iking-web-ui-pro 0.2.22 → 0.2.25

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.
Files changed (72) hide show
  1. package/dist/IKExpandCollapse/ik.index.es.js +77 -82
  2. package/dist/IKExpandCollapse/ik.index.umd.js +1 -1
  3. package/dist/IKExpandCollapse/style.css +1 -1
  4. package/dist/IKPreviewFile/ik.index.es.js +727 -745
  5. package/dist/IKPreviewFile/ik.index.umd.js +46 -46
  6. package/dist/IKPreviewFile/style.css +1 -1
  7. package/dist/IKSearch/ik.index.es.js +41 -33
  8. package/dist/IKSearch/ik.index.umd.js +1 -1
  9. package/dist/IKSearch/style.css +1 -1
  10. package/dist/IKVerticalStepBar/ik.index.es.js +125 -130
  11. package/dist/IKVerticalStepBar/ik.index.umd.js +3 -3
  12. package/dist/IKVerticalStepBar/style.css +1 -1
  13. package/dist/IkApprovalProcess/ik.index.es.js +167 -159
  14. package/dist/IkApprovalProcess/ik.index.umd.js +1 -1
  15. package/dist/IkApprovalProcess/style.css +1 -1
  16. package/dist/IkApprovalProcessDetail/ik.index.es.js +659 -677
  17. package/dist/IkApprovalProcessDetail/ik.index.umd.js +47 -47
  18. package/dist/IkApprovalProcessDetail/style.css +1 -1
  19. package/dist/IkBaseDialog/ik.index.es.js +112 -130
  20. package/dist/IkBaseDialog/ik.index.umd.js +1 -1
  21. package/dist/IkBaseDialog/style.css +1 -1
  22. package/dist/IkBtnSetting/ik.index.es.js +237 -242
  23. package/dist/IkBtnSetting/ik.index.umd.js +1 -1
  24. package/dist/IkBtnSetting/style.css +1 -1
  25. package/dist/IkCalendar/ik.index.es.js +73 -65
  26. package/dist/IkCalendar/ik.index.umd.js +1 -1
  27. package/dist/IkCalendar/style.css +1 -1
  28. package/dist/IkCollapseCard/ik.index.es.js +78 -83
  29. package/dist/IkCollapseCard/ik.index.umd.js +1 -1
  30. package/dist/IkCollapseCard/style.css +1 -1
  31. package/dist/IkDescription/ik.index.es.js +902 -920
  32. package/dist/IkDescription/ik.index.umd.js +45 -45
  33. package/dist/IkDescription/style.css +1 -1
  34. package/dist/IkDetailPreviewFiles/ik.index.es.js +613 -631
  35. package/dist/IkDetailPreviewFiles/ik.index.umd.js +45 -45
  36. package/dist/IkDetailPreviewFiles/style.css +1 -1
  37. package/dist/IkIconPicker/ik.index.es.js +135 -140
  38. package/dist/IkIconPicker/ik.index.umd.js +1 -1
  39. package/dist/IkIconPicker/style.css +1 -1
  40. package/dist/IkMonacoEditor/ik.index.es.js +378 -383
  41. package/dist/IkMonacoEditor/ik.index.umd.js +3 -3
  42. package/dist/IkMonacoEditor/style.css +1 -1
  43. package/dist/IkPageFull/ik.index.es.js +1305 -1302
  44. package/dist/IkPageFull/ik.index.umd.js +2 -2
  45. package/dist/IkPageFull/style.css +1 -1
  46. package/dist/IkPickerUser/ik.index.es.js +41 -33
  47. package/dist/IkPickerUser/ik.index.umd.js +1 -1
  48. package/dist/IkPickerUser/style.css +1 -1
  49. package/dist/IkPreviewFileDialog/ik.index.es.js +687 -705
  50. package/dist/IkPreviewFileDialog/ik.index.umd.js +47 -47
  51. package/dist/IkPreviewFileDialog/style.css +1 -1
  52. package/dist/IkSchedule/ik.index.es.js +2955 -2960
  53. package/dist/IkSchedule/ik.index.umd.js +1 -1
  54. package/dist/IkSchedule/style.css +1 -1
  55. package/dist/IkSideText/ik.index.es.js +106 -111
  56. package/dist/IkSideText/ik.index.umd.js +1 -1
  57. package/dist/IkSideText/style.css +1 -1
  58. package/dist/IkSvgIcon/ik.index.es.js +69 -74
  59. package/dist/IkSvgIcon/ik.index.umd.js +1 -1
  60. package/dist/IkSvgIcon/style.css +1 -1
  61. package/dist/IkUploadFile/ik.index.es.js +761 -779
  62. package/dist/IkUploadFile/ik.index.umd.js +45 -45
  63. package/dist/IkUploadFile/style.css +1 -1
  64. package/dist/IkUploadImage/ik.index.es.js +218 -223
  65. package/dist/IkUploadImage/ik.index.umd.js +1 -1
  66. package/dist/IkUploadImage/style.css +1 -1
  67. package/dist/index.es.js +7089 -7099
  68. package/dist/index.umd.js +89 -89
  69. package/dist/src/components/IkSvgIcon/index.d.ts +2 -6
  70. package/dist/src/components/IkSvgIcon/src/index.vue.d.ts +2 -6
  71. package/dist/style.css +1 -1
  72. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- (function(ie,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("vue"),require("iking-utils-pro"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","iking-utils-pro","element-plus"],p):(ie=typeof globalThis<"u"?globalThis:ie||self,p(ie.index={},ie.vue,ie["iking-utils-pro"],ie["element-plus"]))})(this,function(ie,p,st,Zi){"use strict";const Re=(a,o)=>{if(a.install=r=>{for(const t of[a,...Object.values(o??{})])r.component(t.name,t)},o)for(const[r,t]of Object.entries(o))a[r]=t;return a},ot=(a,o)=>o?o.startsWith("http")?o:`${a||location.origin}${o}`:"",zt=(a,o)=>{var i,n,s,l;const r=(i=a==null?void 0:a.response)!=null&&i.data?jt((s=(n=a==null?void 0:a.response)==null?void 0:n.data)==null?void 0:s.suffix):((l=a.raw)==null?void 0:l.type)||jt(a[o.suffix]),t=r==null?void 0:r.toLowerCase(),e={sheet:"excel",excel:"excel",zip:"zip","application/x-compressed":"zip",image:"image",video:"video",audio:"audio",pdf:"pdf",text:"txt",txt:"txt",word:"word",ppt:"ppt",exe:"exe",json:"json"};for(let u in e)if(typeof t=="string"&&(t.includes(u)||t===u))return e[u];return"unknown"},Ji={".doc":"word",".docx":"word",".docxf":"word",".docm":"word",".dot":"word",".dotm":"word",".dotx":"word",".epub":"word",".fodt":"word",".htm":"word",".html":"word",".mht":"word",".odt":"word",".ott":"word",".rtf":"word",".djvu":"word",".oxps":"word",".oform":"word",".fb2":"word",".xml":"word",".xps":"word",".csv":"excel",".xls":"excel",".xlsx":"excel",".fods":"excel",".ods":"excel",".ots":"excel",".xlsb":"excel",".xlsm":"excel",".xlt":"excel",".xltm":"excel",".xltx":"excel",".fodp":"ppt",".odp":"ppt",".otp":"ppt",".pot":"ppt",".potm":"ppt",".potx":"ppt",".pps":"ppt",".ppsm":"ppt",".ppsx":"ppt",".ppt":"ppt",".pptm":"ppt",".pptx":"ppt",".zip":"zip",".rar":"zip",".7z":"zip",".apz":"zip",".ar":"zip",".bz":"zip",".car":"zip",".dar":"zip",".cpgz":"zip",".f":"zip",".ha":"zip",".hbc":"zip",".hbc2":"zip",".hbe":"zip",".hpk":"zip",".hyp":"zip",".png":"image",".jpg":"image",".jpeg":"image",".bmp":"image",".gif":"image",".webp":"image",".psd":"image",".svg":"image",".tiff":"image",".avi":"video",".wmv":"video",".mpeg":"video",".mp4":"video",".mpm4v":"video",".mov":"video",".asf":"video",".flv":"video",".f4v":"video",".rmvb":"video",".rm":"video",".3gp":"video",".vob":"video",".txt":"txt",".pdf":"pdf"},jt=a=>{const o=a==null?void 0:a.toLocaleLowerCase(),r=o!=null&&o.startsWith(".")?o:`.${o}`;return r&&Ji[r]||"unknow"},Qi=a=>{let o="",r=["doc","docx"],t=["xls","xlsx"],e=["ppt","pptx"],i=["pdf"];return r.includes(a)&&(o="word"),t.includes(a)&&(o="cell"),e.includes(a)&&(o="slide"),i.includes(a)&&(o="text-pdf"),o};/*! Element Plus Icons Vue v2.3.1 */var en=p.defineComponent({name:"Close",__name:"close",setup(a){return(o,r)=>(p.openBlock(),p.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[p.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),tn=en;const He=(a,o)=>{const r=a.__vccOpts||a;for(const[t,e]of o)r[t]=e;return r},nn=a=>{const o=p.inject("loadUrl"),r=p.computed(()=>a.loadUrl||a.fileUrl||(o==null?void 0:o.value)),t=p.inject("uploadUrl"),e=p.computed(()=>a.action||a.uploadUrl||(t==null?void 0:t.value)),i=p.inject("token"),n=p.computed(()=>a.token||(i==null?void 0:i.value)),s=p.inject("onlyofficeConfig"),l=p.computed(()=>a.onlyofficeConfig||(s==null?void 0:s.value)),u=p.inject("userInfo"),c=p.computed(()=>a.userInfo||(u==null?void 0:u.value));return{cLoadUrl:r,cUploadUrl:e,cToken:n,cOnlyofficeConfig:l,cUserInfo:c}},rn={key:0,class:"ik-svg-icon ik-icon-span inline-block inline-flex justify-center box-content line-height-[0]"},sn={key:1,class:"h-[1em] w-[1em]","aria-hidden":"true"},on=["xlink:href"],an=["src"],ln={key:1,class:"h-[1em] w-[1em]","aria-hidden":"true"},un=["xlink:href"],cn=["src"],fn=p.defineComponent({name:"IkSvgIcon",__name:"index",props:{active:{type:Boolean,default:!1},bg:{type:Boolean,default:!1},color:{},colorLight:{},disabled:{type:Boolean,default:!1},error:{type:Boolean},flip:{},name:{},notip:{type:Boolean,default:!1},opacity:{default:.5},padding:{default:"6px"},primary:{type:Boolean},rotate:{},showBg:{type:Boolean,default:!1},size:{default:""},success:{type:Boolean},tableIconType:{},title:{},type:{},warning:{type:Boolean},width:{}},emits:["click"],setup(a,{emit:o}){const r=a,t=p.computed(()=>r),e=p.computed(()=>{const{name:l}=t.value;return/^http?:\/\//.test(l)?"img":/i-[^:]+:[^:]+/.test(l)?"unocss":l!=null&&l.startsWith("iksig")?"iksig":l!=null&&l.includes(":")?"iconify":l!=null&&l.startsWith("iksvg")?"svg":"i"}),i=p.computed(()=>{const l=[];if(t.value.flip)switch(t.value.flip){case"horizontal":l.push("rotateY(180deg)");break;case"vertical":l.push("rotateX(180deg)");break;case"both":l.push("rotateX(180deg)"),l.push("rotateY(180deg)");break}t.value.rotate&&l.push(`rotate(${t.value.rotate%360}deg)`);const u={...t.value.color&&{color:t.value.color},...t.value.size&&{fontSize:typeof t.value.size=="number"?`${t.value.size}px`:t.value.size},...l.length&&{transform:l.join(" ")},padding:t.value.showBg||t.value.bg?t.value.padding:0,...t.value.color&&e.value!=="iksig"?{"--ik-color-icon-dark":t.value.color,"--ik-color-icon-light":t.value.colorLight||st.ikColor.setOpacity(t.value.color,t.value.opacity)}:{}};return t.value.width&&(u.width=u.height=typeof t.value.width=="number"?`${t.value.width}px`:t.value.width),u}),n=o,s=l=>{t.value.disabled||n("click",l)};return(l,u)=>{const c=p.resolveComponent("el-tooltip"),h=p.resolveComponent("el-button");return t.value.tableIconType==="icon"||!t.value.tableIconType?(p.openBlock(),p.createElementBlock("span",rn,[t.value.notip||!t.value.title?(p.openBlock(),p.createElementBlock("i",{key:0,onClick:p.withModifiers(s,["stop"]),class:p.normalizeClass(["ik-svg-icon ik-icon relative h-[1em] w-[1em] inline-flex items-center justify-center fill-current leading-[1em] transition",{[l.name]:e.value==="unocss","show-bg":t.value.showBg||t.value.bg,default:t.value.size==="default",small:t.value.size==="small",big:t.value.size==="big",warning:t.value.warning||t.value.type==="warning",primary:t.value.primary||t.value.type==="primary",success:l.success||t.value.type==="success",error:t.value.error||t.value.type==="error",active:t.value.active,disabled:t.value.disabled}]),style:p.normalizeStyle(i.value)},[p.createCommentVNode(` <Icon v-if="outputType === 'iconify'" :icon="name" /> `),e.value==="iksig"?(p.openBlock(),p.createElementBlock("i",{key:0,class:p.normalizeClass(`iksig ${t.value.name}`),style:p.normalizeStyle(i.value)},null,6)):e.value==="svg"?(p.openBlock(),p.createElementBlock("svg",sn,[p.createElementVNode("use",{"xlink:href":`#${t.value.name}`},null,8,on)])):e.value==="img"?(p.openBlock(),p.createElementBlock("img",{key:2,src:t.value.name,class:"h-[1em] w-[1em]"},null,8,an)):(p.openBlock(),p.createElementBlock("i",{key:3,class:p.normalizeClass(t.value.name),style:p.normalizeStyle(i.value)},null,6))],6)):(p.openBlock(),p.createBlock(c,{key:1,content:t.value.title,placement:"top"},{default:p.withCtx(()=>[p.createElementVNode("i",{class:p.normalizeClass(["ik-svg-icon ik-icon relative h-[1em] w-[1em] inline-flex items-center justify-center fill-current leading-[1em] transition",{[l.name]:e.value==="unocss","show-bg":t.value.showBg||t.value.bg,default:t.value.size==="default",small:t.value.size==="small",big:t.value.size==="big",warning:t.value.warning||t.value.type==="warning",primary:l.primary||t.value.type==="primary",success:l.success||t.value.type==="success",error:t.value.error||t.value.type==="error",active:t.value.active}]),onClick:p.withModifiers(s,["stop"]),style:p.normalizeStyle(i.value)},[e.value==="iksig"?(p.openBlock(),p.createElementBlock("i",{key:0,class:p.normalizeClass(`iksig ${t.value.name}`),style:p.normalizeStyle(i.value)},null,6)):e.value==="svg"?(p.openBlock(),p.createElementBlock("svg",ln,[p.createElementVNode("use",{"xlink:href":`#${t.value.name}`},null,8,un)])):e.value==="img"?(p.openBlock(),p.createElementBlock("img",{key:2,src:t.value.name,class:"h-[1em] w-[1em]"},null,8,cn)):(p.openBlock(),p.createElementBlock("i",{key:3,class:p.normalizeClass(t.value.name),style:p.normalizeStyle(i.value)},null,6))],6)]),_:1},8,["content"]))])):(p.openBlock(),p.createBlock(h,{key:1,type:["warning","error"].includes(t.value.type)?"danger":"",onClick:p.withModifiers(s,["stop"])},{default:p.withCtx(()=>[p.createTextVNode(p.toDisplayString(t.value.title),1)]),_:1},8,["type"]))}}}),js="",at=Re(He(fn,[["__scopeId","data-v-4a1004b9"]])),hn={key:0,class:"exit-main-page-maximize"},dn=p.defineComponent({__name:"CloseIcon",props:{showBg:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1}},setup(a){return(o,r)=>(p.openBlock(),p.createElementBlock("div",null,[a.showBg&&a.fullscreen?(p.openBlock(),p.createElementBlock("div",hn,[p.createVNode(p.unref(at),{name:"iksvg_guanbidanchuang",title:"关闭",size:20,error:""})])):(p.openBlock(),p.createBlock(p.unref(at),{key:1,error:"",name:"iksvg_guanbidanchuang",title:"关闭",size:20}))]))}}),Gs="",gn=He(dn,[["__scopeId","data-v-79f49df8"]]),pn={class:"base-header"},vn=p.defineComponent({__name:"IkBaseDialog",props:p.mergeModels({title:{default:""},cancelText:{default:"取消"},confirmText:{default:"确认"},noHeader:{type:Boolean},noFooter:{type:Boolean},showCloseBg:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1,noHeader:!1,noFooter:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=a,r=p.useModel(a,"modelValue"),t=p.ref(o.fullscreen),e=()=>{t.value=!t.value},i=p.defineComponent({setup(){return()=>p.h(gn,{showBg:o.showCloseBg,fullscreen:o.fullscreen})}});return(n,s)=>{const l=p.resolveComponent("el-dialog");return p.openBlock(),p.createBlock(l,p.mergeProps({modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=u=>r.value=u)},n.$attrs,{"close-icon":p.unref(i),class:`ik-base-dialog ${n.noHeader?"no-header":""} ${n.noFooter?"no-footer":""}`,fullscreen:t.value,"modal-class":"baseDialog"}),p.createSlots({icon:p.withCtx(()=>[p.renderSlot(n.$slots,"title",{},()=>[p.createTextVNode(p.toDisplayString(n.title),1)])]),header:p.withCtx(()=>[p.createElementVNode("div",pn,[p.renderSlot(n.$slots,"header",{},()=>[p.createTextVNode(p.toDisplayString(n.title),1)])]),n.$attrs.showClose?(p.openBlock(),p.createBlock(p.unref(at),{key:0,onClick:e,name:t.value?"iksvg_tuichuquanping":"iksvg_quanping-daohang",class:"absolute! top-[18px] right-[50px] icon-dialog-full",title:t.value?"退出全屏":"全屏"},null,8,["name","title"])):p.createCommentVNode("v-if",!0)]),default:p.withCtx(()=>[p.renderSlot(n.$slots,"default")]),_:2},[n.$slots.footer?{name:"footer",fn:p.withCtx(()=>[p.renderSlot(n.$slots,"footer")]),key:"0"}:void 0]),1040,["modelValue","close-icon","class","fullscreen"])}}}),Ks="",mn=Re(vn);var yn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lt(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function _n(a,o,r,t){function e(i){return i instanceof r?i:new r(function(n){n(i)})}return new(r||(r=Promise))(function(i,n){function s(c){try{u(t.next(c))}catch(h){n(h)}}function l(c){try{u(t.throw(c))}catch(h){n(h)}}function u(c){c.done?i(c.value):e(c.value).then(s,l)}u((t=t.apply(a,o||[])).next())})}function Cn(a,o){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,e,i,n;return n={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function s(u){return function(c){return l([u,c])}}function l(u){if(t)throw new TypeError("Generator is already executing.");for(;n&&(n=0,u[0]&&(r=0)),r;)try{if(t=1,e&&(i=u[0]&2?e.return:u[0]?e.throw||((i=e.return)&&i.call(e),0):e.next)&&!(i=i.call(e,u[1])).done)return i;switch(e=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,e=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=o.call(a,r)}catch(c){u=[6,c],e=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var kn=function(a,o){return _n(void 0,void 0,void 0,function(){return Cn(this,function(r){return[2,new Promise(function(t,e){try{if(window.DocsAPI)return t(null);var i=document.getElementById(o);if(i)var n=setInterval(function(){var l=i.getAttribute("loading");if(!l){if(clearInterval(n),window.DocsAPI)return t(null);var u=Wt(o,a,t,e);i.remove(),document.body.appendChild(u)}},500);else{var s=Wt(o,a,t,e);document.body.appendChild(s)}}catch(l){console.error(l)}})]})})},Wt=function(a,o,r,t){var e=document.createElement("script");return e.id=a,e.type="text/javascript",e.src=o,e.async=!0,e.onload=function(){e.removeAttribute("loading"),r(null)},e.onerror=function(i){e.removeAttribute("loading"),t(i)},e.setAttribute("loading",""),e},ut=p.defineComponent({name:"DocumentEditor",props:{id:{type:String,required:!0},documentServerUrl:{type:String,required:!0},config:{type:Object,required:!0},document_fileType:String,document_title:String,documentType:String,editorConfig_lang:String,height:String,type:String,width:String,onLoadComponentError:Function,events_onAppReady:Function,events_onDocumentStateChange:Function,events_onMetaChange:Function,events_onDocumentReady:Function,events_onInfo:Function,events_onWarning:Function,events_onError:Function,events_onRequestSharingSettings:Function,events_onRequestRename:Function,events_onMakeActionLink:Function,events_onRequestInsertImage:Function,events_onRequestSaveAs:Function,events_onRequestMailMergeRecipients:Function,events_onRequestCompareFile:Function,events_onRequestEditRights:Function,events_onRequestHistory:Function,events_onRequestHistoryClose:Function,events_onRequestHistoryData:Function,events_onRequestRestore:Function,events_onRequestSelectSpreadsheet:Function,events_onRequestSelectDocument:Function},mounted:function(){var a=this,o=this.documentServerUrl;o.endsWith("/")||(o+="/");var r="".concat(o,"web-apps/apps/api/documents/api.js");kn(r,"onlyoffice-api-script").then(function(){return a.onLoad()}).catch(function(){a.onError(-2)})},unmounted:function(){var a,o=this.id||"";!((a=window==null?void 0:window.DocEditor)===null||a===void 0)&&a.instances[o]&&(window.DocEditor.instances[o].destroyEditor(),window.DocEditor.instances[o]=void 0)},watch:{config:{handler:function(a,o){this.onChangeProps()},deep:!0},document_fileType:function(a,o){this.onChangeProps()},document_title:function(a,o){this.onChangeProps()},documentType:function(a,o){this.onChangeProps()},editorConfig_lang:function(a,o){this.onChangeProps()},height:function(a,o){this.onChangeProps()},type:function(a,o){this.onChangeProps()},width:function(a,o){this.onChangeProps()}},methods:{onLoad:function(){var a,o;try{var r=this.id||"";if(window.DocsAPI||this.onError(-3),!((a=window==null?void 0:window.DocEditor)===null||a===void 0)&&a.instances[r]){console.log("Skip loading. Instance already exists",r);return}!((o=window==null?void 0:window.DocEditor)===null||o===void 0)&&o.instances||(window.DocEditor={instances:{}});var t=Object.assign({document:{fileType:this.document_fileType,title:this.document_title},documentType:this.documentType,editorConfig:{lang:this.editorConfig_lang},events:{onAppReady:this.onAppReady,onDocumentStateChange:this.events_onDocumentStateChange,onMetaChange:this.events_onMetaChange,onDocumentReady:this.events_onDocumentReady,onInfo:this.events_onInfo,onWarning:this.events_onWarning,onError:this.events_onError,onRequestSharingSettings:this.events_onRequestSharingSettings,onRequestRename:this.events_onRequestRename,onMakeActionLink:this.events_onMakeActionLink,onRequestInsertImage:this.events_onRequestInsertImage,onRequestSaveAs:this.events_onRequestSaveAs,onRequestMailMergeRecipients:this.events_onRequestMailMergeRecipients,onRequestCompareFile:this.events_onRequestCompareFile,onRequestEditRights:this.events_onRequestEditRights,onRequestHistory:this.events_onRequestHistory,onRequestHistoryClose:this.events_onRequestHistoryClose,onRequestHistoryData:this.events_onRequestHistoryData,onRequestRestore:this.events_onRequestRestore,onRequestSelectSpreadsheet:this.events_onRequestSelectSpreadsheet,onRequestSelectDocument:this.events_onRequestSelectDocument},height:this.height,type:this.type,width:this.width},this.config||{}),e=window.DocsAPI.DocEditor(r,t);window.DocEditor.instances[r]=e}catch(i){console.error(i),this.onError(-1)}},onError:function(a){var o;switch(a){case-2:o="Error load DocsAPI from "+this.documentServerUrl;break;case-3:o="DocsAPI is not defined";break;default:o="Unknown error loading component",a=-1}typeof this.onLoadComponentError>"u"?console.error(o):this.onLoadComponentError(a,o)},onAppReady:function(){var a=this.id||"";this.events_onAppReady(window.DocEditor.instances[a])},onChangeProps:function(){var a,o=this.id||"";!((a=window==null?void 0:window.DocEditor)===null||a===void 0)&&a.instances[o]&&(window.DocEditor.instances[o].destroyEditor(),window.DocEditor.instances[o]=void 0,console.log("Important props have been changed. Load new Editor."),this.onLoad())}}});const bn=["id"];function Tn(a,o,r,t,e,i){return p.openBlock(),p.createElementBlock("div",{id:a.id},null,8,bn)}ut.render=Tn,ut.__file="src/components/DocumentEditor.vue";const wn=p.defineComponent({__name:"IkOnlyOffice",props:{documentServerUrl:{type:String,default:""},configOptions:{type:Object,default:()=>{}},officeHeight:{type:String,default:"100%"}},setup(a){const o=a,r=p.ref({width:"100%",height:"100%",...o.configOptions||{},...o.configOptions}),t=()=>{console.info("文档加载完成",o.configOptions)};return(e,i)=>(p.openBlock(),p.createElementBlock("div",{style:p.normalizeStyle({height:o.officeHeight})},[p.createVNode(p.unref(ut),{id:`${new Date().getTime()}`,ref:"editorRef","document-server-url":a.documentServerUrl,config:r.value,events_onDocumentReady:t},null,8,["id","document-server-url","config"])],4))}}),Ys="",En=Re(He(wn,[["__scopeId","data-v-98d51ef9"]]));function Gt(a,o){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);o&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})),r.push.apply(r,t)}return r}function V(a){for(var o=1;o<arguments.length;o++){var r=arguments[o]!=null?arguments[o]:{};o%2?Gt(Object(r),!0).forEach(function(t){_(a,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):Gt(Object(r)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(r,t))})}return a}function W(a){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},W(a)}function E(a,o){if(!(a instanceof o))throw new TypeError("Cannot call a class as a function")}function Kt(a,o){for(var r=0;r<o.length;r++){var t=o[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,Yt(t.key),t)}}function S(a,o,r){return o&&Kt(a.prototype,o),r&&Kt(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}function _(a,o,r){return o=Yt(o),o in a?Object.defineProperty(a,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[o]=r,a}function x(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(o&&o.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),o&&ct(a,o)}function I(a){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},I(a)}function ct(a,o){return ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ct(a,o)}function Sn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function m(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function ft(a,o){if(o&&(typeof o=="object"||typeof o=="function"))return o;if(o!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(a)}function P(a){var o=Sn();return function(){var t=I(a),e;if(o){var i=I(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ft(this,e)}}function xn(a,o){for(;!Object.prototype.hasOwnProperty.call(a,o)&&(a=I(a),a!==null););return a}function A(){return typeof Reflect<"u"&&Reflect.get?A=Reflect.get.bind():A=function(o,r,t){var e=xn(o,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?o:t):i.value}},A.apply(this,arguments)}function J(a){return Pn(a)||In(a)||An(a)||Ln()}function Pn(a){if(Array.isArray(a))return ht(a)}function In(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function An(a,o){if(a){if(typeof a=="string")return ht(a,o);var r=Object.prototype.toString.call(a).slice(8,-1);if(r==="Object"&&a.constructor&&(r=a.constructor.name),r==="Map"||r==="Set")return Array.from(a);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ht(a,o)}}function ht(a,o){(o==null||o>a.length)&&(o=a.length);for(var r=0,t=new Array(o);r<o;r++)t[r]=a[r];return t}function Ln(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dn(a,o){if(typeof a!="object"||a===null)return a;var r=a[Symbol.toPrimitive];if(r!==void 0){var t=r.call(a,o||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(a)}function Yt(a){var o=Dn(a,"string");return typeof o=="symbol"?o:String(o)}var $t={exports:{}};(function(a){var o=Object.prototype.hasOwnProperty,r="~";function t(){}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(r=!1));function e(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function i(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var g=new e(c,h||l,d),v=r?r+u:u;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],g]:l._events[v].push(g):(l._events[v]=g,l._eventsCount++),l}function n(l,u){--l._eventsCount===0?l._events=new t:delete l._events[u]}function s(){this._events=new t,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)o.call(c,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},s.prototype.listeners=function(u){var c=r?r+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,g=h.length,v=new Array(g);d<g;d++)v[d]=h[d].fn;return v},s.prototype.listenerCount=function(u){var c=r?r+u:u,h=this._events[c];return h?h.fn?1:h.length:0},s.prototype.emit=function(u,c,h,d,g,v){var y=r?r+u:u;if(!this._events[y])return!1;var C=this._events[y],b=arguments.length,w,T;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),b){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,c),!0;case 3:return C.fn.call(C.context,c,h),!0;case 4:return C.fn.call(C.context,c,h,d),!0;case 5:return C.fn.call(C.context,c,h,d,g),!0;case 6:return C.fn.call(C.context,c,h,d,g,v),!0}for(T=1,w=new Array(b-1);T<b;T++)w[T-1]=arguments[T];C.fn.apply(C.context,w)}else{var B=C.length,O;for(T=0;T<B;T++)switch(C[T].once&&this.removeListener(u,C[T].fn,void 0,!0),b){case 1:C[T].fn.call(C[T].context);break;case 2:C[T].fn.call(C[T].context,c);break;case 3:C[T].fn.call(C[T].context,c,h);break;case 4:C[T].fn.call(C[T].context,c,h,d);break;default:if(!w)for(O=1,w=new Array(b-1);O<b;O++)w[O-1]=arguments[O];C[T].fn.apply(C[T].context,w)}}return!0},s.prototype.on=function(u,c,h){return i(this,u,c,h,!1)},s.prototype.once=function(u,c,h){return i(this,u,c,h,!0)},s.prototype.removeListener=function(u,c,h,d){var g=r?r+u:u;if(!this._events[g])return this;if(!c)return n(this,g),this;var v=this._events[g];if(v.fn)v.fn===c&&(!d||v.once)&&(!h||v.context===h)&&n(this,g);else{for(var y=0,C=[],b=v.length;y<b;y++)(v[y].fn!==c||d&&!v[y].once||h&&v[y].context!==h)&&C.push(v[y]);C.length?this._events[g]=C.length===1?C[0]:C:n(this,g)}return this},s.prototype.removeAllListeners=function(u){var c;return u?(c=r?r+u:u,this._events[c]&&n(this,c)):(this._events=new t,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,a.exports=s})($t);var Xt=$t.exports;const qt=lt(Xt);var Rn=typeof window<"u"&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,dt={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},gt="%c[xgplayer]",R={config:{debug:Rn?3:0},logInfo:function(o){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];this.config.debug>=3&&(r=console).log.apply(r,[gt,dt.info,o].concat(e))},logWarn:function(o){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];this.config.debug>=1&&(r=console).warn.apply(r,[gt,dt.warn,o].concat(e))},logError:function(o){var r;if(!(this.config.debug<1)){for(var t=this.config.debug>=2?"trace":"error",e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];(r=console)[t].apply(r,[gt,dt.error,o].concat(i))}}};function On(a){a.logInfo=R.logInfo.bind(a),a.logWarn=R.logWarn.bind(a),a.logError=R.logError.bind(a)}var Mn=function(){function a(o){E(this,a),this.bufferedList=o}return S(a,[{key:"start",value:function(r){return this.bufferedList[r].start}},{key:"end",value:function(r){return this.bufferedList[r].end}},{key:"length",get:function(){return this.bufferedList.length}}]),a}(),f={};f.createDom=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"div",o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",e=document.createElement(a);return e.className=t,e.innerHTML=o,Object.keys(r).forEach(function(i){var n=i,s=r[i];a==="video"||a==="audio"||a==="live-video"?s&&e.setAttribute(n,s):e.setAttribute(n,s)}),e},f.createDomFromHtml=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";try{var t=document.createElement("div");t.innerHTML=a;var e=t.children;return t=null,e.length>0?(e=e[0],r&&f.addClass(e,r),o&&Object.keys(o).forEach(function(i){e.setAttribute(i,o[i])}),e):null}catch(i){return R.logError("util.createDomFromHtml",i),null}},f.hasClass=function(a,o){if(!a||!o)return!1;try{return Array.prototype.some.call(a.classList,function(t){return t===o})}catch{var r=a.className&&W(a.className)==="object"?a.getAttribute("class"):a.className;return r&&!!r.match(new RegExp("(\\s|^)"+o+"(\\s|$)"))}},f.addClass=function(a,o){if(!(!a||!o))try{o.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&a.classList.add(r)})}catch{f.hasClass(a,o)||(a.className&&W(a.className)==="object"?a.setAttribute("class",a.getAttribute("class")+" "+o):a.className+=" "+o)}},f.removeClass=function(a,o){if(!(!a||!o))try{o.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&a.classList.remove(r)})}catch{f.hasClass(a,o)&&o.split(/\s+/g).forEach(function(t){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");a.className&&W(a.className)==="object"?a.setAttribute("class",a.getAttribute("class").replace(e," ")):a.className=a.className.replace(e," ")})}},f.toggleClass=function(a,o){a&&o.split(/\s+/g).forEach(function(r){f.hasClass(a,r)?f.removeClass(a,r):f.addClass(a,r)})},f.classNames=function(){for(var a=arguments,o=[],r=function(i){f.typeOf(a[i])==="String"?o.push(a[i]):f.typeOf(a[i])==="Object"&&Object.keys(a[i]).map(function(n){a[i][n]&&o.push(n)})},t=0;t<arguments.length;t++)r(t);return o.join(" ")},f.findDom=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,o=arguments.length>1?arguments[1]:void 0,r;try{r=a.querySelector(o)}catch(t){R.logError("util.findDom",t),o.indexOf("#")===0&&(r=a.getElementById(o.slice(1)))}return r},f.getCss=function(a,o){return a.currentStyle?a.currentStyle[o]:document.defaultView.getComputedStyle(a,!1)[o]},f.padStart=function(a,o,r){for(var t=String(r),e=o>>0,i=Math.ceil(e/t.length),n=[],s=String(a);i--;)n.push(t);return n.join("").substring(0,e-s.length)+s},f.format=function(a){if(window.isNaN(a))return"";a=Math.round(a);var o=f.padStart(Math.floor(a/3600),2,0),r=f.padStart(Math.floor((a-o*3600)/60),2,0),t=f.padStart(Math.floor(a-o*3600-r*60),2,0);return(o==="00"?[r,t]:[o,r,t]).join(":")},f.event=function(a){if(a.touches){var o=a.touches[0]||a.changedTouches[0];a.clientX=o.clientX||0,a.clientY=o.clientY||0,a.offsetX=o.pageX-o.target.offsetLeft,a.offsetY=o.pageY-o.target.offsetTop}a._target=a.target||a.srcElement},f.typeOf=function(a){return Object.prototype.toString.call(a).match(/([^\s.*]+)(?=]$)/g)[0]},f.deepCopy=function(a,o){if(f.typeOf(o)==="Object"&&f.typeOf(a)==="Object")return Object.keys(o).forEach(function(r){f.typeOf(o[r])==="Object"&&!(o[r]instanceof Node)?a[r]===void 0||a[r]===void 0?a[r]=o[r]:f.deepCopy(a[r],o[r]):f.typeOf(o[r])==="Array"?a[r]=f.typeOf(a[r])==="Array"?a[r].concat(o[r]):o[r]:a[r]=o[r]}),a},f.deepMerge=function(a,o){return Object.keys(o).map(function(r){if(f.typeOf(o[r])==="Array"&&f.typeOf(a[r])==="Array"){if(f.typeOf(a[r])==="Array"){var t;(t=a[r]).push.apply(t,J(o[r]))}}else f.typeOf(a[r])===f.typeOf(o[r])&&a[r]!==null&&f.typeOf(a[r])==="Object"&&!(o[r]instanceof window.Node)?f.deepMerge(a[r],o[r]):o[r]!==null&&(a[r]=o[r])}),a},f.getBgImage=function(a){var o=(a.currentStyle||window.getComputedStyle(a,null)).backgroundImage;if(!o||o==="none")return"";var r=document.createElement("a");return r.href=o.replace(/url\("|"\)/g,""),r.href},f.copyDom=function(a){if(a&&a.nodeType===1){var o=document.createElement(a.tagName);return Array.prototype.forEach.call(a.attributes,function(r){o.setAttribute(r.name,r.value)}),a.innerHTML&&(o.innerHTML=a.innerHTML),o}else return""},f.setInterval=function(a,o,r,t){a._interval[o]||(a._interval[o]=window.setInterval(r.bind(a),t))},f.clearInterval=function(a,o){clearInterval(a._interval[o]),a._interval[o]=null},f.setTimeout=function(a,o,r){a._timers||(a._timers=[]);var t=setTimeout(function(){o(),f.clearTimeout(a,t)},r);return a._timers.push(t),t},f.clearTimeout=function(a,o){var r=a._timers;if(f.typeOf(r)==="Array"){for(var t=0;t<r.length;t++)if(r[t]===o){r.splice(t,1),clearTimeout(o);break}}else clearTimeout(o)},f.clearAllTimers=function(a){var o=a._timers;f.typeOf(o)==="Array"&&(o.map(function(r){clearTimeout(r)}),a._timerIds=[])},f.createImgBtn=function(a,o,r,t){var e=f.createDom("xg-".concat(a),"",{},"xgplayer-".concat(a,"-img"));if(e.style.backgroundImage='url("'.concat(o,'")'),r&&t){var i,n,s;["px","rem","em","pt","dp","vw","vh","vm","%"].every(function(l){return r.indexOf(l)>-1&&t.indexOf(l)>-1?(i=parseFloat(r.slice(0,r.indexOf(l)).trim()),n=parseFloat(t.slice(0,t.indexOf(l)).trim()),s=l,!1):!0}),e.style.width="".concat(i).concat(s),e.style.height="".concat(n).concat(s),e.style.backgroundSize="".concat(i).concat(s," ").concat(n).concat(s),a==="start"?e.style.margin="-".concat(n/2).concat(s," auto auto -").concat(i/2).concat(s):e.style.margin="auto 5px auto 5px"}return e},f.Hex2RGBA=function(a,o){var r=[];if(/^\#[0-9A-F]{3}$/i.test(a)){var t="#";a.replace(/[0-9A-F]/ig,function(e){t+=e+e}),a=t}return/^#[0-9A-F]{6}$/i.test(a)?(a.replace(/[0-9A-F]{2}/ig,function(e){r.push(parseInt(e,16))}),"rgba(".concat(r.join(","),", ").concat(o,")")):"rgba(255, 255, 255, 0.1)"},f.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},f.checkIsFunction=function(a){return a&&typeof a=="function"},f.checkIsObject=function(a){return a!==null&&W(a)==="object"},f.hide=function(a){a.style.display="none"},f.show=function(a,o){a.style.display=o||"block"},f.isUndefined=function(a){if(typeof a>"u"||a===null)return!0},f.isNotNull=function(a){return a!=null},f.setStyleFromCsstext=function(a,o){if(o)if(f.typeOf(o)==="String"){var r=o.replace(/\s+/g,"").split(";");r.map(function(t){if(t){var e=t.split(":");e.length>1&&(a.style[e[0]]=e[1])}})}else Object.keys(o).map(function(t){a.style[t]=o[t]})};function Nn(a,o){for(var r=0,t=o.length;r<t;r++)if(a.indexOf(o[r])>-1)return!0;return!1}f.filterStyleFromText=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],r=a.style.cssText;if(!r)return{};var t=r.replace(/\s+/g,"").split(";"),e={},i={};return t.map(function(n){if(n){var s=n.split(":");s.length>1&&(Nn(s[0],o)?e[s[0]]=s[1]:i[s[0]]=s[1])}}),a.setAttribute("style",""),Object.keys(i).map(function(n){a.style[n]=i[n]}),e},f.getStyleFromCsstext=function(a){var o=a.style.cssText;if(!o)return{};var r=o.replace(/\s+/g,"").split(";"),t={};return r.map(function(e){if(e){var i=e.split(":");i.length>1&&(t[i[0]]=i[1])}}),t},f.preloadImg=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(a){var t=new window.Image;t.onload=function(e){t=null,o&&o(e)},t.onerror=function(e){t=null,r&&r(e)},t.src=a}},f.stopPropagation=function(a){a&&a.stopPropagation()},f.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},f.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},f.checkTouchSupport=function(){return"ontouchstart"in window},f.getBuffered2=function(a){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.5,r=[],t=0;t<a.length;t++)r.push({start:a.start(t)<.5?0:a.start(t),end:a.end(t)});r.sort(function(l,u){var c=l.start-u.start;return c||u.end-l.end});var e=[];if(o)for(var i=0;i<r.length;i++){var n=e.length;if(n){var s=e[n-1].end;r[i].start-s<o?r[i].end>s&&(e[n-1].end=r[i].end):e.push(r[i])}else e.push(r[i])}else e=r;return new Mn(e)},f.getEventPos=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return a.touches&&a.touches.length>0&&(a=a.touches[0]),{x:a.x/o,y:a.y/o,clientX:a.clientX/o,clientY:a.clientY/o,offsetX:a.offsetX/o,offsetY:a.offsetY/o,pageX:a.pageX/o,pageY:a.pageY/o}},f.requestAnimationFrame=function(a){var o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(o)return o(a)},f.getHostFromUrl=function(a){if(f.typeOf(a)!=="String")return"";var o=a.split("/"),r="";return o.length>3&&o[2]&&(r=o[2]),r},f.cancelAnimationFrame=function(a){var o=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;o&&o(a)},f.isMSE=function(a){return a.media&&(a=a.media),!a||!(a instanceof HTMLMediaElement)?!1:/^blob/.test(a.currentSrc)||/^blob/.test(a.src)},f.isBlob=function(a){return typeof a=="string"&&/^blob/.test(a)},f.generateSessionId=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,o=new Date().getTime();try{a=parseInt(a)}catch{a=0}o+=a,window.performance&&typeof window.performance.now=="function"&&(o+=parseInt(window.performance.now()));var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(o+Math.random()*16)%16|0;return o=Math.floor(o/16),(t==="x"?e:e&3|8).toString(16)});return r},f.createEvent=function(a){var o;return typeof window.Event=="function"?o=new Event(a):(o=document.createEvent("Event"),o.initEvent(a,!0,!0)),o},f.adjustTimeByDuration=function(a,o,r){return!o||!a?a:a>o||r&&a<o?o:a},f.createPositionBar=function(a,o){var r=f.createDom("xg-bar","",{"data-index":-1},a);return o.appendChild(r),r},f.getTransformStyle=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{x:0,y:0,scale:1,rotate:0},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={scale:"".concat(a.scale||1),translate:"".concat(a.x||0,"%, ").concat(a.y||0,"%"),rotate:"".concat(a.rotate||0,"deg")},t=Object.keys(r);return t.forEach(function(e){var i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),n="".concat(e,"(").concat(r[e],")");i.test(o)?(i.lastIndex=-1,o=o.replace(i,n)):o+="".concat(n," ")}),o},f.convertDeg=function(a){return Math.abs(a)<=1?a*360:a%360},f.getIndexByTime=function(a,o){var r=o.length,t=-1;if(r<1)return t;if(a<=o[0].end||r<2)t=0;else if(a>o[r-1].end)t=r-1;else for(var e=1;e<r;e++)if(a>o[e-1].end&&a<=o[e].end){t=e;break}return t},f.getOffsetCurrentTime=function(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,t=-1;if(r>=0&&r<o.length?t=r:t=f.getIndexByTime(a,o),t<0)return-1;var e=o.length,i=o[t],n=i.start,s=i.end,l=i.cTime,u=i.offset;return a<n?l:a>=n&&a<=s?a-u:a>s&&t>=e-1?s:-1},f.getCurrentTimeByOffset=function(a,o){var r=-1;if(!o||o.length<0)return a;for(var t=0;t<o.length;t++)if(a<=o[t].duration){r=t;break}if(r!==-1){var e=o[r].start;return r-1<0?e+a:e+(a-o[r-1].duration)}return a};function Zt(a){var o=W(a);return a!==null&&(o==="object"||o==="function")}function Fn(a,o,r){var t,e,i,n,s,l,u=0,c=!1,h=!1,d=!0,g=!o&&o!==0&&typeof window.requestAnimationFrame=="function";if(typeof a!="function")throw new TypeError("Expected a function");o=+o||0,Zt(r)&&(c=!!r.leading,h="maxWait"in r,i=h?Math.max(+r.maxWait||0,o):i,d="trailing"in r?!!r.trailing:d);function v(N){var Z=t,ee=e;return t=e=void 0,u=N,n=a.apply(ee,Z),n}function y(N,Z){return g?(window.cancelAnimationFrame(s),window.requestAnimationFrame(N)):setTimeout(N,Z)}function C(N){if(g)return window.cancelAnimationFrame(N);clearTimeout(N)}function b(N){return u=N,s=y(B,o),c?v(N):n}function w(N){var Z=N-l,ee=N-u,te=o-Z;return h?Math.min(te,i-ee):te}function T(N){var Z=N-l,ee=N-u;return l===void 0||Z>=o||Z<0||h&&ee>=i}function B(){var N=Date.now();if(T(N))return O(N);s=y(B,w(N))}function O(N){return s=void 0,d&&t?v(N):(t=e=void 0,n)}function U(){s!==void 0&&C(s),u=0,t=l=e=s=void 0}function L(){return s===void 0?n:O(Date.now())}function Y(){return s!==void 0}function j(){for(var N=Date.now(),Z=T(N),ee=arguments.length,te=new Array(ee),Te=0;Te<ee;Te++)te[Te]=arguments[Te];if(t=te,e=this,l=N,Z){if(s===void 0)return b(l);if(h)return s=y(B,o),v(l)}return s===void 0&&(s=y(B,o)),n}return j.cancel=U,j.flush=L,j.pending=Y,j}function Bn(a,o,r){var t=!0,e=!0;if(typeof a!="function")throw new TypeError("Expected a function");return Zt(r)&&(t="leading"in r?!!r.leading:t,e="trailing"in r?!!r.trailing:e),Fn(a,o,{leading:t,trailing:e,maxWait:o})}function Hn(){var a=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return a==="zh-cn"&&(a="zh"),a}function Un(a,o,r){if(a){var t=a.getAttribute(r);return!!(t&&t===o&&(a.tagName==="VIDEO"||a.tagName==="AUDIO"))}}var Jt={android:/(Android)\s([\d.]+)/,ios:/(Version)\/([\d.]+)/},Vn=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],D={get device(){var a=D.os;return a.isPc?"pc":"mobile"},get browser(){if(typeof navigator>"u")return"";var a=navigator.userAgent.toLowerCase(),o={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(o).filter(function(r){return o[r].test(a)}))[0]},get os(){if(typeof navigator>"u")return{};var a=navigator.userAgent,o=/(?:Windows Phone)/.test(a),r=/(?:SymbianOS)/.test(a)||o,t=/(?:Android)/.test(a),e=/(?:Firefox)/.test(a),i=/(?:iPad|PlayBook)/.test(a)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,n=i||t&&!/(?:Mobile)/.test(a)||e&&/(?:Tablet)/.test(a),s=/(?:iPhone)/.test(a)&&!n,l=!s&&!t&&!r&&!n;return{isTablet:n,isPhone:s,isIpad:i,isIos:s||i,isAndroid:t,isPc:l,isSymbian:r,isWindowsPhone:o,isFireFox:e}},get osVersion(){if(typeof navigator>"u")return 0;var a=navigator.userAgent,o="";/(?:iPhone)|(?:iPad|PlayBook)/.test(a)?o=Jt.ios:o=Jt.android;var r=o?o.exec(a):[];if(r&&r.length>=3){var t=r[2].split(".");return t.length>0?parseInt(t[0]):0}return 0},get isWeixin(){if(typeof navigator>"u")return!1;var a=/(micromessenger)\/([\d.]+)/,o=a.exec(navigator.userAgent.toLocaleLowerCase());return!!o},isSupportMP4:function(){var o={isSupport:!1,mime:""};if(typeof document>"u")return o;if(this.supportResult)return this.supportResult;var r=document.createElement("video");return typeof r.canPlayType=="function"&&Vn.map(function(t){r.canPlayType('video/mp4; codecs="'.concat(t,'"'))==="probably"&&(o.isSupport=!0,o.mime+="||".concat(t))}),this.supportResult=o,r=null,o},isMSESupport:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(typeof MediaSource>"u"||!MediaSource)return!1;try{return MediaSource.isTypeSupported(o)}catch(r){return this._logger.error(o,r),!1}},isHevcSupported:function(){return typeof MediaSource>"u"||!MediaSource.isTypeSupported?!1:MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')},probeConfigSupported:function(o){var r={supported:!1,smooth:!1,powerEfficient:!1};if(!o||typeof navigator>"u")return Promise.resolve(r);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(o);var t=o.video||{},e=o.audio||{};try{var i=MediaSource.isTypeSupported(t.contentType),n=MediaSource.isTypeSupported(e.contentType);return Promise.resolve({supported:i&&n,smooth:!1,powerEfficient:!1})}catch{return Promise.resolve(r)}}},pt="3.0.18",Qt={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},ei={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Ue=S(function a(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};E(this,a);var t=o&&o.i18n?o.i18n.ERROR_TYPES:null;if(o.media){var e=r.mediaError?r.mediaError:o.media.error||{},i=o.duration,n=o.currentTime,s=o.ended,l=o.src,u=o.currentSrc,c=o.media,h=c.readyState,d=c.networkState,g=r.errorCode||e.code;ei[g]&&(g=ei[g]);var v={playerVersion:pt,currentTime:n,duration:i,ended:s,readyState:h,networkState:d,src:l||u,errorType:r.errorType,errorCode:g,message:r.errorMessage||e.message,mediaError:e,originError:r.originError?r.originError.stack:"",host:f.getHostFromUrl(l||u)};return r.ext&&Object.keys(r.ext).map(function(w){v[w]=r.ext[w]}),v}else if(arguments.length>1){for(var y={playerVersion:pt,domain:document.domain},C=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],b=0;b<arguments.length;b++)y[C[b]]=arguments[b];return y.ex=t?(t[arguments[0]]||{}).msg:"",y}}),$="play",vt="playing",me="ended",we="pause",Oe="error",Ve="seeking",se="seeked",X="timeupdate",Me="waiting",oe="canplay",zn="canplaythrough",ce="durationchange",ti="volumechange",ae="loadeddata",jn="loadedmetadata",ii="ratechange",ni="progress",mt="loadstart",ye="emptied",Wn="stalled",Gn="suspend",Kn="abort",Yn="bufferedChange",yt="focus",ri="blur",_t="ready",si="urlNull",_e="autoplay_started",Ct="autoplay_was_prevented",ze="complete",je="replay",kt="destroy",We="urlchange",bt="download_speed_change",oi="leaveplayer",ai="enterplayer",li="loading",le="fullscreen_change",Ge="cssFullscreen_change",Ke="mini_state_change",Tt="definition_change",$n="before_definition_change",wt="after_definition_change",Xn="SEI_PARSED",qn="retry",fe="video_resize",Et="pip_change",ui="rotate",ci="screenShot",Ye="playnext",fi="shortcut",hi="xglog",$e="user_action",Xe="reset",di="source_error",gi="source_success",Zn="switch_subtitle",pi=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],vi={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},mi="fps_stuck";const Jn=Object.freeze(Object.defineProperty({__proto__:null,ABORT:Kn,AFTER_DEFINITION_CHANGE:wt,AUTOPLAY_PREVENTED:Ct,AUTOPLAY_STARTED:_e,BEFORE_DEFINITION_CHANGE:$n,BUFFER_CHANGE:Yn,CANPLAY:oe,CANPLAY_THROUGH:zn,COMPLETE:ze,CSS_FULLSCREEN_CHANGE:Ge,DEFINITION_CHANGE:Tt,DESTROY:kt,DOWNLOAD_SPEED_CHANGE:bt,DURATION_CHANGE:ce,EMPTIED:ye,ENDED:me,ENTER_PLAYER:ai,ERROR:Oe,FPS_STUCK:mi,FULLSCREEN_CHANGE:le,LEAVE_PLAYER:oi,LOADED_DATA:ae,LOADED_METADATA:jn,LOADING:li,LOAD_START:mt,MINI_STATE_CHANGE:Ke,PAUSE:we,PIP_CHANGE:Et,PLAY:$,PLAYER_BLUR:ri,PLAYER_FOCUS:yt,PLAYING:vt,PLAYNEXT:Ye,PROGRESS:ni,RATE_CHANGE:ii,READY:_t,REPLAY:je,RESET:Xe,RETRY:qn,ROTATE:ui,SCREEN_SHOT:ci,SEEKED:se,SEEKING:Ve,SEI_PARSED:Xn,SHORTCUT:fi,SOURCE_ERROR:di,SOURCE_SUCCESS:gi,STALLED:Wn,STATS_EVENTS:vi,SUSPEND:Gn,SWITCH_SUBTITLE:Zn,TIME_UPDATE:X,URL_CHANGE:We,URL_NULL:si,USER_ACTION:$e,VIDEO_EVENTS:pi,VIDEO_RESIZE:fe,VOLUME_CHANGE:ti,WAITING:Me,XGLOG:hi},Symbol.toStringTag,{value:"Module"}));function St(a,o){!this||!this.emit||(a==="error"?this.errorHandler(a,o.error):this.emit(a,o))}function Qn(a,o){return function(r,t){var e={player:o,eventName:a,originalEvent:r,detail:r.detail||{},timeStamp:r.timeStamp,currentTime:o.currentTime,duration:o.duration,paused:o.paused,ended:o.ended,isInternalOp:!!o._internalOp[r.type],muted:o.muted,volume:o.volume,host:f.getHostFromUrl(o.currentSrc),vtype:o.vtype};if(o.removeInnerOP(r.type),a==="timeupdate"&&(o._currentTime=o.media&&o.media.currentTime),a==="ratechange"){var i=o.media?o.media.playbackRate:0;if(i&&o._rate===i)return;o._rate=o.media&&o.media.playbackRate}if(a==="durationchange"&&(o._duration=o.media.duration),a==="volumechange"&&(e.isMutedChange=o._lastMuted!==o.muted,o._lastMuted=o.muted),a==="error"&&(e.error=t||o.video.error),o.mediaEventMiddleware[a]){var n=St.bind(o,a,e);try{o.mediaEventMiddleware[a].call(o,e,n)}catch(s){throw St.call(o,a,e),s}}else St.call(o,a,e)}}var er=function(a){x(r,a);var o=P(r);function r(t){var e;E(this,r),e=o.call(this,t),e._hasStart=!1,e._currentTime=0,e._duration=0,e._internalOp={},e._lastMuted=!1,e.vtype="MP4",e._rate=-1,e.mediaConfig=Object.assign({},{controls:!1,autoplay:t.autoplay,playsinline:t.playsinline,"x5-playsinline":t.playsinline,"webkit-playsinline":t.playsinline,"x5-video-player-fullscreen":t["x5-video-player-fullscreen"]||t.x5VideoPlayerFullscreen,"x5-video-orientation":t["x5-video-orientation"]||t.x5VideoOrientation,airplay:t.airplay,"webkit-airplay":t.airplay,tabindex:t.tabindex|0,mediaType:t.mediaType||"video","data-index":-1},t.videoConfig,t.videoAttributes);var i=t["x5-video-player-type"]||t.x5VideoPlayerType;return D.isWeixin&&D.os.isAndroid&&i&&(e.mediaConfig["x5-video-player-type"]=i,delete e.mediaConfig.playsinline,delete e.mediaConfig["webkit-playsinline"],delete e.mediaConfig["x5-playsinline"]),t.loop&&(e.mediaConfig.loop="loop"),t.autoplayMuted&&!Object.prototype.hasOwnProperty.call(e.mediaConfig,"muted")&&(e.mediaConfig.muted=!0),e.media=f.createDom(e.mediaConfig.mediaType,"",e.mediaConfig,""),t.defaultPlaybackRate&&(e.media.defaultPlaybackRate=e.media.playbackRate=t.defaultPlaybackRate),f.typeOf(t.volume)==="Number"&&(e.volume=t.volume),t.autoplayMuted&&(e.media.muted=!0,e._lastMuted=!0),t.autoplay&&(e.media.autoplay=!0),e._interval={},e.mediaEventMiddleware={},e.attachVideoEvents(),e}return S(r,[{key:"setEventsMiddleware",value:function(e){var i=this;Object.keys(e).map(function(n){i.mediaEventMiddleware[n]=e[n]})}},{key:"removeEventsMiddleware",value:function(e){var i=this;Object.keys(e).map(function(n){delete i.mediaEventMiddleware[n]})}},{key:"attachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers||(this._evHandlers=pi.map(function(n){var s="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1));return typeof e[s]=="function"&&e.on(n,e[s]),_({},n,Qn(n,e))})),this._evHandlers.forEach(function(n){var s=Object.keys(n)[0];i.addEventListener(s,n[s],!1)})}},{key:"detachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers.forEach(function(n){var s=Object.keys(n)[0];i.removeEventListener(s,n[s],!1)}),this._evHandlers.forEach(function(n){var s=Object.keys(n)[0],l="on".concat(s.charAt(0).toUpperCase()).concat(s.slice(1));typeof e[l]=="function"&&e.off(s,e[l])}),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,i){var n=this;e.removeAttribute("src"),e.load(),i.forEach(function(h,d){n.media.appendChild(f.createDom("source","",{src:"".concat(h.src),type:"".concat(h.type||""),"data-index":d+1}))});var s=e.children;if(s){this._videoSourceCount=s.length,this._videoSourceIndex=s.length,this._vLoadeddata=function(h){n.emit(gi,{src:h.target.currentSrc,host:f.getHostFromUrl(h.target.currentSrc)})};for(var l=null,u=0;u<this._evHandlers.length;u++)if(Object.keys(this._evHandlers[u])[0]==="error"){l=this._evHandlers[u];break}!this._sourceError&&(this._sourceError=function(h){var d=parseInt(h.target.getAttribute("data-index"),10);if(n._videoSourceIndex--,n._videoSourceIndex===0||d>=n._videoSourceCount){var g={code:4,message:"sources_load_error"};l?l.error(h,g):n.errorHandler("error",g)}var v=Qt[4];n.emit(di,new Ue(n,{errorType:v,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:h.target.src}))});for(var c=0;c<s.length;c++)s[c].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var i=e.children;if(!(!i||i.length===0||!this._sourceError)){for(var n=0;n<i.length;n++)i[n].removeEventListener("error",this._sourceError);for(;i.length>0;)e.removeChild(i[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.media&&(this.media.error||i)){var n=this.media.error||i,s=n.code?Qt[n.code]:"other",l=n.message;this.media.currentSrc||(l="empty_src",n={code:6,message:l}),this.emit(e,new Ue(this,{errorType:s,errorCode:n.code,errorMessage:n.message||"",mediaError:n}))}}},{key:"destroy",value:function(){this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null;for(var e in this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){var e=this.media?this.media.play():null;return e}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return this.media?this.media.canPlayType(e):!1}},{key:"getBufferedRange",value:function(e){var i=[0,0];if(!this.media)return i;e||(e=this.media.buffered);var n=this.media.currentTime;if(e)for(var s=0,l=e.length;s<l&&(i[0]=e.start(s),i[1]=e.end(s),!(i[0]<=n&&n<=i[1]));s++);return i[0]-n<=0&&n-i[1]<=0?i:[0,0]}},{key:"autoplay",get:function(){return this.media?this.media.autoplay:!1},set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?f.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var i=this.media.buffered;if(!i||i.length===0)return e;for(var n=0;n<i.length;n++)if((i.start(n)<=this.currentTime||i.start(n)<.1)&&i.end(n)>=this.currentTime)return{start:i.start(n),end:i.end(n)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?this.media.currentTime!==void 0?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return this.media?this.media.defaultMuted:!1},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return this.media?this.media.ended:!1}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){var e=this.media.error;if(!e)return"";var i=["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"];return i[this.media.error.code-1]}},{key:"loop",get:function(){return this.media?this.media.loop:!1},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return this.media?this.media.muted:!1},set:function(e){!this.media||this.media.muted===e||(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return this.media?this.media.paused:!0}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){!this.media||e===1/0||(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return this.media?this.media.preload:!1},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return this.media?this.media.seekable:!1}},{key:"seeking",get:function(){return this.media?this.media.seeking:!1}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){if(this.media){if(this.emit(We,e),this.emit(Me),this._currentTime=0,this._duration=0,f.isMSE(this.media)){this.onWaiting();return}this._detachSourceEvents(this.media),f.typeOf(e)==="Array"?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()}}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e===1/0||!this.media||(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"emit",this)).call.apply(n,[this,e,i].concat(l))}},{key:"on",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"on",this)).call.apply(n,[this,e,i].concat(l))}},{key:"once",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"once",this)).call.apply(n,[this,e,i].concat(l))}},{key:"off",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"off",this)).call.apply(n,[this,e,i].concat(l))}},{key:"offAll",value:function(){A(I(r.prototype),"removeAllListeners",this).call(this)}}]),r}(qt),tr=function(){function a(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};E(this,a),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=o}return S(a,[{key:"openDB",value:function(r){var t=this,e=this,i=this.myDB.version||1,n=e.indexedDB.open(e.myDB.name,i);n.onerror=function(s){},n.onsuccess=function(s){t.myDB.db=s.target.result,r.call(e)},n.onupgradeneeded=function(s){var l=s.target.result;s.target.transaction,l.objectStoreNames.contains(e.myDB.ojstore.name)||l.createObjectStore(e.myDB.ojstore.name,{keyPath:e.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){var r=this;r.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,n=0;n<t.length;n++)i=e.add(t[n]),i.onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,n=0;n<t.length;n++)i=e.put(t[n]),i.onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(r,t,e){var i=this,n=this.myDB.db.transaction(r,"readwrite").objectStore(r),s=n.get(t);s.onerror=function(){e.call(i,null)},s.onsuccess=function(l){var u=l.target.result;e.call(i,u)}}},{key:"deleteData",value:function(r,t){var e=this.myDB.db.transaction(r,"readwrite").objectStore(r);e.delete(t)}},{key:"clearData",value:function(r){var t=this.myDB.db.transaction(r,"readwrite").objectStore(r);t.clear()}}]),a}(),yi=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],_i=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],Ci=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],Ce="data-xgplayerid";function qe(a,o,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i<t;i++)e[i-3]=arguments[i];var n=o.call.apply(o,[a].concat(e));!r||typeof r!="function"||(n&&n.then?n.then(function(){for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];r.call.apply(r,[a].concat(l))}):r.call.apply(r,[a].concat(e)))}function Ze(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[a]&&(this.__hooks[a]=null),(function(){var t=arguments,e=this;if(r.pre)try{var i;(i=r.pre).call.apply(i,[this].concat(Array.prototype.slice.call(arguments)))}catch(l){throw l.message="[pluginName: ".concat(this.pluginName,":").concat(a,":pre error] >> ").concat(l.message),l}if(this.__hooks&&this.__hooks[a])try{var n,s=(n=this.__hooks[a]).call.apply(n,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then(function(l){l!==!1&&qe.apply(void 0,[e,o,r.next].concat(J(t)))}).catch(function(l){throw l}):qe.apply(void 0,[this,o,r.next].concat(Array.prototype.slice.call(arguments))):s===void 0&&qe.apply(void 0,[this,o,r.next].concat(Array.prototype.slice.call(arguments)))}catch(l){throw l.message="[pluginName: ".concat(this.pluginName,":").concat(a,"] >> ").concat(l.message),l}else qe.apply(void 0,[this,o,r.next].concat(Array.prototype.slice.call(arguments)))}).bind(this)}function Je(a,o){var r=this.__hooks;if(r)return r.hasOwnProperty(a)?(r&&(r[a]=o),!0):(console.warn("has no supported hook which name [".concat(a,"]")),!1)}function Qe(a,o){var r=this.__hooks;r&&delete r[a]}function ki(a){if(!(!this.plugins||!this.plugins[a.toLowerCase()])){for(var o=this.plugins[a.toLowerCase()],r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return o.useHooks&&o.useHooks.apply(o,t)}}function bi(a){if(!(!this.plugins||!this.plugins[a.toLowerCase()])){var o=this.plugins[a.toLowerCase()];if(o){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return o.removeHooks&&o.removeHooks.apply(o,t)}}}function Ti(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];a.__hooks={},o&&o.map(function(r){a.__hooks[r]=null}),Object.defineProperty(a,"hooks",{get:function(){return a.__hooks&&Object.keys(a.__hooks).map(function(t){if(a.__hooks[t])return t})}})}function wi(a){a.__hooks=null}function ue(a,o,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i<t;i++)e[i-3]=arguments[i];if(a.__hooks&&a.__hooks[o]){var n,s=(n=a.__hooks[o]).call.apply(n,[a,a].concat(e));if(s&&s.then)s.then(function(l){return l===!1?null:r.call.apply(r,[a,a].concat(e))}).catch(function(l){console.warn("[runHooks]".concat(o," reject"),l.message)});else if(s!==!1)return r.call.apply(r,[a,a].concat(e))}else return r.call.apply(r,[a,a].concat(e))}function xt(a,o){R.logError("[".concat(a,"] event or callback cant be undefined or null when call ").concat(o))}var he=function(){function a(o){E(this,a),f.checkIsFunction(this.beforeCreate)&&this.beforeCreate(o),Ti(this),this.__args=o,this.__events={},this.__onceEvents={},this.config=o.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(o)}return S(a,[{key:"beforeCreate",value:function(r){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(r){this.player=r.player,this.playerConfig=r.player&&r.player.config,this.pluginName=r.pluginName?r.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=r.player&&r.player.logger}},{key:"updateLang",value:function(r){r||(r=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var r=f.checkTouchSupport()?"touch":"mouse";return this.playerConfig&&(this.playerConfig.domEventType==="touch"||this.playerConfig.domEventType==="mouse")&&(r=this.playerConfig.domEventType),r}},{key:"on",value:function(r,t){var e=this;if(!r||!t||!this.player){xt(this.pluginName,"plugin.on(event, callback)");return}typeof r=="string"?(this.__events[r]=t,this.player.on(r,t)):Array.isArray(r)&&r.forEach(function(i){e.__events[i]=t,e.player.on(i,t)})}},{key:"once",value:function(r,t){var e=this;if(!r||!t||!this.player){xt(this.pluginName,"plugin.once(event, callback)");return}typeof r=="string"?(this.__onceEvents[r]=t,this.player.once(r,t)):Array.isArray(r)&&r.forEach(function(i){e.__onceEvents[i]=t,e.player.once(r,t)})}},{key:"off",value:function(r,t){var e=this;if(!r||!t||!this.player){xt(this.pluginName,"plugin.off(event, callback)");return}typeof r=="string"?(delete this.__events[r],this.player.off(r,t)):Array.isArray(r)&&r.forEach(function(i){delete e.__events[r],e.player.off(i,t)})}},{key:"offAll",value:function(){var r=this;["__events","__onceEvents"].forEach(function(t){Object.keys(r[t]).forEach(function(e){r[t][e]&&r.off(e,r[t][e]),e&&delete r[t][e]})}),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(r){var t;if(this.player){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];(t=this.player).emit.apply(t,[r].concat(i))}}},{key:"emitUserAction",value:function(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.player){var i=V(V({},e),{},{pluginName:this.pluginName});this.player.emitUserAction(r,t,i)}}},{key:"hook",value:function(r,t){return Ze.call.apply(Ze,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),n=2;n<e;n++)i[n-2]=arguments[n];return Je.call.apply(Je,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),n=2;n<e;n++)i[n-2]=arguments[n];return Qe.call.apply(Qe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";if(this.player)return e&&(t.pluginName=e),this.player.registerPlugin({plugin:r,options:t})}},{key:"getPlugin",value:function(r){return this.player?this.player.getPlugin(r):null}},{key:"__destroy",value:function(){var r=this,t=this.player,e=this.pluginName;this.offAll(),f.clearAllTimers(this),f.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map(function(i){r[i]=null}),t.unRegisterPlugin(e),wi(this)}}],[{key:"defineGetterOrSetter",value:function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.defineProperty(r,e,t[e])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),a}(),ir=9;if(typeof Element<"u"&&!Element.prototype.matches){var Ee=Element.prototype;Ee.matches=Ee.matchesSelector||Ee.mozMatchesSelector||Ee.msMatchesSelector||Ee.oMatchesSelector||Ee.webkitMatchesSelector}function nr(a,o){for(;a&&a.nodeType!==ir;){if(typeof a.matches=="function"&&a.matches(o))return a;a=a.parentNode}}var rr=nr,sr=rr;function Pt(a,o,r,t,e){var i=ar.apply(this,arguments);return a.addEventListener(r,i,e),{destroy:function(){a.removeEventListener(r,i,e)}}}function or(a,o,r,t,e){return typeof a.addEventListener=="function"?Pt.apply(null,arguments):typeof r=="function"?Pt.bind(null,document).apply(null,arguments):(typeof a=="string"&&(a=document.querySelectorAll(a)),Array.prototype.map.call(a,function(i){return Pt(i,o,r,t,e)}))}function ar(a,o,r,t){return function(e){e.delegateTarget=sr(e.target,o),e.delegateTarget&&t.call(a,e)}}var lr=or;const Ei=lt(lr);var ur={CONTROLS:"controls",ROOT:"root"},H={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},Si={ICON_DISABLE:"xg-icon-disable",ICON_HIDE:"xg-icon-hide"};function It(a){return a?a.indexOf&&/^(?:http|data:|\/)/.test(a):!1}function cr(a,o){return W(a)==="object"&&a.class&&typeof a.class=="string"?"".concat(o," ").concat(a.class):o}function fr(a,o){return W(a)==="object"&&a.attr&&W(a.attr)==="object"&&Object.keys(a.attr).map(function(r){o[r]=a.attr[r]}),o}function xi(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",i=null;if(a instanceof window.Element)return f.addClass(a,r),Object.keys(t).map(function(n){a.setAttribute(n,t[n])}),a;if(It(a)||It(a.url))return t.src=It(a)?a:a.url||"",i=f.createDom(a.tag||"img","",t,"xg-img ".concat(r)),i;if(typeof a=="function")try{return i=a(),i instanceof window.Element?(f.addClass(i,r),Object.keys(t).map(function(n){i.setAttribute(n,t[n])}),i):(R.logWarn("warn>>icons.".concat(o," in config of plugin named [").concat(e,"] is a function mast return an Element Object")),null)}catch(n){return R.logError("Plugin named [".concat(e,"]:createIcon"),n),null}return typeof a=="string"?f.createDomFromHtml(a,t,r):(R.logWarn("warn>>icons.".concat(o," in config of plugin named [").concat(e,"] is invalid")),null)}function hr(a,o){var r=o.config.icons||o.playerConfig.icons;Object.keys(a).map(function(t){var e=a[t],i=e&&e.class?e.class:"",n=e&&e.attr?e.attr:{},s=null;r&&r[t]&&(i=cr(r[t],i),n=fr(r[t],n),s=xi(r[t],t,i,n,o.pluginName)),!s&&e&&(s=xi(e.icon?e.icon:e,n,i,{},o.pluginName)),o.icons[t]=s})}function dr(a,o){Object.keys(a).map(function(r){Object.defineProperty(o.langText,r,{get:function(){var e=o.lang,i=o.i18n;return i[r]?i[r]:a[r]&&a[r][e]||""}})})}var F=function(a){x(r,a);var o=P(r);function r(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return E(this,r),t=o.call(this,e),t.__delegates=[],t}return S(r,[{key:"__init",value:function(e){if(A(I(r.prototype),"__init",this).call(this,e),!!e.root){var i=e.root,n=null;this.icons={},this.root=null,this.parent=null;var s=this.registerIcons()||{};hr(s,this),this.langText={};var l=this.registerLanguageTexts()||{};dr(l,this);var u="";try{u=this.render()}catch(d){throw R.logError("Plugin:".concat(this.pluginName,":render"),d),new Error("Plugin:".concat(this.pluginName,":render:").concat(d.message))}if(u)n=r.insert(u,i,e.index),n.setAttribute("data-index",e.index);else if(e.tag)n=f.createDom(e.tag,"",e.attr,e.name),n.setAttribute("data-index",e.index),i.appendChild(n);else return;this.root=n,this.parent=i;var c=this.config.attr||{},h=this.config.style||{};this.setAttr(c),this.setStyle(h),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var i=this.children();i&&W(i)==="object"&&Object.keys(i).length>0&&Object.keys(i).map(function(n){var s=n,l=i[s],u={root:e.root},c,h;typeof l=="function"?(c=e.config[s]||{},h=l):W(l)==="object"&&typeof l.plugin=="function"&&(c=l.options?f.deepCopy(e.config[s]||{},l.options):e.config[s]||{},h=l.plugin),u.config=c,c.index!==void 0&&(u.index=c.index),c.root&&(u.root=c.root),e.registerPlugin(h,u,s)})}}},{key:"updateLang",value:function(e){e||(e=this.lang);function i(u,c){for(var h=0;h<u.children.length;h++)u.children[h].children.length>0?i(u.children[h],c):c(u.children[h])}var n=this.root,s=this.i18n,l=this.langText;n&&i(n,function(u){var c=u.getAttribute&&u.getAttribute("lang-key");if(c){var h=s[c.toUpperCase()]||l[c];h&&(u.innerHTML=typeof h=="function"?h(e):h)}})}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=this.i18n||{},s=this.langText;e.setAttribute&&e.setAttribute("lang-key",i);var l=n[i]||s[i]||"";l&&(e.innerHTML=l)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,f.addClass(this.find(".xgplayer-icon"),Si.ICON_DISABLE)}},{key:"enable",value:function(){this.config.disable=!1,f.removeClass(this.find(".xgplayer-icon"),Si.ICON_DISABLE)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";i.root=i.root||this.root;var s=A(I(r.prototype),"registerPlugin",this).call(this,e,i,n);return this._children.push(s),s}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,i,n){var s=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(u){s.bindEL(u,i)}):this.bindEL(e,i);else{var l=r.delegate.call(this,this.root,e,i,n);this.__delegates=this.__delegates.concat(l)}}},{key:"unbind",value:function(e,i){var n=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(u){n.unbindEL(u,i)}):this.unbindEL(e,i);else for(var s="".concat(e,"_").concat(i),l=0;l<this.__delegates.length;l++)if(this.__delegates[l].key===s){this.__delegates[l].destroy(),this.__delegates.splice(l,1);break}}},{key:"setStyle",value:function(e,i){var n=this;if(this.root){if(f.typeOf(e)==="String")return this.root.style[e]=i;f.typeOf(e)==="Object"&&Object.keys(e).map(function(s){n.root.style[s]=e[s]})}}},{key:"setAttr",value:function(e,i){var n=this;if(this.root){if(f.typeOf(e)==="String")return this.root.setAttribute(e,i);f.typeOf(e)==="Object"&&Object.keys(e).map(function(s){n.root.setAttribute(s,e[s])})}}},{key:"setHtml",value:function(e,i){this.root&&(this.root.innerHTML=e,typeof i=="function"&&i())}},{key:"bindEL",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.addEventListener(e,i,n)}},{key:"unbindEL",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.removeEventListener(e,i,n)}},{key:"show",value:function(e){if(this.root){this.root.style.display=e!==void 0?e:"block";var i=window.getComputedStyle(this.root,null),n=i.getPropertyValue("display");if(n==="none")return this.root.style.display="block"}}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,i){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!i||!(i instanceof window.Element))return null;try{return typeof e=="string"?this.find(e).appendChild(i):e.appendChild(i)}catch(n){return R.logError("Plugin:appendChild",n),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,i=this.player;this.__delegates.map(function(n){n.destroy()}),this.__delegates=[],this._children instanceof Array&&(this._children.map(function(n){i.unRegisterPlugin(n.pluginName)}),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),A(I(r.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map(function(n){e[n]=null})}}],[{key:"insert",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=i.children.length,l=Number(n),u=e instanceof window.Node;if(s){for(var c=0,h=null,d="";c<s;c++){h=i.children[c];var g=Number(h.getAttribute("data-index"));if(g>=l){d="beforebegin";break}else g<l&&(d="afterend")}return u?d==="afterend"?i.appendChild(e):i.insertBefore(e,h):h.insertAdjacentHTML(d,e),d==="afterend"?i.children[i.children.length-1]:i.children[c]}else return u?i.appendChild(e):i.insertAdjacentHTML("beforeend",e),i.children[i.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,i,n,s){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,u=[];if(e instanceof window.Node&&typeof s=="function")if(Array.isArray(n))n.forEach(function(h){var d=Ei(e,i,h,s,l);d.key="".concat(i,"_").concat(h),u.push(d)});else{var c=Ei(e,i,n,s,l);c.key="".concat(i,"_").concat(n),u.push(c)}return u}},{key:"ROOT_TYPES",get:function(){return ur}},{key:"POSITIONS",get:function(){return H}}]),r}(he),gr=function(){function a(){var o=this;if(E(this,a),_(this,"__trigger",function(r){var t=new Date().getTime();o.timeStamp=t;for(var e=0;e<r.length;e++)o.__runHandler(r[e].target)}),this.__handlers=[],this.timeStamp=0,this.observer=null,!!window.ResizeObserver)try{this.observer=new window.ResizeObserver(Bn(this.__trigger,100,{trailing:!0})),this.timeStamp=new Date().getTime()}catch(r){console.error(r)}}return S(a,[{key:"addObserver",value:function(r,t){if(this.observer){this.observer&&this.observer.observe(r);for(var e=r.getAttribute(Ce),i=this.__handlers,n=-1,s=0;s<i.length;s++)i[s]&&r===i[s].target&&(n=s);n>-1?this.__handlers[n].handler=t:this.__handlers.push({target:r,handler:t,playerId:e})}}},{key:"unObserver",value:function(r){var t=-1;this.__handlers.map(function(e,i){r===e.target&&(t=i)});try{this.observer&&this.observer.unobserve(r)}catch{}this.observer&&this.observer.unobserve(r),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(r){for(var t=this.__handlers,e=0;e<t.length;e++)if(t[e]&&r===t[e].target){try{t[e].handler(r)}catch(i){console.error(i)}return!0}return!1}}]),a}(),Ne=null;function pr(a,o){return Ne||(Ne=new gr),Ne.addObserver(a,o),Ne}function vr(a,o){Ne.unObserver(a,o)}var z={pluginGroup:{},init:function(o){var r=o._pluginInfoId;r||(r=new Date().getTime(),o._pluginInfoId=r),!o.config.closeResizeObserver&&pr(o.root,function(){o.resize()}),this.pluginGroup[r]={_originalOptions:o.config||{},_plugins:{}}},formatPluginInfo:function(o,r){var t=null,e=null;return o.plugin&&typeof o.plugin=="function"?(t=o.plugin,e=o.options):(t=o,e={}),r&&(e.config=r||{}),{PLUFGIN:t,options:e}},checkPluginIfExits:function(o,r){for(var t=0;t<r.length;t++)if(o.toLowerCase()===r[t].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(o,r){for(var t=Object.keys(r),e=null,i=0;i<t.length;i++)if(o.toLowerCase()===t[i].toLowerCase()){e=r[t[i]];break}return f.typeOf(e)==="Object"?{root:e.root,position:e.position}:{}},lazyRegister:function(o,r){var t=this,e=r.timeout||1500;return Promise.race([r.loader().then(function(i){var n;i&&i.__esModule?n=i.default:n=i,t.register(o,n,i.options)}),new Promise(function(i,n){setTimeout(function(){n(new Error("timeout"))},e)})])},register:function(o,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!(!o||!r||typeof r!="function"||r.prototype===void 0)){var e=o._pluginInfoId;if(!(!e||!this.pluginGroup[e])){this.pluginGroup[e]._plugins||(this.pluginGroup[e]._plugins={});var i=this.pluginGroup[e]._plugins,n=this.pluginGroup[e]._originalOptions;t.player=o;var s=t.pluginName||r.pluginName;if(!s)throw new Error("The property pluginName is necessary");if(r.isSupported&&!r.isSupported(o.config.mediaType,o.config.codecType)){console.warn("not supported plugin [".concat(s,"]"));return}t.config||(t.config={});for(var l=Object.keys(n),u=0;u<l.length;u++)if(s.toLowerCase()===l[u].toLowerCase()){var c=n[l[u]];f.typeOf(c)==="Object"?t.config=Object.assign({},t.config,n[l[u]]):f.typeOf(c)==="Boolean"&&(t.config.disable=!c);break}r.defaultConfig&&Object.keys(r.defaultConfig).forEach(function(d){typeof t.config[d]>"u"&&(t.config[d]=r.defaultConfig[d])}),t.root?typeof t.root=="string"&&(t.root=o[t.root]):t.root=o.root,t.index=t.config.index||0;try{i[s.toLowerCase()]&&(this.unRegister(e,s.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(s,"] exist, destroy the old instance")));var h=new r(t);return i[s.toLowerCase()]=h,i[s.toLowerCase()].func=r,h&&typeof h.afterCreate=="function"&&h.afterCreate(),h}catch(d){throw console.error(d),d}}}},unRegister:function(o,r){o._pluginInfoId&&(o=o._pluginInfoId),r=r.toLowerCase();try{var t=this.pluginGroup[o]._plugins[r];t&&(t.pluginName&&t.__destroy(),delete this.pluginGroup[o]._plugins[r])}catch(e){console.error("[unRegister:".concat(r,"] cgid:[").concat(o,"] error"),e)}},deletePlugin:function(o,r){var t=o._pluginInfoId;t&&this.pluginGroup[t]&&this.pluginGroup[t]._plugins&&delete this.pluginGroup[t]._plugins[r]},getPlugins:function(o){var r=o._pluginInfoId;return r&&this.pluginGroup[r]?this.pluginGroup[r]._plugins:{}},findPlugin:function(o,r){var t=o._pluginInfoId;if(!t||!this.pluginGroup[t])return null;var e=r.toLowerCase();return this.pluginGroup[t]._plugins[e]},beforeInit:function(o){var r=this;function t(e){return!e||!e.then?new Promise(function(i){i()}):e}return new Promise(function(e){if(r.pluginGroup){var i;return o._loadingPlugins&&o._loadingPlugins.length?i=Promise.all(o._loadingPlugins):i=Promise.resolve(),i.then(function(){var n=o._pluginInfoId;if(!r.pluginGroup[n]){e();return}var s=r.pluginGroup[n]._plugins,l=[];Object.keys(s).forEach(function(u){if(s[u]&&s[u].beforePlayerInit)try{var c=s[u].beforePlayerInit();l.push(t(c))}catch(h){throw l.push(t(null)),h}}),Promise.all([].concat(l)).then(function(){e()}).catch(function(u){console.error(u),e()})})}})},afterInit:function(o){var r=o._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins;Object.keys(t).forEach(function(e){t[e]&&t[e].afterPlayerInit&&t[e].afterPlayerInit()})}},setLang:function(o,r){var t=r._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=this.pluginGroup[t]._plugins;Object.keys(e).forEach(function(i){if(e[i].updateLang)e[i].updateLang(o);else try{e[i].lang=o}catch{console.warn("".concat(i," setLang"))}})}},reRender:function(o){var r=this,t=o._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=[],i=this.pluginGroup[t]._plugins;Object.keys(i).forEach(function(n){n!=="controls"&&i[n]&&(e.push({plugin:i[n].func,options:i[n].__args}),r.unRegister(t,n))}),e.forEach(function(n){r.register(o,n.plugin,n.options)})}},onPluginsReady:function(o){var r=o._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins||{};Object.keys(t).forEach(function(e){t[e].onPluginsReady&&typeof t[e].onPluginsReady=="function"&&t[e].onPluginsReady()})}},destroy:function(o){var r=o._pluginInfoId;if(this.pluginGroup[r]){vr(o.root);for(var t=this.pluginGroup[r]._plugins,e=0,i=Object.keys(t);e<i.length;e++){var n=i[e];this.unRegister(r,n)}delete this.pluginGroup[r],delete o._pluginInfoId}}},k={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function Pi(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:Hn(),controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}}}var mr=function(o,r){var t,e,i;r.preset&&r.options?i=new r.preset(r.options,o.config):i=new r({},o.config);var n=i,s=n.plugins,l=s===void 0?[]:s,u=n.ignores,c=u===void 0?[]:u,h=n.icons,d=h===void 0?{}:h,g=n.i18n,v=g===void 0?[]:g;o.config.plugins||(o.config.plugins=[]),o.config.ignores||(o.config.ignores=[]),(t=o.config.plugins).push.apply(t,J(l)),(e=o.config.ignores).push.apply(e,J(c)),Object.keys(d).map(function(C){o.config.icons[C]||(o.config.icons[C]=d[C])});var y=o.config.i18n||[];v.push.apply(v,J(y)),o.config.i18n=v},yr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onMouseEnter",function(s){var l=m(t),u=l.player,c=l.playerConfig;c.closeControlsBlur&&u.focus({autoHide:!1})}),_(m(t),"onMouseLeave",function(s){var l=m(t),u=l.player;u.focus()}),t}return S(r,[{key:"beforeCreate",value:function(e){!e.config.mode&&D.device==="mobile"&&(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.disable,s=i.height,l=i.mode;if(!n){l==="flex"&&this.player.addClass(k.FLEX_CONTROLS);var u={height:"".concat(s,"px")};Object.keys(u).map(function(h){e.root.style[h]=u[h]}),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-controls"),this.on(Ke,function(h){h?f.addClass(e.root,"mini-controls"):f.removeClass(e.root,"mini-controls")});var c=this.playerConfig.isMobileSimulateMode;D.device!=="mobile"&&c!=="mobile"&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave))}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&f.addClass(this.root,k.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){f.removeClass(this.root,k.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var s=e.defaultConfig||{};if(!i.root){var l=i.position?i.position:i.config&&i.config.position?i.config.position:s.position;switch(l){case H.CONTROLS_LEFT:i.root=this.left;break;case H.CONTROLS_RIGHT:i.root=this.right;break;case H.CONTROLS_CENTER:i.root=this.center;break;case H.CONTROLS:i.root=this.root;break;default:i.root=this.left}return A(I(r.prototype),"registerPlugin",this).call(this,e,i,n)}}}},{key:"destroy",value:function(){D.device!=="mobile"&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{key:"render",value:function(){var e=this.config,i=e.mode,n=e.autoHide,s=e.initShow,l=e.disable;if(!l){var u=f.classNames({"xgplayer-controls":!0},{"flex-controls":i==="flex"},{"bottom-controls":i==="bottom"},_({},k.CONTROLS_AUTOHIDE,n),{"xgplayer-controls-initshow":s||!n});return'<xg-controls class="'.concat(u,`" unselectable="on">
1
+ (function(ie,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("vue"),require("iking-utils-pro"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","iking-utils-pro","element-plus"],p):(ie=typeof globalThis<"u"?globalThis:ie||self,p(ie.index={},ie.vue,ie["iking-utils-pro"],ie["element-plus"]))})(this,function(ie,p,st,Zi){"use strict";const Re=(a,o)=>{if(a.install=r=>{for(const t of[a,...Object.values(o??{})])r.component(t.name,t)},o)for(const[r,t]of Object.entries(o))a[r]=t;return a},ot=(a,o)=>o?o.startsWith("http")?o:`${a||location.origin}${o}`:"",Vt=(a,o)=>{var i,n,s,l;const r=(i=a==null?void 0:a.response)!=null&&i.data?zt((s=(n=a==null?void 0:a.response)==null?void 0:n.data)==null?void 0:s.suffix):((l=a.raw)==null?void 0:l.type)||zt(a[o.suffix]),t=r==null?void 0:r.toLowerCase(),e={sheet:"excel",excel:"excel",zip:"zip","application/x-compressed":"zip",image:"image",video:"video",audio:"audio",pdf:"pdf",text:"txt",txt:"txt",word:"word",ppt:"ppt",exe:"exe",json:"json"};for(let u in e)if(typeof t=="string"&&(t.includes(u)||t===u))return e[u];return"unknown"},Ji={".doc":"word",".docx":"word",".docxf":"word",".docm":"word",".dot":"word",".dotm":"word",".dotx":"word",".epub":"word",".fodt":"word",".htm":"word",".html":"word",".mht":"word",".odt":"word",".ott":"word",".rtf":"word",".djvu":"word",".oxps":"word",".oform":"word",".fb2":"word",".xml":"word",".xps":"word",".csv":"excel",".xls":"excel",".xlsx":"excel",".fods":"excel",".ods":"excel",".ots":"excel",".xlsb":"excel",".xlsm":"excel",".xlt":"excel",".xltm":"excel",".xltx":"excel",".fodp":"ppt",".odp":"ppt",".otp":"ppt",".pot":"ppt",".potm":"ppt",".potx":"ppt",".pps":"ppt",".ppsm":"ppt",".ppsx":"ppt",".ppt":"ppt",".pptm":"ppt",".pptx":"ppt",".zip":"zip",".rar":"zip",".7z":"zip",".apz":"zip",".ar":"zip",".bz":"zip",".car":"zip",".dar":"zip",".cpgz":"zip",".f":"zip",".ha":"zip",".hbc":"zip",".hbc2":"zip",".hbe":"zip",".hpk":"zip",".hyp":"zip",".png":"image",".jpg":"image",".jpeg":"image",".bmp":"image",".gif":"image",".webp":"image",".psd":"image",".svg":"image",".tiff":"image",".avi":"video",".wmv":"video",".mpeg":"video",".mp4":"video",".mpm4v":"video",".mov":"video",".asf":"video",".flv":"video",".f4v":"video",".rmvb":"video",".rm":"video",".3gp":"video",".vob":"video",".txt":"txt",".pdf":"pdf"},zt=a=>{const o=a==null?void 0:a.toLocaleLowerCase(),r=o!=null&&o.startsWith(".")?o:`.${o}`;return r&&Ji[r]||"unknow"},Qi=a=>{let o="",r=["doc","docx"],t=["xls","xlsx"],e=["ppt","pptx"],i=["pdf"];return r.includes(a)&&(o="word"),t.includes(a)&&(o="cell"),e.includes(a)&&(o="slide"),i.includes(a)&&(o="text-pdf"),o};/*! Element Plus Icons Vue v2.3.1 */var en=p.defineComponent({name:"Close",__name:"close",setup(a){return(o,r)=>(p.openBlock(),p.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[p.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),tn=en;const He=(a,o)=>{const r=a.__vccOpts||a;for(const[t,e]of o)r[t]=e;return r},nn=a=>{const o=p.inject("loadUrl"),r=p.computed(()=>a.loadUrl||a.fileUrl||(o==null?void 0:o.value)),t=p.inject("uploadUrl"),e=p.computed(()=>a.action||a.uploadUrl||(t==null?void 0:t.value)),i=p.inject("token"),n=p.computed(()=>a.token||(i==null?void 0:i.value)),s=p.inject("onlyofficeConfig"),l=p.computed(()=>a.onlyofficeConfig||(s==null?void 0:s.value)),u=p.inject("userInfo"),c=p.computed(()=>a.userInfo||(u==null?void 0:u.value));return{cLoadUrl:r,cUploadUrl:e,cToken:n,cOnlyofficeConfig:l,cUserInfo:c}},rn={key:0,class:"ik-svg-icon ik-icon-span inline-block inline-flex justify-center box-content line-height-[0]"},sn={key:1,class:"h-[1em] w-[1em]","aria-hidden":"true"},on=["xlink:href"],an=["src"],ln={key:1,class:"h-[1em] w-[1em]","aria-hidden":"true"},un=["xlink:href"],cn=["src"],fn=p.defineComponent({name:"IkSvgIcon",__name:"index",props:{active:{type:Boolean,default:!1},bg:{type:Boolean,default:!1},color:{},colorLight:{},disabled:{type:Boolean,default:!1},error:{type:Boolean},flip:{},name:{},notip:{type:Boolean,default:!1},opacity:{default:.5},padding:{default:"6px"},primary:{type:Boolean},rotate:{},showBg:{type:Boolean,default:!1},size:{default:""},success:{type:Boolean},tableIconType:{},title:{},type:{},warning:{type:Boolean},width:{}},setup(a){const o=a,r=p.computed(()=>o),t=p.computed(()=>{const{name:i}=r.value;return/^http?:\/\//.test(i)?"img":/i-[^:]+:[^:]+/.test(i)?"unocss":i!=null&&i.startsWith("iksig")?"iksig":i!=null&&i.includes(":")?"iconify":i!=null&&i.startsWith("iksvg")?"svg":"i"}),e=p.computed(()=>{const i=[];if(r.value.flip)switch(r.value.flip){case"horizontal":i.push("rotateY(180deg)");break;case"vertical":i.push("rotateX(180deg)");break;case"both":i.push("rotateX(180deg)"),i.push("rotateY(180deg)");break}r.value.rotate&&i.push(`rotate(${r.value.rotate%360}deg)`);const n={pointerEvents:r.value.disabled?"none":"auto",...r.value.color&&{color:r.value.color},...r.value.size&&{fontSize:typeof r.value.size=="number"?`${r.value.size}px`:r.value.size},...i.length&&{transform:i.join(" ")},padding:r.value.showBg||r.value.bg?r.value.padding:0,...r.value.color&&t.value!=="iksig"?{"--ik-color-icon-dark":r.value.color,"--ik-color-icon-light":r.value.colorLight||st.ikColor.setOpacity(r.value.color,r.value.opacity)}:{}};return r.value.width&&(n.width=n.height=typeof r.value.width=="number"?`${r.value.width}px`:r.value.width),n});return(i,n)=>{const s=p.resolveComponent("el-tooltip"),l=p.resolveComponent("el-button");return r.value.tableIconType==="icon"||!r.value.tableIconType?(p.openBlock(),p.createElementBlock("span",rn,[r.value.notip||!r.value.title?(p.openBlock(),p.createElementBlock("i",{key:0,class:p.normalizeClass(["ik-svg-icon ik-icon relative h-[1em] w-[1em] inline-flex items-center justify-center fill-current leading-[1em] transition",{[i.name]:t.value==="unocss","show-bg":r.value.showBg||r.value.bg,default:r.value.size==="default",small:r.value.size==="small",big:r.value.size==="big",warning:r.value.warning||r.value.type==="warning",primary:r.value.primary||r.value.type==="primary",success:i.success||r.value.type==="success",error:r.value.error||r.value.type==="error",active:r.value.active,disabled:r.value.disabled}]),style:p.normalizeStyle(e.value)},[p.createCommentVNode(` <Icon v-if="outputType === 'iconify'" :icon="name" /> `),t.value==="iksig"?(p.openBlock(),p.createElementBlock("i",{key:0,class:p.normalizeClass(`iksig ${r.value.name}`),style:p.normalizeStyle(e.value)},null,6)):t.value==="svg"?(p.openBlock(),p.createElementBlock("svg",sn,[p.createElementVNode("use",{"xlink:href":`#${r.value.name}`},null,8,on)])):t.value==="img"?(p.openBlock(),p.createElementBlock("img",{key:2,src:r.value.name,class:"h-[1em] w-[1em]"},null,8,an)):(p.openBlock(),p.createElementBlock("i",{key:3,class:p.normalizeClass(r.value.name),style:p.normalizeStyle(e.value)},null,6))],6)):(p.openBlock(),p.createBlock(s,{key:1,content:r.value.title,placement:"top"},{default:p.withCtx(()=>[p.createElementVNode("i",{class:p.normalizeClass(["ik-svg-icon ik-icon relative h-[1em] w-[1em] inline-flex items-center justify-center fill-current leading-[1em] transition",{[i.name]:t.value==="unocss","show-bg":r.value.showBg||r.value.bg,default:r.value.size==="default",small:r.value.size==="small",big:r.value.size==="big",warning:r.value.warning||r.value.type==="warning",primary:i.primary||r.value.type==="primary",success:i.success||r.value.type==="success",error:r.value.error||r.value.type==="error",active:r.value.active}]),style:p.normalizeStyle(e.value)},[t.value==="iksig"?(p.openBlock(),p.createElementBlock("i",{key:0,class:p.normalizeClass(`iksig ${r.value.name}`),style:p.normalizeStyle(e.value)},null,6)):t.value==="svg"?(p.openBlock(),p.createElementBlock("svg",ln,[p.createElementVNode("use",{"xlink:href":`#${r.value.name}`},null,8,un)])):t.value==="img"?(p.openBlock(),p.createElementBlock("img",{key:2,src:r.value.name,class:"h-[1em] w-[1em]"},null,8,cn)):(p.openBlock(),p.createElementBlock("i",{key:3,class:p.normalizeClass(r.value.name),style:p.normalizeStyle(e.value)},null,6))],6)]),_:1},8,["content"]))])):(p.openBlock(),p.createBlock(l,{key:1,type:["warning","error"].includes(r.value.type)?"danger":""},{default:p.withCtx(()=>[p.createTextVNode(p.toDisplayString(r.value.title),1)]),_:1},8,["type"]))}}}),zs="",jt=Re(He(fn,[["__scopeId","data-v-52806adf"]])),hn=p.defineComponent({__name:"CloseIcon",props:{showBg:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1}},setup(a){return(o,r)=>(p.openBlock(),p.createBlock(p.unref(jt),{error:"",name:"iksvg_guanbidanchuang",title:"关闭",size:20}))}}),Ws="",dn=He(hn,[["__scopeId","data-v-e27fb022"]]),gn={class:"base-header"},pn=p.defineComponent({__name:"IkBaseDialog",props:p.mergeModels({title:{default:""},cancelText:{default:"取消"},confirmText:{default:"确认"},noHeader:{type:Boolean},noFooter:{type:Boolean},showCloseBg:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1,noHeader:!1,noFooter:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=a,r=p.useModel(a,"modelValue"),t=p.ref(o.fullscreen),e=()=>{t.value=!t.value},i=p.defineComponent({setup(){return()=>p.h(dn,{showBg:o.showCloseBg,fullscreen:o.fullscreen})}});return(n,s)=>{const l=p.resolveComponent("el-dialog");return p.openBlock(),p.createBlock(l,p.mergeProps({modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=u=>r.value=u)},n.$attrs,{"close-icon":p.unref(i),class:`ik-base-dialog ${n.noHeader?"no-header":""} ${n.noFooter?"no-footer":""}`,fullscreen:t.value,"modal-class":"baseDialog"}),p.createSlots({icon:p.withCtx(()=>[p.renderSlot(n.$slots,"title",{},()=>[p.createTextVNode(p.toDisplayString(n.title),1)])]),header:p.withCtx(()=>[p.createElementVNode("div",gn,[p.renderSlot(n.$slots,"header",{},()=>[p.createTextVNode(p.toDisplayString(n.title),1)])]),n.$attrs.showClose?(p.openBlock(),p.createBlock(p.unref(jt),{key:0,onClick:e,name:t.value?"iksvg_tuichuquanping":"iksvg_quanping-daohang",class:"absolute! top-[18px] right-[50px] icon-dialog-full",title:t.value?"退出全屏":"全屏"},null,8,["name","title"])):p.createCommentVNode("v-if",!0)]),default:p.withCtx(()=>[p.renderSlot(n.$slots,"default")]),_:2},[n.$slots.footer?{name:"footer",fn:p.withCtx(()=>[p.renderSlot(n.$slots,"footer")]),key:"0"}:void 0]),1040,["modelValue","close-icon","class","fullscreen"])}}}),Gs="",vn=Re(pn);var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function at(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function yn(a,o,r,t){function e(i){return i instanceof r?i:new r(function(n){n(i)})}return new(r||(r=Promise))(function(i,n){function s(c){try{u(t.next(c))}catch(h){n(h)}}function l(c){try{u(t.throw(c))}catch(h){n(h)}}function u(c){c.done?i(c.value):e(c.value).then(s,l)}u((t=t.apply(a,o||[])).next())})}function _n(a,o){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,e,i,n;return n={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function s(u){return function(c){return l([u,c])}}function l(u){if(t)throw new TypeError("Generator is already executing.");for(;n&&(n=0,u[0]&&(r=0)),r;)try{if(t=1,e&&(i=u[0]&2?e.return:u[0]?e.throw||((i=e.return)&&i.call(e),0):e.next)&&!(i=i.call(e,u[1])).done)return i;switch(e=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,e=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=o.call(a,r)}catch(c){u=[6,c],e=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var Cn=function(a,o){return yn(void 0,void 0,void 0,function(){return _n(this,function(r){return[2,new Promise(function(t,e){try{if(window.DocsAPI)return t(null);var i=document.getElementById(o);if(i)var n=setInterval(function(){var l=i.getAttribute("loading");if(!l){if(clearInterval(n),window.DocsAPI)return t(null);var u=Wt(o,a,t,e);i.remove(),document.body.appendChild(u)}},500);else{var s=Wt(o,a,t,e);document.body.appendChild(s)}}catch(l){console.error(l)}})]})})},Wt=function(a,o,r,t){var e=document.createElement("script");return e.id=a,e.type="text/javascript",e.src=o,e.async=!0,e.onload=function(){e.removeAttribute("loading"),r(null)},e.onerror=function(i){e.removeAttribute("loading"),t(i)},e.setAttribute("loading",""),e},lt=p.defineComponent({name:"DocumentEditor",props:{id:{type:String,required:!0},documentServerUrl:{type:String,required:!0},config:{type:Object,required:!0},document_fileType:String,document_title:String,documentType:String,editorConfig_lang:String,height:String,type:String,width:String,onLoadComponentError:Function,events_onAppReady:Function,events_onDocumentStateChange:Function,events_onMetaChange:Function,events_onDocumentReady:Function,events_onInfo:Function,events_onWarning:Function,events_onError:Function,events_onRequestSharingSettings:Function,events_onRequestRename:Function,events_onMakeActionLink:Function,events_onRequestInsertImage:Function,events_onRequestSaveAs:Function,events_onRequestMailMergeRecipients:Function,events_onRequestCompareFile:Function,events_onRequestEditRights:Function,events_onRequestHistory:Function,events_onRequestHistoryClose:Function,events_onRequestHistoryData:Function,events_onRequestRestore:Function,events_onRequestSelectSpreadsheet:Function,events_onRequestSelectDocument:Function},mounted:function(){var a=this,o=this.documentServerUrl;o.endsWith("/")||(o+="/");var r="".concat(o,"web-apps/apps/api/documents/api.js");Cn(r,"onlyoffice-api-script").then(function(){return a.onLoad()}).catch(function(){a.onError(-2)})},unmounted:function(){var a,o=this.id||"";!((a=window==null?void 0:window.DocEditor)===null||a===void 0)&&a.instances[o]&&(window.DocEditor.instances[o].destroyEditor(),window.DocEditor.instances[o]=void 0)},watch:{config:{handler:function(a,o){this.onChangeProps()},deep:!0},document_fileType:function(a,o){this.onChangeProps()},document_title:function(a,o){this.onChangeProps()},documentType:function(a,o){this.onChangeProps()},editorConfig_lang:function(a,o){this.onChangeProps()},height:function(a,o){this.onChangeProps()},type:function(a,o){this.onChangeProps()},width:function(a,o){this.onChangeProps()}},methods:{onLoad:function(){var a,o;try{var r=this.id||"";if(window.DocsAPI||this.onError(-3),!((a=window==null?void 0:window.DocEditor)===null||a===void 0)&&a.instances[r]){console.log("Skip loading. Instance already exists",r);return}!((o=window==null?void 0:window.DocEditor)===null||o===void 0)&&o.instances||(window.DocEditor={instances:{}});var t=Object.assign({document:{fileType:this.document_fileType,title:this.document_title},documentType:this.documentType,editorConfig:{lang:this.editorConfig_lang},events:{onAppReady:this.onAppReady,onDocumentStateChange:this.events_onDocumentStateChange,onMetaChange:this.events_onMetaChange,onDocumentReady:this.events_onDocumentReady,onInfo:this.events_onInfo,onWarning:this.events_onWarning,onError:this.events_onError,onRequestSharingSettings:this.events_onRequestSharingSettings,onRequestRename:this.events_onRequestRename,onMakeActionLink:this.events_onMakeActionLink,onRequestInsertImage:this.events_onRequestInsertImage,onRequestSaveAs:this.events_onRequestSaveAs,onRequestMailMergeRecipients:this.events_onRequestMailMergeRecipients,onRequestCompareFile:this.events_onRequestCompareFile,onRequestEditRights:this.events_onRequestEditRights,onRequestHistory:this.events_onRequestHistory,onRequestHistoryClose:this.events_onRequestHistoryClose,onRequestHistoryData:this.events_onRequestHistoryData,onRequestRestore:this.events_onRequestRestore,onRequestSelectSpreadsheet:this.events_onRequestSelectSpreadsheet,onRequestSelectDocument:this.events_onRequestSelectDocument},height:this.height,type:this.type,width:this.width},this.config||{}),e=window.DocsAPI.DocEditor(r,t);window.DocEditor.instances[r]=e}catch(i){console.error(i),this.onError(-1)}},onError:function(a){var o;switch(a){case-2:o="Error load DocsAPI from "+this.documentServerUrl;break;case-3:o="DocsAPI is not defined";break;default:o="Unknown error loading component",a=-1}typeof this.onLoadComponentError>"u"?console.error(o):this.onLoadComponentError(a,o)},onAppReady:function(){var a=this.id||"";this.events_onAppReady(window.DocEditor.instances[a])},onChangeProps:function(){var a,o=this.id||"";!((a=window==null?void 0:window.DocEditor)===null||a===void 0)&&a.instances[o]&&(window.DocEditor.instances[o].destroyEditor(),window.DocEditor.instances[o]=void 0,console.log("Important props have been changed. Load new Editor."),this.onLoad())}}});const kn=["id"];function bn(a,o,r,t,e,i){return p.openBlock(),p.createElementBlock("div",{id:a.id},null,8,kn)}lt.render=bn,lt.__file="src/components/DocumentEditor.vue";const Tn=p.defineComponent({__name:"IkOnlyOffice",props:{documentServerUrl:{type:String,default:""},configOptions:{type:Object,default:()=>{}},officeHeight:{type:String,default:"100%"}},setup(a){const o=a,r=p.ref({width:"100%",height:"100%",...o.configOptions||{},...o.configOptions}),t=()=>{console.info("文档加载完成",o.configOptions)};return(e,i)=>(p.openBlock(),p.createElementBlock("div",{style:p.normalizeStyle({height:o.officeHeight})},[p.createVNode(p.unref(lt),{id:`${new Date().getTime()}`,ref:"editorRef","document-server-url":a.documentServerUrl,config:r.value,events_onDocumentReady:t},null,8,["id","document-server-url","config"])],4))}}),Ks="",wn=Re(He(Tn,[["__scopeId","data-v-98d51ef9"]]));function Gt(a,o){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);o&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})),r.push.apply(r,t)}return r}function V(a){for(var o=1;o<arguments.length;o++){var r=arguments[o]!=null?arguments[o]:{};o%2?Gt(Object(r),!0).forEach(function(t){_(a,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):Gt(Object(r)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(r,t))})}return a}function W(a){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},W(a)}function E(a,o){if(!(a instanceof o))throw new TypeError("Cannot call a class as a function")}function Kt(a,o){for(var r=0;r<o.length;r++){var t=o[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,Yt(t.key),t)}}function S(a,o,r){return o&&Kt(a.prototype,o),r&&Kt(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}function _(a,o,r){return o=Yt(o),o in a?Object.defineProperty(a,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[o]=r,a}function x(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(o&&o.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),o&&ut(a,o)}function I(a){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},I(a)}function ut(a,o){return ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ut(a,o)}function En(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function m(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function ct(a,o){if(o&&(typeof o=="object"||typeof o=="function"))return o;if(o!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(a)}function P(a){var o=En();return function(){var t=I(a),e;if(o){var i=I(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ct(this,e)}}function Sn(a,o){for(;!Object.prototype.hasOwnProperty.call(a,o)&&(a=I(a),a!==null););return a}function A(){return typeof Reflect<"u"&&Reflect.get?A=Reflect.get.bind():A=function(o,r,t){var e=Sn(o,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?o:t):i.value}},A.apply(this,arguments)}function J(a){return xn(a)||Pn(a)||In(a)||An()}function xn(a){if(Array.isArray(a))return ft(a)}function Pn(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function In(a,o){if(a){if(typeof a=="string")return ft(a,o);var r=Object.prototype.toString.call(a).slice(8,-1);if(r==="Object"&&a.constructor&&(r=a.constructor.name),r==="Map"||r==="Set")return Array.from(a);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ft(a,o)}}function ft(a,o){(o==null||o>a.length)&&(o=a.length);for(var r=0,t=new Array(o);r<o;r++)t[r]=a[r];return t}function An(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ln(a,o){if(typeof a!="object"||a===null)return a;var r=a[Symbol.toPrimitive];if(r!==void 0){var t=r.call(a,o||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(a)}function Yt(a){var o=Ln(a,"string");return typeof o=="symbol"?o:String(o)}var $t={exports:{}};(function(a){var o=Object.prototype.hasOwnProperty,r="~";function t(){}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(r=!1));function e(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function i(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var g=new e(c,h||l,d),v=r?r+u:u;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],g]:l._events[v].push(g):(l._events[v]=g,l._eventsCount++),l}function n(l,u){--l._eventsCount===0?l._events=new t:delete l._events[u]}function s(){this._events=new t,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)o.call(c,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},s.prototype.listeners=function(u){var c=r?r+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,g=h.length,v=new Array(g);d<g;d++)v[d]=h[d].fn;return v},s.prototype.listenerCount=function(u){var c=r?r+u:u,h=this._events[c];return h?h.fn?1:h.length:0},s.prototype.emit=function(u,c,h,d,g,v){var y=r?r+u:u;if(!this._events[y])return!1;var C=this._events[y],b=arguments.length,w,T;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),b){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,c),!0;case 3:return C.fn.call(C.context,c,h),!0;case 4:return C.fn.call(C.context,c,h,d),!0;case 5:return C.fn.call(C.context,c,h,d,g),!0;case 6:return C.fn.call(C.context,c,h,d,g,v),!0}for(T=1,w=new Array(b-1);T<b;T++)w[T-1]=arguments[T];C.fn.apply(C.context,w)}else{var B=C.length,O;for(T=0;T<B;T++)switch(C[T].once&&this.removeListener(u,C[T].fn,void 0,!0),b){case 1:C[T].fn.call(C[T].context);break;case 2:C[T].fn.call(C[T].context,c);break;case 3:C[T].fn.call(C[T].context,c,h);break;case 4:C[T].fn.call(C[T].context,c,h,d);break;default:if(!w)for(O=1,w=new Array(b-1);O<b;O++)w[O-1]=arguments[O];C[T].fn.apply(C[T].context,w)}}return!0},s.prototype.on=function(u,c,h){return i(this,u,c,h,!1)},s.prototype.once=function(u,c,h){return i(this,u,c,h,!0)},s.prototype.removeListener=function(u,c,h,d){var g=r?r+u:u;if(!this._events[g])return this;if(!c)return n(this,g),this;var v=this._events[g];if(v.fn)v.fn===c&&(!d||v.once)&&(!h||v.context===h)&&n(this,g);else{for(var y=0,C=[],b=v.length;y<b;y++)(v[y].fn!==c||d&&!v[y].once||h&&v[y].context!==h)&&C.push(v[y]);C.length?this._events[g]=C.length===1?C[0]:C:n(this,g)}return this},s.prototype.removeAllListeners=function(u){var c;return u?(c=r?r+u:u,this._events[c]&&n(this,c)):(this._events=new t,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,a.exports=s})($t);var Xt=$t.exports;const qt=at(Xt);var Dn=typeof window<"u"&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,ht={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},dt="%c[xgplayer]",R={config:{debug:Dn?3:0},logInfo:function(o){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];this.config.debug>=3&&(r=console).log.apply(r,[dt,ht.info,o].concat(e))},logWarn:function(o){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];this.config.debug>=1&&(r=console).warn.apply(r,[dt,ht.warn,o].concat(e))},logError:function(o){var r;if(!(this.config.debug<1)){for(var t=this.config.debug>=2?"trace":"error",e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];(r=console)[t].apply(r,[dt,ht.error,o].concat(i))}}};function Rn(a){a.logInfo=R.logInfo.bind(a),a.logWarn=R.logWarn.bind(a),a.logError=R.logError.bind(a)}var On=function(){function a(o){E(this,a),this.bufferedList=o}return S(a,[{key:"start",value:function(r){return this.bufferedList[r].start}},{key:"end",value:function(r){return this.bufferedList[r].end}},{key:"length",get:function(){return this.bufferedList.length}}]),a}(),f={};f.createDom=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"div",o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",e=document.createElement(a);return e.className=t,e.innerHTML=o,Object.keys(r).forEach(function(i){var n=i,s=r[i];a==="video"||a==="audio"||a==="live-video"?s&&e.setAttribute(n,s):e.setAttribute(n,s)}),e},f.createDomFromHtml=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";try{var t=document.createElement("div");t.innerHTML=a;var e=t.children;return t=null,e.length>0?(e=e[0],r&&f.addClass(e,r),o&&Object.keys(o).forEach(function(i){e.setAttribute(i,o[i])}),e):null}catch(i){return R.logError("util.createDomFromHtml",i),null}},f.hasClass=function(a,o){if(!a||!o)return!1;try{return Array.prototype.some.call(a.classList,function(t){return t===o})}catch{var r=a.className&&W(a.className)==="object"?a.getAttribute("class"):a.className;return r&&!!r.match(new RegExp("(\\s|^)"+o+"(\\s|$)"))}},f.addClass=function(a,o){if(!(!a||!o))try{o.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&a.classList.add(r)})}catch{f.hasClass(a,o)||(a.className&&W(a.className)==="object"?a.setAttribute("class",a.getAttribute("class")+" "+o):a.className+=" "+o)}},f.removeClass=function(a,o){if(!(!a||!o))try{o.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&a.classList.remove(r)})}catch{f.hasClass(a,o)&&o.split(/\s+/g).forEach(function(t){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");a.className&&W(a.className)==="object"?a.setAttribute("class",a.getAttribute("class").replace(e," ")):a.className=a.className.replace(e," ")})}},f.toggleClass=function(a,o){a&&o.split(/\s+/g).forEach(function(r){f.hasClass(a,r)?f.removeClass(a,r):f.addClass(a,r)})},f.classNames=function(){for(var a=arguments,o=[],r=function(i){f.typeOf(a[i])==="String"?o.push(a[i]):f.typeOf(a[i])==="Object"&&Object.keys(a[i]).map(function(n){a[i][n]&&o.push(n)})},t=0;t<arguments.length;t++)r(t);return o.join(" ")},f.findDom=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,o=arguments.length>1?arguments[1]:void 0,r;try{r=a.querySelector(o)}catch(t){R.logError("util.findDom",t),o.indexOf("#")===0&&(r=a.getElementById(o.slice(1)))}return r},f.getCss=function(a,o){return a.currentStyle?a.currentStyle[o]:document.defaultView.getComputedStyle(a,!1)[o]},f.padStart=function(a,o,r){for(var t=String(r),e=o>>0,i=Math.ceil(e/t.length),n=[],s=String(a);i--;)n.push(t);return n.join("").substring(0,e-s.length)+s},f.format=function(a){if(window.isNaN(a))return"";a=Math.round(a);var o=f.padStart(Math.floor(a/3600),2,0),r=f.padStart(Math.floor((a-o*3600)/60),2,0),t=f.padStart(Math.floor(a-o*3600-r*60),2,0);return(o==="00"?[r,t]:[o,r,t]).join(":")},f.event=function(a){if(a.touches){var o=a.touches[0]||a.changedTouches[0];a.clientX=o.clientX||0,a.clientY=o.clientY||0,a.offsetX=o.pageX-o.target.offsetLeft,a.offsetY=o.pageY-o.target.offsetTop}a._target=a.target||a.srcElement},f.typeOf=function(a){return Object.prototype.toString.call(a).match(/([^\s.*]+)(?=]$)/g)[0]},f.deepCopy=function(a,o){if(f.typeOf(o)==="Object"&&f.typeOf(a)==="Object")return Object.keys(o).forEach(function(r){f.typeOf(o[r])==="Object"&&!(o[r]instanceof Node)?a[r]===void 0||a[r]===void 0?a[r]=o[r]:f.deepCopy(a[r],o[r]):f.typeOf(o[r])==="Array"?a[r]=f.typeOf(a[r])==="Array"?a[r].concat(o[r]):o[r]:a[r]=o[r]}),a},f.deepMerge=function(a,o){return Object.keys(o).map(function(r){if(f.typeOf(o[r])==="Array"&&f.typeOf(a[r])==="Array"){if(f.typeOf(a[r])==="Array"){var t;(t=a[r]).push.apply(t,J(o[r]))}}else f.typeOf(a[r])===f.typeOf(o[r])&&a[r]!==null&&f.typeOf(a[r])==="Object"&&!(o[r]instanceof window.Node)?f.deepMerge(a[r],o[r]):o[r]!==null&&(a[r]=o[r])}),a},f.getBgImage=function(a){var o=(a.currentStyle||window.getComputedStyle(a,null)).backgroundImage;if(!o||o==="none")return"";var r=document.createElement("a");return r.href=o.replace(/url\("|"\)/g,""),r.href},f.copyDom=function(a){if(a&&a.nodeType===1){var o=document.createElement(a.tagName);return Array.prototype.forEach.call(a.attributes,function(r){o.setAttribute(r.name,r.value)}),a.innerHTML&&(o.innerHTML=a.innerHTML),o}else return""},f.setInterval=function(a,o,r,t){a._interval[o]||(a._interval[o]=window.setInterval(r.bind(a),t))},f.clearInterval=function(a,o){clearInterval(a._interval[o]),a._interval[o]=null},f.setTimeout=function(a,o,r){a._timers||(a._timers=[]);var t=setTimeout(function(){o(),f.clearTimeout(a,t)},r);return a._timers.push(t),t},f.clearTimeout=function(a,o){var r=a._timers;if(f.typeOf(r)==="Array"){for(var t=0;t<r.length;t++)if(r[t]===o){r.splice(t,1),clearTimeout(o);break}}else clearTimeout(o)},f.clearAllTimers=function(a){var o=a._timers;f.typeOf(o)==="Array"&&(o.map(function(r){clearTimeout(r)}),a._timerIds=[])},f.createImgBtn=function(a,o,r,t){var e=f.createDom("xg-".concat(a),"",{},"xgplayer-".concat(a,"-img"));if(e.style.backgroundImage='url("'.concat(o,'")'),r&&t){var i,n,s;["px","rem","em","pt","dp","vw","vh","vm","%"].every(function(l){return r.indexOf(l)>-1&&t.indexOf(l)>-1?(i=parseFloat(r.slice(0,r.indexOf(l)).trim()),n=parseFloat(t.slice(0,t.indexOf(l)).trim()),s=l,!1):!0}),e.style.width="".concat(i).concat(s),e.style.height="".concat(n).concat(s),e.style.backgroundSize="".concat(i).concat(s," ").concat(n).concat(s),a==="start"?e.style.margin="-".concat(n/2).concat(s," auto auto -").concat(i/2).concat(s):e.style.margin="auto 5px auto 5px"}return e},f.Hex2RGBA=function(a,o){var r=[];if(/^\#[0-9A-F]{3}$/i.test(a)){var t="#";a.replace(/[0-9A-F]/ig,function(e){t+=e+e}),a=t}return/^#[0-9A-F]{6}$/i.test(a)?(a.replace(/[0-9A-F]{2}/ig,function(e){r.push(parseInt(e,16))}),"rgba(".concat(r.join(","),", ").concat(o,")")):"rgba(255, 255, 255, 0.1)"},f.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},f.checkIsFunction=function(a){return a&&typeof a=="function"},f.checkIsObject=function(a){return a!==null&&W(a)==="object"},f.hide=function(a){a.style.display="none"},f.show=function(a,o){a.style.display=o||"block"},f.isUndefined=function(a){if(typeof a>"u"||a===null)return!0},f.isNotNull=function(a){return a!=null},f.setStyleFromCsstext=function(a,o){if(o)if(f.typeOf(o)==="String"){var r=o.replace(/\s+/g,"").split(";");r.map(function(t){if(t){var e=t.split(":");e.length>1&&(a.style[e[0]]=e[1])}})}else Object.keys(o).map(function(t){a.style[t]=o[t]})};function Mn(a,o){for(var r=0,t=o.length;r<t;r++)if(a.indexOf(o[r])>-1)return!0;return!1}f.filterStyleFromText=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],r=a.style.cssText;if(!r)return{};var t=r.replace(/\s+/g,"").split(";"),e={},i={};return t.map(function(n){if(n){var s=n.split(":");s.length>1&&(Mn(s[0],o)?e[s[0]]=s[1]:i[s[0]]=s[1])}}),a.setAttribute("style",""),Object.keys(i).map(function(n){a.style[n]=i[n]}),e},f.getStyleFromCsstext=function(a){var o=a.style.cssText;if(!o)return{};var r=o.replace(/\s+/g,"").split(";"),t={};return r.map(function(e){if(e){var i=e.split(":");i.length>1&&(t[i[0]]=i[1])}}),t},f.preloadImg=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(a){var t=new window.Image;t.onload=function(e){t=null,o&&o(e)},t.onerror=function(e){t=null,r&&r(e)},t.src=a}},f.stopPropagation=function(a){a&&a.stopPropagation()},f.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},f.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},f.checkTouchSupport=function(){return"ontouchstart"in window},f.getBuffered2=function(a){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.5,r=[],t=0;t<a.length;t++)r.push({start:a.start(t)<.5?0:a.start(t),end:a.end(t)});r.sort(function(l,u){var c=l.start-u.start;return c||u.end-l.end});var e=[];if(o)for(var i=0;i<r.length;i++){var n=e.length;if(n){var s=e[n-1].end;r[i].start-s<o?r[i].end>s&&(e[n-1].end=r[i].end):e.push(r[i])}else e.push(r[i])}else e=r;return new On(e)},f.getEventPos=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return a.touches&&a.touches.length>0&&(a=a.touches[0]),{x:a.x/o,y:a.y/o,clientX:a.clientX/o,clientY:a.clientY/o,offsetX:a.offsetX/o,offsetY:a.offsetY/o,pageX:a.pageX/o,pageY:a.pageY/o}},f.requestAnimationFrame=function(a){var o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(o)return o(a)},f.getHostFromUrl=function(a){if(f.typeOf(a)!=="String")return"";var o=a.split("/"),r="";return o.length>3&&o[2]&&(r=o[2]),r},f.cancelAnimationFrame=function(a){var o=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;o&&o(a)},f.isMSE=function(a){return a.media&&(a=a.media),!a||!(a instanceof HTMLMediaElement)?!1:/^blob/.test(a.currentSrc)||/^blob/.test(a.src)},f.isBlob=function(a){return typeof a=="string"&&/^blob/.test(a)},f.generateSessionId=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,o=new Date().getTime();try{a=parseInt(a)}catch{a=0}o+=a,window.performance&&typeof window.performance.now=="function"&&(o+=parseInt(window.performance.now()));var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(o+Math.random()*16)%16|0;return o=Math.floor(o/16),(t==="x"?e:e&3|8).toString(16)});return r},f.createEvent=function(a){var o;return typeof window.Event=="function"?o=new Event(a):(o=document.createEvent("Event"),o.initEvent(a,!0,!0)),o},f.adjustTimeByDuration=function(a,o,r){return!o||!a?a:a>o||r&&a<o?o:a},f.createPositionBar=function(a,o){var r=f.createDom("xg-bar","",{"data-index":-1},a);return o.appendChild(r),r},f.getTransformStyle=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{x:0,y:0,scale:1,rotate:0},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={scale:"".concat(a.scale||1),translate:"".concat(a.x||0,"%, ").concat(a.y||0,"%"),rotate:"".concat(a.rotate||0,"deg")},t=Object.keys(r);return t.forEach(function(e){var i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),n="".concat(e,"(").concat(r[e],")");i.test(o)?(i.lastIndex=-1,o=o.replace(i,n)):o+="".concat(n," ")}),o},f.convertDeg=function(a){return Math.abs(a)<=1?a*360:a%360},f.getIndexByTime=function(a,o){var r=o.length,t=-1;if(r<1)return t;if(a<=o[0].end||r<2)t=0;else if(a>o[r-1].end)t=r-1;else for(var e=1;e<r;e++)if(a>o[e-1].end&&a<=o[e].end){t=e;break}return t},f.getOffsetCurrentTime=function(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,t=-1;if(r>=0&&r<o.length?t=r:t=f.getIndexByTime(a,o),t<0)return-1;var e=o.length,i=o[t],n=i.start,s=i.end,l=i.cTime,u=i.offset;return a<n?l:a>=n&&a<=s?a-u:a>s&&t>=e-1?s:-1},f.getCurrentTimeByOffset=function(a,o){var r=-1;if(!o||o.length<0)return a;for(var t=0;t<o.length;t++)if(a<=o[t].duration){r=t;break}if(r!==-1){var e=o[r].start;return r-1<0?e+a:e+(a-o[r-1].duration)}return a};function Zt(a){var o=W(a);return a!==null&&(o==="object"||o==="function")}function Nn(a,o,r){var t,e,i,n,s,l,u=0,c=!1,h=!1,d=!0,g=!o&&o!==0&&typeof window.requestAnimationFrame=="function";if(typeof a!="function")throw new TypeError("Expected a function");o=+o||0,Zt(r)&&(c=!!r.leading,h="maxWait"in r,i=h?Math.max(+r.maxWait||0,o):i,d="trailing"in r?!!r.trailing:d);function v(N){var Z=t,ee=e;return t=e=void 0,u=N,n=a.apply(ee,Z),n}function y(N,Z){return g?(window.cancelAnimationFrame(s),window.requestAnimationFrame(N)):setTimeout(N,Z)}function C(N){if(g)return window.cancelAnimationFrame(N);clearTimeout(N)}function b(N){return u=N,s=y(B,o),c?v(N):n}function w(N){var Z=N-l,ee=N-u,te=o-Z;return h?Math.min(te,i-ee):te}function T(N){var Z=N-l,ee=N-u;return l===void 0||Z>=o||Z<0||h&&ee>=i}function B(){var N=Date.now();if(T(N))return O(N);s=y(B,w(N))}function O(N){return s=void 0,d&&t?v(N):(t=e=void 0,n)}function U(){s!==void 0&&C(s),u=0,t=l=e=s=void 0}function L(){return s===void 0?n:O(Date.now())}function Y(){return s!==void 0}function j(){for(var N=Date.now(),Z=T(N),ee=arguments.length,te=new Array(ee),Te=0;Te<ee;Te++)te[Te]=arguments[Te];if(t=te,e=this,l=N,Z){if(s===void 0)return b(l);if(h)return s=y(B,o),v(l)}return s===void 0&&(s=y(B,o)),n}return j.cancel=U,j.flush=L,j.pending=Y,j}function Fn(a,o,r){var t=!0,e=!0;if(typeof a!="function")throw new TypeError("Expected a function");return Zt(r)&&(t="leading"in r?!!r.leading:t,e="trailing"in r?!!r.trailing:e),Nn(a,o,{leading:t,trailing:e,maxWait:o})}function Bn(){var a=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return a==="zh-cn"&&(a="zh"),a}function Hn(a,o,r){if(a){var t=a.getAttribute(r);return!!(t&&t===o&&(a.tagName==="VIDEO"||a.tagName==="AUDIO"))}}var Jt={android:/(Android)\s([\d.]+)/,ios:/(Version)\/([\d.]+)/},Un=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],D={get device(){var a=D.os;return a.isPc?"pc":"mobile"},get browser(){if(typeof navigator>"u")return"";var a=navigator.userAgent.toLowerCase(),o={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(o).filter(function(r){return o[r].test(a)}))[0]},get os(){if(typeof navigator>"u")return{};var a=navigator.userAgent,o=/(?:Windows Phone)/.test(a),r=/(?:SymbianOS)/.test(a)||o,t=/(?:Android)/.test(a),e=/(?:Firefox)/.test(a),i=/(?:iPad|PlayBook)/.test(a)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,n=i||t&&!/(?:Mobile)/.test(a)||e&&/(?:Tablet)/.test(a),s=/(?:iPhone)/.test(a)&&!n,l=!s&&!t&&!r&&!n;return{isTablet:n,isPhone:s,isIpad:i,isIos:s||i,isAndroid:t,isPc:l,isSymbian:r,isWindowsPhone:o,isFireFox:e}},get osVersion(){if(typeof navigator>"u")return 0;var a=navigator.userAgent,o="";/(?:iPhone)|(?:iPad|PlayBook)/.test(a)?o=Jt.ios:o=Jt.android;var r=o?o.exec(a):[];if(r&&r.length>=3){var t=r[2].split(".");return t.length>0?parseInt(t[0]):0}return 0},get isWeixin(){if(typeof navigator>"u")return!1;var a=/(micromessenger)\/([\d.]+)/,o=a.exec(navigator.userAgent.toLocaleLowerCase());return!!o},isSupportMP4:function(){var o={isSupport:!1,mime:""};if(typeof document>"u")return o;if(this.supportResult)return this.supportResult;var r=document.createElement("video");return typeof r.canPlayType=="function"&&Un.map(function(t){r.canPlayType('video/mp4; codecs="'.concat(t,'"'))==="probably"&&(o.isSupport=!0,o.mime+="||".concat(t))}),this.supportResult=o,r=null,o},isMSESupport:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(typeof MediaSource>"u"||!MediaSource)return!1;try{return MediaSource.isTypeSupported(o)}catch(r){return this._logger.error(o,r),!1}},isHevcSupported:function(){return typeof MediaSource>"u"||!MediaSource.isTypeSupported?!1:MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')},probeConfigSupported:function(o){var r={supported:!1,smooth:!1,powerEfficient:!1};if(!o||typeof navigator>"u")return Promise.resolve(r);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(o);var t=o.video||{},e=o.audio||{};try{var i=MediaSource.isTypeSupported(t.contentType),n=MediaSource.isTypeSupported(e.contentType);return Promise.resolve({supported:i&&n,smooth:!1,powerEfficient:!1})}catch{return Promise.resolve(r)}}},gt="3.0.18",Qt={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},ei={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Ue=S(function a(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};E(this,a);var t=o&&o.i18n?o.i18n.ERROR_TYPES:null;if(o.media){var e=r.mediaError?r.mediaError:o.media.error||{},i=o.duration,n=o.currentTime,s=o.ended,l=o.src,u=o.currentSrc,c=o.media,h=c.readyState,d=c.networkState,g=r.errorCode||e.code;ei[g]&&(g=ei[g]);var v={playerVersion:gt,currentTime:n,duration:i,ended:s,readyState:h,networkState:d,src:l||u,errorType:r.errorType,errorCode:g,message:r.errorMessage||e.message,mediaError:e,originError:r.originError?r.originError.stack:"",host:f.getHostFromUrl(l||u)};return r.ext&&Object.keys(r.ext).map(function(w){v[w]=r.ext[w]}),v}else if(arguments.length>1){for(var y={playerVersion:gt,domain:document.domain},C=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],b=0;b<arguments.length;b++)y[C[b]]=arguments[b];return y.ex=t?(t[arguments[0]]||{}).msg:"",y}}),$="play",pt="playing",me="ended",we="pause",Oe="error",Ve="seeking",se="seeked",X="timeupdate",Me="waiting",oe="canplay",Vn="canplaythrough",ce="durationchange",ti="volumechange",ae="loadeddata",zn="loadedmetadata",ii="ratechange",ni="progress",vt="loadstart",ye="emptied",jn="stalled",Wn="suspend",Gn="abort",Kn="bufferedChange",mt="focus",ri="blur",yt="ready",si="urlNull",_e="autoplay_started",_t="autoplay_was_prevented",ze="complete",je="replay",Ct="destroy",We="urlchange",kt="download_speed_change",oi="leaveplayer",ai="enterplayer",li="loading",le="fullscreen_change",Ge="cssFullscreen_change",Ke="mini_state_change",bt="definition_change",Yn="before_definition_change",Tt="after_definition_change",$n="SEI_PARSED",Xn="retry",fe="video_resize",wt="pip_change",ui="rotate",ci="screenShot",Ye="playnext",fi="shortcut",hi="xglog",$e="user_action",Xe="reset",di="source_error",gi="source_success",qn="switch_subtitle",pi=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],vi={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},mi="fps_stuck";const Zn=Object.freeze(Object.defineProperty({__proto__:null,ABORT:Gn,AFTER_DEFINITION_CHANGE:Tt,AUTOPLAY_PREVENTED:_t,AUTOPLAY_STARTED:_e,BEFORE_DEFINITION_CHANGE:Yn,BUFFER_CHANGE:Kn,CANPLAY:oe,CANPLAY_THROUGH:Vn,COMPLETE:ze,CSS_FULLSCREEN_CHANGE:Ge,DEFINITION_CHANGE:bt,DESTROY:Ct,DOWNLOAD_SPEED_CHANGE:kt,DURATION_CHANGE:ce,EMPTIED:ye,ENDED:me,ENTER_PLAYER:ai,ERROR:Oe,FPS_STUCK:mi,FULLSCREEN_CHANGE:le,LEAVE_PLAYER:oi,LOADED_DATA:ae,LOADED_METADATA:zn,LOADING:li,LOAD_START:vt,MINI_STATE_CHANGE:Ke,PAUSE:we,PIP_CHANGE:wt,PLAY:$,PLAYER_BLUR:ri,PLAYER_FOCUS:mt,PLAYING:pt,PLAYNEXT:Ye,PROGRESS:ni,RATE_CHANGE:ii,READY:yt,REPLAY:je,RESET:Xe,RETRY:Xn,ROTATE:ui,SCREEN_SHOT:ci,SEEKED:se,SEEKING:Ve,SEI_PARSED:$n,SHORTCUT:fi,SOURCE_ERROR:di,SOURCE_SUCCESS:gi,STALLED:jn,STATS_EVENTS:vi,SUSPEND:Wn,SWITCH_SUBTITLE:qn,TIME_UPDATE:X,URL_CHANGE:We,URL_NULL:si,USER_ACTION:$e,VIDEO_EVENTS:pi,VIDEO_RESIZE:fe,VOLUME_CHANGE:ti,WAITING:Me,XGLOG:hi},Symbol.toStringTag,{value:"Module"}));function Et(a,o){!this||!this.emit||(a==="error"?this.errorHandler(a,o.error):this.emit(a,o))}function Jn(a,o){return function(r,t){var e={player:o,eventName:a,originalEvent:r,detail:r.detail||{},timeStamp:r.timeStamp,currentTime:o.currentTime,duration:o.duration,paused:o.paused,ended:o.ended,isInternalOp:!!o._internalOp[r.type],muted:o.muted,volume:o.volume,host:f.getHostFromUrl(o.currentSrc),vtype:o.vtype};if(o.removeInnerOP(r.type),a==="timeupdate"&&(o._currentTime=o.media&&o.media.currentTime),a==="ratechange"){var i=o.media?o.media.playbackRate:0;if(i&&o._rate===i)return;o._rate=o.media&&o.media.playbackRate}if(a==="durationchange"&&(o._duration=o.media.duration),a==="volumechange"&&(e.isMutedChange=o._lastMuted!==o.muted,o._lastMuted=o.muted),a==="error"&&(e.error=t||o.video.error),o.mediaEventMiddleware[a]){var n=Et.bind(o,a,e);try{o.mediaEventMiddleware[a].call(o,e,n)}catch(s){throw Et.call(o,a,e),s}}else Et.call(o,a,e)}}var Qn=function(a){x(r,a);var o=P(r);function r(t){var e;E(this,r),e=o.call(this,t),e._hasStart=!1,e._currentTime=0,e._duration=0,e._internalOp={},e._lastMuted=!1,e.vtype="MP4",e._rate=-1,e.mediaConfig=Object.assign({},{controls:!1,autoplay:t.autoplay,playsinline:t.playsinline,"x5-playsinline":t.playsinline,"webkit-playsinline":t.playsinline,"x5-video-player-fullscreen":t["x5-video-player-fullscreen"]||t.x5VideoPlayerFullscreen,"x5-video-orientation":t["x5-video-orientation"]||t.x5VideoOrientation,airplay:t.airplay,"webkit-airplay":t.airplay,tabindex:t.tabindex|0,mediaType:t.mediaType||"video","data-index":-1},t.videoConfig,t.videoAttributes);var i=t["x5-video-player-type"]||t.x5VideoPlayerType;return D.isWeixin&&D.os.isAndroid&&i&&(e.mediaConfig["x5-video-player-type"]=i,delete e.mediaConfig.playsinline,delete e.mediaConfig["webkit-playsinline"],delete e.mediaConfig["x5-playsinline"]),t.loop&&(e.mediaConfig.loop="loop"),t.autoplayMuted&&!Object.prototype.hasOwnProperty.call(e.mediaConfig,"muted")&&(e.mediaConfig.muted=!0),e.media=f.createDom(e.mediaConfig.mediaType,"",e.mediaConfig,""),t.defaultPlaybackRate&&(e.media.defaultPlaybackRate=e.media.playbackRate=t.defaultPlaybackRate),f.typeOf(t.volume)==="Number"&&(e.volume=t.volume),t.autoplayMuted&&(e.media.muted=!0,e._lastMuted=!0),t.autoplay&&(e.media.autoplay=!0),e._interval={},e.mediaEventMiddleware={},e.attachVideoEvents(),e}return S(r,[{key:"setEventsMiddleware",value:function(e){var i=this;Object.keys(e).map(function(n){i.mediaEventMiddleware[n]=e[n]})}},{key:"removeEventsMiddleware",value:function(e){var i=this;Object.keys(e).map(function(n){delete i.mediaEventMiddleware[n]})}},{key:"attachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers||(this._evHandlers=pi.map(function(n){var s="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1));return typeof e[s]=="function"&&e.on(n,e[s]),_({},n,Jn(n,e))})),this._evHandlers.forEach(function(n){var s=Object.keys(n)[0];i.addEventListener(s,n[s],!1)})}},{key:"detachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers.forEach(function(n){var s=Object.keys(n)[0];i.removeEventListener(s,n[s],!1)}),this._evHandlers.forEach(function(n){var s=Object.keys(n)[0],l="on".concat(s.charAt(0).toUpperCase()).concat(s.slice(1));typeof e[l]=="function"&&e.off(s,e[l])}),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,i){var n=this;e.removeAttribute("src"),e.load(),i.forEach(function(h,d){n.media.appendChild(f.createDom("source","",{src:"".concat(h.src),type:"".concat(h.type||""),"data-index":d+1}))});var s=e.children;if(s){this._videoSourceCount=s.length,this._videoSourceIndex=s.length,this._vLoadeddata=function(h){n.emit(gi,{src:h.target.currentSrc,host:f.getHostFromUrl(h.target.currentSrc)})};for(var l=null,u=0;u<this._evHandlers.length;u++)if(Object.keys(this._evHandlers[u])[0]==="error"){l=this._evHandlers[u];break}!this._sourceError&&(this._sourceError=function(h){var d=parseInt(h.target.getAttribute("data-index"),10);if(n._videoSourceIndex--,n._videoSourceIndex===0||d>=n._videoSourceCount){var g={code:4,message:"sources_load_error"};l?l.error(h,g):n.errorHandler("error",g)}var v=Qt[4];n.emit(di,new Ue(n,{errorType:v,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:h.target.src}))});for(var c=0;c<s.length;c++)s[c].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var i=e.children;if(!(!i||i.length===0||!this._sourceError)){for(var n=0;n<i.length;n++)i[n].removeEventListener("error",this._sourceError);for(;i.length>0;)e.removeChild(i[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.media&&(this.media.error||i)){var n=this.media.error||i,s=n.code?Qt[n.code]:"other",l=n.message;this.media.currentSrc||(l="empty_src",n={code:6,message:l}),this.emit(e,new Ue(this,{errorType:s,errorCode:n.code,errorMessage:n.message||"",mediaError:n}))}}},{key:"destroy",value:function(){this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null;for(var e in this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){var e=this.media?this.media.play():null;return e}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return this.media?this.media.canPlayType(e):!1}},{key:"getBufferedRange",value:function(e){var i=[0,0];if(!this.media)return i;e||(e=this.media.buffered);var n=this.media.currentTime;if(e)for(var s=0,l=e.length;s<l&&(i[0]=e.start(s),i[1]=e.end(s),!(i[0]<=n&&n<=i[1]));s++);return i[0]-n<=0&&n-i[1]<=0?i:[0,0]}},{key:"autoplay",get:function(){return this.media?this.media.autoplay:!1},set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?f.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var i=this.media.buffered;if(!i||i.length===0)return e;for(var n=0;n<i.length;n++)if((i.start(n)<=this.currentTime||i.start(n)<.1)&&i.end(n)>=this.currentTime)return{start:i.start(n),end:i.end(n)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?this.media.currentTime!==void 0?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return this.media?this.media.defaultMuted:!1},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return this.media?this.media.ended:!1}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){var e=this.media.error;if(!e)return"";var i=["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"];return i[this.media.error.code-1]}},{key:"loop",get:function(){return this.media?this.media.loop:!1},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return this.media?this.media.muted:!1},set:function(e){!this.media||this.media.muted===e||(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return this.media?this.media.paused:!0}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){!this.media||e===1/0||(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return this.media?this.media.preload:!1},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return this.media?this.media.seekable:!1}},{key:"seeking",get:function(){return this.media?this.media.seeking:!1}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){if(this.media){if(this.emit(We,e),this.emit(Me),this._currentTime=0,this._duration=0,f.isMSE(this.media)){this.onWaiting();return}this._detachSourceEvents(this.media),f.typeOf(e)==="Array"?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()}}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e===1/0||!this.media||(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"emit",this)).call.apply(n,[this,e,i].concat(l))}},{key:"on",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"on",this)).call.apply(n,[this,e,i].concat(l))}},{key:"once",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"once",this)).call.apply(n,[this,e,i].concat(l))}},{key:"off",value:function(e,i){for(var n,s=arguments.length,l=new Array(s>2?s-2:0),u=2;u<s;u++)l[u-2]=arguments[u];(n=A(I(r.prototype),"off",this)).call.apply(n,[this,e,i].concat(l))}},{key:"offAll",value:function(){A(I(r.prototype),"removeAllListeners",this).call(this)}}]),r}(qt),er=function(){function a(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};E(this,a),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=o}return S(a,[{key:"openDB",value:function(r){var t=this,e=this,i=this.myDB.version||1,n=e.indexedDB.open(e.myDB.name,i);n.onerror=function(s){},n.onsuccess=function(s){t.myDB.db=s.target.result,r.call(e)},n.onupgradeneeded=function(s){var l=s.target.result;s.target.transaction,l.objectStoreNames.contains(e.myDB.ojstore.name)||l.createObjectStore(e.myDB.ojstore.name,{keyPath:e.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){var r=this;r.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,n=0;n<t.length;n++)i=e.add(t[n]),i.onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,n=0;n<t.length;n++)i=e.put(t[n]),i.onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(r,t,e){var i=this,n=this.myDB.db.transaction(r,"readwrite").objectStore(r),s=n.get(t);s.onerror=function(){e.call(i,null)},s.onsuccess=function(l){var u=l.target.result;e.call(i,u)}}},{key:"deleteData",value:function(r,t){var e=this.myDB.db.transaction(r,"readwrite").objectStore(r);e.delete(t)}},{key:"clearData",value:function(r){var t=this.myDB.db.transaction(r,"readwrite").objectStore(r);t.clear()}}]),a}(),yi=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],_i=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],Ci=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],Ce="data-xgplayerid";function qe(a,o,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i<t;i++)e[i-3]=arguments[i];var n=o.call.apply(o,[a].concat(e));!r||typeof r!="function"||(n&&n.then?n.then(function(){for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];r.call.apply(r,[a].concat(l))}):r.call.apply(r,[a].concat(e)))}function Ze(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[a]&&(this.__hooks[a]=null),(function(){var t=arguments,e=this;if(r.pre)try{var i;(i=r.pre).call.apply(i,[this].concat(Array.prototype.slice.call(arguments)))}catch(l){throw l.message="[pluginName: ".concat(this.pluginName,":").concat(a,":pre error] >> ").concat(l.message),l}if(this.__hooks&&this.__hooks[a])try{var n,s=(n=this.__hooks[a]).call.apply(n,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then(function(l){l!==!1&&qe.apply(void 0,[e,o,r.next].concat(J(t)))}).catch(function(l){throw l}):qe.apply(void 0,[this,o,r.next].concat(Array.prototype.slice.call(arguments))):s===void 0&&qe.apply(void 0,[this,o,r.next].concat(Array.prototype.slice.call(arguments)))}catch(l){throw l.message="[pluginName: ".concat(this.pluginName,":").concat(a,"] >> ").concat(l.message),l}else qe.apply(void 0,[this,o,r.next].concat(Array.prototype.slice.call(arguments)))}).bind(this)}function Je(a,o){var r=this.__hooks;if(r)return r.hasOwnProperty(a)?(r&&(r[a]=o),!0):(console.warn("has no supported hook which name [".concat(a,"]")),!1)}function Qe(a,o){var r=this.__hooks;r&&delete r[a]}function ki(a){if(!(!this.plugins||!this.plugins[a.toLowerCase()])){for(var o=this.plugins[a.toLowerCase()],r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return o.useHooks&&o.useHooks.apply(o,t)}}function bi(a){if(!(!this.plugins||!this.plugins[a.toLowerCase()])){var o=this.plugins[a.toLowerCase()];if(o){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return o.removeHooks&&o.removeHooks.apply(o,t)}}}function Ti(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];a.__hooks={},o&&o.map(function(r){a.__hooks[r]=null}),Object.defineProperty(a,"hooks",{get:function(){return a.__hooks&&Object.keys(a.__hooks).map(function(t){if(a.__hooks[t])return t})}})}function wi(a){a.__hooks=null}function ue(a,o,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i<t;i++)e[i-3]=arguments[i];if(a.__hooks&&a.__hooks[o]){var n,s=(n=a.__hooks[o]).call.apply(n,[a,a].concat(e));if(s&&s.then)s.then(function(l){return l===!1?null:r.call.apply(r,[a,a].concat(e))}).catch(function(l){console.warn("[runHooks]".concat(o," reject"),l.message)});else if(s!==!1)return r.call.apply(r,[a,a].concat(e))}else return r.call.apply(r,[a,a].concat(e))}function St(a,o){R.logError("[".concat(a,"] event or callback cant be undefined or null when call ").concat(o))}var he=function(){function a(o){E(this,a),f.checkIsFunction(this.beforeCreate)&&this.beforeCreate(o),Ti(this),this.__args=o,this.__events={},this.__onceEvents={},this.config=o.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(o)}return S(a,[{key:"beforeCreate",value:function(r){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(r){this.player=r.player,this.playerConfig=r.player&&r.player.config,this.pluginName=r.pluginName?r.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=r.player&&r.player.logger}},{key:"updateLang",value:function(r){r||(r=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var r=f.checkTouchSupport()?"touch":"mouse";return this.playerConfig&&(this.playerConfig.domEventType==="touch"||this.playerConfig.domEventType==="mouse")&&(r=this.playerConfig.domEventType),r}},{key:"on",value:function(r,t){var e=this;if(!r||!t||!this.player){St(this.pluginName,"plugin.on(event, callback)");return}typeof r=="string"?(this.__events[r]=t,this.player.on(r,t)):Array.isArray(r)&&r.forEach(function(i){e.__events[i]=t,e.player.on(i,t)})}},{key:"once",value:function(r,t){var e=this;if(!r||!t||!this.player){St(this.pluginName,"plugin.once(event, callback)");return}typeof r=="string"?(this.__onceEvents[r]=t,this.player.once(r,t)):Array.isArray(r)&&r.forEach(function(i){e.__onceEvents[i]=t,e.player.once(r,t)})}},{key:"off",value:function(r,t){var e=this;if(!r||!t||!this.player){St(this.pluginName,"plugin.off(event, callback)");return}typeof r=="string"?(delete this.__events[r],this.player.off(r,t)):Array.isArray(r)&&r.forEach(function(i){delete e.__events[r],e.player.off(i,t)})}},{key:"offAll",value:function(){var r=this;["__events","__onceEvents"].forEach(function(t){Object.keys(r[t]).forEach(function(e){r[t][e]&&r.off(e,r[t][e]),e&&delete r[t][e]})}),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(r){var t;if(this.player){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];(t=this.player).emit.apply(t,[r].concat(i))}}},{key:"emitUserAction",value:function(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.player){var i=V(V({},e),{},{pluginName:this.pluginName});this.player.emitUserAction(r,t,i)}}},{key:"hook",value:function(r,t){return Ze.call.apply(Ze,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),n=2;n<e;n++)i[n-2]=arguments[n];return Je.call.apply(Je,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),n=2;n<e;n++)i[n-2]=arguments[n];return Qe.call.apply(Qe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";if(this.player)return e&&(t.pluginName=e),this.player.registerPlugin({plugin:r,options:t})}},{key:"getPlugin",value:function(r){return this.player?this.player.getPlugin(r):null}},{key:"__destroy",value:function(){var r=this,t=this.player,e=this.pluginName;this.offAll(),f.clearAllTimers(this),f.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map(function(i){r[i]=null}),t.unRegisterPlugin(e),wi(this)}}],[{key:"defineGetterOrSetter",value:function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.defineProperty(r,e,t[e])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),a}(),tr=9;if(typeof Element<"u"&&!Element.prototype.matches){var Ee=Element.prototype;Ee.matches=Ee.matchesSelector||Ee.mozMatchesSelector||Ee.msMatchesSelector||Ee.oMatchesSelector||Ee.webkitMatchesSelector}function ir(a,o){for(;a&&a.nodeType!==tr;){if(typeof a.matches=="function"&&a.matches(o))return a;a=a.parentNode}}var nr=ir,rr=nr;function xt(a,o,r,t,e){var i=or.apply(this,arguments);return a.addEventListener(r,i,e),{destroy:function(){a.removeEventListener(r,i,e)}}}function sr(a,o,r,t,e){return typeof a.addEventListener=="function"?xt.apply(null,arguments):typeof r=="function"?xt.bind(null,document).apply(null,arguments):(typeof a=="string"&&(a=document.querySelectorAll(a)),Array.prototype.map.call(a,function(i){return xt(i,o,r,t,e)}))}function or(a,o,r,t){return function(e){e.delegateTarget=rr(e.target,o),e.delegateTarget&&t.call(a,e)}}var ar=sr;const Ei=at(ar);var lr={CONTROLS:"controls",ROOT:"root"},H={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},Si={ICON_DISABLE:"xg-icon-disable",ICON_HIDE:"xg-icon-hide"};function Pt(a){return a?a.indexOf&&/^(?:http|data:|\/)/.test(a):!1}function ur(a,o){return W(a)==="object"&&a.class&&typeof a.class=="string"?"".concat(o," ").concat(a.class):o}function cr(a,o){return W(a)==="object"&&a.attr&&W(a.attr)==="object"&&Object.keys(a.attr).map(function(r){o[r]=a.attr[r]}),o}function xi(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",i=null;if(a instanceof window.Element)return f.addClass(a,r),Object.keys(t).map(function(n){a.setAttribute(n,t[n])}),a;if(Pt(a)||Pt(a.url))return t.src=Pt(a)?a:a.url||"",i=f.createDom(a.tag||"img","",t,"xg-img ".concat(r)),i;if(typeof a=="function")try{return i=a(),i instanceof window.Element?(f.addClass(i,r),Object.keys(t).map(function(n){i.setAttribute(n,t[n])}),i):(R.logWarn("warn>>icons.".concat(o," in config of plugin named [").concat(e,"] is a function mast return an Element Object")),null)}catch(n){return R.logError("Plugin named [".concat(e,"]:createIcon"),n),null}return typeof a=="string"?f.createDomFromHtml(a,t,r):(R.logWarn("warn>>icons.".concat(o," in config of plugin named [").concat(e,"] is invalid")),null)}function fr(a,o){var r=o.config.icons||o.playerConfig.icons;Object.keys(a).map(function(t){var e=a[t],i=e&&e.class?e.class:"",n=e&&e.attr?e.attr:{},s=null;r&&r[t]&&(i=ur(r[t],i),n=cr(r[t],n),s=xi(r[t],t,i,n,o.pluginName)),!s&&e&&(s=xi(e.icon?e.icon:e,n,i,{},o.pluginName)),o.icons[t]=s})}function hr(a,o){Object.keys(a).map(function(r){Object.defineProperty(o.langText,r,{get:function(){var e=o.lang,i=o.i18n;return i[r]?i[r]:a[r]&&a[r][e]||""}})})}var F=function(a){x(r,a);var o=P(r);function r(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return E(this,r),t=o.call(this,e),t.__delegates=[],t}return S(r,[{key:"__init",value:function(e){if(A(I(r.prototype),"__init",this).call(this,e),!!e.root){var i=e.root,n=null;this.icons={},this.root=null,this.parent=null;var s=this.registerIcons()||{};fr(s,this),this.langText={};var l=this.registerLanguageTexts()||{};hr(l,this);var u="";try{u=this.render()}catch(d){throw R.logError("Plugin:".concat(this.pluginName,":render"),d),new Error("Plugin:".concat(this.pluginName,":render:").concat(d.message))}if(u)n=r.insert(u,i,e.index),n.setAttribute("data-index",e.index);else if(e.tag)n=f.createDom(e.tag,"",e.attr,e.name),n.setAttribute("data-index",e.index),i.appendChild(n);else return;this.root=n,this.parent=i;var c=this.config.attr||{},h=this.config.style||{};this.setAttr(c),this.setStyle(h),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var i=this.children();i&&W(i)==="object"&&Object.keys(i).length>0&&Object.keys(i).map(function(n){var s=n,l=i[s],u={root:e.root},c,h;typeof l=="function"?(c=e.config[s]||{},h=l):W(l)==="object"&&typeof l.plugin=="function"&&(c=l.options?f.deepCopy(e.config[s]||{},l.options):e.config[s]||{},h=l.plugin),u.config=c,c.index!==void 0&&(u.index=c.index),c.root&&(u.root=c.root),e.registerPlugin(h,u,s)})}}},{key:"updateLang",value:function(e){e||(e=this.lang);function i(u,c){for(var h=0;h<u.children.length;h++)u.children[h].children.length>0?i(u.children[h],c):c(u.children[h])}var n=this.root,s=this.i18n,l=this.langText;n&&i(n,function(u){var c=u.getAttribute&&u.getAttribute("lang-key");if(c){var h=s[c.toUpperCase()]||l[c];h&&(u.innerHTML=typeof h=="function"?h(e):h)}})}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=this.i18n||{},s=this.langText;e.setAttribute&&e.setAttribute("lang-key",i);var l=n[i]||s[i]||"";l&&(e.innerHTML=l)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,f.addClass(this.find(".xgplayer-icon"),Si.ICON_DISABLE)}},{key:"enable",value:function(){this.config.disable=!1,f.removeClass(this.find(".xgplayer-icon"),Si.ICON_DISABLE)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";i.root=i.root||this.root;var s=A(I(r.prototype),"registerPlugin",this).call(this,e,i,n);return this._children.push(s),s}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,i,n){var s=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(u){s.bindEL(u,i)}):this.bindEL(e,i);else{var l=r.delegate.call(this,this.root,e,i,n);this.__delegates=this.__delegates.concat(l)}}},{key:"unbind",value:function(e,i){var n=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(u){n.unbindEL(u,i)}):this.unbindEL(e,i);else for(var s="".concat(e,"_").concat(i),l=0;l<this.__delegates.length;l++)if(this.__delegates[l].key===s){this.__delegates[l].destroy(),this.__delegates.splice(l,1);break}}},{key:"setStyle",value:function(e,i){var n=this;if(this.root){if(f.typeOf(e)==="String")return this.root.style[e]=i;f.typeOf(e)==="Object"&&Object.keys(e).map(function(s){n.root.style[s]=e[s]})}}},{key:"setAttr",value:function(e,i){var n=this;if(this.root){if(f.typeOf(e)==="String")return this.root.setAttribute(e,i);f.typeOf(e)==="Object"&&Object.keys(e).map(function(s){n.root.setAttribute(s,e[s])})}}},{key:"setHtml",value:function(e,i){this.root&&(this.root.innerHTML=e,typeof i=="function"&&i())}},{key:"bindEL",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.addEventListener(e,i,n)}},{key:"unbindEL",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.removeEventListener(e,i,n)}},{key:"show",value:function(e){if(this.root){this.root.style.display=e!==void 0?e:"block";var i=window.getComputedStyle(this.root,null),n=i.getPropertyValue("display");if(n==="none")return this.root.style.display="block"}}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,i){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!i||!(i instanceof window.Element))return null;try{return typeof e=="string"?this.find(e).appendChild(i):e.appendChild(i)}catch(n){return R.logError("Plugin:appendChild",n),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,i=this.player;this.__delegates.map(function(n){n.destroy()}),this.__delegates=[],this._children instanceof Array&&(this._children.map(function(n){i.unRegisterPlugin(n.pluginName)}),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),A(I(r.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map(function(n){e[n]=null})}}],[{key:"insert",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=i.children.length,l=Number(n),u=e instanceof window.Node;if(s){for(var c=0,h=null,d="";c<s;c++){h=i.children[c];var g=Number(h.getAttribute("data-index"));if(g>=l){d="beforebegin";break}else g<l&&(d="afterend")}return u?d==="afterend"?i.appendChild(e):i.insertBefore(e,h):h.insertAdjacentHTML(d,e),d==="afterend"?i.children[i.children.length-1]:i.children[c]}else return u?i.appendChild(e):i.insertAdjacentHTML("beforeend",e),i.children[i.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,i,n,s){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,u=[];if(e instanceof window.Node&&typeof s=="function")if(Array.isArray(n))n.forEach(function(h){var d=Ei(e,i,h,s,l);d.key="".concat(i,"_").concat(h),u.push(d)});else{var c=Ei(e,i,n,s,l);c.key="".concat(i,"_").concat(n),u.push(c)}return u}},{key:"ROOT_TYPES",get:function(){return lr}},{key:"POSITIONS",get:function(){return H}}]),r}(he),dr=function(){function a(){var o=this;if(E(this,a),_(this,"__trigger",function(r){var t=new Date().getTime();o.timeStamp=t;for(var e=0;e<r.length;e++)o.__runHandler(r[e].target)}),this.__handlers=[],this.timeStamp=0,this.observer=null,!!window.ResizeObserver)try{this.observer=new window.ResizeObserver(Fn(this.__trigger,100,{trailing:!0})),this.timeStamp=new Date().getTime()}catch(r){console.error(r)}}return S(a,[{key:"addObserver",value:function(r,t){if(this.observer){this.observer&&this.observer.observe(r);for(var e=r.getAttribute(Ce),i=this.__handlers,n=-1,s=0;s<i.length;s++)i[s]&&r===i[s].target&&(n=s);n>-1?this.__handlers[n].handler=t:this.__handlers.push({target:r,handler:t,playerId:e})}}},{key:"unObserver",value:function(r){var t=-1;this.__handlers.map(function(e,i){r===e.target&&(t=i)});try{this.observer&&this.observer.unobserve(r)}catch{}this.observer&&this.observer.unobserve(r),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(r){for(var t=this.__handlers,e=0;e<t.length;e++)if(t[e]&&r===t[e].target){try{t[e].handler(r)}catch(i){console.error(i)}return!0}return!1}}]),a}(),Ne=null;function gr(a,o){return Ne||(Ne=new dr),Ne.addObserver(a,o),Ne}function pr(a,o){Ne.unObserver(a,o)}var z={pluginGroup:{},init:function(o){var r=o._pluginInfoId;r||(r=new Date().getTime(),o._pluginInfoId=r),!o.config.closeResizeObserver&&gr(o.root,function(){o.resize()}),this.pluginGroup[r]={_originalOptions:o.config||{},_plugins:{}}},formatPluginInfo:function(o,r){var t=null,e=null;return o.plugin&&typeof o.plugin=="function"?(t=o.plugin,e=o.options):(t=o,e={}),r&&(e.config=r||{}),{PLUFGIN:t,options:e}},checkPluginIfExits:function(o,r){for(var t=0;t<r.length;t++)if(o.toLowerCase()===r[t].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(o,r){for(var t=Object.keys(r),e=null,i=0;i<t.length;i++)if(o.toLowerCase()===t[i].toLowerCase()){e=r[t[i]];break}return f.typeOf(e)==="Object"?{root:e.root,position:e.position}:{}},lazyRegister:function(o,r){var t=this,e=r.timeout||1500;return Promise.race([r.loader().then(function(i){var n;i&&i.__esModule?n=i.default:n=i,t.register(o,n,i.options)}),new Promise(function(i,n){setTimeout(function(){n(new Error("timeout"))},e)})])},register:function(o,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!(!o||!r||typeof r!="function"||r.prototype===void 0)){var e=o._pluginInfoId;if(!(!e||!this.pluginGroup[e])){this.pluginGroup[e]._plugins||(this.pluginGroup[e]._plugins={});var i=this.pluginGroup[e]._plugins,n=this.pluginGroup[e]._originalOptions;t.player=o;var s=t.pluginName||r.pluginName;if(!s)throw new Error("The property pluginName is necessary");if(r.isSupported&&!r.isSupported(o.config.mediaType,o.config.codecType)){console.warn("not supported plugin [".concat(s,"]"));return}t.config||(t.config={});for(var l=Object.keys(n),u=0;u<l.length;u++)if(s.toLowerCase()===l[u].toLowerCase()){var c=n[l[u]];f.typeOf(c)==="Object"?t.config=Object.assign({},t.config,n[l[u]]):f.typeOf(c)==="Boolean"&&(t.config.disable=!c);break}r.defaultConfig&&Object.keys(r.defaultConfig).forEach(function(d){typeof t.config[d]>"u"&&(t.config[d]=r.defaultConfig[d])}),t.root?typeof t.root=="string"&&(t.root=o[t.root]):t.root=o.root,t.index=t.config.index||0;try{i[s.toLowerCase()]&&(this.unRegister(e,s.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(s,"] exist, destroy the old instance")));var h=new r(t);return i[s.toLowerCase()]=h,i[s.toLowerCase()].func=r,h&&typeof h.afterCreate=="function"&&h.afterCreate(),h}catch(d){throw console.error(d),d}}}},unRegister:function(o,r){o._pluginInfoId&&(o=o._pluginInfoId),r=r.toLowerCase();try{var t=this.pluginGroup[o]._plugins[r];t&&(t.pluginName&&t.__destroy(),delete this.pluginGroup[o]._plugins[r])}catch(e){console.error("[unRegister:".concat(r,"] cgid:[").concat(o,"] error"),e)}},deletePlugin:function(o,r){var t=o._pluginInfoId;t&&this.pluginGroup[t]&&this.pluginGroup[t]._plugins&&delete this.pluginGroup[t]._plugins[r]},getPlugins:function(o){var r=o._pluginInfoId;return r&&this.pluginGroup[r]?this.pluginGroup[r]._plugins:{}},findPlugin:function(o,r){var t=o._pluginInfoId;if(!t||!this.pluginGroup[t])return null;var e=r.toLowerCase();return this.pluginGroup[t]._plugins[e]},beforeInit:function(o){var r=this;function t(e){return!e||!e.then?new Promise(function(i){i()}):e}return new Promise(function(e){if(r.pluginGroup){var i;return o._loadingPlugins&&o._loadingPlugins.length?i=Promise.all(o._loadingPlugins):i=Promise.resolve(),i.then(function(){var n=o._pluginInfoId;if(!r.pluginGroup[n]){e();return}var s=r.pluginGroup[n]._plugins,l=[];Object.keys(s).forEach(function(u){if(s[u]&&s[u].beforePlayerInit)try{var c=s[u].beforePlayerInit();l.push(t(c))}catch(h){throw l.push(t(null)),h}}),Promise.all([].concat(l)).then(function(){e()}).catch(function(u){console.error(u),e()})})}})},afterInit:function(o){var r=o._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins;Object.keys(t).forEach(function(e){t[e]&&t[e].afterPlayerInit&&t[e].afterPlayerInit()})}},setLang:function(o,r){var t=r._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=this.pluginGroup[t]._plugins;Object.keys(e).forEach(function(i){if(e[i].updateLang)e[i].updateLang(o);else try{e[i].lang=o}catch{console.warn("".concat(i," setLang"))}})}},reRender:function(o){var r=this,t=o._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=[],i=this.pluginGroup[t]._plugins;Object.keys(i).forEach(function(n){n!=="controls"&&i[n]&&(e.push({plugin:i[n].func,options:i[n].__args}),r.unRegister(t,n))}),e.forEach(function(n){r.register(o,n.plugin,n.options)})}},onPluginsReady:function(o){var r=o._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins||{};Object.keys(t).forEach(function(e){t[e].onPluginsReady&&typeof t[e].onPluginsReady=="function"&&t[e].onPluginsReady()})}},destroy:function(o){var r=o._pluginInfoId;if(this.pluginGroup[r]){pr(o.root);for(var t=this.pluginGroup[r]._plugins,e=0,i=Object.keys(t);e<i.length;e++){var n=i[e];this.unRegister(r,n)}delete this.pluginGroup[r],delete o._pluginInfoId}}},k={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function Pi(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:Bn(),controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}}}var vr=function(o,r){var t,e,i;r.preset&&r.options?i=new r.preset(r.options,o.config):i=new r({},o.config);var n=i,s=n.plugins,l=s===void 0?[]:s,u=n.ignores,c=u===void 0?[]:u,h=n.icons,d=h===void 0?{}:h,g=n.i18n,v=g===void 0?[]:g;o.config.plugins||(o.config.plugins=[]),o.config.ignores||(o.config.ignores=[]),(t=o.config.plugins).push.apply(t,J(l)),(e=o.config.ignores).push.apply(e,J(c)),Object.keys(d).map(function(C){o.config.icons[C]||(o.config.icons[C]=d[C])});var y=o.config.i18n||[];v.push.apply(v,J(y)),o.config.i18n=v},mr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onMouseEnter",function(s){var l=m(t),u=l.player,c=l.playerConfig;c.closeControlsBlur&&u.focus({autoHide:!1})}),_(m(t),"onMouseLeave",function(s){var l=m(t),u=l.player;u.focus()}),t}return S(r,[{key:"beforeCreate",value:function(e){!e.config.mode&&D.device==="mobile"&&(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.disable,s=i.height,l=i.mode;if(!n){l==="flex"&&this.player.addClass(k.FLEX_CONTROLS);var u={height:"".concat(s,"px")};Object.keys(u).map(function(h){e.root.style[h]=u[h]}),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-controls"),this.on(Ke,function(h){h?f.addClass(e.root,"mini-controls"):f.removeClass(e.root,"mini-controls")});var c=this.playerConfig.isMobileSimulateMode;D.device!=="mobile"&&c!=="mobile"&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave))}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&f.addClass(this.root,k.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){f.removeClass(this.root,k.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var s=e.defaultConfig||{};if(!i.root){var l=i.position?i.position:i.config&&i.config.position?i.config.position:s.position;switch(l){case H.CONTROLS_LEFT:i.root=this.left;break;case H.CONTROLS_RIGHT:i.root=this.right;break;case H.CONTROLS_CENTER:i.root=this.center;break;case H.CONTROLS:i.root=this.root;break;default:i.root=this.left}return A(I(r.prototype),"registerPlugin",this).call(this,e,i,n)}}}},{key:"destroy",value:function(){D.device!=="mobile"&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{key:"render",value:function(){var e=this.config,i=e.mode,n=e.autoHide,s=e.initShow,l=e.disable;if(!l){var u=f.classNames({"xgplayer-controls":!0},{"flex-controls":i==="flex"},{"bottom-controls":i==="bottom"},_({},k.CONTROLS_AUTOHIDE,n),{"xgplayer-controls-initshow":s||!n});return'<xg-controls class="'.concat(u,`" unselectable="on">
3
3
  <xg-inner-controls class="xg-inner-controls xg-pos">
4
4
  <xg-left-grid class="xg-left-grid">
5
5
  </xg-left-grid>
@@ -7,27 +7,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7
7
  <xg-right-grid class="xg-right-grid">
8
8
  </xg-right-grid>
9
9
  </xg-inner-controls>
10
- </xg-controls>`)}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),r}(F),_r={LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}},q={lang:{},langKeys:[],textKeys:[]};function Fe(a,o){return Object.keys(o).forEach(function(r){var t=f.typeOf(o[r]),e=f.typeOf(a[r]);if(t==="Array"){var i;e!=="Array"&&(a[r]=[]),(i=a[r]).push.apply(i,J(o[r]))}else t==="Object"?(e!=="Object"&&(a[r]={}),Fe(a[r],o[r])):a[r]=o[r]}),a}function Ii(){Object.keys(q.lang.en).map(function(a){q.textKeys[a]=a})}function Cr(a,o){var r=[];if(o||(o=q),!!o.lang){f.typeOf(a)!=="Array"?r=Object.keys(a).map(function(i){var n=i==="zh"?"zh-cn":i;return{LANG:n,TEXT:a[i]}}):r=a;var t=o,e=t.lang;r.map(function(i){i.LANG==="zh"&&(i.LANG="zh-cn"),e[i.LANG]?Fe(e[i.LANG]||{},i.TEXT||{}):At(i,o)}),Ii()}}function At(a,o){var r=a.LANG;if(o||(o=q),!!o.lang){var t=a.TEXT||{};r==="zh"&&(r="zh-cn"),o.lang[r]?Fe(o.lang[r],t):(o.langKeys.push(r),o.lang[r]=t),Ii()}}function kr(a){var o,r={lang:{},langKeys:[],textKeys:{},pId:a};return Fe(r.lang,q.lang),(o=r.langKeys).push.apply(o,J(q.langKeys)),Fe(r.textKeys,q.textKeys),r}At(_r);var Se={get textKeys(){return q.textKeys},get langKeys(){return q.langKeys},get lang(){var a={};return q.langKeys.map(function(o){a[o]=q.lang[o]}),q.lang["zh-cn"]&&(a.zh=q.lang["zh-cn"]||{}),a},extend:Cr,use:At,init:kr},M={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},Ai=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],K={},Lt=null,Li=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"add",value:function(e){e&&(K[e.playerId]=e,Object.keys(K).length===1&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete K[e.playerId])}},{key:"_iterate",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(var n in K)if(Object.prototype.hasOwnProperty.call(K,n)){var s=K[n];if(i){if(e(s))break}else e(s)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var i=null;return this._iterate(function(n){var s=e(n);return s&&(i=n),s},!0),i}},{key:"findAll",value:function(e){var i=[];return this._iterate(function(n){e(n)&&i.push(n)}),i}},{key:"setActive",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(K[e])return i?this.forEach(function(n){e===n.playerId?(n.isUserActive=!0,n.isInstNext=!1):n.isUserActive=!1}):K[e].isUserActive=i,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(K),i=0;i<e.length;i++){var n=K[e[i]];if(n&&n.isUserActive)return e[i]}return null}},{key:"setNext",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(K[e])return i?this.forEach(function(n){e===n.playerId?(n.isUserActive=!1,n.isInstNext=!0):n.isInstNext=!1}):K[e].isInstNext=i,e}}],[{key:"getInstance",value:function(){return Lt||(Lt=new r),Lt}}]),r}(Xt.EventEmitter);function br(a){for(var o=Object.keys(K),r=0;r<o.length;r++){var t=K[o[r]];if(t.root===a)return t}return null}var Tr=["play","pause","replay","retry"],Di=0,Ri=0,de=null,et=function(a){x(r,a);var o=P(r);function r(t){var e;E(this,r);var i=f.deepMerge(Pi(),t);e=o.call(this,i),_(m(e),"canPlayFunc",function(){if(e.config){var v=e.config,y=v.autoplay,C=v.defaultPlaybackRate;R.logInfo("player","canPlayFunc, startTime",e.__startTime),e.__startTime>0&&e.duration>0&&(e.currentTime=e.__startTime>e.duration?e.duration:e.__startTime,e.__startTime=-1),e.playbackRate=C,(y||e._useAutoplay)&&e.mediaPlay(),e.off(oe,e.canPlayFunc),e.removeClass(k.ENTER)}}),_(m(e),"onFullscreenChange",function(v,y){var C=function(){f.setTimeout(m(e),function(){e.resize()},100)},b=f.getFullScreenEl();e._fullActionFrom?e._fullActionFrom="":e.emit($e,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:e.currentTime,duration:e.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var w=Un(b,e.playerId,Ce);if(y||b&&(b===e._fullscreenEl||w))C(),!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!0,e.changeFullStyle(e.root,b,k.FULLSCREEN),e.emit(le,!0,e._fullScreenOffset),e.cssfullscreen&&e.exitCssFullscreen();else if(e.fullscreen){C();var T=m(e),B=T._fullScreenOffset,O=T.config;if(O.needFullscreenScroll?(window.scrollTo(B.left,B.top),f.setTimeout(m(e),function(){e.fullscreen=!1,e._fullScreenOffset=null},100)):(!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!1,e._fullScreenOffset=null),e.cssfullscreen)e.removeClass(k.FULLSCREEN);else{var U=e._fullscreenEl;!U&&(e.root.contains(v.target)||v.target===e.root)&&(U=v.target),e.recoverFullStyle(e.root,U,k.FULLSCREEN)}e._fullscreenEl=null,e.emit(le,!1)}}),_(m(e),"_onWebkitbeginfullscreen",function(v){e._fullscreenEl=e.media,e.onFullscreenChange(v,!0)}),_(m(e),"_onWebkitendfullscreen",function(v){e.onFullscreenChange(v,!1)}),Ti(m(e),Tr),e.config=i,e._pluginInfoId=f.generateSessionId(),On(m(e));var n=e.constructor.defaultPreset;if(e.config.presets.length){var s=e.config.presets.indexOf("default");s>=0&&n&&(e.config.presets[s]=n)}else n&&e.config.presets.push(n);e.userTimer=null,e.waitTimer=null,e.handleSource=!0,e._state=M.INITIAL,e.isError=!1,e._hasStart=!1,e.isSeeking=!1,e.isCanplay=!1,e._useAutoplay=!1,e.__startTime=-1,e.rotateDeg=0,e.isActive=!1,e.fullscreen=!1,e.cssfullscreen=!1,e.isRotateFullscreen=!1,e._fullscreenEl=null,e.timeSegments=[],e._cssfullscreenEl=null,e.curDefinition=null,e._orgCss="",e._fullScreenOffset=null,e._videoHeight=0,e._videoWidth=0,e.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},e.sizeInfo={width:0,height:0,left:0,top:0},e._accPlayed={t:0,acc:0,loopAcc:0},e._offsetInfo={currentTime:-1,duration:0},e.innerContainer=null,e.controls=null,e.topBar=null,e.root=null,e.__i18n=Se.init(e._pluginInfoId),D.os.isAndroid&&D.osVersion>0&&D.osVersion<6&&(e.config.autoplay=!1),e.database=new tr,e.isUserActive=!1,e._onceSeekCanplay=null,e._isPauseBeforeSeek=0,e.innerStates={isActiveLocked:!1},e.instManager=de;var l=e._initDOM();if(!l)return console.error(new Error("can't find the dom which id is ".concat(e.config.id," or this.config.el does not exist"))),ft(e);var u=e.config,c=u.definition,h=c===void 0?{}:c,d=u.url;if(!d&&h.list&&h.list.length>0){var g=h.list.find(function(v){return v.definition&&v.definition===h.defaultDefinition});g||(h.defaultDefinition=h.list[0].definition,g=h.list[0]),e.config.url=g.url,e.curDefinition=g}return e._bindEvents(),e._registerPresets(),e._registerPlugins(),z.onPluginsReady(m(e)),e.getInitDefinition(),e.setState(M.READY),f.setTimeout(m(e),function(){e.emit(_t)},0),e.onReady&&e.onReady(),(e.config.videoInit||e.config.autoplay)&&(!e.hasStart||e.state<M.ATTACHED)&&e.start(),e}return S(r,[{key:"_initDOM",value:function(){var e,i=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var n=this.config.el;if(n&&n.nodeType===1)this.root=n;else return this.emit(Oe,new Ue("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1}var s=br(this.root);s&&(R.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),s.destroy()),this.root.setAttribute(Ce,this.playerId),(e=de)===null||e===void 0||e.add(this),z.init(this),this._initBaseDoms();var l=this.constructor.XgVideoProxy;if(l&&this.mediaConfig.mediaType===l.mediaType){var u=this.innerContainer||this.root;this.detachVideoEvents(this.media);var c=new l(u,this.config,this.mediaConfig);this.attachVideoEvents(c),this.media=c}if(this.media.setAttribute(Ce,this.playerId),this.config.controls){var h=this.config.controls.root||null,d=z.register(this,yr,{root:h});this.controls=d}var g=this.config.isMobileSimulateMode==="mobile"?"mobile":D.device;if(this.addClass("".concat(k.DEFAULT," ").concat(k.INACTIVE," xgplayer-").concat(g," ").concat(this.config.controls?"":k.NO_CONTROLS)),this.config.autoplay?this.addClass(k.ENTER):this.addClass(k.NO_START),this.config.fluid){var v=this.config,y=v.width,C=v.height;(typeof y!="number"||typeof C!="number")&&(y=600,C=337.5);var b={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(C*100/y,"%")};Object.keys(b).forEach(function(L){i.root.style[L]=b[L]})}else["width","height"].forEach(function(L){i.config[L]&&(typeof i.config[L]!="number"?i.root.style[L]=i.config[L]:i.root.style[L]="".concat(i.config[L],"px"))});var w=this.root.getBoundingClientRect(),T=w.width,B=w.height,O=w.left,U=w.top;return this.sizeInfo.width=T,this.sizeInfo.height=B,this.sizeInfo.left=O,this.sizeInfo.top=U,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=f.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach(function(i){e.on(i,e["on"+i.charAt(0).toUpperCase()+i.slice(1)])}),yi.forEach(function(i){document&&document.addEventListener(i,e.onFullscreenChange)}),D.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(ae,this.resize),this.playFunc=function(){e.config.closeFocusVideoFocus||e.media.focus()},this.once($,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),yi.forEach(function(i){document.removeEventListener(i,e.onFullscreenChange)}),this.playFunc&&this.off($,this.playFunc),this.off(oe,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_clearUserTimer",value:function(){this.userTimer&&(f.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var i=this;if(this.media&&!((!e||e===""||f.typeOf(e)==="Array"&&e.length===0)&&(e="",this.emit(si),R.logWarn("config.url is null, please get url and run player._startInit(url)"),this.config.nullUrlStart))){this.handleSource&&(this._detachSourceEvents(this.media),f.typeOf(e)==="Array"&&e.length>0?this._attachSourceEvents(this.media,e):!this.media.src||this.media.src!==e?this.media.src=e:e||this.media.removeAttribute("src")),f.typeOf(this.config.volume)==="Number"&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var s=this.media.readyState;R.logInfo("_startInit readyState",s),this.config.autoplay&&(!f.isMSE(this.media)&&this.load(),(D.os.isIpad||D.os.isPhone)&&this.mediaPlay());var l=this.config.startTime;this.__startTime=l>0?l:-1,this.config.startTime=0,s>=2&&this.duration>0?this.canPlayFunc():this.on(oe,this.canPlayFunc),(!this.hasStart||this.state<M.ATTACHED)&&z.afterInit(this),this.hasStart=!0,this.setState(M.ATTACHED),f.setTimeout(this,function(){i.emit(ze)},0)}}},{key:"_registerPlugins",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this._loadingPlugins=[];var n=this.config.ignores||[],s=this.config.plugins||[],l=this.config.i18n||[];i&&Se.extend(l,this.__i18n);var u=n.join("||").toLowerCase().split("||"),c=this.plugins;s.forEach(function(h){try{var d=h.plugin?h.plugin.pluginName:h.pluginName;if(d&&u.indexOf(d.toLowerCase())>-1)return null;if(!i&&c[d.toLowerCase()])return;if(h.lazy&&h.loader){var g=z.lazyRegister(e,h);h.forceBeforeInit&&(g.then(function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}).catch(function(v){R.logError("_registerPlugins:loadingPlugin",v),e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}),e._loadingPlugins.push(g));return}return e.registerPlugin(h)}catch(v){R.logError("_registerPlugins:",v)}})}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach(function(i){mr(e,i)})}},{key:"_getRootByPosition",value:function(e){var i=null;switch(e){case H.ROOT_RIGHT:this.rightBar||(this.rightBar=f.createPositionBar("xg-right-bar",this.root)),i=this.rightBar;break;case H.ROOT_LEFT:this.leftBar||(this.leftBar=f.createPositionBar("xg-left-bar",this.root)),i=this.leftBar;break;case H.ROOT_TOP:this.topBar||(this.topBar=f.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&f.addClass(this.topBar,k.TOP_BAR_AUTOHIDE)),i=this.topBar;break;default:i=this.innerContainer||this.root;break}return i}},{key:"registerPlugin",value:function(e,i){var n=z.formatPluginInfo(e,i),s=n.PLUFGIN,l=n.options,u=this.config.plugins,c=z.checkPluginIfExits(s.pluginName,u);!c&&u.push(s);var h=z.getRootByConfig(s.pluginName,this.config);h.root&&(l.root=h.root),h.position&&(l.position=h.position);var d=l.position?l.position:l.config&&l.config.position||s.defaultConfig&&s.defaultConfig.position;return!l.root&&typeof d=="string"&&d.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(s,l,s.pluginName):(l.root||(l.root=this._getRootByPosition(d)),z.register(this,s,l))}},{key:"deregister",value:function(e){typeof e=="string"?z.unRegister(this,e):e instanceof he&&z.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.deregister(e),i&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var i;if(typeof e=="string"?i=e:e instanceof he&&(i=e.pluginName),!!i)for(var n=this.config.plugins.length-1;n>-1;n--){var s=this.config.plugins[n];if(s.pluginName.toLowerCase()===i.toLowerCase()){this.config.plugins.splice(n,1);break}}}},{key:"plugins",get:function(){return z.getPlugins(this)}},{key:"getPlugin",value:function(e){var i=z.findPlugin(this,e);return i&&i.pluginName?i:null}},{key:"addClass",value:function(e){this.root&&(f.hasClass(this.root,e)||f.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&f.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return f.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,i){this.root&&this.root.setAttribute(e,i)}},{key:"removeAttribute",value:function(e,i){this.root&&this.root.removeAttribute(e,i)}},{key:"start",value:function(e){var i=this;if(!(this.state>M.ATTACHING))return!e&&!this.config.url&&this.getInitDefinition(),this.hasStart=!0,this.setState(M.ATTACHING),this._registerPlugins(!1),z.beforeInit(this).then(function(){if(i.config){e||(e=i.url||i.config.url);var n=i._preProcessUrl(e),s=i._startInit(n.url);return s}}).catch(function(n){throw n.fileName="player",n.lineNumber="236",R.logError("start:beforeInit:",n),n})}},{key:"switchURL",value:function(e,i){var n=this,s=e;f.typeOf(e)==="Object"&&(s=e.url),s=this._preProcessUrl(s).url;var l=this.currentTime;this.__startTime=l;var u=this.paused&&!this.isError;return this.src=s,new Promise(function(c,h){var d=function(y){n.off("timeupdate",g),n.off("canplay",g),h(y)},g=function(){n.duration>0&&n.__startTime>0&&(n.currentTime=n.__startTime,n.__startTime=-1),u&&n.pause(),n.off("error",d),c(!0)};if(n.once("error",d),!s){n.errorHandler("error",{code:6,message:"empty_src"});return}D.os.isAndroid?n.once("timeupdate",g):n.once("canplay",g),n.play()})}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<M.ATTACHED){this.removeClass(k.NO_START),this.addClass(k.ENTER),this.start(),this._useAutoplay=!0;return}this.state<M.RUNNING&&(this.removeClass(k.NO_START),!this.isCanplay&&this.addClass(k.ENTER));var i=A(I(r.prototype),"play",this).call(this);return i!==void 0&&i&&i.then?i.then(function(){e.removeClass(k.NOT_ALLOW_AUTOPLAY),e.addClass(k.PLAYING),e.state<M.RUNNING&&(R.logInfo(">>>>playPromise.then"),e.setState(M.RUNNING),e.emit(_e))}).catch(function(n){if(R.logWarn(">>>>playPromise.catch",n.name),e.media&&e.media.error){e.onError(),e.removeClass(k.ENTER);return}n.name==="NotAllowedError"&&(e._errorTimer=f.setTimeout(e,function(){e._errorTimer=null,e.emit(Ct),e.addClass(k.NOT_ALLOW_AUTOPLAY),e.removeClass(k.ENTER),e.pause(),e.setState(M.NOTALLOW)},0))}):(R.logWarn("video.play not return promise"),this.state<M.RUNNING&&(this.setState(M.RUNNING),this.removeClass(k.NOT_ALLOW_AUTOPLAY),this.removeClass(k.NO_START),this.removeClass(k.ENTER),this.addClass(k.PLAYING),this.emit(_e))),i}},{key:"mediaPause",value:function(){A(I(r.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){A(I(r.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(k.PAUSED),ue(this,"play",function(){return e.mediaPlay()})}},{key:"pause",value:function(){var e=this;ue(this,"pause",function(){A(I(r.prototype),"pause",e).call(e)})}},{key:"seek",value:function(e,i){var n=this;if(!(!this.media||Number.isNaN(Number(e))||!this.hasStart)){var s=this.config,l=s.isSeekedPlay,u=s.seekedStatus,c=i||(l?"play":u);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(se,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(n.removeClass(k.ENTER),n.isSeeking=!1,c){case"play":n.play();break;case"pause":n.pause();break;default:n._isPauseBeforeSeek>1||n.paused?n.pause():n.play()}n._isPauseBeforeSeek=0,n._onceSeekCanplay=null},this.once(se,this._onceSeekCanplay),this.state<M.RUNNING?(this.removeClass(k.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,i=this.config,n=i.definition,s=i.url;!s&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&n.list.map(function(l){l.definition===n.defaultDefinition&&(e.config.url=l.url,e.curDefinition=l)})}},{key:"changeDefinition",value:function(e,i){var n=this,s=this.config.definition;if(Array.isArray(s==null?void 0:s.list)&&s.list.forEach(function(u){(e==null?void 0:e.definition)===u.definition&&(n.curDefinition=u)}),e!=null&&e.bitrate&&typeof e.bitrate!="number"&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(Tt,{from:i,to:e}),!this.hasStart){this.config.url=e.url;return}var l=this.switchURL(e.url,V({seamless:s.seamless!==!1&&typeof MediaSource<"u"&&typeof MediaSource.isTypeSupported=="function"},e));l&&l.then?l.then(function(){n.emit(wt,{from:i,to:e})}):this.emit(wt,{from:i,to:e})}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(ae,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,i=k.NOT_ALLOW_AUTOPLAY,n=k.PLAYING,s=k.NO_START,l=k.PAUSED,u=k.REPLAY,c=k.ENTER,h=k.ENDED,d=k.ERROR,g=k.LOADING,v=[i,n,s,l,u,c,h,d,g];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,v.forEach(function(y){e.removeClass(y)}),this.addClass(k.NO_START),this.emit(Xe)}},{key:"reset",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;this.resetState();var s=this.plugins;if(s&&(i.map(function(u){e.deregister(u)}),n)){var l=Pi();Object.keys(this.config).keys(function(u){e.config[u]!=="undefined"&&(u==="plugins"||u==="presets"||u==="el"||u==="id")&&(e.config[u]=l[u])})}}},{key:"destroy",value:function(){var e,i=this,n=this.innerContainer,s=this.root,l=this.media;if(!(!s||!l)){if(this.hasStart=!1,this._useAutoplay=!1,s.removeAttribute(Ce),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),f.clearAllTimers(this),this.emit(kt),(e=de)===null||e===void 0||e.remove(this),z.destroy(this),wi(this),A(I(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),n)for(var u=n.children,c=0;c<u.length;c++)n.removeChild(u[c]);!n&&l instanceof window.Node&&s.contains(l)&&s.removeChild(l),["topBar","leftBar","rightBar","innerContainer"].map(function(d){i[d]&&s.removeChild(i[d]),i[d]=null});var h=s.className.split(" ");h.length>0?s.className=h.filter(function(d){return d.indexOf("xgplayer")<0}).join(" "):s.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach(function(d){i[d]=!1})}}},{key:"replay",value:function(){var e=this;this.removeClass(k.ENDED),this.currentTime=0,this.isSeeking=!1,ue(this,"replay",function(){e.once(se,function(){var i=e.mediaPlay();i&&i.catch&&i.catch(function(n){console.log(n)})}),e.emit(je),e.onPlay()})}},{key:"retry",value:function(){var e=this;this.removeClass(k.ERROR),this.addClass(k.LOADING),ue(this,"retry",function(){var i=e.currentTime,n=e.config.url,s=f.isMSE(e.media)?{url:n}:e._preProcessUrl(n);e.src=s.url,!e.config.isLive&&(e.currentTime=i),e.once(oe,function(){e.mediaPlay()})})}},{key:"changeFullStyle",value:function(e,i,n,s){e&&(s||(s=k.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=f.filterStyleFromText(e)),f.addClass(e,n),i&&i!==e&&!this._orgPCss&&(this._orgPCss=f.filterStyleFromText(i),f.addClass(i,s),i.setAttribute(Ce,this.playerId)))}},{key:"recoverFullStyle",value:function(e,i,n,s){s||(s=k.PARENT_FULLSCREEN),this._orgCss&&(f.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),f.removeClass(e,n),i&&i!==e&&this._orgPCss&&(f.setStyleFromCsstext(i,this._orgPCss),this._orgPCss="",f.removeClass(i,s),i.removeAttribute(Ce))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget,i=this.root,n=this.media;(e==="video"||e==="media")&&(e=this[e]),e||(e=i),this._fullScreenOffset={top:f.scrollTop(),left:f.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get";var s=f.getFullScreenEl();if(s===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var l=0;l<_i.length;l++){var u=_i[l];if(e[u]){var c=u==="webkitRequestFullscreen"?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[u]();return c&&c.then?c:Promise.resolve()}}return n.fullscreenEnabled||n.webkitSupportsFullscreen?(n.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch{return Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),!(!this._fullscreenEl&&!f.getFullScreenEl())){this.root;var i=this.media;this._fullActionFrom="exit";try{for(var n=0;n<Ci.length;n++){var s=Ci[n];if(document[s]){var l=document[s]();return l&&l.then?l:Promise.resolve()}}return i&&i.webkitSupportsFullscreen?(i.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch{return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var i=e?"".concat(k.INNER_FULLSCREEN," ").concat(k.CSS_FULLSCREEN):k.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,i);var n=this.config.fullscreen,s=n===void 0?{}:n,l=s.useCssFullscreen===!0||typeof s.useCssFullscreen=="function"&&s.useCssFullscreen();l&&(this.fullscreen=!0,this.emit(le,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Ge,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(k.INNER_FULLSCREEN," ").concat(k.CSS_FULLSCREEN):k.CSS_FULLSCREEN;if(!this.fullscreen)this.recoverFullStyle(this.root,this._cssfullscreenEl,e);else{var i=this.config.fullscreen,n=i===void 0?{}:i,s=n.useCssFullscreen===!0||typeof n.useCssFullscreen=="function"&&n.useCssFullscreen();s?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(le,!1)):this.removeClass(e)}this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Ge,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var i=e?"".concat(k.INNER_FULLSCREEN," ").concat(k.ROTATE_FULLSCREEN):k.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,i,k.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(le,!0)}},{key:"exitRotateFullscreen",value:function(e){var i=this._fullscreenEl!==this.root?"".concat(k.INNER_FULLSCREEN," ").concat(k.ROTATE_FULLSCREEN):k.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,i,k.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(le,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){window.orientation===90||window.orientation===-90?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};if(this.isActive){this.onFocus(e);return}this.emit(yt,V({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{ignorePaused:!1};if(!this.isActive){this.onBlur(e);return}this._clearUserTimer(),this.emit(ri,V({paused:this.paused,ended:this.ended},e))}},{key:"onFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!0,delay:3e3},n=this.innerStates;if(this.isActive=!0,this.removeClass(k.INACTIVE),this._clearUserTimer(),i.isLock!==void 0&&(n.isActiveLocked=i.isLock),i.autoHide===!1||i.isLock===!0||n.isActiveLocked){this._clearUserTimer();return}var s=i&&i.delay?i.delay:this.config.inactive;this.userTimer=f.setTimeout(this,function(){e.userTimer=null,e.blur()},s)}},{key:"onBlur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=e.ignorePaused,n=i===void 0?!1:i;if(!this.innerStates.isActiveLocked){var s=this.config.closePauseVideoFocus;this.isActive=!1,(n||s||!this.paused&&!this.ended)&&this.addClass(k.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(k.ENTER),this.removeClass(k.ERROR),this.removeClass(k.LOADING),this.isCanplay=!0,this.waitTimer&&f.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){this.isError=!1,this.isSeeking=!1,this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime,this.__startTime=-1)}},{key:"onLoadstart",value:function(){this.removeClass(k.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===M.ENDED&&this.setState(M.RUNNING),this.removeClass(k.PAUSED),this.ended&&this.removeClass(k.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(k.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(k.ENDED),this.setState(M.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(k.NOT_ALLOW_AUTOPLAY),this.removeClass(k.NO_START),this.removeClass(k.ENTER),this.removeClass(k.LOADING),this.addClass(k.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(k.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&f.clearTimeout(this,this.waitTimer),this.removeClass(k.LOADING),this.removeClass(k.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&f.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=f.setTimeout(this,function(){e.addClass(k.LOADING),e.emit(li),f.clearTimeout(e,e.waitTimer),e.waitTimer=null},this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1;var i=k.NO_START,n=k.PAUSED,s=k.ENDED,l=k.ERROR,u=k.REPLAY,c=k.LOADING,h=[i,n,s,l,u,c];h.forEach(function(d){e.removeClass(d)}),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(k.LOADING))&&this.media.readyState>2&&(this.removeClass(k.LOADING),f.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===M.NOTALLOW&&this.duration&&(this.setState(M.RUNNING),this.emit(_e)),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onVolumechange",value:function(){f.typeOf(this.config.volume)==="Number"&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,i,n){if(!(!this.media||!i||!e)){var s=f.typeOf(e)==="String"?e:e.type||"";n.props&&f.typeOf(n.props)!=="Array"&&(n.props=[n.props]),this.emit($e,V({eventType:s,action:i,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},n))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var i=new Date().getTime()-this._accPlayed.t;this._accPlayed.acc+=i,this._accPlayed.t=0,(e==="ended"||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{startDiff:0,endDiff:0},n=i||{},s=n.startDiff,l=s===void 0?0:s,u=n.endDiff,c=u===void 0?0:u,h=this.media.buffered;if(!h||h.length===0||!this.duration)return!0;for(var d=e||this.media.currentTime||.2,g=h.length,v=0;v<g;v++)if(h.start(v)+l<=d&&h.end(v)-c>d)return!0;return!1}},{key:"resizePosition",value:function(){var e=this.videoPos,i=e.vy,n=e.vx,s=e.h,l=e.w,u=this.videoPos.rotate;if(!(u<0&&s<0&&l<0)){var c=this.videoPos._pi;if(!c&&this.media.videoHeight&&(c=this.media.videoWidth/this.media.videoHeight*100),!!c){this.videoPos.pi=c,u=u<0?0:u;var h={rotate:u},d=0,g=0,v=1,y=Math.abs(u/90),C=this.root,b=this.innerContainer,w=C.offsetWidth,T=b?b.offsetHeight:C.offsetHeight,B=T,O=w;if(y%2===0)v=s>0?100/s:l>0?100/l:1,h.scale=v,d=i>0?(100-s)/2-i:0,h.y=y===2?0-d:d,g=n>0?(100-l)/2-n:0,h.x=y===2?0-g:g,this.media.style.width="".concat(O,"px"),this.media.style.height="".concat(B,"px");else if(y%2===1){O=T,B=w;var U=T-w;g=-U/2/O*100,h.x=y===3?g+i/2:g-i/2,d=U/2/B*100,h.y=y===3?d+n/2:d-n/2,h.scale=v,this.media.style.width="".concat(O,"px"),this.media.style.height="".concat(B,"px")}var L=f.getTransformStyle(h,this.media.style.transform||this.media.style.webkitTransform);this.media.style.transform=L,this.media.style.webkitTransform=L}}}},{key:"position",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{h:0,y:0,x:0,w:0};if(!(!this.media||!e||!e.h)){var i=this.videoPos;i.h=e.h*100||0,i.w=e.w*100||0,i.vx=e.x*100||0,i.vy=e.y*100||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(n){if(n!=="plugins"){i.config[n]=e[n];var s=i.plugins[n.toLowerCase()];s&&f.typeOf(s.setConfig)==="Function"&&s.setConfig(e[n])}})}},{key:"playNext",value:function(e){var i=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,ue(this,"playnext",function(){i.start(),i.emit(Ye,e)})}},{key:"resize",value:function(){var e=this;if(this.media){var i=this.root.getBoundingClientRect();this.sizeInfo.width=i.width,this.sizeInfo.height=i.height,this.sizeInfo.left=i.left,this.sizeInfo.top=i.top;var n=this.media,s=n.videoWidth,l=n.videoHeight,u=this.config,c=u.fitVideoSize,h=u.videoFillMode;if((h==="fill"||h==="cover"||h==="contain")&&this.setAttribute("data-xgfill",h),!(!l||!s)){this._videoHeight=l,this._videoWidth=s;var d=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,g=i.width,v=i.height-d,y=parseInt(s/l*1e3,10),C=parseInt(g/v*1e3,10),b=g,w=v,T={};c==="auto"&&C>y||c==="fixWidth"?(w=g/y*1e3,this.config.fluid?T.paddingTop="".concat(w*100/b,"%"):T.height="".concat(w+d,"px")):(c==="auto"&&C<y||c==="fixHeight")&&(b=y*v/1e3,T.width="".concat(b,"px")),!this.fullscreen&&!this.cssfullscreen&&Object.keys(T).forEach(function(O){e.root.style[O]=T[O]}),(h==="fillHeight"&&C<y||h==="fillWidth"&&C>y)&&this.setAttribute("data-xgfill","cover");var B={videoScale:y,vWidth:b,vHeight:w,cWidth:b,cHeight:w+d};this.resizePosition(),this.emit(fe,B)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(this.media.updateObjectPosition){this.media.updateObjectPosition(e,i);return}this.media.style.objectPosition="".concat(e*100,"% ").concat(i*100,"%")}},{key:"setState",value:function(e){R.logInfo("setState","state from:".concat(Ai[this.state]," to:").concat(Ai[e])),this._state=e}},{key:"_preProcessUrl",value:function(e,i){var n=this.config,s=n.preProcessUrl,l=n.preProcessUrlOptions,u=Object.assign({},l,i);return!f.isBlob(e)&&typeof s=="function"?s(e,u):{url:e}}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){typeof e=="boolean"&&(this._hasStart=e,e===!1&&this.setState(M.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===M.RUNNING||this._state===M.ENDED},set:function(e){e?this.setState(M.RUNNING):this._state>=M.RUNNING&&this.setState(M.ATTACHED)}},{key:"definitionList",get:function(){return!this.config||!this.config.definition?[]:this.config.definition.list||[]},set:function(e){var i=this,n=this.config.definition,s=null,l=null;n.list=e,this.emit("resourceReady",e),e.forEach(function(u){var c;((c=i.curDefinition)===null||c===void 0?void 0:c.definition)===u.definition&&(s=u),n.defaultDefinition===u.definition&&(l=u)}),!l&&e.length>0&&(l=e[0]),s?this.changeDefinition(s):l&&this.changeDefinition(l)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var i=this.media.getVideoPlaybackQuality();return e.dropped=i.droppedVideoFrames||0,e.total=i.totalVideoFrames||0,e.corrupted=i.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){var i=Se.langKeys.filter(function(n){return n===e});if(i.length===0&&e!=="zh"){console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(Se.langKeys.join(),"] "));return}this.config.lang=e,z.setLang(e,this)}},{key:"i18n",get:function(){var e=this.config.lang;return e==="zh"&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return pt}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return A(I(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=A(I(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return A(I(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return this._fullScreenOffset!==null}},{key:"cumulateTime",get:function(){var e=this._accPlayed,i=e.acc,n=e.t;return n?new Date().getTime()-n+i:i}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){e=f.convertDeg(e),!(e%90!==0||e===this.videoPos.rotate)&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return Ri},set:function(e){Ri=e}},{key:"realTimeSpeed",get:function(){return Di},set:function(e){Di=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,i){return Ze.call.apply(Ze,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,i){return Je.call.apply(Je,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,i){return Qe.call.apply(Qe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,i,n){for(var s=arguments.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=arguments[u];return ki.call.apply(ki,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,i,n){for(var s=arguments.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=arguments[u];return bi.call.apply(bi,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,i){var n;typeof i=="boolean"&&i!==this.muted&&(this.addInnerOP("volumechange"),f.typeOf(i)===Boolean&&(this.muted=i)),(n=de)===null||n===void 0||n.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return R.config.debug},set:function(e){R.config.debug=e}},{key:"instManager",get:function(){return de},set:function(e){de=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return(e=de)===null||e===void 0?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,i){var n;(n=de)===null||n===void 0||n.setActive(e,i)}},{key:"isHevcSupported",value:function(){return D.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return D.probeConfigSupported(e)}},{key:"install",value:function(e,i){r.plugins||(r.plugins={}),r.plugins[e]||(r.plugins[e]=i)}},{key:"use",value:function(e,i){r.plugins||(r.plugins={}),r.plugins[e]=i}}]),r}(er);_(et,"defaultPreset",null),_(et,"XgVideoProxy",null),et.instManager=Li.getInstance();function G(){return new Date().getTime()}var ge={LOAD_START:"loadstart",LOADED_DATA:"loadeddata",FIRST_FRAME:"firstFrame",WAIT_START:"waitingStart",WAIT_END:"waitingEnd",SEEK_START:"seekStart",SEEK_END:"seekEnd"},wr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onTimeupdate",function(){t._state.isTimeUpdate=!0,t._state.autoplayStart&&(R.logInfo("[xgLogger]".concat(t.player.playerId," _onTimeupdate")),t._sendFF("onTimeupdate"))}),_(m(t),"_onAutoplayStart",function(){R.logInfo("[xgLogger]".concat(t.player.playerId," _onAutoplayStart")),t._state.autoplayStart=!0,t.vt&&t._sendFF("onAutoplayStart")}),_(m(t),"_onReset",function(){t._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},t.vt=0,t.pt=0,t.fvt=0,t.newPointTime=G(),t.loadedCostTime=0,t.startCostTime=0,t._isSeeking=!1,t.seekingStart=0,t.waitingStart=0,t.fixedWaitingStart=0,t._isWaiting=!1,t._waitTimer&&f.clearTimeout(m(t),t._waitTimer),t._waittTimer&&f.clearTimeout(m(t),t._waittTimer),t._waitTimer=null,t._waittTimer=null,t._waitType=0}),_(m(t),"_onSeeking",function(){t.seekingStart||(t.suspendWaitingStatus("seek"),t.seekingStart=G(),t.emitLog(ge.SEEK_START,{start:G()}))}),_(m(t),"_onSeeked",function(){t.suspendSeekingStatus("seeked")}),_(m(t),"_onWaitingLoadStart",function(){t._isWaiting||t.vt||(t._isWaiting=!0,t.waitingStart=G(),t.fixedWaitingStart=G(),t._waitType=1,t.emitLog(ge.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:1,endType:"loadstart"}))}),_(m(t),"_onWaiting",function(){t._isWaiting||!t.vt||(t._isWaiting=!0,t.vt?t.seekingStart?t._waitType=2:t._waitType=0:t._waitType=1,t.fixedWaitingStart=G(),t._waitTimer=f.setTimeout(m(t),function(){t._isWaiting&&(t.waitingStart=G(),f.clearTimeout(m(t),t._waitTimer),t._waitTimer=null,t._startWaitTimeout(),t.emitLog(ge.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:t._waitType,endType:t._waitType===2?"seek":"playing"}))},200))}),_(m(t),"_onError",function(){t.suspendSeekingStatus("error"),t.suspendWaitingStatus("error")}),_(m(t),"_onPlaying",function(){t._isWaiting&&t.suspendWaitingStatus("playing")}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=G(),this.loadedCostTime=0,this.startCostTime=0,this.on(mt,function(){var i=e._state,n=i.autoplayStart,s=i.isFFSend;e.startCostTime=G()-e.newPointTime,R.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),"autoplayStart:".concat(n," isFFSend:").concat(s," startCostTime:").concat(e.startCostTime," newPointTime").concat(e.newPointTime)),!s&&(!i.isLs&&e.emitLog(ge.LOAD_START,{}),i.isLs=!0,i.isTimeUpdate=!1,i.isFFLoading=!0,e.pt=G(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())}),this.on(ae,function(){e.vt=G(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var i=e._state,n=i.isTimeUpdate,s=i.isFFSend,l=i.autoplayStart;R.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),"fvt:".concat(e.fvt," isTimeUpdate:").concat(e._state.isTimeUpdate," loadedCostTime:").concat(e.loadedCostTime)),(n||l)&&e._sendFF("loadedData"),s||e.emitLog(ge.LOADED_DATA,{}),e.suspendWaitingStatus("loadeddata")}),this.on(Ve,this._onSeeking),this.on(se,this._onSeeked),this.on(kt,function(){e.endState("destroy")}),this.on(We,function(){e.endState("urlChange"),R.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()}),this.on([vt,oe],this._onPlaying),this.on(Me,this._onWaiting),this.on(Oe,this._onError),this.on(Xe,function(){R.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()})}},{key:"_initOnceEvents",value:function(){this.off(_e,this._onAutoplayStart),this.off(X,this._onTimeupdate),this.once(_e,this._onAutoplayStart),this.once(X,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=G();var i=this._state,n=i.isFFLoading,s=i.isFFSend;R.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(n," !isFFSend:").concat(!s)),this.vt>0&&n&&!s&&(R.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(ge.FIRST_FRAME,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&f.clearTimeout(this,this._waittTimer),this._waittTimer=f.setTimeout(this,function(){e.suspendWaitingStatus("timeout"),f.clearTimeout(e,e._waittTimer),e._waittTimer=null},this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var i=G(),n=i-this.seekingStart;this.seekingStart=0,this.emitLog(ge.SEEK_END,{end:i,costTime:n,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(f.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(f.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,!!this.waitingStart){var i=G(),n=i-this.waitingStart,s=i-this.fixedWaitingStart,l=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(ge.WAIT_END,{fixedCostTime:s>l?l:s,costTime:n>l?l:n,type:e==="loadeddata"?1:this._waitType,endType:this._waitType===2?"seek":e})}}},{key:"emitLog",value:function(e,i){var n=this.player;this.emit(hi,V({t:G(),host:f.getHostFromUrl(n.currentSrc),vtype:n.vtype,eventType:e,currentTime:this.player.currentTime,readyState:n.video.readyState,networkState:n.video.networkState},i))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),r}(F);function Er(){return new DOMParser().parseFromString(`<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">
10
+ </xg-controls>`)}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),r}(F),yr={LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}},q={lang:{},langKeys:[],textKeys:[]};function Fe(a,o){return Object.keys(o).forEach(function(r){var t=f.typeOf(o[r]),e=f.typeOf(a[r]);if(t==="Array"){var i;e!=="Array"&&(a[r]=[]),(i=a[r]).push.apply(i,J(o[r]))}else t==="Object"?(e!=="Object"&&(a[r]={}),Fe(a[r],o[r])):a[r]=o[r]}),a}function Ii(){Object.keys(q.lang.en).map(function(a){q.textKeys[a]=a})}function _r(a,o){var r=[];if(o||(o=q),!!o.lang){f.typeOf(a)!=="Array"?r=Object.keys(a).map(function(i){var n=i==="zh"?"zh-cn":i;return{LANG:n,TEXT:a[i]}}):r=a;var t=o,e=t.lang;r.map(function(i){i.LANG==="zh"&&(i.LANG="zh-cn"),e[i.LANG]?Fe(e[i.LANG]||{},i.TEXT||{}):It(i,o)}),Ii()}}function It(a,o){var r=a.LANG;if(o||(o=q),!!o.lang){var t=a.TEXT||{};r==="zh"&&(r="zh-cn"),o.lang[r]?Fe(o.lang[r],t):(o.langKeys.push(r),o.lang[r]=t),Ii()}}function Cr(a){var o,r={lang:{},langKeys:[],textKeys:{},pId:a};return Fe(r.lang,q.lang),(o=r.langKeys).push.apply(o,J(q.langKeys)),Fe(r.textKeys,q.textKeys),r}It(yr);var Se={get textKeys(){return q.textKeys},get langKeys(){return q.langKeys},get lang(){var a={};return q.langKeys.map(function(o){a[o]=q.lang[o]}),q.lang["zh-cn"]&&(a.zh=q.lang["zh-cn"]||{}),a},extend:_r,use:It,init:Cr},M={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},Ai=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],K={},At=null,Li=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"add",value:function(e){e&&(K[e.playerId]=e,Object.keys(K).length===1&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete K[e.playerId])}},{key:"_iterate",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(var n in K)if(Object.prototype.hasOwnProperty.call(K,n)){var s=K[n];if(i){if(e(s))break}else e(s)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var i=null;return this._iterate(function(n){var s=e(n);return s&&(i=n),s},!0),i}},{key:"findAll",value:function(e){var i=[];return this._iterate(function(n){e(n)&&i.push(n)}),i}},{key:"setActive",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(K[e])return i?this.forEach(function(n){e===n.playerId?(n.isUserActive=!0,n.isInstNext=!1):n.isUserActive=!1}):K[e].isUserActive=i,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(K),i=0;i<e.length;i++){var n=K[e[i]];if(n&&n.isUserActive)return e[i]}return null}},{key:"setNext",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(K[e])return i?this.forEach(function(n){e===n.playerId?(n.isUserActive=!1,n.isInstNext=!0):n.isInstNext=!1}):K[e].isInstNext=i,e}}],[{key:"getInstance",value:function(){return At||(At=new r),At}}]),r}(Xt.EventEmitter);function kr(a){for(var o=Object.keys(K),r=0;r<o.length;r++){var t=K[o[r]];if(t.root===a)return t}return null}var br=["play","pause","replay","retry"],Di=0,Ri=0,de=null,et=function(a){x(r,a);var o=P(r);function r(t){var e;E(this,r);var i=f.deepMerge(Pi(),t);e=o.call(this,i),_(m(e),"canPlayFunc",function(){if(e.config){var v=e.config,y=v.autoplay,C=v.defaultPlaybackRate;R.logInfo("player","canPlayFunc, startTime",e.__startTime),e.__startTime>0&&e.duration>0&&(e.currentTime=e.__startTime>e.duration?e.duration:e.__startTime,e.__startTime=-1),e.playbackRate=C,(y||e._useAutoplay)&&e.mediaPlay(),e.off(oe,e.canPlayFunc),e.removeClass(k.ENTER)}}),_(m(e),"onFullscreenChange",function(v,y){var C=function(){f.setTimeout(m(e),function(){e.resize()},100)},b=f.getFullScreenEl();e._fullActionFrom?e._fullActionFrom="":e.emit($e,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:e.currentTime,duration:e.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var w=Hn(b,e.playerId,Ce);if(y||b&&(b===e._fullscreenEl||w))C(),!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!0,e.changeFullStyle(e.root,b,k.FULLSCREEN),e.emit(le,!0,e._fullScreenOffset),e.cssfullscreen&&e.exitCssFullscreen();else if(e.fullscreen){C();var T=m(e),B=T._fullScreenOffset,O=T.config;if(O.needFullscreenScroll?(window.scrollTo(B.left,B.top),f.setTimeout(m(e),function(){e.fullscreen=!1,e._fullScreenOffset=null},100)):(!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!1,e._fullScreenOffset=null),e.cssfullscreen)e.removeClass(k.FULLSCREEN);else{var U=e._fullscreenEl;!U&&(e.root.contains(v.target)||v.target===e.root)&&(U=v.target),e.recoverFullStyle(e.root,U,k.FULLSCREEN)}e._fullscreenEl=null,e.emit(le,!1)}}),_(m(e),"_onWebkitbeginfullscreen",function(v){e._fullscreenEl=e.media,e.onFullscreenChange(v,!0)}),_(m(e),"_onWebkitendfullscreen",function(v){e.onFullscreenChange(v,!1)}),Ti(m(e),br),e.config=i,e._pluginInfoId=f.generateSessionId(),Rn(m(e));var n=e.constructor.defaultPreset;if(e.config.presets.length){var s=e.config.presets.indexOf("default");s>=0&&n&&(e.config.presets[s]=n)}else n&&e.config.presets.push(n);e.userTimer=null,e.waitTimer=null,e.handleSource=!0,e._state=M.INITIAL,e.isError=!1,e._hasStart=!1,e.isSeeking=!1,e.isCanplay=!1,e._useAutoplay=!1,e.__startTime=-1,e.rotateDeg=0,e.isActive=!1,e.fullscreen=!1,e.cssfullscreen=!1,e.isRotateFullscreen=!1,e._fullscreenEl=null,e.timeSegments=[],e._cssfullscreenEl=null,e.curDefinition=null,e._orgCss="",e._fullScreenOffset=null,e._videoHeight=0,e._videoWidth=0,e.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},e.sizeInfo={width:0,height:0,left:0,top:0},e._accPlayed={t:0,acc:0,loopAcc:0},e._offsetInfo={currentTime:-1,duration:0},e.innerContainer=null,e.controls=null,e.topBar=null,e.root=null,e.__i18n=Se.init(e._pluginInfoId),D.os.isAndroid&&D.osVersion>0&&D.osVersion<6&&(e.config.autoplay=!1),e.database=new er,e.isUserActive=!1,e._onceSeekCanplay=null,e._isPauseBeforeSeek=0,e.innerStates={isActiveLocked:!1},e.instManager=de;var l=e._initDOM();if(!l)return console.error(new Error("can't find the dom which id is ".concat(e.config.id," or this.config.el does not exist"))),ct(e);var u=e.config,c=u.definition,h=c===void 0?{}:c,d=u.url;if(!d&&h.list&&h.list.length>0){var g=h.list.find(function(v){return v.definition&&v.definition===h.defaultDefinition});g||(h.defaultDefinition=h.list[0].definition,g=h.list[0]),e.config.url=g.url,e.curDefinition=g}return e._bindEvents(),e._registerPresets(),e._registerPlugins(),z.onPluginsReady(m(e)),e.getInitDefinition(),e.setState(M.READY),f.setTimeout(m(e),function(){e.emit(yt)},0),e.onReady&&e.onReady(),(e.config.videoInit||e.config.autoplay)&&(!e.hasStart||e.state<M.ATTACHED)&&e.start(),e}return S(r,[{key:"_initDOM",value:function(){var e,i=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var n=this.config.el;if(n&&n.nodeType===1)this.root=n;else return this.emit(Oe,new Ue("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1}var s=kr(this.root);s&&(R.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),s.destroy()),this.root.setAttribute(Ce,this.playerId),(e=de)===null||e===void 0||e.add(this),z.init(this),this._initBaseDoms();var l=this.constructor.XgVideoProxy;if(l&&this.mediaConfig.mediaType===l.mediaType){var u=this.innerContainer||this.root;this.detachVideoEvents(this.media);var c=new l(u,this.config,this.mediaConfig);this.attachVideoEvents(c),this.media=c}if(this.media.setAttribute(Ce,this.playerId),this.config.controls){var h=this.config.controls.root||null,d=z.register(this,mr,{root:h});this.controls=d}var g=this.config.isMobileSimulateMode==="mobile"?"mobile":D.device;if(this.addClass("".concat(k.DEFAULT," ").concat(k.INACTIVE," xgplayer-").concat(g," ").concat(this.config.controls?"":k.NO_CONTROLS)),this.config.autoplay?this.addClass(k.ENTER):this.addClass(k.NO_START),this.config.fluid){var v=this.config,y=v.width,C=v.height;(typeof y!="number"||typeof C!="number")&&(y=600,C=337.5);var b={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(C*100/y,"%")};Object.keys(b).forEach(function(L){i.root.style[L]=b[L]})}else["width","height"].forEach(function(L){i.config[L]&&(typeof i.config[L]!="number"?i.root.style[L]=i.config[L]:i.root.style[L]="".concat(i.config[L],"px"))});var w=this.root.getBoundingClientRect(),T=w.width,B=w.height,O=w.left,U=w.top;return this.sizeInfo.width=T,this.sizeInfo.height=B,this.sizeInfo.left=O,this.sizeInfo.top=U,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=f.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach(function(i){e.on(i,e["on"+i.charAt(0).toUpperCase()+i.slice(1)])}),yi.forEach(function(i){document&&document.addEventListener(i,e.onFullscreenChange)}),D.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(ae,this.resize),this.playFunc=function(){e.config.closeFocusVideoFocus||e.media.focus()},this.once($,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),yi.forEach(function(i){document.removeEventListener(i,e.onFullscreenChange)}),this.playFunc&&this.off($,this.playFunc),this.off(oe,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_clearUserTimer",value:function(){this.userTimer&&(f.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var i=this;if(this.media&&!((!e||e===""||f.typeOf(e)==="Array"&&e.length===0)&&(e="",this.emit(si),R.logWarn("config.url is null, please get url and run player._startInit(url)"),this.config.nullUrlStart))){this.handleSource&&(this._detachSourceEvents(this.media),f.typeOf(e)==="Array"&&e.length>0?this._attachSourceEvents(this.media,e):!this.media.src||this.media.src!==e?this.media.src=e:e||this.media.removeAttribute("src")),f.typeOf(this.config.volume)==="Number"&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var s=this.media.readyState;R.logInfo("_startInit readyState",s),this.config.autoplay&&(!f.isMSE(this.media)&&this.load(),(D.os.isIpad||D.os.isPhone)&&this.mediaPlay());var l=this.config.startTime;this.__startTime=l>0?l:-1,this.config.startTime=0,s>=2&&this.duration>0?this.canPlayFunc():this.on(oe,this.canPlayFunc),(!this.hasStart||this.state<M.ATTACHED)&&z.afterInit(this),this.hasStart=!0,this.setState(M.ATTACHED),f.setTimeout(this,function(){i.emit(ze)},0)}}},{key:"_registerPlugins",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this._loadingPlugins=[];var n=this.config.ignores||[],s=this.config.plugins||[],l=this.config.i18n||[];i&&Se.extend(l,this.__i18n);var u=n.join("||").toLowerCase().split("||"),c=this.plugins;s.forEach(function(h){try{var d=h.plugin?h.plugin.pluginName:h.pluginName;if(d&&u.indexOf(d.toLowerCase())>-1)return null;if(!i&&c[d.toLowerCase()])return;if(h.lazy&&h.loader){var g=z.lazyRegister(e,h);h.forceBeforeInit&&(g.then(function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}).catch(function(v){R.logError("_registerPlugins:loadingPlugin",v),e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}),e._loadingPlugins.push(g));return}return e.registerPlugin(h)}catch(v){R.logError("_registerPlugins:",v)}})}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach(function(i){vr(e,i)})}},{key:"_getRootByPosition",value:function(e){var i=null;switch(e){case H.ROOT_RIGHT:this.rightBar||(this.rightBar=f.createPositionBar("xg-right-bar",this.root)),i=this.rightBar;break;case H.ROOT_LEFT:this.leftBar||(this.leftBar=f.createPositionBar("xg-left-bar",this.root)),i=this.leftBar;break;case H.ROOT_TOP:this.topBar||(this.topBar=f.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&f.addClass(this.topBar,k.TOP_BAR_AUTOHIDE)),i=this.topBar;break;default:i=this.innerContainer||this.root;break}return i}},{key:"registerPlugin",value:function(e,i){var n=z.formatPluginInfo(e,i),s=n.PLUFGIN,l=n.options,u=this.config.plugins,c=z.checkPluginIfExits(s.pluginName,u);!c&&u.push(s);var h=z.getRootByConfig(s.pluginName,this.config);h.root&&(l.root=h.root),h.position&&(l.position=h.position);var d=l.position?l.position:l.config&&l.config.position||s.defaultConfig&&s.defaultConfig.position;return!l.root&&typeof d=="string"&&d.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(s,l,s.pluginName):(l.root||(l.root=this._getRootByPosition(d)),z.register(this,s,l))}},{key:"deregister",value:function(e){typeof e=="string"?z.unRegister(this,e):e instanceof he&&z.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.deregister(e),i&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var i;if(typeof e=="string"?i=e:e instanceof he&&(i=e.pluginName),!!i)for(var n=this.config.plugins.length-1;n>-1;n--){var s=this.config.plugins[n];if(s.pluginName.toLowerCase()===i.toLowerCase()){this.config.plugins.splice(n,1);break}}}},{key:"plugins",get:function(){return z.getPlugins(this)}},{key:"getPlugin",value:function(e){var i=z.findPlugin(this,e);return i&&i.pluginName?i:null}},{key:"addClass",value:function(e){this.root&&(f.hasClass(this.root,e)||f.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&f.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return f.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,i){this.root&&this.root.setAttribute(e,i)}},{key:"removeAttribute",value:function(e,i){this.root&&this.root.removeAttribute(e,i)}},{key:"start",value:function(e){var i=this;if(!(this.state>M.ATTACHING))return!e&&!this.config.url&&this.getInitDefinition(),this.hasStart=!0,this.setState(M.ATTACHING),this._registerPlugins(!1),z.beforeInit(this).then(function(){if(i.config){e||(e=i.url||i.config.url);var n=i._preProcessUrl(e),s=i._startInit(n.url);return s}}).catch(function(n){throw n.fileName="player",n.lineNumber="236",R.logError("start:beforeInit:",n),n})}},{key:"switchURL",value:function(e,i){var n=this,s=e;f.typeOf(e)==="Object"&&(s=e.url),s=this._preProcessUrl(s).url;var l=this.currentTime;this.__startTime=l;var u=this.paused&&!this.isError;return this.src=s,new Promise(function(c,h){var d=function(y){n.off("timeupdate",g),n.off("canplay",g),h(y)},g=function(){n.duration>0&&n.__startTime>0&&(n.currentTime=n.__startTime,n.__startTime=-1),u&&n.pause(),n.off("error",d),c(!0)};if(n.once("error",d),!s){n.errorHandler("error",{code:6,message:"empty_src"});return}D.os.isAndroid?n.once("timeupdate",g):n.once("canplay",g),n.play()})}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<M.ATTACHED){this.removeClass(k.NO_START),this.addClass(k.ENTER),this.start(),this._useAutoplay=!0;return}this.state<M.RUNNING&&(this.removeClass(k.NO_START),!this.isCanplay&&this.addClass(k.ENTER));var i=A(I(r.prototype),"play",this).call(this);return i!==void 0&&i&&i.then?i.then(function(){e.removeClass(k.NOT_ALLOW_AUTOPLAY),e.addClass(k.PLAYING),e.state<M.RUNNING&&(R.logInfo(">>>>playPromise.then"),e.setState(M.RUNNING),e.emit(_e))}).catch(function(n){if(R.logWarn(">>>>playPromise.catch",n.name),e.media&&e.media.error){e.onError(),e.removeClass(k.ENTER);return}n.name==="NotAllowedError"&&(e._errorTimer=f.setTimeout(e,function(){e._errorTimer=null,e.emit(_t),e.addClass(k.NOT_ALLOW_AUTOPLAY),e.removeClass(k.ENTER),e.pause(),e.setState(M.NOTALLOW)},0))}):(R.logWarn("video.play not return promise"),this.state<M.RUNNING&&(this.setState(M.RUNNING),this.removeClass(k.NOT_ALLOW_AUTOPLAY),this.removeClass(k.NO_START),this.removeClass(k.ENTER),this.addClass(k.PLAYING),this.emit(_e))),i}},{key:"mediaPause",value:function(){A(I(r.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){A(I(r.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(k.PAUSED),ue(this,"play",function(){return e.mediaPlay()})}},{key:"pause",value:function(){var e=this;ue(this,"pause",function(){A(I(r.prototype),"pause",e).call(e)})}},{key:"seek",value:function(e,i){var n=this;if(!(!this.media||Number.isNaN(Number(e))||!this.hasStart)){var s=this.config,l=s.isSeekedPlay,u=s.seekedStatus,c=i||(l?"play":u);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(se,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(n.removeClass(k.ENTER),n.isSeeking=!1,c){case"play":n.play();break;case"pause":n.pause();break;default:n._isPauseBeforeSeek>1||n.paused?n.pause():n.play()}n._isPauseBeforeSeek=0,n._onceSeekCanplay=null},this.once(se,this._onceSeekCanplay),this.state<M.RUNNING?(this.removeClass(k.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,i=this.config,n=i.definition,s=i.url;!s&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&n.list.map(function(l){l.definition===n.defaultDefinition&&(e.config.url=l.url,e.curDefinition=l)})}},{key:"changeDefinition",value:function(e,i){var n=this,s=this.config.definition;if(Array.isArray(s==null?void 0:s.list)&&s.list.forEach(function(u){(e==null?void 0:e.definition)===u.definition&&(n.curDefinition=u)}),e!=null&&e.bitrate&&typeof e.bitrate!="number"&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(bt,{from:i,to:e}),!this.hasStart){this.config.url=e.url;return}var l=this.switchURL(e.url,V({seamless:s.seamless!==!1&&typeof MediaSource<"u"&&typeof MediaSource.isTypeSupported=="function"},e));l&&l.then?l.then(function(){n.emit(Tt,{from:i,to:e})}):this.emit(Tt,{from:i,to:e})}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(ae,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,i=k.NOT_ALLOW_AUTOPLAY,n=k.PLAYING,s=k.NO_START,l=k.PAUSED,u=k.REPLAY,c=k.ENTER,h=k.ENDED,d=k.ERROR,g=k.LOADING,v=[i,n,s,l,u,c,h,d,g];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,v.forEach(function(y){e.removeClass(y)}),this.addClass(k.NO_START),this.emit(Xe)}},{key:"reset",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;this.resetState();var s=this.plugins;if(s&&(i.map(function(u){e.deregister(u)}),n)){var l=Pi();Object.keys(this.config).keys(function(u){e.config[u]!=="undefined"&&(u==="plugins"||u==="presets"||u==="el"||u==="id")&&(e.config[u]=l[u])})}}},{key:"destroy",value:function(){var e,i=this,n=this.innerContainer,s=this.root,l=this.media;if(!(!s||!l)){if(this.hasStart=!1,this._useAutoplay=!1,s.removeAttribute(Ce),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),f.clearAllTimers(this),this.emit(Ct),(e=de)===null||e===void 0||e.remove(this),z.destroy(this),wi(this),A(I(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),n)for(var u=n.children,c=0;c<u.length;c++)n.removeChild(u[c]);!n&&l instanceof window.Node&&s.contains(l)&&s.removeChild(l),["topBar","leftBar","rightBar","innerContainer"].map(function(d){i[d]&&s.removeChild(i[d]),i[d]=null});var h=s.className.split(" ");h.length>0?s.className=h.filter(function(d){return d.indexOf("xgplayer")<0}).join(" "):s.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach(function(d){i[d]=!1})}}},{key:"replay",value:function(){var e=this;this.removeClass(k.ENDED),this.currentTime=0,this.isSeeking=!1,ue(this,"replay",function(){e.once(se,function(){var i=e.mediaPlay();i&&i.catch&&i.catch(function(n){console.log(n)})}),e.emit(je),e.onPlay()})}},{key:"retry",value:function(){var e=this;this.removeClass(k.ERROR),this.addClass(k.LOADING),ue(this,"retry",function(){var i=e.currentTime,n=e.config.url,s=f.isMSE(e.media)?{url:n}:e._preProcessUrl(n);e.src=s.url,!e.config.isLive&&(e.currentTime=i),e.once(oe,function(){e.mediaPlay()})})}},{key:"changeFullStyle",value:function(e,i,n,s){e&&(s||(s=k.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=f.filterStyleFromText(e)),f.addClass(e,n),i&&i!==e&&!this._orgPCss&&(this._orgPCss=f.filterStyleFromText(i),f.addClass(i,s),i.setAttribute(Ce,this.playerId)))}},{key:"recoverFullStyle",value:function(e,i,n,s){s||(s=k.PARENT_FULLSCREEN),this._orgCss&&(f.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),f.removeClass(e,n),i&&i!==e&&this._orgPCss&&(f.setStyleFromCsstext(i,this._orgPCss),this._orgPCss="",f.removeClass(i,s),i.removeAttribute(Ce))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget,i=this.root,n=this.media;(e==="video"||e==="media")&&(e=this[e]),e||(e=i),this._fullScreenOffset={top:f.scrollTop(),left:f.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get";var s=f.getFullScreenEl();if(s===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var l=0;l<_i.length;l++){var u=_i[l];if(e[u]){var c=u==="webkitRequestFullscreen"?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[u]();return c&&c.then?c:Promise.resolve()}}return n.fullscreenEnabled||n.webkitSupportsFullscreen?(n.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch{return Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),!(!this._fullscreenEl&&!f.getFullScreenEl())){this.root;var i=this.media;this._fullActionFrom="exit";try{for(var n=0;n<Ci.length;n++){var s=Ci[n];if(document[s]){var l=document[s]();return l&&l.then?l:Promise.resolve()}}return i&&i.webkitSupportsFullscreen?(i.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch{return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var i=e?"".concat(k.INNER_FULLSCREEN," ").concat(k.CSS_FULLSCREEN):k.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,i);var n=this.config.fullscreen,s=n===void 0?{}:n,l=s.useCssFullscreen===!0||typeof s.useCssFullscreen=="function"&&s.useCssFullscreen();l&&(this.fullscreen=!0,this.emit(le,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Ge,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(k.INNER_FULLSCREEN," ").concat(k.CSS_FULLSCREEN):k.CSS_FULLSCREEN;if(!this.fullscreen)this.recoverFullStyle(this.root,this._cssfullscreenEl,e);else{var i=this.config.fullscreen,n=i===void 0?{}:i,s=n.useCssFullscreen===!0||typeof n.useCssFullscreen=="function"&&n.useCssFullscreen();s?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(le,!1)):this.removeClass(e)}this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Ge,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var i=e?"".concat(k.INNER_FULLSCREEN," ").concat(k.ROTATE_FULLSCREEN):k.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,i,k.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(le,!0)}},{key:"exitRotateFullscreen",value:function(e){var i=this._fullscreenEl!==this.root?"".concat(k.INNER_FULLSCREEN," ").concat(k.ROTATE_FULLSCREEN):k.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,i,k.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(le,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){window.orientation===90||window.orientation===-90?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};if(this.isActive){this.onFocus(e);return}this.emit(mt,V({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{ignorePaused:!1};if(!this.isActive){this.onBlur(e);return}this._clearUserTimer(),this.emit(ri,V({paused:this.paused,ended:this.ended},e))}},{key:"onFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!0,delay:3e3},n=this.innerStates;if(this.isActive=!0,this.removeClass(k.INACTIVE),this._clearUserTimer(),i.isLock!==void 0&&(n.isActiveLocked=i.isLock),i.autoHide===!1||i.isLock===!0||n.isActiveLocked){this._clearUserTimer();return}var s=i&&i.delay?i.delay:this.config.inactive;this.userTimer=f.setTimeout(this,function(){e.userTimer=null,e.blur()},s)}},{key:"onBlur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=e.ignorePaused,n=i===void 0?!1:i;if(!this.innerStates.isActiveLocked){var s=this.config.closePauseVideoFocus;this.isActive=!1,(n||s||!this.paused&&!this.ended)&&this.addClass(k.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(k.ENTER),this.removeClass(k.ERROR),this.removeClass(k.LOADING),this.isCanplay=!0,this.waitTimer&&f.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){this.isError=!1,this.isSeeking=!1,this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime,this.__startTime=-1)}},{key:"onLoadstart",value:function(){this.removeClass(k.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===M.ENDED&&this.setState(M.RUNNING),this.removeClass(k.PAUSED),this.ended&&this.removeClass(k.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(k.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(k.ENDED),this.setState(M.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(k.NOT_ALLOW_AUTOPLAY),this.removeClass(k.NO_START),this.removeClass(k.ENTER),this.removeClass(k.LOADING),this.addClass(k.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(k.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&f.clearTimeout(this,this.waitTimer),this.removeClass(k.LOADING),this.removeClass(k.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&f.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=f.setTimeout(this,function(){e.addClass(k.LOADING),e.emit(li),f.clearTimeout(e,e.waitTimer),e.waitTimer=null},this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1;var i=k.NO_START,n=k.PAUSED,s=k.ENDED,l=k.ERROR,u=k.REPLAY,c=k.LOADING,h=[i,n,s,l,u,c];h.forEach(function(d){e.removeClass(d)}),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(k.LOADING))&&this.media.readyState>2&&(this.removeClass(k.LOADING),f.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===M.NOTALLOW&&this.duration&&(this.setState(M.RUNNING),this.emit(_e)),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onVolumechange",value:function(){f.typeOf(this.config.volume)==="Number"&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,i,n){if(!(!this.media||!i||!e)){var s=f.typeOf(e)==="String"?e:e.type||"";n.props&&f.typeOf(n.props)!=="Array"&&(n.props=[n.props]),this.emit($e,V({eventType:s,action:i,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},n))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var i=new Date().getTime()-this._accPlayed.t;this._accPlayed.acc+=i,this._accPlayed.t=0,(e==="ended"||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{startDiff:0,endDiff:0},n=i||{},s=n.startDiff,l=s===void 0?0:s,u=n.endDiff,c=u===void 0?0:u,h=this.media.buffered;if(!h||h.length===0||!this.duration)return!0;for(var d=e||this.media.currentTime||.2,g=h.length,v=0;v<g;v++)if(h.start(v)+l<=d&&h.end(v)-c>d)return!0;return!1}},{key:"resizePosition",value:function(){var e=this.videoPos,i=e.vy,n=e.vx,s=e.h,l=e.w,u=this.videoPos.rotate;if(!(u<0&&s<0&&l<0)){var c=this.videoPos._pi;if(!c&&this.media.videoHeight&&(c=this.media.videoWidth/this.media.videoHeight*100),!!c){this.videoPos.pi=c,u=u<0?0:u;var h={rotate:u},d=0,g=0,v=1,y=Math.abs(u/90),C=this.root,b=this.innerContainer,w=C.offsetWidth,T=b?b.offsetHeight:C.offsetHeight,B=T,O=w;if(y%2===0)v=s>0?100/s:l>0?100/l:1,h.scale=v,d=i>0?(100-s)/2-i:0,h.y=y===2?0-d:d,g=n>0?(100-l)/2-n:0,h.x=y===2?0-g:g,this.media.style.width="".concat(O,"px"),this.media.style.height="".concat(B,"px");else if(y%2===1){O=T,B=w;var U=T-w;g=-U/2/O*100,h.x=y===3?g+i/2:g-i/2,d=U/2/B*100,h.y=y===3?d+n/2:d-n/2,h.scale=v,this.media.style.width="".concat(O,"px"),this.media.style.height="".concat(B,"px")}var L=f.getTransformStyle(h,this.media.style.transform||this.media.style.webkitTransform);this.media.style.transform=L,this.media.style.webkitTransform=L}}}},{key:"position",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{h:0,y:0,x:0,w:0};if(!(!this.media||!e||!e.h)){var i=this.videoPos;i.h=e.h*100||0,i.w=e.w*100||0,i.vx=e.x*100||0,i.vy=e.y*100||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(n){if(n!=="plugins"){i.config[n]=e[n];var s=i.plugins[n.toLowerCase()];s&&f.typeOf(s.setConfig)==="Function"&&s.setConfig(e[n])}})}},{key:"playNext",value:function(e){var i=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,ue(this,"playnext",function(){i.start(),i.emit(Ye,e)})}},{key:"resize",value:function(){var e=this;if(this.media){var i=this.root.getBoundingClientRect();this.sizeInfo.width=i.width,this.sizeInfo.height=i.height,this.sizeInfo.left=i.left,this.sizeInfo.top=i.top;var n=this.media,s=n.videoWidth,l=n.videoHeight,u=this.config,c=u.fitVideoSize,h=u.videoFillMode;if((h==="fill"||h==="cover"||h==="contain")&&this.setAttribute("data-xgfill",h),!(!l||!s)){this._videoHeight=l,this._videoWidth=s;var d=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,g=i.width,v=i.height-d,y=parseInt(s/l*1e3,10),C=parseInt(g/v*1e3,10),b=g,w=v,T={};c==="auto"&&C>y||c==="fixWidth"?(w=g/y*1e3,this.config.fluid?T.paddingTop="".concat(w*100/b,"%"):T.height="".concat(w+d,"px")):(c==="auto"&&C<y||c==="fixHeight")&&(b=y*v/1e3,T.width="".concat(b,"px")),!this.fullscreen&&!this.cssfullscreen&&Object.keys(T).forEach(function(O){e.root.style[O]=T[O]}),(h==="fillHeight"&&C<y||h==="fillWidth"&&C>y)&&this.setAttribute("data-xgfill","cover");var B={videoScale:y,vWidth:b,vHeight:w,cWidth:b,cHeight:w+d};this.resizePosition(),this.emit(fe,B)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(this.media.updateObjectPosition){this.media.updateObjectPosition(e,i);return}this.media.style.objectPosition="".concat(e*100,"% ").concat(i*100,"%")}},{key:"setState",value:function(e){R.logInfo("setState","state from:".concat(Ai[this.state]," to:").concat(Ai[e])),this._state=e}},{key:"_preProcessUrl",value:function(e,i){var n=this.config,s=n.preProcessUrl,l=n.preProcessUrlOptions,u=Object.assign({},l,i);return!f.isBlob(e)&&typeof s=="function"?s(e,u):{url:e}}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){typeof e=="boolean"&&(this._hasStart=e,e===!1&&this.setState(M.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===M.RUNNING||this._state===M.ENDED},set:function(e){e?this.setState(M.RUNNING):this._state>=M.RUNNING&&this.setState(M.ATTACHED)}},{key:"definitionList",get:function(){return!this.config||!this.config.definition?[]:this.config.definition.list||[]},set:function(e){var i=this,n=this.config.definition,s=null,l=null;n.list=e,this.emit("resourceReady",e),e.forEach(function(u){var c;((c=i.curDefinition)===null||c===void 0?void 0:c.definition)===u.definition&&(s=u),n.defaultDefinition===u.definition&&(l=u)}),!l&&e.length>0&&(l=e[0]),s?this.changeDefinition(s):l&&this.changeDefinition(l)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var i=this.media.getVideoPlaybackQuality();return e.dropped=i.droppedVideoFrames||0,e.total=i.totalVideoFrames||0,e.corrupted=i.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){var i=Se.langKeys.filter(function(n){return n===e});if(i.length===0&&e!=="zh"){console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(Se.langKeys.join(),"] "));return}this.config.lang=e,z.setLang(e,this)}},{key:"i18n",get:function(){var e=this.config.lang;return e==="zh"&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return gt}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return A(I(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=A(I(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return A(I(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return this._fullScreenOffset!==null}},{key:"cumulateTime",get:function(){var e=this._accPlayed,i=e.acc,n=e.t;return n?new Date().getTime()-n+i:i}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){e=f.convertDeg(e),!(e%90!==0||e===this.videoPos.rotate)&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return Ri},set:function(e){Ri=e}},{key:"realTimeSpeed",get:function(){return Di},set:function(e){Di=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,i){return Ze.call.apply(Ze,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,i){return Je.call.apply(Je,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,i){return Qe.call.apply(Qe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,i,n){for(var s=arguments.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=arguments[u];return ki.call.apply(ki,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,i,n){for(var s=arguments.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=arguments[u];return bi.call.apply(bi,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,i){var n;typeof i=="boolean"&&i!==this.muted&&(this.addInnerOP("volumechange"),f.typeOf(i)===Boolean&&(this.muted=i)),(n=de)===null||n===void 0||n.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return R.config.debug},set:function(e){R.config.debug=e}},{key:"instManager",get:function(){return de},set:function(e){de=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return(e=de)===null||e===void 0?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,i){var n;(n=de)===null||n===void 0||n.setActive(e,i)}},{key:"isHevcSupported",value:function(){return D.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return D.probeConfigSupported(e)}},{key:"install",value:function(e,i){r.plugins||(r.plugins={}),r.plugins[e]||(r.plugins[e]=i)}},{key:"use",value:function(e,i){r.plugins||(r.plugins={}),r.plugins[e]=i}}]),r}(Qn);_(et,"defaultPreset",null),_(et,"XgVideoProxy",null),et.instManager=Li.getInstance();function G(){return new Date().getTime()}var ge={LOAD_START:"loadstart",LOADED_DATA:"loadeddata",FIRST_FRAME:"firstFrame",WAIT_START:"waitingStart",WAIT_END:"waitingEnd",SEEK_START:"seekStart",SEEK_END:"seekEnd"},Tr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onTimeupdate",function(){t._state.isTimeUpdate=!0,t._state.autoplayStart&&(R.logInfo("[xgLogger]".concat(t.player.playerId," _onTimeupdate")),t._sendFF("onTimeupdate"))}),_(m(t),"_onAutoplayStart",function(){R.logInfo("[xgLogger]".concat(t.player.playerId," _onAutoplayStart")),t._state.autoplayStart=!0,t.vt&&t._sendFF("onAutoplayStart")}),_(m(t),"_onReset",function(){t._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},t.vt=0,t.pt=0,t.fvt=0,t.newPointTime=G(),t.loadedCostTime=0,t.startCostTime=0,t._isSeeking=!1,t.seekingStart=0,t.waitingStart=0,t.fixedWaitingStart=0,t._isWaiting=!1,t._waitTimer&&f.clearTimeout(m(t),t._waitTimer),t._waittTimer&&f.clearTimeout(m(t),t._waittTimer),t._waitTimer=null,t._waittTimer=null,t._waitType=0}),_(m(t),"_onSeeking",function(){t.seekingStart||(t.suspendWaitingStatus("seek"),t.seekingStart=G(),t.emitLog(ge.SEEK_START,{start:G()}))}),_(m(t),"_onSeeked",function(){t.suspendSeekingStatus("seeked")}),_(m(t),"_onWaitingLoadStart",function(){t._isWaiting||t.vt||(t._isWaiting=!0,t.waitingStart=G(),t.fixedWaitingStart=G(),t._waitType=1,t.emitLog(ge.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:1,endType:"loadstart"}))}),_(m(t),"_onWaiting",function(){t._isWaiting||!t.vt||(t._isWaiting=!0,t.vt?t.seekingStart?t._waitType=2:t._waitType=0:t._waitType=1,t.fixedWaitingStart=G(),t._waitTimer=f.setTimeout(m(t),function(){t._isWaiting&&(t.waitingStart=G(),f.clearTimeout(m(t),t._waitTimer),t._waitTimer=null,t._startWaitTimeout(),t.emitLog(ge.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:t._waitType,endType:t._waitType===2?"seek":"playing"}))},200))}),_(m(t),"_onError",function(){t.suspendSeekingStatus("error"),t.suspendWaitingStatus("error")}),_(m(t),"_onPlaying",function(){t._isWaiting&&t.suspendWaitingStatus("playing")}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=G(),this.loadedCostTime=0,this.startCostTime=0,this.on(vt,function(){var i=e._state,n=i.autoplayStart,s=i.isFFSend;e.startCostTime=G()-e.newPointTime,R.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),"autoplayStart:".concat(n," isFFSend:").concat(s," startCostTime:").concat(e.startCostTime," newPointTime").concat(e.newPointTime)),!s&&(!i.isLs&&e.emitLog(ge.LOAD_START,{}),i.isLs=!0,i.isTimeUpdate=!1,i.isFFLoading=!0,e.pt=G(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())}),this.on(ae,function(){e.vt=G(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var i=e._state,n=i.isTimeUpdate,s=i.isFFSend,l=i.autoplayStart;R.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),"fvt:".concat(e.fvt," isTimeUpdate:").concat(e._state.isTimeUpdate," loadedCostTime:").concat(e.loadedCostTime)),(n||l)&&e._sendFF("loadedData"),s||e.emitLog(ge.LOADED_DATA,{}),e.suspendWaitingStatus("loadeddata")}),this.on(Ve,this._onSeeking),this.on(se,this._onSeeked),this.on(Ct,function(){e.endState("destroy")}),this.on(We,function(){e.endState("urlChange"),R.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()}),this.on([pt,oe],this._onPlaying),this.on(Me,this._onWaiting),this.on(Oe,this._onError),this.on(Xe,function(){R.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()})}},{key:"_initOnceEvents",value:function(){this.off(_e,this._onAutoplayStart),this.off(X,this._onTimeupdate),this.once(_e,this._onAutoplayStart),this.once(X,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=G();var i=this._state,n=i.isFFLoading,s=i.isFFSend;R.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(n," !isFFSend:").concat(!s)),this.vt>0&&n&&!s&&(R.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(ge.FIRST_FRAME,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&f.clearTimeout(this,this._waittTimer),this._waittTimer=f.setTimeout(this,function(){e.suspendWaitingStatus("timeout"),f.clearTimeout(e,e._waittTimer),e._waittTimer=null},this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var i=G(),n=i-this.seekingStart;this.seekingStart=0,this.emitLog(ge.SEEK_END,{end:i,costTime:n,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(f.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(f.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,!!this.waitingStart){var i=G(),n=i-this.waitingStart,s=i-this.fixedWaitingStart,l=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(ge.WAIT_END,{fixedCostTime:s>l?l:s,costTime:n>l?l:n,type:e==="loadeddata"?1:this._waitType,endType:this._waitType===2?"seek":e})}}},{key:"emitLog",value:function(e,i){var n=this.player;this.emit(hi,V({t:G(),host:f.getHostFromUrl(n.currentSrc),vtype:n.vtype,eventType:e,currentTime:this.player.currentTime,readyState:n.video.readyState,networkState:n.video.networkState},i))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),r}(F);function wr(){return new DOMParser().parseFromString(`<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">
11
11
  <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>
12
12
  </svg>
13
- `,"image/svg+xml").firstChild}var Sr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"registerIcons",value:function(){return{replay:Er}}},{key:"afterCreate",value:function(){var e=this;F.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",function(){e.player.replay()},{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(me,function(){if(e.playerConfig.loop||f.addClass(e.player.root,"replay"),!e.config.disable){e.show();var i=e.root.querySelector("path");if(i){var n=window.getComputedStyle(i).getPropertyValue("transform");if(typeof n=="string"&&n.indexOf("none")>-1)return null;i.setAttribute("transform",n)}}}),this.on($,function(){e.hide()})}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),f.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return`<xg-replay class="xgplayer-replay">
13
+ `,"image/svg+xml").firstChild}var Er=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"registerIcons",value:function(){return{replay:wr}}},{key:"afterCreate",value:function(){var e=this;F.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",function(){e.player.replay()},{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(me,function(){if(e.playerConfig.loop||f.addClass(e.player.root,"replay"),!e.config.disable){e.show();var i=e.root.querySelector("path");if(i){var n=window.getComputedStyle(i).getPropertyValue("transform");if(typeof n=="string"&&n.indexOf("none")>-1)return null;i.setAttribute("transform",n)}}}),this.on($,function(){e.hide()})}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),f.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return`<xg-replay class="xgplayer-replay">
14
14
  <xg-replay-txt class="xgplayer-replay-txt" lang-key="`.concat(this.i18nKeys.REPLAY,'">').concat(this.i18n.REPLAY,`</xg-replay-txt>
15
- </xg-replay>`)}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),r}(F),xr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){f.addClass(this.root,"hide")}},{key:"show",value:function(e){f.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){typeof e.player.config.poster=="string"&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(me,function(){e.isEndedShow&&f.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(X,function(){e.onTimeUpdate()}),this.on(We,function(){f.removeClass(e.root,"hide"),f.addClass(e.root,"xg-showplay"),e.once(X,function(){e.onTimeUpdate()})})):this.on($,function(){f.addClass(e.root,"hide")})}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(s){i.config[s]=e[s]});var n=this.config.poster;this.update(n)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?f.removeClass(this.root,"xg-showplay"):this.once(X,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var i="";switch(e){case"cover":i="cover";break;case"contain":i="contain";break;case"fixHeight":i="auto 100%";break;default:i=""}return i?"background-size: ".concat(i,";"):""}},{key:"render",value:function(){var e=this.config,i=e.poster,n=e.hideCanplay,s=e.fillMode,l=e.notHidden,u=this.getBgSize(s),c=i?"background-image:url(".concat(i,");").concat(u):u,h=l?"xg-not-hidden":n?"xg-showplay":"";return'<xg-poster class="xgplayer-poster '.concat(h,'" style="').concat(c,`">
16
- </xg-poster>`)}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),r}(F);function Dt(){return new DOMParser().parseFromString(`<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">
15
+ </xg-replay>`)}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),r}(F),Sr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){f.addClass(this.root,"hide")}},{key:"show",value:function(e){f.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){typeof e.player.config.poster=="string"&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(me,function(){e.isEndedShow&&f.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(X,function(){e.onTimeUpdate()}),this.on(We,function(){f.removeClass(e.root,"hide"),f.addClass(e.root,"xg-showplay"),e.once(X,function(){e.onTimeUpdate()})})):this.on($,function(){f.addClass(e.root,"hide")})}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(s){i.config[s]=e[s]});var n=this.config.poster;this.update(n)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?f.removeClass(this.root,"xg-showplay"):this.once(X,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var i="";switch(e){case"cover":i="cover";break;case"contain":i="contain";break;case"fixHeight":i="auto 100%";break;default:i=""}return i?"background-size: ".concat(i,";"):""}},{key:"render",value:function(){var e=this.config,i=e.poster,n=e.hideCanplay,s=e.fillMode,l=e.notHidden,u=this.getBgSize(s),c=i?"background-image:url(".concat(i,");").concat(u):u,h=l?"xg-not-hidden":n?"xg-showplay":"";return'<xg-poster class="xgplayer-poster '.concat(h,'" style="').concat(c,`">
16
+ </xg-poster>`)}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),r}(F);function Lt(){return new DOMParser().parseFromString(`<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">
17
17
  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>
18
18
  </svg>
19
- `,"image/svg+xml").firstChild}function Rt(){return new DOMParser().parseFromString(`<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">
19
+ `,"image/svg+xml").firstChild}function Dt(){return new DOMParser().parseFromString(`<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">
20
20
  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>
21
21
  </svg>
22
- `,"image/svg+xml").firstChild}var ne={};function Pr(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{start:null,end:null};return ne[a]&&window.clearTimeout(ne[a].id),ne[a]={},r.start&&r.start(),ne[a].id=window.setTimeout(function(){r.end&&r.end(),window.clearTimeout(ne[a].id),delete ne[a]},o),ne[a].id}function Oi(a){if(a){window.clearTimeout(a);return}Object.keys(ne).map(function(o){window.clearTimeout(ne[o].id),delete ne[o]})}var Ir=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onPlayerReset",function(){e.autoPlayStart=!1;var i=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),f.removeClass(e.root,i),e.show()}),_(m(e),"onAutoplayStart",function(){if(!e.autoPlayStart){var i=e.config.mode==="auto"?"auto-hide":"hide";f.addClass(e.root,i),e.autoPlayStart=!0,e.onPlayPause("play")}}),e.autoPlayStart=!1,e}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.playerConfig;this.initIcons(),this.once(_t,function(){n&&(n.lang&&n.lang==="en"?f.addClass(i.root,"lang-is-en"):n.lang==="jp"&&f.addClass(i.root,"lang-is-jp"))}),this.on(_e,this.onAutoplayStart),n.autoplay||this.show(),this.on(Ct,function(){var s=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),f.removeClass(e.root,s),e.show()}),this.on($,function(){e.onPlayPause("play")}),this.on(we,function(){e.onPlayPause("pause")}),this.on(Xe,function(){e.onPlayerReset()}),this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(l){l.cancelable&&l.preventDefault(),l.stopPropagation();var u=e.player.paused;e.emitUserAction(l,"switch_play_pause",{props:"paused",from:u,to:!u})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:Dt,class:"xg-icon-play"},startPause:{icon:Rt,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){f.addClass(this.root,"hide")}},{key:"show",value:function(e){f.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){f.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){f.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var i=this;this._animateId=Pr("pauseplay",400,{start:function(){f.addClass(i.root,"interact"),i.show(),i.switchStatus(!0)},end:function(){f.removeClass(i.root,"interact"),!e&&i.hide(),i._animateId=null}})}},{key:"endAnimate",value:function(){f.removeClass(this.root,"interact"),Oi(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var i=this.player;if(e.cancelable&&e.preventDefault(),e.stopPropagation(),!(i.state<M.READY)){var n=this.player.paused;!n&&i.state===M.RUNNING?i.pause():i.play()}}},{key:"onPlayPause",value:function(e){var i=this.config,n=this.player;if(!(!n||n.state<M.RUNNING||!this.autoPlayStart)){if(i.mode==="show"){this.switchStatus(),this.show();return}if(i.mode==="auto"){this.switchStatus();return}if(i.isShowPause&&n.paused&&!n.ended||i.isShowEnd&&n.ended){this.switchStatus(),this.show(),this.endAnimate();return}if(i.disableAnimate){this.switchStatus(),this.hide();return}if(e==="play")this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||n.ended)return;this.animate()}}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),Oi(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?this.config.mode==="auto"?"auto-hide":"hide":"";return`
22
+ `,"image/svg+xml").firstChild}var ne={};function xr(a,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{start:null,end:null};return ne[a]&&window.clearTimeout(ne[a].id),ne[a]={},r.start&&r.start(),ne[a].id=window.setTimeout(function(){r.end&&r.end(),window.clearTimeout(ne[a].id),delete ne[a]},o),ne[a].id}function Oi(a){if(a){window.clearTimeout(a);return}Object.keys(ne).map(function(o){window.clearTimeout(ne[o].id),delete ne[o]})}var Pr=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onPlayerReset",function(){e.autoPlayStart=!1;var i=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),f.removeClass(e.root,i),e.show()}),_(m(e),"onAutoplayStart",function(){if(!e.autoPlayStart){var i=e.config.mode==="auto"?"auto-hide":"hide";f.addClass(e.root,i),e.autoPlayStart=!0,e.onPlayPause("play")}}),e.autoPlayStart=!1,e}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.playerConfig;this.initIcons(),this.once(yt,function(){n&&(n.lang&&n.lang==="en"?f.addClass(i.root,"lang-is-en"):n.lang==="jp"&&f.addClass(i.root,"lang-is-jp"))}),this.on(_e,this.onAutoplayStart),n.autoplay||this.show(),this.on(_t,function(){var s=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),f.removeClass(e.root,s),e.show()}),this.on($,function(){e.onPlayPause("play")}),this.on(we,function(){e.onPlayPause("pause")}),this.on(Xe,function(){e.onPlayerReset()}),this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(l){l.cancelable&&l.preventDefault(),l.stopPropagation();var u=e.player.paused;e.emitUserAction(l,"switch_play_pause",{props:"paused",from:u,to:!u})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:Lt,class:"xg-icon-play"},startPause:{icon:Dt,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){f.addClass(this.root,"hide")}},{key:"show",value:function(e){f.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){f.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){f.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var i=this;this._animateId=xr("pauseplay",400,{start:function(){f.addClass(i.root,"interact"),i.show(),i.switchStatus(!0)},end:function(){f.removeClass(i.root,"interact"),!e&&i.hide(),i._animateId=null}})}},{key:"endAnimate",value:function(){f.removeClass(this.root,"interact"),Oi(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var i=this.player;if(e.cancelable&&e.preventDefault(),e.stopPropagation(),!(i.state<M.READY)){var n=this.player.paused;!n&&i.state===M.RUNNING?i.pause():i.play()}}},{key:"onPlayPause",value:function(e){var i=this.config,n=this.player;if(!(!n||n.state<M.RUNNING||!this.autoPlayStart)){if(i.mode==="show"){this.switchStatus(),this.show();return}if(i.mode==="auto"){this.switchStatus();return}if(i.isShowPause&&n.paused&&!n.ended||i.isShowEnd&&n.ended){this.switchStatus(),this.show(),this.endAnimate();return}if(i.disableAnimate){this.switchStatus(),this.hide();return}if(e==="play")this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||n.ended)return;this.animate()}}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),Oi(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?this.config.mode==="auto"?"auto-hide":"hide":"";return`
23
23
  <xg-start class="xgplayer-start `.concat(e,`">
24
24
  <xg-start-inner></xg-start-inner>
25
- </xg-start>`)}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),r}(F),Ar=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"render",value:function(){var e=this.config.innerHtml,i=f.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)i.appendChild(e);else if(e&&typeof e=="string")i.innerHTML=e;else{for(var n="",s=1;s<=12;s++)n+='<div class="xgplayer-enter-bar'.concat(s,'"></div>');i.innerHTML='<div class="xgplayer-enter-spinner">'.concat(n,"</div>")}return i}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),r}(F);function pe(a,o,r){try{return' <div class="xg-tips '.concat(r?"hide":" ",'" lang-key="').concat(a.i18nKeys[o],`">
25
+ </xg-start>`)}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),r}(F),Ir=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"render",value:function(){var e=this.config.innerHtml,i=f.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)i.appendChild(e);else if(e&&typeof e=="string")i.innerHTML=e;else{for(var n="",s=1;s<=12;s++)n+='<div class="xgplayer-enter-bar'.concat(s,'"></div>');i.innerHTML='<div class="xgplayer-enter-spinner">'.concat(n,"</div>")}return i}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),r}(F);function pe(a,o,r){try{return' <div class="xg-tips '.concat(r?"hide":" ",'" lang-key="').concat(a.i18nKeys[o],`">
26
26
  `).concat(a.i18n[o],`
27
27
  </div>`)}catch{return'<div class="xg-tips hide"></div>'}}var Mi=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){this.getMini=this.getMini.bind(this),this.exitMini=this.exitMini.bind(this),this.bind("click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e="MINISCREEN";return`
28
28
  <xg-icon class="xgplayer-miniicon">
29
29
  <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="`.concat(this.i18nKeys[e],'">').concat(this.i18n[e],`</span></div>
30
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:10}}}]),r}(F);function Ni(a){var o=parseFloat(a),r=a.indexOf("%")===-1&&!Number.isNaN(o);return r&&o}var Ot=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],Fi=Ot.length;function Lr(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},o=0;o<Fi;o++){var r=Ot[o];a[r]=0}return a}function Dr(a){var o=window.getComputedStyle(a);return o}function Bi(a){if(typeof a=="string"&&(a=document.querySelector(a)),!(!a||W(a)!=="object"||!a.nodeType)){var o=Dr(a);if(o.display==="none")return Lr();var r={};r.width=a.offsetWidth,r.height=a.offsetHeight;for(var t=r.isBorderBox=o.boxSizing==="border-box",e=0;e<Fi;e++){var i=Ot[e],n=o[i],s=parseFloat(n);r[i]=Number.isNaN(s)?0:s}var l=r.paddingLeft+r.paddingRight,u=r.paddingTop+r.paddingBottom,c=r.marginLeft+r.marginRight,h=r.marginTop+r.marginBottom,d=r.borderLeftWidth+r.borderRightWidth,g=r.borderTopWidth+r.borderBottomWidth,v=t,y=Ni(o.width);y!==!1&&(r.width=y+(v?0:l+d));var C=Ni(o.height);return C!==!1&&(r.height=C+(v?0:u+g)),r.innerWidth=r.width-(l+d),r.innerHeight=r.height-(u+g),r.outerWidth=r.width+c,r.outerHeight=r.height+h,r}}function Mt(a,o){for(var r=0;r<a.length;r++){var t=a[r];if(t.identifier===o)return t}}var Nt={START:"dragStart",MOVE:"dragMove",ENDED:"dragEnded"},Hi={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},Rr=function(a){x(r,a);var o=P(r);function r(t){var e,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return E(this,r),e=o.call(this),e.isEnabled=!0,e.isDragging=!1,e.isDown=!1,e.position={},e.downPoint={},e.dragPoint={x:0,y:0},e.startPos={x:0,y:0},e._root=t instanceof Element?t:document.querySelector(t),e._handlerDom=i.handle instanceof Element?i.handle:document.querySelector(i.handle),!e._root||!e._handlerDom?ft(e):(e._bindStartEvent(),e)}return S(r,[{key:"_bindStartEvent",value:function(){var e=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),Hi[this._startKey].map(function(i){e["on".concat(i)]=e["on".concat(i)].bind(e)})}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var i=this;if(e){var n=Hi[this._startKey];n.map(function(s){window.addEventListener(s,i["on".concat(s)])}),this._boundPointerEvents=n}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map(function(i){window.removeEventListener(i,e["on".concat(i)])}),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame(function(){e.animate()}))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var i=e.changedTouches[0];this.dragStart(e,i),this.touchIdentifier=i.pointerId!==void 0?i.pointerId:i.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var i=Mt(e.changedTouches,this.touchIdentifier);i&&this.dragMove(e,i)}},{key:"ontouchend",value:function(e){var i=Mt(e.changedTouches,this.touchIdentifier);i&&this.dragEnd(e,i),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var i=Mt(e.changedTouches,this.touchIdentifier);i&&this.dragCancel(e,i)}},{key:"dragStart",value:function(e,i){if(!(!this._root||this.isDown||!this.isEnabled)){this.downPoint=i,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var n=Bi(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-n.height,this.startPos.maxX=window.innerWidth-n.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,i){this.isDragging=!0,this.animate(),this.emit(Nt.START,this.startPos)}},{key:"dragEnd",value:function(e,i){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(Nt.ENDED)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,i){var n={x:i.pageX-this.downPoint.pageX,y:i.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(n)&&this.dragRealStart(e,i),n}},{key:"dragMove",value:function(e,i){if(e=e||window.event,!!this.isDown){var n=this.startPos,s=n.x,l=n.y,u=this._dragPointerMove(e,i),c=u.x,h=u.y;c=this.checkContain("x",c,s),h=this.checkContain("y",h,l),this.position.x=s+c,this.position.y=l+h,this.dragPoint.x=c,this.dragPoint.y=h,this.emit(Nt.MOVE,this.position)}}},{key:"dragCancel",value:function(e,i){this.dragEnd(e,i)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,i,n){return i+n<0?0-n:e==="x"&&i+n>this.startPos.maxX?this.startPos.maxX-n:e==="y"&&i+n>this.startPos.maxY?this.startPos.maxY-n:i}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),i=this._getPositionCoord(e.left,"width"),n=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(i)?0:i,this.position.y=Number.isNaN(n)?0:n,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var i=e.transform;if(i.indexOf("matrix")===0){var n=i.split(","),s=i.indexOf("matrix3d")===0?12:4,l=parseInt(n[s],10),u=parseInt(n[s+1],10);this.position.x+=l,this.position.y+=u}}},{key:"_getPositionCoord",value:function(e,i){if(e.indexOf("%")!==-1){var n=Bi(this._root.parentNode);return n?parseFloat(e)/100*n[i]:0}return parseInt(e,10)}}]),r}(qt),Or=function(a){x(r,a);var o=P(r);function r(t){var e;E(this,r),e=o.call(this,t),_(m(e),"onCancelClick",function(s){e.exitMini(),e.isClose=!0}),_(m(e),"onCenterClick",function(s){var l=m(e),u=l.player;u.paused?u.play():u.pause()}),_(m(e),"onScroll",function(s){if(!(!window.scrollY&&window.scrollY!==0||Math.abs(window.scrollY-e.pos.scrollY)<50)){var l=parseInt(f.getCss(e.player.root,"height"));l+=e.config.scrollTop,e.pos.scrollY=window.scrollY,window.scrollY>l+5?!e.isMini&&!e.isClose&&e.getMini():window.scrollY<=l&&(e.isMini&&e.exitMini(),e.isClose=!1)}}),e.isMini=!1,e.isClose=!1;var i=m(e),n=i.config;return e.pos={left:n.left<0?window.innerWidth-n.width-20:n.left,top:n.top<0?window.innerHeight-n.height-20:n.top,height:e.config.height,width:e.config.width,scrollY:window.scrollY||0},e.lastStyle=null,e}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.mini=="boolean"&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(we,function(){e.setAttr("data-state","pause")}),this.on($,function(){e.setAttr("data-state","play")})}},{key:"onPluginsReady",value:function(){var e=this,i=this.player,n=this.config;if(!n.disable){if(this.config.isShowIcon){var s={config:{onClick:function(){e.getMini()}}};i.controls.registerPlugin(Mi,s,Mi.pluginName)}var l=f.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",l,this.onCancelClick),this.bind(".play-icon",l,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new Rr(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:Dt,class:"xg-icon-play"},pause:{icon:Rt,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e=this;if(!this.isMini){var i=this.player,n=this.playerConfig,s=this.config.target||this.player.root;this.lastStyle={},f.addClass(i.root,"xgplayer-mini"),["width","height","top","left"].map(function(l){e.lastStyle[l]=s.style[l],s.style[l]="".concat(e.pos[l],"px")}),n.fluid&&(s.style["padding-top"]=""),this.emit(Ke,!0),i.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var i=this.player,n=this.playerConfig,s=this.config.target||this.player.root;f.removeClass(i.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map(function(l){s.style[l]=e.lastStyle[l]}),this.lastStyle=null,n.fluid&&(i.root.style.width="100%",i.root.style.height="0",i.root.style["padding-top"]="".concat(n.height*100/n.width,"%")),this.emit(Ke,!1),this.isMini=i.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=f.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return`
30
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:10}}}]),r}(F);function Ni(a){var o=parseFloat(a),r=a.indexOf("%")===-1&&!Number.isNaN(o);return r&&o}var Rt=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],Fi=Rt.length;function Ar(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},o=0;o<Fi;o++){var r=Rt[o];a[r]=0}return a}function Lr(a){var o=window.getComputedStyle(a);return o}function Bi(a){if(typeof a=="string"&&(a=document.querySelector(a)),!(!a||W(a)!=="object"||!a.nodeType)){var o=Lr(a);if(o.display==="none")return Ar();var r={};r.width=a.offsetWidth,r.height=a.offsetHeight;for(var t=r.isBorderBox=o.boxSizing==="border-box",e=0;e<Fi;e++){var i=Rt[e],n=o[i],s=parseFloat(n);r[i]=Number.isNaN(s)?0:s}var l=r.paddingLeft+r.paddingRight,u=r.paddingTop+r.paddingBottom,c=r.marginLeft+r.marginRight,h=r.marginTop+r.marginBottom,d=r.borderLeftWidth+r.borderRightWidth,g=r.borderTopWidth+r.borderBottomWidth,v=t,y=Ni(o.width);y!==!1&&(r.width=y+(v?0:l+d));var C=Ni(o.height);return C!==!1&&(r.height=C+(v?0:u+g)),r.innerWidth=r.width-(l+d),r.innerHeight=r.height-(u+g),r.outerWidth=r.width+c,r.outerHeight=r.height+h,r}}function Ot(a,o){for(var r=0;r<a.length;r++){var t=a[r];if(t.identifier===o)return t}}var Mt={START:"dragStart",MOVE:"dragMove",ENDED:"dragEnded"},Hi={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},Dr=function(a){x(r,a);var o=P(r);function r(t){var e,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return E(this,r),e=o.call(this),e.isEnabled=!0,e.isDragging=!1,e.isDown=!1,e.position={},e.downPoint={},e.dragPoint={x:0,y:0},e.startPos={x:0,y:0},e._root=t instanceof Element?t:document.querySelector(t),e._handlerDom=i.handle instanceof Element?i.handle:document.querySelector(i.handle),!e._root||!e._handlerDom?ct(e):(e._bindStartEvent(),e)}return S(r,[{key:"_bindStartEvent",value:function(){var e=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),Hi[this._startKey].map(function(i){e["on".concat(i)]=e["on".concat(i)].bind(e)})}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var i=this;if(e){var n=Hi[this._startKey];n.map(function(s){window.addEventListener(s,i["on".concat(s)])}),this._boundPointerEvents=n}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map(function(i){window.removeEventListener(i,e["on".concat(i)])}),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame(function(){e.animate()}))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var i=e.changedTouches[0];this.dragStart(e,i),this.touchIdentifier=i.pointerId!==void 0?i.pointerId:i.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var i=Ot(e.changedTouches,this.touchIdentifier);i&&this.dragMove(e,i)}},{key:"ontouchend",value:function(e){var i=Ot(e.changedTouches,this.touchIdentifier);i&&this.dragEnd(e,i),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var i=Ot(e.changedTouches,this.touchIdentifier);i&&this.dragCancel(e,i)}},{key:"dragStart",value:function(e,i){if(!(!this._root||this.isDown||!this.isEnabled)){this.downPoint=i,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var n=Bi(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-n.height,this.startPos.maxX=window.innerWidth-n.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,i){this.isDragging=!0,this.animate(),this.emit(Mt.START,this.startPos)}},{key:"dragEnd",value:function(e,i){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(Mt.ENDED)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,i){var n={x:i.pageX-this.downPoint.pageX,y:i.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(n)&&this.dragRealStart(e,i),n}},{key:"dragMove",value:function(e,i){if(e=e||window.event,!!this.isDown){var n=this.startPos,s=n.x,l=n.y,u=this._dragPointerMove(e,i),c=u.x,h=u.y;c=this.checkContain("x",c,s),h=this.checkContain("y",h,l),this.position.x=s+c,this.position.y=l+h,this.dragPoint.x=c,this.dragPoint.y=h,this.emit(Mt.MOVE,this.position)}}},{key:"dragCancel",value:function(e,i){this.dragEnd(e,i)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,i,n){return i+n<0?0-n:e==="x"&&i+n>this.startPos.maxX?this.startPos.maxX-n:e==="y"&&i+n>this.startPos.maxY?this.startPos.maxY-n:i}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),i=this._getPositionCoord(e.left,"width"),n=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(i)?0:i,this.position.y=Number.isNaN(n)?0:n,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var i=e.transform;if(i.indexOf("matrix")===0){var n=i.split(","),s=i.indexOf("matrix3d")===0?12:4,l=parseInt(n[s],10),u=parseInt(n[s+1],10);this.position.x+=l,this.position.y+=u}}},{key:"_getPositionCoord",value:function(e,i){if(e.indexOf("%")!==-1){var n=Bi(this._root.parentNode);return n?parseFloat(e)/100*n[i]:0}return parseInt(e,10)}}]),r}(qt),Rr=function(a){x(r,a);var o=P(r);function r(t){var e;E(this,r),e=o.call(this,t),_(m(e),"onCancelClick",function(s){e.exitMini(),e.isClose=!0}),_(m(e),"onCenterClick",function(s){var l=m(e),u=l.player;u.paused?u.play():u.pause()}),_(m(e),"onScroll",function(s){if(!(!window.scrollY&&window.scrollY!==0||Math.abs(window.scrollY-e.pos.scrollY)<50)){var l=parseInt(f.getCss(e.player.root,"height"));l+=e.config.scrollTop,e.pos.scrollY=window.scrollY,window.scrollY>l+5?!e.isMini&&!e.isClose&&e.getMini():window.scrollY<=l&&(e.isMini&&e.exitMini(),e.isClose=!1)}}),e.isMini=!1,e.isClose=!1;var i=m(e),n=i.config;return e.pos={left:n.left<0?window.innerWidth-n.width-20:n.left,top:n.top<0?window.innerHeight-n.height-20:n.top,height:e.config.height,width:e.config.width,scrollY:window.scrollY||0},e.lastStyle=null,e}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.mini=="boolean"&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(we,function(){e.setAttr("data-state","pause")}),this.on($,function(){e.setAttr("data-state","play")})}},{key:"onPluginsReady",value:function(){var e=this,i=this.player,n=this.config;if(!n.disable){if(this.config.isShowIcon){var s={config:{onClick:function(){e.getMini()}}};i.controls.registerPlugin(Mi,s,Mi.pluginName)}var l=f.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",l,this.onCancelClick),this.bind(".play-icon",l,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new Dr(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:Lt,class:"xg-icon-play"},pause:{icon:Dt,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e=this;if(!this.isMini){var i=this.player,n=this.playerConfig,s=this.config.target||this.player.root;this.lastStyle={},f.addClass(i.root,"xgplayer-mini"),["width","height","top","left"].map(function(l){e.lastStyle[l]=s.style[l],s.style[l]="".concat(e.pos[l],"px")}),n.fluid&&(s.style["padding-top"]=""),this.emit(Ke,!0),i.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var i=this.player,n=this.playerConfig,s=this.config.target||this.player.root;f.removeClass(i.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map(function(l){s.style[l]=e.lastStyle[l]}),this.lastStyle=null,n.fluid&&(i.root.style.width="100%",i.root.style.height="0",i.root.style["padding-top"]="".concat(n.height*100/n.width,"%")),this.emit(Ke,!1),this.isMini=i.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=f.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return`
31
31
  <xg-mini-layer class="xg-mini-layer">
32
32
  <xg-mini-header class="xgplayer-mini-header">
33
33
  `.concat(pe(this,"MINI_DRAG",this.playerConfig.isHideTips),`
@@ -39,13 +39,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39
39
  </div>
40
40
  <div class="play-icon">
41
41
  </div>
42
- </xg-mini-layer>`)}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),r}(F),tt={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},Ft=["videoClick","videoDbClick"],Bt=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onMouseMove",function(s){var l=m(t),u=l.player,c=l.playerConfig;u.isActive||(u.focus({autoHide:!c.closeDelayBlur}),!c.closeFocusVideoFocus&&u.media.focus())}),_(m(t),"onMouseEnter",function(s){var l=m(t),u=l.playerConfig,c=l.player;!u.closeFocusVideoFocus&&c.media.focus(),u.closeDelayBlur?c.focus({autoHide:!1}):c.focus(),t.emit(ai)}),_(m(t),"onMouseLeave",function(s){var l=t.playerConfig,u=l.closePlayerBlur,c=l.leavePlayerTime,h=l.closeDelayBlur;!u&&!h&&(c?t.player.focus({autoHide:!0,delay:c}):t.player.blur({ignorePaused:!0})),t.emit(oi)}),_(m(t),"onVideoClick",function(s){var l=m(t),u=l.player,c=l.playerConfig;s.target&&c.closeVideoClick||(s.target===u.root||s.target===u.media||s.target===u.innerContainer||s.target===u.media.__canvas)&&(s.preventDefault(),c.closeVideoStopPropagation||s.stopPropagation(),t._clickCount++,t.clickTimer&&(clearTimeout(t.clickTimer),t.clickTimer=null),t.clickTimer=setTimeout(function(){t._clickCount&&(t._clickCount--,ue(m(t),Ft[0],function(h,d){t.switchPlayPause(d.e)},{e:s,paused:u.paused}),clearTimeout(t.clickTimer),t.clickTimer=null)},300))}),_(m(t),"onVideoDblClick",function(s){var l=m(t),u=l.player,c=l.playerConfig;if(!(c.closeVideoDblclick||!s.target||s.target!==u.media&&s.target!==u.media.__canvas)){if(!c.closeVideoClick&&t._clickCount<2){t._clickCount=0;return}t._clickCount=0,t.clickTimer&&(clearTimeout(t.clickTimer),t.clickTimer=null),s.preventDefault(),s.stopPropagation(),ue(m(t),Ft[1],function(h,d){t.emitUserAction(d.e,"switch_fullscreen",{props:"fullscreen",from:u.fullscreen,to:!u.fullscreen}),u.fullscreen?u.exitFullscreen():u.getFullscreen()},{e:s,fullscreen:u.fullscreen})}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,Ft.map(function(n){e.__hooks[n]=null});var i=this.playerConfig.isMobileSimulateMode;i==="mobile"||D.device==="mobile"&&!D.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,i=this.player,n=i.media,s=i.root,l=this.playerConfig.enableContextmenu;s&&s.addEventListener("click",this.onVideoClick,!1),s&&s.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(tt).map(function(u){s.addEventListener(u,e[tt[u]],!1)}),!l&&n&&n.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var i=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:i.paused,to:!i.paused}),i.ended?i.duration!==1/0&&i.duration>0&&i.replay():i.paused?i.play():i.pause()}},{key:"onContextmenu",value:function(e){e=e||window.event,e.preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,i=this.player,n=i.video,s=i.root;this.clickTimer&&clearTimeout(this.clickTimer),s.removeEventListener("click",this.onVideoClick,!1),s.removeEventListener("dblclick",this.onVideoDblClick,!1),n.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(tt).map(function(l){s.removeEventListener(l,e[tt[l]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(he),ve={PRESS:"press",PRESS_END:"pressend",DOUBlE_CLICK:"doubleclick",CLICK:"click",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend"},Mr={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},Nr={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function Ui(a){return a&&a.length>0?a[a.length-1]:null}function Fr(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var Br=function(){function a(o){var r=this,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{eventType:"touch"};E(this,a),_(this,"onTouchStart",function(e){var i=r._pos,n=r.root,s=Ui(e.touches);i.x=s?parseInt(s.pageX,10):e.pageX,i.y=s?parseInt(s.pageX,10):e.pageX,i.start=!0,r.__setPress(e),n.addEventListener(r.events.end,r.onTouchEnd),n.addEventListener(r.events.cancel,r.onTouchCancel),n.addEventListener(r.events.move,r.onTouchMove),r.trigger(ve.TOUCH_START,e)}),_(this,"onTouchCancel",function(e){r.onTouchEnd(e)}),_(this,"onTouchEnd",function(e){var i=r._pos,n=r.root;r.__clearPress(),n.removeEventListener(r.events.cancel,r.onTouchCancel),n.removeEventListener(r.events.end,r.onTouchEnd),n.removeEventListener(r.events.move,r.onTouchMove),e.moving=i.moving,e.press=i.press,i.press&&r.trigger(ve.PRESS_END,e),r.trigger(ve.TOUCH_END,e),!i.press&&!i.moving&&r.__setDb(e),i.press=!1,i.start=!1,i.moving=!1}),_(this,"onTouchMove",function(e){var i=r._pos,n=r.config,s=Ui(e.touches),l=s?parseInt(s.pageX,10):e.pageX,u=s?parseInt(s.pageY,10):e.pageX,c=l-i.x,h=u-i.y;Math.abs(h)<n.miniStep&&Math.abs(c)<n.miniStep||(r.__clearPress(),i.press&&r.trigger(ve.PRESS_END,e),i.press=!1,i.moving=!0,r.trigger(ve.TOUCH_MOVE,e))}),this._pos={moving:!1,start:!1,x:0,y:0},this.config=Fr(),Object.keys(t).map(function(e){r.config[e]=t[e]}),this.root=o,this.events=t.eventType==="mouse"?Nr:Mr,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return S(a,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(r){var t=this,e=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout(function(){t.trigger(ve.PRESS,r),t._pos.press=!0,t.__clearPress()},e.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(r){var t=this,e=this.config;if(this.dbIntrvalId){this.__clearDb(),this.trigger(ve.DOUBlE_CLICK,r);return}this.dbIntrvalId=setTimeout(function(){t.__clearDb(),!t._pos.start&&!t._pos.press&&!t._pos.moving&&t.trigger(ve.CLICK,r)},e.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(r,t){this.__handlers[r]||(this.__handlers[r]=[]),this.__handlers[r].push(t)}},{key:"off",value:function(r,t){if(this.__handlers[r]){for(var e=this.__handlers[r],i=-1,n=0;n<e.length;n++)if(e[n]===t){i=n;break}i>=0&&this.__handlers[r].splice(i,1)}}},{key:"trigger",value:function(r,t){this.__handlers[r]&&this.__handlers[r].map(function(e){try{e(t)}catch(i){console.error("trigger>>:".concat(r),i)}})}},{key:"destroy",value:function(){var r=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).forEach(function(e){r.root.removeEventListener(e,r[t[e]])})}}]),a}();function Hr(){return new DOMParser().parseFromString(`<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"
42
+ </xg-mini-layer>`)}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),r}(F),tt={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},Nt=["videoClick","videoDbClick"],Ft=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onMouseMove",function(s){var l=m(t),u=l.player,c=l.playerConfig;u.isActive||(u.focus({autoHide:!c.closeDelayBlur}),!c.closeFocusVideoFocus&&u.media.focus())}),_(m(t),"onMouseEnter",function(s){var l=m(t),u=l.playerConfig,c=l.player;!u.closeFocusVideoFocus&&c.media.focus(),u.closeDelayBlur?c.focus({autoHide:!1}):c.focus(),t.emit(ai)}),_(m(t),"onMouseLeave",function(s){var l=t.playerConfig,u=l.closePlayerBlur,c=l.leavePlayerTime,h=l.closeDelayBlur;!u&&!h&&(c?t.player.focus({autoHide:!0,delay:c}):t.player.blur({ignorePaused:!0})),t.emit(oi)}),_(m(t),"onVideoClick",function(s){var l=m(t),u=l.player,c=l.playerConfig;s.target&&c.closeVideoClick||(s.target===u.root||s.target===u.media||s.target===u.innerContainer||s.target===u.media.__canvas)&&(s.preventDefault(),c.closeVideoStopPropagation||s.stopPropagation(),t._clickCount++,t.clickTimer&&(clearTimeout(t.clickTimer),t.clickTimer=null),t.clickTimer=setTimeout(function(){t._clickCount&&(t._clickCount--,ue(m(t),Nt[0],function(h,d){t.switchPlayPause(d.e)},{e:s,paused:u.paused}),clearTimeout(t.clickTimer),t.clickTimer=null)},300))}),_(m(t),"onVideoDblClick",function(s){var l=m(t),u=l.player,c=l.playerConfig;if(!(c.closeVideoDblclick||!s.target||s.target!==u.media&&s.target!==u.media.__canvas)){if(!c.closeVideoClick&&t._clickCount<2){t._clickCount=0;return}t._clickCount=0,t.clickTimer&&(clearTimeout(t.clickTimer),t.clickTimer=null),s.preventDefault(),s.stopPropagation(),ue(m(t),Nt[1],function(h,d){t.emitUserAction(d.e,"switch_fullscreen",{props:"fullscreen",from:u.fullscreen,to:!u.fullscreen}),u.fullscreen?u.exitFullscreen():u.getFullscreen()},{e:s,fullscreen:u.fullscreen})}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,Nt.map(function(n){e.__hooks[n]=null});var i=this.playerConfig.isMobileSimulateMode;i==="mobile"||D.device==="mobile"&&!D.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,i=this.player,n=i.media,s=i.root,l=this.playerConfig.enableContextmenu;s&&s.addEventListener("click",this.onVideoClick,!1),s&&s.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(tt).map(function(u){s.addEventListener(u,e[tt[u]],!1)}),!l&&n&&n.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var i=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:i.paused,to:!i.paused}),i.ended?i.duration!==1/0&&i.duration>0&&i.replay():i.paused?i.play():i.pause()}},{key:"onContextmenu",value:function(e){e=e||window.event,e.preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,i=this.player,n=i.video,s=i.root;this.clickTimer&&clearTimeout(this.clickTimer),s.removeEventListener("click",this.onVideoClick,!1),s.removeEventListener("dblclick",this.onVideoDblClick,!1),n.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(tt).map(function(l){s.removeEventListener(l,e[tt[l]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(he),ve={PRESS:"press",PRESS_END:"pressend",DOUBlE_CLICK:"doubleclick",CLICK:"click",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend"},Or={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},Mr={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function Ui(a){return a&&a.length>0?a[a.length-1]:null}function Nr(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var Fr=function(){function a(o){var r=this,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{eventType:"touch"};E(this,a),_(this,"onTouchStart",function(e){var i=r._pos,n=r.root,s=Ui(e.touches);i.x=s?parseInt(s.pageX,10):e.pageX,i.y=s?parseInt(s.pageX,10):e.pageX,i.start=!0,r.__setPress(e),n.addEventListener(r.events.end,r.onTouchEnd),n.addEventListener(r.events.cancel,r.onTouchCancel),n.addEventListener(r.events.move,r.onTouchMove),r.trigger(ve.TOUCH_START,e)}),_(this,"onTouchCancel",function(e){r.onTouchEnd(e)}),_(this,"onTouchEnd",function(e){var i=r._pos,n=r.root;r.__clearPress(),n.removeEventListener(r.events.cancel,r.onTouchCancel),n.removeEventListener(r.events.end,r.onTouchEnd),n.removeEventListener(r.events.move,r.onTouchMove),e.moving=i.moving,e.press=i.press,i.press&&r.trigger(ve.PRESS_END,e),r.trigger(ve.TOUCH_END,e),!i.press&&!i.moving&&r.__setDb(e),i.press=!1,i.start=!1,i.moving=!1}),_(this,"onTouchMove",function(e){var i=r._pos,n=r.config,s=Ui(e.touches),l=s?parseInt(s.pageX,10):e.pageX,u=s?parseInt(s.pageY,10):e.pageX,c=l-i.x,h=u-i.y;Math.abs(h)<n.miniStep&&Math.abs(c)<n.miniStep||(r.__clearPress(),i.press&&r.trigger(ve.PRESS_END,e),i.press=!1,i.moving=!0,r.trigger(ve.TOUCH_MOVE,e))}),this._pos={moving:!1,start:!1,x:0,y:0},this.config=Nr(),Object.keys(t).map(function(e){r.config[e]=t[e]}),this.root=o,this.events=t.eventType==="mouse"?Mr:Or,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return S(a,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(r){var t=this,e=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout(function(){t.trigger(ve.PRESS,r),t._pos.press=!0,t.__clearPress()},e.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(r){var t=this,e=this.config;if(this.dbIntrvalId){this.__clearDb(),this.trigger(ve.DOUBlE_CLICK,r);return}this.dbIntrvalId=setTimeout(function(){t.__clearDb(),!t._pos.start&&!t._pos.press&&!t._pos.moving&&t.trigger(ve.CLICK,r)},e.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(r,t){this.__handlers[r]||(this.__handlers[r]=[]),this.__handlers[r].push(t)}},{key:"off",value:function(r,t){if(this.__handlers[r]){for(var e=this.__handlers[r],i=-1,n=0;n<e.length;n++)if(e[n]===t){i=n;break}i>=0&&this.__handlers[r].splice(i,1)}}},{key:"trigger",value:function(r,t){this.__handlers[r]&&this.__handlers[r].map(function(e){try{e(t)}catch(i){console.error("trigger>>:".concat(r),i)}})}},{key:"destroy",value:function(){var r=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).forEach(function(e){r.root.removeEventListener(e,r[t[e]])})}}]),a}();function Br(){return new DOMParser().parseFromString(`<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"
43
43
  xmlns:xlink="http://www.w3.org/1999/xlink">
44
44
  <path opacity="0.54"
45
45
  d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"
46
46
  fill="white" />
47
47
  <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>
48
- </svg>`,"image/svg+xml").firstChild}var xe={AUTO:"auto",SEEKING:"seeking",PLAYBACK:"playbackrate",LIGHT:""},Ht=["videoClick","videoDbClick"],Ur=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onTouchStart",function(i){var n=m(e),s=n.player,l=n.config,u=n.pos,c=n.playerConfig,h=e.getTouche(i);if(h&&!l.disableGesture&&e.duration>0&&!s.ended){u.isStart=!0,e.timer&&clearTimeout(e.timer),f.checkIsFunction(c.disableSwipeHandler)&&c.disableSwipeHandler(),e.find(".xg-dur").innerHTML=f.format(e.duration);var d=e.root.getBoundingClientRect();s.rotateDeg===90?(u.top=d.left,u.left=d.top,u.width=d.height,u.height=d.width):(u.top=d.top,u.left=d.left,u.width=d.width,u.height=d.height);var g=parseInt(h.pageX-u.left,10),v=parseInt(h.pageY-u.top,10);u.x=s.rotateDeg===90?v:g,u.y=s.rotateDeg===90?g:v,u.scopeL=l.scopeL*u.width,u.scopeR=(1-l.scopeR)*u.width,u.scopeM1=u.width*(1-l.scopeM)/2,u.scopeM2=u.width-u.scopeM1}}),_(m(e),"onTouchMove",function(i){var n=e.getTouche(i),s=m(e),l=s.pos,u=s.config,c=s.player;if(!(!n||u.disableGesture||!e.duration||!l.isStart)){var h=u.miniMoveStep,d=u.hideControlsActive,g=parseInt(n.pageX-l.left,10),v=parseInt(n.pageY-l.top,10),y=c.rotateDeg===90?v:g,C=c.rotateDeg===90?g:v;if(Math.abs(y-l.x)>h||Math.abs(C-l.y)>h){var b=y-l.x,w=C-l.y,T=l.scope;if(T===-1&&(T=e.checkScope(y,C,b,w,l),T===0&&(d?c.blur():c.focus({autoHide:!1}),!l.time&&(l.time=parseInt(c.currentTime*1e3,10)+e.timeOffset*1e3)),l.scope=T),T===-1||T>0&&!u.gestureY||T===0&&!u.gestureX)return;e.executeMove(b,w,T,l.width,l.height),l.x=y,l.y=C}}}),_(m(e),"onTouchEnd",function(i){var n=m(e),s=n.player,l=n.pos,u=n.playerConfig;if(setTimeout(function(){s.getPlugin("progress")&&s.getPlugin("progress").resetSeekState()},10),!!l.isStart){l.scope>-1&&i.cancelable&&i.preventDefault();var c=e.config,h=c.disableGesture,d=c.gestureX;!h&&d?e.endLastMove(l.scope):l.time=0,l.scope=-1,e.resetPos(),f.checkIsFunction(u.enableSwipeHandler)&&u.enableSwipeHandler(),e.changeAction(xe.AUTO)}}),_(m(e),"onRootTouchMove",function(i){e.config.disableGesture||!e.config.gestureX||e.checkIsRootTarget(i)&&(i.stopPropagation(),e.pos.isStart?e.onTouchMove(i):e.onTouchStart(i))}),_(m(e),"onRootTouchEnd",function(i){e.pos.scope>-1&&e.onTouchEnd(i)}),e.pos={isStart:!1,x:0,y:0,time:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1},e.timer=null,e}return S(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"registerIcons",value:function(){return{seekTipIcon:{icon:Hr,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this;Ht.map(function(d){e.__hooks[d]=null});var i=this.playerConfig,n=this.config,s=this.player;i.closeVideoDblclick===!0&&(n.closedbClick=!0),this.resetPos(),f.isUndefined(i.disableGesture)||(n.disableGesture=!!i.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=f.createDom("xg-mask","",{},"xgmask"),s.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var l=this.domEventType==="mouse"?"mouse":"touch";this.touch=new Br(this.root,{eventType:l,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(d){d.preventDefault()}),s.root.addEventListener("touchmove",this.onRootTouchMove,!0),s.root.addEventListener("touchend",this.onRootTouchEnd,!0),s.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var u=this.player.controls;u&&u.center&&(u.center.addEventListener("touchmove",this.onRootTouchMove,!0),u.center.addEventListener("touchend",this.onRootTouchEnd,!0),u.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(ce,function(){var d=e.player,g=e.config;d.duration*1e3<g.moveDuration&&(g.moveDuration=d.duration*1e3)}),this.on([oe,me],function(){var d=e.pos,g=d.time,v=d.isStart;!v&&g>0&&(e.pos.time=0)});var c={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(c).map(function(d){e.touch.on(d,function(g){e[c[d]](g)})}),!n.disableActive){var h=s.plugins.progress;h&&(h.addCallBack("dragmove",function(d){e.activeSeekNote(d.currentTime,d.forward)}),["dragend","click"].forEach(function(d){h.addCallBack(d,function(){e.changeAction(xe.AUTO)})}))}}},{key:"registerThumbnail",value:function(){var e=this.player,i=e.plugins.thumbnail;if(i&&i.usable){this.thumbnail=i.createThumbnail(null,"mobile-thumbnail");var n=this.find(".time-preview");n.insertBefore(this.thumbnail,n.children[0])}}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,n=i.playedColor,s=i.progressColor,l=i.timePreviewStyle,u=i.curTimeColor,c=i.durationColor;if(n&&(this.find(".xg-curbar").style.backgroundColor=n),s&&(this.find(".xg-bar").style.backgroundColor=s),l){var h=this.find(".time-preview");Object.keys(l).forEach(function(v){h.style[v]=l[v]})}var d=u||n,g=c;d&&(this.find(".xg-cur").style.color=d),g&&(this.find(".xg-dur").style.color=g),this.config.disableTimeProgress&&f.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map(function(i){e.pos[i]=0})):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var i=this.player,n=this.root;n.setAttribute("data-xg-action",e);var s=i.plugins.start;s&&s.recover()}},{key:"getTouche",value:function(e){var i=this.player.rotateDeg,n=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return i===0?{pageX:n.pageX,pageY:n.pageY}:{pageX:n.pageX,pageY:n.pageY}}},{key:"checkScope",value:function(e,i,n,s,l){var u=l.width,c=-1;if(e<0||e>u)return c;var h=Math.abs(s===0?n:n/s);return Math.abs(n)>0&&h>=1.73&&e>l.scopeM1&&e<l.scopeM2?c=0:(Math.abs(n)===0||h<=.57)&&(c=e<l.scopeL?1:e>l.scopeR?2:3),c}},{key:"executeMove",value:function(e,i,n,s,l){switch(n){case 0:this.updateTime(e/s*this.config.scopeM);break;case 1:this.updateBrightness(i/l);break;case 2:D.os.isIos||this.updateVolume(i/l);break}}},{key:"endLastMove",value:function(e){var i=this,n=this.pos,s=this.player,l=this.config,u=(n.time-this.timeOffset)/1e3;switch(e){case 0:s.seek(Number(u).toFixed(1)),l.hideControlsEnd?s.blur():s.focus(),this.timer=setTimeout(function(){i.pos.time=0},500);break}this.changeAction(xe.AUTO)}},{key:"checkIsRootTarget",value:function(e){var i=this.player.plugins||{};return i.progress&&i.progress.root.contains(e.target)?!1:i.start&&i.start.root.contains(e.target)||i.controls&&i.controls.root.contains(e.target)}},{key:"sendUseAction",value:function(e){var i=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i,to:!i})}},{key:"clickHandler",value:function(e){var i=this.player,n=this.config,s=this.playerConfig;if(i.state<M.RUNNING){s.closeVideoClick||(this.sendUseAction(f.createEvent("click")),i.play());return}!n.closedbClick||s.closeVideoClick?i.isActive?i.blur():i.focus():s.closeVideoClick||((i.isActive||n.focusVideoClick)&&(this.sendUseAction(f.createEvent("click")),this.switchPlayPause()),i.focus())}},{key:"dbClickHandler",value:function(e){var i=this.config,n=this.player;!i.closedbClick&&n.state>=M.RUNNING&&(this.sendUseAction(f.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var i=this,n=this.player;ue(this,Ht[0],function(s,l){i.clickHandler(l.e)},{e,paused:n.paused})}},{key:"onDbClick",value:function(e){var i=this,n=this.player;ue(this,Ht[1],function(s,l){i.dbClickHandler(l.e)},{e,paused:n.paused})}},{key:"onPress",value:function(e){var i=this.pos,n=this.config,s=this.player;n.disablePress||(i.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:s.playbackRate,to:n.pressRate}),s.playbackRate=n.pressRate,this.changeAction(xe.PLAYBACK))}},{key:"onPressEnd",value:function(e){var i=this.pos,n=this.config,s=this.player;n.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:s.playbackRate,to:i.rate}),s.playbackRate=i.rate,i.rate=1,this.changeAction(xe.AUTO))}},{key:"updateTime",value:function(e){var i=this.player,n=this.config,s=this.player.duration;e=Number(e.toFixed(4));var l=parseInt(e*n.moveDuration,10)+this.timeOffset;l+=this.pos.time,l=l<0?0:l>s*1e3?s*1e3-200:l,i.getPlugin("time")&&i.getPlugin("time").updateTime(l/1e3),i.getPlugin("progress")&&i.getPlugin("progress").updatePercent(l/1e3/this.duration,!0),this.activeSeekNote(l/1e3,e>0),n.isTouchingSeek&&i.seek(Number((l-this.timeOffset)/1e3).toFixed(1)),this.pos.time=l}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var i=this.player,n=this.pos;if(e=parseInt(e*100,10),n.volume+=e,!(Math.abs(n.volume)<10)){var s=parseInt(i.volume*10,10)-parseInt(n.volume/10,10);s=s>10?10:s<1?0:s,i.volume=s/10,n.volume=0}}},{key:"updateBrightness",value:function(e){this.player.rotateDeg&&(e=-e);var i=this.pos,n=this.config,s=this.xgMask,l=i.light+.8*e;l=l>n.maxDarkness?n.maxDarkness:l<0?0:l,s&&(s.style.backgroundColor="rgba(0,0,0,".concat(l,")")),i.light=l}},{key:"activeSeekNote",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.player,s=this.config,l=!(this.duration!==1/0&&this.duration>0);if(!(!e||typeof e!="number"||l||s.disableActive)){e<0?e=0:e>n.duration&&(e=n.duration-.2),this.changeAction(xe.SEEKING);var u=n.plugins.start;u&&u.focusHide(),this.find(".xg-dur").innerHTML=f.format(this.duration),this.find(".xg-cur").innerHTML=f.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),i?f.removeClass(this.find(".xg-seek-show"),"xg-back"):f.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var i=this.player,n=i.plugins.thumbnail;n&&n.usable&&this.thumbnail&&n.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<M.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!1}},{key:"enableGesture",value:function(){this.config.disableGesture=!0}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var i=this.player.controls;i&&i.center&&(i.center.removeEventListener("touchmove",this.onRootTouchMove,!0),i.center.removeEventListener("touchend",this.onRootTouchEnd,!0),i.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e=this.config.gradient!=="normal"?"gradient ".concat(this.config.gradient):"gradient";return`
48
+ </svg>`,"image/svg+xml").firstChild}var xe={AUTO:"auto",SEEKING:"seeking",PLAYBACK:"playbackrate",LIGHT:""},Bt=["videoClick","videoDbClick"],Hr=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onTouchStart",function(i){var n=m(e),s=n.player,l=n.config,u=n.pos,c=n.playerConfig,h=e.getTouche(i);if(h&&!l.disableGesture&&e.duration>0&&!s.ended){u.isStart=!0,e.timer&&clearTimeout(e.timer),f.checkIsFunction(c.disableSwipeHandler)&&c.disableSwipeHandler(),e.find(".xg-dur").innerHTML=f.format(e.duration);var d=e.root.getBoundingClientRect();s.rotateDeg===90?(u.top=d.left,u.left=d.top,u.width=d.height,u.height=d.width):(u.top=d.top,u.left=d.left,u.width=d.width,u.height=d.height);var g=parseInt(h.pageX-u.left,10),v=parseInt(h.pageY-u.top,10);u.x=s.rotateDeg===90?v:g,u.y=s.rotateDeg===90?g:v,u.scopeL=l.scopeL*u.width,u.scopeR=(1-l.scopeR)*u.width,u.scopeM1=u.width*(1-l.scopeM)/2,u.scopeM2=u.width-u.scopeM1}}),_(m(e),"onTouchMove",function(i){var n=e.getTouche(i),s=m(e),l=s.pos,u=s.config,c=s.player;if(!(!n||u.disableGesture||!e.duration||!l.isStart)){var h=u.miniMoveStep,d=u.hideControlsActive,g=parseInt(n.pageX-l.left,10),v=parseInt(n.pageY-l.top,10),y=c.rotateDeg===90?v:g,C=c.rotateDeg===90?g:v;if(Math.abs(y-l.x)>h||Math.abs(C-l.y)>h){var b=y-l.x,w=C-l.y,T=l.scope;if(T===-1&&(T=e.checkScope(y,C,b,w,l),T===0&&(d?c.blur():c.focus({autoHide:!1}),!l.time&&(l.time=parseInt(c.currentTime*1e3,10)+e.timeOffset*1e3)),l.scope=T),T===-1||T>0&&!u.gestureY||T===0&&!u.gestureX)return;e.executeMove(b,w,T,l.width,l.height),l.x=y,l.y=C}}}),_(m(e),"onTouchEnd",function(i){var n=m(e),s=n.player,l=n.pos,u=n.playerConfig;if(setTimeout(function(){s.getPlugin("progress")&&s.getPlugin("progress").resetSeekState()},10),!!l.isStart){l.scope>-1&&i.cancelable&&i.preventDefault();var c=e.config,h=c.disableGesture,d=c.gestureX;!h&&d?e.endLastMove(l.scope):l.time=0,l.scope=-1,e.resetPos(),f.checkIsFunction(u.enableSwipeHandler)&&u.enableSwipeHandler(),e.changeAction(xe.AUTO)}}),_(m(e),"onRootTouchMove",function(i){e.config.disableGesture||!e.config.gestureX||e.checkIsRootTarget(i)&&(i.stopPropagation(),e.pos.isStart?e.onTouchMove(i):e.onTouchStart(i))}),_(m(e),"onRootTouchEnd",function(i){e.pos.scope>-1&&e.onTouchEnd(i)}),e.pos={isStart:!1,x:0,y:0,time:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1},e.timer=null,e}return S(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"registerIcons",value:function(){return{seekTipIcon:{icon:Br,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this;Bt.map(function(d){e.__hooks[d]=null});var i=this.playerConfig,n=this.config,s=this.player;i.closeVideoDblclick===!0&&(n.closedbClick=!0),this.resetPos(),f.isUndefined(i.disableGesture)||(n.disableGesture=!!i.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=f.createDom("xg-mask","",{},"xgmask"),s.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var l=this.domEventType==="mouse"?"mouse":"touch";this.touch=new Fr(this.root,{eventType:l,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(d){d.preventDefault()}),s.root.addEventListener("touchmove",this.onRootTouchMove,!0),s.root.addEventListener("touchend",this.onRootTouchEnd,!0),s.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var u=this.player.controls;u&&u.center&&(u.center.addEventListener("touchmove",this.onRootTouchMove,!0),u.center.addEventListener("touchend",this.onRootTouchEnd,!0),u.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(ce,function(){var d=e.player,g=e.config;d.duration*1e3<g.moveDuration&&(g.moveDuration=d.duration*1e3)}),this.on([oe,me],function(){var d=e.pos,g=d.time,v=d.isStart;!v&&g>0&&(e.pos.time=0)});var c={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(c).map(function(d){e.touch.on(d,function(g){e[c[d]](g)})}),!n.disableActive){var h=s.plugins.progress;h&&(h.addCallBack("dragmove",function(d){e.activeSeekNote(d.currentTime,d.forward)}),["dragend","click"].forEach(function(d){h.addCallBack(d,function(){e.changeAction(xe.AUTO)})}))}}},{key:"registerThumbnail",value:function(){var e=this.player,i=e.plugins.thumbnail;if(i&&i.usable){this.thumbnail=i.createThumbnail(null,"mobile-thumbnail");var n=this.find(".time-preview");n.insertBefore(this.thumbnail,n.children[0])}}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,n=i.playedColor,s=i.progressColor,l=i.timePreviewStyle,u=i.curTimeColor,c=i.durationColor;if(n&&(this.find(".xg-curbar").style.backgroundColor=n),s&&(this.find(".xg-bar").style.backgroundColor=s),l){var h=this.find(".time-preview");Object.keys(l).forEach(function(v){h.style[v]=l[v]})}var d=u||n,g=c;d&&(this.find(".xg-cur").style.color=d),g&&(this.find(".xg-dur").style.color=g),this.config.disableTimeProgress&&f.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map(function(i){e.pos[i]=0})):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var i=this.player,n=this.root;n.setAttribute("data-xg-action",e);var s=i.plugins.start;s&&s.recover()}},{key:"getTouche",value:function(e){var i=this.player.rotateDeg,n=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return i===0?{pageX:n.pageX,pageY:n.pageY}:{pageX:n.pageX,pageY:n.pageY}}},{key:"checkScope",value:function(e,i,n,s,l){var u=l.width,c=-1;if(e<0||e>u)return c;var h=Math.abs(s===0?n:n/s);return Math.abs(n)>0&&h>=1.73&&e>l.scopeM1&&e<l.scopeM2?c=0:(Math.abs(n)===0||h<=.57)&&(c=e<l.scopeL?1:e>l.scopeR?2:3),c}},{key:"executeMove",value:function(e,i,n,s,l){switch(n){case 0:this.updateTime(e/s*this.config.scopeM);break;case 1:this.updateBrightness(i/l);break;case 2:D.os.isIos||this.updateVolume(i/l);break}}},{key:"endLastMove",value:function(e){var i=this,n=this.pos,s=this.player,l=this.config,u=(n.time-this.timeOffset)/1e3;switch(e){case 0:s.seek(Number(u).toFixed(1)),l.hideControlsEnd?s.blur():s.focus(),this.timer=setTimeout(function(){i.pos.time=0},500);break}this.changeAction(xe.AUTO)}},{key:"checkIsRootTarget",value:function(e){var i=this.player.plugins||{};return i.progress&&i.progress.root.contains(e.target)?!1:i.start&&i.start.root.contains(e.target)||i.controls&&i.controls.root.contains(e.target)}},{key:"sendUseAction",value:function(e){var i=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i,to:!i})}},{key:"clickHandler",value:function(e){var i=this.player,n=this.config,s=this.playerConfig;if(i.state<M.RUNNING){s.closeVideoClick||(this.sendUseAction(f.createEvent("click")),i.play());return}!n.closedbClick||s.closeVideoClick?i.isActive?i.blur():i.focus():s.closeVideoClick||((i.isActive||n.focusVideoClick)&&(this.sendUseAction(f.createEvent("click")),this.switchPlayPause()),i.focus())}},{key:"dbClickHandler",value:function(e){var i=this.config,n=this.player;!i.closedbClick&&n.state>=M.RUNNING&&(this.sendUseAction(f.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var i=this,n=this.player;ue(this,Bt[0],function(s,l){i.clickHandler(l.e)},{e,paused:n.paused})}},{key:"onDbClick",value:function(e){var i=this,n=this.player;ue(this,Bt[1],function(s,l){i.dbClickHandler(l.e)},{e,paused:n.paused})}},{key:"onPress",value:function(e){var i=this.pos,n=this.config,s=this.player;n.disablePress||(i.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:s.playbackRate,to:n.pressRate}),s.playbackRate=n.pressRate,this.changeAction(xe.PLAYBACK))}},{key:"onPressEnd",value:function(e){var i=this.pos,n=this.config,s=this.player;n.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:s.playbackRate,to:i.rate}),s.playbackRate=i.rate,i.rate=1,this.changeAction(xe.AUTO))}},{key:"updateTime",value:function(e){var i=this.player,n=this.config,s=this.player.duration;e=Number(e.toFixed(4));var l=parseInt(e*n.moveDuration,10)+this.timeOffset;l+=this.pos.time,l=l<0?0:l>s*1e3?s*1e3-200:l,i.getPlugin("time")&&i.getPlugin("time").updateTime(l/1e3),i.getPlugin("progress")&&i.getPlugin("progress").updatePercent(l/1e3/this.duration,!0),this.activeSeekNote(l/1e3,e>0),n.isTouchingSeek&&i.seek(Number((l-this.timeOffset)/1e3).toFixed(1)),this.pos.time=l}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var i=this.player,n=this.pos;if(e=parseInt(e*100,10),n.volume+=e,!(Math.abs(n.volume)<10)){var s=parseInt(i.volume*10,10)-parseInt(n.volume/10,10);s=s>10?10:s<1?0:s,i.volume=s/10,n.volume=0}}},{key:"updateBrightness",value:function(e){this.player.rotateDeg&&(e=-e);var i=this.pos,n=this.config,s=this.xgMask,l=i.light+.8*e;l=l>n.maxDarkness?n.maxDarkness:l<0?0:l,s&&(s.style.backgroundColor="rgba(0,0,0,".concat(l,")")),i.light=l}},{key:"activeSeekNote",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.player,s=this.config,l=!(this.duration!==1/0&&this.duration>0);if(!(!e||typeof e!="number"||l||s.disableActive)){e<0?e=0:e>n.duration&&(e=n.duration-.2),this.changeAction(xe.SEEKING);var u=n.plugins.start;u&&u.focusHide(),this.find(".xg-dur").innerHTML=f.format(this.duration),this.find(".xg-cur").innerHTML=f.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),i?f.removeClass(this.find(".xg-seek-show"),"xg-back"):f.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var i=this.player,n=i.plugins.thumbnail;n&&n.usable&&this.thumbnail&&n.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<M.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!1}},{key:"enableGesture",value:function(){this.config.disableGesture=!0}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var i=this.player.controls;i&&i.center&&(i.center.removeEventListener("touchmove",this.onRootTouchMove,!0),i.center.removeEventListener("touchend",this.onRootTouchEnd,!0),i.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e=this.config.gradient!=="normal"?"gradient ".concat(this.config.gradient):"gradient";return`
49
49
  <xg-trigger class="trigger">
50
50
  <div class="`.concat(e,`"></div>
51
51
  <div class="time-preview">
@@ -63,55 +63,55 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
63
63
  <span><i>`).concat(this.config.pressRate,"X</i>").concat(this.i18n.FORWARD,`</span>
64
64
  </div>
65
65
  </xg-trigger>
66
- `)}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:60*6*1e3,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),r}(F);function Vr(a){a.preventDefault(),a.returnValue=!1}function Vi(a){var o=a.tagName;return!!(o==="INPUT"||o==="TEXTAREA"||a.isContentEditable)}var zi=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onBodyKeyDown",function(s){if(t.player){var l=s||window.event,u=l.keyCode,c=m(t),h=c._keyState,d=c.player,g=t.config,v=g.disable,y=g.disableBodyTrigger,C=g.isIgnoreUserActive;if(v||y||!(d.isUserActive||C)||Vi(l.target)||!t.checkIsVisible()||l.metaKey||l.altKey||l.ctrlKey){h.isBodyKeyDown=!1;return}!s.repeat&&!h.isKeyDown&&((l.target===document.body||t.config.isGlobalTrigger&&!Vi(l.target))&&t.checkCode(u,!0)&&(h.isBodyKeyDown=!0),document.addEventListener("keyup",t.onBodyKeyUp)),h.isBodyKeyDown&&t.handleKeyDown(l)}}),_(m(t),"onBodyKeyUp",function(s){t.player&&(document.removeEventListener("keyup",t.onBodyKeyUp),t.handleKeyUp(s))}),_(m(t),"onKeydown",function(s){if(t.player){var l=s||window.event,u=m(t),c=u._keyState;if(!l.repeat){if(t.config.disable||t.config.disableRootTrigger||l.metaKey||l.altKey||l.ctrlKey)return;l&&(l.keyCode===37||t.checkCode(l.keyCode))&&(l.target===t.player.root||l.target===t.player.video||l.target===t.player.controls.el)&&(c.isKeyDown=!0),t.player.root.addEventListener("keyup",t.onKeyup)}c.isKeyDown&&t.handleKeyDown(l)}}),_(m(t),"onKeyup",function(s){t.player&&(t.player.root.removeEventListener("keyup",t.onKeyup),t.handleKeyUp(s))}),t}return S(r,[{key:"mergekeyCodeMap",value:function(){var e=this,i=this.config.keyCodeMap;i&&Object.keys(i).map(function(n){e.keyCodeMap[n]?["keyCode","action","disable","pressAction","disablePress","isBodyTarget"].map(function(s){i[n][s]&&(e.keyCodeMap[n][s]=i[n][s])}):e.keyCodeMap[n]=i[n]})}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e=typeof this.config.seekStep=="function"?this.config.seekStep(this.player):this.config.seekStep;!e||typeof e!="number"||(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(n){i.config[n]=e[n]})}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),i=e.height,n=e.top,s=e.bottom,l=window.innerHeight;return!(n<0&&n<0-i*.9||s>0&&s-l>i*.9)}},{key:"checkCode",value:function(e,i){var n=this,s=!1;return Object.keys(this.keyCodeMap).map(function(l){n.keyCodeMap[l]&&e===n.keyCodeMap[l].keyCode&&!n.keyCodeMap[l].disable&&(s=!i||i&&!n.keyCodeMap[l].noBodyTarget)}),s}},{key:"downVolume",value:function(e){var i=this.player;if(!(i.volume<=0)){var n=parseFloat((i.volume-.1).toFixed(1)),s={volume:{from:i.volume,to:n}};this.emitUserAction(e,"change_volume",{props:s}),n>=0?i.volume=n:i.volume=0}}},{key:"upVolume",value:function(e){var i=this.player;if(!(i.volume>=1)){var n=parseFloat((i.volume+.1).toFixed(1)),s={volume:{from:i.volume,to:n}};this.emitUserAction(e,"change_volume",{props:s}),n<=1?i.volume=n:i.volume=1}}},{key:"seek",value:function(e){var i=this.player,n=i.currentTime,s=i.offsetCurrentTime,l=i.duration,u=i.offsetDuration,c=i.timeSegments,h=s>-1?s:n,d=u||l,g=e.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;h+g<=d?h=h+g:h=d;var v=f.getCurrentTimeByOffset(h,c),y={currentTime:{from:n,to:v}};this.emitUserAction(e,"seek",{props:y}),this.player.currentTime=v}},{key:"seekBack",value:function(e){var i=this.player,n=i.currentTime,s=i.offsetCurrentTime,l=i.timeSegments,u=e.repeat?parseInt(this.seekStep/2,10):this.seekStep,c=s>-1?s:n,h=c-u;h<0&&(h=0),h=f.getCurrentTimeByOffset(h,l);var d={currentTime:{from:n,to:h}};this.emitUserAction(e,"seek",{props:d}),this.player.currentTime=h}},{key:"changePlaybackRate",value:function(e){var i=this._keyState,n=this.config,s=this.player;i.playbackRate===0&&(i.playbackRate=s.playbackRate,s.playbackRate=n.playbackRate)}},{key:"playPause",value:function(e){var i=this.player;i&&(this.emitUserAction(e,"switch_play_pause"),i.paused?i.play():i.pause())}},{key:"exitFullscreen",value:function(e){var i=this.player,n=i.fullscreen,s=i.cssfullscreen;n&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:n,to:!n}),i.exitFullscreen()),s&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:s,to:!s}),i.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var i=this._keyState;if(e.repeat){i.isPress=!0;var n=Date.now();if(n-i.tt<200)return;i.tt=n}this.handleKeyCode(e.keyCode,e,i.isPress)}},{key:"handleKeyUp",value:function(e){var i=this._keyState;i.playbackRate>0&&(this.player.playbackRate=i.playbackRate,i.playbackRate=0),i.isKeyDown=!1,i.isPress=!1,i.tt=0}},{key:"handleKeyCode",value:function(e,i,n){for(var s=Object.keys(this.keyCodeMap),l=0;l<s.length;l++){var u=this.keyCodeMap[s[l]],c=u.action,h=u.keyCode,d=u.disable,g=u.pressAction,v=u.disablePress;if(h===e){if(!d&&!(n&&v)){var y=n&&g||c;typeof y=="function"?c(i,this.player,n):typeof y=="string"&&typeof this[y]=="function"&&this[y](i,this.player,n),this.emit(fi,V({key:s[l],target:i.target,isPress:n},this.keyCodeMap[s[l]]))}Vr(i),i.stopPropagation();break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),r}(he);function zr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">
66
+ `)}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:60*6*1e3,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),r}(F);function Ur(a){a.preventDefault(),a.returnValue=!1}function Vi(a){var o=a.tagName;return!!(o==="INPUT"||o==="TEXTAREA"||a.isContentEditable)}var zi=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onBodyKeyDown",function(s){if(t.player){var l=s||window.event,u=l.keyCode,c=m(t),h=c._keyState,d=c.player,g=t.config,v=g.disable,y=g.disableBodyTrigger,C=g.isIgnoreUserActive;if(v||y||!(d.isUserActive||C)||Vi(l.target)||!t.checkIsVisible()||l.metaKey||l.altKey||l.ctrlKey){h.isBodyKeyDown=!1;return}!s.repeat&&!h.isKeyDown&&((l.target===document.body||t.config.isGlobalTrigger&&!Vi(l.target))&&t.checkCode(u,!0)&&(h.isBodyKeyDown=!0),document.addEventListener("keyup",t.onBodyKeyUp)),h.isBodyKeyDown&&t.handleKeyDown(l)}}),_(m(t),"onBodyKeyUp",function(s){t.player&&(document.removeEventListener("keyup",t.onBodyKeyUp),t.handleKeyUp(s))}),_(m(t),"onKeydown",function(s){if(t.player){var l=s||window.event,u=m(t),c=u._keyState;if(!l.repeat){if(t.config.disable||t.config.disableRootTrigger||l.metaKey||l.altKey||l.ctrlKey)return;l&&(l.keyCode===37||t.checkCode(l.keyCode))&&(l.target===t.player.root||l.target===t.player.video||l.target===t.player.controls.el)&&(c.isKeyDown=!0),t.player.root.addEventListener("keyup",t.onKeyup)}c.isKeyDown&&t.handleKeyDown(l)}}),_(m(t),"onKeyup",function(s){t.player&&(t.player.root.removeEventListener("keyup",t.onKeyup),t.handleKeyUp(s))}),t}return S(r,[{key:"mergekeyCodeMap",value:function(){var e=this,i=this.config.keyCodeMap;i&&Object.keys(i).map(function(n){e.keyCodeMap[n]?["keyCode","action","disable","pressAction","disablePress","isBodyTarget"].map(function(s){i[n][s]&&(e.keyCodeMap[n][s]=i[n][s])}):e.keyCodeMap[n]=i[n]})}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e=typeof this.config.seekStep=="function"?this.config.seekStep(this.player):this.config.seekStep;!e||typeof e!="number"||(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(n){i.config[n]=e[n]})}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),i=e.height,n=e.top,s=e.bottom,l=window.innerHeight;return!(n<0&&n<0-i*.9||s>0&&s-l>i*.9)}},{key:"checkCode",value:function(e,i){var n=this,s=!1;return Object.keys(this.keyCodeMap).map(function(l){n.keyCodeMap[l]&&e===n.keyCodeMap[l].keyCode&&!n.keyCodeMap[l].disable&&(s=!i||i&&!n.keyCodeMap[l].noBodyTarget)}),s}},{key:"downVolume",value:function(e){var i=this.player;if(!(i.volume<=0)){var n=parseFloat((i.volume-.1).toFixed(1)),s={volume:{from:i.volume,to:n}};this.emitUserAction(e,"change_volume",{props:s}),n>=0?i.volume=n:i.volume=0}}},{key:"upVolume",value:function(e){var i=this.player;if(!(i.volume>=1)){var n=parseFloat((i.volume+.1).toFixed(1)),s={volume:{from:i.volume,to:n}};this.emitUserAction(e,"change_volume",{props:s}),n<=1?i.volume=n:i.volume=1}}},{key:"seek",value:function(e){var i=this.player,n=i.currentTime,s=i.offsetCurrentTime,l=i.duration,u=i.offsetDuration,c=i.timeSegments,h=s>-1?s:n,d=u||l,g=e.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;h+g<=d?h=h+g:h=d;var v=f.getCurrentTimeByOffset(h,c),y={currentTime:{from:n,to:v}};this.emitUserAction(e,"seek",{props:y}),this.player.currentTime=v}},{key:"seekBack",value:function(e){var i=this.player,n=i.currentTime,s=i.offsetCurrentTime,l=i.timeSegments,u=e.repeat?parseInt(this.seekStep/2,10):this.seekStep,c=s>-1?s:n,h=c-u;h<0&&(h=0),h=f.getCurrentTimeByOffset(h,l);var d={currentTime:{from:n,to:h}};this.emitUserAction(e,"seek",{props:d}),this.player.currentTime=h}},{key:"changePlaybackRate",value:function(e){var i=this._keyState,n=this.config,s=this.player;i.playbackRate===0&&(i.playbackRate=s.playbackRate,s.playbackRate=n.playbackRate)}},{key:"playPause",value:function(e){var i=this.player;i&&(this.emitUserAction(e,"switch_play_pause"),i.paused?i.play():i.pause())}},{key:"exitFullscreen",value:function(e){var i=this.player,n=i.fullscreen,s=i.cssfullscreen;n&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:n,to:!n}),i.exitFullscreen()),s&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:s,to:!s}),i.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var i=this._keyState;if(e.repeat){i.isPress=!0;var n=Date.now();if(n-i.tt<200)return;i.tt=n}this.handleKeyCode(e.keyCode,e,i.isPress)}},{key:"handleKeyUp",value:function(e){var i=this._keyState;i.playbackRate>0&&(this.player.playbackRate=i.playbackRate,i.playbackRate=0),i.isKeyDown=!1,i.isPress=!1,i.tt=0}},{key:"handleKeyCode",value:function(e,i,n){for(var s=Object.keys(this.keyCodeMap),l=0;l<s.length;l++){var u=this.keyCodeMap[s[l]],c=u.action,h=u.keyCode,d=u.disable,g=u.pressAction,v=u.disablePress;if(h===e){if(!d&&!(n&&v)){var y=n&&g||c;typeof y=="function"?c(i,this.player,n):typeof y=="string"&&typeof this[y]=="function"&&this[y](i,this.player,n),this.emit(fi,V({key:s[l],target:i.target,isPress:n},this.keyCodeMap[s[l]]))}Ur(i),i.stopPropagation();break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),r}(he);function Vr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">
67
67
  <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>
68
68
  </svg>
69
- `,"image/svg+xml").firstChild}var jr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"registerIcons",value:function(){return{loadingIcon:zr}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return`
69
+ `,"image/svg+xml").firstChild}var zr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"registerIcons",value:function(){return{loadingIcon:Vr}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return`
70
70
  <xg-loading class="xgplayer-loading">
71
71
  <xg-loading-inner></xg-loading-inner>
72
- </xg-loading>`}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:H.ROOT}}}]),r}(F),Wr=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],Gr=function(){function a(o){E(this,a),this.fragments=o.fragments||[],this.fragments.length===0&&this.fragments.push({percent:1}),this._callBack=o.actionCallback,this.fragConfig={fragFocusClass:o.fragFocusClass||"inner-focus-point",fragAutoFocus:!!o.fragAutoFocus,fragClass:o.fragClass||""},this.style=o.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return S(a,[{key:"updateDuration",value:function(r){var t=this;this.duration=r;var e=0,i=this.fragments;this.fragments=i.map(function(n){return n.start=parseInt(e,10),n.end=parseInt(e+n.percent*t.duration,10),n.duration=parseInt(n.percent*t.duration,10),e+=n.percent*t.duration,n})}},{key:"updateProgress",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"played",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},e=this.progressList,i=this.fragments;if(!(e.length<1)){var n=t.newIndex,s=t.curIndex,l=t.millisecond;n!==s&&e.map(function(h,d){d<n?h[r].style.width="100%":d>n&&(h[r].style.width=0)});var u=i[n],c=l===0?0:(l-u.start)/u.duration;e[n][r].style.width=c<0?0:"".concat(c*100,"%")}}},{key:"updateFocus",value:function(r){if(!(!this.fragConfig.fragAutoFocus||this.fragments.length<2)){if(!r){if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var t={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(t),this.focusIndex=-1}return}var e=this.findIndex(r.currentTime*1e3,this.focusIndex);if(e>=0&&e!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(e);var i={index:e,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=e,this._callBack&&this._callBack(i)}}}},{key:"update",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(t*1e3,10)!==this.duration){if(!t&&t!==0)return;this.updateDuration(parseInt(t*1e3,10))}var e=this.playedIndex,i=this.cachedIndex;if(f.typeOf(r.played)!=="Undefined"){var n=this.findIndex(r.played*1e3,e);if(n<0)return;this.updateProgress("played",{newIndex:n,curIndex:e,millisecond:parseInt(r.played*1e3,10)}),this.playedIndex=n}if(f.typeOf(r.cached)!=="Undefined"){var s=this.findIndex(r.cached*1e3,i);if(s<0)return;this.updateProgress("cached",{newIndex:s,curIndex:i,millisecond:parseInt(r.cached*1e3,10)}),this.cachedIndex=s}}},{key:"findIndex",value:function(r,t){var e=this.fragments;if(!e||e.length===0)return-1;if(e.length===1)return 0;if(t>-1&&t<e.length&&r>e[t].start&&r<e[t].end)return t;if(r>e[e.length-1].start)return e.length-1;for(var i=0;i<e.length;i++)if(r>e[i].start&&r<=e[i].end){t=i;break}return t}},{key:"findHightLight",value:function(){for(var r=this.root.children,t=0;t<r.length;t++)if(f.hasClass(r[t],this.fragConfig.fragFocusClass))return{dom:r[t],pos:r[t].getBoundingClientRect()}}},{key:"findFragment",value:function(r){var t=this.root.children;return r<0||r>=t.length?null:{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var r=this.root.children,t=0;t<r.length;t++)f.removeClass(r[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(r){var t=this.root.children;if(r<t.length)return f.addClass(t[r],this.fragConfig.fragFocusClass),{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(r){var t=this;if(Object.keys(this.fragConfig).forEach(function(i){r[i]!==void 0&&(t.fragConfig[i]=r[i])}),r.fragments){if(this.fragments=r.fragments.length===0?[{percent:1}]:r.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var e=this.root.children;e.length>0;)this.root.removeChild(e[0]);this.render()}}},{key:"render",value:function(){var r=this,t=this.style.progressColor;if(this.root||(this.root=f.createDom("xg-inners","",{},"progress-list")),this.fragments){var e=this.fragConfig,i=e.fragClass,n=e.fragFocusClass;this.progressList=this.fragments.map(function(s){var l=f.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(s.percent):"flex: ".concat(s.percent)},"".concat(s.isFocus?n:""," xgplayer-progress-inner ").concat(i));return r.root.appendChild(l),Wr.forEach(function(u){l.appendChild(f.createDom(u.tag,"",{style:u.styleKey?"background: ".concat(r.style[u.styleKey],"; width:0;"):"width:0;"},u.className))}),{cached:l.children[0],played:l.children[1]}})}return this.root}}]),a}(),ji={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},Kr=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onMoveOnly",function(i,n){var s=m(e),l=s.pos,u=s.config,c=s.player,h=n;if(i){f.event(i);var d=f.getEventPos(i,c.zoom),g=c.rotateDeg===90?d.clientY:d.clientX;if(l.moving&&Math.abs(l.x-g)<u.miniMoveStep)return;l.moving=!0,l.x=g,h=e.computeTime(i,g)}e.triggerCallbacks("dragmove",h,i),e._updateInnerFocus(h)}),_(m(e),"onBodyClick",function(i){e.pos.isLocked&&(e.pos.isLocked=!1,i.preventDefault(),i.stopPropagation())}),_(m(e),"_mouseDownHandler",function(i,n){e._state.time=n.currentTime,e.updateWidth(n.currentTime,n.seekTime,n.percent,0),e._updateInnerFocus(n)}),_(m(e),"_mouseUpHandler",function(i,n){var s=m(e),l=s.pos;l.moving&&e.updateWidth(n.currentTime,n.seekTime,n.percent,2)}),_(m(e),"_mouseMoveHandler",function(i,n){var s=m(e),l=s._state,u=s.pos,c=s.config,h=s.player;l.time<n.currentTime?n.forward=!0:n.forward=!1,l.time=n.currentTime,u.isDown&&!u.moving&&(u.moving=!0,c.isPauseMoving&&h.pause(),e.triggerCallbacks("dragstart",n,i),e.emitUserAction("drag","dragstart",n)),e.updateWidth(n.currentTime,n.seekTime,n.percent,1),e.triggerCallbacks("dragmove",n,i),e._updateInnerFocus(n)}),_(m(e),"onMouseDown",function(i){var n=m(e),s=n._state,l=n.player,u=n.pos,c=n.config,h=n.playerConfig,d=f.getEventPos(i,l.zoom),g=l.rotateDeg===90?d.clientY:d.clientX;if(!(l.isMini||c.closeMoveSeek||!h.allowSeekAfterEnded&&l.ended)){if(!l.duration&&!l.isPlaying){l.play();return}i.stopPropagation(),e.focus(),f.checkIsFunction(h.disableSwipeHandler)&&h.disableSwipeHandler(),f.checkIsFunction(c.onMoveStart)&&c.onMoveStart(),f.event(i),u.x=g,u.isDown=!0,u.moving=!1,s.prePlayTime=l.currentTime,l.focus({autoHide:!1}),e.isProgressMoving=!0,f.addClass(e.progressBtn,"active");var v=e.computeTime(i,g);v.prePlayTime=s.prePlayTime,e._mouseDownHandlerHook(i,v);var y=i.type;return y==="touchstart"?(e.root.addEventListener("touchmove",e.onMouseMove),e.root.addEventListener("touchend",e.onMouseUp),e.root.addEventListener("touchcancel",e.onMouseUp)):(e.unbind("mousemove",e.onMoveOnly),document.addEventListener("mousemove",e.onMouseMove,!1),document.addEventListener("mouseup",e.onMouseUp,!1)),!0}}),_(m(e),"onMouseUp",function(i){var n=m(e),s=n.player,l=n.config,u=n.pos,c=n.playerConfig,h=n._state;i.stopPropagation(),i.preventDefault(),f.checkIsFunction(c.enableSwipeHandler)&&c.enableSwipeHandler(),f.checkIsFunction(l.onMoveEnd)&&l.onMoveEnd(),f.event(i),f.removeClass(e.progressBtn,"active");var d=e.computeTime(i,u.x);d.prePlayTime=h.prePlayTime,u.moving?(e.triggerCallbacks("dragend",d,i),e.emitUserAction("drag","dragend",d)):(e.triggerCallbacks("click",d,i),e.emitUserAction("click","click",d)),e._mouseUpHandlerHook(i,d),u.moving=!1,u.isDown=!1,u.x=0,u.y=0,u.isLocked=!0,h.prePlayTime=0,h.time=0;var g=i.type;g==="touchend"||g==="touchcancel"?(e.root.removeEventListener("touchmove",e.onMouseMove),e.root.removeEventListener("touchend",e.onMouseUp),e.root.removeEventListener("touchcancel",e.onMouseUp),e.blur()):(document.removeEventListener("mousemove",e.onMouseMove,!1),document.removeEventListener("mouseup",e.onMouseUp,!1),u.isEnter?c.isMobileSimulateMode!=="mobile"&&e.bind("mousemove",e.onMoveOnly):e.onMouseLeave(i)),f.setTimeout(m(e),function(){e.resetSeekState()},1),s.focus()}),_(m(e),"onMouseMove",function(i){var n=m(e),s=n._state,l=n.pos,u=n.player,c=n.config;f.checkTouchSupport()&&i.preventDefault(),f.event(i);var h=f.getEventPos(i,u.zoom),d=u.rotateDeg===90?h.clientY:h.clientX,g=Math.abs(l.x-d);if(!(l.moving&&g<c.miniMoveStep||!l.moving&&g<c.miniStartStep)){l.x=d;var v=e.computeTime(i,d);v.prePlayTime=s.prePlayTime,e._mouseMoveHandlerHook(i,v)}}),_(m(e),"onMouseOut",function(i){e.triggerCallbacks("mouseout",null,i)}),_(m(e),"onMouseOver",function(i){e.triggerCallbacks("mouseover",null,i)}),_(m(e),"onMouseEnter",function(i){var n=m(e),s=n.player,l=n.pos;if(!(l.isDown||l.isEnter||s.isMini||!s.config.allowSeekAfterEnded&&s.ended)){l.isEnter=!0,e.bind("mousemove",e.onMoveOnly),e.bind("mouseleave",e.onMouseLeave),f.event(i);var u=f.getEventPos(i,s.zoom),c=s.rotateDeg===90?u.clientY:u.clientX,h=e.computeTime(i,c);e.triggerCallbacks("mouseenter",h,i),e.focus()}}),_(m(e),"onMouseLeave",function(i){e.triggerCallbacks("mouseleave",null,i),e.unlock(),e._updateInnerFocus(null)}),_(m(e),"onVideoResize",function(){var i=e.pos,n=i.x,s=i.isDown,l=i.isEnter;if(l&&!s){var u=e.computeTime(null,n);e.onMoveOnly(null,u)}}),e.useable=!1,e.isProgressMoving=!1,e.__dragCallBacks=[],e._state={now:-1,direc:0,time:0,prePlayTime:-1},e._disableBlur=!1,e}return S(r,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n+this.timeOffset}},{key:"changeState",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!i||i.length===0)&&(i=[{percent:1}]);var s=V(V({fragments:i},n),{},{actionCallback:function(u){e.emitUserAction("fragment_focus","fragment_focus",u)}});this.innerList?this.innerList.reset(s):(this.innerList=new Gr(s),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map(function(l){e[l]=e.innerList[l].bind(e.innerList)}))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){var e=this;if(!(this.config.disable||this.playerConfig.isLive)){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer");var i=this.config,n=i.fragFocusClass,s=i.fragAutoFocus,l=i.fragClass;this._initInner(this.config.fragments,{fragFocusClass:n,fragAutoFocus:s,fragClass:l,style:this.playerConfig.commonStyle||{}}),D.device==="mobile"&&(this.config.isDragingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.on(ce,function(){e.onMouseLeave()}),this.on(X,function(){e.onTimeupdate()}),this.on(se,function(){e.onTimeupdate(),e.onCacheUpdate()}),this.on(ni,function(){e.onCacheUpdate()}),this.on(me,function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0}),this.on(ye,function(){e.onReset()}),this.on(fe,function(){e.onVideoResize()}),this.bindDomEvents(),this.initCustomStyle()}}},{key:"setConfig",value:function(e){var i=this,n=null;Object.keys(e).forEach(function(s){i.config[s]=e[s],s==="fragments"&&(n=e[s])}),n&&this._initInner(n,e)}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,n=i.sliderBtnStyle,s=this.progressBtn;n&&(typeof n=="string"?s.style.boxShadow=n:W(n)==="object"&&Object.keys(n).map(function(l){s.style[l]=n[l]}))}},{key:"triggerCallbacks",value:function(e,i,n){this.__dragCallBacks.length>0&&this.__dragCallBacks.map(function(s){if(s&&s.handler&&s.type===e)try{s.handler(i,n)}catch(l){console.error("[XGPLAYER][triggerCallbacks] ".concat(s," error"),l)}})}},{key:"addCallBack",value:function(e,i){i&&typeof i=="function"&&this.__dragCallBacks.push({type:e,handler:i})}},{key:"removeCallBack",value:function(e,i){var n=this.__dragCallBacks,s=-1;n.map(function(l,u){l&&l.type===e&&l.handler===i&&(s=u)}),s>-1&&n.splice(s,1)}},{key:"unlock",value:function(){var e=this.player,i=this.pos;if(i.isEnter=!1,i.isLocked=!1,!e.isMini){if(this.unbind("mousemove",this.onMoveOnly),i.isDown){this.unbind("mouseleave",this.onMouseLeave);return}this.blur()}}},{key:"bindDomEvents",value:function(){var e=this.player.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),(this.domEventType==="touch"||this.domEventType==="compatible")&&this.root.addEventListener("touchstart",this.onMouseDown),(this.domEventType==="mouse"||this.domEventType==="compatible")&&(this.bind("mousedown",this.onMouseDown),e.isMobileSimulateMode!=="mobile"&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),f.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),f.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,i,n,s){var l=this.config,u=this.player;if(!(l.isCloseClickSeek&&s===0)){var c=i=i>=u.duration?u.duration-l.endedDiff:Number(i).toFixed(1);this.updatePercent(n),this.updateTime(e),!(s===1&&(!l.isDragingSeek||u.config.mediaType==="audio"))&&(this._state.now=c,this._state.direc=c>u.currentTime?0:1,u.seek(c))}}},{key:"computeTime",value:function(e,i){var n=this.player,s=this.root.getBoundingClientRect(),l=s.width,u=s.height,c=s.top,h=s.left,d,g,v=i;n.rotateDeg===90?(d=u,g=c):(d=l,g=h);var y=v-g;y=y>d?d:y<0?0:y;var C=y/d;C=C<0?0:C>1?1:C;var b=parseInt(C*this.offsetDuration*1e3,10)/1e3,w=f.getCurrentTimeByOffset(b,n.timeSegments);return{percent:C,currentTime:b,seekTime:w,offset:y,width:d,left:g,e}}},{key:"updateTime",value:function(e){var i=this.player,n=this.duration;e>n?e=n:e<0&&(e=0);var s=i.plugins.time;s&&s.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,i){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(e*100,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var n=this.player.plugins.miniprogress;n&&n.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var i=this.player,n=this._state,s=this.offsetDuration;if(!(i.isSeeking&&i.media.seeking||this.isProgressMoving||!i.hasStart)){if(n.now>-1){var l=parseInt(n.now*1e3,10)-parseInt(i.currentTime*1e3,10);if(n.direc===0&&l>300||n.direc===1&&l>-300){n.now=-1;return}else n.now=-1}var u=this.currentTime;u=f.adjustTimeByDuration(u,s,e),this.innerList.update({played:u},s),this.progressBtn.style.left="".concat(u/s*100,"%")}}},{key:"onCacheUpdate",value:function(e){var i=this.player,n=this.duration;if(i){var s=i.bufferedPoint.end;s=f.adjustTimeByDuration(s,n,e),this.innerList.update({cached:s},n)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var i=this.domEventType;(i==="touch"||i==="compatible")&&(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),(i==="mouse"||i==="compatible")&&(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!(this.config.disable||this.playerConfig.isLive)){var e=this.player.controls?this.player.controls.config.mode:"",i=e==="bottom"?"xgplayer-progress-bottom":"";return`
72
+ </xg-loading>`}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:H.ROOT}}}]),r}(F),jr=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],Wr=function(){function a(o){E(this,a),this.fragments=o.fragments||[],this.fragments.length===0&&this.fragments.push({percent:1}),this._callBack=o.actionCallback,this.fragConfig={fragFocusClass:o.fragFocusClass||"inner-focus-point",fragAutoFocus:!!o.fragAutoFocus,fragClass:o.fragClass||""},this.style=o.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return S(a,[{key:"updateDuration",value:function(r){var t=this;this.duration=r;var e=0,i=this.fragments;this.fragments=i.map(function(n){return n.start=parseInt(e,10),n.end=parseInt(e+n.percent*t.duration,10),n.duration=parseInt(n.percent*t.duration,10),e+=n.percent*t.duration,n})}},{key:"updateProgress",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"played",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},e=this.progressList,i=this.fragments;if(!(e.length<1)){var n=t.newIndex,s=t.curIndex,l=t.millisecond;n!==s&&e.map(function(h,d){d<n?h[r].style.width="100%":d>n&&(h[r].style.width=0)});var u=i[n],c=l===0?0:(l-u.start)/u.duration;e[n][r].style.width=c<0?0:"".concat(c*100,"%")}}},{key:"updateFocus",value:function(r){if(!(!this.fragConfig.fragAutoFocus||this.fragments.length<2)){if(!r){if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var t={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(t),this.focusIndex=-1}return}var e=this.findIndex(r.currentTime*1e3,this.focusIndex);if(e>=0&&e!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(e);var i={index:e,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=e,this._callBack&&this._callBack(i)}}}},{key:"update",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(t*1e3,10)!==this.duration){if(!t&&t!==0)return;this.updateDuration(parseInt(t*1e3,10))}var e=this.playedIndex,i=this.cachedIndex;if(f.typeOf(r.played)!=="Undefined"){var n=this.findIndex(r.played*1e3,e);if(n<0)return;this.updateProgress("played",{newIndex:n,curIndex:e,millisecond:parseInt(r.played*1e3,10)}),this.playedIndex=n}if(f.typeOf(r.cached)!=="Undefined"){var s=this.findIndex(r.cached*1e3,i);if(s<0)return;this.updateProgress("cached",{newIndex:s,curIndex:i,millisecond:parseInt(r.cached*1e3,10)}),this.cachedIndex=s}}},{key:"findIndex",value:function(r,t){var e=this.fragments;if(!e||e.length===0)return-1;if(e.length===1)return 0;if(t>-1&&t<e.length&&r>e[t].start&&r<e[t].end)return t;if(r>e[e.length-1].start)return e.length-1;for(var i=0;i<e.length;i++)if(r>e[i].start&&r<=e[i].end){t=i;break}return t}},{key:"findHightLight",value:function(){for(var r=this.root.children,t=0;t<r.length;t++)if(f.hasClass(r[t],this.fragConfig.fragFocusClass))return{dom:r[t],pos:r[t].getBoundingClientRect()}}},{key:"findFragment",value:function(r){var t=this.root.children;return r<0||r>=t.length?null:{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var r=this.root.children,t=0;t<r.length;t++)f.removeClass(r[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(r){var t=this.root.children;if(r<t.length)return f.addClass(t[r],this.fragConfig.fragFocusClass),{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(r){var t=this;if(Object.keys(this.fragConfig).forEach(function(i){r[i]!==void 0&&(t.fragConfig[i]=r[i])}),r.fragments){if(this.fragments=r.fragments.length===0?[{percent:1}]:r.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var e=this.root.children;e.length>0;)this.root.removeChild(e[0]);this.render()}}},{key:"render",value:function(){var r=this,t=this.style.progressColor;if(this.root||(this.root=f.createDom("xg-inners","",{},"progress-list")),this.fragments){var e=this.fragConfig,i=e.fragClass,n=e.fragFocusClass;this.progressList=this.fragments.map(function(s){var l=f.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(s.percent):"flex: ".concat(s.percent)},"".concat(s.isFocus?n:""," xgplayer-progress-inner ").concat(i));return r.root.appendChild(l),jr.forEach(function(u){l.appendChild(f.createDom(u.tag,"",{style:u.styleKey?"background: ".concat(r.style[u.styleKey],"; width:0;"):"width:0;"},u.className))}),{cached:l.children[0],played:l.children[1]}})}return this.root}}]),a}(),ji={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},Gr=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onMoveOnly",function(i,n){var s=m(e),l=s.pos,u=s.config,c=s.player,h=n;if(i){f.event(i);var d=f.getEventPos(i,c.zoom),g=c.rotateDeg===90?d.clientY:d.clientX;if(l.moving&&Math.abs(l.x-g)<u.miniMoveStep)return;l.moving=!0,l.x=g,h=e.computeTime(i,g)}e.triggerCallbacks("dragmove",h,i),e._updateInnerFocus(h)}),_(m(e),"onBodyClick",function(i){e.pos.isLocked&&(e.pos.isLocked=!1,i.preventDefault(),i.stopPropagation())}),_(m(e),"_mouseDownHandler",function(i,n){e._state.time=n.currentTime,e.updateWidth(n.currentTime,n.seekTime,n.percent,0),e._updateInnerFocus(n)}),_(m(e),"_mouseUpHandler",function(i,n){var s=m(e),l=s.pos;l.moving&&e.updateWidth(n.currentTime,n.seekTime,n.percent,2)}),_(m(e),"_mouseMoveHandler",function(i,n){var s=m(e),l=s._state,u=s.pos,c=s.config,h=s.player;l.time<n.currentTime?n.forward=!0:n.forward=!1,l.time=n.currentTime,u.isDown&&!u.moving&&(u.moving=!0,c.isPauseMoving&&h.pause(),e.triggerCallbacks("dragstart",n,i),e.emitUserAction("drag","dragstart",n)),e.updateWidth(n.currentTime,n.seekTime,n.percent,1),e.triggerCallbacks("dragmove",n,i),e._updateInnerFocus(n)}),_(m(e),"onMouseDown",function(i){var n=m(e),s=n._state,l=n.player,u=n.pos,c=n.config,h=n.playerConfig,d=f.getEventPos(i,l.zoom),g=l.rotateDeg===90?d.clientY:d.clientX;if(!(l.isMini||c.closeMoveSeek||!h.allowSeekAfterEnded&&l.ended)){if(!l.duration&&!l.isPlaying){l.play();return}i.stopPropagation(),e.focus(),f.checkIsFunction(h.disableSwipeHandler)&&h.disableSwipeHandler(),f.checkIsFunction(c.onMoveStart)&&c.onMoveStart(),f.event(i),u.x=g,u.isDown=!0,u.moving=!1,s.prePlayTime=l.currentTime,l.focus({autoHide:!1}),e.isProgressMoving=!0,f.addClass(e.progressBtn,"active");var v=e.computeTime(i,g);v.prePlayTime=s.prePlayTime,e._mouseDownHandlerHook(i,v);var y=i.type;return y==="touchstart"?(e.root.addEventListener("touchmove",e.onMouseMove),e.root.addEventListener("touchend",e.onMouseUp),e.root.addEventListener("touchcancel",e.onMouseUp)):(e.unbind("mousemove",e.onMoveOnly),document.addEventListener("mousemove",e.onMouseMove,!1),document.addEventListener("mouseup",e.onMouseUp,!1)),!0}}),_(m(e),"onMouseUp",function(i){var n=m(e),s=n.player,l=n.config,u=n.pos,c=n.playerConfig,h=n._state;i.stopPropagation(),i.preventDefault(),f.checkIsFunction(c.enableSwipeHandler)&&c.enableSwipeHandler(),f.checkIsFunction(l.onMoveEnd)&&l.onMoveEnd(),f.event(i),f.removeClass(e.progressBtn,"active");var d=e.computeTime(i,u.x);d.prePlayTime=h.prePlayTime,u.moving?(e.triggerCallbacks("dragend",d,i),e.emitUserAction("drag","dragend",d)):(e.triggerCallbacks("click",d,i),e.emitUserAction("click","click",d)),e._mouseUpHandlerHook(i,d),u.moving=!1,u.isDown=!1,u.x=0,u.y=0,u.isLocked=!0,h.prePlayTime=0,h.time=0;var g=i.type;g==="touchend"||g==="touchcancel"?(e.root.removeEventListener("touchmove",e.onMouseMove),e.root.removeEventListener("touchend",e.onMouseUp),e.root.removeEventListener("touchcancel",e.onMouseUp),e.blur()):(document.removeEventListener("mousemove",e.onMouseMove,!1),document.removeEventListener("mouseup",e.onMouseUp,!1),u.isEnter?c.isMobileSimulateMode!=="mobile"&&e.bind("mousemove",e.onMoveOnly):e.onMouseLeave(i)),f.setTimeout(m(e),function(){e.resetSeekState()},1),s.focus()}),_(m(e),"onMouseMove",function(i){var n=m(e),s=n._state,l=n.pos,u=n.player,c=n.config;f.checkTouchSupport()&&i.preventDefault(),f.event(i);var h=f.getEventPos(i,u.zoom),d=u.rotateDeg===90?h.clientY:h.clientX,g=Math.abs(l.x-d);if(!(l.moving&&g<c.miniMoveStep||!l.moving&&g<c.miniStartStep)){l.x=d;var v=e.computeTime(i,d);v.prePlayTime=s.prePlayTime,e._mouseMoveHandlerHook(i,v)}}),_(m(e),"onMouseOut",function(i){e.triggerCallbacks("mouseout",null,i)}),_(m(e),"onMouseOver",function(i){e.triggerCallbacks("mouseover",null,i)}),_(m(e),"onMouseEnter",function(i){var n=m(e),s=n.player,l=n.pos;if(!(l.isDown||l.isEnter||s.isMini||!s.config.allowSeekAfterEnded&&s.ended)){l.isEnter=!0,e.bind("mousemove",e.onMoveOnly),e.bind("mouseleave",e.onMouseLeave),f.event(i);var u=f.getEventPos(i,s.zoom),c=s.rotateDeg===90?u.clientY:u.clientX,h=e.computeTime(i,c);e.triggerCallbacks("mouseenter",h,i),e.focus()}}),_(m(e),"onMouseLeave",function(i){e.triggerCallbacks("mouseleave",null,i),e.unlock(),e._updateInnerFocus(null)}),_(m(e),"onVideoResize",function(){var i=e.pos,n=i.x,s=i.isDown,l=i.isEnter;if(l&&!s){var u=e.computeTime(null,n);e.onMoveOnly(null,u)}}),e.useable=!1,e.isProgressMoving=!1,e.__dragCallBacks=[],e._state={now:-1,direc:0,time:0,prePlayTime:-1},e._disableBlur=!1,e}return S(r,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n+this.timeOffset}},{key:"changeState",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!i||i.length===0)&&(i=[{percent:1}]);var s=V(V({fragments:i},n),{},{actionCallback:function(u){e.emitUserAction("fragment_focus","fragment_focus",u)}});this.innerList?this.innerList.reset(s):(this.innerList=new Wr(s),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map(function(l){e[l]=e.innerList[l].bind(e.innerList)}))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){var e=this;if(!(this.config.disable||this.playerConfig.isLive)){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer");var i=this.config,n=i.fragFocusClass,s=i.fragAutoFocus,l=i.fragClass;this._initInner(this.config.fragments,{fragFocusClass:n,fragAutoFocus:s,fragClass:l,style:this.playerConfig.commonStyle||{}}),D.device==="mobile"&&(this.config.isDragingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.on(ce,function(){e.onMouseLeave()}),this.on(X,function(){e.onTimeupdate()}),this.on(se,function(){e.onTimeupdate(),e.onCacheUpdate()}),this.on(ni,function(){e.onCacheUpdate()}),this.on(me,function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0}),this.on(ye,function(){e.onReset()}),this.on(fe,function(){e.onVideoResize()}),this.bindDomEvents(),this.initCustomStyle()}}},{key:"setConfig",value:function(e){var i=this,n=null;Object.keys(e).forEach(function(s){i.config[s]=e[s],s==="fragments"&&(n=e[s])}),n&&this._initInner(n,e)}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,n=i.sliderBtnStyle,s=this.progressBtn;n&&(typeof n=="string"?s.style.boxShadow=n:W(n)==="object"&&Object.keys(n).map(function(l){s.style[l]=n[l]}))}},{key:"triggerCallbacks",value:function(e,i,n){this.__dragCallBacks.length>0&&this.__dragCallBacks.map(function(s){if(s&&s.handler&&s.type===e)try{s.handler(i,n)}catch(l){console.error("[XGPLAYER][triggerCallbacks] ".concat(s," error"),l)}})}},{key:"addCallBack",value:function(e,i){i&&typeof i=="function"&&this.__dragCallBacks.push({type:e,handler:i})}},{key:"removeCallBack",value:function(e,i){var n=this.__dragCallBacks,s=-1;n.map(function(l,u){l&&l.type===e&&l.handler===i&&(s=u)}),s>-1&&n.splice(s,1)}},{key:"unlock",value:function(){var e=this.player,i=this.pos;if(i.isEnter=!1,i.isLocked=!1,!e.isMini){if(this.unbind("mousemove",this.onMoveOnly),i.isDown){this.unbind("mouseleave",this.onMouseLeave);return}this.blur()}}},{key:"bindDomEvents",value:function(){var e=this.player.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),(this.domEventType==="touch"||this.domEventType==="compatible")&&this.root.addEventListener("touchstart",this.onMouseDown),(this.domEventType==="mouse"||this.domEventType==="compatible")&&(this.bind("mousedown",this.onMouseDown),e.isMobileSimulateMode!=="mobile"&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),f.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),f.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,i,n,s){var l=this.config,u=this.player;if(!(l.isCloseClickSeek&&s===0)){var c=i=i>=u.duration?u.duration-l.endedDiff:Number(i).toFixed(1);this.updatePercent(n),this.updateTime(e),!(s===1&&(!l.isDragingSeek||u.config.mediaType==="audio"))&&(this._state.now=c,this._state.direc=c>u.currentTime?0:1,u.seek(c))}}},{key:"computeTime",value:function(e,i){var n=this.player,s=this.root.getBoundingClientRect(),l=s.width,u=s.height,c=s.top,h=s.left,d,g,v=i;n.rotateDeg===90?(d=u,g=c):(d=l,g=h);var y=v-g;y=y>d?d:y<0?0:y;var C=y/d;C=C<0?0:C>1?1:C;var b=parseInt(C*this.offsetDuration*1e3,10)/1e3,w=f.getCurrentTimeByOffset(b,n.timeSegments);return{percent:C,currentTime:b,seekTime:w,offset:y,width:d,left:g,e}}},{key:"updateTime",value:function(e){var i=this.player,n=this.duration;e>n?e=n:e<0&&(e=0);var s=i.plugins.time;s&&s.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,i){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(e*100,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var n=this.player.plugins.miniprogress;n&&n.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var i=this.player,n=this._state,s=this.offsetDuration;if(!(i.isSeeking&&i.media.seeking||this.isProgressMoving||!i.hasStart)){if(n.now>-1){var l=parseInt(n.now*1e3,10)-parseInt(i.currentTime*1e3,10);if(n.direc===0&&l>300||n.direc===1&&l>-300){n.now=-1;return}else n.now=-1}var u=this.currentTime;u=f.adjustTimeByDuration(u,s,e),this.innerList.update({played:u},s),this.progressBtn.style.left="".concat(u/s*100,"%")}}},{key:"onCacheUpdate",value:function(e){var i=this.player,n=this.duration;if(i){var s=i.bufferedPoint.end;s=f.adjustTimeByDuration(s,n,e),this.innerList.update({cached:s},n)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var i=this.domEventType;(i==="touch"||i==="compatible")&&(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),(i==="mouse"||i==="compatible")&&(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!(this.config.disable||this.playerConfig.isLive)){var e=this.player.controls?this.player.controls.config.mode:"",i=e==="bottom"?"xgplayer-progress-bottom":"";return`
73
73
  <xg-progress class="xgplayer-progress `.concat(i,`">
74
74
  <xg-outer class="xgplayer-progress-outer">
75
75
  <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>
76
76
  </xg-outer>
77
77
  </xg-progress>
78
- `)}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_CENTER,index:0,disable:!1,isDragingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:ji.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return ji}}]),r}(F),ke=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onMouseenter",function(s){t.emit("icon_mouseenter",{pluginName:t.pluginName})}),_(m(t),"_onMouseLeave",function(s){t.emit("icon_mouseleave",{pluginName:t.pluginName})}),t}return S(r,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),r}(F),Yr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this);var i=this.player,n=this.config;n.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.on([we,Oe,ye],function(){e.animate(i.paused)}),this.on($,function(){e.animate(i.paused)}),this.animate(!0))}},{key:"registerIcons",value:function(){return{play:{icon:Dt,class:"xg-icon-play"},pause:{icon:Rt,class:"xg-icon-pause"}}}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var i=this.player;return this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i.paused,to:!i.paused}),i.ended?i.replay():i.paused?(i.play(),this.animate(!1)):(i.pause(),this.animate(!0)),!1}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){if(this.player){var i=this.i18nKeys,n=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),n&&this.changeLangTextKey(n,i.PLAY_TIPS)):(this.setAttr("data-state","play"),n&&this.changeLangTextKey(n,i.PAUSE_TIPS))}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class="xgplayer-play">
78
+ `)}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_CENTER,index:0,disable:!1,isDragingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:ji.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return ji}}]),r}(F),ke=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onMouseenter",function(s){t.emit("icon_mouseenter",{pluginName:t.pluginName})}),_(m(t),"_onMouseLeave",function(s){t.emit("icon_mouseleave",{pluginName:t.pluginName})}),t}return S(r,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),r}(F),Kr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this);var i=this.player,n=this.config;n.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.on([we,Oe,ye],function(){e.animate(i.paused)}),this.on($,function(){e.animate(i.paused)}),this.animate(!0))}},{key:"registerIcons",value:function(){return{play:{icon:Lt,class:"xg-icon-play"},pause:{icon:Dt,class:"xg-icon-pause"}}}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var i=this.player;return this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i.paused,to:!i.paused}),i.ended?i.replay():i.paused?(i.play(),this.animate(!1)):(i.pause(),this.animate(!0)),!1}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){if(this.player){var i=this.i18nKeys,n=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),n&&this.changeLangTextKey(n,i.PLAY_TIPS)):(this.setAttr("data-state","play"),n&&this.changeLangTextKey(n,i.PAUSE_TIPS))}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class="xgplayer-play">
79
79
  <div class="xgplayer-icon">
80
80
  </div>
81
81
  `.concat(pe(this,"PLAY_TIPS",this.playerConfig.isHideTips),`
82
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:0,disable:!1}}}]),r}(ke);function $r(){return new DOMParser().parseFromString(`<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
82
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:0,disable:!1}}}]),r}(ke);function Yr(){return new DOMParser().parseFromString(`<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
83
83
  <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
84
84
  <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>
85
85
  </g>
86
- </svg>`,"image/svg+xml").firstChild}var Xr=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(i){i.preventDefault(),i.stopPropagation(),e.config.onClick(i)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:$r,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){f.addClass(this.root,"show")}},{key:"hide",value:function(){f.removeClass(this.root,"show")}},{key:"render",value:function(){return`<xg-icon class="xgplayer-back">
87
- </xg-icon>`}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:H.ROOT_TOP,index:0}}}]),r}(F);function qr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">
86
+ </svg>`,"image/svg+xml").firstChild}var $r=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(i){i.preventDefault(),i.stopPropagation(),e.config.onClick(i)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:Yr,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){f.addClass(this.root,"show")}},{key:"hide",value:function(){f.removeClass(this.root,"show")}},{key:"render",value:function(){return`<xg-icon class="xgplayer-back">
87
+ </xg-icon>`}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:H.ROOT_TOP,index:0}}}]),r}(F);function Xr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">
88
88
  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>
89
89
  </svg>
90
- `,"image/svg+xml").firstChild}function Zr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">
90
+ `,"image/svg+xml").firstChild}function qr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">
91
91
  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>
92
92
  </svg>
93
- `,"image/svg+xml").firstChild}var Jr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onOrientationChange",function(s){t.player.fullscreen&&t.config.rotateFullscreen&&(window.orientation===90||window.orientation===-90?t.player.setRotateDeg(0):t.player.setRotateDeg(90))}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this);var i=this.config,n=this.playerConfig;if(!i.disable){i.target&&(this.playerConfig.fullscreenTarget=this.config.target);var s=f.getFullScreenEl();n.fullscreenTarget===s&&this.player.getFullscreen().catch(function(l){}),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(u){var c=e.player.fullscreen;e.emitUserAction(u,"switch_fullscreen",{prop:"fullscreen",from:c,to:!c})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(le,function(l){var u=e.find(".xg-tips");u&&e.changeLangTextKey(u,l?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(l)}),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:Xr,options:{config:{onClick:function(u){e.handleFullscreen(u)}}}})),D.device==="mobile"&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:qr,class:"xg-get-fullscreen"},exitFullscreen:{icon:Zr,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",D.device==="mobile"?"touchend":"click",this.handleFullscreen),D.device==="mobile"&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e&&(e.preventDefault(),e.stopPropagation());var i=this.player,n=this.config,s=n.useCssFullscreen===!0||typeof n.useCssFullscreen=="function"&&n.useCssFullscreen();s?(i.fullscreen?i.exitCssFullscreen():i.getCssFullscreen(),this.animate(i.fullscreen)):n.rotateFullscreen?(i.fullscreen?i.exitRotateFullscreen():i.getRotateFullscreen(),this.animate(i.fullscreen)):n.switchCallback&&typeof n.switchCallback=="function"?n.switchCallback(i.fullscreen):i.fullscreen?(i.exitFullscreen(),n.useScreenOrientation&&this.unlockScreen()):(i.getFullscreen().catch(function(l){}),n.useScreenOrientation&&i.aspectRatio>1&&this.lockScreen(n.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){var e="FULLSCREEN_TIPS";return`<xg-icon class="xgplayer-fullscreen">
93
+ `,"image/svg+xml").firstChild}var Zr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onOrientationChange",function(s){t.player.fullscreen&&t.config.rotateFullscreen&&(window.orientation===90||window.orientation===-90?t.player.setRotateDeg(0):t.player.setRotateDeg(90))}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this);var i=this.config,n=this.playerConfig;if(!i.disable){i.target&&(this.playerConfig.fullscreenTarget=this.config.target);var s=f.getFullScreenEl();n.fullscreenTarget===s&&this.player.getFullscreen().catch(function(l){}),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(u){var c=e.player.fullscreen;e.emitUserAction(u,"switch_fullscreen",{prop:"fullscreen",from:c,to:!c})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(le,function(l){var u=e.find(".xg-tips");u&&e.changeLangTextKey(u,l?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(l)}),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:$r,options:{config:{onClick:function(u){e.handleFullscreen(u)}}}})),D.device==="mobile"&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:Xr,class:"xg-get-fullscreen"},exitFullscreen:{icon:qr,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",D.device==="mobile"?"touchend":"click",this.handleFullscreen),D.device==="mobile"&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e&&(e.preventDefault(),e.stopPropagation());var i=this.player,n=this.config,s=n.useCssFullscreen===!0||typeof n.useCssFullscreen=="function"&&n.useCssFullscreen();s?(i.fullscreen?i.exitCssFullscreen():i.getCssFullscreen(),this.animate(i.fullscreen)):n.rotateFullscreen?(i.fullscreen?i.exitRotateFullscreen():i.getRotateFullscreen(),this.animate(i.fullscreen)):n.switchCallback&&typeof n.switchCallback=="function"?n.switchCallback(i.fullscreen):i.fullscreen?(i.exitFullscreen(),n.useScreenOrientation&&this.unlockScreen()):(i.getFullscreen().catch(function(l){}),n.useScreenOrientation&&i.aspectRatio>1&&this.lockScreen(n.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){var e="FULLSCREEN_TIPS";return`<xg-icon class="xgplayer-fullscreen">
94
94
  <div class="xgplayer-icon">
95
95
  </div>
96
96
  `.concat(pe(this,e,this.playerConfig.isHideTips),`
97
- </xg-icon>`)}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch(function(i){})}catch{}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch(function(e){})}catch{}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}(ke),Qr=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.isActiving=!1,e}return S(r,[{key:"duration",get:function(){var e=this.player,i=e.offsetDuration,n=e.duration;return this.playerConfig.customDuration||i||n}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this,i=this.player.controls.config.mode;this.mode=i==="flex"?"flex":"normal",!this.config.disable&&(this.mode==="flex"&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.on([ce,se,X],function(n){n.eventName==="durationchange"&&(e.isActiving=!1),e.onTimeUpdate()}),this.on(me,function(){e.onTimeUpdate(!0)}),this.on(ye,function(){e.onReset()}))}},{key:"show",value:function(e){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="block"),this.centerDurDom&&(this.centerDurDom.style.display="block");return}this.root.style.display="block"}},{key:"hide",value:function(){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="none"),this.centerDurDom&&(this.centerDurDom.style.display="none");return}this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var i=this.player,n=this.config,s=this.duration;if(!(n.disable||this.isActiving||!i.hasStart)){var l=this.currentTime+this.timeOffset;l=f.adjustTimeByDuration(l,s,e),this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime(f.format(l)),s!==1/0&&s>0&&(this.centerDurDom.innerHTML=f.format(s))):(this.timeDom.innerHTML=this.minWidthTime(f.format(l)),s!==1/0&&s>0&&(this.durationDom.innerHTML=f.format(s)))}}},{key:"onReset",value:function(){this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime(f.format(0)),this.centerDurDom.innerHTML=f.format(0)):(this.timeDom.innerHTML=this.minWidthTime(f.format(0)),this.durationDom.innerHTML=f.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(!(!e.controls||!e.controls.center)){var i=e.controls.center;this.centerCurDom=f.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=f.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),i.children.length>0?i.insertBefore(this.centerCurDom,i.children[0]):i.appendChild(this.centerCurDom),i.appendChild(this.centerDurDom)}}},{key:"afterPlayerInit",value:function(){var e=this.config;if(this.duration===1/0||this.playerConfig.isLive?(f.hide(this.durationDom),f.hide(this.timeDom),f.hide(this.find(".time-separator")),f.show(this.find(".time-live-tag"))):f.hide(this.find(".time-live-tag")),e.hide){this.hide();return}this.show()}},{key:"changeLiveState",value:function(e){e?(f.hide(this.durationDom),f.hide(this.timeDom),f.hide(this.find(".time-separator")),f.show(this.find(".time-live-tag"))):(f.hide(this.find(".time-live-tag")),f.show(this.find(".time-separator")),f.show(this.durationDom),f.show(this.timeDom))}},{key:"updateTime",value:function(e){if(this.isActiving=!0,!(!e&&e!==0||e>this.duration)){if(this.mode==="flex"){this.centerCurDom.innerHTML=this.minWidthTime(f.format(e));return}this.timeDom.innerHTML=this.minWidthTime(f.format(e))}}},{key:"minWidthTime",value:function(e){return e.split(":").map(function(i){return'<span class="time-min-width">'.concat(i,"</span>")}).join(":")}},{key:"resetActive",value:function(){var e=this,i=this.player,n=function(){e.isActiving=!1};this.off(se,n),i.isSeeking&&i.media.seeking?this.once(se,n):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class="xgplayer-time">
97
+ </xg-icon>`)}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch(function(i){})}catch{}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch(function(e){})}catch{}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}(ke),Jr=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.isActiving=!1,e}return S(r,[{key:"duration",get:function(){var e=this.player,i=e.offsetDuration,n=e.duration;return this.playerConfig.customDuration||i||n}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this,i=this.player.controls.config.mode;this.mode=i==="flex"?"flex":"normal",!this.config.disable&&(this.mode==="flex"&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.on([ce,se,X],function(n){n.eventName==="durationchange"&&(e.isActiving=!1),e.onTimeUpdate()}),this.on(me,function(){e.onTimeUpdate(!0)}),this.on(ye,function(){e.onReset()}))}},{key:"show",value:function(e){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="block"),this.centerDurDom&&(this.centerDurDom.style.display="block");return}this.root.style.display="block"}},{key:"hide",value:function(){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="none"),this.centerDurDom&&(this.centerDurDom.style.display="none");return}this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var i=this.player,n=this.config,s=this.duration;if(!(n.disable||this.isActiving||!i.hasStart)){var l=this.currentTime+this.timeOffset;l=f.adjustTimeByDuration(l,s,e),this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime(f.format(l)),s!==1/0&&s>0&&(this.centerDurDom.innerHTML=f.format(s))):(this.timeDom.innerHTML=this.minWidthTime(f.format(l)),s!==1/0&&s>0&&(this.durationDom.innerHTML=f.format(s)))}}},{key:"onReset",value:function(){this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime(f.format(0)),this.centerDurDom.innerHTML=f.format(0)):(this.timeDom.innerHTML=this.minWidthTime(f.format(0)),this.durationDom.innerHTML=f.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(!(!e.controls||!e.controls.center)){var i=e.controls.center;this.centerCurDom=f.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=f.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),i.children.length>0?i.insertBefore(this.centerCurDom,i.children[0]):i.appendChild(this.centerCurDom),i.appendChild(this.centerDurDom)}}},{key:"afterPlayerInit",value:function(){var e=this.config;if(this.duration===1/0||this.playerConfig.isLive?(f.hide(this.durationDom),f.hide(this.timeDom),f.hide(this.find(".time-separator")),f.show(this.find(".time-live-tag"))):f.hide(this.find(".time-live-tag")),e.hide){this.hide();return}this.show()}},{key:"changeLiveState",value:function(e){e?(f.hide(this.durationDom),f.hide(this.timeDom),f.hide(this.find(".time-separator")),f.show(this.find(".time-live-tag"))):(f.hide(this.find(".time-live-tag")),f.show(this.find(".time-separator")),f.show(this.durationDom),f.show(this.timeDom))}},{key:"updateTime",value:function(e){if(this.isActiving=!0,!(!e&&e!==0||e>this.duration)){if(this.mode==="flex"){this.centerCurDom.innerHTML=this.minWidthTime(f.format(e));return}this.timeDom.innerHTML=this.minWidthTime(f.format(e))}}},{key:"minWidthTime",value:function(e){return e.split(":").map(function(i){return'<span class="time-min-width">'.concat(i,"</span>")}).join(":")}},{key:"resetActive",value:function(){var e=this,i=this.player,n=function(){e.isActiving=!1};this.off(se,n),i.isSeeking&&i.media.seeking?this.once(se,n):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class="xgplayer-time">
98
98
  <span class="time-current">00:00</span>
99
99
  <span class="time-separator">/</span>
100
100
  <span class="time-duration">00:00</span>
101
101
  <span class="time-live-tag">`.concat(this.i18n.LIVE_TIP,`</span>
102
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:2,disable:!1}}}]),r}(F),es=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onDurationChange",function(){t.updateSegments();var s=t.player,l=s.currentTime,u=s.timeSegments;if(t._checkIfEnabled(u)){var c=f.getIndexByTime(l,u),h=f.getOffsetCurrentTime(l,u,c);t.player.offsetCurrentTime=h,t.changeIndex(c,u)}}),_(m(t),"_onLoadedData",function(){var s=t.player.timeSegments;if(t._checkIfEnabled(s)){var l=f.getOffsetCurrentTime(0,s);t.player.offsetCurrentTime=l,t.changeIndex(0,s),t.curPos.start>0&&(t.player.currentTime=t.curPos.start)}}),_(m(t),"_onTimeupdate",function(){var s=t.player,l=s.currentTime,u=s.timeSegments;if(t._checkIfEnabled(u)){var c=u.length;t.lastCurrentTime=l;var h=f.getIndexByTime(l,u);h!==t.curIndex&&t.changeIndex(h,u);var d=f.getOffsetCurrentTime(l,u,h);if(t.player.offsetCurrentTime=d,!!t.curPos){var g=t.curPos,v=g.start,y=g.end;l<v?t.player.currentTime=v:l>y&&h>=c-1&&t.player.pause()}}}),_(m(t),"_onSeeking",function(){var s=t.player,l=s.currentTime,u=s.timeSegments;if(t._checkIfEnabled(u))if(l<u[0].start)t.player.currentTime=u[0].start;else if(l>u[u.length-1].end)t.player.currentTime=u[u.length-1].end;else{var c=f.getIndexByTime(l,u);if(c>=0){var h=t.getSeekTime(l,t.lastCurrentTime,c,u);h>=0&&(t.player.currentTime=h)}}}),_(m(t),"_onPlay",function(){var s=t.player,l=s.currentTime,u=s.timeSegments;t._checkIfEnabled(u)&&l>=u[u.length-1].end&&(t.player.currentTime=u[0].start)}),t}return S(r,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(ce,this._onDurationChange),this.on(ae,this._onLoadedData),this.on(X,this._onTimeupdate),this.on(Ve,this._onSeeking),this.on($,this._onPlay)}},{key:"setConfig",value:function(e){var i=this;if(e){var n=Object.keys(e);n.length<1||(n.forEach(function(s){i.config[s]=e[s]}),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,i=e.disable,n=e.segments,s=this.player;if(i||!n||n.length===0)s.timeSegments=[],s.offsetDuration=0,s.offsetCurrentTime=-1;else{var l=this.formatTimeSegments(n,s.duration);s.timeSegments=l,s.offsetDuration=l.length>0?l[l.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,i){var n=[];return e?(e.sort(function(s,l){return s.start-l.start}),e.forEach(function(s,l){var u={};if(u.start=s.start<0?0:s.start,u.end=i>0&&s.end>i?i:s.end,!(i>0&&u.start>i)){n.push(u);var c=u.end-u.start;if(l===0)u.offset=s.start,u.cTime=0,u.segDuration=c,u.duration=c;else{var h=n[l-1];u.offset=h.offset+(u.start-h.end),u.cTime=h.duration+h.cTime,u.segDuration=c,u.duration=h.duration+c}}}),n):[]}},{key:"getSeekTime",value:function(e,i,n,s){var l=-1,u=s[n],c=u.start,h=u.end;if(e>=c&&e<=h)return l;var d=e-i;if(d<0&&e<c){var g=i>c?i-c:0;return l=n-1>=0?s[n-1].end+d+g:0,l}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,i){this.curIndex=e,e>=0&&i.length>0?this.curPos=i[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),r}(he);function ts(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
102
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:2,disable:!1}}}]),r}(F),Qr=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_onDurationChange",function(){t.updateSegments();var s=t.player,l=s.currentTime,u=s.timeSegments;if(t._checkIfEnabled(u)){var c=f.getIndexByTime(l,u),h=f.getOffsetCurrentTime(l,u,c);t.player.offsetCurrentTime=h,t.changeIndex(c,u)}}),_(m(t),"_onLoadedData",function(){var s=t.player.timeSegments;if(t._checkIfEnabled(s)){var l=f.getOffsetCurrentTime(0,s);t.player.offsetCurrentTime=l,t.changeIndex(0,s),t.curPos.start>0&&(t.player.currentTime=t.curPos.start)}}),_(m(t),"_onTimeupdate",function(){var s=t.player,l=s.currentTime,u=s.timeSegments;if(t._checkIfEnabled(u)){var c=u.length;t.lastCurrentTime=l;var h=f.getIndexByTime(l,u);h!==t.curIndex&&t.changeIndex(h,u);var d=f.getOffsetCurrentTime(l,u,h);if(t.player.offsetCurrentTime=d,!!t.curPos){var g=t.curPos,v=g.start,y=g.end;l<v?t.player.currentTime=v:l>y&&h>=c-1&&t.player.pause()}}}),_(m(t),"_onSeeking",function(){var s=t.player,l=s.currentTime,u=s.timeSegments;if(t._checkIfEnabled(u))if(l<u[0].start)t.player.currentTime=u[0].start;else if(l>u[u.length-1].end)t.player.currentTime=u[u.length-1].end;else{var c=f.getIndexByTime(l,u);if(c>=0){var h=t.getSeekTime(l,t.lastCurrentTime,c,u);h>=0&&(t.player.currentTime=h)}}}),_(m(t),"_onPlay",function(){var s=t.player,l=s.currentTime,u=s.timeSegments;t._checkIfEnabled(u)&&l>=u[u.length-1].end&&(t.player.currentTime=u[0].start)}),t}return S(r,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(ce,this._onDurationChange),this.on(ae,this._onLoadedData),this.on(X,this._onTimeupdate),this.on(Ve,this._onSeeking),this.on($,this._onPlay)}},{key:"setConfig",value:function(e){var i=this;if(e){var n=Object.keys(e);n.length<1||(n.forEach(function(s){i.config[s]=e[s]}),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,i=e.disable,n=e.segments,s=this.player;if(i||!n||n.length===0)s.timeSegments=[],s.offsetDuration=0,s.offsetCurrentTime=-1;else{var l=this.formatTimeSegments(n,s.duration);s.timeSegments=l,s.offsetDuration=l.length>0?l[l.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,i){var n=[];return e?(e.sort(function(s,l){return s.start-l.start}),e.forEach(function(s,l){var u={};if(u.start=s.start<0?0:s.start,u.end=i>0&&s.end>i?i:s.end,!(i>0&&u.start>i)){n.push(u);var c=u.end-u.start;if(l===0)u.offset=s.start,u.cTime=0,u.segDuration=c,u.duration=c;else{var h=n[l-1];u.offset=h.offset+(u.start-h.end),u.cTime=h.duration+h.cTime,u.segDuration=c,u.duration=h.duration+c}}}),n):[]}},{key:"getSeekTime",value:function(e,i,n,s){var l=-1,u=s[n],c=u.start,h=u.end;if(e>=c&&e<=h)return l;var d=e-i;if(d<0&&e<c){var g=i>c?i-c:0;return l=n-1>=0?s[n-1].end+d+g:0,l}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,i){this.curIndex=e,e>=0&&i.length>0?this.curPos=i[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),r}(he);function es(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
103
103
  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>
104
104
  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>
105
105
  </svg>
106
- `,"image/svg+xml").firstChild}function is(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
106
+ `,"image/svg+xml").firstChild}function ts(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
107
107
  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>
108
108
  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>
109
109
  </svg>
110
- `,"image/svg+xml").firstChild}function ns(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
110
+ `,"image/svg+xml").firstChild}function is(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
111
111
  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>
112
112
  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>
113
113
  </svg>
114
- `,"image/svg+xml").firstChild}var rs=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onBarMousedown",function(s){var l=m(t),u=l.player,c=t.find(".xgplayer-bar");f.event(s);var h=c.getBoundingClientRect(),d=f.getEventPos(s,u.zoom),g=h.height-(d.clientY-h.top);if(d.h=g,d.barH=h.height,t.pos=d,!(g<-2))return t.updateVolumePos(g,s),document.addEventListener("mouseup",t.onBarMouseUp),t._d.isStart=!0,!1}),_(m(t),"onBarMouseMove",function(s){var l=m(t),u=l._d;if(u.isStart){var c=m(t),h=c.pos,d=c.player;s.preventDefault(),s.stopPropagation(),f.event(s);var g=f.getEventPos(s,d.zoom);u.isMoving=!0;var v=h.h-g.clientY+h.clientY;v>h.barH||t.updateVolumePos(v,s)}}),_(m(t),"onBarMouseUp",function(s){f.event(s),document.removeEventListener("mouseup",t.onBarMouseUp);var l=m(t),u=l._d;u.isStart=!1,u.isMoving=!1}),_(m(t),"onMouseenter",function(s){t._d.isActive=!0,t.focus(),t.emit("icon_mouseenter",{pluginName:t.pluginName})}),_(m(t),"onMouseleave",function(s){t._d.isActive=!1,t.unFocus(100,!1,s),t.emit("icon_mouseleave",{pluginName:t.pluginName})}),_(m(t),"onVolumeChange",function(s){if(t.player){var l=t.player,u=l.muted,c=l.volume;t._d.isMoving||(t.find(".xgplayer-drag").style.height=u||c===0?"4px":"".concat(c*100,"%"),t.config.showValueLabel&&t.updateVolumeValue()),t.animate(u,c)}}),t}return S(r,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:is,class:"xg-volume-small"},volumeLarge:{icon:ts,class:"xg-volume"},volumeMuted:{icon:ns,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var i=this.playerConfig,n=i.commonStyle,s=i.volume;n.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=n.volumeColor),this.changeMutedHandler=this.hook("mutedChange",function(l){e.changeMuted(l)},{pre:function(u){u.preventDefault(),u.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),D.device!=="mobile"&&this.playerConfig.isMobileSimulateMode!=="mobile"&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(ti,this.onVolumeChange),this.once(ae,this.onVolumeChange),f.typeOf(s)!=="Number"&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,i){var n=this.player,s=this.find(".xgplayer-drag"),l=this.find(".xgplayer-bar");if(!(!l||!s)){var u=parseInt(e/l.getBoundingClientRect().height*1e3,10);s.style.height="".concat(e,"px");var c=Math.max(Math.min(u/1e3,1),0),h={volume:{from:n.volume,to:c}};n.muted&&(h.muted={from:!0,to:!1}),this.emitUserAction(i,"change_volume",{muted:n.muted,volume:n.volume,props:h}),n.volume=Math.max(Math.min(u/1e3,1),0),n.muted&&(n.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,i=e.volume,n=e.muted,s=this.find(".xgplayer-value-label"),l=Math.max(Math.min(i,1),0);s.innerText=n?0:Math.round(l*100)}},{key:"focus",value:function(){var e=this.player;e.focus({autoHide:!1}),this._timerId&&(f.clearTimeout(this,this._timerId),this._timerId=null),f.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2?arguments[2]:void 0,l=this._d,u=this.player;l.isActive||(this._timerId&&(f.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=f.setTimeout(this,function(){l.isActive||(n?u.blur():u.focus(),f.removeClass(e.root,"slide-show"),l.isStart&&e.onBarMouseUp(s)),e._timerId=null},i))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var i=this.player,n=this._d;n.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:i.muted,volume:i.volume,props:{muted:{from:i.muted,to:!i.muted}}}),i.volume>0&&(i.muted=!i.muted),i.volume<.01&&(i.volume=this.config.miniVolume)}},{key:"animate",value:function(e,i){e||i===0?this.setAttr("data-state","mute"):i<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(f.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon",D.device==="mobile"?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,i=this.config.showValueLabel;return`
114
+ `,"image/svg+xml").firstChild}var ns=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onBarMousedown",function(s){var l=m(t),u=l.player,c=t.find(".xgplayer-bar");f.event(s);var h=c.getBoundingClientRect(),d=f.getEventPos(s,u.zoom),g=h.height-(d.clientY-h.top);if(d.h=g,d.barH=h.height,t.pos=d,!(g<-2))return t.updateVolumePos(g,s),document.addEventListener("mouseup",t.onBarMouseUp),t._d.isStart=!0,!1}),_(m(t),"onBarMouseMove",function(s){var l=m(t),u=l._d;if(u.isStart){var c=m(t),h=c.pos,d=c.player;s.preventDefault(),s.stopPropagation(),f.event(s);var g=f.getEventPos(s,d.zoom);u.isMoving=!0;var v=h.h-g.clientY+h.clientY;v>h.barH||t.updateVolumePos(v,s)}}),_(m(t),"onBarMouseUp",function(s){f.event(s),document.removeEventListener("mouseup",t.onBarMouseUp);var l=m(t),u=l._d;u.isStart=!1,u.isMoving=!1}),_(m(t),"onMouseenter",function(s){t._d.isActive=!0,t.focus(),t.emit("icon_mouseenter",{pluginName:t.pluginName})}),_(m(t),"onMouseleave",function(s){t._d.isActive=!1,t.unFocus(100,!1,s),t.emit("icon_mouseleave",{pluginName:t.pluginName})}),_(m(t),"onVolumeChange",function(s){if(t.player){var l=t.player,u=l.muted,c=l.volume;t._d.isMoving||(t.find(".xgplayer-drag").style.height=u||c===0?"4px":"".concat(c*100,"%"),t.config.showValueLabel&&t.updateVolumeValue()),t.animate(u,c)}}),t}return S(r,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:ts,class:"xg-volume-small"},volumeLarge:{icon:es,class:"xg-volume"},volumeMuted:{icon:is,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var i=this.playerConfig,n=i.commonStyle,s=i.volume;n.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=n.volumeColor),this.changeMutedHandler=this.hook("mutedChange",function(l){e.changeMuted(l)},{pre:function(u){u.preventDefault(),u.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),D.device!=="mobile"&&this.playerConfig.isMobileSimulateMode!=="mobile"&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(ti,this.onVolumeChange),this.once(ae,this.onVolumeChange),f.typeOf(s)!=="Number"&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,i){var n=this.player,s=this.find(".xgplayer-drag"),l=this.find(".xgplayer-bar");if(!(!l||!s)){var u=parseInt(e/l.getBoundingClientRect().height*1e3,10);s.style.height="".concat(e,"px");var c=Math.max(Math.min(u/1e3,1),0),h={volume:{from:n.volume,to:c}};n.muted&&(h.muted={from:!0,to:!1}),this.emitUserAction(i,"change_volume",{muted:n.muted,volume:n.volume,props:h}),n.volume=Math.max(Math.min(u/1e3,1),0),n.muted&&(n.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,i=e.volume,n=e.muted,s=this.find(".xgplayer-value-label"),l=Math.max(Math.min(i,1),0);s.innerText=n?0:Math.round(l*100)}},{key:"focus",value:function(){var e=this.player;e.focus({autoHide:!1}),this._timerId&&(f.clearTimeout(this,this._timerId),this._timerId=null),f.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2?arguments[2]:void 0,l=this._d,u=this.player;l.isActive||(this._timerId&&(f.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=f.setTimeout(this,function(){l.isActive||(n?u.blur():u.focus(),f.removeClass(e.root,"slide-show"),l.isStart&&e.onBarMouseUp(s)),e._timerId=null},i))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var i=this.player,n=this._d;n.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:i.muted,volume:i.volume,props:{muted:{from:i.muted,to:!i.muted}}}),i.volume>0&&(i.muted=!i.muted),i.volume<.01&&(i.volume=this.config.miniVolume)}},{key:"animate",value:function(e,i){e||i===0?this.setAttr("data-state","mute"):i<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(f.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon",D.device==="mobile"?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,i=this.config.showValueLabel;return`
115
115
  <xg-icon class="xgplayer-volume" data-state="normal">
116
116
  <div class="xgplayer-icon">
117
117
  </div>
@@ -121,7 +121,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
121
121
  <xg-drag class="xgplayer-drag" style="height: `).concat(e*100,`%"></xg-drag>
122
122
  </div>
123
123
  </xg-slider>
124
- </xg-icon>`)}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}(F);function ss(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">
124
+ </xg-icon>`)}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}(F);function rs(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">
125
125
  <g clip-path="url(#clip0)">
126
126
  <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>
127
127
  <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>
@@ -132,41 +132,41 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
132
132
  </clipPath>
133
133
  </defs>
134
134
  </svg>
135
- `,"image/svg+xml").firstChild}var os=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.rotateDeg=e.config.rotateDeg||0,e}return S(r,[{key:"afterCreate",value:function(){var e=this;if(!this.config.disable){A(I(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(fe,function(){e.rotateDeg&&e.config.innerRotate&&f.setTimeout(e,function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)},100)});var i=this.player.root;this.rootWidth=i.style.width||i.offsetWidth||i.clientWidth,this.rootHeight=i.style.height||i.offsetHeight||i.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,i){if(e||(e=0),i){this.player.videoRotateDeg=e;return}var n=this.player,s=this.rootWidth,l=this.rootHeight,u=n.root,c=n.innerContainer,h=n.media,d=u.offsetWidth,g=c&&i?c.offsetHeight:u.offsetHeight,v=s,y=l,C=0,b=0;(e===.75||e===.25)&&(v="".concat(g,"px"),y="".concat(d,"px"),C=-(g-d)/2,b=-(d-g)/2);var w="translate(".concat(C,"px,").concat(b,"px) rotate(").concat(e,"turn)"),T={transformOrigin:"center center",transform:w,webKitTransform:w,height:y,width:v},B=i?h:u,O=i?n.getPlugin("poster"):null;Object.keys(T).map(function(U){B.style[U]=T[U],O&&O.root&&(O.root.style[U]=T[U])})}},{key:"rotate",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.player;this.rotateDeg||(this.rotateDeg=0);var l=e?1:-1;this.rotateDeg=(this.rotateDeg+1+l*.25*n)%1,this.updateRotateDeg(this.rotateDeg,i),s.emit(ui,this.rotateDeg*360)}},{key:"registerIcons",value:function(){return{rotate:ss}}},{key:"render",value:function(){if(!this.config.disable)return`
135
+ `,"image/svg+xml").firstChild}var ss=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.rotateDeg=e.config.rotateDeg||0,e}return S(r,[{key:"afterCreate",value:function(){var e=this;if(!this.config.disable){A(I(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(fe,function(){e.rotateDeg&&e.config.innerRotate&&f.setTimeout(e,function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)},100)});var i=this.player.root;this.rootWidth=i.style.width||i.offsetWidth||i.clientWidth,this.rootHeight=i.style.height||i.offsetHeight||i.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,i){if(e||(e=0),i){this.player.videoRotateDeg=e;return}var n=this.player,s=this.rootWidth,l=this.rootHeight,u=n.root,c=n.innerContainer,h=n.media,d=u.offsetWidth,g=c&&i?c.offsetHeight:u.offsetHeight,v=s,y=l,C=0,b=0;(e===.75||e===.25)&&(v="".concat(g,"px"),y="".concat(d,"px"),C=-(g-d)/2,b=-(d-g)/2);var w="translate(".concat(C,"px,").concat(b,"px) rotate(").concat(e,"turn)"),T={transformOrigin:"center center",transform:w,webKitTransform:w,height:y,width:v},B=i?h:u,O=i?n.getPlugin("poster"):null;Object.keys(T).map(function(U){B.style[U]=T[U],O&&O.root&&(O.root.style[U]=T[U])})}},{key:"rotate",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.player;this.rotateDeg||(this.rotateDeg=0);var l=e?1:-1;this.rotateDeg=(this.rotateDeg+1+l*.25*n)%1,this.updateRotateDeg(this.rotateDeg,i),s.emit(ui,this.rotateDeg*360)}},{key:"registerIcons",value:function(){return{rotate:rs}}},{key:"render",value:function(){if(!this.config.disable)return`
136
136
  <xg-icon class="xgplayer-rotate">
137
137
  <div class="xgplayer-icon">
138
138
  </div>
139
139
  `.concat(pe(this,"ROTATE_TIPS",this.playerConfig.isHideTips),`
140
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),r}(ke);function as(){return new DOMParser().parseFromString(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
140
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),r}(ke);function os(){return new DOMParser().parseFromString(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
141
141
  <path fill-rule="evenodd" clip-rule="evenodd"
142
142
  d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"
143
143
  fill="white" />
144
- </svg>`,"image/svg+xml").firstChild}function ls(){return new DOMParser().parseFromString(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
144
+ </svg>`,"image/svg+xml").firstChild}function as(){return new DOMParser().parseFromString(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
145
145
  <path fill-rule="evenodd" clip-rule="evenodd"
146
146
  d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"
147
147
  fill="white" />
148
148
  <path fill-rule="evenodd" clip-rule="evenodd"
149
149
  d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"
150
150
  fill="white" />
151
- </svg>`,"image/svg+xml").firstChild}var Pe={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"},us=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"switchPIP",function(s){if(!t.isPIPAvailable())return!1;s.stopPropagation&&s.stopPropagation(),t.isPip?(t.exitPIP(),t.emitUserAction(s,"change_pip",{props:"pip",from:!0,to:!1}),t.setAttr("data-state","normal")):t.player.media.readyState===4&&(t.requestPIP(),t.emitUserAction(s,"change_pip",{props:"pip",from:!1,to:!0}),t.setAttr("data-state","pip"))}),t}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.pip=="boolean"&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(A(I(r.prototype),"afterCreate",this).call(this),this.pMode=Pe.INLINE,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(ze,function(){e.config.showIcon&&(f.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))}))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:as,class:"xg-get-pip"},pipIconExit:{icon:ls,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var e=this,i=this.player;this.leavePIPCallback=function(){var n=i.paused;f.setTimeout(e,function(){!n&&i.mediaPlay()},0),!n&&i.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,i.emit(Et,!1)},this.enterPIPCallback=function(n){i.emit(Et,!0),n!=null&&n.pictureInPictureWindow&&(e.pipWindow=n.pictureInPictureWindow),e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(n){var s=i.media.webkitPresentationMode;e.pMode===Pe.FULLSCREEN&&s!==Pe.FULLSCREEN&&i.onFullscreenChange(null,!1),e.pMode=s,s===Pe.PIP?e.enterPIPCallback(n):s===Pe.INLINE&&e.leavePIPCallback(n)},i.media&&(i.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),i.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),r.checkWebkitSetPresentationMode(i.media)&&i.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"copyStyleIntoPiPWindow",value:function(e){var i=J(document.styleSheets).map(function(s){try{return J(s.cssRules).map(function(u){return u.cssText}).join("")}catch{var l=document.createElement("link");l.rel="stylesheet",l.type=s.type,l.media=s.media,l.href=s.href,e.document.head.appendChild(l)}return""}).filter(Boolean).join(`
151
+ </svg>`,"image/svg+xml").firstChild}var Pe={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"},ls=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"switchPIP",function(s){if(!t.isPIPAvailable())return!1;s.stopPropagation&&s.stopPropagation(),t.isPip?(t.exitPIP(),t.emitUserAction(s,"change_pip",{props:"pip",from:!0,to:!1}),t.setAttr("data-state","normal")):t.player.media.readyState===4&&(t.requestPIP(),t.emitUserAction(s,"change_pip",{props:"pip",from:!1,to:!0}),t.setAttr("data-state","pip"))}),t}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.pip=="boolean"&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(A(I(r.prototype),"afterCreate",this).call(this),this.pMode=Pe.INLINE,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(ze,function(){e.config.showIcon&&(f.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))}))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:os,class:"xg-get-pip"},pipIconExit:{icon:as,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var e=this,i=this.player;this.leavePIPCallback=function(){var n=i.paused;f.setTimeout(e,function(){!n&&i.mediaPlay()},0),!n&&i.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,i.emit(wt,!1)},this.enterPIPCallback=function(n){i.emit(wt,!0),n!=null&&n.pictureInPictureWindow&&(e.pipWindow=n.pictureInPictureWindow),e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(n){var s=i.media.webkitPresentationMode;e.pMode===Pe.FULLSCREEN&&s!==Pe.FULLSCREEN&&i.onFullscreenChange(null,!1),e.pMode=s,s===Pe.PIP?e.enterPIPCallback(n):s===Pe.INLINE&&e.leavePIPCallback(n)},i.media&&(i.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),i.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),r.checkWebkitSetPresentationMode(i.media)&&i.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"copyStyleIntoPiPWindow",value:function(e){var i=J(document.styleSheets).map(function(s){try{return J(s.cssRules).map(function(u){return u.cssText}).join("")}catch{var l=document.createElement("link");l.rel="stylesheet",l.type=s.type,l.media=s.media,l.href=s.href,e.document.head.appendChild(l)}return""}).filter(Boolean).join(`
152
152
  `),n=document.createElement("style");n.textContent=i,e.document.head.appendChild(n)}},{key:"requestPIP",value:function(){var e=this,i=this.player,n=this.playerConfig,s=this.config;if(!(!this.isPIPAvailable()||this.isPip))try{var l=n.poster;if(l&&(i.media.poster=f.typeOf(l)==="String"?l:l.poster),s.preferDocument&&this.isDocPIPAvailable()){var u={};if(s.width&&s.height)u.width=s.width,u.height=s.height;else{var c=i.root.getBoundingClientRect();u.width=c.width,u.height=c.height}documentPictureInPicture.requestWindow(u).then(function(h){var d=s.docPiPNode,g=s.docPiPStyle;e.enterPIPCallback();var v=d||i.root,y=v.parentElement,C=v.previousSibling,b=v.nextSibling;e.copyStyleIntoPiPWindow(h);var w=document.createElement("style");if(w.append("body{padding:0; margin:0;}"),g){var T="";typeof g=="string"?T=g:typeof g=="function"&&(T=g.call(s)),T&&w.append(T)}else v===i.root&&w.append(`
153
153
  .xgplayer{width: 100%!important; height: 100%!important;}
154
154
  `);h.document.head.append(w),h.document.body.append(v),h.addEventListener("pagehide",function(B){y&&(b?y.insertBefore(v,b):C?y.insertBefore(v,C.nextSibling):y.appendChild(v)),e.leavePIPCallback()},{once:!0})})}else r.checkWebkitSetPresentationMode(i.media)?i.media.webkitSetPresentationMode("picture-in-picture"):i.media.requestPictureInPicture();return!0}catch(h){return console.error("requestPiP",h),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{if(this.isPIPAvailable()&&this.isPip){var i;this.isDocPIPAvailable()&&(i=documentPictureInPicture)!==null&&i!==void 0&&i.window?documentPictureInPicture.window.close():r.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture()}return!0}catch(n){return console.error("exitPIP",n),!1}}},{key:"isPip",get:function(){var e,i=this.player;return!!(this.isDocPIPAvailable()&&(e=documentPictureInPicture)!==null&&e!==void 0&&e.window)||document.pictureInPictureElement&&document.pictureInPictureElement===i.media||i.media.webkitPresentationMode===Pe.PIP}},{key:"isPIPAvailable",value:function(){var e=this.player.media,i=f.typeOf(document.pictureInPictureEnabled)==="Boolean"?document.pictureInPictureEnabled:!0;return i&&(f.typeOf(e.disablePictureInPicture)==="Boolean"&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&f.typeOf(e.webkitSetPresentationMode)==="Function")||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return"documentPictureInPicture"in window&&/^(https|file)/.test(location.protocol)}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this);var e=this.player;e.media.removeEventListener("enterpictureinpicture",this.enterPIPCallback),e.media.removeEventListener("leavepictureinpicture",this.leavePIPCallback),r.checkWebkitSetPresentationMode(e.media)&&e.media.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.exitPIP(),this.unbind("click",this.btnClick)}},{key:"render",value:function(){if(!(!this.config.showIcon||!this.isPIPAvailable()))return`<xg-icon class="xgplayer-pip">
155
155
  <div class="xgplayer-icon xg-icon-disable">
156
156
  </div>
157
157
  `.concat(pe(this,"PIP",this.playerConfig.isHideTips),`
158
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return typeof e.webkitSetPresentationMode=="function"}}]),r}(ke);function cs(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">
158
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return typeof e.webkitSetPresentationMode=="function"}}]),r}(ke);function us(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">
159
159
  <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>
160
160
  </svg>
161
- `,"image/svg+xml").firstChild}var fs=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"playNext",function(i){var n=m(e),s=n.player;i.preventDefault(),i.stopPropagation(),e.idx+1<e.config.urlList.length?(e.idx++,e.nextHandler(e.config.urlList[e.idx],e.idx),s.emit(Ye,e.idx+1)):(e.nextHandler(),s.emit(Ye))}),e.idx=-1,e}return S(r,[{key:"afterCreate",value:function(){!this.config.urlList||this.config.urlList.length===0||(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:cs}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e=D.device==="mobile"?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var i=this.player;e&&(i.pause(),i.currentTime=0,i.switchURL?i.switchURL(e):i.src=e,i.config.url=e,i.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(!(!this.config.urlList||this.config.urlList.length===0))return`
161
+ `,"image/svg+xml").firstChild}var cs=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"playNext",function(i){var n=m(e),s=n.player;i.preventDefault(),i.stopPropagation(),e.idx+1<e.config.urlList.length?(e.idx++,e.nextHandler(e.config.urlList[e.idx],e.idx),s.emit(Ye,e.idx+1)):(e.nextHandler(),s.emit(Ye))}),e.idx=-1,e}return S(r,[{key:"afterCreate",value:function(){!this.config.urlList||this.config.urlList.length===0||(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:us}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e=D.device==="mobile"?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var i=this.player;e&&(i.pause(),i.currentTime=0,i.switchURL?i.switchURL(e):i.src=e,i.config.url=e,i.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(!(!this.config.urlList||this.config.urlList.length===0))return`
162
162
  <xg-icon class="xgplayer-playnext">
163
163
  <div class="xgplayer-icon">
164
164
  </div>
165
165
  `.concat(pe(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),`
166
166
  </xg-icon>
167
- `)}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),r}(F),Wi={exports:{}};(function(a,o){(function(r,t){a.exports=t()})(yn,function(){return function r(t,e,i){var n=window,s="application/octet-stream",l=i||s,u=t,c=!e&&!i&&u,h=document.createElement("a"),d=function(L){return String(L)},g=n.Blob||n.MozBlob||n.WebKitBlob||d,v=e||"download",y,C;if(g=g.call?g.bind(n):Blob,String(this)==="true"&&(u=[u,l],l=u[0],u=u[1]),c&&c.length<2048&&(v=c.split("/").pop().split("?")[0],h.href=c,h.href.indexOf(c)!==-1)){var b=new XMLHttpRequest;return b.open("GET",c,!0),b.responseType="blob",b.onload=function(L){r(L.target.response,v,s)},setTimeout(function(){b.send()},0),b}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(u))if(u.length>1024*1024*1.999&&g!==d)u=O(u),l=u.type||s;else return navigator.msSaveBlob?navigator.msSaveBlob(O(u),v):U(u);else if(/([\x80-\xff])/.test(u)){var w=0,T=new Uint8Array(u.length),B=T.length;for(w;w<B;++w)T[w]=u.charCodeAt(w);u=new g([T],{type:l})}y=u instanceof g?u:new g([u],{type:l});function O(L){var Y=L.split(/[:;,]/),j=Y[1],N=Y[2]=="base64"?atob:decodeURIComponent,Z=N(Y.pop()),ee=Z.length,te=0,Te=new Uint8Array(ee);for(te;te<ee;++te)Te[te]=Z.charCodeAt(te);return new g([Te],{type:j})}function U(L,Y){if("download"in h)return h.href=L,h.setAttribute("download",v),h.className="download-js-link",h.innerHTML="downloading...",h.style.display="none",document.body.appendChild(h),setTimeout(function(){h.click(),document.body.removeChild(h),Y===!0&&setTimeout(function(){n.URL.revokeObjectURL(h.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(L)&&(L="data:"+L.replace(/^data:([\w\/\-\+]+)/,s)),window.open(L)||confirm(`Displaying New Document
167
+ `)}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),r}(F),Wi={exports:{}};(function(a,o){(function(r,t){a.exports=t()})(mn,function(){return function r(t,e,i){var n=window,s="application/octet-stream",l=i||s,u=t,c=!e&&!i&&u,h=document.createElement("a"),d=function(L){return String(L)},g=n.Blob||n.MozBlob||n.WebKitBlob||d,v=e||"download",y,C;if(g=g.call?g.bind(n):Blob,String(this)==="true"&&(u=[u,l],l=u[0],u=u[1]),c&&c.length<2048&&(v=c.split("/").pop().split("?")[0],h.href=c,h.href.indexOf(c)!==-1)){var b=new XMLHttpRequest;return b.open("GET",c,!0),b.responseType="blob",b.onload=function(L){r(L.target.response,v,s)},setTimeout(function(){b.send()},0),b}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(u))if(u.length>1024*1024*1.999&&g!==d)u=O(u),l=u.type||s;else return navigator.msSaveBlob?navigator.msSaveBlob(O(u),v):U(u);else if(/([\x80-\xff])/.test(u)){var w=0,T=new Uint8Array(u.length),B=T.length;for(w;w<B;++w)T[w]=u.charCodeAt(w);u=new g([T],{type:l})}y=u instanceof g?u:new g([u],{type:l});function O(L){var Y=L.split(/[:;,]/),j=Y[1],N=Y[2]=="base64"?atob:decodeURIComponent,Z=N(Y.pop()),ee=Z.length,te=0,Te=new Uint8Array(ee);for(te;te<ee;++te)Te[te]=Z.charCodeAt(te);return new g([Te],{type:j})}function U(L,Y){if("download"in h)return h.href=L,h.setAttribute("download",v),h.className="download-js-link",h.innerHTML="downloading...",h.style.display="none",document.body.appendChild(h),setTimeout(function(){h.click(),document.body.removeChild(h),Y===!0&&setTimeout(function(){n.URL.revokeObjectURL(h.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(L)&&(L="data:"+L.replace(/^data:([\w\/\-\+]+)/,s)),window.open(L)||confirm(`Displaying New Document
168
168
 
169
- Use Save As... to download, then click back to return to this page.`)&&(location.href=L),!0;var j=document.createElement("iframe");document.body.appendChild(j),!Y&&/^data:/.test(L)&&(L="data:"+L.replace(/^data:([\w\/\-\+]+)/,s)),j.src=L,setTimeout(function(){document.body.removeChild(j)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(y,v);if(n.URL)U(n.URL.createObjectURL(y),!0);else{if(typeof y=="string"||y.constructor===d)try{return U("data:"+l+";base64,"+n.btoa(y))}catch{return U("data:"+l+","+encodeURIComponent(y))}C=new FileReader,C.onload=function(L){U(this.result)},C.readAsDataURL(y)}return!0}})})(Wi);var hs=Wi.exports;const ds=lt(hs);function gs(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
169
+ Use Save As... to download, then click back to return to this page.`)&&(location.href=L),!0;var j=document.createElement("iframe");document.body.appendChild(j),!Y&&/^data:/.test(L)&&(L="data:"+L.replace(/^data:([\w\/\-\+]+)/,s)),j.src=L,setTimeout(function(){document.body.removeChild(j)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(y,v);if(n.URL)U(n.URL.createObjectURL(y),!0);else{if(typeof y=="string"||y.constructor===d)try{return U("data:"+l+";base64,"+n.btoa(y))}catch{return U("data:"+l+","+encodeURIComponent(y))}C=new FileReader,C.onload=function(L){U(this.result)},C.readAsDataURL(y)}return!0}})})(Wi);var fs=Wi.exports;const hs=at(fs);function ds(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
170
170
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
171
171
  <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">
172
172
  <g id="Group-2">
@@ -180,36 +180,36 @@ Use Save As... to download, then click back to return to this page.`)&&(location
180
180
  </g>
181
181
  </g>
182
182
  </svg>
183
- `,"image/svg+xml").firstChild}var ps=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"download",function(i){if(!e.isLock){e.emitUserAction(i,"download");var n=e.playerConfig.url,s="";f.typeOf(n)==="String"?s=n:f.typeOf(n)==="Array"&&n.length>0&&(s=n[0].src);var l=e.getAbsoluteURL(s);ds(l),e.isLock=!0,e.timer=window.setTimeout(function(){e.isLock=!1,window.clearTimeout(e.timer),e.timer=null},300)}}),e.timer=null,e.isLock=!1,e}return S(r,[{key:"afterCreate",value:function(){A(I(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(i){i.preventDefault(),i.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:gs}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var i=document.createElement("div");i.innerHTML='<a href="'.concat(e,'">x</a>'),e=i.firstChild.href}return e}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class="xgplayer-download">
183
+ `,"image/svg+xml").firstChild}var gs=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"download",function(i){if(!e.isLock){e.emitUserAction(i,"download");var n=e.playerConfig.url,s="";f.typeOf(n)==="String"?s=n:f.typeOf(n)==="Array"&&n.length>0&&(s=n[0].src);var l=e.getAbsoluteURL(s);hs(l),e.isLock=!0,e.timer=window.setTimeout(function(){e.isLock=!1,window.clearTimeout(e.timer),e.timer=null},300)}}),e.timer=null,e.isLock=!1,e}return S(r,[{key:"afterCreate",value:function(){A(I(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(i){i.preventDefault(),i.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:ds}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var i=document.createElement("div");i.innerHTML='<a href="'.concat(e,'">x</a>'),e=i.firstChild.href}return e}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class="xgplayer-download">
184
184
  <div class="xgplayer-icon">
185
185
  </div>
186
186
  `.concat(pe(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),`
187
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:3,disable:!0}}}]),r}(ke),vs=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.screenShot=="boolean"&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){A(I(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(i){e.fitVideo&&(e.width=i.vWidth,e.height=i.vHeight)},this.once(fe,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,i){var n=document.createElement("a");n.href=e,n.download=i;var s;try{typeof MouseEvent<"u"?s=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null))}catch(l){console.error("MouseEvent unsupported",l)}s&&n.dispatchEvent(s)}},{key:"createCanvas",value:function(e,i){var n=document.createElement("canvas"),s=n.getContext("2d");this.canvasCtx=s,this.canvas=n,n.width=e||this.config.width,n.height=i||this.config.height,s.imageSmoothingEnabled=!0,s.imageSmoothingEnabled&&(s.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var i=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var n=this.config;this.shot(n.width,n.height).then(function(s){i.emit(ci,s),n.saveImg&&i.saveScreenShot(s,n.name+n.format)})}},{key:"shot",value:function(e,i){var n=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{quality:.92,type:"image/png"},l=this.config,u=this.player,c=s.quality||l.quality,h=s.type||l.type;return new Promise(function(d,g){var v=null,y;if(u.media.canvas)v=u.media.canvas;else{n.canvas?(n.canvas.width=e||l.width,n.canvas.height=i||l.height):n.createCanvas(e,i),v=n.canvas,y=n.canvasCtx;var C=u.media.videoWidth/u.media.videoHeight,b=v.width/v.height,w=0,T=0,B=u.media.videoWidth,O=u.media.videoHeight,U,L,Y,j;C>b?(Y=v.width,j=v.width/C,U=0,L=Math.round((v.height-j)/2)):C===b?(Y=v.width,j=v.height,U=0,L=0):C<b&&(Y=v.height*C,j=v.height,U=Math.round((v.width-Y)/2),L=0),y.drawImage(u.media,w,T,B,O,U,L,Y,j)}var N=v.toDataURL(h,c).replace(h,"image/octet-stream");N=N.replace(/^data:image\/[^;]+/,"data:application/octet-stream"),d(N)})}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(fe,this.initSize)}},{key:"render",value:function(){if(!this.config.disable){var e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",i="SCREENSHOT";return`
187
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:3,disable:!0}}}]),r}(ke),ps=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.screenShot=="boolean"&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){A(I(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(i){e.fitVideo&&(e.width=i.vWidth,e.height=i.vHeight)},this.once(fe,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,i){var n=document.createElement("a");n.href=e,n.download=i;var s;try{typeof MouseEvent<"u"?s=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null))}catch(l){console.error("MouseEvent unsupported",l)}s&&n.dispatchEvent(s)}},{key:"createCanvas",value:function(e,i){var n=document.createElement("canvas"),s=n.getContext("2d");this.canvasCtx=s,this.canvas=n,n.width=e||this.config.width,n.height=i||this.config.height,s.imageSmoothingEnabled=!0,s.imageSmoothingEnabled&&(s.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var i=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var n=this.config;this.shot(n.width,n.height).then(function(s){i.emit(ci,s),n.saveImg&&i.saveScreenShot(s,n.name+n.format)})}},{key:"shot",value:function(e,i){var n=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{quality:.92,type:"image/png"},l=this.config,u=this.player,c=s.quality||l.quality,h=s.type||l.type;return new Promise(function(d,g){var v=null,y;if(u.media.canvas)v=u.media.canvas;else{n.canvas?(n.canvas.width=e||l.width,n.canvas.height=i||l.height):n.createCanvas(e,i),v=n.canvas,y=n.canvasCtx;var C=u.media.videoWidth/u.media.videoHeight,b=v.width/v.height,w=0,T=0,B=u.media.videoWidth,O=u.media.videoHeight,U,L,Y,j;C>b?(Y=v.width,j=v.width/C,U=0,L=Math.round((v.height-j)/2)):C===b?(Y=v.width,j=v.height,U=0,L=0):C<b&&(Y=v.height*C,j=v.height,U=Math.round((v.width-Y)/2),L=0),y.drawImage(u.media,w,T,B,O,U,L,Y,j)}var N=v.toDataURL(h,c).replace(h,"image/octet-stream");N=N.replace(/^data:image\/[^;]+/,"data:application/octet-stream"),d(N)})}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(fe,this.initSize)}},{key:"render",value:function(){if(!this.config.disable){var e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",i="SCREENSHOT";return`
188
188
  <xg-icon class="xgplayer-shot">
189
189
  <div class="`.concat(e,`">
190
190
  `).concat(this.icons.screenshotIcon?"":'<span lang-key="'.concat(this.i18nKeys[i],'">').concat(this.i18n[i],"</span>"),`
191
191
  </div>
192
- </xg-icon>`)}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),r}(ke),ms=function(){function a(o){E(this,a),this.config=o.config,this.parent=o.root,this.root=f.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),o.root.appendChild(this.root);var r=this.config.maxHeight;r&&this.setStyle({maxHeight:r}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var t=this.config.domEventType==="touch"?"touchend":"click";this._delegates=F.delegate.call(this,this.root,"li",t,this.onItemClick)}return S(a,[{key:"renderItemList",value:function(r){var t=this,e=this.config,i=this.root;r?e.data=r:r=e.data,e.style&&Object.keys(e.style).map(function(n){i.style[n]=e[n]}),r.length>0&&(this.attrKeys=Object.keys(r[0])),this.root.innerHTML="",r.map(function(n,s){var l=n.selected?"option-item selected":"option-item";n["data-index"]=s,t.root.appendChild(f.createDom("li","<span>".concat(n.showText,"</span>"),n,l))})}},{key:"onItemClick",value:function(r){r.delegateTarget||(r.delegateTarget=r.target);var t=r.delegateTarget;if(t&&f.hasClass(t,"selected"))return!1;var e=typeof this.config.onItemClick=="function"?this.config.onItemClick:null,i=this.root.querySelector(".selected");f.addClass(t,"selected"),i&&f.removeClass(i,"selected"),e(r,{from:i?this.getAttrObj(i,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(r,t){if(!r||!t)return{};var e={};t.map(function(n){e[n]=r.getAttribute(n)});var i=r.getAttribute("data-index");return i&&(e.index=Number(i)),e}},{key:"show",value:function(){f.removeClass(this.root,"hide"),f.addClass(this.root,"active")}},{key:"hide",value:function(){f.removeClass(this.root,"active"),f.addClass(this.root,"hide")}},{key:"setStyle",value:function(r){var t=this;Object.keys(r).forEach(function(e){t.root.style[e]=r[e]})}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map(function(r){r.destroy&&r.destroy()}),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),a}(),re={SIDE:"side",MIDDLE:"middle",DEFAULT:"default"},Ie={CLICK:"click",HOVER:"hover"};function ys(a,o){return a===re.SIDE?o===H.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""}var be=D.device==="mobile",it=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onEnter",function(i){i.stopPropagation(),e.emit("icon_mouseenter",{pluginName:e.pluginName}),e.switchActiveState(i)}),_(m(e),"switchActiveState",function(i){i.stopPropagation();var n=e.config.toggleMode;n===Ie.CLICK?e.toggle(!e.isActive):e.toggle(!0)}),_(m(e),"onLeave",function(i){i.stopPropagation(),e.emit("icon_mouseleave",{pluginName:e.pluginName}),e.config.listType!==re.SIDE&&e.isActive&&e.toggle(!1)}),_(m(e),"onListEnter",function(i){e.enterType=2}),_(m(e),"onListLeave",function(i){e.enterType=0,e.isActive&&e.toggle(!1)}),e.isIcons=!1,e.isActive=!1,e.curValue=null,e.curIndex=0,e}return S(r,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,i=this.config;this.initIcons(),be=be||this.domEventType==="touch",be&&D.device==="mobile"&&i.listType===re.DEFAULT&&(i.listType=re.SIDE),i.hidePortrait&&f.addClass(this.root,"portrait"),this.on([fe,le],function(){e._resizeList()}),this.once(oe,function(){i.list&&i.list.length>0&&(e.renderItemList(i.list),e.show())}),be&&this.on(yt,function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)}),be?(i.toggleMode=Ie.CLICK,this.activeEvent="touchend"):this.activeEvent=i.toggleMode===Ie.CLICK?"click":"mouseenter",i.toggleMode===Ie.CLICK?this.bind(this.activeEvent,this.switchActiveState):(this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,i=this.icons,n=Object.keys(i),s=!1;n.length>0&&(n.forEach(function(l){e.appendChild(".xgplayer-icon",i[l]),!s&&(s=i[l])}),this.isIcons=s),!s&&(this.appendChild(".xgplayer-icon",f.createDom("span","",{},"icon-text")),f.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||f.addClass(this.root,"show")}},{key:"hide",value:function(){f.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,i,n){if(e===void 0)return"";var s=this.config.list;!n&&(n=this.player.lang),i=!i||f.isUndefined(e[i])?"text":i,typeof e=="number"&&(e=s[e]);try{return W(e[i])==="object"?e[i][n]||e[i].en:e[i]}catch(l){return console.warn(l),""}}},{key:"toggle",value:function(e){if(!(e===this.isActive||this.config.disable)){var i=this.player.controls,n=this.config.listType;e?(n===re.SIDE?i.blur():i.focus(),this.optionsList&&this.optionsList.show()):(n===re.SIDE?i.focus():i.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,i){e.stopPropagation();var n=this.config,s=n.listType,l=n.list;this.curIndex=i.to.index,this.curItem=l[this.curIndex],this.changeCurrentText();var u=this.config.isItemClickHide;(u||be||s===re.SIDE)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex<e.length?this.curIndex:0,n=e[i];n&&(this.find(".icon-text").innerHTML=this.getTextByLang(n,"iconText"))}}},{key:"renderItemList",value:function(e,i){var n=this,s=this.config,l=this.optionsList,u=this.player;if(typeof i=="number"&&(this.curIndex=i,this.curItem=s.list[i]),l){l.renderItemList(e),this.changeCurrentText();return}var c={config:{data:e||[],className:ys(s.listType,s.position),onItemClick:function(y,C){n.onItemClick(y,C)},domEventType:be?"touch":"mouse"},root:s.listType===re.SIDE?u.innerContainer||u.root:this.root};if(this.config.isShowIcon){var h=this.player.root.getBoundingClientRect(),d=h.height,g=s.listType===re.MIDDLE?d-50:d;g&&s.heightLimit&&(c.config.maxHeight="".concat(g,"px")),this.optionsList=new ms(c),this.changeCurrentText(),this.show()}this._resizeList()}},{key:"_resizeList",value:function(){if(this.config.heightLimit){var e=this.player.root.getBoundingClientRect(),i=e.height,n=this.config.listType===re.MIDDLE?i-50:i;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(n,"px")})}}},{key:"destroy",value:function(){var e=this.config;e.toggleMode===Ie.CLICK?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.isIcons&&this.unbind("click",this.onIconClick),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",`">
192
+ </xg-icon>`)}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),r}(ke),vs=function(){function a(o){E(this,a),this.config=o.config,this.parent=o.root,this.root=f.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),o.root.appendChild(this.root);var r=this.config.maxHeight;r&&this.setStyle({maxHeight:r}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var t=this.config.domEventType==="touch"?"touchend":"click";this._delegates=F.delegate.call(this,this.root,"li",t,this.onItemClick)}return S(a,[{key:"renderItemList",value:function(r){var t=this,e=this.config,i=this.root;r?e.data=r:r=e.data,e.style&&Object.keys(e.style).map(function(n){i.style[n]=e[n]}),r.length>0&&(this.attrKeys=Object.keys(r[0])),this.root.innerHTML="",r.map(function(n,s){var l=n.selected?"option-item selected":"option-item";n["data-index"]=s,t.root.appendChild(f.createDom("li","<span>".concat(n.showText,"</span>"),n,l))})}},{key:"onItemClick",value:function(r){r.delegateTarget||(r.delegateTarget=r.target);var t=r.delegateTarget;if(t&&f.hasClass(t,"selected"))return!1;var e=typeof this.config.onItemClick=="function"?this.config.onItemClick:null,i=this.root.querySelector(".selected");f.addClass(t,"selected"),i&&f.removeClass(i,"selected"),e(r,{from:i?this.getAttrObj(i,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(r,t){if(!r||!t)return{};var e={};t.map(function(n){e[n]=r.getAttribute(n)});var i=r.getAttribute("data-index");return i&&(e.index=Number(i)),e}},{key:"show",value:function(){f.removeClass(this.root,"hide"),f.addClass(this.root,"active")}},{key:"hide",value:function(){f.removeClass(this.root,"active"),f.addClass(this.root,"hide")}},{key:"setStyle",value:function(r){var t=this;Object.keys(r).forEach(function(e){t.root.style[e]=r[e]})}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map(function(r){r.destroy&&r.destroy()}),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),a}(),re={SIDE:"side",MIDDLE:"middle",DEFAULT:"default"},Ie={CLICK:"click",HOVER:"hover"};function ms(a,o){return a===re.SIDE?o===H.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""}var be=D.device==="mobile",it=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onEnter",function(i){i.stopPropagation(),e.emit("icon_mouseenter",{pluginName:e.pluginName}),e.switchActiveState(i)}),_(m(e),"switchActiveState",function(i){i.stopPropagation();var n=e.config.toggleMode;n===Ie.CLICK?e.toggle(!e.isActive):e.toggle(!0)}),_(m(e),"onLeave",function(i){i.stopPropagation(),e.emit("icon_mouseleave",{pluginName:e.pluginName}),e.config.listType!==re.SIDE&&e.isActive&&e.toggle(!1)}),_(m(e),"onListEnter",function(i){e.enterType=2}),_(m(e),"onListLeave",function(i){e.enterType=0,e.isActive&&e.toggle(!1)}),e.isIcons=!1,e.isActive=!1,e.curValue=null,e.curIndex=0,e}return S(r,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,i=this.config;this.initIcons(),be=be||this.domEventType==="touch",be&&D.device==="mobile"&&i.listType===re.DEFAULT&&(i.listType=re.SIDE),i.hidePortrait&&f.addClass(this.root,"portrait"),this.on([fe,le],function(){e._resizeList()}),this.once(oe,function(){i.list&&i.list.length>0&&(e.renderItemList(i.list),e.show())}),be&&this.on(mt,function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)}),be?(i.toggleMode=Ie.CLICK,this.activeEvent="touchend"):this.activeEvent=i.toggleMode===Ie.CLICK?"click":"mouseenter",i.toggleMode===Ie.CLICK?this.bind(this.activeEvent,this.switchActiveState):(this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,i=this.icons,n=Object.keys(i),s=!1;n.length>0&&(n.forEach(function(l){e.appendChild(".xgplayer-icon",i[l]),!s&&(s=i[l])}),this.isIcons=s),!s&&(this.appendChild(".xgplayer-icon",f.createDom("span","",{},"icon-text")),f.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||f.addClass(this.root,"show")}},{key:"hide",value:function(){f.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,i,n){if(e===void 0)return"";var s=this.config.list;!n&&(n=this.player.lang),i=!i||f.isUndefined(e[i])?"text":i,typeof e=="number"&&(e=s[e]);try{return W(e[i])==="object"?e[i][n]||e[i].en:e[i]}catch(l){return console.warn(l),""}}},{key:"toggle",value:function(e){if(!(e===this.isActive||this.config.disable)){var i=this.player.controls,n=this.config.listType;e?(n===re.SIDE?i.blur():i.focus(),this.optionsList&&this.optionsList.show()):(n===re.SIDE?i.focus():i.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,i){e.stopPropagation();var n=this.config,s=n.listType,l=n.list;this.curIndex=i.to.index,this.curItem=l[this.curIndex],this.changeCurrentText();var u=this.config.isItemClickHide;(u||be||s===re.SIDE)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex<e.length?this.curIndex:0,n=e[i];n&&(this.find(".icon-text").innerHTML=this.getTextByLang(n,"iconText"))}}},{key:"renderItemList",value:function(e,i){var n=this,s=this.config,l=this.optionsList,u=this.player;if(typeof i=="number"&&(this.curIndex=i,this.curItem=s.list[i]),l){l.renderItemList(e),this.changeCurrentText();return}var c={config:{data:e||[],className:ms(s.listType,s.position),onItemClick:function(y,C){n.onItemClick(y,C)},domEventType:be?"touch":"mouse"},root:s.listType===re.SIDE?u.innerContainer||u.root:this.root};if(this.config.isShowIcon){var h=this.player.root.getBoundingClientRect(),d=h.height,g=s.listType===re.MIDDLE?d-50:d;g&&s.heightLimit&&(c.config.maxHeight="".concat(g,"px")),this.optionsList=new vs(c),this.changeCurrentText(),this.show()}this._resizeList()}},{key:"_resizeList",value:function(){if(this.config.heightLimit){var e=this.player.root.getBoundingClientRect(),i=e.height,n=this.config.listType===re.MIDDLE?i-50:i;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(n,"px")})}}},{key:"destroy",value:function(){var e=this.config;e.toggleMode===Ie.CLICK?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.isIcons&&this.unbind("click",this.onIconClick),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",`">
193
193
  <div class="xgplayer-icon">
194
194
  </div>
195
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:Ie.HOVER,heightLimit:!0}}}]),r}(F),_s=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.curTime=0,e.isPaused=!0,e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.config.list;Array.isArray(i)&&i.length>0&&(e.config.list=i.map(function(n){return!n.text&&n.name&&(n.text=n.name),n.text||(n.text=n.definition),n}))}},{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this),this.on("resourceReady",function(i){e.changeDefinitionList(i)}),this.on(Tt,function(i){e.renderItemList(e.config.list,i.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||f.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,i=e.list,n=e.defaultDefinition;if(i.length>0){var s=null;i.map(function(l){l.definition===n&&(s=l)}),s||(s=i[0]),this.changeDefinition(s)}}},{key:"renderItemList",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,s=n&&n.definition?n.definition:this.config.defaultDefinition;n&&i.forEach(function(c){c.selected=!1});var l=0,u=i.map(function(c,h){var d=V(V({},c),{},{showText:e.getTextByLang(c)||c.definition,selected:!1});return(c.selected||c.definition&&c.definition==s)&&(d.selected=!0,l=h),d});A(I(r.prototype),"renderItemList",this).call(this,u,l)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map(function(i){return!i.text&&i.name&&(i.text=i.name),i.text||(i.text=i.definition),i}),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,i){this.player.changeDefinition(e,i)}},{key:"onItemClick",value:function(e,i){var n=this.player.definitionList;A(I(r.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:i.from,to:i.to});for(var s=0;s<n.length;s++)i.to&&n[s].definition===i.to.definition&&(i.to.url=n[s].url),i.from&&n[s].definition===i.from.definition&&(i.from.url=n[s].url);this.player.changeDefinition(i.to,i.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return V(V({},it.defaultConfig),{},{position:H.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),r}(it),Cs=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.curRate=1,e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.player.config.playbackRate,n=i?Array.isArray(i)?i:e.config.list:[];Array.isArray(n)&&(e.config.list=n.map(function(s){return typeof s=="number"?s={rate:s,text:"".concat(s,"x")}:!s.text&&s.rate&&(s.text="".concat(s.rate,"x")),s}))}},{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this),this.on(ii,function(){e.curValue!==e.player.playbackRate&&e.renderItemList()}),this.renderItemList()}},{key:"show",value:function(e){!this.config.list||this.config.list.length===0||A(I(r.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,i){A(I(r.prototype),"onItemClick",this).call(this,e,i);var n=e.delegateTarget,s=Number(n.getAttribute("rate"));if(!s||s===this.curValue)return!1;var l={playbackRate:{from:this.player.playbackRate,to:s}};this.emitUserAction(e,"change_rate",{props:l}),this.curValue=s,this.player.playbackRate=s}},{key:"renderItemList",value:function(){var e=this,i=this.player.playbackRate||1;this.curValue=i;var n=-1,s=this.config.list.map(function(l,u){var c={rate:l.rate};return c.rate===i&&(c.selected=!0,n=u),c.showText=e.getTextByLang(l),c});A(I(r.prototype),"renderItemList",this).call(this,s,n)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex<e.length?this.curIndex:0,n=e[i],s="";!n||this.curIndex<0?s="".concat(this.player.playbackRate,"x"):s=this.getTextByLang(n,"iconText"),this.find(".icon-text").innerHTML=s}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return V(V({},it.defaultConfig),{},{position:H.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),r}(it);function ks(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
195
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:Ie.HOVER,heightLimit:!0}}}]),r}(F),ys=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.curTime=0,e.isPaused=!0,e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.config.list;Array.isArray(i)&&i.length>0&&(e.config.list=i.map(function(n){return!n.text&&n.name&&(n.text=n.name),n.text||(n.text=n.definition),n}))}},{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this),this.on("resourceReady",function(i){e.changeDefinitionList(i)}),this.on(bt,function(i){e.renderItemList(e.config.list,i.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||f.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,i=e.list,n=e.defaultDefinition;if(i.length>0){var s=null;i.map(function(l){l.definition===n&&(s=l)}),s||(s=i[0]),this.changeDefinition(s)}}},{key:"renderItemList",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,s=n&&n.definition?n.definition:this.config.defaultDefinition;n&&i.forEach(function(c){c.selected=!1});var l=0,u=i.map(function(c,h){var d=V(V({},c),{},{showText:e.getTextByLang(c)||c.definition,selected:!1});return(c.selected||c.definition&&c.definition==s)&&(d.selected=!0,l=h),d});A(I(r.prototype),"renderItemList",this).call(this,u,l)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map(function(i){return!i.text&&i.name&&(i.text=i.name),i.text||(i.text=i.definition),i}),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,i){this.player.changeDefinition(e,i)}},{key:"onItemClick",value:function(e,i){var n=this.player.definitionList;A(I(r.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:i.from,to:i.to});for(var s=0;s<n.length;s++)i.to&&n[s].definition===i.to.definition&&(i.to.url=n[s].url),i.from&&n[s].definition===i.from.definition&&(i.from.url=n[s].url);this.player.changeDefinition(i.to,i.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return V(V({},it.defaultConfig),{},{position:H.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),r}(it),_s=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.curRate=1,e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.player.config.playbackRate,n=i?Array.isArray(i)?i:e.config.list:[];Array.isArray(n)&&(e.config.list=n.map(function(s){return typeof s=="number"?s={rate:s,text:"".concat(s,"x")}:!s.text&&s.rate&&(s.text="".concat(s.rate,"x")),s}))}},{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this),this.on(ii,function(){e.curValue!==e.player.playbackRate&&e.renderItemList()}),this.renderItemList()}},{key:"show",value:function(e){!this.config.list||this.config.list.length===0||A(I(r.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,i){A(I(r.prototype),"onItemClick",this).call(this,e,i);var n=e.delegateTarget,s=Number(n.getAttribute("rate"));if(!s||s===this.curValue)return!1;var l={playbackRate:{from:this.player.playbackRate,to:s}};this.emitUserAction(e,"change_rate",{props:l}),this.curValue=s,this.player.playbackRate=s}},{key:"renderItemList",value:function(){var e=this,i=this.player.playbackRate||1;this.curValue=i;var n=-1,s=this.config.list.map(function(l,u){var c={rate:l.rate};return c.rate===i&&(c.selected=!0,n=u),c.showText=e.getTextByLang(l),c});A(I(r.prototype),"renderItemList",this).call(this,s,n)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex<e.length?this.curIndex:0,n=e[i],s="";!n||this.curIndex<0?s="".concat(this.player.playbackRate,"x"):s=this.getTextByLang(n,"iconText"),this.find(".icon-text").innerHTML=s}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return V(V({},it.defaultConfig),{},{position:H.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),r}(it);function Cs(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
196
196
  <path fill="#fff" transform="scale(1.3, 1.3)" class='path_full' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>
197
197
  </svg>
198
- `,"image/svg+xml").firstChild}function bs(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
198
+ `,"image/svg+xml").firstChild}function ks(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
199
199
  <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>
200
200
  </svg>
201
- `,"image/svg+xml").firstChild}var Gi=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.cssFullscreen=="boolean"&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Ge,function(i){e.animate(i)}),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,i=this.find(".xgplayer-icon");i.appendChild(e.cssFullscreen),i.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var i=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:i}),i?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var i=this.i18nKeys,n=this.find(".xg-tips");n&&this.changeLangTextKey(n,e?i.EXITCSSFULLSCREEN_TIPS:i.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:ks,class:"xg-get-cssfull"},exitCssFullscreen:{icon:bs,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class='xgplayer-cssfullscreen'>
201
+ `,"image/svg+xml").firstChild}var Gi=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.cssFullscreen=="boolean"&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;A(I(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Ge,function(i){e.animate(i)}),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,i=this.find(".xgplayer-icon");i.appendChild(e.cssFullscreen),i.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var i=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:i}),i?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var i=this.i18nKeys,n=this.find(".xg-tips");n&&this.changeLangTextKey(n,e?i.EXITCSSFULLSCREEN_TIPS:i.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:Cs,class:"xg-get-cssfull"},exitCssFullscreen:{icon:ks,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){A(I(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return`<xg-icon class='xgplayer-cssfullscreen'>
202
202
  <div class="xgplayer-icon">
203
203
  </div>
204
204
  `.concat(pe(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),`
205
- </xg-icon>`)}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),r}(ke),Ts=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(Oe,function(i){e.onError(i)})}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=this.player,n=e.errorType,s=i.errorNote?this.i18n[i.errorNote]:"";if(!s)switch(n){case"decoder":s=this.i18n.MEDIA_ERR_DECODE;break;case"network":s=this.i18n.MEDIA_ERR_NETWORK;break;default:s=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=s,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return`<xg-error class="xgplayer-error">
205
+ </xg-icon>`)}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),r}(ke),bs=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(Oe,function(i){e.onError(i)})}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=this.player,n=e.errorType,s=i.errorNote?this.i18n[i.errorNote]:"";if(!s)switch(n){case"decoder":s=this.i18n.MEDIA_ERR_DECODE;break;case"network":s=this.i18n.MEDIA_ERR_NETWORK;break;default:s=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=s,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return`<xg-error class="xgplayer-error">
206
206
  <div class="xgplayer-errornote">
207
207
  <span class="xgplayer-error-text"></span>
208
208
  <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>
209
209
  </div>
210
- </xg-error>`}}],[{key:"pluginName",get:function(){return"error"}}]),r}(F),ws=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],function(i){(e.config.onClick||e.customOnClick)&&(i.preventDefault(),i.stopPropagation(),e.customOnClick?e.customOnClick(i):e.config.onClick(i))}),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var i=this;Object.keys(e).map(function(n){i.root.style[n]=e[n]})}},{key:"showPrompt",value:function(e){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(e){this.customOnClick=s;var l=this.config.interval;this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),f.addClass(this.root,"show"),n.mode==="arrow"&&f.addClass(this.root,"arrow"),typeof e=="string"?this.find(".xgplayer-prompt-detail").innerHTML=e:this.find(".xgplayer-prompt-detail").innerHTML="".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),n.style&&this.setStyle(n.style);var u=typeof n.autoHide=="boolean"?n.autoHide:this.config.autoHide;if(u){var c=n.interval||l;this.intervalId=setTimeout(function(){i.hide()},c)}}}},{key:"hide",value:function(){f.removeClass(this.root,"show"),f.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(k.CONTROLS_FOLLOW,`">
210
+ </xg-error>`}}],[{key:"pluginName",get:function(){return"error"}}]),r}(F),Ts=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],function(i){(e.config.onClick||e.customOnClick)&&(i.preventDefault(),i.stopPropagation(),e.customOnClick?e.customOnClick(i):e.config.onClick(i))}),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var i=this;Object.keys(e).map(function(n){i.root.style[n]=e[n]})}},{key:"showPrompt",value:function(e){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(e){this.customOnClick=s;var l=this.config.interval;this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),f.addClass(this.root,"show"),n.mode==="arrow"&&f.addClass(this.root,"arrow"),typeof e=="string"?this.find(".xgplayer-prompt-detail").innerHTML=e:this.find(".xgplayer-prompt-detail").innerHTML="".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),n.style&&this.setStyle(n.style);var u=typeof n.autoHide=="boolean"?n.autoHide:this.config.autoHide;if(u){var c=n.interval||l;this.intervalId=setTimeout(function(){i.hide()},c)}}}},{key:"hide",value:function(){f.removeClass(this.root,"show"),f.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(k.CONTROLS_FOLLOW,`">
211
211
  <span class="xgplayer-prompt-detail"></span>
212
- </xg-prompt>`)}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),r}(F),Ki={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function Yi(a){Object.keys(Ki).map(function(o){a[o]===void 0&&(a[o]=Ki[o])})}var $i={_updateDotDom:function(o,r){if(r){var t=this.calcuPosition(o.time,o.duration),e=o.style||{};e.left="".concat(t.left,"%"),e.width="".concat(t.width,"%"),r.setAttribute("data-text",o.text),r.setAttribute("data-time",o.time),t.isMini?f.addClass(r,"mini"):f.removeClass(r,"mini"),Object.keys(e).map(function(i){r.style[i]=e[i]})}},initDots:function(){var o=this;this._ispots.map(function(r){o.createDot(r,!1)}),this.ispotsInit=!0},createDot:function(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this.player.plugins.progress;if(t&&(r&&(Yi(o),this._ispots.push(o)),!(!this.ispotsInit&&r))){var e=this.calcuPosition(o.time,o.duration),i=o.style||{};i.left="".concat(e.left,"%"),i.width="".concat(e.width,"%");var n="xgspot_".concat(o.id," xgplayer-spot");e.isMini&&(n+=" mini");var s=o.template?'<div class="xgplayer-spot-pop">'.concat(o.template,"</div>"):"",l=f.createDom("xg-spot",s,{"data-text":o.text,"data-time":o.time,"data-id":o.id},n);Object.keys(i).map(function(u){l.style[u]=i[u]}),t.outer&&t.outer.appendChild(l),this.positionDot(l,o.id)}},findDot:function(o){if(this.player.plugins.progress){var r=this._ispots.filter(function(t,e){return t.id===o});return r.length>0?r[0]:null}},updateDot:function(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=this.player.plugins.progress;if(t){var e=this.findDot(o.id);if(e&&Object.keys(o).map(function(n){e[n]=o[n]}),!!this.ispotsInit){var i=t.find('xg-spot[data-id="'.concat(o.id,'"]'));i&&(this._updateDotDom(o,i),r&&this.showDot(o.id))}}},deleteDot:function(o){var r=this._ispots,t=this.player.plugins.progress;if(t){for(var e=[],i=0;i<r.length;i++)r[i].id===o&&e.push(i);for(var n=e.length,s=n-1;s>=0;s--)if(r.splice(e[s],1),this.ispotsInit){var l=t.find('xg-spot[data-id="'.concat(o,'"]'));l&&l.parentElement.removeChild(l)}}},deleteAllDots:function(){var o=this.player.plugins.progress;if(o){if(!this.ispotsInit){this._ispots=[];return}for(var r=o.root.getElementsByTagName("xg-spot"),t=r.length-1;t>=0;t--)o.outer.removeChild(r[t]);this._ispots=[]}},updateAllDots:function(){var o=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=this.player.plugins.progress;if(t){if(!this.ispotsInit){this._ispots=r;return}this._ispots=[];var e=t.root.getElementsByTagName("xg-spot"),i=e.length;if(i>r.length)for(var n=i-1;n>r.length-1;n--)t.outer.removeChild(e[n]);r.forEach(function(s,l){l<i?(e[l].setAttribute("data-id","".concat(s.id)),o._ispots.push(s),o.updateDot(s)):o.createDot(s)})}},positionDots:function(){var o=this,r=this._ispots,t=this.playerSize,e=this.player.sizeInfo,i=this.player.plugins.progress;!i||e.width===t.width||(t.width=e.width,t.left=e.left,r.forEach(function(n){var s=i.find('xg-spot[data-id="'.concat(n.id,'"]'));s&&o.positionDot(s,n.id)}))},positionDot:function(o,r){var t=f.findDom(o,".xgplayer-spot-pop");if(t){var e=this.playerSize,i=o.getBoundingClientRect(),n=t.getBoundingClientRect(),s=i.left-e.left,l=e.width-s-i.width/2;if(s<n.width/2||e.width<n.width){var u=n.width/2-s;t.style.left="".concat(u,"px")}else if(l<n.width/2){var c=l-n.width/2+i.width/2;t.style.left="".concat(c,"px")}else t.style.left="50%"}},updateDuration:function(){var o=this,r=this.player.plugins.progress;if(r){var t=this._ispots;t.forEach(function(e){var i=r.find('xg-spot[data-id="'.concat(e.id,'"]'));o._updateDotDom(e,i)})}},getAllDotsDom:function(){var o=this.player.plugins.progress;if(!o)return[];var r=o.root.getElementsByTagName("xg-spot");return r},getDotDom:function(o){var r=this.player.plugins.progress;if(r)return r.find('xg-spot[data-id="'.concat(o,'"]'))}};function Es(a){var o=a.config,r=a.player;Object.keys($i).map(function(e){a[e]=$i[e].bind(a)});var t=r.config.progressDot||o.ispots||[];a._ispots=t.map(function(e){return Yi(e),e}),a.ispotsInit=!1,a.playerSize={left:r.sizeInfo.left,width:r.sizeInfo.width},a.on(ce,function(){a.ispotsInit?a.updateDuration():a.initDots()}),a.on(fe,function(){a.positionDots()})}var Ae={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},Ss=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onMousemove",function(i){if(!e.config.disable){if(f.hasClass(i.target,"xg-spot-content")&&e.config.isHideThumbnailHover){e.player.plugins.progress.onMouseLeave(i);return}(e._state.f||f.hasClass(i.target,"xg-spot-content"))&&(f.event(i),i.stopPropagation())}}),_(m(e),"onMousedown",function(i){e.config.disable||(e._state.f||f.hasClass(i.target,"xg-spot-content"))&&(f.event(i),i.stopPropagation())}),_(m(e),"onMouseup",function(i){if(e.isDrag){var n=e.player.plugins.progress;n&&n.pos&&(n.onMouseUp(i),!n.pos.isEnter&&n.onMouseLeave(i))}}),_(m(e),"onDotMouseLeave",function(i){if(!e.config.disable){e._curDot.removeEventListener("mouseleave",e.onDotMouseLeave),e.blurDot(i.target),e._curDot=null;var n=e.player.plugins.progress;n&&n.enableBlur(),e.show()}}),_(m(e),"onProgressMouseOver",function(i,n){if(!e.config.disable&&f.hasClass(n.target,"xgplayer-spot")&&!e._curDot){e._curDot=n.target,e.focusDot(n.target),e._curDot.children.length>0&&e.hide();var s=e.player.plugins.progress;s&&s.disableBlur(),e._curDot.addEventListener("mouseleave",e.onDotMouseLeave)}}),e._ispots=[],e.videoPreview=null,e.videothumbnail=null,e.thumbnail=null,e.timeStr="",e._state={now:0,f:!1},e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.player.plugins.progress;i&&(e.root=i.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",function(i,n){n.seekTime&&e.player.seek(n.seekTime)}),this.transformTimeHook=this.hook("transformTime",function(i){e.setTimeContent(f.format(i))}),Es(this),this.on(ce,function(){e.show()}),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(n){i.config[n]=e[n]})}},{key:"onPluginsReady",value:function(){var e=this.player;e.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e=this,i=this.player.plugins.progress;if(i&&(Object.keys(Ae).map(function(s){e[Ae[s]]=e[Ae[s]].bind(e),i.addCallBack(s,e[Ae[s]])}),D.device!=="mobile")){this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup);var n=this.hook("previewClick",function(){});this.handlerPreviewClick=function(s){s.stopPropagation(),n(parseInt(e._state.now*1e3,10)/1e3,s)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,i){this.config.disable||!this.player.duration||this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!0,this.videoPreview&&f.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!1,this.videoPreview&&f.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,i){this.config.disable||f.hasClass(i.target,"xgplayer-spot")&&(i.stopPropagation(),i.preventDefault(),["time","id","text"].map(function(n){e[n]=i.target.getAttribute("data-".concat(n))}),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(i,e))}},{key:"updateLinePos",value:function(e,i){var n=this.root,s=this.previewLine,l=this.player,u=this.config,c=l.controls.mode,h=c==="flex",d=n.getBoundingClientRect().width;if(!(!d&&this._hasThumnail)){d=this._hasThumnail&&d<u.width?u.width:d;var g=e-d/2,v;g<0&&!h?(g=0,v=e-d/2):g>i-d&&!h?(v=g-(i-d),g=i-d):v=0,v!==void 0&&(s.style.transform="translateX(".concat(v.toFixed(2),"px)")),n.style.transform="translateX(".concat(g.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var i=this.timeText,n=this.timePoint;i.innerHTML=e,!this.thumbnail&&(n.innerHTML=e)}},{key:"updatePosition",value:function(e,i,n,s){var l=this.root,u=this.config,c=this._state;if(l){c.now=n,this.transformTimeHook(n);var h=this.timeStr;s&&s.target&&f.hasClass(s.target,"xgplayer-spot")?(this.showTips(s.target.getAttribute("data-text"),!1,h),this.focusDot(s.target),c.f=!0,u.isFocusDots&&c.f&&(c.now=parseInt(s.target.getAttribute("data-time"),10))):u.defaultText?(c.f=!1,this.showTips(u.defaultText,!0,h)):(c.f=!1,this.hideTips("")),this.updateTimeText(h),this.updateThumbnails(c.now),this.updateLinePos(e,i)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var i=this.player,n=this.videoPreview,s=this.config,l=i.plugins.thumbnail;if(l&&l.usable){this.thumbnail&&l.update(this.thumbnail,e,s.width,s.height);var u=n&&n.getBoundingClientRect();this.videothumbnail&&l.update(this.videothumbnail,e,u.width,u.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(D.device!=="mobile"){var i=this.player,n=this.config,s=i.getPlugin("thumbnail");if(s&&s.setConfig(e),!s||!s.usable||!n.isShowThumbnail){f.addClass(this.root,"short-line no-thumbnail");return}else f.removeClass(this.root,"short-line no-thumbnail");n.mode==="short"&&f.addClass(this.root,"short-line"),this._hasThumnail=!0;var l=this.find(".xg-spot-thumbnail");this.thumbnail=s.createThumbnail(l,"progress-thumbnail"),n.isShowCoverPreview&&(this.videoPreview=f.createDom("xg-video-preview","",{},"xgvideo-preview"),i.root.appendChild(this.videoPreview),this.videothumbnail=s.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}}},{key:"calcuPosition",value:function(e,i){var n=this.player.plugins.progress,s=this.player,l=n.root.getBoundingClientRect().width,u=s.duration/l*6;return e+i>s.duration&&(i=s.duration-e),e/s.duration*100,i/s.duration,{left:e/s.duration*100,width:i/s.duration*100,isMini:i<u}}},{key:"showDot",value:function(e){var i=this.findDot(e);if(i){var n=this.root.getBoundingClientRect(),s=n.width,l=i.time/this.player.duration*s;this.updatePosition(l,s,i.time)}}},{key:"focusDot",value:function(e,i){e&&(i||(i=e.getAttribute("data-id")),f.addClass(e,"active"),this._activeDotId=i)}},{key:"blurDot",value:function(e){if(!e){var i=this._activeDotId;e=this.getDotDom(i)}e&&(f.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";f.addClass(this.root,"no-timepoint"),e&&(f.addClass(this.find(".xg-spot-content"),"show-text"),i&&this.config.mode==="production"?(f.addClass(this.root,"product"),this.tipText.textContent=e):(f.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(n," ").concat(e)))}},{key:"hideTips",value:function(){f.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",f.removeClass(this.find(".xg-spot-content"),"show-text"),f.removeClass(this.root,"product")}},{key:"hide",value:function(){f.addClass(this.root,"hide")}},{key:"show",value:function(e){f.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,i=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(i.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,i=this.player.plugins.progress;i&&Object.keys(Ae).map(function(n){i.removeCallBack(n,e[Ae[n]])}),this.videothumbnail=null,this.thumbnail=null,this.videoPreview&&this.player.root.removeChild(this.videoPreview),this.unbind(".xg-spot-info","mousemove",this.onMousemove),this.unbind(".xg-spot-info","mousedown",this.onMousedown),this.unbind(".xg-spot-info","mouseup",this.onMouseup),this.unbind(".xg-spot-content","mouseup",this.handlerPreviewClick)}},{key:"render",value:function(){return D.device==="mobile"||this.playerConfig.isMobileSimulateMode==="mobile"?"":'<div class="xg-spot-info hide '.concat(this.config.mode==="short"?"short-line":"",`">
212
+ </xg-prompt>`)}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),r}(F),Ki={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function Yi(a){Object.keys(Ki).map(function(o){a[o]===void 0&&(a[o]=Ki[o])})}var $i={_updateDotDom:function(o,r){if(r){var t=this.calcuPosition(o.time,o.duration),e=o.style||{};e.left="".concat(t.left,"%"),e.width="".concat(t.width,"%"),r.setAttribute("data-text",o.text),r.setAttribute("data-time",o.time),t.isMini?f.addClass(r,"mini"):f.removeClass(r,"mini"),Object.keys(e).map(function(i){r.style[i]=e[i]})}},initDots:function(){var o=this;this._ispots.map(function(r){o.createDot(r,!1)}),this.ispotsInit=!0},createDot:function(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this.player.plugins.progress;if(t&&(r&&(Yi(o),this._ispots.push(o)),!(!this.ispotsInit&&r))){var e=this.calcuPosition(o.time,o.duration),i=o.style||{};i.left="".concat(e.left,"%"),i.width="".concat(e.width,"%");var n="xgspot_".concat(o.id," xgplayer-spot");e.isMini&&(n+=" mini");var s=o.template?'<div class="xgplayer-spot-pop">'.concat(o.template,"</div>"):"",l=f.createDom("xg-spot",s,{"data-text":o.text,"data-time":o.time,"data-id":o.id},n);Object.keys(i).map(function(u){l.style[u]=i[u]}),t.outer&&t.outer.appendChild(l),this.positionDot(l,o.id)}},findDot:function(o){if(this.player.plugins.progress){var r=this._ispots.filter(function(t,e){return t.id===o});return r.length>0?r[0]:null}},updateDot:function(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=this.player.plugins.progress;if(t){var e=this.findDot(o.id);if(e&&Object.keys(o).map(function(n){e[n]=o[n]}),!!this.ispotsInit){var i=t.find('xg-spot[data-id="'.concat(o.id,'"]'));i&&(this._updateDotDom(o,i),r&&this.showDot(o.id))}}},deleteDot:function(o){var r=this._ispots,t=this.player.plugins.progress;if(t){for(var e=[],i=0;i<r.length;i++)r[i].id===o&&e.push(i);for(var n=e.length,s=n-1;s>=0;s--)if(r.splice(e[s],1),this.ispotsInit){var l=t.find('xg-spot[data-id="'.concat(o,'"]'));l&&l.parentElement.removeChild(l)}}},deleteAllDots:function(){var o=this.player.plugins.progress;if(o){if(!this.ispotsInit){this._ispots=[];return}for(var r=o.root.getElementsByTagName("xg-spot"),t=r.length-1;t>=0;t--)o.outer.removeChild(r[t]);this._ispots=[]}},updateAllDots:function(){var o=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=this.player.plugins.progress;if(t){if(!this.ispotsInit){this._ispots=r;return}this._ispots=[];var e=t.root.getElementsByTagName("xg-spot"),i=e.length;if(i>r.length)for(var n=i-1;n>r.length-1;n--)t.outer.removeChild(e[n]);r.forEach(function(s,l){l<i?(e[l].setAttribute("data-id","".concat(s.id)),o._ispots.push(s),o.updateDot(s)):o.createDot(s)})}},positionDots:function(){var o=this,r=this._ispots,t=this.playerSize,e=this.player.sizeInfo,i=this.player.plugins.progress;!i||e.width===t.width||(t.width=e.width,t.left=e.left,r.forEach(function(n){var s=i.find('xg-spot[data-id="'.concat(n.id,'"]'));s&&o.positionDot(s,n.id)}))},positionDot:function(o,r){var t=f.findDom(o,".xgplayer-spot-pop");if(t){var e=this.playerSize,i=o.getBoundingClientRect(),n=t.getBoundingClientRect(),s=i.left-e.left,l=e.width-s-i.width/2;if(s<n.width/2||e.width<n.width){var u=n.width/2-s;t.style.left="".concat(u,"px")}else if(l<n.width/2){var c=l-n.width/2+i.width/2;t.style.left="".concat(c,"px")}else t.style.left="50%"}},updateDuration:function(){var o=this,r=this.player.plugins.progress;if(r){var t=this._ispots;t.forEach(function(e){var i=r.find('xg-spot[data-id="'.concat(e.id,'"]'));o._updateDotDom(e,i)})}},getAllDotsDom:function(){var o=this.player.plugins.progress;if(!o)return[];var r=o.root.getElementsByTagName("xg-spot");return r},getDotDom:function(o){var r=this.player.plugins.progress;if(r)return r.find('xg-spot[data-id="'.concat(o,'"]'))}};function ws(a){var o=a.config,r=a.player;Object.keys($i).map(function(e){a[e]=$i[e].bind(a)});var t=r.config.progressDot||o.ispots||[];a._ispots=t.map(function(e){return Yi(e),e}),a.ispotsInit=!1,a.playerSize={left:r.sizeInfo.left,width:r.sizeInfo.width},a.on(ce,function(){a.ispotsInit?a.updateDuration():a.initDots()}),a.on(fe,function(){a.positionDots()})}var Ae={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},Es=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),_(m(e),"onMousemove",function(i){if(!e.config.disable){if(f.hasClass(i.target,"xg-spot-content")&&e.config.isHideThumbnailHover){e.player.plugins.progress.onMouseLeave(i);return}(e._state.f||f.hasClass(i.target,"xg-spot-content"))&&(f.event(i),i.stopPropagation())}}),_(m(e),"onMousedown",function(i){e.config.disable||(e._state.f||f.hasClass(i.target,"xg-spot-content"))&&(f.event(i),i.stopPropagation())}),_(m(e),"onMouseup",function(i){if(e.isDrag){var n=e.player.plugins.progress;n&&n.pos&&(n.onMouseUp(i),!n.pos.isEnter&&n.onMouseLeave(i))}}),_(m(e),"onDotMouseLeave",function(i){if(!e.config.disable){e._curDot.removeEventListener("mouseleave",e.onDotMouseLeave),e.blurDot(i.target),e._curDot=null;var n=e.player.plugins.progress;n&&n.enableBlur(),e.show()}}),_(m(e),"onProgressMouseOver",function(i,n){if(!e.config.disable&&f.hasClass(n.target,"xgplayer-spot")&&!e._curDot){e._curDot=n.target,e.focusDot(n.target),e._curDot.children.length>0&&e.hide();var s=e.player.plugins.progress;s&&s.disableBlur(),e._curDot.addEventListener("mouseleave",e.onDotMouseLeave)}}),e._ispots=[],e.videoPreview=null,e.videothumbnail=null,e.thumbnail=null,e.timeStr="",e._state={now:0,f:!1},e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.player.plugins.progress;i&&(e.root=i.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",function(i,n){n.seekTime&&e.player.seek(n.seekTime)}),this.transformTimeHook=this.hook("transformTime",function(i){e.setTimeContent(f.format(i))}),ws(this),this.on(ce,function(){e.show()}),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(n){i.config[n]=e[n]})}},{key:"onPluginsReady",value:function(){var e=this.player;e.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e=this,i=this.player.plugins.progress;if(i&&(Object.keys(Ae).map(function(s){e[Ae[s]]=e[Ae[s]].bind(e),i.addCallBack(s,e[Ae[s]])}),D.device!=="mobile")){this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup);var n=this.hook("previewClick",function(){});this.handlerPreviewClick=function(s){s.stopPropagation(),n(parseInt(e._state.now*1e3,10)/1e3,s)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,i){this.config.disable||!this.player.duration||this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!0,this.videoPreview&&f.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!1,this.videoPreview&&f.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,i){this.config.disable||f.hasClass(i.target,"xgplayer-spot")&&(i.stopPropagation(),i.preventDefault(),["time","id","text"].map(function(n){e[n]=i.target.getAttribute("data-".concat(n))}),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(i,e))}},{key:"updateLinePos",value:function(e,i){var n=this.root,s=this.previewLine,l=this.player,u=this.config,c=l.controls.mode,h=c==="flex",d=n.getBoundingClientRect().width;if(!(!d&&this._hasThumnail)){d=this._hasThumnail&&d<u.width?u.width:d;var g=e-d/2,v;g<0&&!h?(g=0,v=e-d/2):g>i-d&&!h?(v=g-(i-d),g=i-d):v=0,v!==void 0&&(s.style.transform="translateX(".concat(v.toFixed(2),"px)")),n.style.transform="translateX(".concat(g.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var i=this.timeText,n=this.timePoint;i.innerHTML=e,!this.thumbnail&&(n.innerHTML=e)}},{key:"updatePosition",value:function(e,i,n,s){var l=this.root,u=this.config,c=this._state;if(l){c.now=n,this.transformTimeHook(n);var h=this.timeStr;s&&s.target&&f.hasClass(s.target,"xgplayer-spot")?(this.showTips(s.target.getAttribute("data-text"),!1,h),this.focusDot(s.target),c.f=!0,u.isFocusDots&&c.f&&(c.now=parseInt(s.target.getAttribute("data-time"),10))):u.defaultText?(c.f=!1,this.showTips(u.defaultText,!0,h)):(c.f=!1,this.hideTips("")),this.updateTimeText(h),this.updateThumbnails(c.now),this.updateLinePos(e,i)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var i=this.player,n=this.videoPreview,s=this.config,l=i.plugins.thumbnail;if(l&&l.usable){this.thumbnail&&l.update(this.thumbnail,e,s.width,s.height);var u=n&&n.getBoundingClientRect();this.videothumbnail&&l.update(this.videothumbnail,e,u.width,u.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(D.device!=="mobile"){var i=this.player,n=this.config,s=i.getPlugin("thumbnail");if(s&&s.setConfig(e),!s||!s.usable||!n.isShowThumbnail){f.addClass(this.root,"short-line no-thumbnail");return}else f.removeClass(this.root,"short-line no-thumbnail");n.mode==="short"&&f.addClass(this.root,"short-line"),this._hasThumnail=!0;var l=this.find(".xg-spot-thumbnail");this.thumbnail=s.createThumbnail(l,"progress-thumbnail"),n.isShowCoverPreview&&(this.videoPreview=f.createDom("xg-video-preview","",{},"xgvideo-preview"),i.root.appendChild(this.videoPreview),this.videothumbnail=s.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}}},{key:"calcuPosition",value:function(e,i){var n=this.player.plugins.progress,s=this.player,l=n.root.getBoundingClientRect().width,u=s.duration/l*6;return e+i>s.duration&&(i=s.duration-e),e/s.duration*100,i/s.duration,{left:e/s.duration*100,width:i/s.duration*100,isMini:i<u}}},{key:"showDot",value:function(e){var i=this.findDot(e);if(i){var n=this.root.getBoundingClientRect(),s=n.width,l=i.time/this.player.duration*s;this.updatePosition(l,s,i.time)}}},{key:"focusDot",value:function(e,i){e&&(i||(i=e.getAttribute("data-id")),f.addClass(e,"active"),this._activeDotId=i)}},{key:"blurDot",value:function(e){if(!e){var i=this._activeDotId;e=this.getDotDom(i)}e&&(f.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";f.addClass(this.root,"no-timepoint"),e&&(f.addClass(this.find(".xg-spot-content"),"show-text"),i&&this.config.mode==="production"?(f.addClass(this.root,"product"),this.tipText.textContent=e):(f.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(n," ").concat(e)))}},{key:"hideTips",value:function(){f.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",f.removeClass(this.find(".xg-spot-content"),"show-text"),f.removeClass(this.root,"product")}},{key:"hide",value:function(){f.addClass(this.root,"hide")}},{key:"show",value:function(e){f.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,i=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(i.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,i=this.player.plugins.progress;i&&Object.keys(Ae).map(function(n){i.removeCallBack(n,e[Ae[n]])}),this.videothumbnail=null,this.thumbnail=null,this.videoPreview&&this.player.root.removeChild(this.videoPreview),this.unbind(".xg-spot-info","mousemove",this.onMousemove),this.unbind(".xg-spot-info","mousedown",this.onMousedown),this.unbind(".xg-spot-info","mouseup",this.onMouseup),this.unbind(".xg-spot-content","mouseup",this.handlerPreviewClick)}},{key:"render",value:function(){return D.device==="mobile"||this.playerConfig.isMobileSimulateMode==="mobile"?"":'<div class="xg-spot-info hide '.concat(this.config.mode==="short"?"short-line":"",`">
213
213
  <div class="xg-spot-content">
214
214
  <div class="xg-spot-thumbnail">
215
215
  <span class="xg-spot-time"></span>
@@ -219,8 +219,8 @@ Use Save As... to download, then click back to return to this page.`)&&(location
219
219
  <div class="xgplayer-progress-point">00:00</div>
220
220
  <div class="xg-spot-ext-text"></div>
221
221
  <div class="xg-spot-line"></div>
222
- </div>`)}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),r}(F),xs=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.ratio=1,e.interval=null,e._preloadMark={},e}return S(r,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([ce],function(){var i=e.config,n=i.pic_num,s=i.interval;e.usable&&(e.interval=s>0?s:Math.round(e.player.duration*1e3/n)/1e3)})}},{key:"setConfig",value:function(e){var i=this;if(e){var n=Object.keys(e);n.length<1||(n.forEach(function(s){i.config[s]=e[s]}),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,i=e.urls,n=e.pic_num;return i&&i.length>0&&n>0}},{key:"initThumbnail",value:function(){var e=this.config,i=e.width,n=e.height,s=e.pic_num,l=e.interval;this.ratio=i/n*100,this.interval=l||Math.round(this.player.duration/s),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var i=this;if(!this._preloadMark[e]){var n=this.config.urls,s=n.length,l=[];e>0&&l.push(e-1),l.push(e),e>0&&e<s-1&&l.push(e+1),l.map(function(u){!i._preloadMark[u]&&u>=0&&u<s&&(i._preloadMark[u]=1,f.preloadImg(n[u],function(){i._preloadMark[u]=2}))})}}},{key:"getPosition",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=this.config,l=s.pic_num,u=s.row,c=s.col,h=s.width,d=s.height;this.interval=Math.round(this.player.duration/l);var g=Math.ceil(e/this.interval);g=g>l?l:g;var v=g<u*c?0:Math.ceil(g/(u*c))-1,y=g-v*(c*u),C=y>0?Math.ceil(y/c)-1:0,b=y>0?y-C*c-1:0,w=0,T=0;if(i&&n){var B=i/n;B<h/d?(T=n,w=T*(h/d)):(w=i,T=w/(h/d))}else n?i||(T=n||d,w=T*(h/d)):(w=i||h,T=w/(h/d));var O=this.getUrlByIndex(v);return{urlIndex:v,rowIndex:C,colIndex:b,url:O,height:T,width:w,style:{backgroundImage:"url(".concat(O,")"),backgroundSize:"".concat(w*c,"px auto"),backgroundPosition:"-".concat(b*w,"px -").concat(C*T,"px"),width:"".concat(w,"px"),height:"".concat(T,"px")}}}},{key:"update",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",u=this.config,c=u.pic_num,h=u.urls;if(!(c<=0||!h||h.length===0)){var d=this.getPosition(i,n,s);this.preload(d.urlIndex),Object.keys(d.style).map(function(g){e.style[g]=d.style[g]}),Object.keys(l).map(function(g){e.style[g]=l[g]})}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,i){var n=f.createDom("xg-thumbnail","",{},"thumbnail ".concat(i));return e&&e.appendChild(n),n}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),r}(F);function Ut(a){return a?"background:".concat(a,";"):""}var Ps=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onTimeupdate",function(){var s=t.player.ended,l=m(t),u=l.offsetDuration,c=t.currentTime;c=f.adjustTimeByDuration(c,u,s),t.update({played:c},u)}),t}return S(r,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(X,this.onTimeupdate),this.on(ye,function(){e.reset()}))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},i=arguments.length>1?arguments[1]:void 0;!i||!this.root||(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/i*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/i*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,i=e.commonStyle,n=e.miniprogress;if(n){var s=this.config,l=s.mode,u=s.height,c={cached:Ut(i.cachedColor),played:Ut(i.playedColor),progress:Ut(i.progressColor),height:u>0&&u!==2?"height: ".concat(u,"px;"):""},h=l==="show"?"xg-mini-progress-show":"";return'<xg-mini-progress class="xg-mini-progress '.concat(h,'" style="').concat(c.progress," ").concat(c.height,`">
222
+ </div>`)}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),r}(F),Ss=function(a){x(r,a);var o=P(r);function r(t){var e;return E(this,r),e=o.call(this,t),e.ratio=1,e.interval=null,e._preloadMark={},e}return S(r,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([ce],function(){var i=e.config,n=i.pic_num,s=i.interval;e.usable&&(e.interval=s>0?s:Math.round(e.player.duration*1e3/n)/1e3)})}},{key:"setConfig",value:function(e){var i=this;if(e){var n=Object.keys(e);n.length<1||(n.forEach(function(s){i.config[s]=e[s]}),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,i=e.urls,n=e.pic_num;return i&&i.length>0&&n>0}},{key:"initThumbnail",value:function(){var e=this.config,i=e.width,n=e.height,s=e.pic_num,l=e.interval;this.ratio=i/n*100,this.interval=l||Math.round(this.player.duration/s),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var i=this;if(!this._preloadMark[e]){var n=this.config.urls,s=n.length,l=[];e>0&&l.push(e-1),l.push(e),e>0&&e<s-1&&l.push(e+1),l.map(function(u){!i._preloadMark[u]&&u>=0&&u<s&&(i._preloadMark[u]=1,f.preloadImg(n[u],function(){i._preloadMark[u]=2}))})}}},{key:"getPosition",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=this.config,l=s.pic_num,u=s.row,c=s.col,h=s.width,d=s.height;this.interval=Math.round(this.player.duration/l);var g=Math.ceil(e/this.interval);g=g>l?l:g;var v=g<u*c?0:Math.ceil(g/(u*c))-1,y=g-v*(c*u),C=y>0?Math.ceil(y/c)-1:0,b=y>0?y-C*c-1:0,w=0,T=0;if(i&&n){var B=i/n;B<h/d?(T=n,w=T*(h/d)):(w=i,T=w/(h/d))}else n?i||(T=n||d,w=T*(h/d)):(w=i||h,T=w/(h/d));var O=this.getUrlByIndex(v);return{urlIndex:v,rowIndex:C,colIndex:b,url:O,height:T,width:w,style:{backgroundImage:"url(".concat(O,")"),backgroundSize:"".concat(w*c,"px auto"),backgroundPosition:"-".concat(b*w,"px -").concat(C*T,"px"),width:"".concat(w,"px"),height:"".concat(T,"px")}}}},{key:"update",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",u=this.config,c=u.pic_num,h=u.urls;if(!(c<=0||!h||h.length===0)){var d=this.getPosition(i,n,s);this.preload(d.urlIndex),Object.keys(d.style).map(function(g){e.style[g]=d.style[g]}),Object.keys(l).map(function(g){e.style[g]=l[g]})}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,i){var n=f.createDom("xg-thumbnail","",{},"thumbnail ".concat(i));return e&&e.appendChild(n),n}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),r}(F);function Ht(a){return a?"background:".concat(a,";"):""}var xs=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onTimeupdate",function(){var s=t.player.ended,l=m(t),u=l.offsetDuration,c=t.currentTime;c=f.adjustTimeByDuration(c,u,s),t.update({played:c},u)}),t}return S(r,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(X,this.onTimeupdate),this.on(ye,function(){e.reset()}))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},i=arguments.length>1?arguments[1]:void 0;!i||!this.root||(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/i*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/i*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,i=e.commonStyle,n=e.miniprogress;if(n){var s=this.config,l=s.mode,u=s.height,c={cached:Ht(i.cachedColor),played:Ht(i.playedColor),progress:Ht(i.progressColor),height:u>0&&u!==2?"height: ".concat(u,"px;"):""},h=l==="show"?"xg-mini-progress-show":"";return'<xg-mini-progress class="xg-mini-progress '.concat(h,'" style="').concat(c.progress," ").concat(c.height,`">
223
223
  <xg-mini-progress-cache class="xg-mini-progress-cache" style="`).concat(c.cached,`"></xg-mini-progress-cache>
224
224
  <xg-mini-progress-played class="xg-mini-progress-played" style="`).concat(c.played,`"></xg-mini-progress-played>
225
- </xg-mini-progress>`)}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),r}(F),Le={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",FRAME_RATE:"framerate",POSTER:"poster"};function Is(){try{return parseInt(window.performance.now(),10)}catch{return new Date().getTime()}}function As(){try{var a=document.createElement("canvas").getContext;return!!a}catch{return!1}}var nt=null,Ls=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onLoadedData",function(s){t.player&&(t._frameCount=t.config.startFrameCount,t.stop(),t.renderOnTimeupdate(s),t.off(X,t.renderOnTimeupdate),t.on(X,t.renderOnTimeupdate))}),_(m(t),"onVisibilitychange",function(s){document.visibilityState==="visible"?t._checkIfCanStart()&&t.start():document.visibilityState==="hidden"&&t.stop()}),_(m(t),"renderOnTimeupdate",function(s){if(t._frameCount>0)t.renderOnce(),t._frameCount--;else{t._isLoaded=!0,t.off(X,t.renderOnTimeupdate);var l=t.config.startInterval;!t.player.paused&&t._checkIfCanStart()&&t.start(0,l)}}),_(m(t),"start",function(s,l){var u=t.player.video,c=Is(),h=t.checkVideoIsSupport(u);!h||!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===Le.REAL_TIME||c-t.preTime>=l)&&(u&&u.videoWidth&&t.update(h,t.videoPI),t.preTime=c)),t.frameId=t._loopType==="timer"?f.setTimeout(m(t),t.start,l):f.requestAnimationFrame(t.start))}),_(m(t),"stop",function(){t.frameId&&(t._loopType==="timer"?f.clearTimeout(m(t),t.frameId):f.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return S(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,s=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!==Le.REAL_TIME&&this.interval>=1e3?"timer":"animation",this.once(ze,function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())}),s!==Le.POSTER&&(s!==Le.FIRST_FRAME&&(this.on(ye,function(){e.stop()}),this.on($,function(){var u=e.config.startInterval;e._checkIfCanStart()&&e.start(0,u)}),this.on(we,function(){e.stop()})),this.on(ae,this.onLoadedData),this.on(mt,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 s=e||n.root;s||(s=n.isInnerRender&&i.innerContainer||i.root),s.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,`"><canvas>
226
- </canvas><xgmask></xgmask></div>`)),this.root=s.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){R.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 s=this.config.startInterval;this._checkIfCanStart()&&this.start(0,s)}}},{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&&!(D.browser==="safari"&&f.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=f.typeOf(e)==="String"?e:f.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!==Le.FIRST_FRAME&&e!==Le.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(),s=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=s;var c=parseInt(s/l*100,10);i.update(u,c),u=null}},u.src=e}}},{key:"update",value:function(e,i){if(!(!this.canvas||!this.canvasCtx||!i))try{var n=this._pos,s=this.config,l=this.canvas.getBoundingClientRect(),u=l.width,c=l.height;if(u!==n.width||c!==n.height||n.pi!==i){var h=parseInt(u/c*100,10);n.pi=i,n.width!==u&&(n.width=this.canvas.width=u),n.height!==c&&(n.height=this.canvas.height=c);var d=c,g=u;h<i?g=parseInt(c*i/100,10):h>i&&(d=parseInt(u*100/i,10)),n.rwidth=g*s.multiple,n.rheight=d*s.multiple,n.x=(u-n.rwidth)/2,n.y=(c-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=s.filter),this.canvasCtx.drawImage(e,n.x,n.y,n.rwidth,n.rheight)}catch(v){R.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 nt=="boolean"||(nt=As()),nt}},{key:"supportCanvasFilter",value:function(){return!(D.browser==="safari"||D.browser==="firefox")}}]),r}(F),Ds={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:"直播"}},Be="info",Vt=vi,Rs=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_recordUserActions",function(s){var l=t._getTime(),u=Object.assign({},s,{msg:s.msg||s.action});t._stats[Be].push(V(V({type:"userAction"},l),{},{payload:u}))}),_(m(t),"_onReset",function(){t.reset()}),_(m(t),"_recordInfo",function(s){t.info(s)}),_(m(t),"_downloadStats",function(){var s=t.getStats(),l=new Blob([JSON.stringify(s)],{type:"application/json"}),u=window.URL.createObjectURL(l),c=document.createElement("a");c.style.display="none",c.href=u,c.download="player.txt",c.disabled=!1,c.click()}),t}return S(r,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:new Date().toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on($e,this._recordUserActions),this.on(Vt.STATS_INFO,this._recordInfo),this.on(Vt.STATS_DOWNLOAD,this._downloadStats),this.on(Vt.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[Be].push(V(V({},i),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var i=Date.now(),n=i-e.startMs,s=V({cat:"function",dur:n,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(s)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(e={},_(e,Be,[]),_(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player,i=e.media,n=[],s=0;s<i.buffered.length;s++)n.push({start:i.buffered.start(s),end:i.buffered.end(s)});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[Be],i=e.map(function(n){var s=n.payload.data,l="";try{s instanceof Error?l=s.msg:s!==void 0&&(l=JSON.stringify(s))}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[Be];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}(he),Xi=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onGapJump",function(){var s=m(t),l=s.player,u=s.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 c=l.media.buffered,h=u.smallGapLimit||.5,d=u.gapDetectionThreshold||.3,g=l.media.currentTime,v=t._getIndex(c,g,d);if(!(v===null||v===0)){console.log("GapJump bufferRange ",c.start(v),c.end(v));var y=c.start(v)+.1,C=l.media.duration;if(!(y>C)){var b=y-g,w=b<=h;b<r.BROWSER_GAP_TOLERANCE||w&&(u.useGapJump!==!1&&(l.media.currentTime=t.isSafari?y+.1:y),t.player&&t.player.emit("detectGap"),console.log("gapJump gapIndex",v," isGapSamll:",w," currentTime:",l.media.currentTime," jumpSize:",g-l.media.currentTime),y!==.08&&l&&l.emit("log",{type:"oneevent",end_type:"gap",vid:l.config.vid,ext:{video_postion:Math.floor(y*1e3)}}))}}}}}),t}return S(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(Me,this.onGapJump),this.on($,function(){e.hasPlayed=!0}),this.on(Ve,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 s=this._getBuffered(e),l=null,u=0;u<s.length;u++){var c=s[u];if(c.start>i&&(u===0||s[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}(F);Xi.BROWSER_GAP_TOLERANCE=.001;var Os=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onWaiting",function(){var s=m(t),l=s.config;t.jumpCnt>l.jumpCntMax||t.timer||l.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,l.waitingTime*1e3))}),_(m(t),"onJump",function(){var s=m(t),l=s.player,u=s.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 c=l.currentTime+t.jumpSize,h=l.media.duration;c>h||(t.jumpCnt++,l.currentTime=c)}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.useWaitingTimeoutJump,s=i.jumpSize;n!==!1&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=s,this.on(Me,this.onWaiting),this.on([vt,oe],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on($,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(F),De="cdn",rt=["cdn"],Ms=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"getSpeed",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De;if(!t.speedListCache||!t.speedListCache[s]||t.speedListCache[s].length<=0)return 0;var l=0;return t.speedListCache[s].map(function(u){l+=u}),Math.floor(l/t.speedListCache[s].length)}),_(m(t),"startTimer",function(){f.isMSE(t.player.video)||(t.initSpeedList(),t.cnt=0,t.timer=setTimeout(t.testSpeed,t.config.testTimeStep))}),_(m(t),"initSpeedList",function(){t.speedListCache={},rt.forEach(function(s){t.speedListCache[s]=[]})}),_(m(t),"_onRealSpeedChange",function(s){s.speed&&t.appendList(s.speed,s.type||De)}),_(m(t),"testSpeed",function(){if(clearTimeout(t.timer),t.timer=null,!(!t.player||!t.config.openSpeed)){var s=t.config,l=s.url,u=s.loadSize,c=s.testCnt,h=s.testTimeStep,d=l+(l.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=c)){t.cnt++;try{var g=new Date().getTime(),v=null,y=new XMLHttpRequest;t.xhr=y,y.open("GET",d);var C={},b=Math.floor(Math.random()*10);C.Range="bytes="+b+"-"+(u+b),C&&Object.keys(C).forEach(function(w){y.setRequestHeader(w,C[w])}),y.onreadystatechange=function(){if(y.readyState===4){t.xhr=null,v=new Date().getTime();var w=y.getResponseHeader("Content-Length")/1024*8,T=Math.round(w*1e3/(v-g));t.appendList(T),t.timer=setTimeout(t.testSpeed,h)}},y.send()}catch(w){console.error(w)}}}}),_(m(t),"appendList",function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De;if(!(!t.speedListCache||!t.speedListCache[l])){var u=t.config.saveSpeedMax;t.speedListCache[l].length>=u&&t.speedListCache[l].shift(),t.speedListCache[l].push(s);var c=m(t),h=c.player;h&&(l===De?h.realTimeSpeed=s:h[t.getSpeedName("realTime",l)]=s),t.updateSpeed(l)}}),_(m(t),"updateSpeed",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De,l=t.getSpeed(s),u=m(t),c=u.player;if(c)if(s===De)(!c.avgSpeed||l!==c.avgSpeed)&&(c.avgSpeed=l,c.emit(bt,{speed:l,realTimeSpeed:c.realTimeSpeed}));else{var h=t.getSpeedName("avg",s);(!c[h]||l!==c[h])&&(c[h]=l,c.emit(bt,{speed:l,realTimeSpeed:c.realTimeSpeed}))}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this.config,i=e.openSpeed,n=e.addSpeedTypeList;(n==null?void 0:n.length)>0&&rt.push.apply(rt,J(n)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,i&&this.on([ae,je],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([ae,je],this.startTimer),rt.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}(F),Ns=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.config,s=i.media||i.video;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],!n.disabled){var l=s.getVideoPlaybackQuality;l&&(this.on($,function(){e._startTick()}),this.on(we,function(){e._stopTick()}),this.on(me,function(){e._stopTick()}),this.on(ye,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,s=[],l=0;l<i.length;l++){var u=i.start(l),c=i.end(l);if(s.push({start:u,end:c}),u<=e&&e<=c-1){n=!0;break}}return{enoughBuffer:n,buffers:s}}},{key:"_checkStuck",value:function(e,i,n,s){var l=this.player.media||this.player.video,u=document.hidden,c=l.paused,h=l.readyState,d=l.currentTime,g=l.buffered;if(!(u||c||h<4)){var v=this._checkBuffer(d,g),y=v.enoughBuffer,C=v.buffers;y&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:d,buffers:C,curDecodedFrames:e,totalVideoFrames:i,droppedVideoFrames:n,checkInterval:s}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(mi,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,s=i.droppedVideoFrames,l=performance.now();if(n&&this._lastCheckPoint){var u=n-this._lastDecodedFrames,c=l-this._lastCheckPoint;this._checkStuck(u,n,s,c)}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}(F);Se.use(Ds);var Fs=S(function a(o,r){var t,e,i;E(this,a);var n=r&&r.isMobileSimulateMode==="mobile",s=r.isLive,l=s?[]:[es,Kr,Ps,Ss,Qr],u=[].concat(l,[Yr,Jr,os,fs,_s,Cs,ps,vs,rs,us]),c=[Sr,xr,Ir,jr,Ar,Ts,ws,xs,Or];this.plugins=[Rs,wr].concat(J(u),c,[Xi,Os]);var h=n?"mobile":D.device;switch(h){case"pc":(t=this.plugins).push.apply(t,[zi,Bt,Gi,Ms,Ns]);break;case"mobile":(e=this.plugins).push.apply(e,[Ur]);break;default:(i=this.plugins).push.apply(i,[zi,Bt,Gi])}(D.os.isIpad||h==="pc")&&this.plugins.push(Ls),D.os.isIpad&&this.plugins.push(Bt),this.ignores=[],this.i18n=[]}),Q=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r)}(et);_(Q,"defaultPreset",Fs),_(Q,"Util",f),_(Q,"Sniffer",D),_(Q,"Errors",Ue),_(Q,"Events",Jn),_(Q,"Plugin",F),_(Q,"BasePlugin",he),_(Q,"I18N",Se),_(Q,"STATE_CLASS",k),_(Q,"InstManager",Li);const Xs="",Bs=["id"],Hs=p.defineComponent({name:"ElImageViewer",__name:"Player",props:p.mergeModels({url:{type:String,default:""},zIndex:{type:Number,default:200},config:{type:Object,default:()=>({})}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:p.mergeModels({close:()=>!0},["update:modelValue"]),setup(a,{emit:o}){let r=null;const t=a,{cLoadUrl:e}=nn(t),i=p.computed(()=>ot(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},s=p.computed(()=>({...n,...t.config})),l=o,u=p.useModel(a,"modelValue"),c=st.buildUUID(),h=Zi.useNamespace("image-viewer");function d(){l("close"),u.value=!1,r.destroy()}return p.watch(()=>u.value,g=>{g&&p.nextTick(()=>{r=new Q({id:c,url:i.value,...s.value})})}),(g,v)=>{const y=p.resolveComponent("el-icon");return u.value?(p.openBlock(),p.createBlock(p.Teleport,{key:0,to:"body"},[p.createVNode(p.Transition,{name:"viewer-fade",appear:""},{default:p.withCtx(()=>[p.createElementVNode("div",{ref:"wrapper",tabindex:-1,class:p.normalizeClass(p.unref(h).e("wrapper")),style:p.normalizeStyle({zIndex:a.zIndex})},[p.createElementVNode("div",{class:p.normalizeClass(p.unref(h).e("mask"))},null,2),p.createCommentVNode(" CANVAS "),p.createElementVNode("div",{class:p.normalizeClass(p.unref(h).e("canvas"))},[p.createElementVNode("div",{id:p.unref(c)},null,8,Bs),p.createCommentVNode(" CLOSE "),p.createElementVNode("span",{class:p.normalizeClass([p.unref(h).e("btn"),p.unref(h).e("close")]),onClick:d},[p.createVNode(y,{onClick:d},{default:p.withCtx(()=>[p.createVNode(p.unref(tn))]),_:1})],2)],2),p.renderSlot(g.$slots,"default",{},void 0,!0)],6)]),_:3})])):p.createCommentVNode("v-if",!0)}}}),qs="",Us=Re(He(Hs,[["__scopeId","data-v-b301aa7d"]])),Vs=p.defineComponent({__name:"IkPreviewFileDialog",props:p.mergeModels({file:{type:Object,default:()=>[]},loadUrl:{type:String,default:""},onlyOfficeAccept:{type:String,default:".pdf,.docx,.doc.ppt,.pptx,.xlsx,.xls,"},onlyofficeServer:{type:String,default:""},onlyOfficeConfig:{type:Object,default:()=>({})},field:{type:Object,default:()=>({})}},{show:{default:!1},showModifiers:{}}),emits:["update:show"],setup(a){const o=a,r=p.useModel(a,"show"),t=p.computed(()=>({name:"name",url:"url",suffix:"suffix",size:"fileSize",...o.field})),e=p.ref(null),i=p.ref(null),n=p.reactive({image:!1,office:!1,video:!1}),s=u=>{var c,h,d,g,v,y,C;try{const b=((c=u==null?void 0:u.response)==null?void 0:c.data)||u,w=b[t.value.url]||(b==null?void 0:b.id)||b.attachmentId,T=(h=b[t.value.suffix]||b.attachmentSuffix)==null?void 0:h.toLowerCase(),B=b[t.value.name]||(b==null?void 0:b.attachmentName)||(b==null?void 0:b.originName);if(i.value={...u,name:u[t.value.name],url:ot(o.loadUrl,w)},u&&zt(u,t.value)==="image"){n.image=!0;return}else if(u&&zt(u,t.value)==="video"){n.video=!0;return}else if((((d=o.onlyOfficeConfig)==null?void 0:d.accept)||o.onlyOfficeAccept).includes(T)){n.office=!0,e.value={...o.onlyOfficeConfig,editorConfig:{...((g=o.onlyOfficeConfig)==null?void 0:g.editorConfig)||{},customization:{...((y=(v=o.onlyOfficeConfig)==null?void 0:v.editorConfig)==null?void 0:y.customization)||{},review:{reviewDisplay:"final"}}},document:{key:st.buildUUID(),title:B,url:ot(o.loadUrl,w),fileType:T,...((C=o.onlyOfficeConfig)==null?void 0:C.document)||{}},documentType:Qi(T)};return}}catch(b){console.info("预览错误: ",b)}};p.watch([r,o.file],([u,c])=>{u&&p.nextTick(()=>{s(o.file)})});const l=()=>{r.value=!1,n.office=!1,n.image=!1,n.video=!1,i.value=null};return(u,c)=>{var d,g,v;const h=p.resolveComponent("el-image-viewer");return r.value?(p.openBlock(),p.createElementBlock(p.Fragment,{key:0},[(d=i.value)!=null&&d.url&&n.image?(p.openBlock(),p.createBlock(h,{key:0,onClose:c[0]||(c[0]=y=>l()),ref:"previewImgRef","url-list":[(g=i.value)==null?void 0:g.url],teleported:""},null,8,["url-list"])):p.createCommentVNode("v-if",!0),p.createCommentVNode(' <IkPreviewVideo :file="fileData" v-model:show="modal.video" />'),p.createCommentVNode(" 文档类 "),p.createVNode(p.unref(Us),{modelValue:n.video,"onUpdate:modelValue":c[1]||(c[1]=y=>n.video=y),url:(v=i.value)==null?void 0:v.url},null,8,["modelValue","url"]),p.createVNode(p.unref(mn),{modelValue:n.office,"onUpdate:modelValue":c[2]||(c[2]=y=>n.office=y),draggable:"","no-footer":"","no-header":"",fullscreen:"","show-close-bg":"","destroy-on-close":"","close-on-click-modal":"","close-on-press-escape":!1,"append-to-body":"",onClose:l,"modal-class":"ik-only-preview-dialog"},{default:p.withCtx(()=>{var y;return[p.createVNode(p.unref(En),{"config-options":e.value,"document-server-url":((y=a.onlyOfficeConfig)==null?void 0:y.serverUrl)||a.onlyofficeServer},null,8,["config-options","document-server-url"])]}),_:1},8,["modelValue"])],64)):p.createCommentVNode("v-if",!0)}}}),Js="",qi=Re(Vs);ie.IkPreviewFileDialog=qi,ie.default=qi,Object.defineProperties(ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
225
+ </xg-mini-progress>`)}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),r}(F),Le={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",FRAME_RATE:"framerate",POSTER:"poster"};function Ps(){try{return parseInt(window.performance.now(),10)}catch{return new Date().getTime()}}function Is(){try{var a=document.createElement("canvas").getContext;return!!a}catch{return!1}}var nt=null,As=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onLoadedData",function(s){t.player&&(t._frameCount=t.config.startFrameCount,t.stop(),t.renderOnTimeupdate(s),t.off(X,t.renderOnTimeupdate),t.on(X,t.renderOnTimeupdate))}),_(m(t),"onVisibilitychange",function(s){document.visibilityState==="visible"?t._checkIfCanStart()&&t.start():document.visibilityState==="hidden"&&t.stop()}),_(m(t),"renderOnTimeupdate",function(s){if(t._frameCount>0)t.renderOnce(),t._frameCount--;else{t._isLoaded=!0,t.off(X,t.renderOnTimeupdate);var l=t.config.startInterval;!t.player.paused&&t._checkIfCanStart()&&t.start(0,l)}}),_(m(t),"start",function(s,l){var u=t.player.video,c=Ps(),h=t.checkVideoIsSupport(u);!h||!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===Le.REAL_TIME||c-t.preTime>=l)&&(u&&u.videoWidth&&t.update(h,t.videoPI),t.preTime=c)),t.frameId=t._loopType==="timer"?f.setTimeout(m(t),t.start,l):f.requestAnimationFrame(t.start))}),_(m(t),"stop",function(){t.frameId&&(t._loopType==="timer"?f.clearTimeout(m(t),t.frameId):f.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return S(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,s=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!==Le.REAL_TIME&&this.interval>=1e3?"timer":"animation",this.once(ze,function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())}),s!==Le.POSTER&&(s!==Le.FIRST_FRAME&&(this.on(ye,function(){e.stop()}),this.on($,function(){var u=e.config.startInterval;e._checkIfCanStart()&&e.start(0,u)}),this.on(we,function(){e.stop()})),this.on(ae,this.onLoadedData),this.on(vt,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 s=e||n.root;s||(s=n.isInnerRender&&i.innerContainer||i.root),s.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,`"><canvas>
226
+ </canvas><xgmask></xgmask></div>`)),this.root=s.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){R.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 s=this.config.startInterval;this._checkIfCanStart()&&this.start(0,s)}}},{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&&!(D.browser==="safari"&&f.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=f.typeOf(e)==="String"?e:f.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!==Le.FIRST_FRAME&&e!==Le.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(),s=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=s;var c=parseInt(s/l*100,10);i.update(u,c),u=null}},u.src=e}}},{key:"update",value:function(e,i){if(!(!this.canvas||!this.canvasCtx||!i))try{var n=this._pos,s=this.config,l=this.canvas.getBoundingClientRect(),u=l.width,c=l.height;if(u!==n.width||c!==n.height||n.pi!==i){var h=parseInt(u/c*100,10);n.pi=i,n.width!==u&&(n.width=this.canvas.width=u),n.height!==c&&(n.height=this.canvas.height=c);var d=c,g=u;h<i?g=parseInt(c*i/100,10):h>i&&(d=parseInt(u*100/i,10)),n.rwidth=g*s.multiple,n.rheight=d*s.multiple,n.x=(u-n.rwidth)/2,n.y=(c-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=s.filter),this.canvasCtx.drawImage(e,n.x,n.y,n.rwidth,n.rheight)}catch(v){R.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 nt=="boolean"||(nt=Is()),nt}},{key:"supportCanvasFilter",value:function(){return!(D.browser==="safari"||D.browser==="firefox")}}]),r}(F),Ls={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:"直播"}},Be="info",Ut=vi,Ds=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"_recordUserActions",function(s){var l=t._getTime(),u=Object.assign({},s,{msg:s.msg||s.action});t._stats[Be].push(V(V({type:"userAction"},l),{},{payload:u}))}),_(m(t),"_onReset",function(){t.reset()}),_(m(t),"_recordInfo",function(s){t.info(s)}),_(m(t),"_downloadStats",function(){var s=t.getStats(),l=new Blob([JSON.stringify(s)],{type:"application/json"}),u=window.URL.createObjectURL(l),c=document.createElement("a");c.style.display="none",c.href=u,c.download="player.txt",c.disabled=!1,c.click()}),t}return S(r,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:new Date().toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on($e,this._recordUserActions),this.on(Ut.STATS_INFO,this._recordInfo),this.on(Ut.STATS_DOWNLOAD,this._downloadStats),this.on(Ut.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[Be].push(V(V({},i),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var i=Date.now(),n=i-e.startMs,s=V({cat:"function",dur:n,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(s)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(e={},_(e,Be,[]),_(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player,i=e.media,n=[],s=0;s<i.buffered.length;s++)n.push({start:i.buffered.start(s),end:i.buffered.end(s)});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[Be],i=e.map(function(n){var s=n.payload.data,l="";try{s instanceof Error?l=s.msg:s!==void 0&&(l=JSON.stringify(s))}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[Be];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}(he),Xi=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onGapJump",function(){var s=m(t),l=s.player,u=s.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 c=l.media.buffered,h=u.smallGapLimit||.5,d=u.gapDetectionThreshold||.3,g=l.media.currentTime,v=t._getIndex(c,g,d);if(!(v===null||v===0)){console.log("GapJump bufferRange ",c.start(v),c.end(v));var y=c.start(v)+.1,C=l.media.duration;if(!(y>C)){var b=y-g,w=b<=h;b<r.BROWSER_GAP_TOLERANCE||w&&(u.useGapJump!==!1&&(l.media.currentTime=t.isSafari?y+.1:y),t.player&&t.player.emit("detectGap"),console.log("gapJump gapIndex",v," isGapSamll:",w," currentTime:",l.media.currentTime," jumpSize:",g-l.media.currentTime),y!==.08&&l&&l.emit("log",{type:"oneevent",end_type:"gap",vid:l.config.vid,ext:{video_postion:Math.floor(y*1e3)}}))}}}}}),t}return S(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(Me,this.onGapJump),this.on($,function(){e.hasPlayed=!0}),this.on(Ve,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 s=this._getBuffered(e),l=null,u=0;u<s.length;u++){var c=s[u];if(c.start>i&&(u===0||s[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}(F);Xi.BROWSER_GAP_TOLERANCE=.001;var Rs=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"onWaiting",function(){var s=m(t),l=s.config;t.jumpCnt>l.jumpCntMax||t.timer||l.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,l.waitingTime*1e3))}),_(m(t),"onJump",function(){var s=m(t),l=s.player,u=s.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 c=l.currentTime+t.jumpSize,h=l.media.duration;c>h||(t.jumpCnt++,l.currentTime=c)}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.useWaitingTimeoutJump,s=i.jumpSize;n!==!1&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=s,this.on(Me,this.onWaiting),this.on([pt,oe],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on($,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(F),De="cdn",rt=["cdn"],Os=function(a){x(r,a);var o=P(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=o.call.apply(o,[this].concat(i)),_(m(t),"getSpeed",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De;if(!t.speedListCache||!t.speedListCache[s]||t.speedListCache[s].length<=0)return 0;var l=0;return t.speedListCache[s].map(function(u){l+=u}),Math.floor(l/t.speedListCache[s].length)}),_(m(t),"startTimer",function(){f.isMSE(t.player.video)||(t.initSpeedList(),t.cnt=0,t.timer=setTimeout(t.testSpeed,t.config.testTimeStep))}),_(m(t),"initSpeedList",function(){t.speedListCache={},rt.forEach(function(s){t.speedListCache[s]=[]})}),_(m(t),"_onRealSpeedChange",function(s){s.speed&&t.appendList(s.speed,s.type||De)}),_(m(t),"testSpeed",function(){if(clearTimeout(t.timer),t.timer=null,!(!t.player||!t.config.openSpeed)){var s=t.config,l=s.url,u=s.loadSize,c=s.testCnt,h=s.testTimeStep,d=l+(l.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=c)){t.cnt++;try{var g=new Date().getTime(),v=null,y=new XMLHttpRequest;t.xhr=y,y.open("GET",d);var C={},b=Math.floor(Math.random()*10);C.Range="bytes="+b+"-"+(u+b),C&&Object.keys(C).forEach(function(w){y.setRequestHeader(w,C[w])}),y.onreadystatechange=function(){if(y.readyState===4){t.xhr=null,v=new Date().getTime();var w=y.getResponseHeader("Content-Length")/1024*8,T=Math.round(w*1e3/(v-g));t.appendList(T),t.timer=setTimeout(t.testSpeed,h)}},y.send()}catch(w){console.error(w)}}}}),_(m(t),"appendList",function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De;if(!(!t.speedListCache||!t.speedListCache[l])){var u=t.config.saveSpeedMax;t.speedListCache[l].length>=u&&t.speedListCache[l].shift(),t.speedListCache[l].push(s);var c=m(t),h=c.player;h&&(l===De?h.realTimeSpeed=s:h[t.getSpeedName("realTime",l)]=s),t.updateSpeed(l)}}),_(m(t),"updateSpeed",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De,l=t.getSpeed(s),u=m(t),c=u.player;if(c)if(s===De)(!c.avgSpeed||l!==c.avgSpeed)&&(c.avgSpeed=l,c.emit(kt,{speed:l,realTimeSpeed:c.realTimeSpeed}));else{var h=t.getSpeedName("avg",s);(!c[h]||l!==c[h])&&(c[h]=l,c.emit(kt,{speed:l,realTimeSpeed:c.realTimeSpeed}))}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this.config,i=e.openSpeed,n=e.addSpeedTypeList;(n==null?void 0:n.length)>0&&rt.push.apply(rt,J(n)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,i&&this.on([ae,je],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([ae,je],this.startTimer),rt.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}(F),Ms=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.config,s=i.media||i.video;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],!n.disabled){var l=s.getVideoPlaybackQuality;l&&(this.on($,function(){e._startTick()}),this.on(we,function(){e._stopTick()}),this.on(me,function(){e._stopTick()}),this.on(ye,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,s=[],l=0;l<i.length;l++){var u=i.start(l),c=i.end(l);if(s.push({start:u,end:c}),u<=e&&e<=c-1){n=!0;break}}return{enoughBuffer:n,buffers:s}}},{key:"_checkStuck",value:function(e,i,n,s){var l=this.player.media||this.player.video,u=document.hidden,c=l.paused,h=l.readyState,d=l.currentTime,g=l.buffered;if(!(u||c||h<4)){var v=this._checkBuffer(d,g),y=v.enoughBuffer,C=v.buffers;y&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:d,buffers:C,curDecodedFrames:e,totalVideoFrames:i,droppedVideoFrames:n,checkInterval:s}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(mi,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,s=i.droppedVideoFrames,l=performance.now();if(n&&this._lastCheckPoint){var u=n-this._lastDecodedFrames,c=l-this._lastCheckPoint;this._checkStuck(u,n,s,c)}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}(F);Se.use(Ls);var Ns=S(function a(o,r){var t,e,i;E(this,a);var n=r&&r.isMobileSimulateMode==="mobile",s=r.isLive,l=s?[]:[Qr,Gr,xs,Es,Jr],u=[].concat(l,[Kr,Zr,ss,cs,ys,_s,gs,ps,ns,ls]),c=[Er,Sr,Pr,zr,Ir,bs,Ts,Ss,Rr];this.plugins=[Ds,Tr].concat(J(u),c,[Xi,Rs]);var h=n?"mobile":D.device;switch(h){case"pc":(t=this.plugins).push.apply(t,[zi,Ft,Gi,Os,Ms]);break;case"mobile":(e=this.plugins).push.apply(e,[Hr]);break;default:(i=this.plugins).push.apply(i,[zi,Ft,Gi])}(D.os.isIpad||h==="pc")&&this.plugins.push(As),D.os.isIpad&&this.plugins.push(Ft),this.ignores=[],this.i18n=[]}),Q=function(a){x(r,a);var o=P(r);function r(){return E(this,r),o.apply(this,arguments)}return S(r)}(et);_(Q,"defaultPreset",Ns),_(Q,"Util",f),_(Q,"Sniffer",D),_(Q,"Errors",Ue),_(Q,"Events",Zn),_(Q,"Plugin",F),_(Q,"BasePlugin",he),_(Q,"I18N",Se),_(Q,"STATE_CLASS",k),_(Q,"InstManager",Li);const $s="",Fs=["id"],Bs=p.defineComponent({name:"ElImageViewer",__name:"Player",props:p.mergeModels({url:{type:String,default:""},zIndex:{type:Number,default:200},config:{type:Object,default:()=>({})}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:p.mergeModels({close:()=>!0},["update:modelValue"]),setup(a,{emit:o}){let r=null;const t=a,{cLoadUrl:e}=nn(t),i=p.computed(()=>ot(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},s=p.computed(()=>({...n,...t.config})),l=o,u=p.useModel(a,"modelValue"),c=st.buildUUID(),h=Zi.useNamespace("image-viewer");function d(){l("close"),u.value=!1,r.destroy()}return p.watch(()=>u.value,g=>{g&&p.nextTick(()=>{r=new Q({id:c,url:i.value,...s.value})})}),(g,v)=>{const y=p.resolveComponent("el-icon");return u.value?(p.openBlock(),p.createBlock(p.Teleport,{key:0,to:"body"},[p.createVNode(p.Transition,{name:"viewer-fade",appear:""},{default:p.withCtx(()=>[p.createElementVNode("div",{ref:"wrapper",tabindex:-1,class:p.normalizeClass(p.unref(h).e("wrapper")),style:p.normalizeStyle({zIndex:a.zIndex})},[p.createElementVNode("div",{class:p.normalizeClass(p.unref(h).e("mask"))},null,2),p.createCommentVNode(" CANVAS "),p.createElementVNode("div",{class:p.normalizeClass(p.unref(h).e("canvas"))},[p.createElementVNode("div",{id:p.unref(c)},null,8,Fs),p.createCommentVNode(" CLOSE "),p.createElementVNode("span",{class:p.normalizeClass([p.unref(h).e("btn"),p.unref(h).e("close")]),onClick:d},[p.createVNode(y,{onClick:d},{default:p.withCtx(()=>[p.createVNode(p.unref(tn))]),_:1})],2)],2),p.renderSlot(g.$slots,"default",{},void 0,!0)],6)]),_:3})])):p.createCommentVNode("v-if",!0)}}}),Xs="",Hs=Re(He(Bs,[["__scopeId","data-v-b301aa7d"]])),Us=p.defineComponent({__name:"IkPreviewFileDialog",props:p.mergeModels({file:{type:Object,default:()=>[]},loadUrl:{type:String,default:""},onlyOfficeAccept:{type:String,default:".pdf,.docx,.doc.ppt,.pptx,.xlsx,.xls,"},onlyofficeServer:{type:String,default:""},onlyOfficeConfig:{type:Object,default:()=>({})},field:{type:Object,default:()=>({})}},{show:{default:!1},showModifiers:{}}),emits:["update:show"],setup(a){const o=a,r=p.useModel(a,"show"),t=p.computed(()=>({name:"name",url:"url",suffix:"suffix",size:"fileSize",...o.field})),e=p.ref(null),i=p.ref(null),n=p.reactive({image:!1,office:!1,video:!1}),s=u=>{var c,h,d,g,v,y,C;try{const b=((c=u==null?void 0:u.response)==null?void 0:c.data)||u,w=b[t.value.url]||(b==null?void 0:b.id)||b.attachmentId,T=(h=b[t.value.suffix]||b.attachmentSuffix)==null?void 0:h.toLowerCase(),B=b[t.value.name]||(b==null?void 0:b.attachmentName)||(b==null?void 0:b.originName);if(i.value={...u,name:u[t.value.name],url:ot(o.loadUrl,w)},u&&Vt(u,t.value)==="image"){n.image=!0;return}else if(u&&Vt(u,t.value)==="video"){n.video=!0;return}else if((((d=o.onlyOfficeConfig)==null?void 0:d.accept)||o.onlyOfficeAccept).includes(T)){n.office=!0,e.value={...o.onlyOfficeConfig,editorConfig:{...((g=o.onlyOfficeConfig)==null?void 0:g.editorConfig)||{},customization:{...((y=(v=o.onlyOfficeConfig)==null?void 0:v.editorConfig)==null?void 0:y.customization)||{},review:{reviewDisplay:"final"}}},document:{key:st.buildUUID(),title:B,url:ot(o.loadUrl,w),fileType:T,...((C=o.onlyOfficeConfig)==null?void 0:C.document)||{}},documentType:Qi(T)};return}}catch(b){console.info("预览错误: ",b)}};p.watch([r,o.file],([u,c])=>{u&&p.nextTick(()=>{s(o.file)})});const l=()=>{r.value=!1,n.office=!1,n.image=!1,n.video=!1,i.value=null};return(u,c)=>{var d,g,v;const h=p.resolveComponent("el-image-viewer");return r.value?(p.openBlock(),p.createElementBlock(p.Fragment,{key:0},[(d=i.value)!=null&&d.url&&n.image?(p.openBlock(),p.createBlock(h,{key:0,onClose:c[0]||(c[0]=y=>l()),ref:"previewImgRef","url-list":[(g=i.value)==null?void 0:g.url],teleported:""},null,8,["url-list"])):p.createCommentVNode("v-if",!0),p.createCommentVNode(' <IkPreviewVideo :file="fileData" v-model:show="modal.video" />'),p.createCommentVNode(" 文档类 "),p.createVNode(p.unref(Hs),{modelValue:n.video,"onUpdate:modelValue":c[1]||(c[1]=y=>n.video=y),url:(v=i.value)==null?void 0:v.url},null,8,["modelValue","url"]),p.createVNode(p.unref(vn),{modelValue:n.office,"onUpdate:modelValue":c[2]||(c[2]=y=>n.office=y),draggable:"","no-footer":"","no-header":"",fullscreen:"","show-close-bg":"","destroy-on-close":"","close-on-click-modal":"","close-on-press-escape":!1,"append-to-body":"",onClose:l,"modal-class":"ik-only-preview-dialog"},{default:p.withCtx(()=>{var y;return[p.createVNode(p.unref(wn),{"config-options":e.value,"document-server-url":((y=a.onlyOfficeConfig)==null?void 0:y.serverUrl)||a.onlyofficeServer},null,8,["config-options","document-server-url"])]}),_:1},8,["modelValue"])],64)):p.createCommentVNode("v-if",!0)}}}),Zs="",qi=Re(Us);ie.IkPreviewFileDialog=qi,ie.default=qi,Object.defineProperties(ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});