/*! * artplayer-plugin-vtt-thumbnail.js v1.0.4 * Github: https://github.com/zhw2590582/ArtPlayer * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ !function(t,n){"object"===typeof exports&&"undefined"!==typeof module?module.exports=n():"function"==typeof define&&define.amd?(t.ArtplayerPluginVttThumbnail=n(),define(function(){return t.ArtplayerPluginVttThumbnail})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginVttThumbnail=n()}(this,function(){"use strict";var t=(t,n,e)=>new Promise((l,i)=>{var o=t=>{try{s(e.next(t))}catch(n){i(n)}},r=t=>{try{s(e.throw(t))}catch(n){i(n)}},s=t=>t.done?l(t.value):Promise.resolve(t.value).then(o,r);s((e=e.apply(t,n)).next())});function n(t){const n=t.split("."),e=n[0].split(":")||[],l=(i=n[1]||"0",o=3,r="0",i.length>o?String(i):((o-=i.length)>r.length&&(r+=r.repeat(o/r.length)),String(i)+r.slice(0,o)));var i,o,r;const s=Number(l)/1e3;return 3600*Number(e[e.length-3]||0)+60*Number(e[e.length-2]||0)+Number(e[e.length-1]||0)+s}function e(e){return l=>t(null,null,function*(){const{constructor:{utils:{setStyle:i,isMobile:o,addClass:r}},template:{$progress:s}}=l;let u=null;const d=yield function(e=""){return t(this,null,function*(){const t=(yield(yield fetch(e)).text()).split(/[\n\r]/g).filter(t=>t.trim()),l=[];for(let i=1;i ?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,u=o.match(s),d=/(.*)#(\w{4})=(.*)/,a=r.match(d),c=Math.floor(n(u[1])),p=Math.floor(n(u[2]));let f=a[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(f)){const t=e.split("/");t.pop(),t.push(f),f=t.join("/")}const h={start:c,end:p,url:f},m=a[2].split(""),y=a[3].split(",");for(let t=0;tt(null,null,function*(){const t="played"===e&&a&&o;if("hover"===e||t){const e=s.clientWidth*r,a=r*l.duration;i(n,"display","flex");const c=d.find(t=>a>=t.start&&a<=t.end);if(!c)return i(n,"display","none");e>0&&es.clientWidth-n.w/2?i(t,"left",s.clientWidth-n.w+"px"):i(t,"left",e-n.w/2+"px")}(n,c,e):o||i(n,"display","none"),t&&(clearTimeout(u),u=setTimeout(()=>{i(n,"display","none")},500))}}))}}),{name:"artplayerPluginVttThumbnail"}})}return"undefined"!==typeof window&&(window.artplayerPluginVttThumbnail=e),e});