!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["utils/view-cover"]=t():e["utils/view-cover"]=t()}(globalThis,(()=>(()=>{var e={39:(e,t,n)=>{var o=n(955)((function(e){return e[1]}));o.push([e.id,".download-cover-config.download-video-config-section .be-dropdown {\n text-transform: uppercase;\n}",""]),e.exports=o},955:e=>{"use strict"; // eslint-disable-next-line func-names e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")}, // eslint-disable-next-line func-names t.i=function(e,n,o){"string"==typeof e&&( // eslint-disable-next-line no-param-reassign e=[[null,e,""]]);var i={};if(o)for(var r=0;r{"use strict";var o,i=function(){return void 0===o&&( // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // @see https://github.com/webpack-contrib/style-loader/issues/177 o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function s(e){for(var t=-1,n=0;n{"use strict";n.r(t),n.d(t,{default:()=>f});var o=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"download-cover-config download-video-config-section"},[t("div",{staticClass:"download-video-config-item"},[t("div",{staticClass:"download-video-config-title"},[e._v("封面:")]),e._v(" "),t("VDropdown",{attrs:{items:e.items},scopedSlots:e._u([{key:"item",fn:function({item:t}){return[e._v("\n "+e._s(t)+"\n ")]}}]),model:{value:e.type,callback:function(t){e.type=t},expression:"type"}})],1)])};o._withStripped=!0;const i=coreApis.settings;var r=n(164);const{options:a}=(0,i.getComponentSettings)("downloadVideo"),s=Vue.extend({components:{VDropdown:r.VDropdown},data:()=>({type:a.CoverType??"无",items:["无","jpg"]}),computed:{enabled(){return"无"!==this.type}},watch:{type(e){a.CoverType=e}}});var c=n(991),l=n.n(c),d=n(39),u=n.n(d),p={insert:"head",singleton:!1};l()(u(),p);u().locals;const f=(0,n(678).A)(s,o,[],!1,null,null,null).exports},277:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var o=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("DefaultWidget",{staticClass:"view-cover",attrs:{disabled:!e.imageUrl,name:"查看封面",icon:"mdi-image-outline"},on:{click:function(t){return e.viewCover()}}})};o._withStripped=!0;var i=n(341);const r=coreApis.ajax,a=coreApis.observer,s=coreApis.spinQuery;var c=n(164);const l=Vue.extend({components:{DefaultWidget:c.DefaultWidget},data:()=>({imageUrl:""}),async mounted(){if(document.URL.includes("live.bilibili.com")){const e=".header-info-ctnr .room-cover, .header-info-ctnr .avatar",t=await(0,s.select)(e);if(!t)return;const n=t.getAttribute("href").match(/space\.bilibili\.com\/([\d]+)/);if(n&&n[1]){const e=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${n[1]}`,t=await(0,r.getJson)(e);this.imageUrl=t.data.cover.replace("http:","https:")}}else(0,a.videoChange)((async()=>{const{aid:e}=unsafeWindow;this.imageUrl=await(0,i.getVideoCoverUrlByAid)(e)}))},methods:{async viewCover(){(0,c.showImage)(this.imageUrl)}}});const d=(0,n(678).A)(l,o,[],!1,null,null,null).exports},678:(e,t,n)=>{"use strict";function o(e,t,n,o,i,r,a,s){var c,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):i&&(c=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(l.functional){l._injectStyles=c;var d=l.render;l.render=function(e,t){return c.call(t),d(e,t)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,c):[c]}return{exports:e,options:l}}n.d(t,{A:()=>o})},341:e=>{"use strict";e.exports=coreApis.componentApis.video.videoCover},164:e=>{"use strict";e.exports=coreApis.ui}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={id:o,exports:{}};return e[o](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var o={};return(()=>{"use strict";n.d(o,{component:()=>a});const e=coreApis.componentApis.define;var t=n(341);const i=coreApis.utils.urls,r=coreApis.toast,a=(0,e.defineComponentMetadata)({name:"viewCover",displayName:"查看封面",tags:[componentsTags.utils,componentsTags.video],entry:none,reload:none,unload:none,plugin:{displayName:"下载视频 - 下载封面支持",setup:e=>{let{addData:o}=e;o("downloadVideo.assets",(async e=>{e.push({name:"downloadCover",displayName:"下载封面",getAssets:async(e,n)=>{const{type:o,enabled:i}=n;if(!i)return[];const a=r.Toast.info("获取封面中...","下载封面");let s=0;const c=await Promise.allSettled(e.map((async n=>{const i=await(0,t.getBlobByAid)(n.input.aid);return s++,a.message=`获取封面中... (${s}/${e.length})`,{name:`${n.input.title}.${o}`,data:i}}))),l=c.filter((e=>"fulfilled"===e.status)),d=c.filter((e=>"rejected"===e.status));return a.message=`获取完成. 成功 ${l.length} 个, 失败 ${d.length} 个.`,l.map((e=>e.value))},getUrls:async(e,n)=>{const{type:o,enabled:i}=n;return i?Promise.all(e.map((async e=>({name:`${e.input.title}.${o}`,url:await(0,t.getVideoCoverUrlByAid)(e.input.aid)})))):[]},component:()=>Promise.resolve().then(n.bind(n,10)).then((e=>e.default))})}))}},widget:{component:()=>Promise.resolve().then(n.bind(n,277)).then((e=>e.default))},description:{"zh-CN":"在视频页面中, 可从功能面板中查看封面."},urlInclude:[...i.videoAndBangumiUrls],commitHash:"4b3a1a387095ef7eaca46616c451a366366a9869",coreVersion:"2.10.3"})})(),o=o.component})()));