!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["live/badge-keepalive"]=t():e["live/badge-keepalive"]=t()}(globalThis,(()=>(()=>{var e,t,n={553:(e,t,n)=>{var o=n(955)((function(e){return e[1]}));o.push([e.id,".container[data-v-5fb78579] {\n  display: flex;\n  flex-flow: column;\n  box-shadow: 0 0 0 1px #8884;\n  order: -2;\n  border-radius: 4px;\n  padding: 6px 6px 6px 10px;\n  display: flex;\n  align-items: stretch;\n  flex-direction: column;\n  gap: 6px;\n}\n.container .title[data-v-5fb78579] {\n  font-weight: 600;\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 r={};if(o)for(var i=0;i<this.length;i++){
// eslint-disable-next-line prefer-destructuring
var a=this[i][0];null!=a&&(r[a]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);o&&r[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},991:(e,t,n)=>{"use strict";var o,r=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},i=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<a.length;n++)if(a[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},o=[],r=0;r<e.length;r++){var i=e[r],c=t.base?i[0]+t.base:i[0],l=n[c]||0,d="".concat(c," ").concat(l);n[c]=l+1;var u=s(d),f={css:i[1],media:i[2],sourceMap:i[3]};-1!==u?(a[u].references++,a[u].updater(f)):a.push({identifier:d,updater:m(f,t),references:1}),o.push(d)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var r=n.nc;r&&(o.nonce=r)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var a=i(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function f(e,t,n,o){var r=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,r);else{var i=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function p(e,t,n){var o=n.css,r=n.media,i=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var v=null,h=0;function m(e,t){var n,o,r;if(t.singleton){var i=h++;n=v||(v=l(t)),o=f.bind(null,n,i,!1),r=f.bind(null,n,i,!0)}else n=l(t),o=p.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var r=s(n[o]);a[r].references--}for(var i=c(e,t),l=0;l<n.length;l++){var d=s(n[l]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}n=i}}}},405:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var o=function(){var e=this,t=e._self._c,n=e._self._setupProxy;return t("div",{staticClass:"container"},[t("p",{staticClass:"title"},[e._v("一键点亮粉丝勋章")]),e._v(" "),t(n.TextBox,{attrs:{placeholder:"直播间ID",text:n.roomid,changeOnBlur:!0},on:{change:n.handleRoomIdChange}}),e._v(" "),t(n.AsyncButton,{on:{click:n.handleKeepAliveRequest}},[e._v("点亮!")])],1)};o._withStripped=!0;const r=globalThis.Vue,i=coreApis.ui,a=coreApis.ajax;var s=n(847);function c(e){if(0!==e.code)throw new Error(e.message);return e.data}async function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"300";const n=await async function(e){return c(await(0,a.getJsonWithCredentials)(`https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByUser?room_id=${e}`))}(e),{curr_weared:o}=n.medal;if(!o)throw new Error(`暂未获得直播间 ${e} 的粉丝勋章`);const r={click_time:t,room_id:e,anchor_id:o.target_id,uid:(0,s.getUID)(),csrf:(0,s.getCsrf)()};return c(JSON.parse(await(0,a.postTextWithCredentials)("https://api.live.bilibili.com/xlive/app-ucenter/v1/like_info_v3/like/likeReportV3",new URLSearchParams(r))))}const d=coreApis.toast,u=(0,r.defineComponent)({__name:"BadgeKeepalive",setup(e){const t=(0,r.ref)(function(){let e=location.href.match(/live.bilibili.com\/(\d+)/);return e?e[1]:(e=location.href.match(/live.bilibili.com\/blanc\/(\d+)/),e?e[1]:"")}());return{__sfc:!0,roomid:t,handleRoomIdChange:e=>{!function(e){return/^\d+$/.test(e)}(e)?t.value="":t.value=e},handleKeepAliveRequest:async()=>{if(t.value)try{await l(t.value),d.Toast.success("发送点亮勋章请求成功","提示")}catch({message:e}){d.Toast.error(`勋章点亮失败，原因: ${e}`,"提示")}},TextBox:i.TextBox,AsyncButton:i.AsyncButton}}});var f=n(991),p=n.n(f),v=n(553),h=n.n(v),m={insert:"head",singleton:!1};p()(h(),m);h().locals;var b=function(e,t,n,o,r,i,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),i&&(l._scopeId="data-v-"+i),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__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):r&&(c=s?function(){r.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:r),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}}(u,o,[],!1,null,"5fb78579",null);const g=b.exports},637:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=637,e.exports=t},786:e=>{"use strict";e.exports="在直播间页面的功能面板添加一键点亮粉丝勋章功能，仅适用于有粉丝勋章且正在直播的直播间。原理：发送一个 300 次点赞的请求点亮粉丝勋章。"},847:e=>{"use strict";e.exports=coreApis.utils}},o={};function r(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={id:e,exports:{}};return n[e](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var i=Object.create(null);r.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&o&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,r.d(i,a),i},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nc=void 0;var i={};return(()=>{"use strict";r.d(i,{component:()=>o});const e=coreApis.componentApis.define;var t=r(847);const n=coreApis.utils.urls,o=(0,e.defineComponentMetadata)({name:"badgeKeepalive",displayName:"一键点亮直播间粉丝勋章",entry:none,reload:none,unload:none,author:{name:"magicFeirl",link:"https://github.com/magicFeirl"},tags:[componentsTags.live],widget:{component:()=>Promise.resolve().then(r.bind(r,405)).then((e=>e.default)),condition:()=>Boolean((0,t.getUID)())},urlInclude:n.liveUrls,commitHash:"f8d9b5665fc198fe5b2eb39c57dab6d686e5ed74",coreVersion:"2.10.4",description:(()=>{const e=r(637);return{...Object.fromEntries(e.keys().map((t=>[t.match(/index\.(.+)\.md$/)[1],e(t)]))),"zh-CN":()=>Promise.resolve().then(r.t.bind(r,786,17)).then((e=>e.default))}})()})})(),i=i.component})()));