({value:t,name:`aspect-ratio-${t}`,default:t===e.aspectRatio,html:i(t)})),onSelect:t=>(e.aspectRatio=t.value,t.html),mounted:()=>{n(),e.on("aspectRatio",()=>n())}}}o.defineInteropFlag(r),o.export(r,"default",()=>i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],ljJTO:[function(e,t,r,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>n);var i=e("../utils");function n(e){let{i18n:t,icons:r,constructor:{SETTING_ITEM_WIDTH:a,FLIP:o}}=e;function n(e){return t.get((0,i.capitalize)(e))}function s(){let t=e.setting.find(`flip-${e.flip}`);e.setting.check(t)}return{width:a,name:"flip",html:t.get("Video Flip"),tooltip:n(e.flip),icon:r.flip,selector:o.map(t=>({value:t,name:`flip-${t}`,default:t===e.flip,html:n(t)})),onSelect:t=>(e.flip=t.value,t.html),mounted:()=>{s(),e.on("flip",()=>s())}}}},{"../utils":"aBlEo","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3QcSQ":[function(e,t,r,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){let{i18n:t,icons:r,constructor:{SETTING_ITEM_WIDTH:a,PLAYBACK_RATE:o}}=e;function i(e){return 1===e?t.get("Normal"):e.toFixed(1)}function n(){let t=e.setting.find(`playback-rate-${e.playbackRate}`);e.setting.check(t)}return{width:a,name:"playback-rate",html:t.get("Play Speed"),tooltip:i(e.playbackRate),icon:r.playbackRate,selector:o.map(t=>({value:t,name:`playback-rate-${t}`,default:t===e.playbackRate,html:i(t)})),onSelect:t=>(e.playbackRate=t.value,t.html),mounted:()=>{n(),e.on("video:ratechange",()=>n())}}}o.defineInteropFlag(r),o.export(r,"default",()=>i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],eB5hg:[function(e,t,r,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){let{i18n:t,icons:r,constructor:a}=e;return{width:a.SETTING_ITEM_WIDTH,name:"subtitle-offset",html:t.get("Subtitle Offset"),icon:r.subtitle,tooltip:"0s",range:[0,-10,10,.1],onChange:t=>(e.subtitleOffset=t.range[0],`${t.range[0]}s`),mounted:(t,r)=>{e.on("subtitleOffset",e=>{r.$range.value=e,r.tooltip=`${e}s`})}}}o.defineInteropFlag(r),o.export(r,"default",()=>i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],kwqbK:[function(e,t,r,a){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r),r.default=class{constructor(){this.name="artplayer_settings",this.settings={}}get(e){try{let t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:t}catch{return e?this.settings[e]:this.settings}}set(e,t){try{let r=Object.assign({},this.get(),{[e]:t});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[e]=t}}del(e){try{let t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}catch{delete this.settings[e]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],k5613:[function(e,t,r,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("option-validator"),n=o.interopDefault(i),s=e("./scheme"),l=o.interopDefault(s),c=e("./utils"),p=e("./utils/component"),u=o.interopDefault(p);class d extends u.default{constructor(e){super(e),this.name="subtitle",this.option=null,this.destroyEvent=()=>null,this.init(e.option.subtitle);let t=!1;e.on("video:timeupdate",()=>{if(!this.url)return;let e=this.art.template.$video.webkitDisplayingFullscreen;"boolean"==typeof e&&e!==t&&(t=e,this.createTrack(e?"subtitles":"metadata",this.url))})}get url(){return this.art.template.$track.src}set url(e){this.switch(e)}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return this.textTrack?Array.from(this.textTrack.activeCues):[]}get cues(){return this.textTrack?Array.from(this.textTrack.cues):[]}style(e,t){let{$subtitle:r}=this.art.template;return"object"==typeof e?(0,c.setStyles)(r,e):(0,c.setStyle)(r,e,t)}update(){let{option:{subtitle:e},template:{$subtitle:t}}=this.art;t.innerHTML="",this.activeCues.length&&(this.art.emit("subtitleBeforeUpdate",this.activeCues),t.innerHTML=this.activeCues.map((t,r)=>t.text.split(/\r?\n/).filter(e=>e.trim()).map(t=>`${e.escape?(0,c.escape)(t):t}
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(e,t={}){let{i18n:r,notice:a,option:o}=this.art,i={...o.subtitle,...t,url:e},n=await this.init(i);return t.name&&(a.show=`${r.get("Switch Subtitle")}: ${t.name}`),n}createTrack(e,t){let{template:r,proxy:a,option:o}=this.art,{$video:i,$track:n}=r,s=(0,c.createElement)("track");s.default=!0,s.kind=e,s.src=t,s.label=o.subtitle.name||"Artplayer",s.track.mode="hidden",s.onload=()=>{this.art.emit("subtitleLoad",this.cues,this.option)},this.art.events.remove(this.destroyEvent),n.onload=null,(0,c.remove)(n),(0,c.append)(i,s),r.$track=s,this.destroyEvent=a(this.textTrack,"cuechange",()=>this.update())}async init(e){let{notice:t,template:{$subtitle:r}}=this.art;return this.textTrack?((0,n.default)(e,l.default.subtitle),e.url)?(this.option=e,this.style(e.style),fetch(e.url).then(e=>e.arrayBuffer()).then(t=>{let r=new TextDecoder(e.encoding).decode(t);switch(e.type||(0,c.getExt)(e.url)){case"srt":{let t=(0,c.srtToVtt)(r),a=e.onVttLoad(t);return(0,c.vttToBlob)(a)}case"ass":{let t=(0,c.assToVtt)(r),a=e.onVttLoad(t);return(0,c.vttToBlob)(a)}case"vtt":{let t=e.onVttLoad(r);return(0,c.vttToBlob)(t)}default:return e.url}}).then(e=>(r.innerHTML="",this.url===e||(URL.revokeObjectURL(this.url),this.createTrack("metadata",e)),e)).catch(e=>{throw r.innerHTML="",t.show=e,e})):void 0:null}}r.default=d},{"option-validator":"g7VGh","./scheme":"biLjm","./utils":"aBlEo","./utils/component":"idCEj","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],fwOA1:[function(e,t,r,a){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);var o=e("../package.json"),i=e("./utils");class n{constructor(e){this.art=e;let{option:t,constructor:r}=e;t.container instanceof Element?this.$container=t.container:(this.$container=(0,i.query)(t.container),(0,i.errorHandle)(this.$container,`No container element found by ${t.container}`)),(0,i.errorHandle)((0,i.supportsFlex)(),"The current browser does not support flex layout");let a=this.$container.tagName.toLowerCase();(0,i.errorHandle)("div"===a,`Unsupported container element type, only support 'div' but got '${a}'`),(0,i.errorHandle)(r.instances.every(e=>e.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=e.id,this.init()}static get html(){return`Player version:
${o.version}
[x]
`}query(e){return(0,i.query)(e,this.$container)}init(){let{option:e}=this.art;if(e.useSSR||(this.$container.innerHTML=n.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query("track"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsCenter=this.query(".art-controls-center"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$contextmenu=this.query(".art-contextmenus"),e.proxy){let t=e.proxy.call(this.art,this.art);(0,i.errorHandle)(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'"),(0,i.replaceElement)(t,this.$video),t.className="art-video",this.$video=t}e.backdrop&&(0,i.addClass)(this.$player,"art-backdrop"),i.isMobile&&(0,i.addClass)(this.$player,"art-mobile")}destroy(e){e?this.$container.innerHTML="":(0,i.addClass)(this.$player,"art-destroy")}}r.default=n},{"../package.json":"lh3R5","./utils":"aBlEo","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"4NM7P":[function(e,t,r,a){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r),r.default=class{on(e,t,r){let a=this.e||(this.e={});return(a[e]||(a[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){let a=this;function o(...i){a.off(e,o),t.apply(r,i)}return o._=t,this.on(e,o,r)}emit(e,...t){let r=((this.e||(this.e={}))[e]||[]).slice();for(let e=0;e
-
+