kplayer-ts 1.0.0

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.
@@ -0,0 +1,410 @@
1
+ "use strict";const C=/mobile|android|iphone|ipod|phone|ipad/i.test(window.navigator.userAgent),u={secondToTime(n){if(n=n||0,n===0||n===1/0||n.toString()==="NaN")return"00:00";const e=a=>a<10?"0"+a:""+a,t=Math.floor(n/3600),i=Math.floor((n-t*3600)/60),s=Math.floor(n-t*3600-i*60);return(t>0?[t,i,s]:[i,s]).map(e).join(":")},getElementViewLeft(n){let e=n.offsetLeft,t=n.offsetParent;const i=document.body.scrollLeft+document.documentElement.scrollLeft;if(!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement)for(;t!==null;)e+=t.offsetLeft,t=t.offsetParent;else for(;t!==null&&t!==n;)e+=t.offsetLeft,t=t.offsetParent;return e-i},getBoundingClientRectViewLeft(n){const e=window.scrollY||window.pageYOffset||document.body.scrollTop+(document.documentElement&&document.documentElement.scrollTop||0);if(n.getBoundingClientRect){const t=this.getBoundingClientRectViewLeft;if(typeof t.offset!="number"){let a=document.createElement("div");a.style.cssText="position:absolute;top:0;left:0;",document.body.appendChild(a),t.offset=-a.getBoundingClientRect().top-e,document.body.removeChild(a),a=null}const i=n.getBoundingClientRect(),s=t.offset;return i.left+s}else return this.getElementViewLeft(n)},getScrollPosition(){return{left:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}},setScrollPosition({left:n=0,top:e=0}){this.isFirefox?(document.documentElement.scrollLeft=n,document.documentElement.scrollTop=e):window.scrollTo(n,e)},isMobile:C,isFirefox:/firefox/i.test(window.navigator.userAgent),isChrome:/chrome/i.test(window.navigator.userAgent),isSafari:/safari/i.test(window.navigator.userAgent),storage:{set(n,e){localStorage.setItem(n,String(e))},get(n){return localStorage.getItem(n)}},nameMap:{dragStart:C?"touchstart":"mousedown",dragMove:C?"touchmove":"mousemove",dragEnd:C?"touchend":"mouseup"},color2Number(n){return n[0]==="#"&&(n=n.substr(1)),n.length===3&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`),parseInt(n,16)+0&16777215},number2Color(n){return"#"+("00000"+n.toString(16)).slice(-6)},number2Type(n){switch(n){case 0:return"right";case 1:return"top";case 2:return"bottom";default:return"right"}}},j=n=>{var t;const e={container:n.element||document.getElementsByClassName("kplayer")[0],live:!1,autoplay:!1,theme:"#b7daff",loop:!1,lang:(navigator.language||navigator.browserLanguage||"en").toLowerCase(),screenshot:!1,airplay:!0,chromecast:!1,hotkey:!0,preload:"metadata",volume:.7,playbackSpeed:[.5,.75,1,1.25,1.5,2],video:{},contextmenu:[],ad:null,vastAD:!1,vastADURL:"",mutex:!0,pluginOptions:{hls:{},flv:{},dash:{},webtorrent:{}},preventClickToggle:!1};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&!Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=e[i]);return n.video&&(n.video.type||(n.video.type="auto")),typeof n.awaken=="object"&&n.awaken&&(n.awaken.user||(n.awaken.user="DIYgod")),n.subtitle&&(n.subtitle.type||(n.subtitle.type="webvtt"),n.subtitle.fontSize||(n.subtitle.fontSize="20px"),n.subtitle.bottom||(n.subtitle.bottom="40px"),n.subtitle.color||(n.subtitle.color="#fff")),(t=n.video)!=null&&t.quality&&n.video.defaultQuality!==void 0&&(n.video.url=n.video.quality[n.video.defaultQuality].url),n.lang&&(n.lang=n.lang.toLowerCase()),n.contextmenu=(n.contextmenu||[]).concat([{key:"about-author",link:"https://github.com/kenji-07/"}]),n};function N(n){this.lang=n,this.fallbackLang=this.lang.includes("-")?this.lang.split("-")[0]:this.lang,this.tran=e=>(e=e.toLowerCase(),E[this.lang]&&E[this.lang][e]?E[this.lang][e]:E[this.fallbackLang]&&E[this.fallbackLang][e]?E[this.fallbackLang][e]:_[e]?_[e]:e)}const _={"awaken-loading":"Awaken ачааллаж байна",top:"Дээд",bottom:"Доод",rolling:"Гүйлгэх","input-awaken-enter":"Awaken бичээд Enter дарна уу","about-author":"Зохиогчийн тухай","kplayer-feedback":"KPlayer санал хүсэлт","about-kplayer":"KPlayer-ийн тухай",loop:"Дахин тоглуулах",speed:"Тоглуулах хурд",quality:"Бичлэгийн чанар","opacity-awaken":"Awaken тунгалаг байдал",normal:"Хэвийн","please-input-awaken":"Awaken текст оруулна уу!","set-awaken-color":"Awaken өнгө тохируулах","set-awaken-type":"Awaken төрөл тохируулах","show-awaken":"Awaken харуулах","video-failed":"Видео ачааллахад алдаа гарлаа","awaken-failed":"Awaken ачааллахад алдаа гарлаа","awaken-send-failed":"Awaken илгээхэд алдаа гарлаа","switching-quality":"Чанар солигдож байна: %q","switched-quality":"Чанар солигдлоо: %q",ff:">> %s секунд",rew:"<< %s секунд","unlimited-awaken":"Хязгааргүй awaken","send-awaken":"Awaken илгээх",setting:"ТОХИРГОО",fullscreen:"Бүтэн дэлгэц","web-fullscreen":"Вэб бүтэн дэлгэц",send:"Илгээх",screenshot:"Дэлгэцийн зураг авах",airplay:"AirPlay",chromecast:"Chromecast",subtitle:"Хадмал орчуулга",off:"Унтраалттай","show-subs":"Хадмал харуулах","hide-subs":"Хадмал нуух",volume:"Дууны түвшин",live:"Шууд","video-info":"Видео мэдээлэл"},E={mn:_,en:{"awaken-loading":"awaken is loading",top:"Top",bottom:"Bottom",rolling:"Rolling","input-awaken-enter":"Input awaken, hit Enter","about-author":"About author","kplayer-feedback":"KPlayer feedback","about-kplayer":"About KPlayer",loop:"Loop",speed:"Speed",quality:"Quality","opacity-awaken":"Opacity for awaken",normal:"Normal","please-input-awaken":"Please input awaken content!","set-awaken-color":"Set awaken color","set-awaken-type":"Set awaken type","show-awaken":"Show awaken","video-failed":"Video load failed","awaken-failed":"awaken load failed","awaken-send-failed":"awaken send failed","switching-quality":"Switching to %q quality","switched-quality":"Switched to %q quality",ff:">> %s s",rew:"<< %s s","unlimited-awaken":"Unlimited awaken","send-awaken":"Send awaken",setting:"Setting",fullscreen:"Full screen","web-fullscreen":"Web full screen",send:"Send",screenshot:"Screenshot",airplay:"AirPlay",chromecast:"ChromeCast",subtitle:"Subtitle",off:"Off","show-subs":"Show subtitle","hide-subs":"Hide subtitle",volume:"Volume",live:"Live","video-info":"Video info"},"zh-cn":{"awaken-loading":"弹幕加载中",top:"顶部",bottom:"底部",rolling:"滚动","input-awaken-enter":"输入弹幕,回车发送","about-author":"关于作者","kplayer-feedback":"播放器意见反馈","about-kplayer":"关于 KPlayer 播放器",loop:"洗脑循环",speed:"速度",quality:"画质","opacity-awaken":"弹幕透明度",normal:"正常","please-input-awaken":"要输入弹幕内容啊喂!","set-awaken-color":"设置弹幕颜色","set-awaken-type":"设置弹幕类型","show-awaken":"显示弹幕","video-failed":"视频加载失败","awaken-failed":"弹幕加载失败","awaken-send-failed":"弹幕发送失败","switching-quality":"正在切换至 %q 画质","switched-quality":"已经切换至 %q 画质",ff:"快进 %s 秒",rew:"快退 %s 秒","unlimited-awaken":"海量弹幕","send-awaken":"发送弹幕",setting:"设置",fullscreen:"全屏","web-fullscreen":"页面全屏",send:"发送",screenshot:"截图",airplay:"无线投屏",chromecast:"ChromeCast",subtitle:"字幕",off:"关闭","show-subs":"显示字幕","hide-subs":"隐藏字幕",volume:"音量",live:"直播","video-info":"视频统计信息"},"zh-tw":{"awaken-loading":"彈幕載入中",top:"頂部",bottom:"底部",rolling:"滾動","input-awaken-enter":"輸入彈幕,Enter 發送","about-author":"關於作者","kplayer-feedback":"播放器意見回饋","about-kplayer":"關於 KPlayer 播放器",loop:"循環播放",speed:"速度",quality:"畫質","opacity-awaken":"彈幕透明度",normal:"正常","please-input-awaken":"請輸入彈幕內容啊!","set-awaken-color":"設定彈幕顏色","set-awaken-type":"設定彈幕類型","show-awaken":"顯示彈幕","video-failed":"影片載入失敗","awaken-failed":"彈幕載入失敗","awaken-send-failed":"彈幕發送失敗","switching-quality":"正在切換至 %q 畫質","switched-quality":"已經切換至 %q 畫質",ff:"快進 %s 秒",rew:"快退 %s 秒","unlimited-awaken":"巨量彈幕","send-awaken":"發送彈幕",setting:"設定",fullscreen:"全螢幕","web-fullscreen":"頁面全螢幕",send:"發送",screenshot:"截圖",airplay:"無線投屏",chromecast:"ChromeCast",subtitle:"字幕",off:"關閉","show-subs":"顯示字幕","hide-subs":"隱藏字幕",volume:"音量",live:"直播","video-info":"影片統計訊息"},"ko-kr":{"awaken-loading":"awaken를 불러오는 중입니다.",top:"Top",bottom:"Bottom",rolling:"Rolling","input-awaken-enter":"awaken를 입력하고 Enter를 누르세요.","about-author":"만든이","kplayer-feedback":"피드백 보내기","about-kplayer":"KPlayer 정보",loop:"반복",speed:"배속",quality:"화질","opacity-awaken":"awaken 불투명도",normal:"표준","please-input-awaken":"awaken를 입력하세요!","set-awaken-color":"awaken 색상","set-awaken-type":"awaken 설정","show-awaken":"awaken 표시","video-failed":"비디오를 불러오지 못했습니다.","awaken-failed":"awaken를 불러오지 못했습니다.","awaken-send-failed":"awaken 전송에 실패했습니다.","switching-quality":"전환 %q 화질","switched-quality":"전환 됨 %q 화질",ff:"앞으로 %s 초",rew:"뒤로 %s 초","unlimited-awaken":"끝없는 awaken","send-awaken":"awaken 보내기",setting:"설정",fullscreen:"전체 화면","web-fullscreen":"웹 내 전체화면",send:"보내기",screenshot:"화면 캡쳐",airplay:"에어플레이",chromecast:"ChromeCast",subtitle:"부제",off:"끄다","show-subs":"자막 보이기","hide-subs":"자막 숨기기",volume:"볼륨",live:"생방송","video-info":"비디오 정보"},de:{"awaken-loading":"awaken lädt...",top:"Oben",bottom:"Unten",rolling:"Rollend","input-awaken-enter":"Drücke Enter nach dem Einfügen vom awaken","about-author":"Über den Autor","kplayer-feedback":"KPlayer Feedback","about-kplayer":"Über KPlayer",loop:"Wiederholen",speed:"Geschwindigkeit",quality:"Qualität","opacity-awaken":"Transparenz für awaken",normal:"Normal","please-input-awaken":"Bitte awaken Inhalt eingeben!","set-awaken-color":"awaken Farbe festlegen","set-awaken-type":"awaken Typ festlegen","show-awaken":"Zeige awaken","video-failed":"Das Video konnte nicht geladen werden","awaken-failed":"awaken konnte nicht geladen werden","awaken-send-failed":"Das senden von awaken ist fehgeschlagen","switching-quality":"Wechsle zur %q Qualität","switched-quality":"Zur %q Qualität gewechselt",ff:"%s s Vorwärts",rew:"%s s Zurück","unlimited-awaken":"Unlimitiertes awaken","send-awaken":"Sende awaken",setting:"Einstellungen",fullscreen:"Vollbild","web-fullscreen":"Browser Vollbild",send:"Senden",screenshot:"Screenshot",airplay:"AirPlay",chromecast:"ChromeCast",subtitle:"Untertitel",off:"Schließung","show-subs":"Zeige Untertitel","hide-subs":"Verstecke Untertitel",volume:"Lautstärke",live:"Live","video-info":"Video Info"},ja:{"awaken-loading":"コメントを読み込んでいます",top:"トップ",bottom:"ボトム",rolling:"スクロール","input-awaken-enter":"コメントを入力し,Enter で送信","about-author":"作者について","kplayer-feedback":"KPlayer についての意見・要望","about-kplayer":"KPlayer について",loop:"くり返し",speed:"再生速度",quality:"へ","opacity-awaken":"コメントの透明度",normal:"通常","please-input-awaken":"コメントを入力してください!","set-awaken-color":"コメントの色","set-awaken-type":"コメントの種類","show-awaken":"コメント表示","video-failed":"ビデオの読み込みに失敗","awaken-failed":"コメントの読み込みに失敗","awaken-send-failed":"コメントの送信に失敗","switching-quality":"%qへ切り替え中","switched-quality":"%qへ切り替え完了",ff:"%s 秒早送り",rew:"%s 秒早戻し","unlimited-awaken":"コメント無制限","send-awaken":"コメント送信",setting:"設定",fullscreen:"全画面表示","web-fullscreen":"ブラウザ全体表示",send:"送信",screenshot:"画面コピー",airplay:"AirPlay",chromecast:"ChromeCast",subtitle:"字幕",off:"OFF","show-subs":"字幕表示","hide-subs":"字幕非表示",volume:"音量",live:"ライブ","video-info":"動画情報"},ru:{"awaken-loading":"Загрузка комментариев",top:"Вверху",bottom:"Внизу",rolling:"Лента","input-awaken-enter":"Введите комментарий, нажмите Enter","about-author":"Об авторе","kplayer-feedback":"Обратная связь","about-kplayer":"О плеере",loop:"Закольцевать",speed:"Скорость",quality:"Качество","opacity-awaken":"Прозрачность",normal:"Обычный","please-input-awaken":"Пожалуйста, введите комментарий!","set-awaken-color":"Цвет комментария","set-awaken-type":"Тип комментария","show-awaken":"Показать комментарии","video-failed":"Ошибка загрузки видео","awaken-failed":"Ошибка загрузки комментариев","awaken-send-failed":"Ошибка отправки комментария","switching-quality":"Переключение качества на: %q","switched-quality":"Установлено качество: %q",ff:"Вперёд: %s с",rew:"Назад: %s с","unlimited-awaken":"Без ограничений","send-awaken":"Отправить комментарий",setting:"Настройки",fullscreen:"На весь экран","web-fullscreen":"На весь Web экран",send:"Отправить",screenshot:"Скриншот",airplay:"AirPlay",chromecast:"ChromeCast",subtitle:"Комментарий",off:"Выкл","show-subs":"Показать комментарии","hide-subs":"Скрыть комментарии",volume:"Громкость",live:"Живые комментарии","video-info":"Информация о видео"}},D=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 32">
2
+ <path d="M15.552 15.168q0.448 0.32 0.448 0.832 0 0.448-0.448 0.768l-13.696 8.512q-0.768 0.512-1.312 0.192t-0.544-1.28v-16.448q0-0.96 0.544-1.28t1.312 0.192z"></path>
3
+ </svg>`,K=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 17 32">
4
+ <path d="M14.080 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048zM2.88 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048z"></path>
5
+ </svg>`,Q=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 21 32">
6
+ <path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528zM25.152 16q0 2.72-1.536 5.056t-4 3.36q-0.256 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.704 0.672-1.056 1.024-0.512 1.376-0.8 1.312-0.96 2.048-2.4t0.736-3.104-0.736-3.104-2.048-2.4q-0.352-0.288-1.376-0.8-0.672-0.352-0.672-1.056 0-0.448 0.32-0.8t0.8-0.352q0.224 0 0.48 0.096 2.496 1.056 4 3.36t1.536 5.056z"></path>
7
+ </svg>`,X=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 21 32">
8
+ <path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528z"></path>
9
+ </svg>`,Y=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 21 32">
10
+ <path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8z"></path>
11
+ </svg>`,Z=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 33">
12
+ <path d="M6.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v4h4c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333zM30.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h4v-4c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM30.667 12c-0.8 0-1.333-0.533-1.333-1.333v-4h-4c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM1.333 12c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333h-4v4c0 0.8-0.533 1.333-1.333 1.333z"></path>
13
+ </svg>`,G=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 33">
14
+ <path d="M24.965 24.38h-18.132c-1.366 0-2.478-1.113-2.478-2.478v-11.806c0-1.364 1.111-2.478 2.478-2.478h18.132c1.366 0 2.478 1.113 2.478 2.478v11.806c0 1.364-1.11 2.478-2.478 2.478zM6.833 10.097v11.806h18.134l-0.002-11.806h-18.132zM2.478 28.928h5.952c0.684 0 1.238-0.554 1.238-1.239 0-0.684-0.554-1.238-1.238-1.238h-5.952v-5.802c0-0.684-0.554-1.239-1.238-1.239s-1.239 0.556-1.239 1.239v5.802c0 1.365 1.111 2.478 2.478 2.478zM30.761 19.412c-0.684 0-1.238 0.554-1.238 1.238v5.801h-5.951c-0.686 0-1.239 0.554-1.239 1.238 0 0.686 0.554 1.239 1.239 1.239h5.951c1.366 0 2.478-1.111 2.478-2.478v-5.801c0-0.683-0.554-1.238-1.239-1.238zM0 5.55v5.802c0 0.683 0.554 1.238 1.238 1.238s1.238-0.555 1.238-1.238v-5.802h5.952c0.684 0 1.238-0.554 1.238-1.238s-0.554-1.238-1.238-1.238h-5.951c-1.366-0.001-2.478 1.111-2.478 2.476zM32 11.35v-5.801c0-1.365-1.11-2.478-2.478-2.478h-5.951c-0.686 0-1.239 0.554-1.239 1.238s0.554 1.238 1.239 1.238h5.951v5.801c0 0.683 0.554 1.237 1.238 1.237 0.686 0.002 1.239-0.553 1.239-1.236z"></path>
15
+ </svg>`,J=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 28">
16
+ <path d="M28.633 17.104c0.035 0.21 0.026 0.463-0.026 0.76s-0.14 0.598-0.262 0.904c-0.122 0.306-0.271 0.581-0.445 0.825s-0.367 0.419-0.576 0.524c-0.209 0.105-0.393 0.157-0.55 0.157s-0.332-0.035-0.524-0.105c-0.175-0.052-0.393-0.1-0.655-0.144s-0.528-0.052-0.799-0.026c-0.271 0.026-0.541 0.083-0.812 0.17s-0.502 0.236-0.694 0.445c-0.419 0.437-0.664 0.934-0.734 1.493s0.009 1.092 0.236 1.598c0.175 0.349 0.148 0.699-0.079 1.048-0.105 0.14-0.271 0.284-0.498 0.432s-0.476 0.284-0.747 0.406-0.555 0.218-0.851 0.288c-0.297 0.070-0.559 0.105-0.786 0.105-0.157 0-0.306-0.061-0.445-0.183s-0.236-0.253-0.288-0.393h-0.026c-0.192-0.541-0.52-1.009-0.982-1.402s-1-0.589-1.611-0.589c-0.594 0-1.131 0.197-1.611 0.589s-0.816 0.851-1.009 1.375c-0.087 0.21-0.218 0.362-0.393 0.458s-0.367 0.144-0.576 0.144c-0.244 0-0.52-0.044-0.825-0.131s-0.611-0.197-0.917-0.327c-0.306-0.131-0.581-0.284-0.825-0.458s-0.428-0.349-0.55-0.524c-0.087-0.122-0.135-0.266-0.144-0.432s0.057-0.397 0.197-0.694c0.192-0.402 0.266-0.86 0.223-1.375s-0.266-0.991-0.668-1.428c-0.244-0.262-0.541-0.432-0.891-0.511s-0.681-0.109-0.995-0.092c-0.367 0.017-0.742 0.087-1.127 0.21-0.244 0.070-0.489 0.052-0.734-0.052-0.192-0.070-0.371-0.231-0.537-0.485s-0.314-0.533-0.445-0.838c-0.131-0.306-0.231-0.62-0.301-0.943s-0.087-0.59-0.052-0.799c0.052-0.384 0.227-0.629 0.524-0.734 0.524-0.21 0.995-0.555 1.415-1.035s0.629-1.017 0.629-1.611c0-0.611-0.21-1.144-0.629-1.598s-0.891-0.786-1.415-0.996c-0.157-0.052-0.288-0.179-0.393-0.38s-0.157-0.406-0.157-0.616c0-0.227 0.035-0.48 0.105-0.76s0.162-0.55 0.275-0.812 0.244-0.502 0.393-0.72c0.148-0.218 0.31-0.38 0.485-0.485 0.14-0.087 0.275-0.122 0.406-0.105s0.275 0.052 0.432 0.105c0.524 0.21 1.070 0.275 1.637 0.197s1.070-0.327 1.506-0.747c0.21-0.209 0.362-0.467 0.458-0.773s0.157-0.607 0.183-0.904c0.026-0.297 0.026-0.568 0-0.812s-0.048-0.419-0.065-0.524c-0.035-0.105-0.066-0.227-0.092-0.367s-0.013-0.262 0.039-0.367c0.105-0.244 0.293-0.458 0.563-0.642s0.563-0.336 0.878-0.458c0.314-0.122 0.62-0.214 0.917-0.275s0.533-0.092 0.707-0.092c0.227 0 0.406 0.074 0.537 0.223s0.223 0.301 0.275 0.458c0.192 0.471 0.507 0.886 0.943 1.244s0.952 0.537 1.546 0.537c0.611 0 1.153-0.17 1.624-0.511s0.803-0.773 0.996-1.297c0.070-0.14 0.179-0.284 0.327-0.432s0.301-0.223 0.458-0.223c0.244 0 0.511 0.035 0.799 0.105s0.572 0.166 0.851 0.288c0.279 0.122 0.537 0.279 0.773 0.472s0.423 0.402 0.563 0.629c0.087 0.14 0.113 0.293 0.079 0.458s-0.070 0.284-0.105 0.354c-0.227 0.506-0.297 1.039-0.21 1.598s0.341 1.048 0.76 1.467c0.419 0.419 0.934 0.651 1.546 0.694s1.179-0.057 1.703-0.301c0.14-0.087 0.31-0.122 0.511-0.105s0.371 0.096 0.511 0.236c0.262 0.244 0.493 0.616 0.694 1.113s0.336 1 0.406 1.506c0.035 0.297-0.013 0.528-0.144 0.694s-0.266 0.275-0.406 0.327c-0.542 0.192-1.004 0.528-1.388 1.009s-0.576 1.026-0.576 1.637c0 0.594 0.162 1.113 0.485 1.559s0.747 0.764 1.27 0.956c0.122 0.070 0.227 0.14 0.314 0.21 0.192 0.157 0.323 0.358 0.393 0.602v0zM16.451 19.462c0.786 0 1.528-0.149 2.227-0.445s1.305-0.707 1.821-1.231c0.515-0.524 0.921-1.131 1.218-1.821s0.445-1.428 0.445-2.214c0-0.786-0.148-1.524-0.445-2.214s-0.703-1.292-1.218-1.808c-0.515-0.515-1.122-0.921-1.821-1.218s-1.441-0.445-2.227-0.445c-0.786 0-1.524 0.148-2.214 0.445s-1.292 0.703-1.808 1.218c-0.515 0.515-0.921 1.118-1.218 1.808s-0.445 1.428-0.445 2.214c0 0.786 0.149 1.524 0.445 2.214s0.703 1.297 1.218 1.821c0.515 0.524 1.118 0.934 1.808 1.231s1.428 0.445 2.214 0.445v0z"></path>
17
+ </svg>`,ee=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
18
+ <path d="M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"></path>
19
+ </svg>`,te='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-camera"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 7h1a2 2 0 0 0 2 -2a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1a2 2 0 0 0 2 2h1a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2" /><path d="M9 13a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" /></svg>',ie='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-broadcast"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18.364 19.364a9 9 0 1 0 -12.728 0" /><path d="M15.536 16.536a5 5 0 1 0 -7.072 0" /><path d="M11 13a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg>',se='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-subtitles"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 5a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3l12 0" /><path d="M7 15h5" /><path d="M15 15h2" /><path d="M17 12h-3" /><path d="M11 12h-1" /></svg>',ae=`<svg height="100%" version="1.1" viewBox="0 0 22 22">
20
+ <svg x="7" y="1">
21
+ <circle class="diplayer-loading-dot diplayer-loading-dot-0" cx="4" cy="4" r="2"></circle>
22
+ </svg>
23
+ <svg x="11" y="3">
24
+ <circle class="diplayer-loading-dot diplayer-loading-dot-1" cx="4" cy="4" r="2"></circle>
25
+ </svg>
26
+ <svg x="13" y="7">
27
+ <circle class="diplayer-loading-dot diplayer-loading-dot-2" cx="4" cy="4" r="2"></circle>
28
+ </svg>
29
+ <svg x="11" y="11">
30
+ <circle class="diplayer-loading-dot diplayer-loading-dot-3" cx="4" cy="4" r="2"></circle>
31
+ </svg>
32
+ <svg x="7" y="13">
33
+ <circle class="diplayer-loading-dot diplayer-loading-dot-4" cx="4" cy="4" r="2"></circle>
34
+ </svg>
35
+ <svg x="3" y="11">
36
+ <circle class="diplayer-loading-dot diplayer-loading-dot-5" cx="4" cy="4" r="2"></circle>
37
+ </svg>
38
+ <svg x="1" y="7">
39
+ <circle class="diplayer-loading-dot diplayer-loading-dot-6" cx="4" cy="4" r="2"></circle>
40
+ </svg>
41
+ <svg x="3" y="3">
42
+ <circle class="diplayer-loading-dot diplayer-loading-dot-7" cx="4" cy="4" r="2"></circle>
43
+ </svg>
44
+ </svg>`,ne='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-cast"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 19l.01 0" /><path d="M7 19a4 4 0 0 0 -4 -4" /><path d="M11 19a8 8 0 0 0 -8 -8" /><path d="M15 19h3a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-12a3 3 0 0 0 -2.8 2" /></svg>',le=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
45
+ <g><path d="M990,503.4c0,25.9-21,46.9-46.9,46.9H56.9c-25.9,0-46.9-21-46.9-46.9v-4.6c0-25.9,21-46.9,46.9-46.9h886.1c25.9,0,46.9,21,46.9,46.9V503.4z"></path><path d="M430.9,131.1c18.3,18.3,18.3,48.1,0,66.4L93.1,535.2c-18.3,18.3-48.1,18.3-66.4,0l-2.9-2.9C5.5,514,5.5,484.3,23.9,466l337.7-337.7c18.3-18.3,48.1-18.3,66.4,0L430.9,131.1z"></path><path d="M430.9,868.9c18.3-18.3,18.3-48.1,0-66.4L93.1,464.8c-18.3-18.3-48.1-18.3-66.4,0l-2.9,2.9C5.5,486,5.5,515.7,23.9,534l337.7,337.7c18.3,18.3,48.1,18.3,66.4,0L430.9,868.9z"></path></g>
46
+ </svg>`,re=`<svg height="64" viewBox="0 0 52 58" width="64" xmlns="http://www.w3.org/2000/svg">
47
+ <g fill="currentColor" fill-rule="evenodd">
48
+ <path d="m 5.5924415,15.888 c 0.689576,-0.850221 1.934556,-0.988067 2.793425,-0.309293 0.858869,0.678775 1.01244,1.921914 0.344575,2.789293 -3.080792,3.874075 -4.749496,8.682314 -4.731,13.632 C 3.9968145,43.81419 13.325754,53.521229 25.13073,53.987735 36.935706,54.45424 47.001556,45.513639 47.931221,33.736084 48.860886,21.958529 40.322412,11.54939 28.590442,10.158 l 2.709,2.323 c 0.805609,0.726128 0.885668,1.962033 0.180472,2.786027 -0.705196,0.823994 -1.938636,0.935771 -2.780472,0.251973 l -7,-6 C 21.25581,9.139031 21.000457,8.5841111 21.000457,8 c 0,-0.5841111 0.255353,-1.1390314 0.698985,-1.519 l 7,-6 c 0.539853,-0.48659126 1.301183,-0.64202535 1.988568,-0.4059887 0.687386,0.2360366 1.192625,0.8263892 1.319668,1.5419814 C 32.134722,2.3325849 31.863571,3.0607745 31.299442,3.519 l -3.019,2.587 C 42.289945,7.3398222 52.778928,19.489857 51.954757,33.529417 51.130586,47.568977 39.292047,58.408309 25.234406,57.994492 11.176766,57.580675 -0.00366845,46.06373 -5.5845031e-4,32 -0.02194145,26.149702 1.9507985,20.466743 5.5924415,15.888 Z" fill-rule="nonzero"/>
49
+ <path d="m 18.518442,15.3 c -0.345217,0.403014 -0.836445,0.652314 -1.365537,0.693013 -0.529093,0.0407 -1.05267,-0.130538 -1.455463,-0.476013 l -7.0000005,-6 C 8.2538095,9.137031 7.9984565,8.5821111 7.9984565,7.998 c 0,-0.5841111 0.255353,-1.1390315 0.698985,-1.519 l 7.0000005,-6 c 0.539853,-0.48659126 1.301183,-0.64202535 1.988568,-0.4059887 0.687386,0.2360366 1.192625,0.8263892 1.319668,1.5419814 C 19.132722,2.3305849 18.861571,3.0587745 18.297442,3.517 l -5.225,4.483 5.227,4.481 c 0.838569,0.718149 0.936595,1.979957 0.219,2.819 z" fill-rule="nonzero"/>
50
+ <path d="m 15,40 c -1.104569,0 -2,0.895431 -2,2 0,1.104569 0.895431,2 2,2 h 6 c 1.104569,0 2,-0.895431 2,-2 0,-1.104569 -0.895431,-2 -2,-2 H 20 V 23 C 19.999864,22.262562 19.593937,21.58503 18.943766,21.237045 18.293595,20.88906 17.504684,20.92709 16.891,21.336 l -3,2 c -0.895079,0.599923 -1.153983,1.801111 -0.585512,2.716488 C 13.87396,26.967865 15.06543,27.268334 16,26.732 V 40 Z" fill-rule="nonzero"/>
51
+ <path d="m 31,21 c -2.761424,0 -5,2.238576 -5,5 v 13 c 0,2.761424 2.238576,5 5,5 h 3 c 2.761424,0 5,-2.238576 5,-5 V 26 c 0,-2.761424 -2.238576,-5 -5,-5 z m 4,5 v 13 c 0,0.552285 -0.447715,1 -1,1 h -3 c -0.552285,0 -1,-0.447715 -1,-1 V 26 c 0,-0.552285 0.447715,-1 1,-1 h 3 c 0.552285,0 1,0.447715 1,1 z" fill-rule="nonzero"/>
52
+ </g>
53
+ </svg>`,oe=`<svg height="64" viewBox="0 0 52 58" width="64" xmlns="http://www.w3.org/2000/svg">
54
+ <g fill="currentColor" fill-rule="evenodd">
55
+ <path d="M 46.407,15.888 C 45.717424,15.037779 44.472444,14.899933 43.613575,15.578707 42.754706,16.257482 42.601135,17.500621 43.269,18.368 46.349792,22.242075 48.018496,27.050314 48,32 48.002627,43.81419 38.673688,53.521229 26.868712,53.987735 15.063736,54.45424 4.9978851,45.513639 4.0682205,33.736084 3.1385559,21.958529 11.67703,11.54939 23.409,10.158 L 20.7,12.481 c -0.805609,0.726128 -0.885668,1.962033 -0.180472,2.786027 0.705196,0.823994 1.938636,0.935771 2.780472,0.251973 l 7,-6 C 30.743632,9.139031 30.998985,8.5841111 30.998985,8 30.998985,7.4158889 30.743632,6.8609686 30.3,6.481 l -7,-6 C 22.760147,-0.00559126 21.998817,-0.16102535 21.311432,0.0750113 20.624046,0.3110479 20.118807,0.9014005 19.991764,1.6169927 19.86472,2.3325849 20.135871,3.0607745 20.7,3.519 l 3.019,2.587 C 9.709497,7.3398222 -0.77948671,19.489857 0.0446845,33.529417 0.8688557,47.568977 12.707395,58.408309 26.765036,57.994492 40.822676,57.580675 52.00311,46.06373 52,32 52.021383,26.149702 50.048643,20.466743 46.407,15.888 Z" fill-rule="nonzero"/>
56
+ <path d="m 33.481,15.3 c 0.345217,0.403014 0.836445,0.652314 1.365537,0.693013 0.529093,0.0407 1.05267,-0.130538 1.455463,-0.476013 l 7,-6 c 0.443632,-0.379969 0.698985,-0.9348889 0.698985,-1.519 0,-0.5841111 -0.255353,-1.1390315 -0.698985,-1.519 l -7,-6 C 35.762147,-0.00759126 35.000817,-0.16302535 34.313432,0.0730113 33.626046,0.3090479 33.120807,0.8994005 32.993764,1.6149927 32.86672,2.3305849 33.137871,3.0587745 33.702,3.517 L 38.927,8 33.7,12.481 c -0.838569,0.718149 -0.936595,1.979957 -0.219,2.819 z" fill-rule="nonzero"/>
57
+ <path d="m 15,40 c -1.104569,0 -2,0.895431 -2,2 0,1.104569 0.895431,2 2,2 h 6 c 1.104569,0 2,-0.895431 2,-2 0,-1.104569 -0.895431,-2 -2,-2 H 20 V 23 C 19.999864,22.262562 19.593937,21.58503 18.943766,21.237045 18.293595,20.88906 17.504684,20.92709 16.891,21.336 l -3,2 c -0.895079,0.599923 -1.153983,1.801111 -0.585512,2.716488 C 13.87396,26.967865 15.06543,27.268334 16,26.732 V 40 Z" fill-rule="nonzero"/>
58
+ <path d="m 31,21 c -2.761424,0 -5,2.238576 -5,5 v 13 c 0,2.761424 2.238576,5 5,5 h 3 c 2.761424,0 5,-2.238576 5,-5 V 26 c 0,-2.761424 -2.238576,-5 -5,-5 z m 4,5 v 13 c 0,0.552285 -0.447715,1 -1,1 h -3 c -0.552285,0 -1,-0.447715 -1,-1 V 26 c 0,-0.552285 0.447715,-1 1,-1 h 3 c 0.552285,0 1,0.447715 1,1 z" fill-rule="nonzero"/>
59
+ </g>
60
+ </svg>`,ce='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-badge-hd"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10" /><path d="M14 9v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1" /><path d="M7 15v-6" /><path d="M10 15v-6" /><path d="M7 12h3" /></svg>',w={play:D,pause:K,volumeUp:Q,volumeDown:X,volumeOff:Y,full:Z,fullWeb:G,setting:J,right:ee,camera:te,subtitle:se,loading:ae,airplay:ie,chromecast:ne,back:le,rewind:re,forward:oe,video:ce};function A(n){return String(n??"").replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function O({current:n=!1,airplay:e=!1,pic:t="",screenshot:i=!1,preload:s="",url:a="",subtitle:l=null}={}){return l&&l.type,`
61
+ <video
62
+ class="kplayer-video ${n?"kplayer-video-current":""}"
63
+ webkit-playsinline
64
+ ${e?'x-webkit-airplay="allow"':""}
65
+ playsinline
66
+ ${t?`poster="${A(t)}"`:""}
67
+ ${i?'crossorigin="anonymous"':""}
68
+ ${s?`preload="${A(s)}"`:""}
69
+ ${e?"nosrc":a?`src="${A(a)}"`:""}
70
+ >
71
+ ${e?`<source src="${A(a)}">`:""}
72
+ </video>`.trim()}function b(n){return String(n??"").replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d(n){return n==null?"":String(n)}function q(n){return n?"checked":""}function pe({options:n,index:e,tran:t,icons:i,mobile:s,video:a}){var m,o,p,f,v,x,B,T,$,H,I,P,F;const l=n.theme||"#b7daff",r=n.awaken&&typeof n.awaken=="object"&&n.awaken.bottom?` style="margin-bottom:${b(n.awaken.bottom)}"`:"",y=n.subtitle&&typeof n.subtitle.url=="string",c=((f=(p=(m=n.video)==null?void 0:m.quality)==null?void 0:p[((o=n.video)==null?void 0:o.defaultQuality)??0])==null?void 0:f.name)||"",k=(v=n.title)!=null&&v.back?`
73
+ <div class="kplayer-back">
74
+ <button class="kplayer-title-back-btn" aria-label="Back">
75
+ <span class="kplayer-icon-content">${d(i.back)}</span>
76
+ </button>
77
+ </div>`:"",h=n.title?`
78
+ ${k}
79
+ <div class="kplayer-title-bar">
80
+ <div class="kplayer-title-info">
81
+ <div class="kplayer-title-main">${d(n.title.title||"")}</div>
82
+ ${n.title.description?`<div class="kplayer-title-desc">${d(n.title.description)}</div>`:""}
83
+ </div>
84
+ </div>`:"";return`
85
+ <div class="kplayer-mask"></div>
86
+ <div class="kplayer-video-wrap">
87
+ ${O(a)}
88
+ ${n.logo?`
89
+ <div class="kplayer-logo">
90
+ <img src="${b(n.logo)}">
91
+ </div>`:""}
92
+ ${h}
93
+ <div class="kplayer-awaken"${r}>
94
+ <div class="kplayer-awaken-item kplayer-awaken-item--demo"></div>
95
+ </div>
96
+ <div class="kplayer-subtitle"></div>
97
+ <div class="kplayer-bezel">
98
+ <span class="kplayer-bezel-icon"></span>
99
+ ${n.awaken?`
100
+ <span class="kplayer-danloading">${d(t("awaken-loading"))}</span>`:""}
101
+ <span class="diplayer-loading-icon">${d(i.loading)}</span>
102
+ </div>
103
+ </div>
104
+ <div class="kplayer-controller-mask"></div>
105
+
106
+
107
+ <div class="kplayer-controller">
108
+
109
+ <div class="kplayer-icons kplayer-icons-left">
110
+ <div class="kplayer-volume">
111
+ <button class="kplayer-icon kplayer-volume-icon">
112
+ <span class="kplayer-icon-content">${d(i.volumeDown)}</span>
113
+ </button>
114
+ <div class="kplayer-volume-bar-wrap" data-balloon-pos="up">
115
+ <div class="kplayer-volume-bar">
116
+ <div class="kplayer-volume-bar-inner" style="background: ${b(l)};">
117
+ <span class="kplayer-thumb" style="background: ${b(l)}"></span>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ <span class="kplayer-time">
123
+ <span class="kplayer-ptime">0:00</span> /
124
+ <span class="kplayer-dtime">0:00</span>
125
+ </span>
126
+ ${n.live?`
127
+ <span class="kplayer-live-badge"><span class="kplayer-live-dot" style="background: ${b(l)};"></span>${d(t("live"))}</span>`:""}
128
+ </div>
129
+
130
+ <div class="kplayer-icons kplayer-icons-center">
131
+ <button class="kplayer-icon kplayer-rewind-icon">
132
+ <span class="kplayer-icon-content">${d(i.rewind)}</span>
133
+ </button>
134
+ <button class="kplayer-icon kplayer-play-icon">
135
+ <span class="kplayer-icon-content">${d(i.play)}</span>
136
+ </button>
137
+ <button class="kplayer-icon kplayer-forward-icon">
138
+ <span class="kplayer-icon-content">${d(i.forward)}</span>
139
+ </button>
140
+ </div>
141
+
142
+ <div class="kplayer-icons kplayer-icons-right">
143
+ <div class="kplayer-camera-icon"></div>
144
+ <div class="kplayer-airplay-icon"></div>
145
+ <div class="kplayer-chromecast-icon"></div>
146
+
147
+ <div class="kplayer-setting">
148
+ <button class="kplayer-icon kplayer-setting-icon" data-balloon="${b(t("setting"))}" data-balloon-pos="up">
149
+ <span class="kplayer-icon-content">${d(i.setting)}</span>
150
+ </button>
151
+
152
+ <div class="kplayer-setting-box">
153
+ <!-- MAIN PANEL -->
154
+ <div class="kplayer-setting-origin-panel">
155
+
156
+ ${n.subtitle?`
157
+ <div class="kplayer-setting-item kplayer-setting-subtitle-entry">
158
+ <div class="kplayer-setting-action-main">
159
+ <span class="kplayer-setting-action-icon">${d(i.subtitle)}</span>
160
+ <span class="kplayer-label">${d(t("subtitle"))}</span>
161
+ </div>
162
+ <div class="kplayer-setting-item-right">
163
+ <span class="kplayer-setting-current-value" id="kplayer-subtitle-current"></span>
164
+ <span class="kplayer-setting-arrow">${d(i.right)}</span>
165
+ </div>
166
+ </div>`:""}
167
+
168
+ ${(x=n.video)!=null&&x.quality||((B=n.video)==null?void 0:B.type)==="hls"||((T=n.video)==null?void 0:T.type)==="auto"?`
169
+ <div class="kplayer-setting-item kplayer-setting-quality-entry">
170
+ <div class="kplayer-setting-action-main">
171
+ <span class="kplayer-setting-action-icon">${d(i.video||i.setting)}</span>
172
+ <span class="kplayer-label">${d(t("quality"))}</span>
173
+ </div>
174
+ <div class="kplayer-setting-item-right">
175
+ <span class="kplayer-setting-current-value" id="kplayer-quality-current">${d(c||"Auto")}</span>
176
+ <span class="kplayer-setting-arrow">${d(i.right)}</span>
177
+ </div>
178
+ </div>`:""}
179
+
180
+ ${n.airplay?`
181
+ <div class="kplayer-setting-action kplayer-setting-airplay-entry">
182
+ <div class="kplayer-setting-action-main">
183
+ <span class="kplayer-setting-action-icon">${d(i.airplay)}</span>
184
+ <span class="kplayer-label">${d(t("airplay"))}</span>
185
+ </div>
186
+ </div>`:""}
187
+
188
+ ${n.chromecast?`
189
+ <div class="kplayer-setting-action kplayer-setting-chromecast-entry">
190
+ <div class="kplayer-setting-action-main">
191
+ <span class="kplayer-setting-action-icon">${d(i.chromecast)}</span>
192
+ <span class="kplayer-label">${d(t("chromecast"))}</span>
193
+ </div>
194
+ </div>`:""}
195
+
196
+ ${n.screenshot?`
197
+ <div class="kplayer-setting-action kplayer-setting-screenshot-entry">
198
+ <div class="kplayer-setting-action-main">
199
+ <span class="kplayer-setting-action-icon">${d(i.camera)}</span>
200
+ <span class="kplayer-label">${d(t("screenshot"))}</span>
201
+ </div>
202
+ </div>`:""}
203
+
204
+ <div class="kplayer-setting-item kplayer-setting-speed">
205
+ <div class="kplayer-setting-action-main">
206
+ <span class="kplayer-label">${d(t("speed"))}</span>
207
+ </div>
208
+ <div class="kplayer-setting-item-right">
209
+ <span class="kplayer-setting-speed-badge" id="kplayer-speed-current">1×</span>
210
+ <span class="kplayer-setting-arrow">${d(i.right)}</span>
211
+ </div>
212
+ </div>
213
+
214
+ <div class="kplayer-setting-item kplayer-setting-loop">
215
+ <div class="kplayer-setting-action-main">
216
+ <span class="kplayer-label">${d(t("loop"))}</span>
217
+ </div>
218
+ <div class="kplayer-toggle">
219
+ <input class="kplayer-toggle-setting-input" type="checkbox" name="kplayer-toggle" ${q(n.loop)}>
220
+ <label for="kplayer-toggle"></label>
221
+ </div>
222
+ </div>
223
+
224
+ <div class="kplayer-setting-item kplayer-setting-showdan">
225
+ <div class="kplayer-toggle">
226
+ <input class="kplayer-showdan-setting-input" type="checkbox" name="kplayer-toggle-dan" ${q(!0)}>
227
+ <label for="kplayer-toggle-dan"></label>
228
+ </div>
229
+ </div>
230
+
231
+ <div class="kplayer-setting-item kplayer-setting-danunlimit">
232
+ <span class="kplayer-label">${d(t("unlimited-awaken"))}</span>
233
+ <div class="kplayer-toggle">
234
+ <input class="kplayer-danunlimit-setting-input" type="checkbox" name="kplayer-toggle-danunlimit" ${q(typeof n.awaken=="object"&&(($=n.awaken)==null?void 0:$.unlimited))}>
235
+ <label for="kplayer-toggle-danunlimit"></label>
236
+ </div>
237
+ </div>
238
+
239
+ <div class="kplayer-setting-item kplayer-setting-awaken">
240
+ <span class="kplayer-label">${d(t("opacity-awaken"))}</span>
241
+ <div class="kplayer-awaken-bar-wrap">
242
+ <div class="kplayer-awaken-bar">
243
+ <div class="kplayer-awaken-bar-inner">
244
+ <span class="kplayer-thumb"></span>
245
+ </div>
246
+ </div>
247
+ </div>
248
+ </div>
249
+ </div>
250
+
251
+ <!-- SPEED PANEL -->
252
+ <div class="kplayer-setting-speed-panel">
253
+ <div class="kplayer-setting-panel-back kplayer-setting-back-main">
254
+ <div class="kplayer-setting-action-main">
255
+ <span class="kplayer-setting-back-icon">${d(i.back)}</span>
256
+ <span class="kplayer-label">${d(t("speed"))}</span>
257
+ </div>
258
+ </div>
259
+ ${(n.playbackSpeed||[]).map(g=>`
260
+ <div class="kplayer-setting-speed-item" data-speed="${b(g)}">
261
+ <span class="kplayer-label">${d(g===1?t("normal"):g)}</span>
262
+ <span class="kplayer-check-icon"><svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg></span>
263
+ </div>`).join("")}
264
+ </div>
265
+
266
+ <!-- SUBTITLE PANEL -->
267
+ <div class="kplayer-setting-subtitle-panel">
268
+ <div class="kplayer-setting-panel-back kplayer-setting-back-main">
269
+ <div class="kplayer-setting-action-main">
270
+ <span class="kplayer-setting-back-icon">${d(i.back)}</span>
271
+ <span class="kplayer-label">${d(t("subtitle"))}</span>
272
+ </div>
273
+ </div>
274
+ ${n.subtitle?y?`
275
+ <div class="kplayer-setting-subtitle-toggle">
276
+ <div class="kplayer-setting-action-main">
277
+ <span class="kplayer-setting-action-icon">${d(i.subtitle)}</span>
278
+ <span class="kplayer-label">${d(t("hide-subs"))}</span>
279
+ </div>
280
+ </div>`:`
281
+ <div class="kplayer-subtitles-inline">
282
+ <div class="kplayer-subtitles-box">
283
+ <div class="kplayer-subtitles-panel">
284
+ ${(Array.isArray(n.subtitle.url)?n.subtitle.url:[]).map(g=>{const L=g,U=L.lang?L.name?`${L.name} (${t(L.lang)})`:t(L.lang):L.name||"";return`
285
+ <div class="kplayer-subtitles-item" data-subtitle="${b(L.url)}">
286
+ <span class="kplayer-label">${d(U)}</span>
287
+ <span class="kplayer-check-icon"><svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg></span>
288
+ </div>`}).join("")}
289
+ </div>
290
+ </div>
291
+ </div>`:""}
292
+ </div>
293
+
294
+ <!-- QUALITY PANEL -->
295
+ <div class="kplayer-setting-quality-panel">
296
+ <div class="kplayer-setting-panel-back kplayer-setting-back-main">
297
+ <div class="kplayer-setting-action-main">
298
+ <span class="kplayer-setting-back-icon">${d(i.back)}</span>
299
+ <span class="kplayer-label">${d(t("quality"))}</span>
300
+ </div>
301
+ </div>
302
+ ${(H=n.video)!=null&&H.quality||((I=n.video)==null?void 0:I.type)==="hls"||((P=n.video)==null?void 0:P.type)==="auto"?`
303
+ <div class="kplayer-quality-inline">
304
+ <div class="kplayer-quality-list">
305
+ ${(F=n.video)!=null&&F.quality?n.video.quality.map((g,L)=>`
306
+ <div class="kplayer-quality-item" data-index="${L}">
307
+ <span class="kplayer-label">${d(g.name)}</span>
308
+ <span class="kplayer-check-icon"><svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg></span>
309
+ </div>`).join(""):""}
310
+ </div>
311
+ </div>`:""}
312
+ </div>
313
+ </div>
314
+ </div>
315
+
316
+ <button class="kplayer-icon kplayer-full-in-icon" data-balloon="${b(t("web-fullscreen"))}" data-balloon-pos="up">
317
+ <span class="kplayer-icon-content">${d(i.fullWeb)}</span>
318
+ </button>
319
+ <button class="kplayer-icon kplayer-full-icon" data-balloon="${b(t("fullscreen"))}" data-balloon-pos="up">
320
+ <span class="kplayer-icon-content">${d(i.full)}</span>
321
+ </button>
322
+ </div>
323
+
324
+ <div class="kplayer-bar-wrap">
325
+ <div class="kplayer-bar-time hidden">00:00</div>
326
+ <div class="kplayer-bar-preview"></div>
327
+ <div class="kplayer-bar">
328
+ <div class="kplayer-loaded" style="width: 0;"></div>
329
+ <div class="kplayer-played" style="width: 0; background: ${b(l)}">
330
+ <span class="kplayer-thumb" style="background: ${b(l)}"></span>
331
+ </div>
332
+ </div>
333
+ </div>
334
+ </div>
335
+
336
+ <div class="kplayer-info-panel kplayer-info-panel-hide">
337
+ <div class="kplayer-info-panel-close">[x]</div>
338
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-version">
339
+ <span class="kplayer-info-panel-item-title">Player version</span>
340
+ <span class="kplayer-info-panel-item-data"></span>
341
+ </div>
342
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-fps">
343
+ <span class="kplayer-info-panel-item-title">Player FPS</span>
344
+ <span class="kplayer-info-panel-item-data"></span>
345
+ </div>
346
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-type">
347
+ <span class="kplayer-info-panel-item-title">Video type</span>
348
+ <span class="kplayer-info-panel-item-data"></span>
349
+ </div>
350
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-url">
351
+ <span class="kplayer-info-panel-item-title">Video url</span>
352
+ <span class="kplayer-info-panel-item-data"></span>
353
+ </div>
354
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-resolution">
355
+ <span class="kplayer-info-panel-item-title">Video resolution</span>
356
+ <span class="kplayer-info-panel-item-data"></span>
357
+ </div>
358
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-duration">
359
+ <span class="kplayer-info-panel-item-title">Video duration</span>
360
+ <span class="kplayer-info-panel-item-data"></span>
361
+ </div>
362
+ ${n.awaken?`
363
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-awaken-id">
364
+ <span class="kplayer-info-panel-item-title">Awaken id</span>
365
+ <span class="kplayer-info-panel-item-data"></span>
366
+ </div>
367
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-awaken-api">
368
+ <span class="kplayer-info-panel-item-title">Awaken api</span>
369
+ <span class="kplayer-info-panel-item-data"></span>
370
+ </div>
371
+ <div class="kplayer-info-panel-item kplayer-info-panel-item-awaken-amount">
372
+ <span class="kplayer-info-panel-item-title">Awaken amount</span>
373
+ <span class="kplayer-info-panel-item-data"></span>
374
+ </div>`:""}
375
+ </div>
376
+
377
+ <div class="kplayer-menu">
378
+ ${(n.contextmenu||[]).map(g=>{const L=`${g.key?t(g.key):""}${g.text?g.text:""}`;return`
379
+ <div class="kplayer-menu-item">
380
+ <a ${g.link?'target="_blank"':""} href="${b(g.link||"javascript:void(0);")}">${d(L)}</a>
381
+ </div>`}).join("")}
382
+ </div>
383
+
384
+ <div class="kplayer-notice-list"></div>
385
+ <button class="kplayer-mobile-play" style="display:none!important">
386
+ ${d(i.play)}
387
+ </button>
388
+
389
+ <div class="kplayer-mobile-controls">
390
+ <button class="kplayer-mobile-rewind">
391
+ <span class="kplayer-icon-content">${d(i.rewind)}</span>
392
+ </button>
393
+ <button class="kplayer-mobile-play-btn">
394
+ <span class="kplayer-icon-content">${d(i.play)}</span>
395
+ </button>
396
+ <button class="kplayer-mobile-forward">
397
+ <span class="kplayer-icon-content">${d(i.forward)}</span>
398
+ </button>
399
+ </div>
400
+
401
+ `.trim()}class W{constructor(e){this.container=e.container,this.options=e.options,this.index=e.index,this.tran=e.tran,this.init()}init(){this.container.innerHTML=pe({options:this.options,index:this.index,tran:this.tran,icons:w,mobile:u.isMobile,video:{current:!0,pic:this.options.video.pic,screenshot:this.options.screenshot,airplay:u.isSafari&&!u.isChrome?this.options.airplay:!1,chromecast:this.options.chromecast,preload:this.options.preload,url:this.options.video.url,subtitle:this.options.subtitle}});const e=i=>this.container.querySelector(i),t=i=>this.container.querySelectorAll(i);this.volumeBar=e(".kplayer-volume-bar-inner"),this.volumeBarWrap=e(".kplayer-volume-bar"),this.volumeBarWrapWrap=e(".kplayer-volume-bar-wrap"),this.volumeButton=e(".kplayer-volume"),this.volumeButtonIcon=e(".kplayer-volume-icon"),this.volumeIcon=e(".kplayer-volume-icon .kplayer-icon-content"),this.playedBar=e(".kplayer-played"),this.loadedBar=e(".kplayer-loaded"),this.playedBarWrap=e(".kplayer-bar-wrap"),this.playedBarTime=e(".kplayer-bar-time"),this.awaken=e(".kplayer-awaken"),this.awakenLoading=e(".kplayer-danloading"),this.video=e(".kplayer-video-current"),this.bezel=e(".kplayer-bezel-icon"),this.playButton=e(".kplayer-play-icon"),this.mobilePlayButton=e(".kplayer-mobile-play")||document.createElement("button"),this.videoWrap=e(".kplayer-video-wrap"),this.controllerMask=e(".kplayer-controller-mask"),this.ptime=e(".kplayer-ptime"),this.settingButton=e(".kplayer-setting-icon"),this.settingBox=e(".kplayer-setting-box"),this.mask=e(".kplayer-mask"),this.loop=e(".kplayer-setting-loop"),this.loopToggle=e(".kplayer-setting-loop .kplayer-toggle-setting-input"),this.showAwaken=e(".kplayer-setting-showdan"),this.showAwakenToggle=e(".kplayer-showdan-setting-input"),this.unlimitAwaken=e(".kplayer-setting-danunlimit"),this.unlimitAwakenToggle=e(".kplayer-danunlimit-setting-input"),this.speed=e(".kplayer-setting-speed"),this.speedItem=t(".kplayer-setting-speed-item"),this.awakenOpacityBar=e(".kplayer-awaken-bar-inner"),this.awakenOpacityBarWrap=e(".kplayer-awaken-bar"),this.awakenOpacityBarWrapWrap=e(".kplayer-awaken-bar-wrap"),this.awakenOpacityBox=e(".kplayer-setting-awaken"),this.dtime=e(".kplayer-dtime"),this.controller=e(".kplayer-controller"),this.browserFullButton=e(".kplayer-full-icon"),this.webFullButton=e(".kplayer-full-in-icon"),this.menu=e(".kplayer-menu"),this.menuItem=t(".kplayer-menu-item"),this.qualityList=e(".kplayer-quality-list"),this.camareButton=e(".kplayer-camera-icon"),this.airplayButton=e(".kplayer-airplay-icon"),this.chromecastButton=e(".kplayer-chromecast-icon"),this.subtitleButton=e(".kplayer-subtitle-icon"),this.subtitleButtonInner=e(".kplayer-subtitle-icon .kplayer-icon-content"),this.subtitlesBox=e(".kplayer-subtitles-box"),this.subtitlesItem=t(".kplayer-subtitles-item"),this.subtitle=e(".kplayer-subtitle"),this.subtrack=e(".kplayer-subtrack"),this.barPreview=e(".kplayer-bar-preview"),this.barWrap=e(".kplayer-bar-wrap"),this.noticeList=e(".kplayer-notice-list"),this.infoPanel=e(".kplayer-info-panel"),this.infoPanelClose=e(".kplayer-info-panel-close"),this.infoVersion=e(".kplayer-info-panel-item-version .kplayer-info-panel-item-data"),this.infoFPS=e(".kplayer-info-panel-item-fps .kplayer-info-panel-item-data"),this.infoType=e(".kplayer-info-panel-item-type .kplayer-info-panel-item-data"),this.infoUrl=e(".kplayer-info-panel-item-url .kplayer-info-panel-item-data"),this.infoResolution=e(".kplayer-info-panel-item-resolution .kplayer-info-panel-item-data"),this.infoDuration=e(".kplayer-info-panel-item-duration .kplayer-info-panel-item-data"),this.infoAwakenId=e(".kplayer-info-panel-item-awaken-id .kplayer-info-panel-item-data"),this.infoAwakenApi=e(".kplayer-info-panel-item-awaken-api .kplayer-info-panel-item-data"),this.infoAwakenAmount=e(".kplayer-info-panel-item-awaken-amount .kplayer-info-panel-item-data"),this.subtitlesButton=e(".kplayer-subtitles-icon")||{addEventListener:()=>{},dataset:{},style:{}},this.qualityButton=e(".kplayer-quality-icon")||document.createElement("span"),this.titleBar=e(".kplayer-title-bar"),this.titleBack=e(".kplayer-title-back-btn"),this.titleMain=e(".kplayer-title-main"),this.titleDesc=e(".kplayer-title-desc"),this.subtitleEntry=e(".kplayer-setting-subtitle-entry"),this.qualityEntry=e(".kplayer-setting-quality-entry"),this.qualityItems=t(".kplayer-quality-item")}static NewNotice(e,t,i){const s=document.createElement("div");return s.classList.add("kplayer-notice"),s.style.opacity=String(t),s.innerText=e,i&&(s.id=`kplayer-notice-${i}`),s}}class he{constructor(e){this.currentAd=null,this.adContainer=null,this.skipRemaining=0,this.adMarkers=[],this._timeUpdateBound=!1,this._shownAds=new Set,this._adVideo=null,this.player=e,this.options=e.options.ad||null,this._createAdContainer(),this.options&&Array.isArray(this.options.url)&&this.options.url.length>0&&(this._renderBarMarkers(),this._bindTimeUpdate())}_createAdContainer(){const e=this.player.template.videoWrap;this.adContainer=document.createElement("div"),this.adContainer.className="kplayer-ad-container",Object.assign(this.adContainer.style,{display:"none",position:"absolute",top:"0",left:"0",right:"0",bottom:"0",zIndex:"50",background:"#000"}),this.adContent=document.createElement("div"),this.adContent.className="kplayer-ad-content",Object.assign(this.adContent.style,{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"}),this.skipBtn=document.createElement("button"),this.skipBtn.className="kplayer-ad-skip-btn",Object.assign(this.skipBtn.style,{position:"absolute",bottom:"60px",right:"16px",zIndex:"60",display:"none",alignItems:"center",gap:"6px",padding:"6px 14px",border:"none",borderRadius:"2px",background:"rgba(22, 22, 26, 0.96)",color:"rgba(255, 255, 255, 0.88)",fontSize:"13px",fontWeight:"400",cursor:"pointer"}),this.skipBtn.innerHTML='<span class="kplayer-ad-skip-text">Skip ad in <span class="kplayer-ad-skip-count">5</span>s</span>',this.skipBtn.addEventListener("click",()=>this._skipAd()),this.deeplinkBtn=document.createElement("button"),this.deeplinkBtn.className="kplayer-ad-deeplink-btn",Object.assign(this.deeplinkBtn.style,{position:"absolute",bottom:"60px",left:"16px",zIndex:"60",display:"none",alignItems:"center",gap:"6px",padding:"6px 14px",border:"none",borderRadius:"2px",background:"rgba(22, 22, 26, 0.96)",color:"rgba(255, 255, 255, 0.88)",fontSize:"13px",cursor:"pointer"}),this.deeplinkBtn.textContent="Learn more",this.deeplinkBtn.addEventListener("click",()=>{var t;(t=this.currentAd)!=null&&t.deeplink&&window.open(this.currentAd.deeplink,"_blank")}),this.adLabel=document.createElement("div"),this.adLabel.className="kplayer-ad-label",Object.assign(this.adLabel.style,{position:"absolute",top:"12px",left:"16px",zIndex:"60",padding:"3px 8px",borderRadius:"2px",background:"rgba(22, 22, 26, 0.8)",color:"rgba(255, 255, 255, 0.6)",fontSize:"11px",letterSpacing:"0.04em"}),this.adLabel.textContent="Ad",this.adContainer.appendChild(this.adContent),this.adContainer.appendChild(this.skipBtn),this.adContainer.appendChild(this.deeplinkBtn),this.adContainer.appendChild(this.adLabel),e.appendChild(this.adContainer)}_createMarker(e,t){var l;const i=document.createElement("div");i.className="kplayer-ad-marker",i.style.left=`${e}%`;const s=document.createElement("span");s.className="kplayer-ad-marker-text";let a="Ad";if((l=t.name)!=null&&l.includes("vast_")){const r=t.name.replace("vast_","");a=r==="start"||r==="end"?"Ad":`Ad · ${r}`}else t.name&&(a=t.name);return s.textContent=a,i.appendChild(s),i}_renderBarMarkers(){this.player.on("durationchange",()=>{var t;const e=this.player.video.duration;!e||e===1/0||(this.adMarkers.forEach(i=>{var s;return(s=i.parentNode)==null?void 0:s.removeChild(i)}),this.adMarkers=[],(((t=this.options)==null?void 0:t.url)||[]).forEach(i=>{if(i.startTime===void 0||i.startTime<=0)return;const s=i.startTime/e*100;if(s>=100)return;const a=this._createMarker(s,i);this.player.template.playedBarWrap.appendChild(a),this.adMarkers.push(a)}))})}_bindTimeUpdate(){this._timeUpdateBound||(this._timeUpdateBound=!0,this.player.on("timeupdate",()=>{var i;if(this.currentAd||!((i=this.options)!=null&&i.url))return;const e=this.player.video.currentTime,t=this.player.video.duration;for(const s of this.options.url){s._isPostroll&&t&&t!==1/0&&(s.startTime=t-1);const a=`${s.name}_${s.startTime}`;if(this._shownAds.has(a))continue;if(Math.abs(e-(s.startTime||0))<.8){this._shownAds.add(a),s._impressionUrl&&fetch(s._impressionUrl).catch(()=>{}),this._showAd(s);break}}}))}_showAd(e){this.currentAd=e,this.adContent.innerHTML="",this.adContainer&&(this.adContainer.style.display="block"),this.deeplinkBtn.style.display=e.deeplink?"flex":"none",e.type==="image"?this._showImageAd(e):e.type==="text"?this._showTextAd(e):e.type==="video"&&this._showVideoAd(e),e.type!=="video"?this.player.pause():this.player.video.pause(),this._startSkipTimer(e.skipTime||5)}_showImageAd(e){const t=document.createElement("img");t.src=e.url,Object.assign(t.style,{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",cursor:e.deeplink?"pointer":"default"}),e.deeplink&&t.addEventListener("click",()=>window.open(e.deeplink,"_blank")),this.adContent.appendChild(t)}_showTextAd(e){const t=e.backroundColor?e.backroundColor.startsWith("#")?e.backroundColor:"#"+e.backroundColor:"#1a1a1a";this.adContent.style.background=t,this.adContainer&&(this.adContainer.style.background=t);const i=document.createElement("div");Object.assign(i.style,{color:"#fff",fontSize:"18px",fontWeight:"400",textAlign:"center",padding:"24px",lineHeight:"1.6",cursor:e.deeplink?"pointer":"default"}),i.textContent=e.url,e.deeplink&&i.addEventListener("click",()=>window.open(e.deeplink,"_blank")),this.adContent.appendChild(i)}_showVideoAd(e){this.adContainer&&(this.adContainer.style.background="#000"),this.adContent.style.background="#000";const t=document.createElement("video");t.src=e.url,t.autoplay=!0,t.controls=!1,Object.assign(t.style,{width:"100%",height:"100%",objectFit:"contain",cursor:e.deeplink?"pointer":"default"}),e.deeplink&&t.addEventListener("click",()=>window.open(e.deeplink,"_blank")),t.addEventListener("ended",()=>this._closeAd()),this.adContent.appendChild(t),this._adVideo=t}_startSkipTimer(e){this.skipRemaining=e,this.skipBtn.style.display="flex";const t=this.skipBtn.querySelector(".kplayer-ad-skip-text");this.skipBtn.disabled=!0,this.skipBtn.style.opacity="0.6",this.skipBtn.style.cursor="default",t&&(t.innerHTML=`Skip ad in <span class="kplayer-ad-skip-count">${this.skipRemaining}</span>s`),clearInterval(this.skipTimer),this.skipTimer=setInterval(()=>{this.skipRemaining--,this.skipRemaining<=0?(clearInterval(this.skipTimer),this.skipBtn.disabled=!1,this.skipBtn.style.opacity="1",this.skipBtn.style.cursor="pointer",t&&(t.textContent="Skip ad")):t&&(t.innerHTML=`Skip ad in <span class="kplayer-ad-skip-count">${this.skipRemaining}</span>s`)},1e3)}_skipAd(){this.skipRemaining>0||this._closeAd()}_closeAd(){clearInterval(this.skipTimer),this._adVideo&&(this._adVideo.pause(),this._adVideo.src="",this._adVideo=null),this.adContent.style.background="",this.adContainer&&(this.adContainer.style.background="#000",this.adContainer.style.display="none"),this.skipBtn.style.display="none",this.deeplinkBtn.style.display="none",this.adContent.innerHTML="";const e=this.currentAd;if(this.currentAd=null,e&&e.startTime!==void 0){const t=(e.startTime||0)+.5,i=this.player.video.duration||0;i>0&&t<i&&(this.player.video.currentTime=t)}this.player.play()}async _loadVAST(e){var t;try{const s=await(await fetch(e)).text(),l=new DOMParser().parseFromString(s,"text/xml"),r="http://www.iab.net/videosuite/vmap",y=l.getElementsByTagNameNS(r,"AdBreak");if(y.length>0){const c=this.player.video.duration||0,k=[];for(const h of Array.from(y)){const m=h.getAttribute("timeOffset")||"";let o=0;m==="start"?o=0:m==="end"?o=c>0?c-1:99999:m&&(o=this._parseTime(m));const p=h.getElementsByTagNameNS(r,"AdTagURI")[0],f=(t=p==null?void 0:p.textContent)==null?void 0:t.trim();f&&k.push({vastUrl:f,startTime:o,timeOffset:m})}for(const{vastUrl:h,startTime:m,timeOffset:o}of k)await this._fetchVASTAndRegister(h,m,o);this._registerVMAPMarkers()}else await this._parseVASTAndShow(l,0,5)}catch(i){console.warn("[Kplayer] VAST/VMAP load failed:",i)}}async _fetchVASTAndRegister(e,t,i){var s,a,l,r;try{const c=await(await fetch(e)).text(),h=new DOMParser().parseFromString(c,"text/xml"),m=h.querySelector("MediaFile"),o=(s=m==null?void 0:m.textContent)==null?void 0:s.trim(),p=(a=h.querySelector("Linear"))==null?void 0:a.getAttribute("skipoffset"),f=p?this._parseTime(p):5,v=(r=(l=h.querySelector("Impression"))==null?void 0:l.textContent)==null?void 0:r.trim();if(!o)return;const x={type:"video",url:o,startTime:t,skipTime:f,name:`vast_${i}`,_impressionUrl:v,_isPostroll:i==="end"};this.options||(this.options={url:[]}),Array.isArray(this.options.url)||(this.options.url=[]),this.options.url.push(x)}catch(y){console.warn("[Kplayer] VAST fetch failed:",e,y)}}_registerVMAPMarkers(){const e=()=>{var i,s;const t=this.player.video.duration;!t||t===1/0||((((i=this.options)==null?void 0:i.url)||[]).forEach(a=>{a._isPostroll&&(a.startTime=t-1)}),this.adMarkers.forEach(a=>{var l;return(l=a.parentNode)==null?void 0:l.removeChild(a)}),this.adMarkers=[],(((s=this.options)==null?void 0:s.url)||[]).forEach(a=>{if(a.startTime===void 0||a.startTime<=0)return;const l=a.startTime/t*100;if(l>=100)return;const r=this._createMarker(l,a);this.player.template.playedBarWrap.appendChild(r),this.adMarkers.push(r)}))};this.player.video.duration&&this.player.video.duration!==1/0?e():this.player.on("durationchange",e),this._bindTimeUpdate()}async _parseVASTAndShow(e,t,i){var c,k,h,m;const s=e.querySelector("MediaFile"),a=(c=s==null?void 0:s.textContent)==null?void 0:c.trim(),l=(k=e.querySelector("Linear"))==null?void 0:k.getAttribute("skipoffset"),r=l?this._parseTime(l):i,y=(m=(h=e.querySelector("Impression"))==null?void 0:h.textContent)==null?void 0:m.trim();y&&fetch(y).catch(()=>{}),a&&this._showAd({type:"video",url:a,startTime:t,skipTime:r})}_parseTime(e){if(!e)return 0;const t=e.split(":");return t.length!==3?0:parseInt(t[0])*3600+parseInt(t[1])*60+parseFloat(t[2])}destroy(){var e;clearInterval(this.skipTimer),this.adMarkers.forEach(t=>{var i;return(i=t.parentNode)==null?void 0:i.removeChild(t)}),(e=this.adContainer)!=null&&e.parentNode&&this.adContainer.parentNode.removeChild(this.adContainer)}}class de{constructor(){this.events={},this.videoEvents=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","mozaudioavailable","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],this.playerEvents=["screenshot","thumbnails_show","thumbnails_hide","awaken_show","awaken_hide","awaken_clear","awaken_loaded","awaken_send","awaken_opacity","contextmenu_show","contextmenu_hide","notice_show","notice_hide","quality_start","quality_end","destroy","resize","fullscreen","fullscreen_cancel","webfullscreen","webfullscreen_cancel","subtitle_show","subtitle_hide","subtitle_change","title_back"]}on(e,t){this.type(e)&&typeof t=="function"&&(this.events[e]||(this.events[e]=[]),this.events[e].push(t))}trigger(e,t){if(this.events[e]&&this.events[e].length)for(let i=0;i<this.events[e].length;i++)this.events[e][i](t)}type(e){return this.playerEvents.indexOf(e)!==-1?"player":this.videoEvents.indexOf(e)!==-1?"video":(console.error(`Unknown event name: ${e}`),null)}}class ue{constructor(e){this.player=e,this.lastScrollPosition={left:0,top:0},this.player.events.on("webfullscreen",()=>{this.player.resize()}),this.player.events.on("webfullscreen_cancel",()=>{this.player.resize(),u.setScrollPosition(this.lastScrollPosition)}),this.fullscreenchange=()=>{this.player.resize(),this.isFullScreen("browser")?this.player.events.trigger("fullscreen"):(u.setScrollPosition(this.lastScrollPosition),this.player.events.trigger("fullscreen_cancel"))},this.docfullscreenchange=()=>{const t=document,i=document.fullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;i&&i!==this.player.container||(this.player.resize(),i?this.player.events.trigger("fullscreen"):(u.setScrollPosition(this.lastScrollPosition),this.player.events.trigger("fullscreen_cancel")))},/Firefox/.test(navigator.userAgent)?(document.addEventListener("mozfullscreenchange",this.docfullscreenchange),document.addEventListener("fullscreenchange",this.docfullscreenchange)):(this.player.container.addEventListener("fullscreenchange",this.fullscreenchange),this.player.container.addEventListener("webkitfullscreenchange",this.fullscreenchange),document.addEventListener("msfullscreenchange",this.docfullscreenchange),document.addEventListener("MSFullscreenChange",this.docfullscreenchange))}isFullScreen(e="browser"){const t=document;switch(e){case"browser":return document.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement||null;case"web":return this.player.container.classList.contains("kplayer-fulled")}}request(e="browser"){const t=e==="browser"?"web":"browser",i=this.isFullScreen(t);switch(i||(this.lastScrollPosition=u.getScrollPosition()),e){case"browser":{const s=this.player.container,a=this.player.video;s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():a.webkitEnterFullscreen?a.webkitEnterFullscreen():a.webkitEnterFullScreen?a.webkitEnterFullScreen():s.msRequestFullscreen&&s.msRequestFullscreen();break}case"web":this.player.container.classList.add("kplayer-fulled"),document.body.classList.add("kplayer-web-fullscreen-fix"),this.player.events.trigger("webfullscreen");break}i&&this.cancel(t)}cancel(e="browser"){const t=document;switch(e){case"browser":t.cancelFullScreen?t.cancelFullScreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitCancelFullScreen?t.webkitCancelFullScreen():t.webkitCancelFullscreen?t.webkitCancelFullscreen():t.msCancelFullScreen?t.msCancelFullScreen():t.msExitFullscreen?t.msExitFullscreen():document.exitFullscreen&&document.exitFullscreen();break;case"web":this.player.container.classList.remove("kplayer-fulled"),document.body.classList.remove("kplayer-web-fullscreen-fix"),this.player.events.trigger("webfullscreen_cancel");break}}toggle(e="browser"){this.isFullScreen(e)?this.cancel(e):this.request(e)}destroy(){/Firefox/.test(navigator.userAgent)?(document.removeEventListener("mozfullscreenchange",this.docfullscreenchange),document.removeEventListener("fullscreenchange",this.docfullscreenchange)):(this.player.container.removeEventListener("fullscreenchange",this.fullscreenchange),this.player.container.removeEventListener("webkitfullscreenchange",this.fullscreenchange),document.removeEventListener("msfullscreenchange",this.docfullscreenchange),document.removeEventListener("MSFullscreenChange",this.docfullscreenchange))}}class ye{constructor(e){this.storageName={opacity:"kplayer-awaken-opacity",volume:"kplayer-volume",unlimited:"kplayer-awaken-unlimited",awaken:"kplayer-awaken-show",subtitle:"kplayer-subtitle-show"},this.default={opacity:.7,volume:e.options.hasOwnProperty("volume")?e.options.volume??.7:.7,unlimited:(e.options.awaken&&typeof e.options.awaken=="object"&&e.options.awaken.unlimited?1:0)||0,awaken:1,subtitle:1},this.data={},this.init()}init(){for(const e in this.storageName){const t=e,i=this.storageName[t];this.data[t]=parseFloat(u.storage.get(i)||String(this.default[t]))}}get(e){return this.data[e]}set(e,t){this.data[e]=t,u.storage.set(this.storageName[e],t)}}class me{constructor(e,t,i,s){this._track=null,this.container=e,this.video=t,this.options=i,this.events=s,this.init()}init(){this.container.style.fontSize=this.options.fontSize||"20px",this.container.style.bottom=this.options.bottom||"40px",this.container.style.color=this.options.color||"#fff"}async loadVttText(e){this._clearTrack();const t=this.video.addTextTrack("subtitles","","");t.mode="showing",this._track=t;const i=this._parseVtt(e);for(const s of i)try{t.addCue(s)}catch(a){console.warn("[KPlayer] addCue failed:",a)}this._onTimeUpdateBound=this._onTimeUpdate.bind(this),this.video.addEventListener("timeupdate",this._onTimeUpdateBound)}_onTimeUpdate(){var t;if(!((t=this._track)!=null&&t.activeCues))return;const e=this._track.activeCues;this.container.innerHTML="";for(let i=0;i<e.length;i++){const s=e[i],a=document.createElement("p");a.textContent=s.text.replace(/<[^>]+>/g,""),this.container.appendChild(a)}}_clearTrack(){if(this._onTimeUpdateBound&&(this.video.removeEventListener("timeupdate",this._onTimeUpdateBound),this._onTimeUpdateBound=void 0),this._track){for(;this._track.cues&&this._track.cues.length>0;)this._track.removeCue(this._track.cues[0]);this._track.mode="disabled",this._track.oncuechange=null,this._track=null}this.container.innerHTML=""}_parseVtt(e){const t=[],s=e.replace(/^\uFEFF/,"").trim().split(/\n\s*\n/);for(const a of s){const l=a.trim().split(`
402
+ `);if(!l.length||l[0].startsWith("WEBVTT")||l[0].startsWith("NOTE")||l[0].startsWith("STYLE"))continue;let r=-1;for(let o=0;o<l.length;o++)if(l[o].includes("-->")){r=o;break}if(r===-1)continue;const c=l[r].match(/((?:\d{2}:)?\d{2}:\d{2}[.,]\d{3})\s*-->\s*((?:\d{2}:)?\d{2}:\d{2}[.,]\d{3})/);if(!c)continue;const k=this._timeToSeconds(c[1]),h=this._timeToSeconds(c[2]),m=l.slice(r+1).join(`
403
+ `).trim();if(m)try{const o=new VTTCue(k,h,m);t.push(o)}catch(o){console.warn("[KPlayer] VTTCue failed:",o,k,h,m)}}return t}_timeToSeconds(e){const i=e.replace(",",".").split(":");return i.length===3?parseInt(i[0])*3600+parseInt(i[1])*60+parseFloat(i[2]):i.length===2?parseInt(i[0])*60+parseFloat(i[1]):0}show(){this.container.classList.remove("kplayer-subtitle-hide"),this._track&&(this._track.mode="hidden"),this.events.trigger("subtitle_show")}hide(){this.container.classList.add("kplayer-subtitle-hide"),this._track&&(this._track.mode="disabled"),this.events.trigger("subtitle_hide")}toggle(){this.container.classList.contains("kplayer-subtitle-hide")?this.show():this.hide()}destroy(){this._clearTrack()}}class ke{constructor(e){var a;this.player=e,this.player.template.mask.addEventListener("click",()=>{this.hide()}),this.player.template.subtitlesButton&&"addEventListener"in this.player.template.subtitlesButton&&this.player.template.subtitlesButton.addEventListener("click",()=>{this.adaptiveHeight(),this.show()});const t=Array.from(this.player.template.subtitlesItem||[]),i=t.length-1;if(i<0)return;for(let l=0;l<i;l++)t[l].addEventListener("click",()=>{this.hide(),this.selectSubtitle(l)});t[i].addEventListener("click",()=>{this.hide(),this.selectOff()});const s=((a=this.player.options.subtitle)==null?void 0:a.index)??0;t[s]&&(t.forEach(l=>l.classList.remove("kplayer-selected")),t[s].classList.add("kplayer-selected"))}reloadTrack(){var i;const e=this.player.video,t=this.player.template.subtrack;if(t){if(t.default=!0,(i=e==null?void 0:e.textTracks)!=null&&i[0])try{e.textTracks[0].mode="disabled",e.textTracks[0].mode="showing";return}catch{}e&&typeof e.load=="function"&&e.load()}}clearSelected(){Array.from(this.player.template.subtitlesItem||[]).forEach(t=>t.classList.remove("kplayer-selected"))}selectSubtitle(e){const i=Array.from(this.player.template.subtitlesItem||[])[e];i&&(this.clearSelected(),i.classList.add("kplayer-selected"),this.player.options.subtitle.index=e,this.player.loadSubtitleByIndex(e),this.player.template.subtitle.classList.contains("kplayer-subtitle-hide")&&this.subContainerShow())}selectOff(){var s;const e=Array.from(this.player.template.subtitlesItem||[]),t=e.length-1,i=e[t];i&&(this.clearSelected(),i.classList.add("kplayer-selected"),this.player.options.subtitle.index=t,(s=this.player.subtitle)==null||s.hide(),this.player.template.subtitle.innerHTML="",this.subContainerHide())}subContainerShow(){this.player.template.subtitle.classList.remove("kplayer-subtitle-hide"),this.player.events.trigger("subtitle_show")}subContainerHide(){this.player.template.subtitle.classList.add("kplayer-subtitle-hide"),this.player.events.trigger("subtitle_hide")}hide(){var e;(e=this.player.template.subtitlesBox)==null||e.classList.remove("kplayer-subtitles-box-open"),this.player.template.mask.classList.remove("kplayer-mask-show"),this.player.controller.disableAutoHide=!1}show(){var e;(e=this.player.template.subtitlesBox)==null||e.classList.add("kplayer-subtitles-box-open"),this.player.template.mask.classList.add("kplayer-mask-show"),this.player.controller.disableAutoHide=!0}adaptiveHeight(){const t=Array.from(this.player.template.subtitlesItem||[]).length*30+14,i=this.player.template.videoWrap.offsetHeight*.8;this.player.template.subtitlesBox&&(t>=i-50?(this.player.template.subtitlesBox.style.bottom="8px",this.player.template.subtitlesBox.style.maxHeight=`${i-8}px`):(this.player.template.subtitlesBox.style.bottom="50px",this.player.template.subtitlesBox.style.maxHeight=`${i-50}px`))}updateUrls(e){Array.isArray(e)&&this.player.options.subtitle&&(this.player.options.subtitle.url=e)}}class fe{constructor(e){this.elements={},e.volumeBar&&(this.elements.volume=e.volumeBar),e.playedBar&&(this.elements.played=e.playedBar),e.loadedBar&&(this.elements.loaded=e.loadedBar),e.awakenOpacityBar&&(this.elements.awaken=e.awakenOpacityBar)}set(e,t,i){t=Math.max(t,0),t=Math.min(t,1),this.elements[e]&&(this.elements[e].style[i]=t*100+"%")}get(e){var t;return parseFloat(((t=this.elements[e])==null?void 0:t.style.width)||"0")/100}}class ve{constructor(e){this.enableloadingChecker=!1,this.enableinfoChecker=!1,this.enablefpsChecker=!1,this.fpsIndex=0,this.player=e,window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60),0},this.types=["loading","info","fps"],this.init()}init(){this.types.forEach(e=>{e!=="fps"&&this[`init${e}Checker`]()})}initloadingChecker(){let e=0,t=0,i=!1;this.loadingChecker=setInterval(()=>{this.enableloadingChecker&&(t=this.player.video.currentTime,!i&&t===e&&!this.player.video.paused&&(this.player.container.classList.add("kplayer-loading"),i=!0),i&&t>e&&!this.player.video.paused&&(this.player.container.classList.remove("kplayer-loading"),i=!1),e=t)},100)}initfpsChecker(){window.requestAnimationFrame(()=>{if(this.enablefpsChecker)if(this.initfpsChecker(),!this.fpsStart)this.fpsStart=new Date,this.fpsIndex=0;else{this.fpsIndex++;const e=new Date;e.getTime()-this.fpsStart.getTime()>1e3&&(this.player.infoPanel.fps(this.fpsIndex/(e.getTime()-this.fpsStart.getTime())*1e3),this.fpsStart=new Date,this.fpsIndex=0)}else this.fpsStart=void 0,this.fpsIndex=0})}initinfoChecker(){this.infoChecker=setInterval(()=>{this.enableinfoChecker&&this.player.infoPanel.update()},1e3)}enable(e){this[`enable${e}Checker`]=!0,e==="fps"&&this.initfpsChecker()}disable(e){this[`enable${e}Checker`]=!1}destroy(){this.types.forEach(e=>{this[`enable${e}Checker`]=!1;const t=this[`${e}Checker`];t&&clearInterval(t)})}}class ge{constructor(e){this.container=e,this.container.addEventListener("animationend",()=>{this.container.classList.remove("kplayer-bezel-transition")})}switch(e){this.container.innerHTML=e,this.container.classList.add("kplayer-bezel-transition")}}class be{constructor(e){this.container=e.container,this.barWidth=e.barWidth,this.container.style.backgroundImage=`url('${e.url}')`,this.events=e.events}resize(e,t,i){this.container.style.width=`${e}px`,this.container.style.height=`${t}px`,this.container.style.top=`${-t+2}px`,this.barWidth=i}show(){this.container.style.display="block",this.events&&this.events.trigger("thumbnails_show")}move(e){this.container.style.backgroundPosition=`-${(Math.ceil(e/this.barWidth*100)-1)*160}px 0`,this.container.style.left=`${Math.min(Math.max(e-this.container.offsetWidth/2,-10),this.barWidth-150)}px`}hide(){this.container.style.display="none",this.events&&this.events.trigger("thumbnails_hide")}}let z=!0,M=!1;class we{constructor(e){this.autoHideTimer=0,this.disableAutoHide=!1,this._skipBtn=null,this._skipTarget=null,this.session=void 0,this.currentMedia=null,this.player=e,u.isMobile||(this.setAutoHideHandler=this.setAutoHide.bind(this),this.player.container.addEventListener("mousemove",this.setAutoHideHandler),this.player.container.addEventListener("click",this.setAutoHideHandler),this.player.on("play",this.setAutoHideHandler),this.player.on("pause",this.setAutoHideHandler)),this.initPlayButton(),this.initSeekButtons(),this.initThumbnails(),this.initPlayedBar(),this.initFullButton(),this.initQualityButton(),this.initScreenshotButton(),this.player.options.subtitle&&typeof this.player.options.subtitle.url=="string"&&this.initSubtitleButton(),this.initHighlights(),this.initAirplayButton(),this.initChromecastButton(),u.isMobile||this.initVolumeButton()}initPlayButton(){this.player.template.playButton.addEventListener("click",()=>{this.player.toggle()}),this.player.template.mobilePlayButton.addEventListener("click",()=>{this.player.toggle()}),u.isMobile?(this.player.template.videoWrap.addEventListener("click",()=>{this.toggle()}),this.player.template.controllerMask.addEventListener("click",()=>{this.toggle()})):this.player.options.preventClickToggle||(this.player.template.videoWrap.addEventListener("click",()=>{this.player.toggle()}),this.player.template.controllerMask.addEventListener("click",()=>{this.player.toggle()}));const e=this.player.container.querySelector(".kplayer-mobile-rewind"),t=this.player.container.querySelector(".kplayer-mobile-forward"),i=this.player.container.querySelector(".kplayer-mobile-play-btn");e==null||e.addEventListener("click",s=>{s.stopPropagation(),this.player.seek(this.player.video.currentTime-10),this.setAutoHide()}),t==null||t.addEventListener("click",s=>{s.stopPropagation(),this.player.seek(this.player.video.currentTime+10),this.setAutoHide()}),i==null||i.addEventListener("click",s=>{s.stopPropagation(),this.player.toggle()})}initSeekButtons(){const e=this.player.container.querySelector(".kplayer-rewind-icon"),t=this.player.container.querySelector(".kplayer-forward-icon");e==null||e.addEventListener("click",i=>{i.stopPropagation(),this.player.seek(this.player.video.currentTime-10)}),t==null||t.addEventListener("click",i=>{i.stopPropagation(),this.player.seek(this.player.video.currentTime+10)})}initHighlights(){this._createSkipButton(),this.player.on("durationchange",()=>{if(this.player.video.duration!==1&&this.player.video.duration!==1/0&&this.player.options.highlight){const e=this.player.template.playedBarWrap.querySelectorAll(".kplayer-highlight");Array.from(e).forEach(t=>{this.player.template.playedBarWrap.removeChild(t)});for(let t=0;t<this.player.options.highlight.length;t++){const i=this.player.options.highlight[t];if(!i.text||!i.time)continue;const s=document.createElement("div");s.classList.add("kplayer-highlight"),s.style.left=i.time/this.player.video.duration*100+"%",s.innerHTML=`<span class="kplayer-highlight-text">${i.text}</span>`,s.addEventListener("click",a=>{a.stopPropagation(),this.player.seek(i.time),this.player.paused&&this.player.play()}),this.player.template.playedBarWrap.insertBefore(s,this.player.template.playedBarTime)}}}),this.player.on("timeupdate",()=>{this._updateSkipButton()})}_createSkipButton(){if(this.player.container.querySelector(".kplayer-skip-btn"))return;const e=document.createElement("button");e.classList.add("kplayer-skip-btn"),e.style.display="none",e.innerHTML='<span class="kplayer-skip-btn-text"></span>',e.addEventListener("click",t=>{t.stopPropagation(),this._skipTarget!=null&&(this.player.seek(this._skipTarget),this.player.paused&&this.player.play()),e.style.display="none"}),this.player.template.videoWrap.appendChild(e),this._skipBtn=e,this._skipTarget=null}_updateSkipButton(){if(!this.player.options.highlight||!this._skipBtn)return;const e=this.player.options.highlight,t=this.player.video.currentTime;let i=!1;for(let s=0;s<e.length-1;s++){const a=e[s],l=e[s+1];if(!(!/\bstart\b|\bэхлэл\b/i.test(a.text)||!/\bend\b|\bтөгсгөл\b/i.test(l.text))&&!(t<a.time||t>=l.time)){this._skipTarget=l.time,this._skipBtn.querySelector(".kplayer-skip-btn-text").textContent=a.text,this._skipBtn.style.display="flex",i=!0;break}}i||(this._skipBtn.style.display="none")}initThumbnails(){this.player.options.video.thumbnails&&(this.thumbnails=new be({container:this.player.template.barPreview,barWidth:this.player.template.barWrap.offsetWidth,url:this.player.options.video.thumbnails,events:this.player.events}),this.player.on("loadedmetadata",()=>{var e;(e=this.thumbnails)==null||e.resize(160,this.player.video.videoHeight/this.player.video.videoWidth*160,this.player.template.barWrap.offsetWidth)}))}initPlayedBar(){const e=i=>{let s=((i.clientX||i.changedTouches[0].clientX)-u.getBoundingClientRectViewLeft(this.player.template.playedBarWrap))/this.player.template.playedBarWrap.clientWidth;s=Math.max(0,Math.min(1,s)),this.player.bar.set("played",s,"width"),this.player.template.ptime.innerHTML=u.secondToTime(s*this.player.video.duration)},t=i=>{document.removeEventListener(u.nameMap.dragEnd,t),document.removeEventListener(u.nameMap.dragMove,e);let s=((i.clientX||i.changedTouches[0].clientX)-u.getBoundingClientRectViewLeft(this.player.template.playedBarWrap))/this.player.template.playedBarWrap.clientWidth;s=Math.max(0,Math.min(1,s)),this.player.bar.set("played",s,"width"),this.player.seek(this.player.bar.get("played")*this.player.video.duration),this.player.moveBar=!1};this.player.template.playedBarWrap.addEventListener(u.nameMap.dragStart,()=>{this.player.moveBar=!0,document.addEventListener(u.nameMap.dragMove,e),document.addEventListener(u.nameMap.dragEnd,t)}),this.player.template.playedBarWrap.addEventListener(u.nameMap.dragMove,i=>{var s,a;if(this.player.video.duration){const l=this.player.template.playedBarWrap.getBoundingClientRect().left,r=(i.clientX||i.changedTouches[0].clientX)-l;if(r<0||r>this.player.template.playedBarWrap.offsetWidth)return;const y=this.player.video.duration*(r/this.player.template.playedBarWrap.offsetWidth);u.isMobile&&((s=this.thumbnails)==null||s.show()),(a=this.thumbnails)==null||a.move(r),this.player.template.playedBarTime.style.left=`${r-(y>=3600?25:20)}px`,this.player.template.playedBarTime.innerText=u.secondToTime(y),this.player.template.playedBarTime.classList.remove("hidden")}}),this.player.template.playedBarWrap.addEventListener(u.nameMap.dragEnd,()=>{var i;u.isMobile&&((i=this.thumbnails)==null||i.hide())}),u.isMobile||(this.player.template.playedBarWrap.addEventListener("mouseenter",()=>{var i;this.player.video.duration&&((i=this.thumbnails)==null||i.show(),this.player.template.playedBarTime.classList.remove("hidden"))}),this.player.template.playedBarWrap.addEventListener("mouseleave",()=>{var i;this.player.video.duration&&((i=this.thumbnails)==null||i.hide(),this.player.template.playedBarTime.classList.add("hidden"))}))}initFullButton(){this.player.template.browserFullButton.addEventListener("click",()=>{this.player.fullScreen.toggle("browser")}),this.player.template.webFullButton.addEventListener("click",()=>{this.player.fullScreen.toggle("web")})}initVolumeButton(){const t=s=>{const a=s,l=((a.clientX||a.changedTouches[0].clientX)-u.getBoundingClientRectViewLeft(this.player.template.volumeBarWrap)-5.5)/35;this.player.volume(l)},i=()=>{document.removeEventListener(u.nameMap.dragEnd,i),document.removeEventListener(u.nameMap.dragMove,t),this.player.template.volumeButton.classList.remove("kplayer-volume-active")};this.player.template.volumeBarWrapWrap.addEventListener("click",s=>{const a=((s.clientX||0)-u.getBoundingClientRectViewLeft(this.player.template.volumeBarWrap)-5.5)/35;this.player.volume(a)}),this.player.template.volumeBarWrapWrap.addEventListener(u.nameMap.dragStart,()=>{document.addEventListener(u.nameMap.dragMove,t),document.addEventListener(u.nameMap.dragEnd,i),this.player.template.volumeButton.classList.add("kplayer-volume-active")}),this.player.template.volumeButtonIcon.addEventListener("click",()=>{this.player.video.muted?(this.player.video.muted=!1,this.player.switchVolumeIcon(),this.player.bar.set("volume",this.player.volume(),"width")):(this.player.video.muted=!0,this.player.template.volumeIcon.innerHTML=w.volumeOff,this.player.bar.set("volume",0,"width"))})}initQualityButton(){if(this.player.options.video.quality){const e=this.player.options.video.defaultQuality||0,t=this.player.template.qualityList.querySelectorAll(".kplayer-quality-item");t[e]&&t[e].classList.add("kplayer-selected"),this.player.template.qualityList.addEventListener("click",i=>{const s=i.target.closest(".kplayer-quality-item");s&&(t.forEach(a=>a.classList.remove("kplayer-selected")),s.classList.add("kplayer-selected"),this.player.switchQuality(Number(s.dataset.index)))})}}initScreenshotButton(){this.player.options.screenshot&&this.player.template.camareButton&&this.player.template.camareButton.addEventListener("click",()=>{var t;const e=document.createElement("canvas");e.width=this.player.video.videoWidth,e.height=this.player.video.videoHeight,(t=e.getContext("2d"))==null||t.drawImage(this.player.video,0,0,e.width,e.height),e.toBlob(i=>{if(!i)return;const s=URL.createObjectURL(i),a=document.createElement("a");a.href=s,a.download="kplayer.png",a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(s),this.player.events.trigger("screenshot",s)})})}initAirplayButton(){this.player.options.airplay&&(window.WebKitPlaybackTargetAvailabilityEvent?this.player.video.addEventListener("webkitplaybacktargetavailabilitychanged",(function(e){var i;e.availability==="available"?this.template.airplayButton&&(this.template.airplayButton.disable=!1):this.template.airplayButton&&(this.template.airplayButton.disable=!0),(i=this.template.airplayButton)==null||i.addEventListener("click",()=>{var s,a;(a=(s=this.video).webkitShowPlaybackTargetPicker)==null||a.call(s)})}).bind(this.player)):this.player.template.airplayButton&&(this.player.template.airplayButton.style.display="none"))}initChromecast(){const e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("src","https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"),document.body.appendChild(e),window.__onGCastApiAvailable=t=>{var i;if(t){if(cast=(i=window.chrome)==null?void 0:i.cast,!cast)return;const s=new cast.SessionRequest(cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID),a=new cast.ApiConfig(s,()=>{},l=>{l===cast.ReceiverAvailability.AVAILABLE&&console.log("chromecast:",l)});cast.initialize(a,()=>{})}}}initChromecastButton(){var e;if(this.player.options.chromecast){z&&(z=!1,this.initChromecast());const t=a=>{if(!cast)return!1;const l=new cast.media.MediaInfo(a),r=new cast.media.LoadRequest(l);return this.session?(this.session.loadMedia(r,i.bind(this,"loadMedia"),s).play(),!0):(window.open(a),!1)},i=(a,l)=>{this.currentMedia=l},s=a=>{console.error("Error launching media",a)};(e=this.player.template.chromecastButton)==null||e.addEventListener("click",()=>{var a,l;M?(M=!1,(a=this.currentMedia)==null||a.stop(),(l=this.session)==null||l.stop(),this.initChromecast()):(M=!0,cast==null||cast.requestSession(r=>{this.session=r,t(this.player.options.video.url||"")},r=>{r.code==="cancel"?this.session=void 0:console.error("Error selecting cast device",r)}))})}}initSubtitleButton(){this.player.events.on("subtitle_show",()=>{this.player.template.subtitleButton&&"dataset"in this.player.template.subtitleButton&&(this.player.template.subtitleButton.dataset.balloon=this.player.tran("hide-subs")),this.player.template.subtitleButtonInner&&(this.player.template.subtitleButtonInner.style.opacity=""),this.player.user.set("subtitle",1)}),this.player.events.on("subtitle_hide",()=>{this.player.template.subtitleButton&&"dataset"in this.player.template.subtitleButton&&(this.player.template.subtitleButton.dataset.balloon=this.player.tran("show-subs")),this.player.template.subtitleButtonInner&&(this.player.template.subtitleButtonInner.style.opacity="0.4"),this.player.user.set("subtitle",0)}),this.player.template.subtitleButton&&"addEventListener"in this.player.template.subtitleButton&&this.player.template.subtitleButton.addEventListener("click",()=>{var e;(e=this.player.subtitle)==null||e.toggle()})}_showTitleBar(){const e=this.player.template.titleBar;e&&(e.style.opacity="1",e.style.visibility="visible",e.style.transform="translateY(0)",e.style.pointerEvents="auto")}_hideTitleBar(){const e=this.player.template.titleBar;e&&(e.style.opacity="0",e.style.visibility="hidden",e.style.transform="translateY(-8px)",e.style.pointerEvents="none")}setAutoHide(){this.show(),clearTimeout(this.autoHideTimer),this.autoHideTimer=window.setTimeout(()=>{this.player.video.played.length&&!this.player.paused&&!this.disableAutoHide&&this.hide()},1500)}show(){this.player.container.classList.remove("kplayer-hide-controller"),this._showTitleBar()}hide(){this.player.container.classList.add("kplayer-hide-controller"),this.player.setting.hide(),this._hideTitleBar()}isShow(){return!this.player.container.classList.contains("kplayer-hide-controller")}toggle(){this.isShow()?this.hide():this.show()}destroy(){!u.isMobile&&this.setAutoHideHandler&&(this.player.container.removeEventListener("mousemove",this.setAutoHideHandler),this.player.container.removeEventListener("click",this.setAutoHideHandler)),clearTimeout(this.autoHideTimer)}}class xe{constructor(e){var a,l,r;this.player=e,this.player.template.mask.addEventListener("click",()=>{this.hide()}),this.player.template.settingButton.addEventListener("click",()=>{this.show()}),this.loop=this.player.options.loop||!1,this.player.template.loopToggle.checked=this.loop,this.player.template.loop.addEventListener("click",()=>{this.player.template.loopToggle.checked=!this.player.template.loopToggle.checked,this.loop=this.player.template.loopToggle.checked}),this.showAwaken=this.player.user.get("awaken"),this.showAwaken||this.player.awaken&&this.player.awaken.hide(),this.player.template.showAwakenToggle.checked=!!this.showAwaken,this.player.template.showAwaken.addEventListener("click",()=>{var y,c;this.player.template.showAwakenToggle.checked=!this.player.template.showAwakenToggle.checked,this.player.template.showAwakenToggle.checked?(this.showAwaken=1,(y=this.player.awaken)==null||y.show()):(this.showAwaken=0,(c=this.player.awaken)==null||c.hide()),this.player.user.set("awaken",this.showAwaken?1:0),this.hide()}),this.unlimitAwaken=this.player.user.get("unlimited"),this.player.template.unlimitAwakenToggle.checked=!!this.unlimitAwaken,this.player.template.unlimitAwaken.addEventListener("click",()=>{var y,c;this.player.template.unlimitAwakenToggle.checked=!this.player.template.unlimitAwakenToggle.checked,this.player.template.unlimitAwakenToggle.checked?(this.unlimitAwaken=1,(y=this.player.awaken)==null||y.unlimit(!0)):(this.unlimitAwaken=0,(c=this.player.awaken)==null||c.unlimit(!1)),this.player.user.set("unlimited",this.unlimitAwaken?1:0),this.hide()}),this.player.template.speed.addEventListener("click",()=>{this.player.template.settingBox.classList.add("kplayer-setting-box-speed")});const i=(this.player.options.playbackSpeed||[]).indexOf(1);if(i>=0&&this.player.template.speedItem[i]&&this.player.template.speedItem[i].classList.add("kplayer-selected"),Array.from(this.player.template.speedItem).forEach((y,c)=>{y.addEventListener("click",()=>{Array.from(this.player.template.speedItem).forEach(h=>h.classList.remove("kplayer-selected")),y.classList.add("kplayer-selected"),this.player.speed(Number(y.dataset.speed));const k=this.player.container.querySelector("#kplayer-speed-current");if(k){const h=y.dataset.speed;k.textContent=h==="1"?"1×":h+"×"}})}),this.player.template.subtitleEntry&&this.player.template.subtitleEntry.addEventListener("click",()=>{this.player.template.settingBox.classList.add("kplayer-setting-box-subtitle")}),this.player.template.qualityEntry&&this.player.template.qualityEntry.addEventListener("click",()=>{this.player.template.settingBox.classList.add("kplayer-setting-box-quality")}),this.airplayEntry=this.player.container.querySelector(".kplayer-setting-airplay-entry"),this.chromecastEntry=this.player.container.querySelector(".kplayer-setting-chromecast-entry"),this.screenshotEntry=this.player.container.querySelector(".kplayer-setting-screenshot-entry"),this.screenshotEntry&&this.player.template.camareButton&&this.screenshotEntry.addEventListener("click",y=>{var c;y.stopPropagation(),(c=this.player.template.camareButton)==null||c.click(),this.hide()}),this.airplayEntry&&this.player.template.airplayButton&&this.airplayEntry.addEventListener("click",y=>{var c;y.stopPropagation(),(c=this.player.template.airplayButton)==null||c.click(),this.hide()}),this.chromecastEntry&&this.player.template.chromecastButton&&this.chromecastEntry.addEventListener("click",y=>{var c;y.stopPropagation(),(c=this.player.template.chromecastButton)==null||c.click(),this.hide()}),this.player.container.querySelectorAll(".kplayer-setting-back-main").forEach(y=>{y.addEventListener("click",()=>{this.player.template.settingBox.classList.remove("kplayer-setting-box-speed"),this.player.template.settingBox.classList.remove("kplayer-setting-box-subtitle"),this.player.template.settingBox.classList.remove("kplayer-setting-box-quality"),this.player.template.settingBox.classList.remove("kplayer-setting-box-narrow")})}),this.player.awaken){this.player.on("awaken_opacity",h=>{this.player.bar.set("awaken",h,"width"),this.player.user.set("opacity",h)}),(a=this.player.awaken)==null||a.opacity(this.player.user.get("opacity"));const c=h=>{var p,f,v;const m=h;let o=((m.clientX||((f=(p=m.changedTouches)==null?void 0:p[0])==null?void 0:f.clientX)||0)-u.getBoundingClientRectViewLeft(this.player.template.awakenOpacityBarWrap))/130;o=Math.max(0,Math.min(1,o)),(v=this.player.awaken)==null||v.opacity(o)},k=()=>{var h;document.removeEventListener(u.nameMap.dragEnd,k),document.removeEventListener(u.nameMap.dragMove,c),(h=this.player.template.awakenOpacityBox)==null||h.classList.remove("kplayer-setting-awaken-active")};(l=this.player.template.awakenOpacityBarWrapWrap)==null||l.addEventListener("click",h=>{var o;let m=((h.clientX||0)-u.getBoundingClientRectViewLeft(this.player.template.awakenOpacityBarWrap))/130;m=Math.max(0,Math.min(1,m)),(o=this.player.awaken)==null||o.opacity(m)}),(r=this.player.template.awakenOpacityBarWrapWrap)==null||r.addEventListener(u.nameMap.dragStart,()=>{var h;document.addEventListener(u.nameMap.dragMove,c),document.addEventListener(u.nameMap.dragEnd,k),(h=this.player.template.awakenOpacityBox)==null||h.classList.add("kplayer-setting-awaken-active")})}}hide(){this.player.template.settingBox.classList.remove("kplayer-setting-box-open"),this.player.template.mask.classList.remove("kplayer-mask-show"),setTimeout(()=>{this.player.template.settingBox.classList.remove("kplayer-setting-box-narrow"),this.player.template.settingBox.classList.remove("kplayer-setting-box-speed"),this.player.template.settingBox.classList.remove("kplayer-setting-box-subtitle"),this.player.template.settingBox.classList.remove("kplayer-setting-box-quality")},300),this.player.controller.disableAutoHide=!1}show(){this.player.template.settingBox.classList.add("kplayer-setting-box-open"),this.player.template.mask.classList.add("kplayer-mask-show"),this.player.controller.disableAutoHide=!0}}class Le{constructor(e){this.player=e,this.doHotKeyHandler=this.doHotKey.bind(this),this.cancelFullScreenHandler=this.cancelFullScreen.bind(this),this.player.options.hotkey&&document.addEventListener("keydown",this.doHotKeyHandler),document.addEventListener("keydown",this.cancelFullScreenHandler)}doHotKey(e){var t;if(this.player.focus){const i=document.activeElement.tagName.toUpperCase(),s=(t=document.activeElement)==null?void 0:t.getAttribute("contenteditable");if(i!=="INPUT"&&i!=="TEXTAREA"&&s!==""&&s!=="true"){let a;switch(e.keyCode){case 32:e.preventDefault(),this.player.toggle();break;case 37:if(e.preventDefault(),this.player.options.live)break;this.player.seek(this.player.video.currentTime-10),this.player.controller.setAutoHide();break;case 39:if(e.preventDefault(),this.player.options.live)break;this.player.seek(this.player.video.currentTime+10),this.player.controller.setAutoHide();break;case 38:e.preventDefault(),a=this.player.volume()+.1,this.player.volume(a);break;case 40:e.preventDefault(),a=this.player.volume()-.1,this.player.volume(a);break}}}}cancelFullScreen(e){switch(e.keyCode){case 27:this.player.fullScreen.isFullScreen("web")&&this.player.fullScreen.cancel("web");break}}destroy(){this.player.options.hotkey&&document.removeEventListener("keydown",this.doHotKeyHandler),document.removeEventListener("keydown",this.cancelFullScreenHandler)}}class Be{constructor(e){this.shown=!1,this.player=e,Array.prototype.slice.call(this.player.template.menuItem).forEach((t,i)=>{var a;const s=(a=this.player.options.contextmenu)==null?void 0:a[i];s!=null&&s.click&&t.addEventListener("click",()=>{s.click(this.player),this.hide()})}),this.contextmenuHandler=t=>{t.preventDefault(),t.stopPropagation();const i=this.player.container.getBoundingClientRect(),s=t.clientX-i.left,a=t.clientY-i.top;if(this.shown){this.hide();return}this.show(s,a)},this.player.container.addEventListener("contextmenu",this.contextmenuHandler),this.videoContextHandler=t=>{t.preventDefault(),t.stopPropagation();const i=this.player.container.getBoundingClientRect(),s=t.clientX-i.left,a=t.clientY-i.top;if(this.shown){this.hide();return}this.show(s,a)},this.player.video.addEventListener("contextmenu",this.videoContextHandler)}show(e,t){this.player.template.menu.classList.add("kplayer-menu-show");const i=this.player.container.getBoundingClientRect();e+this.player.template.menu.offsetWidth>=i.width?(this.player.template.menu.style.right=i.width-e+"px",this.player.template.menu.style.left="initial"):(this.player.template.menu.style.left=e+"px",this.player.template.menu.style.right="initial"),t+this.player.template.menu.offsetHeight>=i.height?(this.player.template.menu.style.bottom=i.height-t+"px",this.player.template.menu.style.top="initial"):(this.player.template.menu.style.top=t+"px",this.player.template.menu.style.bottom="initial"),this.player.template.mask.classList.add("kplayer-mask-show"),this.shown=!0,this.player.events.trigger("contextmenu_show")}hide(){this.player.template.mask.classList.remove("kplayer-mask-show"),this.player.template.menu.classList.remove("kplayer-menu-show"),this.shown=!1,this.player.events.trigger("contextmenu_hide")}destroy(){this.player.container.removeEventListener("contextmenu",this.contextmenuHandler),this.videoContextHandler&&this.player.video.removeEventListener("contextmenu",this.videoContextHandler)}}class Ee{constructor(e){var t;this.beginTime=0,this.container=e.template.infoPanel,this.template=e.template,this.video=e.video,this.player=e,(t=this.template.infoPanelClose)==null||t.addEventListener("click",()=>{this.hide()})}show(){this.beginTime=Date.now(),this.update(),this.player.timer.enable("info"),this.player.timer.enable("fps"),this.container.classList.remove("kplayer-info-panel-hide")}hide(){this.player.timer.disable("info"),this.player.timer.disable("fps"),this.container.classList.add("kplayer-info-panel-hide")}triggle(){this.container.classList.contains("kplayer-info-panel-hide")?this.show():this.hide()}update(){var e;this.template.infoVersion&&(this.template.infoVersion.innerHTML="v1.0.0 dev"),this.template.infoType&&(this.template.infoType.innerHTML=this.player.type||""),this.template.infoUrl&&(this.template.infoUrl.innerHTML=((e=this.player.options.video)==null?void 0:e.url)||""),this.template.infoResolution&&(this.template.infoResolution.innerHTML=`${this.video.videoWidth} x ${this.video.videoHeight}`),this.template.infoDuration&&(this.template.infoDuration.innerHTML=String(this.video.duration)),this.player.options.awaken&&typeof this.player.options.awaken=="object"&&(this.template.infoAwakenId&&(this.template.infoAwakenId.innerHTML=this.player.options.awaken.id||""),this.template.infoAwakenApi&&(this.template.infoAwakenApi.innerHTML=this.player.options.awaken.api||""))}fps(e){this.template.infoFPS&&(this.template.infoFPS.innerHTML=`${e.toFixed(1)}`)}}let V=0;const S=[];function Te(n){const e=n.DefaultConfig.loader;return class extends e{constructor(i){super(i);const s=this.load.bind(this);this.load=function(a,l,r){const y=r.onSuccess;r.onSuccess=function(c,k,h,m){try{if(a.type==="fragment"){const o=c.data;let p;if(o instanceof ArrayBuffer?p=o:typeof o=="string"&&(p=new TextEncoder().encode(o).buffer),p){const f=new Blob([p],{type:"video/mp2t"}),v=URL.createObjectURL(f);c.url=v,setTimeout(()=>URL.revokeObjectURL(v),1e4)}}}catch(o){console.warn("[KPlayer] BlobHLSLoader error:",o)}y(c,k,h,m)},s(a,l,r)}}}}async function R(n,e,t,i){const s=await fetch(n,{mode:"cors"});if(!s.ok)throw new Error(`HTTP ${s.status}`);let a=await s.text();if(e&&t&&i){const l=/^\d{2}:\d{2}:\d{2}[.,]\d{3}\s*-->\s*\d{2}:\d{2}:\d{2}[.,]\d{3}$/,r=async(p,f,v)=>{const x=new Uint8Array(p.match(/.{2}/g).map(T=>parseInt(T,16))),B=await crypto.subtle.decrypt({name:"AES-CBC",iv:v.buffer},f,x.buffer);return new TextDecoder().decode(B)},y=new Uint8Array(t.match(/.{2}/g).map(p=>parseInt(p,16))),c=new Uint8Array(i.match(/.{2}/g).map(p=>parseInt(p,16))),k=await crypto.subtle.importKey("raw",y.buffer,{name:"AES-CBC"},!1,["decrypt"]);let h;try{h=atob(a.trim())}catch{h=a}const m=h.split(`
404
+ `),o=[];for(const p of m){const f=p.trim();if(!f){o.push(p);continue}if(l.test(f)){o.push(p);continue}if(/^[0-9a-fA-F]+$/.test(f)&&f.length%2===0)try{const v=await r(f,k,c);o.push(v)}catch{o.push(p)}else o.push(p)}a=o.join(`
405
+ `)}return a}class Ce{constructor(e){var t,i;if(this.focus=!1,this.paused=!0,this.moveBar=!1,this.switchingQuality=!1,this.options=j({preload:((t=e.video)==null?void 0:t.type)==="webtorrent"?"none":"metadata",...e}),this.options.video.quality&&(this.qualityIndex=this.options.video.defaultQuality??0,this.quality=this.options.video.quality[this.qualityIndex]),this.tran=new N(this.options.lang||"en").tran,this.events=new de,this.user=new ye(this),this.container=this.options.container,this.noticeList={},this.hlsQualityList=[],this.hlsCurrentLevel=-1,this.hlsAutoEnabled=!0,this.container.classList.add("kplayer"),this.options.awaken||this.container.classList.add("kplayer-no-awaken"),this.options.live?this.container.classList.add("kplayer-live"):this.container.classList.remove("kplayer-live"),u.isMobile&&this.container.classList.add("kplayer-mobile"),this.container.offsetWidth<=500&&this.container.classList.add("kplayer-arrow"),this.options.subtitle&&Array.isArray(this.options.subtitle.url)){const s={subtitle:"",lang:"off",url:""};if(this.options.subtitle.url.push(s),this.options.subtitle.defaultSubtitle!==void 0){const l=this.options.subtitle.defaultSubtitle;typeof l=="string"?this.options.subtitle.index=this.options.subtitle.url.findIndex(r=>r.lang===l||r.name===l):typeof l=="number"&&(this.options.subtitle.index=l)}const a=this.options.subtitle.url;(this.options.subtitle.index===-1||this.options.subtitle.index==null||this.options.subtitle.index>a.length-1)&&(this.options.subtitle.index=a.findIndex(l=>l.lang===this.options.lang)),this.options.subtitle.index===-1&&(this.options.subtitle.index=a.length-1)}this.template=new W({container:this.container,options:this.options,index:V,tran:this.tran}),this.video=this.template.video,this.bar=new fe(this.template),this.bezel=new ge(this.template.bezel),this.fullScreen=new ue(this),this.controller=new we(this),this.setting=new xe(this),this.plugins={},this.docClickFun=()=>{this.focus=!1},this.containerClickFun=()=>{this.focus=!0},document.addEventListener("click",this.docClickFun,!0),this.container.addEventListener("click",this.containerClickFun,!0),this.paused=!0,this.timer=new ve(this),this.hotkey=new Le(this),this.contextmenu=new Be(this),this.initVideo(this.video,this.quality&&this.quality.type||this.options.video.type||"auto"),this.infoPanel=new Ee(this),(this.options.ad||this.options.vastAD)&&(this.ad=new he(this)),this.options.vastAD&&this.options.vastADURL&&((i=this.ad)==null||i._loadVAST(this.options.vastADURL)),this.template.titleBack&&this.template.titleBack.addEventListener("click",()=>{var s;typeof((s=this.options.title)==null?void 0:s.onBack)=="function"?this.options.title.onBack(this):window.history.back(),this.events.trigger("title_back")}),!this.awaken&&this.options.autoplay&&this.play(),this.moveBar=!1,V++,S.push(this)}seek(e){e=Math.max(e,0),this.video.duration&&(e=Math.min(e,this.video.duration)),this.video.currentTime<e?this.notice(`${this.tran("ff").replace("%s",(e-this.video.currentTime).toFixed(0))}`):this.video.currentTime>e&&this.notice(`${this.tran("rew").replace("%s",(this.video.currentTime-e).toFixed(0))}`),this.video.currentTime=e,this.awaken&&this.awaken.seek(),this.bar.set("played",e/this.video.duration,"width"),this.template.ptime.innerHTML=u.secondToTime(e)}play(e){if(this.paused=!1,this.video.paused&&!u.isMobile&&this.bezel.switch(w.play),this.template.playButton.innerHTML=w.pause,this.template.mobilePlayButton.innerHTML=w.pause,e||Promise.resolve(this.video.play()).catch(()=>{this.pause()}),this.timer.enable("loading"),this.container.classList.remove("kplayer-paused"),this.container.classList.add("kplayer-playing"),this.awaken&&this.awaken.play(),this.options.mutex)for(const i of S)this!==i&&i.pause();const t=this.container.querySelector(".kplayer-mobile-play-btn .kplayer-icon-content");t&&(t.innerHTML=w.pause)}pause(e){this.paused=!0,this.container.classList.remove("kplayer-loading"),!this.video.paused&&!u.isMobile&&this.bezel.switch(w.pause),this.template.playButton.innerHTML=w.play,this.template.mobilePlayButton.innerHTML=w.play,e||this.video.pause(),this.timer.disable("loading"),this.container.classList.remove("kplayer-playing"),this.container.classList.add("kplayer-paused"),this.awaken&&this.awaken.pause();const t=this.container.querySelector(".kplayer-mobile-play-btn .kplayer-icon-content");t&&(t.innerHTML=w.play)}switchVolumeIcon(){this.volume()>=.95?this.template.volumeIcon.innerHTML=w.volumeUp:this.volume()>0?this.template.volumeIcon.innerHTML=w.volumeDown:this.template.volumeIcon.innerHTML=w.volumeOff}volume(e,t,i){const s=parseFloat(String(e));if(!isNaN(s)){const a=Math.max(0,Math.min(1,s));this.bar.set("volume",a,"width");const l=`${(a*100).toFixed(0)}%`;this.template.volumeBarWrapWrap.dataset.balloon=l,t||this.user.set("volume",a),i||this.notice(`${this.tran("volume")} ${(a*100).toFixed(0)}%`,void 0,void 0,"volume"),this.video.volume=a,this.video.muted&&(this.video.muted=!1),this.switchVolumeIcon()}return this.video.volume}toggle(){this.video.paused?this.play():this.pause()}on(e,t){this.events.on(e,t)}initMSE(e,t){var a,l,r,y,c,k,h,m;if(this.type=t,(a=this.options.video.customType)!=null&&a[t]){const o=this.options.video.customType[t];typeof o=="function"?o(this.video,this):console.error(`Illegal customType: ${t}`);return}let i=t;i==="auto"&&(/m3u8(#|\?|$)/i.exec(e.src)?i="hls":/.flv(#|\?|$)/i.exec(e.src)?i="flv":/.mpd(#|\?|$)/i.exec(e.src)?i="dash":i="normal"),i==="auto"&&(e.canPlayType("application/x-mpegURL")||e.canPlayType("application/vnd.apple.mpegURL"))&&(i="normal"),this.type=i;const s=this.quality?this.quality.url:e.src;switch(i){case"hls":{const o=window.Hls;if(!o){this.notice("Error: Can't find Hls.");return}if(!o.isSupported()){this.notice("Error: Hls is not supported.");return}const p=((l=this.options.pluginOptions)==null?void 0:l.hls)||{},f=Te(o),v=new o({...p,loader:f});this.plugins.hls=v,v.loadSource(e.src),v.attachMedia(e),v.on(o.Events.MANIFEST_PARSED,()=>{this.buildHlsQualityMenu(v),this.updateHlsQualityCurrentLabel()}),v.on(o.Events.LEVEL_SWITCHED,(x,B)=>{this.hlsCurrentLevel=B.level,this.updateHlsQualityCurrentLabel()}),this.events.on("destroy",()=>{v.destroy(),delete this.plugins.hls});break}case"flv":{const o=window.flvjs;if(o)if(o.isSupported()){const p=o.createPlayer(Object.assign(((y=(r=this.options.pluginOptions)==null?void 0:r.flv)==null?void 0:y.mediaDataSource)||{},{type:"flv",url:e.src}),(k=(c=this.options.pluginOptions)==null?void 0:c.flv)==null?void 0:k.config);this.plugins.flvjs=p,p.attachMediaElement(e),p.load(),this.events.on("destroy",()=>{p.unload(),p.detachMediaElement(),p.destroy(),delete this.plugins.flvjs}),this.events.on("quality_end",()=>{var f;s!==((f=this.quality)==null?void 0:f.url)&&(p.unload(),p.detachMediaElement(),p.destroy())})}else this.notice("Error: flvjs is not supported.");else this.notice("Error: Can't find flvjs.");break}case"dash":{const o=window.dashjs;if(o){const p=o.MediaPlayer().create();p.initialize(e,e.src,!1,0),p.updateSettings(((h=this.options.pluginOptions)==null?void 0:h.dash)||{}),this.plugins.dash=p,this.events.on("destroy",()=>{o.MediaPlayer().reset(),delete this.plugins.dash}),this.events.on("quality_end",()=>{var f;s!==((f=this.quality)==null?void 0:f.url)&&o.MediaPlayer().reset()})}else this.notice("Error: Can't find dashjs.");break}case"webtorrent":{const o=window.WebTorrent;if(o)if(o.WEBRTC_SUPPORT){this.container.classList.add("kplayer-loading");const p=new o(((m=this.options.pluginOptions)==null?void 0:m.webtorrent)||{});this.plugins.webtorrent=p;const f=e.src;e.src="",e.preload="metadata",e.addEventListener("durationchange",()=>this.container.classList.remove("kplayer-loading"),{once:!0}),p.add(f,v=>{const x=v.files.find(B=>B.name.endsWith(".mp4"));x==null||x.renderTo(this.video,{autoplay:this.options.autoplay,controls:!1})}),this.events.on("destroy",()=>{p.remove(f),p.destroy(),delete this.plugins.webtorrent}),this.events.on("quality_end",()=>{var v;s!==((v=this.quality)==null?void 0:v.url)&&(p.remove(f),p.destroy())})}else this.notice("Error: Webtorrent is not supported.");else this.notice("Error: Can't find Webtorrent.");break}}}initVideo(e,t){this.initMSE(e,t),this.on("durationchange",()=>{e.duration!==1&&e.duration!==1/0&&(this.template.dtime.innerHTML=u.secondToTime(e.duration))}),this.on("progress",()=>{const i=e.buffered.length?e.buffered.end(e.buffered.length-1)/e.duration:0;this.bar.set("loaded",i,"width")}),this.on("error",()=>{this.video.error&&this.tran&&this.notice&&this.type!=="webtorrent"&&this.notice(this.tran("video-failed"))}),this.on("ended",()=>{this.bar.set("played",1,"width"),this.setting.loop?(this.seek(0),this.play()):this.pause(),this.awaken&&(this.awaken.danIndex=0)}),this.on("play",()=>{this.paused&&this.play(!0)}),this.on("pause",()=>{this.paused||this.pause(!0)}),this.on("timeupdate",()=>{this.moveBar||this.bar.set("played",this.video.currentTime/this.video.duration,"width");const i=u.secondToTime(this.video.currentTime);this.template.ptime.innerHTML!==i&&(this.template.ptime.innerHTML=i)});for(const i of this.events.videoEvents)e.addEventListener(i,s=>{this.events.trigger(i,s)});this.volume(this.user.get("volume"),!0,!0),this.options.subtitle&&(this.subtitle=new me(this.template.subtitle,this.video,this.options.subtitle,this.events),Array.isArray(this.options.subtitle.url)&&(this.subtitles=new ke(this)),this.user.get("subtitle")||this.subtitle.hide(),this._loadSubtitleTexts())}getHlsLevelLabel(e){return e?e.height?`${e.height}p`:e.bitrate?`${Math.round(e.bitrate/1e3)}kbps`:"Auto":"Auto"}updateHlsQualityCurrentLabel(){const e=this.container.querySelector("#kplayer-quality-current");if(!e||!this.plugins.hls)return;const t=this.plugins.hls;if(t.autoLevelEnabled){const i=t.levels[t.currentLevel];e.textContent=i?`Auto (${i.height}p)`:"Auto"}else{const i=t.levels[t.currentLevel];e.textContent=i?`${i.height}p`:"Manual"}}buildHlsQualityMenu(e){var y;if(!((y=e==null?void 0:e.levels)!=null&&y.length))return;const t=new Set,i=[];e.levels.forEach((c,k)=>{const h=`${c.height}-${c.bitrate}`;t.has(h)||(t.add(h),i.push({index:k,name:c.height?`${c.height}p`:`${Math.round((c.bitrate||0)/1e3)}kbps`,height:c.height||0,bitrate:c.bitrate||0}))}),i.sort((c,k)=>k.height-c.height||k.bitrate-c.bitrate);const s=[{index:-1,name:"Auto"},...i],a=this.container.querySelector(".kplayer-quality-list");if(!a)return;a.innerHTML=s.map(c=>`
406
+ <div class="kplayer-quality-item" data-level="${c.index}">
407
+ <span class="kplayer-label">${c.name}</span>
408
+ </div>
409
+ `).join("");const l=a.querySelectorAll(".kplayer-quality-item"),r=this.container.querySelector("#kplayer-quality-current");l.forEach(c=>{c.addEventListener("click",()=>{var h;const k=Number(c.dataset.level);e.currentLevel=k,e.nextLevel=k,e.loadLevel=k,l.forEach(m=>m.classList.remove("active")),c.classList.add("active"),r&&(r.textContent=((h=c.textContent)==null?void 0:h.trim())||"")})}),r&&(r.textContent="Auto")}switchQuality(e){var l;if(e=typeof e=="string"?parseInt(e):e,this.qualityIndex===e||this.switchingQuality||(this.prevIndex=this.qualityIndex,this.qualityIndex=e,this.switchingQuality=!0,this.quality=(l=this.options.video.quality)==null?void 0:l[e],!this.quality))return;this.template.qualityButton&&(this.template.qualityButton.innerHTML=this.quality.name);const t=this.container.querySelector("#kplayer-quality-current");t&&(t.textContent=this.quality.name);const i=this.video.paused;this.video.pause();const s=O({current:!1,pic:void 0,screenshot:this.options.screenshot,preload:"auto",url:this.quality.url,subtitle:this.options.subtitle}),a=new DOMParser().parseFromString(s,"text/html").body.firstChild;this.template.videoWrap.insertBefore(a,this.template.videoWrap.getElementsByTagName("div")[0]),this.prevVideo=this.video,this.video=a,this.initVideo(this.video,this.quality.type||this.options.video.type||"auto"),this.seek(this.prevVideo.currentTime),this.notice(`${this.tran("switching-quality").replace("%q",this.quality.name)}`,-1,void 0,"switch-quality"),this.events.trigger("quality_start",this.quality),this.on("canplay",()=>{if(this.prevVideo){if(this.video.currentTime!==this.prevVideo.currentTime){this.seek(this.prevVideo.currentTime);return}this.template.videoWrap.removeChild(this.prevVideo),this.video.classList.add("kplayer-video-current"),i||this.video.play(),this.prevVideo=void 0,this.notice(`${this.tran("switched-quality").replace("%q",this.quality.name)}`,void 0,void 0,"switch-quality"),this.switchingQuality=!1,this.events.trigger("quality_end")}}),this.on("error",()=>{var r;this.video.error&&this.prevVideo&&(this.template.videoWrap.removeChild(this.video),this.video=this.prevVideo,i||this.video.play(),this.qualityIndex=this.prevIndex,this.quality=(r=this.options.video.quality)==null?void 0:r[this.qualityIndex??0],this.prevVideo=void 0,this.switchingQuality=!1)})}notice(e,t=2e3,i=.8,s){let a;if(s&&(a=document.getElementById(`kplayer-notice-${s}`),a&&(a.innerHTML=e),this.noticeList[s]&&(clearTimeout(this.noticeList[s]),this.noticeList[s]=null)),!a){const l=W.NewNotice(e,i,s);this.template.noticeList.appendChild(l),a=l}this.events.trigger("notice_show",a),t>0&&(this.noticeList[s||""]=setTimeout(((l,r)=>()=>{l.addEventListener("animationend",()=>{r.template.noticeList.removeChild(l)}),l.classList.add("remove-notice"),r.events.trigger("notice_hide"),r.noticeList[s||""]=null})(a,this),t))}resize(){this.awaken&&this.awaken.resize(),this.controller.thumbnails&&this.controller.thumbnails.resize(160,this.video.videoHeight/this.video.videoWidth*160,this.template.barWrap.offsetWidth),this.events.trigger("resize")}speed(e){this.video.playbackRate=e}destroy(){var e;S.splice(S.indexOf(this),1),this.pause(),document.removeEventListener("click",this.docClickFun,!0),this.container.removeEventListener("click",this.containerClickFun,!0),this.fullScreen.destroy(),this.hotkey.destroy(),this.contextmenu.destroy(),this.controller.destroy(),this.timer.destroy(),this.video.src="",this.container.innerHTML="",(e=this.ad)==null||e.destroy(),this.events.trigger("destroy")}static get version(){return"1.0.0"}async _loadSubtitleTexts(){var s;const e=this.options.subtitle;if(!(e!=null&&e.url)||!Array.isArray(e.url))return;const t=e.index??0,i=e.url[t];if(!(!(i!=null&&i.url)||i.lang==="off"))try{const a=await R(i.url,e.encrypt,e.key,e.iv);await((s=this.subtitle)==null?void 0:s.loadVttText(a))}catch(a){console.warn("[KPlayer] Subtitle load failed:",a)}}async loadSubtitleByIndex(e){var s,a,l;const t=this.options.subtitle;if(!(t!=null&&t.url)||!Array.isArray(t.url))return;const i=t.url[e];if(!(i!=null&&i.url)||i.lang==="off"){(s=this.subtitle)==null||s.hide();return}try{const r=await R(i.url,t.encrypt,t.key,t.iv);await((a=this.subtitle)==null?void 0:a.loadVttText(r)),(l=this.subtitle)==null||l.show()}catch(r){console.warn("[KPlayer] Subtitle switch failed:",r)}}}module.exports=Ce;
410
+ //# sourceMappingURL=kplayer.cjs.js.map