// ==UserScript== // @name Bilibili 旧播放页 // @namespace MotooriKashin // @version 10.1.4-855f3686b22c5c493d7df808d348e7e511658617 // @description 恢复Bilibili旧版页面,为了那些念旧的人。 // @author MotooriKashin, wly5556 // @homepage https://github.com/MotooriKashin/Bilibili-Old // @supportURL https://github.com/MotooriKashin/Bilibili-Old/issues // @icon https://www.bilibili.com/favicon.ico // @match *://*.bilibili.com/* // @connect * // @grant GM.xmlHttpRequest // @grant GM.getValue // @grant GM.setValue // @grant GM.deleteValue // @grant GM.cookie // @run-at document-start // @license MIT // @downloadURL none // ==/UserScript== const MODULES = ` var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __commonJS = (cb, mod2) => function __require() { return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target, mod2 )); var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; // node_modules/crypt/crypt.js var require_crypt = __commonJS({ "node_modules/crypt/crypt.js"(exports2, module2) { (function() { var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", crypt = { // Bit-wise rotation left rotl: function(n, b) { return n << b | n >>> 32 - b; }, // Bit-wise rotation right rotr: function(n, b) { return n << 32 - b | n >>> b; }, // Swap big-endian to little-endian and vice versa endian: function(n) { if (n.constructor == Number) { return crypt.rotl(n, 8) & 16711935 | crypt.rotl(n, 24) & 4278255360; } for (var i = 0; i < n.length; i++) n[i] = crypt.endian(n[i]); return n; }, // Generate an array of any length of random bytes randomBytes: function(n) { for (var bytes = []; n > 0; n--) bytes.push(Math.floor(Math.random() * 256)); return bytes; }, // Convert a byte array to big-endian 32-bit words bytesToWords: function(bytes) { for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) words[b >>> 5] |= bytes[i] << 24 - b % 32; return words; }, // Convert big-endian 32-bit words to a byte array wordsToBytes: function(words) { for (var bytes = [], b = 0; b < words.length * 32; b += 8) bytes.push(words[b >>> 5] >>> 24 - b % 32 & 255); return bytes; }, // Convert a byte array to a hex string bytesToHex: function(bytes) { for (var hex = [], i = 0; i < bytes.length; i++) { hex.push((bytes[i] >>> 4).toString(16)); hex.push((bytes[i] & 15).toString(16)); } return hex.join(""); }, // Convert a hex string to a byte array hexToBytes: function(hex) { for (var bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }, // Convert a byte array to a base-64 string bytesToBase64: function(bytes) { for (var base64 = [], i = 0; i < bytes.length; i += 3) { var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; for (var j = 0; j < 4; j++) if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt(triplet >>> 6 * (3 - j) & 63)); else base64.push("="); } return base64.join(""); }, // Convert a base-64 string to a byte array base64ToBytes: function(base64) { base64 = base64.replace(/[^A-Z0-9+\\/]/ig, ""); for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) { if (imod4 == 0) continue; bytes.push((base64map.indexOf(base64.charAt(i - 1)) & Math.pow(2, -2 * imod4 + 8) - 1) << imod4 * 2 | base64map.indexOf(base64.charAt(i)) >>> 6 - imod4 * 2); } return bytes; } }; module2.exports = crypt; })(); } }); // node_modules/charenc/charenc.js var require_charenc = __commonJS({ "node_modules/charenc/charenc.js"(exports2, module2) { var charenc = { // UTF-8 encoding utf8: { // Convert a string to a byte array stringToBytes: function(str) { return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); }, // Convert a byte array to a string bytesToString: function(bytes) { return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); } }, // Binary encoding bin: { // Convert a string to a byte array stringToBytes: function(str) { for (var bytes = [], i = 0; i < str.length; i++) bytes.push(str.charCodeAt(i) & 255); return bytes; }, // Convert a byte array to a string bytesToString: function(bytes) { for (var str = [], i = 0; i < bytes.length; i++) str.push(String.fromCharCode(bytes[i])); return str.join(""); } } }; module2.exports = charenc; } }); // node_modules/is-buffer/index.js var require_is_buffer = __commonJS({ "node_modules/is-buffer/index.js"(exports2, module2) { module2.exports = function(obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer); }; function isBuffer(obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); } function isSlowBuffer(obj) { return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer(obj.slice(0, 0)); } } }); // node_modules/md5/md5.js var require_md5 = __commonJS({ "node_modules/md5/md5.js"(exports2, module2) { (function() { var crypt = require_crypt(), utf8 = require_charenc().utf8, isBuffer = require_is_buffer(), bin = require_charenc().bin, md52 = function(message, options) { if (message.constructor == String) if (options && options.encoding === "binary") message = bin.stringToBytes(message); else message = utf8.stringToBytes(message); else if (isBuffer(message)) message = Array.prototype.slice.call(message, 0); else if (!Array.isArray(message) && message.constructor !== Uint8Array) message = message.toString(); var m = crypt.bytesToWords(message), l = message.length * 8, a = 1732584193, b = -271733879, c = -1732584194, d = 271733878; for (var i = 0; i < m.length; i++) { m[i] = (m[i] << 8 | m[i] >>> 24) & 16711935 | (m[i] << 24 | m[i] >>> 8) & 4278255360; } m[l >>> 5] |= 128 << l % 32; m[(l + 64 >>> 9 << 4) + 14] = l; var FF = md52._ff, GG = md52._gg, HH = md52._hh, II = md52._ii; for (var i = 0; i < m.length; i += 16) { var aa = a, bb = b, cc = c, dd = d; a = FF(a, b, c, d, m[i + 0], 7, -680876936); d = FF(d, a, b, c, m[i + 1], 12, -389564586); c = FF(c, d, a, b, m[i + 2], 17, 606105819); b = FF(b, c, d, a, m[i + 3], 22, -1044525330); a = FF(a, b, c, d, m[i + 4], 7, -176418897); d = FF(d, a, b, c, m[i + 5], 12, 1200080426); c = FF(c, d, a, b, m[i + 6], 17, -1473231341); b = FF(b, c, d, a, m[i + 7], 22, -45705983); a = FF(a, b, c, d, m[i + 8], 7, 1770035416); d = FF(d, a, b, c, m[i + 9], 12, -1958414417); c = FF(c, d, a, b, m[i + 10], 17, -42063); b = FF(b, c, d, a, m[i + 11], 22, -1990404162); a = FF(a, b, c, d, m[i + 12], 7, 1804603682); d = FF(d, a, b, c, m[i + 13], 12, -40341101); c = FF(c, d, a, b, m[i + 14], 17, -1502002290); b = FF(b, c, d, a, m[i + 15], 22, 1236535329); a = GG(a, b, c, d, m[i + 1], 5, -165796510); d = GG(d, a, b, c, m[i + 6], 9, -1069501632); c = GG(c, d, a, b, m[i + 11], 14, 643717713); b = GG(b, c, d, a, m[i + 0], 20, -373897302); a = GG(a, b, c, d, m[i + 5], 5, -701558691); d = GG(d, a, b, c, m[i + 10], 9, 38016083); c = GG(c, d, a, b, m[i + 15], 14, -660478335); b = GG(b, c, d, a, m[i + 4], 20, -405537848); a = GG(a, b, c, d, m[i + 9], 5, 568446438); d = GG(d, a, b, c, m[i + 14], 9, -1019803690); c = GG(c, d, a, b, m[i + 3], 14, -187363961); b = GG(b, c, d, a, m[i + 8], 20, 1163531501); a = GG(a, b, c, d, m[i + 13], 5, -1444681467); d = GG(d, a, b, c, m[i + 2], 9, -51403784); c = GG(c, d, a, b, m[i + 7], 14, 1735328473); b = GG(b, c, d, a, m[i + 12], 20, -1926607734); a = HH(a, b, c, d, m[i + 5], 4, -378558); d = HH(d, a, b, c, m[i + 8], 11, -2022574463); c = HH(c, d, a, b, m[i + 11], 16, 1839030562); b = HH(b, c, d, a, m[i + 14], 23, -35309556); a = HH(a, b, c, d, m[i + 1], 4, -1530992060); d = HH(d, a, b, c, m[i + 4], 11, 1272893353); c = HH(c, d, a, b, m[i + 7], 16, -155497632); b = HH(b, c, d, a, m[i + 10], 23, -1094730640); a = HH(a, b, c, d, m[i + 13], 4, 681279174); d = HH(d, a, b, c, m[i + 0], 11, -358537222); c = HH(c, d, a, b, m[i + 3], 16, -722521979); b = HH(b, c, d, a, m[i + 6], 23, 76029189); a = HH(a, b, c, d, m[i + 9], 4, -640364487); d = HH(d, a, b, c, m[i + 12], 11, -421815835); c = HH(c, d, a, b, m[i + 15], 16, 530742520); b = HH(b, c, d, a, m[i + 2], 23, -995338651); a = II(a, b, c, d, m[i + 0], 6, -198630844); d = II(d, a, b, c, m[i + 7], 10, 1126891415); c = II(c, d, a, b, m[i + 14], 15, -1416354905); b = II(b, c, d, a, m[i + 5], 21, -57434055); a = II(a, b, c, d, m[i + 12], 6, 1700485571); d = II(d, a, b, c, m[i + 3], 10, -1894986606); c = II(c, d, a, b, m[i + 10], 15, -1051523); b = II(b, c, d, a, m[i + 1], 21, -2054922799); a = II(a, b, c, d, m[i + 8], 6, 1873313359); d = II(d, a, b, c, m[i + 15], 10, -30611744); c = II(c, d, a, b, m[i + 6], 15, -1560198380); b = II(b, c, d, a, m[i + 13], 21, 1309151649); a = II(a, b, c, d, m[i + 4], 6, -145523070); d = II(d, a, b, c, m[i + 11], 10, -1120210379); c = II(c, d, a, b, m[i + 2], 15, 718787259); b = II(b, c, d, a, m[i + 9], 21, -343485551); a = a + aa >>> 0; b = b + bb >>> 0; c = c + cc >>> 0; d = d + dd >>> 0; } return crypt.endian([a, b, c, d]); }; md52._ff = function(a, b, c, d, x, s, t) { var n = a + (b & c | ~b & d) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._gg = function(a, b, c, d, x, s, t) { var n = a + (b & d | c & ~d) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._hh = function(a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._ii = function(a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._blocksize = 16; md52._digestsize = 16; module2.exports = function(message, options) { if (message === void 0 || message === null) throw new Error("Illegal argument " + message); var digestbytes = crypt.wordsToBytes(md52(message, options)); return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt.bytesToHex(digestbytes); }; })(); } }); // node_modules/@protobufjs/aspromise/index.js var require_aspromise = __commonJS({ "node_modules/@protobufjs/aspromise/index.js"(exports2, module2) { "use strict"; module2.exports = asPromise; function asPromise(fn, ctx) { var params = new Array(arguments.length - 1), offset2 = 0, index = 2, pending = true; while (index < arguments.length) params[offset2++] = arguments[index++]; return new Promise(function executor(resolve, reject) { params[offset2] = function callback(err) { if (pending) { pending = false; if (err) reject(err); else { var params2 = new Array(arguments.length - 1), offset3 = 0; while (offset3 < params2.length) params2[offset3++] = arguments[offset3]; resolve.apply(null, params2); } } }; try { fn.apply(ctx || null, params); } catch (err) { if (pending) { pending = false; reject(err); } } }); } } }); // node_modules/@protobufjs/base64/index.js var require_base64 = __commonJS({ "node_modules/@protobufjs/base64/index.js"(exports2) { "use strict"; var base64 = exports2; base64.length = function length(string) { var p = string.length; if (!p) return 0; var n = 0; while (--p % 4 > 1 && string.charAt(p) === "=") ++n; return Math.ceil(string.length * 3) / 4 - n; }; var b64 = new Array(64); var s64 = new Array(123); for (i = 0; i < 64; ) s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; var i; base64.encode = function encode(buffer, start, end) { var parts = null, chunk = []; var i2 = 0, j = 0, t; while (start < end) { var b = buffer[start++]; switch (j) { case 0: chunk[i2++] = b64[b >> 2]; t = (b & 3) << 4; j = 1; break; case 1: chunk[i2++] = b64[t | b >> 4]; t = (b & 15) << 2; j = 2; break; case 2: chunk[i2++] = b64[t | b >> 6]; chunk[i2++] = b64[b & 63]; j = 0; break; } if (i2 > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i2 = 0; } } if (j) { chunk[i2++] = b64[t]; chunk[i2++] = 61; if (j === 1) chunk[i2++] = 61; } if (parts) { if (i2) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i2))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i2)); }; var invalidEncoding = "invalid encoding"; base64.decode = function decode(string, buffer, offset2) { var start = offset2; var j = 0, t; for (var i2 = 0; i2 < string.length; ) { var c = string.charCodeAt(i2++); if (c === 61 && j > 1) break; if ((c = s64[c]) === void 0) throw Error(invalidEncoding); switch (j) { case 0: t = c; j = 1; break; case 1: buffer[offset2++] = t << 2 | (c & 48) >> 4; t = c; j = 2; break; case 2: buffer[offset2++] = (t & 15) << 4 | (c & 60) >> 2; t = c; j = 3; break; case 3: buffer[offset2++] = (t & 3) << 6 | c; j = 0; break; } } if (j === 1) throw Error(invalidEncoding); return offset2 - start; }; base64.test = function test(string) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\$/.test(string); }; } }); // node_modules/@protobufjs/eventemitter/index.js var require_eventemitter = __commonJS({ "node_modules/@protobufjs/eventemitter/index.js"(exports2, module2) { "use strict"; module2.exports = EventEmitter; function EventEmitter() { this._listeners = {}; } EventEmitter.prototype.on = function on(evt, fn, ctx) { (this._listeners[evt] || (this._listeners[evt] = [])).push({ fn, ctx: ctx || this }); return this; }; EventEmitter.prototype.off = function off(evt, fn) { if (evt === void 0) this._listeners = {}; else { if (fn === void 0) this._listeners[evt] = []; else { var listeners = this._listeners[evt]; for (var i = 0; i < listeners.length; ) if (listeners[i].fn === fn) listeners.splice(i, 1); else ++i; } } return this; }; EventEmitter.prototype.emit = function emit(evt) { var listeners = this._listeners[evt]; if (listeners) { var args = [], i = 1; for (; i < arguments.length; ) args.push(arguments[i++]); for (i = 0; i < listeners.length; ) listeners[i].fn.apply(listeners[i++].ctx, args); } return this; }; } }); // node_modules/@protobufjs/float/index.js var require_float = __commonJS({ "node_modules/@protobufjs/float/index.js"(exports2, module2) { "use strict"; module2.exports = factory(factory); function factory(exports3) { if (typeof Float32Array !== "undefined") (function() { var f32 = new Float32Array([-0]), f8b = new Uint8Array(f32.buffer), le = f8b[3] === 128; function writeFloat_f32_cpy(val, buf, pos) { f32[0] = val; buf[pos] = f8b[0]; buf[pos + 1] = f8b[1]; buf[pos + 2] = f8b[2]; buf[pos + 3] = f8b[3]; } function writeFloat_f32_rev(val, buf, pos) { f32[0] = val; buf[pos] = f8b[3]; buf[pos + 1] = f8b[2]; buf[pos + 2] = f8b[1]; buf[pos + 3] = f8b[0]; } exports3.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; exports3.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; function readFloat_f32_cpy(buf, pos) { f8b[0] = buf[pos]; f8b[1] = buf[pos + 1]; f8b[2] = buf[pos + 2]; f8b[3] = buf[pos + 3]; return f32[0]; } function readFloat_f32_rev(buf, pos) { f8b[3] = buf[pos]; f8b[2] = buf[pos + 1]; f8b[1] = buf[pos + 2]; f8b[0] = buf[pos + 3]; return f32[0]; } exports3.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; exports3.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; })(); else (function() { function writeFloat_ieee754(writeUint, val, buf, pos) { var sign = val < 0 ? 1 : 0; if (sign) val = -val; if (val === 0) writeUint(1 / val > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), buf, pos); else if (isNaN(val)) writeUint(2143289344, buf, pos); else if (val > 34028234663852886e22) writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); else if (val < 11754943508222875e-54) writeUint((sign << 31 | Math.round(val / 1401298464324817e-60)) >>> 0, buf, pos); else { var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); } } exports3.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); exports3.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); function readFloat_ieee754(readUint, buf, pos) { var uint = readUint(buf, pos), sign = (uint >> 31) * 2 + 1, exponent = uint >>> 23 & 255, mantissa = uint & 8388607; return exponent === 255 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 1401298464324817e-60 * mantissa : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); } exports3.readFloatLE = readFloat_ieee754.bind(null, readUintLE); exports3.readFloatBE = readFloat_ieee754.bind(null, readUintBE); })(); if (typeof Float64Array !== "undefined") (function() { var f64 = new Float64Array([-0]), f8b = new Uint8Array(f64.buffer), le = f8b[7] === 128; function writeDouble_f64_cpy(val, buf, pos) { f64[0] = val; buf[pos] = f8b[0]; buf[pos + 1] = f8b[1]; buf[pos + 2] = f8b[2]; buf[pos + 3] = f8b[3]; buf[pos + 4] = f8b[4]; buf[pos + 5] = f8b[5]; buf[pos + 6] = f8b[6]; buf[pos + 7] = f8b[7]; } function writeDouble_f64_rev(val, buf, pos) { f64[0] = val; buf[pos] = f8b[7]; buf[pos + 1] = f8b[6]; buf[pos + 2] = f8b[5]; buf[pos + 3] = f8b[4]; buf[pos + 4] = f8b[3]; buf[pos + 5] = f8b[2]; buf[pos + 6] = f8b[1]; buf[pos + 7] = f8b[0]; } exports3.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; exports3.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; function readDouble_f64_cpy(buf, pos) { f8b[0] = buf[pos]; f8b[1] = buf[pos + 1]; f8b[2] = buf[pos + 2]; f8b[3] = buf[pos + 3]; f8b[4] = buf[pos + 4]; f8b[5] = buf[pos + 5]; f8b[6] = buf[pos + 6]; f8b[7] = buf[pos + 7]; return f64[0]; } function readDouble_f64_rev(buf, pos) { f8b[7] = buf[pos]; f8b[6] = buf[pos + 1]; f8b[5] = buf[pos + 2]; f8b[4] = buf[pos + 3]; f8b[3] = buf[pos + 4]; f8b[2] = buf[pos + 5]; f8b[1] = buf[pos + 6]; f8b[0] = buf[pos + 7]; return f64[0]; } exports3.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; exports3.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; })(); else (function() { function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { var sign = val < 0 ? 1 : 0; if (sign) val = -val; if (val === 0) { writeUint(0, buf, pos + off0); writeUint(1 / val > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), buf, pos + off1); } else if (isNaN(val)) { writeUint(0, buf, pos + off0); writeUint(2146959360, buf, pos + off1); } else if (val > 17976931348623157e292) { writeUint(0, buf, pos + off0); writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); } else { var mantissa; if (val < 22250738585072014e-324) { mantissa = val / 5e-324; writeUint(mantissa >>> 0, buf, pos + off0); writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); } else { var exponent = Math.floor(Math.log(val) / Math.LN2); if (exponent === 1024) exponent = 1023; mantissa = val * Math.pow(2, -exponent); writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); } } } exports3.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); exports3.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); function readDouble_ieee754(readUint, off0, off1, buf, pos) { var lo = readUint(buf, pos + off0), hi = readUint(buf, pos + off1); var sign = (hi >> 31) * 2 + 1, exponent = hi >>> 20 & 2047, mantissa = 4294967296 * (hi & 1048575) + lo; return exponent === 2047 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 5e-324 * mantissa : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); } exports3.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); exports3.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); })(); return exports3; } function writeUintLE(val, buf, pos) { buf[pos] = val & 255; buf[pos + 1] = val >>> 8 & 255; buf[pos + 2] = val >>> 16 & 255; buf[pos + 3] = val >>> 24; } function writeUintBE(val, buf, pos) { buf[pos] = val >>> 24; buf[pos + 1] = val >>> 16 & 255; buf[pos + 2] = val >>> 8 & 255; buf[pos + 3] = val & 255; } function readUintLE(buf, pos) { return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; } function readUintBE(buf, pos) { return (buf[pos] << 24 | buf[pos + 1] << 16 | buf[pos + 2] << 8 | buf[pos + 3]) >>> 0; } } }); // node_modules/@protobufjs/inquire/index.js var require_inquire = __commonJS({ "node_modules/@protobufjs/inquire/index.js"(exports, module) { "use strict"; module.exports = inquire; function inquire(moduleName) { try { var mod = eval("quire".replace(/^/, "re"))(moduleName); if (mod && (mod.length || Object.keys(mod).length)) return mod; } catch (e) { } return null; } } }); // node_modules/@protobufjs/utf8/index.js var require_utf8 = __commonJS({ "node_modules/@protobufjs/utf8/index.js"(exports2) { "use strict"; var utf8 = exports2; utf8.length = function utf8_length(string) { var len = 0, c = 0; for (var i = 0; i < string.length; ++i) { c = string.charCodeAt(i); if (c < 128) len += 1; else if (c < 2048) len += 2; else if ((c & 64512) === 55296 && (string.charCodeAt(i + 1) & 64512) === 56320) { ++i; len += 4; } else len += 3; } return len; }; utf8.read = function utf8_read(buffer, start, end) { var len = end - start; if (len < 1) return ""; var parts = null, chunk = [], i = 0, t; while (start < end) { t = buffer[start++]; if (t < 128) chunk[i++] = t; else if (t > 191 && t < 224) chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; else if (t > 239 && t < 365) { t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 65536; chunk[i++] = 55296 + (t >> 10); chunk[i++] = 56320 + (t & 1023); } else chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; if (i > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i = 0; } } if (parts) { if (i) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i)); }; utf8.write = function utf8_write(string, buffer, offset2) { var start = offset2, c1, c2; for (var i = 0; i < string.length; ++i) { c1 = string.charCodeAt(i); if (c1 < 128) { buffer[offset2++] = c1; } else if (c1 < 2048) { buffer[offset2++] = c1 >> 6 | 192; buffer[offset2++] = c1 & 63 | 128; } else if ((c1 & 64512) === 55296 && ((c2 = string.charCodeAt(i + 1)) & 64512) === 56320) { c1 = 65536 + ((c1 & 1023) << 10) + (c2 & 1023); ++i; buffer[offset2++] = c1 >> 18 | 240; buffer[offset2++] = c1 >> 12 & 63 | 128; buffer[offset2++] = c1 >> 6 & 63 | 128; buffer[offset2++] = c1 & 63 | 128; } else { buffer[offset2++] = c1 >> 12 | 224; buffer[offset2++] = c1 >> 6 & 63 | 128; buffer[offset2++] = c1 & 63 | 128; } } return offset2 - start; }; } }); // node_modules/@protobufjs/pool/index.js var require_pool = __commonJS({ "node_modules/@protobufjs/pool/index.js"(exports2, module2) { "use strict"; module2.exports = pool; function pool(alloc, slice, size) { var SIZE = size || 8192; var MAX = SIZE >>> 1; var slab = null; var offset2 = SIZE; return function pool_alloc(size2) { if (size2 < 1 || size2 > MAX) return alloc(size2); if (offset2 + size2 > SIZE) { slab = alloc(SIZE); offset2 = 0; } var buf = slice.call(slab, offset2, offset2 += size2); if (offset2 & 7) offset2 = (offset2 | 7) + 1; return buf; }; } } }); // node_modules/protobufjs/src/util/longbits.js var require_longbits = __commonJS({ "node_modules/protobufjs/src/util/longbits.js"(exports2, module2) { "use strict"; module2.exports = LongBits; var util = require_minimal(); function LongBits(lo, hi) { this.lo = lo >>> 0; this.hi = hi >>> 0; } var zero = LongBits.zero = new LongBits(0, 0); zero.toNumber = function() { return 0; }; zero.zzEncode = zero.zzDecode = function() { return this; }; zero.length = function() { return 1; }; var zeroHash = LongBits.zeroHash = "\\0\\0\\0\\0\\0\\0\\0\\0"; LongBits.fromNumber = function fromNumber(value) { if (value === 0) return zero; var sign = value < 0; if (sign) value = -value; var lo = value >>> 0, hi = (value - lo) / 4294967296 >>> 0; if (sign) { hi = ~hi >>> 0; lo = ~lo >>> 0; if (++lo > 4294967295) { lo = 0; if (++hi > 4294967295) hi = 0; } } return new LongBits(lo, hi); }; LongBits.from = function from(value) { if (typeof value === "number") return LongBits.fromNumber(value); if (util.isString(value)) { if (util.Long) value = util.Long.fromString(value); else return LongBits.fromNumber(parseInt(value, 10)); } return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; }; LongBits.prototype.toNumber = function toNumber(unsigned) { if (!unsigned && this.hi >>> 31) { var lo = ~this.lo + 1 >>> 0, hi = ~this.hi >>> 0; if (!lo) hi = hi + 1 >>> 0; return -(lo + hi * 4294967296); } return this.lo + this.hi * 4294967296; }; LongBits.prototype.toLong = function toLong(unsigned) { return util.Long ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; }; var charCodeAt = String.prototype.charCodeAt; LongBits.fromHash = function fromHash(hash) { if (hash === zeroHash) return zero; return new LongBits( (charCodeAt.call(hash, 0) | charCodeAt.call(hash, 1) << 8 | charCodeAt.call(hash, 2) << 16 | charCodeAt.call(hash, 3) << 24) >>> 0, (charCodeAt.call(hash, 4) | charCodeAt.call(hash, 5) << 8 | charCodeAt.call(hash, 6) << 16 | charCodeAt.call(hash, 7) << 24) >>> 0 ); }; LongBits.prototype.toHash = function toHash() { return String.fromCharCode( this.lo & 255, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, this.hi & 255, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24 ); }; LongBits.prototype.zzEncode = function zzEncode() { var mask = this.hi >> 31; this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; this.lo = (this.lo << 1 ^ mask) >>> 0; return this; }; LongBits.prototype.zzDecode = function zzDecode() { var mask = -(this.lo & 1); this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; this.hi = (this.hi >>> 1 ^ mask) >>> 0; return this; }; LongBits.prototype.length = function length() { var part0 = this.lo, part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, part2 = this.hi >>> 24; return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10; }; } }); // node_modules/protobufjs/src/util/minimal.js var require_minimal = __commonJS({ "node_modules/protobufjs/src/util/minimal.js"(exports2) { "use strict"; var util = exports2; util.asPromise = require_aspromise(); util.base64 = require_base64(); util.EventEmitter = require_eventemitter(); util.float = require_float(); util.inquire = require_inquire(); util.utf8 = require_utf8(); util.pool = require_pool(); util.LongBits = require_longbits(); util.isNode = Boolean(typeof global !== "undefined" && global && global.process && global.process.versions && global.process.versions.node); util.global = util.isNode && global || typeof window !== "undefined" && window || typeof self !== "undefined" && self || exports2; util.emptyArray = Object.freeze ? Object.freeze([]) : ( /* istanbul ignore next */ [] ); util.emptyObject = Object.freeze ? Object.freeze({}) : ( /* istanbul ignore next */ {} ); util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; }; util.isString = function isString(value) { return typeof value === "string" || value instanceof String; }; util.isObject = function isObject2(value) { return value && typeof value === "object"; }; util.isset = /** * Checks if a property on a message is considered to be present. * @param {Object} obj Plain object or message instance * @param {string} prop Property name * @returns {boolean} \`true\` if considered to be present, otherwise \`false\` */ util.isSet = function isSet(obj, prop) { var value = obj[prop]; if (value != null && obj.hasOwnProperty(prop)) return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; return false; }; util.Buffer = function() { try { var Buffer2 = util.inquire("buffer").Buffer; return Buffer2.prototype.utf8Write ? Buffer2 : ( /* istanbul ignore next */ null ); } catch (e) { return null; } }(); util._Buffer_from = null; util._Buffer_allocUnsafe = null; util.newBuffer = function newBuffer(sizeOrArray) { return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray); }; util.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array; util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long || /* istanbul ignore next */ util.global.Long || util.inquire("long"); util.key2Re = /^true|false|0|1\$/; util.key32Re = /^-?(?:0|[1-9][0-9]*)\$/; util.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))\$/; util.longToHash = function longToHash(value) { return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash; }; util.longFromHash = function longFromHash(hash, unsigned) { var bits = util.LongBits.fromHash(hash); if (util.Long) return util.Long.fromBits(bits.lo, bits.hi, unsigned); return bits.toNumber(Boolean(unsigned)); }; function merge(dst, src, ifNotSet) { for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) if (dst[keys[i]] === void 0 || !ifNotSet) dst[keys[i]] = src[keys[i]]; return dst; } util.merge = merge; util.lcFirst = function lcFirst(str) { return str.charAt(0).toLowerCase() + str.substring(1); }; function newError(name) { function CustomError(message, properties) { if (!(this instanceof CustomError)) return new CustomError(message, properties); Object.defineProperty(this, "message", { get: function() { return message; } }); if (Error.captureStackTrace) Error.captureStackTrace(this, CustomError); else Object.defineProperty(this, "stack", { value: new Error().stack || "" }); if (properties) merge(this, properties); } CustomError.prototype = Object.create(Error.prototype, { constructor: { value: CustomError, writable: true, enumerable: false, configurable: true }, name: { get() { return name; }, set: void 0, enumerable: false, // configurable: false would accurately preserve the behavior of // the original, but I'm guessing that was not intentional. // For an actual error subclass, this property would // be configurable. configurable: true }, toString: { value() { return this.name + ": " + this.message; }, writable: true, enumerable: false, configurable: true } }); return CustomError; } util.newError = newError; util.ProtocolError = newError("ProtocolError"); util.oneOfGetter = function getOneOf(fieldNames) { var fieldMap = {}; for (var i = 0; i < fieldNames.length; ++i) fieldMap[fieldNames[i]] = 1; return function() { for (var keys = Object.keys(this), i2 = keys.length - 1; i2 > -1; --i2) if (fieldMap[keys[i2]] === 1 && this[keys[i2]] !== void 0 && this[keys[i2]] !== null) return keys[i2]; }; }; util.oneOfSetter = function setOneOf(fieldNames) { return function(name) { for (var i = 0; i < fieldNames.length; ++i) if (fieldNames[i] !== name) delete this[fieldNames[i]]; }; }; util.toJSONOptions = { longs: String, enums: String, bytes: String, json: true }; util._configure = function() { var Buffer2 = util.Buffer; if (!Buffer2) { util._Buffer_from = util._Buffer_allocUnsafe = null; return; } util._Buffer_from = Buffer2.from !== Uint8Array.from && Buffer2.from || /* istanbul ignore next */ function Buffer_from(value, encoding) { return new Buffer2(value, encoding); }; util._Buffer_allocUnsafe = Buffer2.allocUnsafe || /* istanbul ignore next */ function Buffer_allocUnsafe(size) { return new Buffer2(size); }; }; } }); // node_modules/protobufjs/src/writer.js var require_writer = __commonJS({ "node_modules/protobufjs/src/writer.js"(exports2, module2) { "use strict"; module2.exports = Writer; var util = require_minimal(); var BufferWriter; var LongBits = util.LongBits; var base64 = util.base64; var utf8 = util.utf8; function Op(fn, len, val) { this.fn = fn; this.len = len; this.next = void 0; this.val = val; } function noop() { } function State(writer) { this.head = writer.head; this.tail = writer.tail; this.len = writer.len; this.next = writer.states; } function Writer() { this.len = 0; this.head = new Op(noop, 0, 0); this.tail = this.head; this.states = null; } var create = function create2() { return util.Buffer ? function create_buffer_setup() { return (Writer.create = function create_buffer() { return new BufferWriter(); })(); } : function create_array() { return new Writer(); }; }; Writer.create = create(); Writer.alloc = function alloc(size) { return new util.Array(size); }; if (util.Array !== Array) Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); Writer.prototype._push = function push(fn, len, val) { this.tail = this.tail.next = new Op(fn, len, val); this.len += len; return this; }; function writeByte(val, buf, pos) { buf[pos] = val & 255; } function writeVarint32(val, buf, pos) { while (val > 127) { buf[pos++] = val & 127 | 128; val >>>= 7; } buf[pos] = val; } function VarintOp(len, val) { this.len = len; this.next = void 0; this.val = val; } VarintOp.prototype = Object.create(Op.prototype); VarintOp.prototype.fn = writeVarint32; Writer.prototype.uint32 = function write_uint32(value) { this.len += (this.tail = this.tail.next = new VarintOp( (value = value >>> 0) < 128 ? 1 : value < 16384 ? 2 : value < 2097152 ? 3 : value < 268435456 ? 4 : 5, value )).len; return this; }; Writer.prototype.int32 = function write_int32(value) { return value < 0 ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) : this.uint32(value); }; Writer.prototype.sint32 = function write_sint32(value) { return this.uint32((value << 1 ^ value >> 31) >>> 0); }; function writeVarint64(val, buf, pos) { while (val.hi) { buf[pos++] = val.lo & 127 | 128; val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; val.hi >>>= 7; } while (val.lo > 127) { buf[pos++] = val.lo & 127 | 128; val.lo = val.lo >>> 7; } buf[pos++] = val.lo; } Writer.prototype.uint64 = function write_uint64(value) { var bits = LongBits.from(value); return this._push(writeVarint64, bits.length(), bits); }; Writer.prototype.int64 = Writer.prototype.uint64; Writer.prototype.sint64 = function write_sint64(value) { var bits = LongBits.from(value).zzEncode(); return this._push(writeVarint64, bits.length(), bits); }; Writer.prototype.bool = function write_bool(value) { return this._push(writeByte, 1, value ? 1 : 0); }; function writeFixed32(val, buf, pos) { buf[pos] = val & 255; buf[pos + 1] = val >>> 8 & 255; buf[pos + 2] = val >>> 16 & 255; buf[pos + 3] = val >>> 24; } Writer.prototype.fixed32 = function write_fixed32(value) { return this._push(writeFixed32, 4, value >>> 0); }; Writer.prototype.sfixed32 = Writer.prototype.fixed32; Writer.prototype.fixed64 = function write_fixed64(value) { var bits = LongBits.from(value); return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); }; Writer.prototype.sfixed64 = Writer.prototype.fixed64; Writer.prototype.float = function write_float(value) { return this._push(util.float.writeFloatLE, 4, value); }; Writer.prototype.double = function write_double(value) { return this._push(util.float.writeDoubleLE, 8, value); }; var writeBytes = util.Array.prototype.set ? function writeBytes_set(val, buf, pos) { buf.set(val, pos); } : function writeBytes_for(val, buf, pos) { for (var i = 0; i < val.length; ++i) buf[pos + i] = val[i]; }; Writer.prototype.bytes = function write_bytes(value) { var len = value.length >>> 0; if (!len) return this._push(writeByte, 1, 0); if (util.isString(value)) { var buf = Writer.alloc(len = base64.length(value)); base64.decode(value, buf, 0); value = buf; } return this.uint32(len)._push(writeBytes, len, value); }; Writer.prototype.string = function write_string(value) { var len = utf8.length(value); return len ? this.uint32(len)._push(utf8.write, len, value) : this._push(writeByte, 1, 0); }; Writer.prototype.fork = function fork() { this.states = new State(this); this.head = this.tail = new Op(noop, 0, 0); this.len = 0; return this; }; Writer.prototype.reset = function reset() { if (this.states) { this.head = this.states.head; this.tail = this.states.tail; this.len = this.states.len; this.states = this.states.next; } else { this.head = this.tail = new Op(noop, 0, 0); this.len = 0; } return this; }; Writer.prototype.ldelim = function ldelim() { var head = this.head, tail = this.tail, len = this.len; this.reset().uint32(len); if (len) { this.tail.next = head.next; this.tail = tail; this.len += len; } return this; }; Writer.prototype.finish = function finish() { var head = this.head.next, buf = this.constructor.alloc(this.len), pos = 0; while (head) { head.fn(head.val, buf, pos); pos += head.len; head = head.next; } return buf; }; Writer._configure = function(BufferWriter_) { BufferWriter = BufferWriter_; Writer.create = create(); BufferWriter._configure(); }; } }); // node_modules/protobufjs/src/writer_buffer.js var require_writer_buffer = __commonJS({ "node_modules/protobufjs/src/writer_buffer.js"(exports2, module2) { "use strict"; module2.exports = BufferWriter; var Writer = require_writer(); (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; var util = require_minimal(); function BufferWriter() { Writer.call(this); } BufferWriter._configure = function() { BufferWriter.alloc = util._Buffer_allocUnsafe; BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" ? function writeBytesBuffer_set(val, buf, pos) { buf.set(val, pos); } : function writeBytesBuffer_copy(val, buf, pos) { if (val.copy) val.copy(buf, pos, 0, val.length); else for (var i = 0; i < val.length; ) buf[pos++] = val[i++]; }; }; BufferWriter.prototype.bytes = function write_bytes_buffer(value) { if (util.isString(value)) value = util._Buffer_from(value, "base64"); var len = value.length >>> 0; this.uint32(len); if (len) this._push(BufferWriter.writeBytesBuffer, len, value); return this; }; function writeStringBuffer(val, buf, pos) { if (val.length < 40) util.utf8.write(val, buf, pos); else if (buf.utf8Write) buf.utf8Write(val, pos); else buf.write(val, pos); } BufferWriter.prototype.string = function write_string_buffer(value) { var len = util.Buffer.byteLength(value); this.uint32(len); if (len) this._push(writeStringBuffer, len, value); return this; }; BufferWriter._configure(); } }); // node_modules/protobufjs/src/reader.js var require_reader = __commonJS({ "node_modules/protobufjs/src/reader.js"(exports2, module2) { "use strict"; module2.exports = Reader; var util = require_minimal(); var BufferReader; var LongBits = util.LongBits; var utf8 = util.utf8; function indexOutOfRange(reader, writeLength) { return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); } function Reader(buffer) { this.buf = buffer; this.pos = 0; this.len = buffer.length; } var create_array = typeof Uint8Array !== "undefined" ? function create_typed_array(buffer) { if (buffer instanceof Uint8Array || Array.isArray(buffer)) return new Reader(buffer); throw Error("illegal buffer"); } : function create_array2(buffer) { if (Array.isArray(buffer)) return new Reader(buffer); throw Error("illegal buffer"); }; var create = function create2() { return util.Buffer ? function create_buffer_setup(buffer) { return (Reader.create = function create_buffer(buffer2) { return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2); })(buffer); } : create_array; }; Reader.create = create(); Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; Reader.prototype.uint32 = function read_uint32_setup() { var value = 4294967295; return function read_uint32() { value = (this.buf[this.pos] & 127) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; if ((this.pos += 5) > this.len) { this.pos = this.len; throw indexOutOfRange(this, 10); } return value; }; }(); Reader.prototype.int32 = function read_int32() { return this.uint32() | 0; }; Reader.prototype.sint32 = function read_sint32() { var value = this.uint32(); return value >>> 1 ^ -(value & 1) | 0; }; function readLongVarint() { var bits = new LongBits(0, 0); var i = 0; if (this.len - this.pos > 4) { for (; i < 4; ++i) { bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; if (this.buf[this.pos++] < 128) return bits; i = 0; } else { for (; i < 3; ++i) { if (this.pos >= this.len) throw indexOutOfRange(this); bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; return bits; } if (this.len - this.pos > 4) { for (; i < 5; ++i) { bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } else { for (; i < 5; ++i) { if (this.pos >= this.len) throw indexOutOfRange(this); bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } throw Error("invalid varint encoding"); } Reader.prototype.bool = function read_bool() { return this.uint32() !== 0; }; function readFixed32_end(buf, end) { return (buf[end - 4] | buf[end - 3] << 8 | buf[end - 2] << 16 | buf[end - 1] << 24) >>> 0; } Reader.prototype.fixed32 = function read_fixed32() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4); }; Reader.prototype.sfixed32 = function read_sfixed32() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4) | 0; }; function readFixed64() { if (this.pos + 8 > this.len) throw indexOutOfRange(this, 8); return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); } Reader.prototype.float = function read_float() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); var value = util.float.readFloatLE(this.buf, this.pos); this.pos += 4; return value; }; Reader.prototype.double = function read_double() { if (this.pos + 8 > this.len) throw indexOutOfRange(this, 4); var value = util.float.readDoubleLE(this.buf, this.pos); this.pos += 8; return value; }; Reader.prototype.bytes = function read_bytes() { var length = this.uint32(), start = this.pos, end = this.pos + length; if (end > this.len) throw indexOutOfRange(this, length); this.pos += length; if (Array.isArray(this.buf)) return this.buf.slice(start, end); return start === end ? new this.buf.constructor(0) : this._slice.call(this.buf, start, end); }; Reader.prototype.string = function read_string() { var bytes = this.bytes(); return utf8.read(bytes, 0, bytes.length); }; Reader.prototype.skip = function skip(length) { if (typeof length === "number") { if (this.pos + length > this.len) throw indexOutOfRange(this, length); this.pos += length; } else { do { if (this.pos >= this.len) throw indexOutOfRange(this); } while (this.buf[this.pos++] & 128); } return this; }; Reader.prototype.skipType = function(wireType) { switch (wireType) { case 0: this.skip(); break; case 1: this.skip(8); break; case 2: this.skip(this.uint32()); break; case 3: while ((wireType = this.uint32() & 7) !== 4) { this.skipType(wireType); } break; case 5: this.skip(4); break; default: throw Error("invalid wire type " + wireType + " at offset " + this.pos); } return this; }; Reader._configure = function(BufferReader_) { BufferReader = BufferReader_; Reader.create = create(); BufferReader._configure(); var fn = util.Long ? "toLong" : ( /* istanbul ignore next */ "toNumber" ); util.merge(Reader.prototype, { int64: function read_int64() { return readLongVarint.call(this)[fn](false); }, uint64: function read_uint64() { return readLongVarint.call(this)[fn](true); }, sint64: function read_sint64() { return readLongVarint.call(this).zzDecode()[fn](false); }, fixed64: function read_fixed64() { return readFixed64.call(this)[fn](true); }, sfixed64: function read_sfixed64() { return readFixed64.call(this)[fn](false); } }); }; } }); // node_modules/protobufjs/src/reader_buffer.js var require_reader_buffer = __commonJS({ "node_modules/protobufjs/src/reader_buffer.js"(exports2, module2) { "use strict"; module2.exports = BufferReader; var Reader = require_reader(); (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; var util = require_minimal(); function BufferReader(buffer) { Reader.call(this, buffer); } BufferReader._configure = function() { if (util.Buffer) BufferReader.prototype._slice = util.Buffer.prototype.slice; }; BufferReader.prototype.string = function read_string_buffer() { var len = this.uint32(); return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); }; BufferReader._configure(); } }); // node_modules/protobufjs/src/rpc/service.js var require_service = __commonJS({ "node_modules/protobufjs/src/rpc/service.js"(exports2, module2) { "use strict"; module2.exports = Service; var util = require_minimal(); (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; function Service(rpcImpl, requestDelimited, responseDelimited) { if (typeof rpcImpl !== "function") throw TypeError("rpcImpl must be a function"); util.EventEmitter.call(this); this.rpcImpl = rpcImpl; this.requestDelimited = Boolean(requestDelimited); this.responseDelimited = Boolean(responseDelimited); } Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { if (!request) throw TypeError("request must be specified"); var self2 = this; if (!callback) return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request); if (!self2.rpcImpl) { setTimeout(function() { callback(Error("already ended")); }, 0); return void 0; } try { return self2.rpcImpl( method, requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), function rpcCallback(err, response) { if (err) { self2.emit("error", err, method); return callback(err); } if (response === null) { self2.end( /* endedByRPC */ true ); return void 0; } if (!(response instanceof responseCtor)) { try { response = responseCtor[self2.responseDelimited ? "decodeDelimited" : "decode"](response); } catch (err2) { self2.emit("error", err2, method); return callback(err2); } } self2.emit("data", response, method); return callback(null, response); } ); } catch (err) { self2.emit("error", err, method); setTimeout(function() { callback(err); }, 0); return void 0; } }; Service.prototype.end = function end(endedByRPC) { if (this.rpcImpl) { if (!endedByRPC) this.rpcImpl(null, null, null); this.rpcImpl = null; this.emit("end").off(); } return this; }; } }); // node_modules/protobufjs/src/rpc.js var require_rpc = __commonJS({ "node_modules/protobufjs/src/rpc.js"(exports2) { "use strict"; var rpc = exports2; rpc.Service = require_service(); } }); // node_modules/protobufjs/src/roots.js var require_roots = __commonJS({ "node_modules/protobufjs/src/roots.js"(exports2, module2) { "use strict"; module2.exports = {}; } }); // node_modules/protobufjs/src/index-minimal.js var require_index_minimal = __commonJS({ "node_modules/protobufjs/src/index-minimal.js"(exports2) { "use strict"; var protobuf = exports2; protobuf.build = "minimal"; protobuf.Writer = require_writer(); protobuf.BufferWriter = require_writer_buffer(); protobuf.Reader = require_reader(); protobuf.BufferReader = require_reader_buffer(); protobuf.util = require_minimal(); protobuf.rpc = require_rpc(); protobuf.roots = require_roots(); protobuf.configure = configure; function configure() { protobuf.util._configure(); protobuf.Writer._configure(protobuf.BufferWriter); protobuf.Reader._configure(protobuf.BufferReader); } configure(); } }); // node_modules/@protobufjs/codegen/index.js var require_codegen = __commonJS({ "node_modules/@protobufjs/codegen/index.js"(exports2, module2) { "use strict"; module2.exports = codegen; function codegen(functionParams, functionName) { if (typeof functionParams === "string") { functionName = functionParams; functionParams = void 0; } var body = []; function Codegen(formatStringOrScope) { if (typeof formatStringOrScope !== "string") { var source = toString2(); if (codegen.verbose) console.log("codegen: " + source); source = "return " + source; if (formatStringOrScope) { var scopeKeys = Object.keys(formatStringOrScope), scopeParams = new Array(scopeKeys.length + 1), scopeValues = new Array(scopeKeys.length), scopeOffset = 0; while (scopeOffset < scopeKeys.length) { scopeParams[scopeOffset] = scopeKeys[scopeOffset]; scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; } scopeParams[scopeOffset] = source; return Function.apply(null, scopeParams).apply(null, scopeValues); } return Function(source)(); } var formatParams = new Array(arguments.length - 1), formatOffset = 0; while (formatOffset < formatParams.length) formatParams[formatOffset] = arguments[++formatOffset]; formatOffset = 0; formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace(\$0, \$1) { var value = formatParams[formatOffset++]; switch (\$1) { case "d": case "f": return String(Number(value)); case "i": return String(Math.floor(value)); case "j": return JSON.stringify(value); case "s": return String(value); } return "%"; }); if (formatOffset !== formatParams.length) throw Error("parameter count mismatch"); body.push(formatStringOrScope); return Codegen; } function toString2(functionNameOverride) { return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\\n " + body.join("\\n ") + "\\n}"; } Codegen.toString = toString2; return Codegen; } codegen.verbose = false; } }); // node_modules/@protobufjs/fetch/index.js var require_fetch = __commonJS({ "node_modules/@protobufjs/fetch/index.js"(exports2, module2) { "use strict"; module2.exports = fetch2; var asPromise = require_aspromise(); var inquire2 = require_inquire(); var fs = inquire2("fs"); function fetch2(filename, options, callback) { if (typeof options === "function") { callback = options; options = {}; } else if (!options) options = {}; if (!callback) return asPromise(fetch2, this, filename, options); if (!options.xhr && fs && fs.readFile) return fs.readFile(filename, function fetchReadFileCallback(err, contents) { return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename, options, callback) : err ? callback(err) : callback(null, options.binary ? contents : contents.toString("utf8")); }); return fetch2.xhr(filename, options, callback); } fetch2.xhr = function fetch_xhr(filename, options, callback) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function fetchOnReadyStateChange() { if (xhr.readyState !== 4) return void 0; if (xhr.status !== 0 && xhr.status !== 200) return callback(Error("status " + xhr.status)); if (options.binary) { var buffer = xhr.response; if (!buffer) { buffer = []; for (var i = 0; i < xhr.responseText.length; ++i) buffer.push(xhr.responseText.charCodeAt(i) & 255); } return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); } return callback(null, xhr.responseText); }; if (options.binary) { if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain; charset=x-user-defined"); xhr.responseType = "arraybuffer"; } xhr.open("GET", filename); xhr.send(); }; } }); // node_modules/@protobufjs/path/index.js var require_path = __commonJS({ "node_modules/@protobufjs/path/index.js"(exports2) { "use strict"; var path = exports2; var isAbsolute = ( /** * Tests if the specified path is absolute. * @param {string} path Path to test * @returns {boolean} \`true\` if path is absolute */ path.isAbsolute = function isAbsolute2(path2) { return /^(?:\\/|\\w+:)/.test(path2); } ); var normalize = ( /** * Normalizes the specified path. * @param {string} path Path to normalize * @returns {string} Normalized path */ path.normalize = function normalize2(path2) { path2 = path2.replace(/\\\\/g, "/").replace(/\\/{2,}/g, "/"); var parts = path2.split("/"), absolute = isAbsolute(path2), prefix = ""; if (absolute) prefix = parts.shift() + "/"; for (var i = 0; i < parts.length; ) { if (parts[i] === "..") { if (i > 0 && parts[i - 1] !== "..") parts.splice(--i, 2); else if (absolute) parts.splice(i, 1); else ++i; } else if (parts[i] === ".") parts.splice(i, 1); else ++i; } return prefix + parts.join("/"); } ); path.resolve = function resolve(originPath, includePath, alreadyNormalized) { if (!alreadyNormalized) includePath = normalize(includePath); if (isAbsolute(includePath)) return includePath; if (!alreadyNormalized) originPath = normalize(originPath); return (originPath = originPath.replace(/(?:\\/|^)[^/]+\$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; }; } }); // node_modules/protobufjs/src/types.js var require_types = __commonJS({ "node_modules/protobufjs/src/types.js"(exports2) { "use strict"; var types = exports2; var util = require_util(); var s = [ "double", // 0 "float", // 1 "int32", // 2 "uint32", // 3 "sint32", // 4 "fixed32", // 5 "sfixed32", // 6 "int64", // 7 "uint64", // 8 "sint64", // 9 "fixed64", // 10 "sfixed64", // 11 "bool", // 12 "string", // 13 "bytes" // 14 ]; function bake(values, offset2) { var i = 0, o = {}; offset2 |= 0; while (i < values.length) o[s[i + offset2]] = values[i++]; return o; } types.basic = bake([ /* double */ 1, /* float */ 5, /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 5, /* sfixed32 */ 5, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1, /* bool */ 0, /* string */ 2, /* bytes */ 2 ]); types.defaults = bake([ /* double */ 0, /* float */ 0, /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 0, /* sfixed32 */ 0, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 0, /* sfixed64 */ 0, /* bool */ false, /* string */ "", /* bytes */ util.emptyArray, /* message */ null ]); types.long = bake([ /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1 ], 7); types.mapKey = bake([ /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 5, /* sfixed32 */ 5, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1, /* bool */ 0, /* string */ 2 ], 2); types.packed = bake([ /* double */ 1, /* float */ 5, /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 5, /* sfixed32 */ 5, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1, /* bool */ 0 ]); } }); // node_modules/protobufjs/src/field.js var require_field = __commonJS({ "node_modules/protobufjs/src/field.js"(exports2, module2) { "use strict"; module2.exports = Field; var ReflectionObject = require_object(); ((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; var Enum = require_enum(); var types = require_types(); var util = require_util(); var Type2; var ruleRe = /^required|optional|repeated\$/; Field.fromJSON = function fromJSON(name, json) { return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); }; function Field(name, id, type, rule, extend, options, comment) { if (util.isObject(rule)) { comment = extend; options = rule; rule = extend = void 0; } else if (util.isObject(extend)) { comment = options; options = extend; extend = void 0; } ReflectionObject.call(this, name, options); if (!util.isInteger(id) || id < 0) throw TypeError("id must be a non-negative integer"); if (!util.isString(type)) throw TypeError("type must be a string"); if (rule !== void 0 && !ruleRe.test(rule = rule.toString().toLowerCase())) throw TypeError("rule must be a string rule"); if (extend !== void 0 && !util.isString(extend)) throw TypeError("extend must be a string"); if (rule === "proto3_optional") { rule = "optional"; } this.rule = rule && rule !== "optional" ? rule : void 0; this.type = type; this.id = id; this.extend = extend || void 0; this.required = rule === "required"; this.optional = !this.required; this.repeated = rule === "repeated"; this.map = false; this.message = null; this.partOf = null; this.typeDefault = null; this.defaultValue = null; this.long = util.Long ? types.long[type] !== void 0 : ( /* istanbul ignore next */ false ); this.bytes = type === "bytes"; this.resolvedType = null; this.extensionField = null; this.declaringField = null; this._packed = null; this.comment = comment; } Object.defineProperty(Field.prototype, "packed", { get: function() { if (this._packed === null) this._packed = this.getOption("packed") !== false; return this._packed; } }); Field.prototype.setOption = function setOption(name, value, ifNotSet) { if (name === "packed") this._packed = null; return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); }; Field.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "rule", this.rule !== "optional" && this.rule || void 0, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", keepComments ? this.comment : void 0 ]); }; Field.prototype.resolve = function resolve() { if (this.resolved) return this; if ((this.typeDefault = types.defaults[this.type]) === void 0) { this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); if (this.resolvedType instanceof Type2) this.typeDefault = null; else this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; } else if (this.options && this.options.proto3_optional) { this.typeDefault = null; } if (this.options && this.options["default"] != null) { this.typeDefault = this.options["default"]; if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") this.typeDefault = this.resolvedType.values[this.typeDefault]; } if (this.options) { if (this.options.packed === true || this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof Enum)) delete this.options.packed; if (!Object.keys(this.options).length) this.options = void 0; } if (this.long) { this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); if (Object.freeze) Object.freeze(this.typeDefault); } else if (this.bytes && typeof this.typeDefault === "string") { var buf; if (util.base64.test(this.typeDefault)) util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); else util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); this.typeDefault = buf; } if (this.map) this.defaultValue = util.emptyObject; else if (this.repeated) this.defaultValue = util.emptyArray; else this.defaultValue = this.typeDefault; if (this.parent instanceof Type2) this.parent.ctor.prototype[this.name] = this.defaultValue; return ReflectionObject.prototype.resolve.call(this); }; Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { if (typeof fieldType === "function") fieldType = util.decorateType(fieldType).name; else if (fieldType && typeof fieldType === "object") fieldType = util.decorateEnum(fieldType).name; return function fieldDecorator(prototype, fieldName) { util.decorateType(prototype.constructor).add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); }; }; Field._configure = function configure(Type_) { Type2 = Type_; }; } }); // node_modules/protobufjs/src/oneof.js var require_oneof = __commonJS({ "node_modules/protobufjs/src/oneof.js"(exports2, module2) { "use strict"; module2.exports = OneOf; var ReflectionObject = require_object(); ((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; var Field = require_field(); var util = require_util(); function OneOf(name, fieldNames, options, comment) { if (!Array.isArray(fieldNames)) { options = fieldNames; fieldNames = void 0; } ReflectionObject.call(this, name, options); if (!(fieldNames === void 0 || Array.isArray(fieldNames))) throw TypeError("fieldNames must be an Array"); this.oneof = fieldNames || []; this.fieldsArray = []; this.comment = comment; } OneOf.fromJSON = function fromJSON(name, json) { return new OneOf(name, json.oneof, json.options, json.comment); }; OneOf.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "options", this.options, "oneof", this.oneof, "comment", keepComments ? this.comment : void 0 ]); }; function addFieldsToParent(oneof) { if (oneof.parent) { for (var i = 0; i < oneof.fieldsArray.length; ++i) if (!oneof.fieldsArray[i].parent) oneof.parent.add(oneof.fieldsArray[i]); } } OneOf.prototype.add = function add(field) { if (!(field instanceof Field)) throw TypeError("field must be a Field"); if (field.parent && field.parent !== this.parent) field.parent.remove(field); this.oneof.push(field.name); this.fieldsArray.push(field); field.partOf = this; addFieldsToParent(this); return this; }; OneOf.prototype.remove = function remove(field) { if (!(field instanceof Field)) throw TypeError("field must be a Field"); var index = this.fieldsArray.indexOf(field); if (index < 0) throw Error(field + " is not a member of " + this); this.fieldsArray.splice(index, 1); index = this.oneof.indexOf(field.name); if (index > -1) this.oneof.splice(index, 1); field.partOf = null; return this; }; OneOf.prototype.onAdd = function onAdd(parent) { ReflectionObject.prototype.onAdd.call(this, parent); var self2 = this; for (var i = 0; i < this.oneof.length; ++i) { var field = parent.get(this.oneof[i]); if (field && !field.partOf) { field.partOf = self2; self2.fieldsArray.push(field); } } addFieldsToParent(this); }; OneOf.prototype.onRemove = function onRemove(parent) { for (var i = 0, field; i < this.fieldsArray.length; ++i) if ((field = this.fieldsArray[i]).parent) field.parent.remove(field); ReflectionObject.prototype.onRemove.call(this, parent); }; OneOf.d = function decorateOneOf() { var fieldNames = new Array(arguments.length), index = 0; while (index < arguments.length) fieldNames[index] = arguments[index++]; return function oneOfDecorator(prototype, oneofName) { util.decorateType(prototype.constructor).add(new OneOf(oneofName, fieldNames)); Object.defineProperty(prototype, oneofName, { get: util.oneOfGetter(fieldNames), set: util.oneOfSetter(fieldNames) }); }; }; } }); // node_modules/protobufjs/src/namespace.js var require_namespace = __commonJS({ "node_modules/protobufjs/src/namespace.js"(exports2, module2) { "use strict"; module2.exports = Namespace; var ReflectionObject = require_object(); ((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; var Field = require_field(); var util = require_util(); var OneOf = require_oneof(); var Type2; var Service; var Enum; Namespace.fromJSON = function fromJSON(name, json) { return new Namespace(name, json.options).addJSON(json.nested); }; function arrayToJSON(array, toJSONOptions) { if (!(array && array.length)) return void 0; var obj = {}; for (var i = 0; i < array.length; ++i) obj[array[i].name] = array[i].toJSON(toJSONOptions); return obj; } Namespace.arrayToJSON = arrayToJSON; Namespace.isReservedId = function isReservedId(reserved, id) { if (reserved) { for (var i = 0; i < reserved.length; ++i) if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id) return true; } return false; }; Namespace.isReservedName = function isReservedName(reserved, name) { if (reserved) { for (var i = 0; i < reserved.length; ++i) if (reserved[i] === name) return true; } return false; }; function Namespace(name, options) { ReflectionObject.call(this, name, options); this.nested = void 0; this._nestedArray = null; } function clearCache(namespace) { namespace._nestedArray = null; return namespace; } Object.defineProperty(Namespace.prototype, "nestedArray", { get: function() { return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); } }); Namespace.prototype.toJSON = function toJSON(toJSONOptions) { return util.toObject([ "options", this.options, "nested", arrayToJSON(this.nestedArray, toJSONOptions) ]); }; Namespace.prototype.addJSON = function addJSON(nestedJson) { var ns = this; if (nestedJson) { for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { nested = nestedJson[names[i]]; ns.add( // most to least likely (nested.fields !== void 0 ? Type2.fromJSON : nested.values !== void 0 ? Enum.fromJSON : nested.methods !== void 0 ? Service.fromJSON : nested.id !== void 0 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested) ); } } return this; }; Namespace.prototype.get = function get(name) { return this.nested && this.nested[name] || null; }; Namespace.prototype.getEnum = function getEnum(name) { if (this.nested && this.nested[name] instanceof Enum) return this.nested[name].values; throw Error("no such enum: " + name); }; Namespace.prototype.add = function add(object) { if (!(object instanceof Field && object.extend !== void 0 || object instanceof Type2 || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace)) throw TypeError("object must be a valid nested object"); if (!this.nested) this.nested = {}; else { var prev = this.get(object.name); if (prev) { if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type2 || prev instanceof Service)) { var nested = prev.nestedArray; for (var i = 0; i < nested.length; ++i) object.add(nested[i]); this.remove(prev); if (!this.nested) this.nested = {}; object.setOptions(prev.options, true); } else throw Error("duplicate name '" + object.name + "' in " + this); } } this.nested[object.name] = object; object.onAdd(this); return clearCache(this); }; Namespace.prototype.remove = function remove(object) { if (!(object instanceof ReflectionObject)) throw TypeError("object must be a ReflectionObject"); if (object.parent !== this) throw Error(object + " is not a member of " + this); delete this.nested[object.name]; if (!Object.keys(this.nested).length) this.nested = void 0; object.onRemove(this); return clearCache(this); }; Namespace.prototype.define = function define(path, json) { if (util.isString(path)) path = path.split("."); else if (!Array.isArray(path)) throw TypeError("illegal path"); if (path && path.length && path[0] === "") throw Error("path must be relative"); var ptr = this; while (path.length > 0) { var part = path.shift(); if (ptr.nested && ptr.nested[part]) { ptr = ptr.nested[part]; if (!(ptr instanceof Namespace)) throw Error("path conflicts with non-namespace objects"); } else ptr.add(ptr = new Namespace(part)); } if (json) ptr.addJSON(json); return ptr; }; Namespace.prototype.resolveAll = function resolveAll() { var nested = this.nestedArray, i = 0; while (i < nested.length) if (nested[i] instanceof Namespace) nested[i++].resolveAll(); else nested[i++].resolve(); return this.resolve(); }; Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { if (typeof filterTypes === "boolean") { parentAlreadyChecked = filterTypes; filterTypes = void 0; } else if (filterTypes && !Array.isArray(filterTypes)) filterTypes = [filterTypes]; if (util.isString(path) && path.length) { if (path === ".") return this.root; path = path.split("."); } else if (!path.length) return this; if (path[0] === "") return this.root.lookup(path.slice(1), filterTypes); var found = this.get(path[0]); if (found) { if (path.length === 1) { if (!filterTypes || filterTypes.indexOf(found.constructor) > -1) return found; } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true))) return found; } else for (var i = 0; i < this.nestedArray.length; ++i) if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true))) return found; if (this.parent === null || parentAlreadyChecked) return null; return this.parent.lookup(path, filterTypes); }; Namespace.prototype.lookupType = function lookupType(path) { var found = this.lookup(path, [Type2]); if (!found) throw Error("no such type: " + path); return found; }; Namespace.prototype.lookupEnum = function lookupEnum(path) { var found = this.lookup(path, [Enum]); if (!found) throw Error("no such Enum '" + path + "' in " + this); return found; }; Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { var found = this.lookup(path, [Type2, Enum]); if (!found) throw Error("no such Type or Enum '" + path + "' in " + this); return found; }; Namespace.prototype.lookupService = function lookupService(path) { var found = this.lookup(path, [Service]); if (!found) throw Error("no such Service '" + path + "' in " + this); return found; }; Namespace._configure = function(Type_, Service_, Enum_) { Type2 = Type_; Service = Service_; Enum = Enum_; }; } }); // node_modules/protobufjs/src/mapfield.js var require_mapfield = __commonJS({ "node_modules/protobufjs/src/mapfield.js"(exports2, module2) { "use strict"; module2.exports = MapField; var Field = require_field(); ((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; var types = require_types(); var util = require_util(); function MapField(name, id, keyType, type, options, comment) { Field.call(this, name, id, type, void 0, void 0, options, comment); if (!util.isString(keyType)) throw TypeError("keyType must be a string"); this.keyType = keyType; this.resolvedKeyType = null; this.map = true; } MapField.fromJSON = function fromJSON(name, json) { return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); }; MapField.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "keyType", this.keyType, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", keepComments ? this.comment : void 0 ]); }; MapField.prototype.resolve = function resolve() { if (this.resolved) return this; if (types.mapKey[this.keyType] === void 0) throw Error("invalid key type: " + this.keyType); return Field.prototype.resolve.call(this); }; MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { if (typeof fieldValueType === "function") fieldValueType = util.decorateType(fieldValueType).name; else if (fieldValueType && typeof fieldValueType === "object") fieldValueType = util.decorateEnum(fieldValueType).name; return function mapFieldDecorator(prototype, fieldName) { util.decorateType(prototype.constructor).add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); }; }; } }); // node_modules/protobufjs/src/method.js var require_method = __commonJS({ "node_modules/protobufjs/src/method.js"(exports2, module2) { "use strict"; module2.exports = Method; var ReflectionObject = require_object(); ((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; var util = require_util(); function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment, parsedOptions) { if (util.isObject(requestStream)) { options = requestStream; requestStream = responseStream = void 0; } else if (util.isObject(responseStream)) { options = responseStream; responseStream = void 0; } if (!(type === void 0 || util.isString(type))) throw TypeError("type must be a string"); if (!util.isString(requestType)) throw TypeError("requestType must be a string"); if (!util.isString(responseType)) throw TypeError("responseType must be a string"); ReflectionObject.call(this, name, options); this.type = type || "rpc"; this.requestType = requestType; this.requestStream = requestStream ? true : void 0; this.responseType = responseType; this.responseStream = responseStream ? true : void 0; this.resolvedRequestType = null; this.resolvedResponseType = null; this.comment = comment; this.parsedOptions = parsedOptions; } Method.fromJSON = function fromJSON(name, json) { return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment, json.parsedOptions); }; Method.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "type", this.type !== "rpc" && /* istanbul ignore next */ this.type || void 0, "requestType", this.requestType, "requestStream", this.requestStream, "responseType", this.responseType, "responseStream", this.responseStream, "options", this.options, "comment", keepComments ? this.comment : void 0, "parsedOptions", this.parsedOptions ]); }; Method.prototype.resolve = function resolve() { if (this.resolved) return this; this.resolvedRequestType = this.parent.lookupType(this.requestType); this.resolvedResponseType = this.parent.lookupType(this.responseType); return ReflectionObject.prototype.resolve.call(this); }; } }); // node_modules/protobufjs/src/service.js var require_service2 = __commonJS({ "node_modules/protobufjs/src/service.js"(exports2, module2) { "use strict"; module2.exports = Service; var Namespace = require_namespace(); ((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; var Method = require_method(); var util = require_util(); var rpc = require_rpc(); function Service(name, options) { Namespace.call(this, name, options); this.methods = {}; this._methodsArray = null; } Service.fromJSON = function fromJSON(name, json) { var service = new Service(name, json.options); if (json.methods) for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) service.add(Method.fromJSON(names[i], json.methods[names[i]])); if (json.nested) service.addJSON(json.nested); service.comment = json.comment; return service; }; Service.prototype.toJSON = function toJSON(toJSONOptions) { var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "options", inherited && inherited.options || void 0, "methods", Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {}, "nested", inherited && inherited.nested || void 0, "comment", keepComments ? this.comment : void 0 ]); }; Object.defineProperty(Service.prototype, "methodsArray", { get: function() { return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); } }); function clearCache(service) { service._methodsArray = null; return service; } Service.prototype.get = function get(name) { return this.methods[name] || Namespace.prototype.get.call(this, name); }; Service.prototype.resolveAll = function resolveAll() { var methods = this.methodsArray; for (var i = 0; i < methods.length; ++i) methods[i].resolve(); return Namespace.prototype.resolve.call(this); }; Service.prototype.add = function add(object) { if (this.get(object.name)) throw Error("duplicate name '" + object.name + "' in " + this); if (object instanceof Method) { this.methods[object.name] = object; object.parent = this; return clearCache(this); } return Namespace.prototype.add.call(this, object); }; Service.prototype.remove = function remove(object) { if (object instanceof Method) { if (this.methods[object.name] !== object) throw Error(object + " is not a member of " + this); delete this.methods[object.name]; object.parent = null; return clearCache(this); } return Namespace.prototype.remove.call(this, object); }; Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) { var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^\$\\w_]/g, ""); rpcService[methodName] = util.codegen(["r", "c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ m: method, q: method.resolvedRequestType.ctor, s: method.resolvedResponseType.ctor }); } return rpcService; }; } }); // node_modules/protobufjs/src/message.js var require_message = __commonJS({ "node_modules/protobufjs/src/message.js"(exports2, module2) { "use strict"; module2.exports = Message; var util = require_minimal(); function Message(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) this[keys[i]] = properties[keys[i]]; } Message.create = function create(properties) { return this.\$type.create(properties); }; Message.encode = function encode(message, writer) { return this.\$type.encode(message, writer); }; Message.encodeDelimited = function encodeDelimited(message, writer) { return this.\$type.encodeDelimited(message, writer); }; Message.decode = function decode(reader) { return this.\$type.decode(reader); }; Message.decodeDelimited = function decodeDelimited(reader) { return this.\$type.decodeDelimited(reader); }; Message.verify = function verify(message) { return this.\$type.verify(message); }; Message.fromObject = function fromObject(object) { return this.\$type.fromObject(object); }; Message.toObject = function toObject2(message, options) { return this.\$type.toObject(message, options); }; Message.prototype.toJSON = function toJSON() { return this.\$type.toObject(this, util.toJSONOptions); }; } }); // node_modules/protobufjs/src/decoder.js var require_decoder = __commonJS({ "node_modules/protobufjs/src/decoder.js"(exports2, module2) { "use strict"; module2.exports = decoder; var Enum = require_enum(); var types = require_types(); var util = require_util(); function missing(field) { return "missing required '" + field.name + "'"; } function decoder(mtype) { var gen = util.codegen(["r", "l"], mtype.name + "\$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field2) { return field2.map; }).length ? ",k,value" : ""))("while(r.pos>>3){"); var i = 0; for (; i < /* initializes */ mtype.fieldsArray.length; ++i) { var field = mtype._fieldsArray[i].resolve(), type = field.resolvedType instanceof Enum ? "int32" : field.type, ref = "m" + util.safeProp(field.name); gen("case %i: {", field.id); if (field.map) { gen("if(%s===util.emptyObject)", ref)("%s={}", ref)("var c2 = r.uint32()+r.pos"); if (types.defaults[field.keyType] !== void 0) gen("k=%j", types.defaults[field.keyType]); else gen("k=null"); if (types.defaults[type] !== void 0) gen("value=%j", types.defaults[type]); else gen("value=null"); gen("while(r.pos>>3){")("case 1: k=r.%s(); break", field.keyType)("case 2:"); if (types.basic[type] === void 0) gen("value=types[%i].decode(r,r.uint32())", i); else gen("value=r.%s()", type); gen("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"); if (types.long[field.keyType] !== void 0) gen('%s[typeof k==="object"?util.longToHash(k):k]=value', ref); else gen("%s[k]=value", ref); } else if (field.repeated) { gen("if(!(%s&&%s.length))", ref, ref)("%s=[]", ref); if (types.packed[type] !== void 0) gen("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0", prop, prop); break; case "int32": case "sint32": case "sfixed32": gen("m%s=d%s|0", prop, prop); break; case "uint64": isUnsigned = true; case "int64": case "sint64": case "fixed64": case "sfixed64": gen("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)('else if(typeof d%s==="string")', prop)("m%s=parseInt(d%s,10)", prop, prop)('else if(typeof d%s==="number")', prop)("m%s=d%s", prop, prop)('else if(typeof d%s==="object")', prop)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); break; case "bytes": gen('if(typeof d%s==="string")', prop)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)("else if(d%s.length >= 0)", prop)("m%s=d%s", prop, prop); break; case "string": gen("m%s=String(d%s)", prop, prop); break; case "bool": gen("m%s=Boolean(d%s)", prop, prop); break; } } return gen; } converter.fromObject = function fromObject(mtype) { var fields = mtype.fieldsArray; var gen = util.codegen(["d"], mtype.name + "\$fromObject")("if(d instanceof this.ctor)")("return d"); if (!fields.length) return gen("return new this.ctor"); gen("var m=new this.ctor"); for (var i = 0; i < fields.length; ++i) { var field = fields[i].resolve(), prop = util.safeProp(field.name); if (field.map) { gen("if(d%s){", prop)('if(typeof d%s!=="object")', prop)("throw TypeError(%j)", field.fullName + ": object expected")("m%s={}", prop)("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true" : "", prop); break; case "bytes": gen("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); break; default: gen("d%s=m%s", prop, prop); break; } } return gen; } converter.toObject = function toObject2(mtype) { var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); if (!fields.length) return util.codegen()("return {}"); var gen = util.codegen(["m", "o"], mtype.name + "\$toObject")("if(!o)")("o={}")("var d={}"); var repeatedFields = [], mapFields = [], normalFields = [], i = 0; for (; i < fields.length; ++i) if (!fields[i].partOf) (fields[i].resolve().repeated ? repeatedFields : fields[i].map ? mapFields : normalFields).push(fields[i]); if (repeatedFields.length) { gen("if(o.arrays||o.defaults){"); for (i = 0; i < repeatedFields.length; ++i) gen("d%s=[]", util.safeProp(repeatedFields[i].name)); gen("}"); } if (mapFields.length) { gen("if(o.objects||o.defaults){"); for (i = 0; i < mapFields.length; ++i) gen("d%s={}", util.safeProp(mapFields[i].name)); gen("}"); } if (normalFields.length) { gen("if(o.defaults){"); for (i = 0; i < normalFields.length; ++i) { var field = normalFields[i], prop = util.safeProp(field.name); if (field.resolvedType instanceof Enum) gen("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); else if (field.long) gen("if(util.Long){")("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)("}else")("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); else if (field.bytes) { var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; gen("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault))("else{")("d%s=%s", prop, arrayDefault)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop)("}"); } else gen("d%s=%j", prop, field.typeDefault); } gen("}"); } var hasKs2 = false; for (i = 0; i < fields.length; ++i) { var field = fields[i], index = mtype._fieldsArray.indexOf(field), prop = util.safeProp(field.name); if (field.map) { if (!hasKs2) { hasKs2 = true; gen("var ks2"); } gen("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop)("d%s={}", prop)("for(var j=0;j} * @readonly */ fieldsById: { get: function() { if (this._fieldsById) return this._fieldsById; this._fieldsById = {}; for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { var field = this.fields[names[i]], id = field.id; if (this._fieldsById[id]) throw Error("duplicate id " + id + " in " + this); this._fieldsById[id] = field; } return this._fieldsById; } }, /** * Fields of this message as an array for iteration. * @name Type#fieldsArray * @type {Field[]} * @readonly */ fieldsArray: { get: function() { return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); } }, /** * Oneofs of this message as an array for iteration. * @name Type#oneofsArray * @type {OneOf[]} * @readonly */ oneofsArray: { get: function() { return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); } }, /** * The registered constructor, if any registered, otherwise a generic constructor. * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. * @name Type#ctor * @type {Constructor<{}>} */ ctor: { get: function() { return this._ctor || (this.ctor = Type2.generateConstructor(this)()); }, set: function(ctor) { var prototype = ctor.prototype; if (!(prototype instanceof Message)) { (ctor.prototype = new Message()).constructor = ctor; util.merge(ctor.prototype, prototype); } ctor.\$type = ctor.prototype.\$type = this; util.merge(ctor, Message, true); this._ctor = ctor; var i = 0; for (; i < /* initializes */ this.fieldsArray.length; ++i) this._fieldsArray[i].resolve(); var ctorProperties = {}; for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) ctorProperties[this._oneofsArray[i].resolve().name] = { get: util.oneOfGetter(this._oneofsArray[i].oneof), set: util.oneOfSetter(this._oneofsArray[i].oneof) }; if (i) Object.defineProperties(ctor.prototype, ctorProperties); } } }); Type2.generateConstructor = function generateConstructor(mtype) { var gen = util.codegen(["p"], mtype.name); for (var i = 0, field; i < mtype.fieldsArray.length; ++i) if ((field = mtype._fieldsArray[i]).map) gen("this%s={}", util.safeProp(field.name)); else if (field.repeated) gen("this%s=[]", util.safeProp(field.name)); return gen("if(p)for(var ks=Object.keys(p),i=0;i -1) { var altname = filename2.substring(idx); if (altname in common) return altname; } return null; } function process(filename2, source) { try { if (util.isString(source) && source.charAt(0) === "{") source = JSON.parse(source); if (!util.isString(source)) self2.setOptions(source.options).addJSON(source.nested); else { parse.filename = filename2; var parsed = parse(source, self2, options), resolved2, i2 = 0; if (parsed.imports) { for (; i2 < parsed.imports.length; ++i2) if (resolved2 = getBundledFileName(parsed.imports[i2]) || self2.resolvePath(filename2, parsed.imports[i2])) fetch2(resolved2); } if (parsed.weakImports) { for (i2 = 0; i2 < parsed.weakImports.length; ++i2) if (resolved2 = getBundledFileName(parsed.weakImports[i2]) || self2.resolvePath(filename2, parsed.weakImports[i2])) fetch2(resolved2, true); } } } catch (err) { finish(err); } if (!sync && !queued) finish(null, self2); } function fetch2(filename2, weak) { if (self2.files.indexOf(filename2) > -1) return; self2.files.push(filename2); if (filename2 in common) { if (sync) process(filename2, common[filename2]); else { ++queued; setTimeout(function() { --queued; process(filename2, common[filename2]); }); } return; } if (sync) { var source; try { source = util.fs.readFileSync(filename2).toString("utf8"); } catch (err) { if (!weak) finish(err); return; } process(filename2, source); } else { ++queued; self2.fetch(filename2, function(err, source2) { --queued; if (!callback) return; if (err) { if (!weak) finish(err); else if (!queued) finish(null, self2); return; } process(filename2, source2); }); } } var queued = 0; if (util.isString(filename)) filename = [filename]; for (var i = 0, resolved; i < filename.length; ++i) if (resolved = self2.resolvePath("", filename[i])) fetch2(resolved); if (sync) return self2; if (!queued) finish(null, self2); return void 0; }; Root2.prototype.loadSync = function loadSync(filename, options) { if (!util.isNode) throw Error("not supported"); return this.load(filename, options, SYNC); }; Root2.prototype.resolveAll = function resolveAll() { if (this.deferred.length) throw Error("unresolvable extensions: " + this.deferred.map(function(field) { return "'extend " + field.extend + "' in " + field.parent.fullName; }).join(", ")); return Namespace.prototype.resolveAll.call(this); }; var exposeRe = /^[A-Z]/; function tryHandleExtension(root, field) { var extendedType = field.parent.lookup(field.extend); if (extendedType) { var sisterField = new Field(field.fullName, field.id, field.type, field.rule, void 0, field.options); sisterField.declaringField = field; field.extensionField = sisterField; extendedType.add(sisterField); return true; } return false; } Root2.prototype._handleAdd = function _handleAdd(object) { if (object instanceof Field) { if ( /* an extension field (implies not part of a oneof) */ object.extend !== void 0 && /* not already handled */ !object.extensionField ) { if (!tryHandleExtension(this, object)) this.deferred.push(object); } } else if (object instanceof Enum) { if (exposeRe.test(object.name)) object.parent[object.name] = object.values; } else if (!(object instanceof OneOf)) { if (object instanceof Type2) for (var i = 0; i < this.deferred.length; ) if (tryHandleExtension(this, this.deferred[i])) this.deferred.splice(i, 1); else ++i; for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) this._handleAdd(object._nestedArray[j]); if (exposeRe.test(object.name)) object.parent[object.name] = object; } }; Root2.prototype._handleRemove = function _handleRemove(object) { if (object instanceof Field) { if ( /* an extension field */ object.extend !== void 0 ) { if ( /* already handled */ object.extensionField ) { object.extensionField.parent.remove(object.extensionField); object.extensionField = null; } else { var index = this.deferred.indexOf(object); if (index > -1) this.deferred.splice(index, 1); } } } else if (object instanceof Enum) { if (exposeRe.test(object.name)) delete object.parent[object.name]; } else if (object instanceof Namespace) { for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) this._handleRemove(object._nestedArray[i]); if (exposeRe.test(object.name)) delete object.parent[object.name]; } }; Root2._configure = function(Type_, parse_, common_) { Type2 = Type_; parse = parse_; common = common_; }; } }); // node_modules/protobufjs/src/util.js var require_util = __commonJS({ "node_modules/protobufjs/src/util.js"(exports2, module2) { "use strict"; var util = module2.exports = require_minimal(); var roots = require_roots(); var Type2; var Enum; util.codegen = require_codegen(); util.fetch = require_fetch(); util.path = require_path(); util.fs = util.inquire("fs"); util.toArray = function toArray(object) { if (object) { var keys = Object.keys(object), array = new Array(keys.length), index = 0; while (index < keys.length) array[index] = object[keys[index++]]; return array; } return []; }; util.toObject = function toObject2(array) { var object = {}, index = 0; while (index < array.length) { var key = array[index++], val = array[index++]; if (val !== void 0) object[key] = val; } return object; }; var safePropBackslashRe = /\\\\/g; var safePropQuoteRe = /"/g; util.isReserved = function isReserved(name) { return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)\$/.test(name); }; util.safeProp = function safeProp(prop) { if (!/^[\$\\w_]+\$/.test(prop) || util.isReserved(prop)) return '["' + prop.replace(safePropBackslashRe, "\\\\\\\\").replace(safePropQuoteRe, '\\\\"') + '"]'; return "." + prop; }; util.ucFirst = function ucFirst(str) { return str.charAt(0).toUpperCase() + str.substring(1); }; var camelCaseRe = /_([a-z])/g; util.camelCase = function camelCase(str) { return str.substring(0, 1) + str.substring(1).replace(camelCaseRe, function(\$0, \$1) { return \$1.toUpperCase(); }); }; util.compareFieldsById = function compareFieldsById(a, b) { return a.id - b.id; }; util.decorateType = function decorateType(ctor, typeName) { if (ctor.\$type) { if (typeName && ctor.\$type.name !== typeName) { util.decorateRoot.remove(ctor.\$type); ctor.\$type.name = typeName; util.decorateRoot.add(ctor.\$type); } return ctor.\$type; } if (!Type2) Type2 = require_type(); var type = new Type2(typeName || ctor.name); util.decorateRoot.add(type); type.ctor = ctor; Object.defineProperty(ctor, "\$type", { value: type, enumerable: false }); Object.defineProperty(ctor.prototype, "\$type", { value: type, enumerable: false }); return type; }; var decorateEnumIndex = 0; util.decorateEnum = function decorateEnum(object) { if (object.\$type) return object.\$type; if (!Enum) Enum = require_enum(); var enm = new Enum("Enum" + decorateEnumIndex++, object); util.decorateRoot.add(enm); Object.defineProperty(object, "\$type", { value: enm, enumerable: false }); return enm; }; util.setProperty = function setProperty(dst, path, value) { function setProp(dst2, path2, value2) { var part = path2.shift(); if (part === "__proto__") { return dst2; } if (path2.length > 0) { dst2[part] = setProp(dst2[part] || {}, path2, value2); } else { var prevValue = dst2[part]; if (prevValue) value2 = [].concat(prevValue).concat(value2); dst2[part] = value2; } return dst2; } if (typeof dst !== "object") throw TypeError("dst must be an object"); if (!path) throw TypeError("path must be specified"); path = path.split("."); return setProp(dst, path, value); }; Object.defineProperty(util, "decorateRoot", { get: function() { return roots["decorated"] || (roots["decorated"] = new (require_root())()); } }); } }); // node_modules/protobufjs/src/object.js var require_object = __commonJS({ "node_modules/protobufjs/src/object.js"(exports2, module2) { "use strict"; module2.exports = ReflectionObject; ReflectionObject.className = "ReflectionObject"; var util = require_util(); var Root2; function ReflectionObject(name, options) { if (!util.isString(name)) throw TypeError("name must be a string"); if (options && !util.isObject(options)) throw TypeError("options must be an object"); this.options = options; this.parsedOptions = null; this.name = name; this.parent = null; this.resolved = false; this.comment = null; this.filename = null; } Object.defineProperties(ReflectionObject.prototype, { /** * Reference to the root namespace. * @name ReflectionObject#root * @type {Root} * @readonly */ root: { get: function() { var ptr = this; while (ptr.parent !== null) ptr = ptr.parent; return ptr; } }, /** * Full name including leading dot. * @name ReflectionObject#fullName * @type {string} * @readonly */ fullName: { get: function() { var path = [this.name], ptr = this.parent; while (ptr) { path.unshift(ptr.name); ptr = ptr.parent; } return path.join("."); } } }); ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() { throw Error(); }; ReflectionObject.prototype.onAdd = function onAdd(parent) { if (this.parent && this.parent !== parent) this.parent.remove(this); this.parent = parent; this.resolved = false; var root = parent.root; if (root instanceof Root2) root._handleAdd(this); }; ReflectionObject.prototype.onRemove = function onRemove(parent) { var root = parent.root; if (root instanceof Root2) root._handleRemove(this); this.parent = null; this.resolved = false; }; ReflectionObject.prototype.resolve = function resolve() { if (this.resolved) return this; if (this.root instanceof Root2) this.resolved = true; return this; }; ReflectionObject.prototype.getOption = function getOption(name) { if (this.options) return this.options[name]; return void 0; }; ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { if (!ifNotSet || !this.options || this.options[name] === void 0) (this.options || (this.options = {}))[name] = value; return this; }; ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) { if (!this.parsedOptions) { this.parsedOptions = []; } var parsedOptions = this.parsedOptions; if (propName) { var opt = parsedOptions.find(function(opt2) { return Object.prototype.hasOwnProperty.call(opt2, name); }); if (opt) { var newValue = opt[name]; util.setProperty(newValue, propName, value); } else { opt = {}; opt[name] = util.setProperty({}, propName, value); parsedOptions.push(opt); } } else { var newOpt = {}; newOpt[name] = value; parsedOptions.push(newOpt); } return this; }; ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { if (options) for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) this.setOption(keys[i], options[keys[i]], ifNotSet); return this; }; ReflectionObject.prototype.toString = function toString2() { var className = this.constructor.className, fullName = this.fullName; if (fullName.length) return className + " " + fullName; return className; }; ReflectionObject._configure = function(Root_) { Root2 = Root_; }; } }); // node_modules/protobufjs/src/enum.js var require_enum = __commonJS({ "node_modules/protobufjs/src/enum.js"(exports2, module2) { "use strict"; module2.exports = Enum; var ReflectionObject = require_object(); ((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; var Namespace = require_namespace(); var util = require_util(); function Enum(name, values, options, comment, comments, valuesOptions) { ReflectionObject.call(this, name, options); if (values && typeof values !== "object") throw TypeError("values must be an object"); this.valuesById = {}; this.values = Object.create(this.valuesById); this.comment = comment; this.comments = comments || {}; this.valuesOptions = valuesOptions; this.reserved = void 0; if (values) { for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) if (typeof values[keys[i]] === "number") this.valuesById[this.values[keys[i]] = values[keys[i]]] = keys[i]; } } Enum.fromJSON = function fromJSON(name, json) { var enm = new Enum(name, json.values, json.options, json.comment, json.comments); enm.reserved = json.reserved; return enm; }; Enum.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "options", this.options, "valuesOptions", this.valuesOptions, "values", this.values, "reserved", this.reserved && this.reserved.length ? this.reserved : void 0, "comment", keepComments ? this.comment : void 0, "comments", keepComments ? this.comments : void 0 ]); }; Enum.prototype.add = function add(name, id, comment, options) { if (!util.isString(name)) throw TypeError("name must be a string"); if (!util.isInteger(id)) throw TypeError("id must be an integer"); if (this.values[name] !== void 0) throw Error("duplicate name '" + name + "' in " + this); if (this.isReservedId(id)) throw Error("id " + id + " is reserved in " + this); if (this.isReservedName(name)) throw Error("name '" + name + "' is reserved in " + this); if (this.valuesById[id] !== void 0) { if (!(this.options && this.options.allow_alias)) throw Error("duplicate id " + id + " in " + this); this.values[name] = id; } else this.valuesById[this.values[name] = id] = name; if (options) { if (this.valuesOptions === void 0) this.valuesOptions = {}; this.valuesOptions[name] = options || null; } this.comments[name] = comment || null; return this; }; Enum.prototype.remove = function remove(name) { if (!util.isString(name)) throw TypeError("name must be a string"); var val = this.values[name]; if (val == null) throw Error("name '" + name + "' does not exist in " + this); delete this.valuesById[val]; delete this.values[name]; delete this.comments[name]; if (this.valuesOptions) delete this.valuesOptions[name]; return this; }; Enum.prototype.isReservedId = function isReservedId(id) { return Namespace.isReservedId(this.reserved, id); }; Enum.prototype.isReservedName = function isReservedName(name) { return Namespace.isReservedName(this.reserved, name); }; } }); // node_modules/protobufjs/src/encoder.js var require_encoder = __commonJS({ "node_modules/protobufjs/src/encoder.js"(exports2, module2) { "use strict"; module2.exports = encoder; var Enum = require_enum(); var types = require_types(); var util = require_util(); function genTypePartial(gen, field, fieldIndex, ref) { return field.resolvedType.group ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0) : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); } function encoder(mtype) { var gen = util.codegen(["m", "w"], mtype.name + "\$encode")("if(!w)")("w=Writer.create()"); var i, ref; var fields = ( /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById) ); for (var i = 0; i < fields.length; ++i) { var field = fields[i].resolve(), index = mtype._fieldsArray.indexOf(field), type = field.resolvedType instanceof Enum ? "int32" : field.type, wireType = types.basic[type]; ref = "m" + util.safeProp(field.name); if (field.map) { gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name)("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); if (wireType === void 0) gen("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); else gen(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); gen("}")("}"); } else if (field.repeated) { gen("if(%s!=null&&%s.length){", ref, ref); if (field.packed && types.packed[type] !== void 0) { gen("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", ref)("w.%s(%s[i])", type, ref)("w.ldelim()"); } else { gen("for(var i=0;i<%s.length;++i)", ref); if (wireType === void 0) genTypePartial(gen, field, index, ref + "[i]"); else gen("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); } gen("}"); } else { if (field.optional) gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); if (wireType === void 0) genTypePartial(gen, field, index, ref); else gen("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); } } return gen("return w"); } } }); // node_modules/protobufjs/src/index-light.js var require_index_light = __commonJS({ "node_modules/protobufjs/src/index-light.js"(exports2, module2) { "use strict"; var protobuf = module2.exports = require_index_minimal(); protobuf.build = "light"; function load2(filename, root, callback) { if (typeof root === "function") { callback = root; root = new protobuf.Root(); } else if (!root) root = new protobuf.Root(); return root.load(filename, callback); } protobuf.load = load2; function loadSync(filename, root) { if (!root) root = new protobuf.Root(); return root.loadSync(filename); } protobuf.loadSync = loadSync; protobuf.encoder = require_encoder(); protobuf.decoder = require_decoder(); protobuf.verifier = require_verifier(); protobuf.converter = require_converter(); protobuf.ReflectionObject = require_object(); protobuf.Namespace = require_namespace(); protobuf.Root = require_root(); protobuf.Enum = require_enum(); protobuf.Type = require_type(); protobuf.Field = require_field(); protobuf.OneOf = require_oneof(); protobuf.MapField = require_mapfield(); protobuf.Service = require_service2(); protobuf.Method = require_method(); protobuf.Message = require_message(); protobuf.wrappers = require_wrappers(); protobuf.types = require_types(); protobuf.util = require_util(); protobuf.ReflectionObject._configure(protobuf.Root); protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); protobuf.Root._configure(protobuf.Type); protobuf.Field._configure(protobuf.Type); } }); // node_modules/protobufjs/light.js var require_light = __commonJS({ "node_modules/protobufjs/light.js"(exports2, module2) { "use strict"; module2.exports = require_index_light(); } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/value-types.js var require_value_types = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/value-types.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var NewLine = "\\n"; exports2.NewLine = NewLine; var ListType; (function(ListType2) { ListType2["Ordered"] = "ordered"; ListType2["Bullet"] = "bullet"; ListType2["Checked"] = "checked"; ListType2["Unchecked"] = "unchecked"; })(ListType || (ListType = {})); exports2.ListType = ListType; var ScriptType; (function(ScriptType2) { ScriptType2["Sub"] = "sub"; ScriptType2["Super"] = "super"; })(ScriptType || (ScriptType = {})); exports2.ScriptType = ScriptType; var DirectionType; (function(DirectionType2) { DirectionType2["Rtl"] = "rtl"; })(DirectionType || (DirectionType = {})); exports2.DirectionType = DirectionType; var AlignType; (function(AlignType2) { AlignType2["Left"] = "left"; AlignType2["Center"] = "center"; AlignType2["Right"] = "right"; AlignType2["Justify"] = "justify"; })(AlignType || (AlignType = {})); exports2.AlignType = AlignType; var DataType; (function(DataType2) { DataType2["Image"] = "image"; DataType2["Video"] = "video"; DataType2["Formula"] = "formula"; DataType2["Text"] = "text"; })(DataType || (DataType = {})); exports2.DataType = DataType; var GroupType; (function(GroupType2) { GroupType2["Block"] = "block"; GroupType2["InlineGroup"] = "inline-group"; GroupType2["List"] = "list"; GroupType2["Video"] = "video"; GroupType2["Table"] = "table"; })(GroupType || (GroupType = {})); exports2.GroupType = GroupType; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/InsertData.js var require_InsertData = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/InsertData.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var InsertDataQuill = function() { function InsertDataQuill2(type, value) { this.type = type; this.value = value; } return InsertDataQuill2; }(); exports2.InsertDataQuill = InsertDataQuill; var InsertDataCustom = function() { function InsertDataCustom2(type, value) { this.type = type; this.value = value; } return InsertDataCustom2; }(); exports2.InsertDataCustom = InsertDataCustom; } }); // node_modules/lodash.isequal/index.js var require_lodash = __commonJS({ "node_modules/lodash.isequal/index.js"(exports2, module2) { var LARGE_ARRAY_SIZE = 200; var HASH_UNDEFINED = "__lodash_hash_undefined__"; var COMPARE_PARTIAL_FLAG = 1; var COMPARE_UNORDERED_FLAG = 2; var MAX_SAFE_INTEGER = 9007199254740991; var argsTag = "[object Arguments]"; var arrayTag = "[object Array]"; var asyncTag = "[object AsyncFunction]"; var boolTag = "[object Boolean]"; var dateTag = "[object Date]"; var errorTag = "[object Error]"; var funcTag = "[object Function]"; var genTag = "[object GeneratorFunction]"; var mapTag = "[object Map]"; var numberTag = "[object Number]"; var nullTag = "[object Null]"; var objectTag = "[object Object]"; var promiseTag = "[object Promise]"; var proxyTag = "[object Proxy]"; var regexpTag = "[object RegExp]"; var setTag = "[object Set]"; var stringTag = "[object String]"; var symbolTag = "[object Symbol]"; var undefinedTag = "[object Undefined]"; var weakMapTag = "[object WeakMap]"; var arrayBufferTag = "[object ArrayBuffer]"; var dataViewTag = "[object DataView]"; var float32Tag = "[object Float32Array]"; var float64Tag = "[object Float64Array]"; var int8Tag = "[object Int8Array]"; var int16Tag = "[object Int16Array]"; var int32Tag = "[object Int32Array]"; var uint8Tag = "[object Uint8Array]"; var uint8ClampedTag = "[object Uint8ClampedArray]"; var uint16Tag = "[object Uint16Array]"; var uint32Tag = "[object Uint32Array]"; var reRegExpChar = /[\\\\^\$.*+?()[\\]{}|]/g; var reIsHostCtor = /^\\[object .+?Constructor\\]\$/; var reIsUint = /^(?:0|[1-9]\\d*)\$/; var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; var freeGlobal = typeof global == "object" && global && global.Object === Object && global; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function("return this")(); var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2; var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; var moduleExports = freeModule && freeModule.exports === freeExports; var freeProcess = moduleExports && freeGlobal.process; var nodeUtil = function() { try { return freeProcess && freeProcess.binding && freeProcess.binding("util"); } catch (e) { } }(); var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } function arrayPush(array, values) { var index = -1, length = values.length, offset2 = array.length; while (++index < length) { array[offset2 + index] = values[index]; } return array; } function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } function baseUnary(func) { return function(value) { return func(value); }; } function cacheHas(cache, key) { return cache.has(key); } function getValue(object, key) { return object == null ? void 0 : object[key]; } function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } var arrayProto = Array.prototype; var funcProto = Function.prototype; var objectProto = Object.prototype; var coreJsData = root["__core-js_shared__"]; var funcToString = funcProto.toString; var hasOwnProperty = objectProto.hasOwnProperty; var maskSrcKey = function() { var uid2 = /[^.]+\$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); return uid2 ? "Symbol(src)_1." + uid2 : ""; }(); var nativeObjectToString = objectProto.toString; var reIsNative = RegExp( "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, "\$1.*?") + "\$" ); var Buffer2 = moduleExports ? root.Buffer : void 0; var Symbol2 = root.Symbol; var Uint8Array2 = root.Uint8Array; var propertyIsEnumerable = objectProto.propertyIsEnumerable; var splice = arrayProto.splice; var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0; var nativeGetSymbols = Object.getOwnPropertySymbols; var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; var nativeKeys = overArg(Object.keys, Object); var DataView = getNative(root, "DataView"); var Map = getNative(root, "Map"); var Promise2 = getNative(root, "Promise"); var Set2 = getNative(root, "Set"); var WeakMap = getNative(root, "WeakMap"); var nativeCreate = getNative(Object, "create"); var dataViewCtorString = toSource(DataView); var mapCtorString = toSource(Map); var promiseCtorString = toSource(Promise2); var setCtorString = toSource(Set2); var weakMapCtorString = toSource(WeakMap); var symbolProto = Symbol2 ? Symbol2.prototype : void 0; var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? void 0 : result; } return hasOwnProperty.call(data, key) ? data[key] : void 0; } function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); } function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value; return this; } Hash.prototype.clear = hashClear; Hash.prototype["delete"] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function listCacheClear() { this.__data__ = []; this.size = 0; } function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? void 0 : data[index][1]; } function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } ListCache.prototype.clear = listCacheClear; ListCache.prototype["delete"] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function mapCacheClear() { this.size = 0; this.__data__ = { "hash": new Hash(), "map": new (Map || ListCache)(), "string": new Hash() }; } function mapCacheDelete(key) { var result = getMapData(this, key)["delete"](key); this.size -= result ? 1 : 0; return result; } function mapCacheGet(key) { return getMapData(this, key).get(key); } function mapCacheHas(key) { return getMapData(this, key).has(key); } function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } MapCache.prototype.clear = mapCacheClear; MapCache.prototype["delete"] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache(); while (++index < length) { this.add(values[index]); } } function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } function setCacheHas(value) { return this.__data__.has(value); } SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } function stackClear() { this.__data__ = new ListCache(); this.size = 0; } function stackDelete(key) { var data = this.__data__, result = data["delete"](key); this.size = data.size; return result; } function stackGet(key) { return this.__data__.get(key); } function stackHas(key) { return this.__data__.has(key); } function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } Stack.prototype.clear = stackClear; Stack.prototype["delete"] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; function arrayLikeKeys(value, inherited) { var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable \`arguments.length\` in strict mode. (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. isIndex(key, length)))) { result.push(key); } } return result; } function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray2(object) ? result : arrayPush(result, symbolsFunc(object)); } function baseGetTag(value) { if (value == null) { return value === void 0 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); } function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack()); return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack()); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } function baseIsNative(value) { if (!isObject2(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != "constructor") { result.push(key); } } return result; } function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0; stack.set(array, other); stack.set(other, array); while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== void 0) { if (compared) { continue; } result = false; break; } if (seen) { if (!arraySome(other, function(othValue2, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { result = false; break; } } stack["delete"](array); stack["delete"](other); return result; } function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: return object == other + ""; case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack["delete"](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { result = false; break; } skipCtor || (skipCtor = key == "constructor"); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { result = false; } } stack["delete"](object); stack["delete"](other); return result; } function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; } function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : void 0; } function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = void 0; var unmasked = true; } catch (e) { } var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; var getTag = baseGetTag; if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : ""; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } function isKeyable(value) { var type = typeof value; return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; } function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; return value === proto; } function objectToString(value) { return nativeObjectToString.call(value); } function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) { } try { return func + ""; } catch (e) { } } return ""; } function eq(value, other) { return value === other || value !== value && other !== other; } var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); }; var isArray2 = Array.isArray; function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } var isBuffer = nativeIsBuffer || stubFalse; function isEqual(value, other) { return baseIsEqual(value, other); } function isFunction(value) { if (!isObject2(value)) { return false; } var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } function isLength(value) { return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } function isObject2(value) { var type = typeof value; return value != null && (type == "object" || type == "function"); } function isObjectLike(value) { return value != null && typeof value == "object"; } var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } function stubArray() { return []; } function stubFalse() { return false; } module2.exports = isEqual; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/DeltaInsertOp.js var require_DeltaInsertOp = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/DeltaInsertOp.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod2) { return mod2 && mod2.__esModule ? mod2 : { "default": mod2 }; }; Object.defineProperty(exports2, "__esModule", { value: true }); var value_types_1 = require_value_types(); var InsertData_1 = require_InsertData(); var lodash_isequal_1 = __importDefault(require_lodash()); var DeltaInsertOp = function() { function DeltaInsertOp2(insertVal, attrs) { if (typeof insertVal === "string") { insertVal = new InsertData_1.InsertDataQuill(value_types_1.DataType.Text, insertVal + ""); } this.insert = insertVal; this.attributes = attrs || {}; } DeltaInsertOp2.createNewLineOp = function() { return new DeltaInsertOp2(value_types_1.NewLine); }; DeltaInsertOp2.prototype.isContainerBlock = function() { return this.isBlockquote() || this.isList() || this.isTable() || this.isCodeBlock() || this.isHeader() || this.isBlockAttribute() || this.isCustomTextBlock(); }; DeltaInsertOp2.prototype.isBlockAttribute = function() { var attrs = this.attributes; return !!(attrs.align || attrs.direction || attrs.indent); }; DeltaInsertOp2.prototype.isBlockquote = function() { return !!this.attributes.blockquote; }; DeltaInsertOp2.prototype.isHeader = function() { return !!this.attributes.header; }; DeltaInsertOp2.prototype.isTable = function() { return !!this.attributes.table; }; DeltaInsertOp2.prototype.isSameHeaderAs = function(op) { return op.attributes.header === this.attributes.header && this.isHeader(); }; DeltaInsertOp2.prototype.hasSameAdiAs = function(op) { return this.attributes.align === op.attributes.align && this.attributes.direction === op.attributes.direction && this.attributes.indent === op.attributes.indent; }; DeltaInsertOp2.prototype.hasSameIndentationAs = function(op) { return this.attributes.indent === op.attributes.indent; }; DeltaInsertOp2.prototype.hasSameAttr = function(op) { return lodash_isequal_1.default(this.attributes, op.attributes); }; DeltaInsertOp2.prototype.hasHigherIndentThan = function(op) { return (Number(this.attributes.indent) || 0) > (Number(op.attributes.indent) || 0); }; DeltaInsertOp2.prototype.isInline = function() { return !(this.isContainerBlock() || this.isVideo() || this.isCustomEmbedBlock()); }; DeltaInsertOp2.prototype.isCodeBlock = function() { return !!this.attributes["code-block"]; }; DeltaInsertOp2.prototype.hasSameLangAs = function(op) { return this.attributes["code-block"] === op.attributes["code-block"]; }; DeltaInsertOp2.prototype.isJustNewline = function() { return this.insert.value === value_types_1.NewLine; }; DeltaInsertOp2.prototype.isList = function() { return this.isOrderedList() || this.isBulletList() || this.isCheckedList() || this.isUncheckedList(); }; DeltaInsertOp2.prototype.isOrderedList = function() { return this.attributes.list === value_types_1.ListType.Ordered; }; DeltaInsertOp2.prototype.isBulletList = function() { return this.attributes.list === value_types_1.ListType.Bullet; }; DeltaInsertOp2.prototype.isCheckedList = function() { return this.attributes.list === value_types_1.ListType.Checked; }; DeltaInsertOp2.prototype.isUncheckedList = function() { return this.attributes.list === value_types_1.ListType.Unchecked; }; DeltaInsertOp2.prototype.isACheckList = function() { return this.attributes.list == value_types_1.ListType.Unchecked || this.attributes.list === value_types_1.ListType.Checked; }; DeltaInsertOp2.prototype.isSameListAs = function(op) { return !!op.attributes.list && (this.attributes.list === op.attributes.list || op.isACheckList() && this.isACheckList()); }; DeltaInsertOp2.prototype.isSameTableRowAs = function(op) { return !!op.isTable() && this.isTable() && this.attributes.table === op.attributes.table; }; DeltaInsertOp2.prototype.isText = function() { return this.insert.type === value_types_1.DataType.Text; }; DeltaInsertOp2.prototype.isImage = function() { return this.insert.type === value_types_1.DataType.Image; }; DeltaInsertOp2.prototype.isFormula = function() { return this.insert.type === value_types_1.DataType.Formula; }; DeltaInsertOp2.prototype.isVideo = function() { return this.insert.type === value_types_1.DataType.Video; }; DeltaInsertOp2.prototype.isLink = function() { return this.isText() && !!this.attributes.link; }; DeltaInsertOp2.prototype.isCustomEmbed = function() { return this.insert instanceof InsertData_1.InsertDataCustom; }; DeltaInsertOp2.prototype.isCustomEmbedBlock = function() { return this.isCustomEmbed() && !!this.attributes.renderAsBlock; }; DeltaInsertOp2.prototype.isCustomTextBlock = function() { return this.isText() && !!this.attributes.renderAsBlock; }; DeltaInsertOp2.prototype.isMentions = function() { return this.isText() && !!this.attributes.mentions; }; return DeltaInsertOp2; }(); exports2.DeltaInsertOp = DeltaInsertOp; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/mentions/MentionSanitizer.js var require_MentionSanitizer = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/mentions/MentionSanitizer.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var OpAttributeSanitizer_1 = require_OpAttributeSanitizer(); var MentionSanitizer = function() { function MentionSanitizer2() { } MentionSanitizer2.sanitize = function(dirtyObj, sanitizeOptions) { var cleanObj = {}; if (!dirtyObj || typeof dirtyObj !== "object") { return cleanObj; } if (dirtyObj.class && MentionSanitizer2.IsValidClass(dirtyObj.class)) { cleanObj.class = dirtyObj.class; } if (dirtyObj.id && MentionSanitizer2.IsValidId(dirtyObj.id)) { cleanObj.id = dirtyObj.id; } if (MentionSanitizer2.IsValidTarget(dirtyObj.target + "")) { cleanObj.target = dirtyObj.target; } if (dirtyObj.avatar) { cleanObj.avatar = OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(dirtyObj.avatar + "", sanitizeOptions); } if (dirtyObj["end-point"]) { cleanObj["end-point"] = OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(dirtyObj["end-point"] + "", sanitizeOptions); } if (dirtyObj.slug) { cleanObj.slug = dirtyObj.slug + ""; } return cleanObj; }; MentionSanitizer2.IsValidClass = function(classAttr) { return !!classAttr.match(/^[a-zA-Z0-9_\\-]{1,500}\$/i); }; MentionSanitizer2.IsValidId = function(idAttr) { return !!idAttr.match(/^[a-zA-Z0-9_\\-\\:\\.]{1,500}\$/i); }; MentionSanitizer2.IsValidTarget = function(target) { return ["_self", "_blank", "_parent", "_top"].indexOf(target) > -1; }; return MentionSanitizer2; }(); exports2.MentionSanitizer = MentionSanitizer; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/url.js var require_url = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/url.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function sanitize(str) { var val = str; val = val.replace(/^\\s*/gm, ""); var whiteList = /^((https?|s?ftp|file|blob|mailto|tel):|#|\\/|data:image\\/)/; if (whiteList.test(val)) { return val; } return "unsafe:" + val; } exports2.sanitize = sanitize; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/funcs-html.js var require_funcs_html = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/funcs-html.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var EncodeTarget; (function(EncodeTarget2) { EncodeTarget2[EncodeTarget2["Html"] = 0] = "Html"; EncodeTarget2[EncodeTarget2["Url"] = 1] = "Url"; })(EncodeTarget || (EncodeTarget = {})); function makeStartTag(tag, attrs) { if (attrs === void 0) { attrs = void 0; } if (!tag) { return ""; } var attrsStr = ""; if (attrs) { var arrAttrs = [].concat(attrs); attrsStr = arrAttrs.map(function(attr) { return attr.key + (attr.value ? '="' + attr.value + '"' : ""); }).join(" "); } var closing = ">"; if (tag === "img" || tag === "br") { closing = "/>"; } return attrsStr ? "<" + tag + " " + attrsStr + closing : "<" + tag + closing; } exports2.makeStartTag = makeStartTag; function makeEndTag(tag) { if (tag === void 0) { tag = ""; } return tag && "" || ""; } exports2.makeEndTag = makeEndTag; function decodeHtml(str) { return encodeMappings(EncodeTarget.Html).reduce(decodeMapping, str); } exports2.decodeHtml = decodeHtml; function encodeHtml(str, preventDoubleEncoding) { if (preventDoubleEncoding === void 0) { preventDoubleEncoding = true; } if (preventDoubleEncoding) { str = decodeHtml(str); } return encodeMappings(EncodeTarget.Html).reduce(encodeMapping, str); } exports2.encodeHtml = encodeHtml; function encodeLink(str) { var linkMaps = encodeMappings(EncodeTarget.Url); var decoded = linkMaps.reduce(decodeMapping, str); return linkMaps.reduce(encodeMapping, decoded); } exports2.encodeLink = encodeLink; function encodeMappings(mtype) { var maps = [ ["&", "&"], ["<", "<"], [">", ">"], ['"', """], ["'", "'"], ["\\\\/", "/"], ["\\\\(", "("], ["\\\\)", ")"] ]; if (mtype === EncodeTarget.Html) { return maps.filter(function(_a) { var v = _a[0], _ = _a[1]; return v.indexOf("(") === -1 && v.indexOf(")") === -1; }); } else { return maps.filter(function(_a) { var v = _a[0], _ = _a[1]; return v.indexOf("/") === -1; }); } } function encodeMapping(str, mapping) { return str.replace(new RegExp(mapping[0], "g"), mapping[1]); } function decodeMapping(str, mapping) { return str.replace(new RegExp(mapping[1], "g"), mapping[0].replace("\\\\", "")); } } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/array.js var require_array = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/array.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function preferSecond(arr2) { if (arr2.length === 0) { return null; } return arr2.length >= 2 ? arr2[1] : arr2[0]; } exports2.preferSecond = preferSecond; function flatten(arr2) { return arr2.reduce(function(pv, v) { return pv.concat(Array.isArray(v) ? flatten(v) : v); }, []); } exports2.flatten = flatten; function find(arr2, predicate) { if (Array.prototype.find) { return Array.prototype.find.call(arr2, predicate); } for (var i = 0; i < arr2.length; i++) { if (predicate(arr2[i])) return arr2[i]; } return void 0; } exports2.find = find; function groupConsecutiveElementsWhile(arr2, predicate) { var groups = []; var currElm, currGroup; for (var i = 0; i < arr2.length; i++) { currElm = arr2[i]; if (i > 0 && predicate(currElm, arr2[i - 1])) { currGroup = groups[groups.length - 1]; currGroup.push(currElm); } else { groups.push([currElm]); } } return groups.map(function(g) { return g.length === 1 ? g[0] : g; }); } exports2.groupConsecutiveElementsWhile = groupConsecutiveElementsWhile; function sliceFromReverseWhile(arr2, startIndex, predicate) { var result = { elements: [], sliceStartsAt: -1 }; for (var i = startIndex; i >= 0; i--) { if (!predicate(arr2[i])) { break; } result.sliceStartsAt = i; result.elements.unshift(arr2[i]); } return result; } exports2.sliceFromReverseWhile = sliceFromReverseWhile; function intersperse(arr2, item) { return arr2.reduce(function(pv, v, index) { pv.push(v); if (index < arr2.length - 1) { pv.push(item); } return pv; }, []); } exports2.intersperse = intersperse; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/OpAttributeSanitizer.js var require_OpAttributeSanitizer = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/OpAttributeSanitizer.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var value_types_1 = require_value_types(); var MentionSanitizer_1 = require_MentionSanitizer(); var url = __importStar(require_url()); var funcs_html_1 = require_funcs_html(); var array_1 = require_array(); var OpAttributeSanitizer = function() { function OpAttributeSanitizer2() { } OpAttributeSanitizer2.sanitize = function(dirtyAttrs, sanitizeOptions) { var cleanAttrs = {}; if (!dirtyAttrs || typeof dirtyAttrs !== "object") { return cleanAttrs; } var booleanAttrs = [ "bold", "italic", "underline", "strike", "code", "blockquote", "code-block", "renderAsBlock" ]; var colorAttrs = ["background", "color"]; var font = dirtyAttrs.font, size = dirtyAttrs.size, link = dirtyAttrs.link, script = dirtyAttrs.script, list = dirtyAttrs.list, header = dirtyAttrs.header, align = dirtyAttrs.align, direction = dirtyAttrs.direction, indent = dirtyAttrs.indent, mentions = dirtyAttrs.mentions, mention = dirtyAttrs.mention, width = dirtyAttrs.width, target = dirtyAttrs.target, rel = dirtyAttrs.rel; var codeBlock = dirtyAttrs["code-block"]; var sanitizedAttrs = booleanAttrs.concat(colorAttrs, [ "font", "size", "link", "script", "list", "header", "align", "direction", "indent", "mentions", "mention", "width", "target", "rel", "code-block" ]); booleanAttrs.forEach(function(prop) { var v = dirtyAttrs[prop]; if (v) { cleanAttrs[prop] = !!v; } }); colorAttrs.forEach(function(prop) { var val = dirtyAttrs[prop]; if (val && (OpAttributeSanitizer2.IsValidHexColor(val + "") || OpAttributeSanitizer2.IsValidColorLiteral(val + "") || OpAttributeSanitizer2.IsValidRGBColor(val + ""))) { cleanAttrs[prop] = val; } }); if (font && OpAttributeSanitizer2.IsValidFontName(font + "")) { cleanAttrs.font = font; } if (size && OpAttributeSanitizer2.IsValidSize(size + "")) { cleanAttrs.size = size; } if (width && OpAttributeSanitizer2.IsValidWidth(width + "")) { cleanAttrs.width = width; } if (link) { cleanAttrs.link = OpAttributeSanitizer2.sanitizeLinkUsingOptions(link + "", sanitizeOptions); } if (target && OpAttributeSanitizer2.isValidTarget(target)) { cleanAttrs.target = target; } if (rel && OpAttributeSanitizer2.IsValidRel(rel)) { cleanAttrs.rel = rel; } if (codeBlock) { if (OpAttributeSanitizer2.IsValidLang(codeBlock)) { cleanAttrs["code-block"] = codeBlock; } else { cleanAttrs["code-block"] = !!codeBlock; } } if (script === value_types_1.ScriptType.Sub || value_types_1.ScriptType.Super === script) { cleanAttrs.script = script; } if (list === value_types_1.ListType.Bullet || list === value_types_1.ListType.Ordered || list === value_types_1.ListType.Checked || list === value_types_1.ListType.Unchecked) { cleanAttrs.list = list; } if (Number(header)) { cleanAttrs.header = Math.min(Number(header), 6); } if (array_1.find([value_types_1.AlignType.Center, value_types_1.AlignType.Right, value_types_1.AlignType.Justify, value_types_1.AlignType.Left], function(a) { return a === align; })) { cleanAttrs.align = align; } if (direction === value_types_1.DirectionType.Rtl) { cleanAttrs.direction = direction; } if (indent && Number(indent)) { cleanAttrs.indent = Math.min(Number(indent), 30); } if (mentions && mention) { var sanitizedMention = MentionSanitizer_1.MentionSanitizer.sanitize(mention, sanitizeOptions); if (Object.keys(sanitizedMention).length > 0) { cleanAttrs.mentions = !!mentions; cleanAttrs.mention = mention; } } return Object.keys(dirtyAttrs).reduce(function(cleaned, k) { if (sanitizedAttrs.indexOf(k) === -1) { cleaned[k] = dirtyAttrs[k]; } return cleaned; }, cleanAttrs); }; OpAttributeSanitizer2.sanitizeLinkUsingOptions = function(link, options) { var sanitizerFn = function() { return void 0; }; if (options && typeof options.urlSanitizer === "function") { sanitizerFn = options.urlSanitizer; } var result = sanitizerFn(link); return typeof result === "string" ? result : funcs_html_1.encodeLink(url.sanitize(link)); }; OpAttributeSanitizer2.IsValidHexColor = function(colorStr) { return !!colorStr.match(/^#([0-9A-F]{6}|[0-9A-F]{3})\$/i); }; OpAttributeSanitizer2.IsValidColorLiteral = function(colorStr) { return !!colorStr.match(/^[a-z]{1,50}\$/i); }; OpAttributeSanitizer2.IsValidRGBColor = function(colorStr) { var re = /^rgb\\(((0|25[0-5]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),\\s*){2}(0|25[0-5]|2[0-4]\\d|1\\d\\d|0?\\d?\\d)\\)\$/i; return !!colorStr.match(re); }; OpAttributeSanitizer2.IsValidFontName = function(fontName) { return !!fontName.match(/^[a-z\\s0-9\\- ]{1,30}\$/i); }; OpAttributeSanitizer2.IsValidSize = function(size) { return !!size.match(/^[a-z0-9\\-]{1,20}\$/i); }; OpAttributeSanitizer2.IsValidWidth = function(width) { return !!width.match(/^[0-9]*(px|em|%)?\$/); }; OpAttributeSanitizer2.isValidTarget = function(target) { return !!target.match(/^[_a-zA-Z0-9\\-]{1,50}\$/); }; OpAttributeSanitizer2.IsValidRel = function(relStr) { return !!relStr.match(/^[a-zA-Z\\s\\-]{1,250}\$/i); }; OpAttributeSanitizer2.IsValidLang = function(lang) { if (typeof lang === "boolean") { return true; } return !!lang.match(/^[a-zA-Z\\s\\-\\\\\\/\\+]{1,50}\$/i); }; return OpAttributeSanitizer2; }(); exports2.OpAttributeSanitizer = OpAttributeSanitizer; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/string.js var require_string = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/string.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function tokenizeWithNewLines(str) { var NewLine = "\\n"; if (str === NewLine) { return [str]; } var lines = str.split(NewLine); if (lines.length === 1) { return lines; } var lastIndex = lines.length - 1; return lines.reduce(function(pv, line, ind) { if (ind !== lastIndex) { if (line !== "") { pv = pv.concat(line, NewLine); } else { pv.push(NewLine); } } else if (line !== "") { pv.push(line); } return pv; }, []); } exports2.tokenizeWithNewLines = tokenizeWithNewLines; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/object.js var require_object2 = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/object.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function assign(target) { var sources = []; for (var _i = 1; _i < arguments.length; _i++) { sources[_i - 1] = arguments[_i]; } if (target == null) { throw new TypeError("Cannot convert undefined or null to object"); } var to = Object(target); for (var index = 0; index < sources.length; index++) { var nextSource = sources[index]; if (nextSource != null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; } exports2.assign = assign; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpDenormalizer.js var require_InsertOpDenormalizer = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpDenormalizer.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var value_types_1 = require_value_types(); var str = __importStar(require_string()); var obj = __importStar(require_object2()); var InsertOpDenormalizer = function() { function InsertOpDenormalizer2() { } InsertOpDenormalizer2.denormalize = function(op) { if (!op || typeof op !== "object") { return []; } if (typeof op.insert === "object" || op.insert === value_types_1.NewLine) { return [op]; } var newlinedArray = str.tokenizeWithNewLines(op.insert + ""); if (newlinedArray.length === 1) { return [op]; } var nlObj = obj.assign({}, op, { insert: value_types_1.NewLine }); return newlinedArray.map(function(line) { if (line === value_types_1.NewLine) { return nlObj; } return obj.assign({}, op, { insert: line }); }); }; return InsertOpDenormalizer2; }(); exports2.InsertOpDenormalizer = InsertOpDenormalizer; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpsConverter.js var require_InsertOpsConverter = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpsConverter.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var DeltaInsertOp_1 = require_DeltaInsertOp(); var value_types_1 = require_value_types(); var InsertData_1 = require_InsertData(); var OpAttributeSanitizer_1 = require_OpAttributeSanitizer(); var InsertOpDenormalizer_1 = require_InsertOpDenormalizer(); var InsertOpsConverter = function() { function InsertOpsConverter2() { } InsertOpsConverter2.convert = function(deltaOps, options) { if (!Array.isArray(deltaOps)) { return []; } var denormalizedOps = [].concat.apply([], deltaOps.map(InsertOpDenormalizer_1.InsertOpDenormalizer.denormalize)); var results = []; var insertVal, attributes; for (var _i = 0, denormalizedOps_1 = denormalizedOps; _i < denormalizedOps_1.length; _i++) { var op = denormalizedOps_1[_i]; if (!op.insert) { continue; } insertVal = InsertOpsConverter2.convertInsertVal(op.insert, options); if (!insertVal) { continue; } attributes = OpAttributeSanitizer_1.OpAttributeSanitizer.sanitize(op.attributes, options); results.push(new DeltaInsertOp_1.DeltaInsertOp(insertVal, attributes)); } return results; }; InsertOpsConverter2.convertInsertVal = function(insertPropVal, sanitizeOptions) { if (typeof insertPropVal === "string") { return new InsertData_1.InsertDataQuill(value_types_1.DataType.Text, insertPropVal); } if (!insertPropVal || typeof insertPropVal !== "object") { return null; } var keys = Object.keys(insertPropVal); if (!keys.length) { return null; } return value_types_1.DataType.Image in insertPropVal ? new InsertData_1.InsertDataQuill(value_types_1.DataType.Image, OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(insertPropVal[value_types_1.DataType.Image] + "", sanitizeOptions)) : value_types_1.DataType.Video in insertPropVal ? new InsertData_1.InsertDataQuill(value_types_1.DataType.Video, OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(insertPropVal[value_types_1.DataType.Video] + "", sanitizeOptions)) : value_types_1.DataType.Formula in insertPropVal ? new InsertData_1.InsertDataQuill(value_types_1.DataType.Formula, insertPropVal[value_types_1.DataType.Formula]) : new InsertData_1.InsertDataCustom(keys[0], insertPropVal[keys[0]]); }; return InsertOpsConverter2; }(); exports2.InsertOpsConverter = InsertOpsConverter; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/OpToHtmlConverter.js var require_OpToHtmlConverter = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/OpToHtmlConverter.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var funcs_html_1 = require_funcs_html(); var value_types_1 = require_value_types(); var obj = __importStar(require_object2()); var arr2 = __importStar(require_array()); var OpAttributeSanitizer_1 = require_OpAttributeSanitizer(); var DEFAULT_INLINE_FONTS = { serif: "font-family: Georgia, Times New Roman, serif", monospace: "font-family: Monaco, Courier New, monospace" }; exports2.DEFAULT_INLINE_STYLES = { font: function(value) { return DEFAULT_INLINE_FONTS[value] || "font-family:" + value; }, size: { small: "font-size: 0.75em", large: "font-size: 1.5em", huge: "font-size: 2.5em" }, indent: function(value, op) { var indentSize = parseInt(value, 10) * 3; var side = op.attributes["direction"] === "rtl" ? "right" : "left"; return "padding-" + side + ":" + indentSize + "em"; }, direction: function(value, op) { if (value === "rtl") { return "direction:rtl" + (op.attributes["align"] ? "" : "; text-align:inherit"); } else { return void 0; } } }; var OpToHtmlConverter = function() { function OpToHtmlConverter2(op, options) { this.op = op; this.options = obj.assign({}, { classPrefix: "ql", inlineStyles: void 0, encodeHtml: true, listItemTag: "li", paragraphTag: "p" }, options); } OpToHtmlConverter2.prototype.prefixClass = function(className) { if (!this.options.classPrefix) { return className + ""; } return this.options.classPrefix + "-" + className; }; OpToHtmlConverter2.prototype.getHtml = function() { var parts = this.getHtmlParts(); return parts.openingTag + parts.content + parts.closingTag; }; OpToHtmlConverter2.prototype.getHtmlParts = function() { var _this = this; if (this.op.isJustNewline() && !this.op.isContainerBlock()) { return { openingTag: "", closingTag: "", content: value_types_1.NewLine }; } var tags = this.getTags(), attrs = this.getTagAttributes(); if (!tags.length && attrs.length) { tags.push(this.options.textTag || "span"); } var beginTags = [], endTags = []; var imgTag = "img"; var isImageLink = function(tag2) { return tag2 === imgTag && !!_this.op.attributes.link; }; for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { var tag = tags_1[_i]; if (isImageLink(tag)) { beginTags.push(funcs_html_1.makeStartTag("a", this.getLinkAttrs())); } beginTags.push(funcs_html_1.makeStartTag(tag, attrs)); endTags.push(tag === "img" ? "" : funcs_html_1.makeEndTag(tag)); if (isImageLink(tag)) { endTags.push(funcs_html_1.makeEndTag("a")); } attrs = []; } endTags.reverse(); return { openingTag: beginTags.join(""), content: this.getContent(), closingTag: endTags.join("") }; }; OpToHtmlConverter2.prototype.getContent = function() { if (this.op.isContainerBlock()) { return ""; } if (this.op.isMentions()) { return this.op.insert.value; } var content = this.op.isFormula() || this.op.isText() ? this.op.insert.value : ""; return this.options.encodeHtml && funcs_html_1.encodeHtml(content) || content; }; OpToHtmlConverter2.prototype.getCssClasses = function() { var attrs = this.op.attributes; if (this.options.inlineStyles) { return []; } var propsArr = ["indent", "align", "direction", "font", "size"]; if (this.options.allowBackgroundClasses) { propsArr.push("background"); } return (this.getCustomCssClasses() || []).concat(propsArr.filter(function(prop) { return !!attrs[prop]; }).filter(function(prop) { return prop === "background" ? OpAttributeSanitizer_1.OpAttributeSanitizer.IsValidColorLiteral(attrs[prop]) : true; }).map(function(prop) { return prop + "-" + attrs[prop]; }).concat(this.op.isFormula() ? "formula" : []).concat(this.op.isVideo() ? "video" : []).concat(this.op.isImage() ? "image" : []).map(this.prefixClass.bind(this))); }; OpToHtmlConverter2.prototype.getCssStyles = function() { var _this = this; var attrs = this.op.attributes; var propsArr = [["color"]]; if (!!this.options.inlineStyles || !this.options.allowBackgroundClasses) { propsArr.push(["background", "background-color"]); } if (this.options.inlineStyles) { propsArr = propsArr.concat([ ["indent"], ["align", "text-align"], ["direction"], ["font", "font-family"], ["size"] ]); } return (this.getCustomCssStyles() || []).concat(propsArr.filter(function(item) { return !!attrs[item[0]]; }).map(function(item) { var attribute = item[0]; var attrValue = attrs[attribute]; var attributeConverter = _this.options.inlineStyles && _this.options.inlineStyles[attribute] || exports2.DEFAULT_INLINE_STYLES[attribute]; if (typeof attributeConverter === "object") { return attributeConverter[attrValue]; } else if (typeof attributeConverter === "function") { var converterFn = attributeConverter; return converterFn(attrValue, _this.op); } else { return arr2.preferSecond(item) + ":" + attrValue; } })).filter(function(item) { return item !== void 0; }); }; OpToHtmlConverter2.prototype.getTagAttributes = function() { if (this.op.attributes.code && !this.op.isLink()) { return []; } var makeAttr = this.makeAttr.bind(this); var customTagAttributes = this.getCustomTagAttributes(); var customAttr = customTagAttributes ? Object.keys(this.getCustomTagAttributes()).map(function(k) { return makeAttr(k, customTagAttributes[k]); }) : []; var classes = this.getCssClasses(); var tagAttrs = classes.length ? customAttr.concat([makeAttr("class", classes.join(" "))]) : customAttr; if (this.op.isImage()) { this.op.attributes.width && (tagAttrs = tagAttrs.concat(makeAttr("width", this.op.attributes.width))); return tagAttrs.concat(makeAttr("src", this.op.insert.value)); } if (this.op.isACheckList()) { return tagAttrs.concat(makeAttr("data-checked", this.op.isCheckedList() ? "true" : "false")); } if (this.op.isFormula()) { return tagAttrs; } if (this.op.isVideo()) { return tagAttrs.concat(makeAttr("frameborder", "0"), makeAttr("allowfullscreen", "true"), makeAttr("src", this.op.insert.value)); } if (this.op.isMentions()) { var mention = this.op.attributes.mention; if (mention.class) { tagAttrs = tagAttrs.concat(makeAttr("class", mention.class)); } if (mention["end-point"] && mention.slug) { tagAttrs = tagAttrs.concat(makeAttr("href", mention["end-point"] + "/" + mention.slug)); } else { tagAttrs = tagAttrs.concat(makeAttr("href", "about:blank")); } if (mention.target) { tagAttrs = tagAttrs.concat(makeAttr("target", mention.target)); } return tagAttrs; } var styles = this.getCssStyles(); if (styles.length) { tagAttrs.push(makeAttr("style", styles.join(";"))); } if (this.op.isCodeBlock() && typeof this.op.attributes["code-block"] === "string") { return tagAttrs.concat(makeAttr("data-language", this.op.attributes["code-block"])); } if (this.op.isContainerBlock()) { return tagAttrs; } if (this.op.isLink()) { tagAttrs = tagAttrs.concat(this.getLinkAttrs()); } return tagAttrs; }; OpToHtmlConverter2.prototype.makeAttr = function(k, v) { return { key: k, value: v }; }; OpToHtmlConverter2.prototype.getLinkAttrs = function() { var tagAttrs = []; var targetForAll = OpAttributeSanitizer_1.OpAttributeSanitizer.isValidTarget(this.options.linkTarget || "") ? this.options.linkTarget : void 0; var relForAll = OpAttributeSanitizer_1.OpAttributeSanitizer.IsValidRel(this.options.linkRel || "") ? this.options.linkRel : void 0; var target = this.op.attributes.target || targetForAll; var rel = this.op.attributes.rel || relForAll; return tagAttrs.concat(this.makeAttr("href", this.op.attributes.link)).concat(target ? this.makeAttr("target", target) : []).concat(rel ? this.makeAttr("rel", rel) : []); }; OpToHtmlConverter2.prototype.getCustomTag = function(format) { if (this.options.customTag && typeof this.options.customTag === "function") { return this.options.customTag.apply(null, [format, this.op]); } }; OpToHtmlConverter2.prototype.getCustomTagAttributes = function() { if (this.options.customTagAttributes && typeof this.options.customTagAttributes === "function") { return this.options.customTagAttributes.apply(null, [this.op]); } }; OpToHtmlConverter2.prototype.getCustomCssClasses = function() { if (this.options.customCssClasses && typeof this.options.customCssClasses === "function") { var res = this.options.customCssClasses.apply(null, [this.op]); if (res) { return Array.isArray(res) ? res : [res]; } } }; OpToHtmlConverter2.prototype.getCustomCssStyles = function() { if (this.options.customCssStyles && typeof this.options.customCssStyles === "function") { var res = this.options.customCssStyles.apply(null, [this.op]); if (res) { return Array.isArray(res) ? res : [res]; } } }; OpToHtmlConverter2.prototype.getTags = function() { var _this = this; var attrs = this.op.attributes; if (!this.op.isText()) { return [ this.op.isVideo() ? "iframe" : this.op.isImage() ? "img" : "span" ]; } var positionTag = this.options.paragraphTag || "p"; var blocks = [ ["blockquote"], ["code-block", "pre"], ["list", this.options.listItemTag], ["header"], ["align", positionTag], ["direction", positionTag], ["indent", positionTag] ]; for (var _i = 0, blocks_1 = blocks; _i < blocks_1.length; _i++) { var item = blocks_1[_i]; var firstItem = item[0]; if (attrs[firstItem]) { var customTag = this.getCustomTag(firstItem); return customTag ? [customTag] : firstItem === "header" ? ["h" + attrs[firstItem]] : [arr2.preferSecond(item)]; } } if (this.op.isCustomTextBlock()) { var customTag = this.getCustomTag("renderAsBlock"); return customTag ? [customTag] : [positionTag]; } var customTagsMap = Object.keys(attrs).reduce(function(res, it) { var customTag2 = _this.getCustomTag(it); if (customTag2) { res[it] = customTag2; } return res; }, {}); var inlineTags = [ ["link", "a"], ["mentions", "a"], ["script"], ["bold", "strong"], ["italic", "em"], ["strike", "s"], ["underline", "u"], ["code"] ]; return inlineTags.filter(function(item2) { return !!attrs[item2[0]]; }).concat(Object.keys(customTagsMap).filter(function(t) { return !inlineTags.some(function(it) { return it[0] == t; }); }).map(function(t) { return [t, customTagsMap[t]]; })).map(function(item2) { return customTagsMap[item2[0]] ? customTagsMap[item2[0]] : item2[0] === "script" ? attrs[item2[0]] === value_types_1.ScriptType.Sub ? "sub" : "sup" : arr2.preferSecond(item2); }); }; return OpToHtmlConverter2; }(); exports2.OpToHtmlConverter = OpToHtmlConverter; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/group-types.js var require_group_types = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/group-types.js"(exports2) { "use strict"; var __extends = exports2 && exports2.__extends || function() { var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { d.__proto__ = b; } || function(d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports2, "__esModule", { value: true }); var InlineGroup = function() { function InlineGroup2(ops) { this.ops = ops; } return InlineGroup2; }(); exports2.InlineGroup = InlineGroup; var SingleItem = function() { function SingleItem2(op) { this.op = op; } return SingleItem2; }(); var VideoItem = function(_super) { __extends(VideoItem2, _super); function VideoItem2() { return _super !== null && _super.apply(this, arguments) || this; } return VideoItem2; }(SingleItem); exports2.VideoItem = VideoItem; var BlotBlock = function(_super) { __extends(BlotBlock2, _super); function BlotBlock2() { return _super !== null && _super.apply(this, arguments) || this; } return BlotBlock2; }(SingleItem); exports2.BlotBlock = BlotBlock; var BlockGroup = function() { function BlockGroup2(op, ops) { this.op = op; this.ops = ops; } return BlockGroup2; }(); exports2.BlockGroup = BlockGroup; var ListGroup = function() { function ListGroup2(items) { this.items = items; } return ListGroup2; }(); exports2.ListGroup = ListGroup; var ListItem = function() { function ListItem2(item, innerList) { if (innerList === void 0) { innerList = null; } this.item = item; this.innerList = innerList; } return ListItem2; }(); exports2.ListItem = ListItem; var TableGroup = function() { function TableGroup2(rows) { this.rows = rows; } return TableGroup2; }(); exports2.TableGroup = TableGroup; var TableRow = function() { function TableRow2(cells) { this.cells = cells; } return TableRow2; }(); exports2.TableRow = TableRow; var TableCell = function() { function TableCell2(item) { this.item = item; } return TableCell2; }(); exports2.TableCell = TableCell; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/Grouper.js var require_Grouper = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/Grouper.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var DeltaInsertOp_1 = require_DeltaInsertOp(); var array_1 = require_array(); var group_types_1 = require_group_types(); var Grouper = function() { function Grouper2() { } Grouper2.pairOpsWithTheirBlock = function(ops) { var result = []; var canBeInBlock = function(op2) { return !(op2.isJustNewline() || op2.isCustomEmbedBlock() || op2.isVideo() || op2.isContainerBlock()); }; var isInlineData = function(op2) { return op2.isInline(); }; var lastInd = ops.length - 1; var opsSlice; for (var i = lastInd; i >= 0; i--) { var op = ops[i]; if (op.isVideo()) { result.push(new group_types_1.VideoItem(op)); } else if (op.isCustomEmbedBlock()) { result.push(new group_types_1.BlotBlock(op)); } else if (op.isContainerBlock()) { opsSlice = array_1.sliceFromReverseWhile(ops, i - 1, canBeInBlock); result.push(new group_types_1.BlockGroup(op, opsSlice.elements)); i = opsSlice.sliceStartsAt > -1 ? opsSlice.sliceStartsAt : i; } else { opsSlice = array_1.sliceFromReverseWhile(ops, i - 1, isInlineData); result.push(new group_types_1.InlineGroup(opsSlice.elements.concat(op))); i = opsSlice.sliceStartsAt > -1 ? opsSlice.sliceStartsAt : i; } } result.reverse(); return result; }; Grouper2.groupConsecutiveSameStyleBlocks = function(groups, blocksOf) { if (blocksOf === void 0) { blocksOf = { header: true, codeBlocks: true, blockquotes: true, customBlocks: true }; } return array_1.groupConsecutiveElementsWhile(groups, function(g, gPrev) { if (!(g instanceof group_types_1.BlockGroup) || !(gPrev instanceof group_types_1.BlockGroup)) { return false; } return blocksOf.codeBlocks && Grouper2.areBothCodeblocksWithSameLang(g, gPrev) || blocksOf.blockquotes && Grouper2.areBothBlockquotesWithSameAdi(g, gPrev) || blocksOf.header && Grouper2.areBothSameHeadersWithSameAdi(g, gPrev) || blocksOf.customBlocks && Grouper2.areBothCustomBlockWithSameAttr(g, gPrev); }); }; Grouper2.reduceConsecutiveSameStyleBlocksToOne = function(groups) { var newLineOp = DeltaInsertOp_1.DeltaInsertOp.createNewLineOp(); return groups.map(function(elm) { if (!Array.isArray(elm)) { if (elm instanceof group_types_1.BlockGroup && !elm.ops.length) { elm.ops.push(newLineOp); } return elm; } var groupsLastInd = elm.length - 1; elm[0].ops = array_1.flatten(elm.map(function(g, i) { if (!g.ops.length) { return [newLineOp]; } return g.ops.concat(i < groupsLastInd ? [newLineOp] : []); })); return elm[0]; }); }; Grouper2.areBothCodeblocksWithSameLang = function(g1, gOther) { return g1.op.isCodeBlock() && gOther.op.isCodeBlock() && g1.op.hasSameLangAs(gOther.op); }; Grouper2.areBothSameHeadersWithSameAdi = function(g1, gOther) { return g1.op.isSameHeaderAs(gOther.op) && g1.op.hasSameAdiAs(gOther.op); }; Grouper2.areBothBlockquotesWithSameAdi = function(g, gOther) { return g.op.isBlockquote() && gOther.op.isBlockquote() && g.op.hasSameAdiAs(gOther.op); }; Grouper2.areBothCustomBlockWithSameAttr = function(g, gOther) { return g.op.isCustomTextBlock() && gOther.op.isCustomTextBlock() && g.op.hasSameAttr(gOther.op); }; return Grouper2; }(); exports2.Grouper = Grouper; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/ListNester.js var require_ListNester = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/ListNester.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var group_types_1 = require_group_types(); var array_1 = require_array(); var ListNester = function() { function ListNester2() { } ListNester2.prototype.nest = function(groups) { var _this = this; var listBlocked = this.convertListBlocksToListGroups(groups); var groupedByListGroups = this.groupConsecutiveListGroups(listBlocked); var nested = array_1.flatten(groupedByListGroups.map(function(group2) { if (!Array.isArray(group2)) { return group2; } return _this.nestListSection(group2); })); var groupRootLists = array_1.groupConsecutiveElementsWhile(nested, function(curr, prev) { if (!(curr instanceof group_types_1.ListGroup && prev instanceof group_types_1.ListGroup)) { return false; } return curr.items[0].item.op.isSameListAs(prev.items[0].item.op); }); return groupRootLists.map(function(v) { if (!Array.isArray(v)) { return v; } var litems = v.map(function(g) { return g.items; }); return new group_types_1.ListGroup(array_1.flatten(litems)); }); }; ListNester2.prototype.convertListBlocksToListGroups = function(items) { var grouped = array_1.groupConsecutiveElementsWhile(items, function(g, gPrev) { return g instanceof group_types_1.BlockGroup && gPrev instanceof group_types_1.BlockGroup && g.op.isList() && gPrev.op.isList() && g.op.isSameListAs(gPrev.op) && g.op.hasSameIndentationAs(gPrev.op); }); return grouped.map(function(item) { if (!Array.isArray(item)) { if (item instanceof group_types_1.BlockGroup && item.op.isList()) { return new group_types_1.ListGroup([new group_types_1.ListItem(item)]); } return item; } return new group_types_1.ListGroup(item.map(function(g) { return new group_types_1.ListItem(g); })); }); }; ListNester2.prototype.groupConsecutiveListGroups = function(items) { return array_1.groupConsecutiveElementsWhile(items, function(curr, prev) { return curr instanceof group_types_1.ListGroup && prev instanceof group_types_1.ListGroup; }); }; ListNester2.prototype.nestListSection = function(sectionItems) { var _this = this; var indentGroups = this.groupByIndent(sectionItems); Object.keys(indentGroups).map(Number).sort().reverse().forEach(function(indent) { indentGroups[indent].forEach(function(lg) { var idx = sectionItems.indexOf(lg); if (_this.placeUnderParent(lg, sectionItems.slice(0, idx))) { sectionItems.splice(idx, 1); } }); }); return sectionItems; }; ListNester2.prototype.groupByIndent = function(items) { return items.reduce(function(pv, cv) { var indent = cv.items[0].item.op.attributes.indent; if (indent) { pv[indent] = pv[indent] || []; pv[indent].push(cv); } return pv; }, {}); }; ListNester2.prototype.placeUnderParent = function(target, items) { for (var i = items.length - 1; i >= 0; i--) { var elm = items[i]; if (target.items[0].item.op.hasHigherIndentThan(elm.items[0].item.op)) { var parent = elm.items[elm.items.length - 1]; if (parent.innerList) { parent.innerList.items = parent.innerList.items.concat(target.items); } else { parent.innerList = target; } return true; } } return false; }; return ListNester2; }(); exports2.ListNester = ListNester; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/TableGrouper.js var require_TableGrouper = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/TableGrouper.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var group_types_1 = require_group_types(); var array_1 = require_array(); var TableGrouper = function() { function TableGrouper2() { } TableGrouper2.prototype.group = function(groups) { var tableBlocked = this.convertTableBlocksToTableGroups(groups); return tableBlocked; }; TableGrouper2.prototype.convertTableBlocksToTableGroups = function(items) { var _this = this; var grouped = array_1.groupConsecutiveElementsWhile(items, function(g, gPrev) { return g instanceof group_types_1.BlockGroup && gPrev instanceof group_types_1.BlockGroup && g.op.isTable() && gPrev.op.isTable(); }); return grouped.map(function(item) { if (!Array.isArray(item)) { if (item instanceof group_types_1.BlockGroup && item.op.isTable()) { return new group_types_1.TableGroup([new group_types_1.TableRow([new group_types_1.TableCell(item)])]); } return item; } return new group_types_1.TableGroup(_this.convertTableBlocksToTableRows(item)); }); }; TableGrouper2.prototype.convertTableBlocksToTableRows = function(items) { var grouped = array_1.groupConsecutiveElementsWhile(items, function(g, gPrev) { return g instanceof group_types_1.BlockGroup && gPrev instanceof group_types_1.BlockGroup && g.op.isTable() && gPrev.op.isTable() && g.op.isSameTableRowAs(gPrev.op); }); return grouped.map(function(item) { return new group_types_1.TableRow(Array.isArray(item) ? item.map(function(it) { return new group_types_1.TableCell(it); }) : [new group_types_1.TableCell(item)]); }); }; return TableGrouper2; }(); exports2.TableGrouper = TableGrouper; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/QuillDeltaToHtmlConverter.js var require_QuillDeltaToHtmlConverter = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/QuillDeltaToHtmlConverter.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var InsertOpsConverter_1 = require_InsertOpsConverter(); var OpToHtmlConverter_1 = require_OpToHtmlConverter(); var Grouper_1 = require_Grouper(); var group_types_1 = require_group_types(); var ListNester_1 = require_ListNester(); var funcs_html_1 = require_funcs_html(); var obj = __importStar(require_object2()); var value_types_1 = require_value_types(); var TableGrouper_1 = require_TableGrouper(); var BrTag = "
"; var QuillDeltaToHtmlConverter2 = function() { function QuillDeltaToHtmlConverter3(deltaOps, options) { this.rawDeltaOps = []; this.callbacks = {}; this.options = obj.assign({ paragraphTag: "p", textTag: "span", encodeHtml: true, classPrefix: "ql", inlineStyles: false, multiLineBlockquote: true, multiLineHeader: true, multiLineCodeblock: true, multiLineParagraph: true, multiLineCustomBlock: true, allowBackgroundClasses: false, linkTarget: "_blank" }, options, { orderedListTag: "ol", bulletListTag: "ul", listItemTag: "li" }); var inlineStyles; if (!this.options.inlineStyles) { inlineStyles = void 0; } else if (typeof this.options.inlineStyles === "object") { inlineStyles = this.options.inlineStyles; } else { inlineStyles = {}; } this.converterOptions = { encodeHtml: this.options.encodeHtml, classPrefix: this.options.classPrefix, inlineStyles, listItemTag: this.options.listItemTag, paragraphTag: this.options.paragraphTag, textTag: this.options.textTag, linkRel: this.options.linkRel, linkTarget: this.options.linkTarget, allowBackgroundClasses: this.options.allowBackgroundClasses, customTag: this.options.customTag, customTagAttributes: this.options.customTagAttributes, customCssClasses: this.options.customCssClasses, customCssStyles: this.options.customCssStyles }; this.rawDeltaOps = deltaOps; } QuillDeltaToHtmlConverter3.prototype._getListTag = function(op) { return op.isOrderedList() ? this.options.orderedListTag + "" : op.isBulletList() ? this.options.bulletListTag + "" : op.isCheckedList() ? this.options.bulletListTag + "" : op.isUncheckedList() ? this.options.bulletListTag + "" : ""; }; QuillDeltaToHtmlConverter3.prototype.getGroupedOps = function() { var deltaOps = InsertOpsConverter_1.InsertOpsConverter.convert(this.rawDeltaOps, this.options); var pairedOps = Grouper_1.Grouper.pairOpsWithTheirBlock(deltaOps); var groupedSameStyleBlocks = Grouper_1.Grouper.groupConsecutiveSameStyleBlocks(pairedOps, { blockquotes: !!this.options.multiLineBlockquote, header: !!this.options.multiLineHeader, codeBlocks: !!this.options.multiLineCodeblock, customBlocks: !!this.options.multiLineCustomBlock }); var groupedOps = Grouper_1.Grouper.reduceConsecutiveSameStyleBlocksToOne(groupedSameStyleBlocks); var tableGrouper = new TableGrouper_1.TableGrouper(); groupedOps = tableGrouper.group(groupedOps); var listNester = new ListNester_1.ListNester(); return listNester.nest(groupedOps); }; QuillDeltaToHtmlConverter3.prototype.convert = function() { var _this = this; var groups = this.getGroupedOps(); return groups.map(function(group2) { if (group2 instanceof group_types_1.ListGroup) { return _this._renderWithCallbacks(value_types_1.GroupType.List, group2, function() { return _this._renderList(group2); }); } else if (group2 instanceof group_types_1.TableGroup) { return _this._renderWithCallbacks(value_types_1.GroupType.Table, group2, function() { return _this._renderTable(group2); }); } else if (group2 instanceof group_types_1.BlockGroup) { var g = group2; return _this._renderWithCallbacks(value_types_1.GroupType.Block, group2, function() { return _this._renderBlock(g.op, g.ops); }); } else if (group2 instanceof group_types_1.BlotBlock) { return _this._renderCustom(group2.op, null); } else if (group2 instanceof group_types_1.VideoItem) { return _this._renderWithCallbacks(value_types_1.GroupType.Video, group2, function() { var g2 = group2; var converter = new OpToHtmlConverter_1.OpToHtmlConverter(g2.op, _this.converterOptions); return converter.getHtml(); }); } else { return _this._renderWithCallbacks(value_types_1.GroupType.InlineGroup, group2, function() { return _this._renderInlines(group2.ops, true); }); } }).join(""); }; QuillDeltaToHtmlConverter3.prototype._renderWithCallbacks = function(groupType, group2, myRenderFn) { var html = ""; var beforeCb = this.callbacks["beforeRender_cb"]; html = typeof beforeCb === "function" ? beforeCb.apply(null, [groupType, group2]) : ""; if (!html) { html = myRenderFn(); } var afterCb = this.callbacks["afterRender_cb"]; html = typeof afterCb === "function" ? afterCb.apply(null, [groupType, html]) : html; return html; }; QuillDeltaToHtmlConverter3.prototype._renderList = function(list) { var _this = this; var firstItem = list.items[0]; return funcs_html_1.makeStartTag(this._getListTag(firstItem.item.op)) + list.items.map(function(li) { return _this._renderListItem(li); }).join("") + funcs_html_1.makeEndTag(this._getListTag(firstItem.item.op)); }; QuillDeltaToHtmlConverter3.prototype._renderListItem = function(li) { li.item.op.attributes.indent = 0; var converter = new OpToHtmlConverter_1.OpToHtmlConverter(li.item.op, this.converterOptions); var parts = converter.getHtmlParts(); var liElementsHtml = this._renderInlines(li.item.ops, false); return parts.openingTag + liElementsHtml + (li.innerList ? this._renderList(li.innerList) : "") + parts.closingTag; }; QuillDeltaToHtmlConverter3.prototype._renderTable = function(table) { var _this = this; return funcs_html_1.makeStartTag("table") + funcs_html_1.makeStartTag("tbody") + table.rows.map(function(row) { return _this._renderTableRow(row); }).join("") + funcs_html_1.makeEndTag("tbody") + funcs_html_1.makeEndTag("table"); }; QuillDeltaToHtmlConverter3.prototype._renderTableRow = function(row) { var _this = this; return funcs_html_1.makeStartTag("tr") + row.cells.map(function(cell) { return _this._renderTableCell(cell); }).join("") + funcs_html_1.makeEndTag("tr"); }; QuillDeltaToHtmlConverter3.prototype._renderTableCell = function(cell) { var converter = new OpToHtmlConverter_1.OpToHtmlConverter(cell.item.op, this.converterOptions); var parts = converter.getHtmlParts(); var cellElementsHtml = this._renderInlines(cell.item.ops, false); return funcs_html_1.makeStartTag("td", { key: "data-row", value: cell.item.op.attributes.table }) + parts.openingTag + cellElementsHtml + parts.closingTag + funcs_html_1.makeEndTag("td"); }; QuillDeltaToHtmlConverter3.prototype._renderBlock = function(bop, ops) { var _this = this; var converter = new OpToHtmlConverter_1.OpToHtmlConverter(bop, this.converterOptions); var htmlParts = converter.getHtmlParts(); if (bop.isCodeBlock()) { return htmlParts.openingTag + funcs_html_1.encodeHtml(ops.map(function(iop) { return iop.isCustomEmbed() ? _this._renderCustom(iop, bop) : iop.insert.value; }).join("")) + htmlParts.closingTag; } var inlines = ops.map(function(op) { return _this._renderInline(op, bop); }).join(""); return htmlParts.openingTag + (inlines || BrTag) + htmlParts.closingTag; }; QuillDeltaToHtmlConverter3.prototype._renderInlines = function(ops, isInlineGroup) { var _this = this; if (isInlineGroup === void 0) { isInlineGroup = true; } var opsLen = ops.length - 1; var html = ops.map(function(op, i) { if (i > 0 && i === opsLen && op.isJustNewline()) { return ""; } return _this._renderInline(op, null); }).join(""); if (!isInlineGroup) { return html; } var startParaTag = funcs_html_1.makeStartTag(this.options.paragraphTag); var endParaTag = funcs_html_1.makeEndTag(this.options.paragraphTag); if (html === BrTag || this.options.multiLineParagraph) { return startParaTag + html + endParaTag; } return startParaTag + html.split(BrTag).map(function(v) { return v === "" ? BrTag : v; }).join(endParaTag + startParaTag) + endParaTag; }; QuillDeltaToHtmlConverter3.prototype._renderInline = function(op, contextOp) { if (op.isCustomEmbed()) { return this._renderCustom(op, contextOp); } var converter = new OpToHtmlConverter_1.OpToHtmlConverter(op, this.converterOptions); return converter.getHtml().replace(/\\n/g, BrTag); }; QuillDeltaToHtmlConverter3.prototype._renderCustom = function(op, contextOp) { var renderCb = this.callbacks["renderCustomOp_cb"]; if (typeof renderCb === "function") { return renderCb.apply(null, [op, contextOp]); } return ""; }; QuillDeltaToHtmlConverter3.prototype.beforeRender = function(cb) { if (typeof cb === "function") { this.callbacks["beforeRender_cb"] = cb; } }; QuillDeltaToHtmlConverter3.prototype.afterRender = function(cb) { if (typeof cb === "function") { this.callbacks["afterRender_cb"] = cb; } }; QuillDeltaToHtmlConverter3.prototype.renderCustomWith = function(cb) { this.callbacks["renderCustomOp_cb"] = cb; }; return QuillDeltaToHtmlConverter3; }(); exports2.QuillDeltaToHtmlConverter = QuillDeltaToHtmlConverter2; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/main.js var require_main = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/main.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var QuillDeltaToHtmlConverter_1 = require_QuillDeltaToHtmlConverter(); exports2.QuillDeltaToHtmlConverter = QuillDeltaToHtmlConverter_1.QuillDeltaToHtmlConverter; var OpToHtmlConverter_1 = require_OpToHtmlConverter(); exports2.OpToHtmlConverter = OpToHtmlConverter_1.OpToHtmlConverter; var group_types_1 = require_group_types(); exports2.InlineGroup = group_types_1.InlineGroup; exports2.VideoItem = group_types_1.VideoItem; exports2.BlockGroup = group_types_1.BlockGroup; exports2.ListGroup = group_types_1.ListGroup; exports2.ListItem = group_types_1.ListItem; exports2.BlotBlock = group_types_1.BlotBlock; var DeltaInsertOp_1 = require_DeltaInsertOp(); exports2.DeltaInsertOp = DeltaInsertOp_1.DeltaInsertOp; var InsertData_1 = require_InsertData(); exports2.InsertDataQuill = InsertData_1.InsertDataQuill; exports2.InsertDataCustom = InsertData_1.InsertDataCustom; var value_types_1 = require_value_types(); exports2.NewLine = value_types_1.NewLine; exports2.ListType = value_types_1.ListType; exports2.ScriptType = value_types_1.ScriptType; exports2.DirectionType = value_types_1.DirectionType; exports2.AlignType = value_types_1.AlignType; exports2.DataType = value_types_1.DataType; exports2.GroupType = value_types_1.GroupType; } }); // src/utils/typeof.ts var isArray = Array.isArray; var isObject = (val) => val !== null && typeof val === "object"; var isNumber = (val) => !isNaN(parseFloat(val)) && isFinite(val); // src/utils/format/url.ts var URL2 = class { /** 锚 */ hash; /** 基链 */ base; /** 参数对象。结果会格式化\`undefined\`\`null\`\`NaN\`等特殊值,但不会处理数字,以免丢失精度。 */ params = {}; /** 参数链(不含\`?\`) */ get param() { return Object.entries(this.params).reduce((s, d) => { return s += \`\${s ? "&" : ""}\${d[0]}=\${d[1]}\`; }, ""); } /** 提取URL参数 */ constructor(url) { const arr1 = url.split("#"); let str = arr1.shift(); this.hash = arr1.join("#"); (this.hash || url.includes("#")) && (this.hash = \`#\${this.hash}\`); const arr2 = str.split("?"); this.base = arr2.shift(); str = arr2.join("?"); if (str) { str.split("&").forEach((d) => { const arr3 = d.split("="); const key = arr3.shift(); let value = arr3.join("=") || ""; try { if (!isNumber(value)) { value = JSON.parse(value); } } catch { value === "undefined" && (value = void 0); value === "NaN" && (value = NaN); } this.params[key] = value; }); } } sort() { this.params = Object.keys(this.params).sort().reduce((s, d) => { s[d] = this.params[d]; return s; }, {}); } /** 还原url链接 */ toJSON() { return \`\${this.base ? this.param ? this.base + "?" : this.base : ""}\${this.param}\${this.hash || ""}\`; } }; function objUrl(url, obj) { const res = new URL2(url); Object.entries(obj).forEach((d) => { if (d[1] === void 0 || d[1] === null) return; res.params[d[0]] = d[1]; }); return res.toJSON(); } function urlObj(url) { const res = new URL2(url); return res.params; } // src/io/api.ts var import_md5 = __toESM(require_md5()); function jsonCheck(str) { const result = typeof str === "string" ? JSON.parse(str) : str; if (result.code === 0) return result; throw new Error(\`\${result.code} \${result.message}\`, { cause: result.code }); } var APP_KEY = /* @__PURE__ */ ((APP_KEY2) => { APP_KEY2["1d8b6e7d45233436"] = "560c52ccd288fed045859ed18bffd973"; APP_KEY2["c1b107428d337928"] = "ea85624dfcf12d7cc7b2b3a94fac1f2c"; APP_KEY2["07da50c9a0bf829f"] = "25bdede4e1581c836cab73a48790ca6e"; APP_KEY2["7d089525d3611b1c"] = "acd495b248ec528c2eed1e862d393126"; APP_KEY2["9e5ded06c39bf5c4"] = "583e398ed0f980290b5903aba30b4cc4"; APP_KEY2["27eb53fc9058f8c3"] = "c2ed53a74eeefe3cf99fbd01d8c9c375"; APP_KEY2["85eb6835b0a1034e"] = "2ad42749773c441109bdc0191257a664"; APP_KEY2["4409e2ce8ffd12b8"] = "59b43e04ad6965f34319062b478f83dd"; APP_KEY2["37207f2beaebf8d7"] = "e988e794d4d4b6dd43bc0e89d6e90c43"; APP_KEY2["84956560bc028eb7"] = "94aba54af9065f71de72f5508f1cd42e"; APP_KEY2["bb3101000e232e27"] = "36efcfed79309338ced0380abd824ac1"; APP_KEY2["fb06a25c6338edbc"] = "fd10bd177559780c2e4a44f1fa47fa83"; APP_KEY2["iVGUTjsxvpLeuDCf"] = "aHRmhWMLkdeMuILqORnYZocwMBpMEOdt"; APP_KEY2["178cf125136ca8ea"] = "34381a26236dd1171185c0beb042e1c6"; APP_KEY2["57263273bc6b67f6"] = "a0488e488d1567960d3a765e8d129f90"; APP_KEY2["8d23902c1688a798"] = "710f0212e62bd499b8d3ac6e1db9302a"; APP_KEY2["7d336ec01856996b"] = "a1ce6983bc89e20a36c37f40c4f1a0dd"; APP_KEY2["8e16697a1b4f8121"] = "f5dd03b752426f2e623d7badb28d190a"; APP_KEY2["aae92bc66f3edfab"] = "af125a0d5279fd576c1b4418a3e8276d"; APP_KEY2["ae57252b0c09105d"] = "c75875c596a69eb55bd119e74b07cfe3"; APP_KEY2["bca7e84c2d947ac6"] = "60698ba2f68e01ce44738920a0ffe768"; APP_KEY2["cc578d267072c94d"] = "ffb6bb4c4edae2566584dbcacfc6a6ad"; APP_KEY2["cc8617fd6961e070"] = "3131924b941aac971e45189f265262be"; APP_KEY2["YvirImLGlLANCLvM"] = "JNlZNgfNGKZEpaDTkCdPQVXntXhuiJEM"; APP_KEY2["f3bb208b3d081dc8"] = "f7c926f549b9becf1c27644958676a21"; APP_KEY2["4fa4601d1caa8b48"] = "f7c926f549b9becf1c27644958676a21"; APP_KEY2["452d3958f048c02a"] = "f7c926f549b9becf1c27644958676a21"; APP_KEY2["86385cdc024c0f6c"] = "f7c926f549b9becf1c27644958676a21"; APP_KEY2["5256c25b71989747"] = "f7c926f549b9becf1c27644958676a21"; APP_KEY2["e97210393ad42219"] = "f7c926f549b9becf1c27644958676a21"; APP_KEY2["5dce947fe22167f9"] = ""; APP_KEY2["8e9fc618fbd41e28"] = ""; return APP_KEY2; })(APP_KEY || {}); var ApiSign = class { constructor(url, appkey) { this.url = url; this.appkey = appkey; } get ts() { return new Date().getTime(); } /** * URL签名 * @param searchParams 查询参数,会覆盖url原有参数 * @param api 授权api,**授权第三方登录专用** * @returns 签名后的api */ sign(searchParams = {}, api = "") { const url = new URL2(this.url); Object.assign(url.params, searchParams, { ts: this.ts }); delete url.params.sign; api && (this.appkey = "27eb53fc9058f8c3"); const appSecret = this.appSecret; url.params.appkey = this.appkey; url.sort(); url.params.sign = (0, import_md5.default)((api ? \`api=\${decodeURIComponent(api)}\` : url.param) + appSecret); return url.toJSON(); } get appSecret() { switch (this.appkey) { case "f3bb208b3d081dc8": case "4fa4601d1caa8b48": case "452d3958f048c02a": case "86385cdc024c0f6c": case "5256c25b71989747": case "e97210393ad42219": switch (Math.trunc(new Date().getHours() / 4)) { case 0: this.appkey = "f3bb208b3d081dc8"; break; case 1: this.appkey = "4fa4601d1caa8b48"; break; case 2: this.appkey = "452d3958f048c02a"; break; case 3: this.appkey = "86385cdc024c0f6c"; break; case 4: this.appkey = "5256c25b71989747"; break; case 5: this.appkey = "e97210393ad42219"; break; default: break; } break; default: break; } return APP_KEY[this.appkey]; } }; // src/io/urls.ts var _URLS = class { }; var URLS = _URLS; // protocol + // __publicField(URLS, "P_AUTO", "//"); __publicField(URLS, "P_HTTP", "http://"); __publicField(URLS, "P_HTTPS", "https://"); __publicField(URLS, "P_WS", "ws://"); __publicField(URLS, "P_WSS", "wss://"); // domain __publicField(URLS, "D_WWW", "www.bilibili.com"); __publicField(URLS, "D_API", "api.bilibili.com"); __publicField(URLS, "D_APP", "app.bilibili.com"); __publicField(URLS, "D_MANAGER", "manager.bilibili.co"); __publicField(URLS, "D_INTERFACE", "interface.bilibili.com"); __publicField(URLS, "D_PASSPORT", "passport.bilibili.com"); __publicField(URLS, "D_BANGUMI", "bangumi.bilibili.com"); __publicField(URLS, "D_SPACE", "space.bilibili.com"); __publicField(URLS, "D_STATIC_S", "static.hdslb.com"); __publicField(URLS, "D_CHAT", "chat.bilibili.com"); __publicField(URLS, "D_DATA", "data.bilibili.com"); __publicField(URLS, "D_COMMENT", "comment.bilibili.com"); __publicField(URLS, "D_BROADCAST", "broadcast.bilibili.com"); __publicField(URLS, "D_MISAKA_SW", "misaka-sw.bilibili.com"); __publicField(URLS, "D_MEMBER", "member.bilibili.com"); __publicField(URLS, "D_BVC", "bvc.bilivideo.com"); __publicField(URLS, "D_S1", "s1.hdslb.com"); __publicField(URLS, "D_API_GLOBAL", "api.global.bilibili.com"); __publicField(URLS, "D_ACCOUNT", "account.bilibili.com"); __publicField(URLS, "D_INTL", "apiintl.biliapi.net"); __publicField(URLS, "WEBSHOW_LOCS", _URLS.P_AUTO + _URLS.D_API + "/x/web-show/res/locs"); __publicField(URLS, "INDEX_TOP_RCMD", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/index/top/rcmd"); __publicField(URLS, "PAGE_HEADER", _URLS.P_AUTO + _URLS.D_API + "/x/web-show/page/header"); __publicField(URLS, "SEASON_RANK_LIST", _URLS.P_AUTO + _URLS.D_API + "/pgc/season/rank/web/list"); __publicField(URLS, "VIDEO", _URLS.P_AUTO + _URLS.D_STATIC_S + "/js/video.min.js"); __publicField(URLS, "JQUERY", _URLS.P_AUTO + _URLS.D_STATIC_S + "/js/jquery.min.js"); __publicField(URLS, "ARTICLE_CARDS", _URLS.P_AUTO + _URLS.D_API + "/x/article/cards"); __publicField(URLS, "VIEW_DETAIL", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/view/detail"); __publicField(URLS, "VIEW", _URLS.P_AUTO + _URLS.D_API + "/view"); __publicField(URLS, "X_VIEW", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/view"); __publicField(URLS, "PAGE_LIST", _URLS.P_AUTO + _URLS.D_API + "/x/player/pagelist"); __publicField(URLS, "TAG_INFO", _URLS.P_AUTO + _URLS.D_API + "/x/tag/info"); __publicField(URLS, "TAG_TOP", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/tag/top"); __publicField(URLS, "BANGUMI_SEASON", _URLS.P_AUTO + _URLS.D_BANGUMI + "/view/web_api/season"); __publicField(URLS, "SEASON_STATUS", _URLS.P_AUTO + _URLS.D_API + "/pgc/view/web/season/user/status"); __publicField(URLS, "SEASON_SECTION", _URLS.P_AUTO + _URLS.D_API + "/pgc/web/season/section"); __publicField(URLS, "GLOBAL_OGV_VIEW", _URLS.P_AUTO + _URLS.D_API_GLOBAL + "/intl/gateway/v2/ogv/view/app/season"); __publicField(URLS, "GLOBAL_OGV_PLAYURL", _URLS.P_AUTO + _URLS.D_API_GLOBAL + "/intl/gateway/v2/ogv/playurl"); __publicField(URLS, "APP_PGC_PLAYURL", _URLS.P_AUTO + _URLS.D_API + "/pgc/player/api/playurl"); __publicField(URLS, "ACCOUNT_GETCARDBYMID", _URLS.P_AUTO + _URLS.D_ACCOUNT + "/api/member/getCardByMid"); __publicField(URLS, "LOGIN_APP_THIRD", _URLS.P_AUTO + _URLS.D_PASSPORT + "/login/app/third"); __publicField(URLS, "PLAYER", _URLS.P_AUTO + _URLS.D_API + "/x/player/v2"); __publicField(URLS, "PLAYURL_PROJ", _URLS.P_AUTO + _URLS.D_APP + "/v2/playurlproj"); __publicField(URLS, "PGC_PLAYURL_PROJ", _URLS.P_AUTO + _URLS.D_API + "/pgc/player/api/playurlproj"); __publicField(URLS, "PGC_PLAYURL_TV", _URLS.P_AUTO + _URLS.D_API + "/pgc/player/api/playurltv"); __publicField(URLS, "UGC_PLAYURL_TV", _URLS.P_AUTO + _URLS.D_API + "/x/tv/ugc/playurl"); __publicField(URLS, "PGC_PLAYURL", _URLS.P_AUTO + _URLS.D_API + "/pgc/player/web/playurl"); __publicField(URLS, "PLAYURL", _URLS.P_AUTO + _URLS.D_API + "/x/player/playurl"); __publicField(URLS, "INTL_PLAYURL", _URLS.P_AUTO + _URLS.D_APP + "/x/intl/playurl"); __publicField(URLS, "INTL_OGV_PLAYURL", _URLS.P_AUTO + _URLS.D_INTL + "/intl/gateway/ogv/player/api/playurl"); __publicField(URLS, "PLAYURL_INTERFACE", _URLS.P_AUTO + _URLS.D_INTERFACE + "/v2/playurl"); __publicField(URLS, "PLAYURL_BANGUMI", _URLS.P_AUTO + _URLS.D_BANGUMI + "/player/web_api/v2/playurl"); __publicField(URLS, "LIKE", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/archive/like"); __publicField(URLS, "HAS_LIKE", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/archive/has/like"); __publicField(URLS, "DM_WEB_VIEW", _URLS.P_AUTO + _URLS.D_API + "/x/v2/dm/web/view"); __publicField(URLS, "DM_WEB_SEG_SO", _URLS.P_AUTO + _URLS.D_API + "/x/v2/dm/web/seg.so"); __publicField(URLS, "STAT", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/archive/stat"); __publicField(URLS, "SLIDE_SHOW", _URLS.P_AUTO + _URLS.D_API + "/pgc/operation/api/slideshow"); __publicField(URLS, "SEARCH_SQUARE", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/search/square"); __publicField(URLS, "SPACE_ARC", _URLS.P_AUTO + _URLS.D_API + "/x/space/wbi/arc/search"); __publicField(URLS, "NEWLIST", _URLS.P_AUTO + _URLS.D_API + "/x/web-interface/newlist"); // src/io/api-article-cards.ts async function apiArticleCards(data) { const arr2 = []; if (isArray(data)) { arr2.push(...data); } else { Object.entries(data).forEach((d) => { if (d[1]) { (isArray(d[1]) ? d[1] : [d[1]]).forEach((t) => arr2.push(d[0] + t)); } }); } if (!arr2.length) throw new Error("输入参数不能为空!"); const response = await fetch(objUrl(URLS.ARTICLE_CARDS, { ids: arr2.join(",") })); const json = await response.json(); return jsonCheck(json).data; } // src/utils/format/integer.ts function integerFormat(num, byte = 2) { return num < 10 ** byte ? (Array(byte).join("0") + num).slice(-1 * byte) : num; } // src/utils/format/time.ts function timeFormat(time = new Date().getTime(), type) { const date = new Date(time); const arr2 = date.toLocaleString().split(" "); const day = arr2[0].split("/"); day[1] = integerFormat(day[1], 2); day[2] = integerFormat(day[2], 2); return type ? day.join("-") + " " + arr2[1] : arr2[1]; } // src/utils/debug.ts var group = { /** 分组层次 */ i: 0, /** 分组栈 */ call: [] }; function debug(...data) { group.call.push(console.log.bind(console, \`%c[\${timeFormat()}]\`, "color: blue;", ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; } debug.assert = function(condition, ...data) { group.call.push(console.assert.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.clear = function() { group.i = 0; group.call = []; setTimeout(console.clear.bind(console)); return debug; }; debug.debug = function(...data) { group.call.push(console.debug.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.error = function(...data) { group.call.push(console.error.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.group = function(...data) { group.i++; group.call.push(console.group.bind(console, \`[\${timeFormat()}]\`, ...arguments)); return debug; }; debug.groupCollapsed = function(...data) { group.i++; group.call.push(console.groupCollapsed.bind(console, \`[\${timeFormat()}]\`, ...arguments)); return debug; }; debug.groupEnd = function() { if (group.i) { group.i--; group.call.push(console.groupEnd.bind(console)); !group.i && (group.call.push(() => group.call = []), group.call.forEach((d) => setTimeout(d))); } return debug; }; debug.info = function(...data) { group.call.push(console.info.bind(console, \`%c[\${timeFormat()}]\`, "color: blue;", ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.log = function(...data) { group.call.push(console.log.bind(console, \`%c[\${timeFormat()}]\`, "color: blue;", ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.table = function(tabularData, properties) { group.call.push(console.table.bind(console, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.time = function(label) { console.time(label); return debug; }; debug.timeEnd = function(label) { console.timeEnd(label); return debug; }; debug.timeLog = function(label, ...data) { console.timeLog(label, \`[\${timeFormat()}]\`, ...data); return debug; }; debug.trace = function(...data) { group.call.push(console.trace.bind(console, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.warn = function(...data) { group.call.push(console.warn.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; // src/utils/poll.ts function poll(check, callback, delay = 100, stop = 180) { let timer = setInterval(() => { const d = check(); if (d) { clearInterval(timer); callback(d); } }, delay); stop && setTimeout(() => clearInterval(timer), stop * 1e3); } // src/core/observer.ts var nodelist = []; var observe = new MutationObserver(async (d) => d.forEach((d2) => { d2.addedNodes[0] && nodelist.forEach((f) => { try { f(d2.addedNodes[0]); } catch (e) { debug.error("MutationObserver", e); } }); })); observe.observe(document, { childList: true, subtree: true }); function observerAddedNodes(callback) { try { if (typeof callback === "function") nodelist.push(callback); return nodelist.length - 1; } catch (e) { debug.error(e); } } var switchlist = []; function switchVideo(callback) { try { if (typeof callback === "function") switchlist.push(callback); } catch (e) { debug.error("switchVideo", e); } } observerAddedNodes((node) => { if (/video-state-pause/.test(node.className)) { switchlist.forEach(async (d) => { try { d(); } catch (e) { debug.error(d); } }); } }); // src/io/api-pgc-slideshow.ts async function apiPgcSlideShow(position_id) { const response = await fetch(objUrl(URLS.SLIDE_SHOW, { position_id })); const json = await response.json(); return jsonCheck(json).result; } // src/io/api-search-square.ts async function apiSearchSquare(limit = 10) { const response = await fetch(objUrl(URLS.SEARCH_SQUARE, { limit })); const json = await response.json(); return jsonCheck(json).data.trending.list; } // src/utils/abv.ts var Abv = class { base58Table = "fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF"; digitMap = [11, 10, 3, 8, 4, 6]; xor = 177451812; add = 8728348608; bvidTemplate = ["B", "V", 1, "", "", 4, "", 1, "", 7, "", ""]; table = {}; constructor() { for (let i = 0; i < 58; i++) this.table[this.base58Table[i]] = i; } /** * av/BV互转 * @param input av或BV,可带av/BV前缀 * @returns 转化结果 */ check(input) { if (/^[aA][vV][0-9]+\$/.test(String(input)) || /^\\d+\$/.test(String(input))) return this.avToBv(Number(/[0-9]+/.exec(String(input))[0])); if (/^1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}\$/.test(String(input))) return this.bvToAv("BV" + input); if (/^[bB][vV]1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}\$/.test(String(input))) return this.bvToAv(String(input)); throw input; } bvToAv(BV) { let r = 0; for (let i = 0; i < 6; i++) r += this.table[BV[this.digitMap[i]]] * 58 ** i; return r - this.add ^ this.xor; } avToBv(av) { let bv = Array.from(this.bvidTemplate); av = (av ^ this.xor) + this.add; for (let i = 0; i < 6; i++) bv[this.digitMap[i]] = this.base58Table[parseInt(String(av / 58 ** i)) % 58]; return bv.join(""); } }; function abv(input) { return new Abv().check(input); } function BV2avAll(str) { return str.replace(/[bB][vV]1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}/g, (s) => "av" + abv(s)); } // src/io/api-webshow-locs.ts async function apiWebshowLoc(id) { const response = await fetch(objUrl(URLS.WEBSHOW_LOCS.slice(0, -1), { pf: 0, id })); const text = await response.text(); return jsonCheck(BV2avAll(text)).data; } async function apiWebshowLocs(data) { const response = await fetch(objUrl(URLS.WEBSHOW_LOCS, { pf: 0, ids: data.ids.join(",") })); const text = await response.text(); return jsonCheck(BV2avAll(text)).data; } // src/utils/element.ts function addElement(tag, attribute, parrent, innerHTML, top, replaced) { let element = document.createElement(tag); attribute && Object.entries(attribute).forEach((d) => element.setAttribute(d[0], d[1])); parrent = parrent || document.body; innerHTML && (element.innerHTML = innerHTML); replaced ? replaced.replaceWith(element) : top ? parrent.insertBefore(element, parrent.firstChild) : parrent.appendChild(element); return element; } async function addCss(txt, id, parrent) { if (!parrent && !document.head) { await new Promise((r) => poll(() => document.body, r)); } parrent = parrent || document.head; const style = document.createElement("style"); style.setAttribute("type", "text/css"); id && !parrent.querySelector(\`#\${id}\`) && style.setAttribute("id", id); style.appendChild(document.createTextNode(txt)); parrent.appendChild(style); return style; } function loadScript(src, onload) { return new Promise((r, j) => { const script = document.createElement("script"); script.type = "text/javascript"; script.src = src; script.addEventListener("load", () => { script.remove(); onload && onload(); r(true); }); script.addEventListener("error", () => { script.remove(); j(); }); (document.body || document.head || document.documentElement || document).appendChild(script); }); } function getTotalTop(node) { var sum = 0; do { sum += node.offsetTop; node = node.offsetParent; } while (node); return sum; } // src/utils/format/cht2chs.ts var aTC2SC = { "以功覆過": "以功复过", "侔德覆載": "侔德复载", "傷亡枕藉": "伤亡枕借", "出醜狼藉": "出丑狼借", "反反覆覆": "反反复复", "名覆金甌": "名复金瓯", "情有獨鍾": "情有独锺", "文錦覆阱": "文锦复阱", "於呼哀哉": "於呼哀哉", "旋乾轉坤": "旋乾转坤", "朝乾夕惕": "朝乾夕惕", "狐藉虎威": "狐借虎威", "瞭若指掌": "了若指掌", "老態龍鍾": "老态龙锺", "藉箸代籌": "借箸代筹", "藉草枕塊": "借草枕块", "藉藉无名": "藉藉无名", "衹見樹木": "只见树木", "覆蕉尋鹿": "复蕉寻鹿", "覆鹿尋蕉": "复鹿寻蕉", "覆鹿遺蕉": "复鹿遗蕉", "買臣覆水": "买臣复水", "踅門瞭戶": "踅门了户", "雁杳魚沈": "雁杳鱼沉", "顛乾倒坤": "颠乾倒坤", "乾清宮": "乾清宫", "乾盛世": "乾盛世", "八濛山": "八濛山", "千鍾粟": "千锺粟", "尼乾陀": "尼乾陀", "張法乾": "张法乾", "於世成": "於世成", "於仲完": "於仲完", "於其一": "於其一", "於勇明": "於勇明", "於崇文": "於崇文", "於忠祥": "於忠祥", "於惟一": "於惟一", "於梨華": "於梨华", "於清言": "於清言", "於竹屋": "於竹屋", "於陵子": "於陵子", "李乾德": "李乾德", "李澤鉅": "李泽钜", "李鍊福": "李链福", "李鍾郁": "李锺郁", "樊於期": "樊於期", "藉寇兵": "借寇兵", "覆醬瓿": "复酱瓿", "角徵羽": "角徵羽", "貂覆額": "貂复额", "郭子乾": "郭子乾", "錢鍾書": "钱锺书", "鍾萬梅": "锺万梅", "鍾重發": "锺重发", "麼些族": "麽些族", "黄鍾公": "黄锺公", "上鍊": "上链", "么麼": "幺麽", "么麽": "幺麽", "乾元": "乾元", "乾卦": "乾卦", "乾嘉": "乾嘉", "乾圖": "乾图", "乾坤": "乾坤", "乾宅": "乾宅", "乾斷": "乾断", "乾旦": "乾旦", "乾曜": "乾曜", "乾紅": "乾红", "乾綱": "乾纲", "乾縣": "乾县", "乾象": "乾象", "乾造": "乾造", "乾道": "乾道", "乾陵": "乾陵", "乾隆": "乾隆", "家俱": "家具", "傢具": "家具", "傢俱": "家具", "凌藉": "凌借", "函覆": "函复", "反覆": "反复", "哪吒": "哪吒", "哪咤": "哪吒", "回覆": "回复", "射覆": "射复", "幺麼": "幺麽", "康乾": "康乾", "彷彿": "仿佛", "徵弦": "徵弦", "徵絃": "徵弦", "徵聲": "徵声", "徵調": "徵调", "徵音": "徵音", "憑藉": "凭借", "手鍊": "手链", "拉鍊": "拉链", "拜覆": "拜复", "於乎": "於乎", "於倫": "於伦", "於則": "於则", "於單": "於单", "於坦": "於坦", "於戲": "於戏", "於敖": "於敖", "於琳": "於琳", "於穆": "於穆", "於菟": "於菟", "於邑": "於邑", "明瞭": "明了", "明覆": "明复", "木吒": "木吒", "木咤": "木吒", "沈沒": "沉没", "沈積": "沉积", "沈船": "沉船", "沈默": "沉默", "流徵": "流徵", "滑藉": "滑借", "牴牾": "抵牾", "牴觸": "抵触", "甚鉅": "甚钜", "申覆": "申复", "畢昇": "毕昇", "發覆": "发复", "瞭如": "了如", "瞭然": "了然", "瞭解": "了解", "示覆": "示复", "禀覆": "禀复", "答覆": "答复", "篤麼": "笃麽", "籌畫": "筹划", "素藉": "素借", "茵藉": "茵借", "萬鍾": "万锺", "蒜薹": "蒜薹", "蕓薹": "芸薹", "蕩覆": "荡复", "蕭乾": "萧乾", "藉代": "借代", "藉以": "借以", "藉助": "借助", "藉卉": "借卉", "藉口": "借口", "藉喻": "借喻", "藉手": "借手", "藉據": "借据", "藉故": "借故", "藉方": "借方", "藉條": "借条", "藉槁": "借槁", "藉機": "借机", "藉此": "借此", "藉甚": "借甚", "藉由": "借由", "藉著": "借着", "藉端": "借端", "藉藉": "借借", "藉詞": "借词", "藉讀": "借读", "藉資": "借资", "衹得": "只得", "覆上": "复上", "覆住": "复住", "覆信": "复信", "覆冒": "复冒", "覆呈": "复呈", "覆命": "复命", "覆墓": "复墓", "覆宗": "复宗", "覆帳": "复帐", "覆幬": "复帱", "覆成": "复成", "覆按": "复按", "覆文": "复文", "覆杯": "复杯", "覆校": "复校", "覆瓿": "复瓿", "覆盂": "复盂", "覆育": "复育", "覆逆": "复逆", "覆醢": "复醢", "覆電": "复电", "覆露": "复露", "覆鼎": "复鼎", "見覆": "见复", "角徵": "角徵", "計畫": "计划", "變徵": "变徵", "躪藉": "躏借", "酝藉": "酝借", "重覆": "重复", "金吒": "金吒", "金咤": "金吒", "金鍊": "金链", "鈕釦": "纽扣", "鈞覆": "钧复", "鉅子": "钜子", "鉅萬": "钜万", "鉅防": "钜防", "鉸鍊": "铰链", "銀鍊": "银链", "鍊墜": "链坠", "鍊子": "链子", "鍊形": "链形", "鍊條": "链条", "鍊錘": "链锤", "鍊鎖": "链锁", "鍛鍾": "锻锺", "鍾鍛": "锺锻", "鍾馗": "锺馗", "鎖鍊": "锁链", "鐵鍊": "铁链", "電覆": "电复", "露覆": "露复", "項鍊": "项链", "頗覆": "颇复", "頸鍊": "颈链", "顧藉": "顾借", "煞車": "刹车", "著": "着", "乾": "干", "儘": "尽", "劃": "划", "徵": "征", "於": "于", "瀋": "沈", "瀰": "弥", "畫": "画", "睪": "睾", "綵": "彩", "線": "线", "薹": "苔", "蘋": "苹", "襬": "摆", "託": "托", "諮": "咨", "鈕": "钮", "鉅": "巨", "鍾": "钟", "钁": "镢", "靦": "腼", "餘": "余", "麪": "面", "麴": "曲", "麵": "面", "麼": "么", "麽": "么", "開": "开", "噹": "当", "崙": "仑", "擣": "捣", "牴": "抵", "衹": "只", "諫": "谏", "譾": "谫", "買": "买", "閒": "闲", "願": "愿", "餬": "糊", "餱": "糇", "餵": "喂", "驄": "骢", "鵰": "雕", "齧": "啮", "鍊": "炼", "㑯": "㑔", "㑳": "㑇", "㑶": "㐹", "㓨": "刾", "㘚": "㘎", "㜄": "㚯", "㜏": "㛣", "㠏": "㟆", "㥮": "㤘", "㩜": "㨫", "㩳": "㧐", "䁻": "䀥", "䊷": "䌶", "䋙": "䌺", "䋚": "䌻", "䋹": "䌿", "䋻": "䌾", "䎱": "䎬", "䙡": "䙌", "䜀": "䜧", "䝼": "䞍", "䥇": "䦂", "䥱": "䥾", "䦛": "䦶", "䦟": "䦷", "䯀": "䯅", "䰾": "鲃", "䱷": "䲣", "䱽": "䲝", "䲁": "鳚", "䲘": "鳤", "䴉": "鹮", "丟": "丢", "並": "并", "亂": "乱", "亙": "亘", "亞": "亚", "佇": "伫", "佈": "布", "佔": "占", "併": "并", "來": "来", "侖": "仑", "侶": "侣", "侷": "局", "俁": "俣", "係": "系", "俔": "伣", "俠": "侠", "俥": "伡", "俬": "私", "倀": "伥", "倆": "俩", "倈": "俫", "倉": "仓", "個": "个", "們": "们", "倖": "幸", "倫": "伦", "倲": "㑈", "偉": "伟", "偑": "㐽", "側": "侧", "偵": "侦", "偽": "伪", "傌": "㐷", "傑": "杰", "傖": "伧", "傘": "伞", "備": "备", "傢": "家", "傭": "佣", "傯": "偬", "傳": "传", "傴": "伛", "債": "债", "傷": "伤", "傾": "倾", "僂": "偻", "僅": "仅", "僉": "佥", "僑": "侨", "僕": "仆", "僞": "伪", "僥": "侥", "僨": "偾", "僱": "雇", "價": "价", "儀": "仪", "儁": "俊", "儂": "侬", "億": "亿", "儈": "侩", "儉": "俭", "儐": "傧", "儔": "俦", "儕": "侪", "償": "偿", "優": "优", "儲": "储", "儷": "俪", "儸": "㑩", "儺": "傩", "儻": "傥", "儼": "俨", "兇": "凶", "兌": "兑", "兒": "儿", "兗": "兖", "內": "内", "兩": "两", "冊": "册", "冑": "胄", "冪": "幂", "凈": "净", "凍": "冻", "凜": "凛", "凱": "凯", "別": "别", "刪": "删", "剄": "刭", "則": "则", "剋": "克", "剎": "刹", "剗": "刬", "剛": "刚", "剝": "剥", "剮": "剐", "剴": "剀", "創": "创", "剷": "铲", "劇": "剧", "劉": "刘", "劊": "刽", "劌": "刿", "劍": "剑", "劏": "㓥", "劑": "剂", "劚": "㔉", "勁": "劲", "動": "动", "務": "务", "勛": "勋", "勝": "胜", "勞": "劳", "勢": "势", "勩": "勚", "勱": "劢", "勳": "勋", "勵": "励", "勸": "劝", "勻": "匀", "匭": "匦", "匯": "汇", "匱": "匮", "區": "区", "協": "协", "卹": "恤", "卻": "却", "卽": "即", "厙": "厍", "厠": "厕", "厤": "历", "厭": "厌", "厲": "厉", "厴": "厣", "參": "参", "叄": "叁", "叢": "丛", "吒": "咤", "吳": "吴", "吶": "呐", "呂": "吕", "咼": "呙", "員": "员", "唄": "呗", "唚": "吣", "唸": "念", "問": "问", "啓": "启", "啞": "哑", "啟": "启", "啢": "唡", "喎": "㖞", "喚": "唤", "喪": "丧", "喫": "吃", "喬": "乔", "單": "单", "喲": "哟", "嗆": "呛", "嗇": "啬", "嗊": "唝", "嗎": "吗", "嗚": "呜", "嗩": "唢", "嗶": "哔", "嘆": "叹", "嘍": "喽", "嘓": "啯", "嘔": "呕", "嘖": "啧", "嘗": "尝", "嘜": "唛", "嘩": "哗", "嘮": "唠", "嘯": "啸", "嘰": "叽", "嘵": "哓", "嘸": "呒", "嘽": "啴", "噁": "恶", "噓": "嘘", "噚": "㖊", "噝": "咝", "噠": "哒", "噥": "哝", "噦": "哕", "噯": "嗳", "噲": "哙", "噴": "喷", "噸": "吨", "嚀": "咛", "嚇": "吓", "嚌": "哜", "嚐": "尝", "嚕": "噜", "嚙": "啮", "嚥": "咽", "嚦": "呖", "嚨": "咙", "嚮": "向", "嚲": "亸", "嚳": "喾", "嚴": "严", "嚶": "嘤", "囀": "啭", "囁": "嗫", "囂": "嚣", "囅": "冁", "囈": "呓", "囉": "啰", "囌": "苏", "囑": "嘱", "囪": "囱", "圇": "囵", "國": "国", "圍": "围", "園": "园", "圓": "圆", "圖": "图", "團": "团", "垵": "埯", "埡": "垭", "埰": "采", "執": "执", "堅": "坚", "堊": "垩", "堖": "垴", "堝": "埚", "堯": "尧", "報": "报", "場": "场", "塊": "块", "塋": "茔", "塏": "垲", "塒": "埘", "塗": "涂", "塚": "冢", "塢": "坞", "塤": "埙", "塵": "尘", "塹": "堑", "墊": "垫", "墜": "坠", "墮": "堕", "墰": "坛", "墳": "坟", "墶": "垯", "墻": "墙", "墾": "垦", "壇": "坛", "壋": "垱", "壎": "埙", "壓": "压", "壘": "垒", "壙": "圹", "壚": "垆", "壜": "坛", "壞": "坏", "壟": "垄", "壠": "垅", "壢": "坜", "壩": "坝", "壯": "壮", "壺": "壶", "壼": "壸", "壽": "寿", "夠": "够", "夢": "梦", "夥": "伙", "夾": "夹", "奐": "奂", "奧": "奥", "奩": "奁", "奪": "夺", "奬": "奖", "奮": "奋", "奼": "姹", "妝": "妆", "姍": "姗", "姦": "奸", "娛": "娱", "婁": "娄", "婦": "妇", "婭": "娅", "媧": "娲", "媯": "妫", "媰": "㛀", "媼": "媪", "媽": "妈", "嫋": "袅", "嫗": "妪", "嫵": "妩", "嫺": "娴", "嫻": "娴", "嫿": "婳", "嬀": "妫", "嬃": "媭", "嬈": "娆", "嬋": "婵", "嬌": "娇", "嬙": "嫱", "嬡": "嫒", "嬤": "嬷", "嬪": "嫔", "嬰": "婴", "嬸": "婶", "孃": "娘", "孋": "㛤", "孌": "娈", "孫": "孙", "學": "学", "孿": "孪", "宮": "宫", "寀": "采", "寢": "寝", "實": "实", "寧": "宁", "審": "审", "寫": "写", "寬": "宽", "寵": "宠", "寶": "宝", "將": "将", "專": "专", "尋": "寻", "對": "对", "導": "导", "尷": "尴", "屆": "届", "屍": "尸", "屓": "屃", "屜": "屉", "屢": "屡", "層": "层", "屨": "屦", "屬": "属", "岡": "冈", "峯": "峰", "峴": "岘", "島": "岛", "峽": "峡", "崍": "崃", "崑": "昆", "崗": "岗", "崢": "峥", "崬": "岽", "嵐": "岚", "嵗": "岁", "嶁": "嵝", "嶄": "崭", "嶇": "岖", "嶔": "嵚", "嶗": "崂", "嶠": "峤", "嶢": "峣", "嶧": "峄", "嶨": "峃", "嶮": "崄", "嶴": "岙", "嶸": "嵘", "嶺": "岭", "嶼": "屿", "嶽": "岳", "巋": "岿", "巒": "峦", "巔": "巅", "巖": "岩", "巰": "巯", "巹": "卺", "帥": "帅", "師": "师", "帳": "帐", "帶": "带", "幀": "帧", "幃": "帏", "幗": "帼", "幘": "帻", "幟": "帜", "幣": "币", "幫": "帮", "幬": "帱", "幹": "干", "幾": "几", "庫": "库", "廁": "厕", "廂": "厢", "廄": "厩", "廈": "厦", "廎": "庼", "廕": "荫", "廚": "厨", "廝": "厮", "廟": "庙", "廠": "厂", "廡": "庑", "廢": "废", "廣": "广", "廩": "廪", "廬": "庐", "廳": "厅", "弒": "弑", "弔": "吊", "弳": "弪", "張": "张", "強": "强", "彆": "别", "彈": "弹", "彌": "弥", "彎": "弯", "彔": "录", "彙": "汇", "彞": "彝", "彠": "彟", "彥": "彦", "彫": "雕", "彲": "彨", "彿": "佛", "後": "后", "徑": "径", "從": "从", "徠": "徕", "復": "复", "徹": "彻", "恆": "恒", "恥": "耻", "悅": "悦", "悞": "悮", "悵": "怅", "悶": "闷", "悽": "凄", "惡": "恶", "惱": "恼", "惲": "恽", "惻": "恻", "愛": "爱", "愜": "惬", "愨": "悫", "愴": "怆", "愷": "恺", "愾": "忾", "慄": "栗", "態": "态", "慍": "愠", "慘": "惨", "慚": "惭", "慟": "恸", "慣": "惯", "慤": "悫", "慪": "怄", "慫": "怂", "慮": "虑", "慳": "悭", "慶": "庆", "慼": "戚", "慾": "欲", "憂": "忧", "憊": "惫", "憐": "怜", "憑": "凭", "憒": "愦", "憚": "惮", "憤": "愤", "憫": "悯", "憮": "怃", "憲": "宪", "憶": "忆", "懇": "恳", "應": "应", "懌": "怿", "懍": "懔", "懞": "蒙", "懟": "怼", "懣": "懑", "懨": "恹", "懲": "惩", "懶": "懒", "懷": "怀", "懸": "悬", "懺": "忏", "懼": "惧", "懾": "慑", "戀": "恋", "戇": "戆", "戔": "戋", "戧": "戗", "戩": "戬", "戰": "战", "戱": "戯", "戲": "戏", "戶": "户", "拋": "抛", "挩": "捝", "挱": "挲", "挾": "挟", "捨": "舍", "捫": "扪", "捱": "挨", "捲": "卷", "掃": "扫", "掄": "抡", "掆": "㧏", "掗": "挜", "掙": "挣", "掛": "挂", "採": "采", "揀": "拣", "揚": "扬", "換": "换", "揮": "挥", "損": "损", "搖": "摇", "搗": "捣", "搵": "揾", "搶": "抢", "摑": "掴", "摜": "掼", "摟": "搂", "摯": "挚", "摳": "抠", "摶": "抟", "摺": "折", "摻": "掺", "撈": "捞", "撏": "挦", "撐": "撑", "撓": "挠", "撝": "㧑", "撟": "挢", "撣": "掸", "撥": "拨", "撫": "抚", "撲": "扑", "撳": "揿", "撻": "挞", "撾": "挝", "撿": "捡", "擁": "拥", "擄": "掳", "擇": "择", "擊": "击", "擋": "挡", "擓": "㧟", "擔": "担", "據": "据", "擠": "挤", "擡": "抬", "擬": "拟", "擯": "摈", "擰": "拧", "擱": "搁", "擲": "掷", "擴": "扩", "擷": "撷", "擺": "摆", "擻": "擞", "擼": "撸", "擽": "㧰", "擾": "扰", "攄": "摅", "攆": "撵", "攏": "拢", "攔": "拦", "攖": "撄", "攙": "搀", "攛": "撺", "攜": "携", "攝": "摄", "攢": "攒", "攣": "挛", "攤": "摊", "攪": "搅", "攬": "揽", "敎": "教", "敓": "敚", "敗": "败", "敘": "叙", "敵": "敌", "數": "数", "斂": "敛", "斃": "毙", "斆": "敩", "斕": "斓", "斬": "斩", "斷": "断", "旂": "旗", "旣": "既", "昇": "升", "時": "时", "晉": "晋", "晝": "昼", "暈": "晕", "暉": "晖", "暘": "旸", "暢": "畅", "暫": "暂", "曄": "晔", "曆": "历", "曇": "昙", "曉": "晓", "曏": "向", "曖": "暧", "曠": "旷", "曨": "昽", "曬": "晒", "書": "书", "會": "会", "朧": "胧", "朮": "术", "東": "东", "杴": "锨", "枴": "拐", "柵": "栅", "柺": "拐", "査": "查", "桿": "杆", "梔": "栀", "梘": "枧", "條": "条", "梟": "枭", "梲": "棁", "棄": "弃", "棊": "棋", "棖": "枨", "棗": "枣", "棟": "栋", "棡": "㭎", "棧": "栈", "棲": "栖", "棶": "梾", "椏": "桠", "椲": "㭏", "楊": "杨", "楓": "枫", "楨": "桢", "業": "业", "極": "极", "榘": "矩", "榦": "干", "榪": "杩", "榮": "荣", "榲": "榅", "榿": "桤", "構": "构", "槍": "枪", "槓": "杠", "槤": "梿", "槧": "椠", "槨": "椁", "槮": "椮", "槳": "桨", "槶": "椢", "槼": "椝", "樁": "桩", "樂": "乐", "樅": "枞", "樑": "梁", "樓": "楼", "標": "标", "樞": "枢", "樢": "㭤", "樣": "样", "樫": "㭴", "樳": "桪", "樸": "朴", "樹": "树", "樺": "桦", "樿": "椫", "橈": "桡", "橋": "桥", "機": "机", "橢": "椭", "橫": "横", "檁": "檩", "檉": "柽", "檔": "档", "檜": "桧", "檟": "槚", "檢": "检", "檣": "樯", "檮": "梼", "檯": "台", "檳": "槟", "檸": "柠", "檻": "槛", "櫃": "柜", "櫓": "橹", "櫚": "榈", "櫛": "栉", "櫝": "椟", "櫞": "橼", "櫟": "栎", "櫥": "橱", "櫧": "槠", "櫨": "栌", "櫪": "枥", "櫫": "橥", "櫬": "榇", "櫱": "蘖", "櫳": "栊", "櫸": "榉", "櫺": "棂", "櫻": "樱", "欄": "栏", "欅": "榉", "權": "权", "欏": "椤", "欒": "栾", "欖": "榄", "欞": "棂", "欽": "钦", "歎": "叹", "歐": "欧", "歟": "欤", "歡": "欢", "歲": "岁", "歷": "历", "歸": "归", "歿": "殁", "殘": "残", "殞": "殒", "殤": "殇", "殨": "㱮", "殫": "殚", "殭": "僵", "殮": "殓", "殯": "殡", "殰": "㱩", "殲": "歼", "殺": "杀", "殻": "壳", "殼": "壳", "毀": "毁", "毆": "殴", "毿": "毵", "氂": "牦", "氈": "毡", "氌": "氇", "氣": "气", "氫": "氢", "氬": "氩", "氳": "氲", "氾": "泛", "汎": "泛", "汙": "污", "決": "决", "沒": "没", "沖": "冲", "況": "况", "泝": "溯", "洩": "泄", "洶": "汹", "浹": "浃", "涇": "泾", "涗": "涚", "涼": "凉", "淒": "凄", "淚": "泪", "淥": "渌", "淨": "净", "淩": "凌", "淪": "沦", "淵": "渊", "淶": "涞", "淺": "浅", "渙": "涣", "減": "减", "渢": "沨", "渦": "涡", "測": "测", "渾": "浑", "湊": "凑", "湞": "浈", "湧": "涌", "湯": "汤", "溈": "沩", "準": "准", "溝": "沟", "溫": "温", "溮": "浉", "溳": "涢", "溼": "湿", "滄": "沧", "滅": "灭", "滌": "涤", "滎": "荥", "滙": "汇", "滬": "沪", "滯": "滞", "滲": "渗", "滷": "卤", "滸": "浒", "滻": "浐", "滾": "滚", "滿": "满", "漁": "渔", "漊": "溇", "漚": "沤", "漢": "汉", "漣": "涟", "漬": "渍", "漲": "涨", "漵": "溆", "漸": "渐", "漿": "浆", "潁": "颍", "潑": "泼", "潔": "洁", "潙": "沩", "潛": "潜", "潤": "润", "潯": "浔", "潰": "溃", "潷": "滗", "潿": "涠", "澀": "涩", "澆": "浇", "澇": "涝", "澐": "沄", "澗": "涧", "澠": "渑", "澤": "泽", "澦": "滪", "澩": "泶", "澮": "浍", "澱": "淀", "澾": "㳠", "濁": "浊", "濃": "浓", "濄": "㳡", "濕": "湿", "濘": "泞", "濛": "蒙", "濜": "浕", "濟": "济", "濤": "涛", "濧": "㳔", "濫": "滥", "濰": "潍", "濱": "滨", "濺": "溅", "濼": "泺", "濾": "滤", "瀂": "澛", "瀅": "滢", "瀆": "渎", "瀇": "㲿", "瀉": "泻", "瀏": "浏", "瀕": "濒", "瀘": "泸", "瀝": "沥", "瀟": "潇", "瀠": "潆", "瀦": "潴", "瀧": "泷", "瀨": "濑", "瀲": "潋", "瀾": "澜", "灃": "沣", "灄": "滠", "灑": "洒", "灕": "漓", "灘": "滩", "灝": "灏", "灠": "漤", "灡": "㳕", "灣": "湾", "灤": "滦", "灧": "滟", "灩": "滟", "災": "灾", "為": "为", "烏": "乌", "烴": "烃", "無": "无", "煉": "炼", "煒": "炜", "煙": "烟", "煢": "茕", "煥": "焕", "煩": "烦", "煬": "炀", "煱": "㶽", "熅": "煴", "熒": "荧", "熗": "炝", "熱": "热", "熲": "颎", "熾": "炽", "燁": "烨", "燈": "灯", "燉": "炖", "燒": "烧", "燙": "烫", "燜": "焖", "營": "营", "燦": "灿", "燬": "毁", "燭": "烛", "燴": "烩", "燶": "㶶", "燻": "熏", "燼": "烬", "燾": "焘", "爍": "烁", "爐": "炉", "爛": "烂", "爭": "争", "爲": "为", "爺": "爷", "爾": "尔", "牀": "床", "牆": "墙", "牘": "牍", "牽": "牵", "犖": "荦", "犛": "牦", "犢": "犊", "犧": "牺", "狀": "状", "狹": "狭", "狽": "狈", "猙": "狰", "猶": "犹", "猻": "狲", "獁": "犸", "獃": "呆", "獄": "狱", "獅": "狮", "獎": "奖", "獨": "独", "獪": "狯", "獫": "猃", "獮": "狝", "獰": "狞", "獱": "㺍", "獲": "获", "獵": "猎", "獷": "犷", "獸": "兽", "獺": "獭", "獻": "献", "獼": "猕", "玀": "猡", "現": "现", "琱": "雕", "琺": "珐", "琿": "珲", "瑋": "玮", "瑒": "玚", "瑣": "琐", "瑤": "瑶", "瑩": "莹", "瑪": "玛", "瑲": "玱", "璉": "琏", "璡": "琎", "璣": "玑", "璦": "瑷", "璫": "珰", "璯": "㻅", "環": "环", "璵": "玙", "璸": "瑸", "璽": "玺", "瓊": "琼", "瓏": "珑", "瓔": "璎", "瓚": "瓒", "甌": "瓯", "甕": "瓮", "產": "产", "産": "产", "甦": "苏", "甯": "宁", "畝": "亩", "畢": "毕", "異": "异", "畵": "画", "當": "当", "疇": "畴", "疊": "叠", "痙": "痉", "痠": "酸", "痾": "疴", "瘂": "痖", "瘋": "疯", "瘍": "疡", "瘓": "痪", "瘞": "瘗", "瘡": "疮", "瘧": "疟", "瘮": "瘆", "瘲": "疭", "瘺": "瘘", "瘻": "瘘", "療": "疗", "癆": "痨", "癇": "痫", "癉": "瘅", "癒": "愈", "癘": "疠", "癟": "瘪", "癡": "痴", "癢": "痒", "癤": "疖", "癥": "症", "癧": "疬", "癩": "癞", "癬": "癣", "癭": "瘿", "癮": "瘾", "癰": "痈", "癱": "瘫", "癲": "癫", "發": "发", "皁": "皂", "皚": "皑", "皰": "疱", "皸": "皲", "皺": "皱", "盃": "杯", "盜": "盗", "盞": "盏", "盡": "尽", "監": "监", "盤": "盘", "盧": "卢", "盪": "荡", "眞": "真", "眥": "眦", "眾": "众", "睏": "困", "睜": "睁", "睞": "睐", "瞘": "眍", "瞜": "䁖", "瞞": "瞒", "瞶": "瞆", "瞼": "睑", "矇": "蒙", "矓": "眬", "矚": "瞩", "矯": "矫", "硃": "朱", "硜": "硁", "硤": "硖", "硨": "砗", "硯": "砚", "碕": "埼", "碩": "硕", "碭": "砀", "碸": "砜", "確": "确", "碼": "码", "碽": "䂵", "磑": "硙", "磚": "砖", "磠": "硵", "磣": "碜", "磧": "碛", "磯": "矶", "磽": "硗", "礄": "硚", "礆": "硷", "礎": "础", "礙": "碍", "礦": "矿", "礪": "砺", "礫": "砾", "礬": "矾", "礱": "砻", "祕": "秘", "祿": "禄", "禍": "祸", "禎": "祯", "禕": "祎", "禡": "祃", "禦": "御", "禪": "禅", "禮": "礼", "禰": "祢", "禱": "祷", "禿": "秃", "秈": "籼", "稅": "税", "稈": "秆", "稏": "䅉", "稜": "棱", "稟": "禀", "種": "种", "稱": "称", "穀": "谷", "穇": "䅟", "穌": "稣", "積": "积", "穎": "颖", "穠": "秾", "穡": "穑", "穢": "秽", "穩": "稳", "穫": "获", "穭": "稆", "窩": "窝", "窪": "洼", "窮": "穷", "窯": "窑", "窵": "窎", "窶": "窭", "窺": "窥", "竄": "窜", "竅": "窍", "竇": "窦", "竈": "灶", "竊": "窃", "竪": "竖", "競": "竞", "筆": "笔", "筍": "笋", "筧": "笕", "筴": "䇲", "箇": "个", "箋": "笺", "箏": "筝", "節": "节", "範": "范", "築": "筑", "篋": "箧", "篔": "筼", "篤": "笃", "篩": "筛", "篳": "筚", "簀": "箦", "簍": "篓", "簑": "蓑", "簞": "箪", "簡": "简", "簣": "篑", "簫": "箫", "簹": "筜", "簽": "签", "簾": "帘", "籃": "篮", "籌": "筹", "籔": "䉤", "籙": "箓", "籛": "篯", "籜": "箨", "籟": "籁", "籠": "笼", "籤": "签", "籩": "笾", "籪": "簖", "籬": "篱", "籮": "箩", "籲": "吁", "粵": "粤", "糉": "粽", "糝": "糁", "糞": "粪", "糧": "粮", "糰": "团", "糲": "粝", "糴": "籴", "糶": "粜", "糹": "纟", "糾": "纠", "紀": "纪", "紂": "纣", "約": "约", "紅": "红", "紆": "纡", "紇": "纥", "紈": "纨", "紉": "纫", "紋": "纹", "納": "纳", "紐": "纽", "紓": "纾", "純": "纯", "紕": "纰", "紖": "纼", "紗": "纱", "紘": "纮", "紙": "纸", "級": "级", "紛": "纷", "紜": "纭", "紝": "纴", "紡": "纺", "紬": "䌷", "紮": "扎", "細": "细", "紱": "绂", "紲": "绁", "紳": "绅", "紵": "纻", "紹": "绍", "紺": "绀", "紼": "绋", "紿": "绐", "絀": "绌", "終": "终", "絃": "弦", "組": "组", "絅": "䌹", "絆": "绊", "絎": "绗", "結": "结", "絕": "绝", "絛": "绦", "絝": "绔", "絞": "绞", "絡": "络", "絢": "绚", "給": "给", "絨": "绒", "絰": "绖", "統": "统", "絲": "丝", "絳": "绛", "絶": "绝", "絹": "绢", "綁": "绑", "綃": "绡", "綆": "绠", "綈": "绨", "綉": "绣", "綌": "绤", "綏": "绥", "綐": "䌼", "綑": "捆", "經": "经", "綜": "综", "綞": "缍", "綠": "绿", "綢": "绸", "綣": "绻", "綫": "线", "綬": "绶", "維": "维", "綯": "绹", "綰": "绾", "綱": "纲", "網": "网", "綳": "绷", "綴": "缀", "綸": "纶", "綹": "绺", "綺": "绮", "綻": "绽", "綽": "绰", "綾": "绫", "綿": "绵", "緄": "绲", "緇": "缁", "緊": "紧", "緋": "绯", "緑": "绿", "緒": "绪", "緓": "绬", "緔": "绱", "緗": "缃", "緘": "缄", "緙": "缂", "緝": "缉", "緞": "缎", "締": "缔", "緡": "缗", "緣": "缘", "緦": "缌", "編": "编", "緩": "缓", "緬": "缅", "緯": "纬", "緱": "缑", "緲": "缈", "練": "练", "緶": "缏", "緹": "缇", "緻": "致", "緼": "缊", "縈": "萦", "縉": "缙", "縊": "缢", "縋": "缒", "縐": "绉", "縑": "缣", "縕": "缊", "縗": "缞", "縛": "缚", "縝": "缜", "縞": "缟", "縟": "缛", "縣": "县", "縧": "绦", "縫": "缝", "縭": "缡", "縮": "缩", "縱": "纵", "縲": "缧", "縳": "䌸", "縴": "纤", "縵": "缦", "縶": "絷", "縷": "缕", "縹": "缥", "總": "总", "績": "绩", "繃": "绷", "繅": "缫", "繆": "缪", "繐": "穗", "繒": "缯", "織": "织", "繕": "缮", "繚": "缭", "繞": "绕", "繡": "绣", "繢": "缋", "繩": "绳", "繪": "绘", "繫": "系", "繭": "茧", "繮": "缰", "繯": "缳", "繰": "缲", "繳": "缴", "繸": "䍁", "繹": "绎", "繼": "继", "繽": "缤", "繾": "缱", "繿": "䍀", "纇": "颣", "纈": "缬", "纊": "纩", "續": "续", "纍": "累", "纏": "缠", "纓": "缨", "纔": "才", "纖": "纤", "纘": "缵", "纜": "缆", "缽": "钵", "罈": "坛", "罌": "罂", "罎": "坛", "罰": "罚", "罵": "骂", "罷": "罢", "羅": "罗", "羆": "罴", "羈": "羁", "羋": "芈", "羣": "群", "羥": "羟", "羨": "羡", "義": "义", "羶": "膻", "習": "习", "翬": "翚", "翹": "翘", "翽": "翙", "耬": "耧", "耮": "耢", "聖": "圣", "聞": "闻", "聯": "联", "聰": "聪", "聲": "声", "聳": "耸", "聵": "聩", "聶": "聂", "職": "职", "聹": "聍", "聽": "听", "聾": "聋", "肅": "肃", "脅": "胁", "脈": "脉", "脛": "胫", "脣": "唇", "脩": "修", "脫": "脱", "脹": "胀", "腎": "肾", "腖": "胨", "腡": "脶", "腦": "脑", "腫": "肿", "腳": "脚", "腸": "肠", "膃": "腽", "膕": "腘", "膚": "肤", "膞": "䏝", "膠": "胶", "膩": "腻", "膽": "胆", "膾": "脍", "膿": "脓", "臉": "脸", "臍": "脐", "臏": "膑", "臘": "腊", "臚": "胪", "臟": "脏", "臠": "脔", "臢": "臜", "臥": "卧", "臨": "临", "臺": "台", "與": "与", "興": "兴", "舉": "举", "舊": "旧", "舘": "馆", "艙": "舱", "艤": "舣", "艦": "舰", "艫": "舻", "艱": "艰", "艷": "艳", "芻": "刍", "苧": "苎", "茲": "兹", "荊": "荆", "莊": "庄", "莖": "茎", "莢": "荚", "莧": "苋", "華": "华", "菴": "庵", "菸": "烟", "萇": "苌", "萊": "莱", "萬": "万", "萴": "荝", "萵": "莴", "葉": "叶", "葒": "荭", "葤": "荮", "葦": "苇", "葯": "药", "葷": "荤", "蒐": "搜", "蒓": "莼", "蒔": "莳", "蒕": "蒀", "蒞": "莅", "蒼": "苍", "蓀": "荪", "蓆": "席", "蓋": "盖", "蓮": "莲", "蓯": "苁", "蓴": "莼", "蓽": "荜", "蔔": "卜", "蔘": "参", "蔞": "蒌", "蔣": "蒋", "蔥": "葱", "蔦": "茑", "蔭": "荫", "蕁": "荨", "蕆": "蒇", "蕎": "荞", "蕒": "荬", "蕓": "芸", "蕕": "莸", "蕘": "荛", "蕢": "蒉", "蕩": "荡", "蕪": "芜", "蕭": "萧", "蕷": "蓣", "薀": "蕰", "薈": "荟", "薊": "蓟", "薌": "芗", "薑": "姜", "薔": "蔷", "薘": "荙", "薟": "莶", "薦": "荐", "薩": "萨", "薳": "䓕", "薴": "苧", "薺": "荠", "藍": "蓝", "藎": "荩", "藝": "艺", "藥": "药", "藪": "薮", "藭": "䓖", "藴": "蕴", "藶": "苈", "藹": "蔼", "藺": "蔺", "蘀": "萚", "蘄": "蕲", "蘆": "芦", "蘇": "苏", "蘊": "蕴", "蘚": "藓", "蘞": "蔹", "蘢": "茏", "蘭": "兰", "蘺": "蓠", "蘿": "萝", "虆": "蔂", "處": "处", "虛": "虚", "虜": "虏", "號": "号", "虧": "亏", "虯": "虬", "蛺": "蛱", "蛻": "蜕", "蜆": "蚬", "蝕": "蚀", "蝟": "猬", "蝦": "虾", "蝨": "虱", "蝸": "蜗", "螄": "蛳", "螞": "蚂", "螢": "萤", "螮": "䗖", "螻": "蝼", "螿": "螀", "蟄": "蛰", "蟈": "蝈", "蟎": "螨", "蟣": "虮", "蟬": "蝉", "蟯": "蛲", "蟲": "虫", "蟶": "蛏", "蟻": "蚁", "蠁": "蚃", "蠅": "蝇", "蠆": "虿", "蠍": "蝎", "蠐": "蛴", "蠑": "蝾", "蠔": "蚝", "蠟": "蜡", "蠣": "蛎", "蠨": "蟏", "蠱": "蛊", "蠶": "蚕", "蠻": "蛮", "衆": "众", "衊": "蔑", "術": "术", "衕": "同", "衚": "胡", "衛": "卫", "衝": "冲", "袞": "衮", "裊": "袅", "裏": "里", "補": "补", "裝": "装", "裡": "里", "製": "制", "複": "复", "褌": "裈", "褘": "袆", "褲": "裤", "褳": "裢", "褸": "褛", "褻": "亵", "襆": "幞", "襇": "裥", "襉": "裥", "襏": "袯", "襖": "袄", "襝": "裣", "襠": "裆", "襤": "褴", "襪": "袜", "襯": "衬", "襲": "袭", "襴": "襕", "覈": "核", "見": "见", "覎": "觃", "規": "规", "覓": "觅", "視": "视", "覘": "觇", "覡": "觋", "覥": "觍", "覦": "觎", "親": "亲", "覬": "觊", "覯": "觏", "覲": "觐", "覷": "觑", "覺": "觉", "覽": "览", "覿": "觌", "觀": "观", "觴": "觞", "觶": "觯", "觸": "触", "訁": "讠", "訂": "订", "訃": "讣", "計": "计", "訊": "讯", "訌": "讧", "討": "讨", "訐": "讦", "訒": "讱", "訓": "训", "訕": "讪", "訖": "讫", "記": "记", "訛": "讹", "訝": "讶", "訟": "讼", "訢": "䜣", "訣": "诀", "訥": "讷", "訩": "讻", "訪": "访", "設": "设", "許": "许", "訴": "诉", "訶": "诃", "診": "诊", "註": "注", "証": "证", "詁": "诂", "詆": "诋", "詎": "讵", "詐": "诈", "詒": "诒", "詔": "诏", "評": "评", "詖": "诐", "詗": "诇", "詘": "诎", "詛": "诅", "詞": "词", "詠": "咏", "詡": "诩", "詢": "询", "詣": "诣", "試": "试", "詩": "诗", "詫": "诧", "詬": "诟", "詭": "诡", "詮": "诠", "詰": "诘", "話": "话", "該": "该", "詳": "详", "詵": "诜", "詼": "诙", "詿": "诖", "誄": "诔", "誅": "诛", "誆": "诓", "誇": "夸", "誌": "志", "認": "认", "誑": "诳", "誒": "诶", "誕": "诞", "誘": "诱", "誚": "诮", "語": "语", "誠": "诚", "誡": "诫", "誣": "诬", "誤": "误", "誥": "诰", "誦": "诵", "誨": "诲", "說": "说", "説": "说", "誰": "谁", "課": "课", "誶": "谇", "誹": "诽", "誼": "谊", "誾": "訚", "調": "调", "諂": "谄", "諄": "谆", "談": "谈", "諉": "诿", "請": "请", "諍": "诤", "諏": "诹", "諑": "诼", "諒": "谅", "論": "论", "諗": "谂", "諛": "谀", "諜": "谍", "諝": "谞", "諞": "谝", "諡": "谥", "諢": "诨", "諤": "谔", "諦": "谛", "諧": "谐", "諭": "谕", "諱": "讳", "諳": "谙", "諶": "谌", "諷": "讽", "諸": "诸", "諺": "谚", "諼": "谖", "諾": "诺", "謀": "谋", "謁": "谒", "謂": "谓", "謄": "誊", "謅": "诌", "謊": "谎", "謎": "谜", "謐": "谧", "謔": "谑", "謖": "谡", "謗": "谤", "謙": "谦", "謚": "谥", "講": "讲", "謝": "谢", "謠": "谣", "謡": "谣", "謨": "谟", "謫": "谪", "謬": "谬", "謭": "谫", "謳": "讴", "謹": "谨", "謾": "谩", "譁": "哗", "譅": "䜧", "證": "证", "譎": "谲", "譏": "讥", "譖": "谮", "識": "识", "譙": "谯", "譚": "谭", "譜": "谱", "譟": "噪", "譫": "谵", "譭": "毁", "譯": "译", "議": "议", "譴": "谴", "護": "护", "譸": "诪", "譽": "誉", "讀": "读", "讅": "谉", "變": "变", "讋": "詟", "讌": "䜩", "讎": "雠", "讒": "谗", "讓": "让", "讕": "谰", "讖": "谶", "讚": "赞", "讜": "谠", "讞": "谳", "豈": "岂", "豎": "竖", "豐": "丰", "豔": "艳", "豬": "猪", "豶": "豮", "貓": "猫", "貙": "䝙", "貝": "贝", "貞": "贞", "貟": "贠", "負": "负", "財": "财", "貢": "贡", "貧": "贫", "貨": "货", "販": "贩", "貪": "贪", "貫": "贯", "責": "责", "貯": "贮", "貰": "贳", "貲": "赀", "貳": "贰", "貴": "贵", "貶": "贬", "貸": "贷", "貺": "贶", "費": "费", "貼": "贴", "貽": "贻", "貿": "贸", "賀": "贺", "賁": "贲", "賂": "赂", "賃": "赁", "賄": "贿", "賅": "赅", "資": "资", "賈": "贾", "賊": "贼", "賑": "赈", "賒": "赊", "賓": "宾", "賕": "赇", "賙": "赒", "賚": "赉", "賜": "赐", "賞": "赏", "賠": "赔", "賡": "赓", "賢": "贤", "賣": "卖", "賤": "贱", "賦": "赋", "賧": "赕", "質": "质", "賫": "赍", "賬": "账", "賭": "赌", "賰": "䞐", "賴": "赖", "賵": "赗", "賺": "赚", "賻": "赙", "購": "购", "賽": "赛", "賾": "赜", "贄": "贽", "贅": "赘", "贇": "赟", "贈": "赠", "贊": "赞", "贋": "赝", "贍": "赡", "贏": "赢", "贐": "赆", "贓": "赃", "贔": "赑", "贖": "赎", "贗": "赝", "贛": "赣", "贜": "赃", "赬": "赪", "趕": "赶", "趙": "赵", "趨": "趋", "趲": "趱", "跡": "迹", "踐": "践", "踰": "逾", "踴": "踊", "蹌": "跄", "蹕": "跸", "蹟": "迹", "蹣": "蹒", "蹤": "踪", "蹺": "跷", "躂": "跶", "躉": "趸", "躊": "踌", "躋": "跻", "躍": "跃", "躎": "䟢", "躑": "踯", "躒": "跞", "躓": "踬", "躕": "蹰", "躚": "跹", "躡": "蹑", "躥": "蹿", "躦": "躜", "躪": "躏", "軀": "躯", "車": "车", "軋": "轧", "軌": "轨", "軍": "军", "軑": "轪", "軒": "轩", "軔": "轫", "軛": "轭", "軟": "软", "軤": "轷", "軫": "轸", "軲": "轱", "軸": "轴", "軹": "轵", "軺": "轺", "軻": "轲", "軼": "轶", "軾": "轼", "較": "较", "輅": "辂", "輇": "辁", "輈": "辀", "載": "载", "輊": "轾", "輒": "辄", "輓": "挽", "輔": "辅", "輕": "轻", "輛": "辆", "輜": "辎", "輝": "辉", "輞": "辋", "輟": "辍", "輥": "辊", "輦": "辇", "輩": "辈", "輪": "轮", "輬": "辌", "輯": "辑", "輳": "辏", "輸": "输", "輻": "辐", "輼": "辒", "輾": "辗", "輿": "舆", "轀": "辒", "轂": "毂", "轄": "辖", "轅": "辕", "轆": "辘", "轉": "转", "轍": "辙", "轎": "轿", "轔": "辚", "轟": "轰", "轡": "辔", "轢": "轹", "轤": "轳", "辦": "办", "辭": "辞", "辮": "辫", "辯": "辩", "農": "农", "迴": "回", "逕": "迳", "這": "这", "連": "连", "週": "周", "進": "进", "遊": "游", "運": "运", "過": "过", "達": "达", "違": "违", "遙": "遥", "遜": "逊", "遞": "递", "遠": "远", "遡": "溯", "適": "适", "遲": "迟", "遷": "迁", "選": "选", "遺": "遗", "遼": "辽", "邁": "迈", "還": "还", "邇": "迩", "邊": "边", "邏": "逻", "邐": "逦", "郟": "郏", "郵": "邮", "鄆": "郓", "鄉": "乡", "鄒": "邹", "鄔": "邬", "鄖": "郧", "鄧": "邓", "鄭": "郑", "鄰": "邻", "鄲": "郸", "鄴": "邺", "鄶": "郐", "鄺": "邝", "酇": "酂", "酈": "郦", "醃": "腌", "醖": "酝", "醜": "丑", "醞": "酝", "醣": "糖", "醫": "医", "醬": "酱", "醱": "酦", "釀": "酿", "釁": "衅", "釃": "酾", "釅": "酽", "釋": "释", "釐": "厘", "釒": "钅", "釓": "钆", "釔": "钇", "釕": "钌", "釗": "钊", "釘": "钉", "釙": "钋", "針": "针", "釣": "钓", "釤": "钐", "釦": "扣", "釧": "钏", "釩": "钒", "釵": "钗", "釷": "钍", "釹": "钕", "釺": "钎", "釾": "䥺", "鈀": "钯", "鈁": "钫", "鈃": "钘", "鈄": "钭", "鈅": "钥", "鈈": "钚", "鈉": "钠", "鈍": "钝", "鈎": "钩", "鈐": "钤", "鈑": "钣", "鈒": "钑", "鈔": "钞", "鈞": "钧", "鈡": "钟", "鈣": "钙", "鈥": "钬", "鈦": "钛", "鈧": "钪", "鈮": "铌", "鈰": "铈", "鈳": "钶", "鈴": "铃", "鈷": "钴", "鈸": "钹", "鈹": "铍", "鈺": "钰", "鈽": "钸", "鈾": "铀", "鈿": "钿", "鉀": "钾", "鉆": "钻", "鉈": "铊", "鉉": "铉", "鉋": "铇", "鉍": "铋", "鉑": "铂", "鉕": "钷", "鉗": "钳", "鉚": "铆", "鉛": "铅", "鉞": "钺", "鉢": "钵", "鉤": "钩", "鉦": "钲", "鉬": "钼", "鉭": "钽", "鉶": "铏", "鉸": "铰", "鉺": "铒", "鉻": "铬", "鉿": "铪", "銀": "银", "銃": "铳", "銅": "铜", "銍": "铚", "銑": "铣", "銓": "铨", "銖": "铢", "銘": "铭", "銚": "铫", "銛": "铦", "銜": "衔", "銠": "铑", "銣": "铷", "銥": "铱", "銦": "铟", "銨": "铵", "銩": "铥", "銪": "铕", "銫": "铯", "銬": "铐", "銱": "铞", "銳": "锐", "銷": "销", "銹": "锈", "銻": "锑", "銼": "锉", "鋁": "铝", "鋃": "锒", "鋅": "锌", "鋇": "钡", "鋌": "铤", "鋏": "铗", "鋒": "锋", "鋙": "铻", "鋝": "锊", "鋟": "锓", "鋣": "铘", "鋤": "锄", "鋥": "锃", "鋦": "锔", "鋨": "锇", "鋩": "铓", "鋪": "铺", "鋭": "锐", "鋮": "铖", "鋯": "锆", "鋰": "锂", "鋱": "铽", "鋶": "锍", "鋸": "锯", "鋼": "钢", "錁": "锞", "錄": "录", "錆": "锖", "錇": "锫", "錈": "锩", "錏": "铔", "錐": "锥", "錒": "锕", "錕": "锟", "錘": "锤", "錙": "锱", "錚": "铮", "錛": "锛", "錟": "锬", "錠": "锭", "錡": "锜", "錢": "钱", "錦": "锦", "錨": "锚", "錩": "锠", "錫": "锡", "錮": "锢", "錯": "错", "録": "录", "錳": "锰", "錶": "表", "錸": "铼", "鍀": "锝", "鍁": "锨", "鍃": "锪", "鍆": "钔", "鍇": "锴", "鍈": "锳", "鍋": "锅", "鍍": "镀", "鍔": "锷", "鍘": "铡", "鍚": "钖", "鍛": "锻", "鍠": "锽", "鍤": "锸", "鍥": "锲", "鍩": "锘", "鍬": "锹", "鍰": "锾", "鍵": "键", "鍶": "锶", "鍺": "锗", "鍼": "针", "鎂": "镁", "鎄": "锿", "鎇": "镅", "鎊": "镑", "鎌": "镰", "鎔": "镕", "鎖": "锁", "鎘": "镉", "鎚": "锤", "鎛": "镈", "鎡": "镃", "鎢": "钨", "鎣": "蓥", "鎦": "镏", "鎧": "铠", "鎩": "铩", "鎪": "锼", "鎬": "镐", "鎭": "镇", "鎮": "镇", "鎰": "镒", "鎲": "镋", "鎳": "镍", "鎵": "镓", "鎸": "镌", "鎿": "镎", "鏃": "镞", "鏇": "镟", "鏈": "链", "鏌": "镆", "鏍": "镙", "鏐": "镠", "鏑": "镝", "鏗": "铿", "鏘": "锵", "鏚": "戚", "鏜": "镗", "鏝": "镘", "鏞": "镛", "鏟": "铲", "鏡": "镜", "鏢": "镖", "鏤": "镂", "鏨": "錾", "鏰": "镚", "鏵": "铧", "鏷": "镤", "鏹": "镪", "鏺": "䥽", "鏽": "锈", "鐃": "铙", "鐋": "铴", "鐐": "镣", "鐒": "铹", "鐓": "镦", "鐔": "镡", "鐗": "锏", "鐘": "钟", "鐙": "镫", "鐝": "镢", "鐠": "镨", "鐥": "䦅", "鐦": "锎", "鐧": "锏", "鐨": "镄", "鐫": "镌", "鐮": "镰", "鐯": "䦃", "鐲": "镯", "鐳": "镭", "鐵": "铁", "鐶": "镮", "鐸": "铎", "鐺": "铛", "鐿": "镱", "鑄": "铸", "鑊": "镬", "鑌": "镔", "鑑": "鉴", "鑒": "鉴", "鑔": "镲", "鑕": "锧", "鑞": "镴", "鑠": "铄", "鑣": "镳", "鑥": "镥", "鑭": "镧", "鑰": "钥", "鑱": "镵", "鑲": "镶", "鑷": "镊", "鑹": "镩", "鑼": "锣", "鑽": "钻", "鑾": "銮", "鑿": "凿", "钂": "镋", "镟": "旋", "長": "长", "門": "门", "閂": "闩", "閃": "闪", "閆": "闫", "閈": "闬", "閉": "闭", "閌": "闶", "閎": "闳", "閏": "闰", "閑": "闲", "間": "间", "閔": "闵", "閘": "闸", "閡": "阂", "閣": "阁", "閤": "合", "閥": "阀", "閨": "闺", "閩": "闽", "閫": "阃", "閬": "阆", "閭": "闾", "閱": "阅", "閲": "阅", "閶": "阊", "閹": "阉", "閻": "阎", "閼": "阏", "閽": "阍", "閾": "阈", "閿": "阌", "闃": "阒", "闆": "板", "闇": "暗", "闈": "闱", "闊": "阔", "闋": "阕", "闌": "阑", "闍": "阇", "闐": "阗", "闒": "阘", "闓": "闿", "闔": "阖", "闕": "阙", "闖": "闯", "關": "关", "闞": "阚", "闠": "阓", "闡": "阐", "闢": "辟", "闤": "阛", "闥": "闼", "陘": "陉", "陝": "陕", "陞": "升", "陣": "阵", "陰": "阴", "陳": "陈", "陸": "陆", "陽": "阳", "隉": "陧", "隊": "队", "階": "阶", "隕": "陨", "際": "际", "隨": "随", "險": "险", "隱": "隐", "隴": "陇", "隸": "隶", "隻": "只", "雋": "隽", "雖": "虽", "雙": "双", "雛": "雏", "雜": "杂", "雞": "鸡", "離": "离", "難": "难", "雲": "云", "電": "电", "霢": "霡", "霧": "雾", "霽": "霁", "靂": "雳", "靄": "霭", "靆": "叇", "靈": "灵", "靉": "叆", "靚": "靓", "靜": "静", "靨": "靥", "鞀": "鼗", "鞏": "巩", "鞝": "绱", "鞦": "秋", "鞽": "鞒", "韁": "缰", "韃": "鞑", "韆": "千", "韉": "鞯", "韋": "韦", "韌": "韧", "韍": "韨", "韓": "韩", "韙": "韪", "韜": "韬", "韞": "韫", "韻": "韵", "響": "响", "頁": "页", "頂": "顶", "頃": "顷", "項": "项", "順": "顺", "頇": "顸", "須": "须", "頊": "顼", "頌": "颂", "頎": "颀", "頏": "颃", "預": "预", "頑": "顽", "頒": "颁", "頓": "顿", "頗": "颇", "領": "领", "頜": "颌", "頡": "颉", "頤": "颐", "頦": "颏", "頭": "头", "頮": "颒", "頰": "颊", "頲": "颋", "頴": "颕", "頷": "颔", "頸": "颈", "頹": "颓", "頻": "频", "頽": "颓", "顆": "颗", "題": "题", "額": "额", "顎": "颚", "顏": "颜", "顒": "颙", "顓": "颛", "顔": "颜", "顙": "颡", "顛": "颠", "類": "类", "顢": "颟", "顥": "颢", "顧": "顾", "顫": "颤", "顬": "颥", "顯": "显", "顰": "颦", "顱": "颅", "顳": "颞", "顴": "颧", "風": "风", "颭": "飐", "颮": "飑", "颯": "飒", "颱": "台", "颳": "刮", "颶": "飓", "颸": "飔", "颺": "飏", "颻": "飖", "颼": "飕", "飀": "飗", "飄": "飘", "飆": "飙", "飈": "飚", "飛": "飞", "飠": "饣", "飢": "饥", "飣": "饤", "飥": "饦", "飩": "饨", "飪": "饪", "飫": "饫", "飭": "饬", "飯": "饭", "飱": "飧", "飲": "饮", "飴": "饴", "飼": "饲", "飽": "饱", "飾": "饰", "飿": "饳", "餃": "饺", "餄": "饸", "餅": "饼", "餉": "饷", "養": "养", "餌": "饵", "餎": "饹", "餏": "饻", "餑": "饽", "餒": "馁", "餓": "饿", "餕": "馂", "餖": "饾", "餚": "肴", "餛": "馄", "餜": "馃", "餞": "饯", "餡": "馅", "館": "馆", "餳": "饧", "餶": "馉", "餷": "馇", "餺": "馎", "餼": "饩", "餾": "馏", "餿": "馊", "饁": "馌", "饃": "馍", "饅": "馒", "饈": "馐", "饉": "馑", "饊": "馓", "饋": "馈", "饌": "馔", "饑": "饥", "饒": "饶", "饗": "飨", "饜": "餍", "饞": "馋", "饢": "馕", "馬": "马", "馭": "驭", "馮": "冯", "馱": "驮", "馳": "驰", "馴": "驯", "馹": "驲", "駁": "驳", "駐": "驻", "駑": "驽", "駒": "驹", "駔": "驵", "駕": "驾", "駘": "骀", "駙": "驸", "駛": "驶", "駝": "驼", "駟": "驷", "駡": "骂", "駢": "骈", "駭": "骇", "駰": "骃", "駱": "骆", "駸": "骎", "駿": "骏", "騁": "骋", "騂": "骍", "騅": "骓", "騌": "骔", "騍": "骒", "騎": "骑", "騏": "骐", "騖": "骛", "騙": "骗", "騤": "骙", "騧": "䯄", "騫": "骞", "騭": "骘", "騮": "骝", "騰": "腾", "騶": "驺", "騷": "骚", "騸": "骟", "騾": "骡", "驀": "蓦", "驁": "骜", "驂": "骖", "驃": "骠", "驅": "驱", "驊": "骅", "驌": "骕", "驍": "骁", "驏": "骣", "驕": "骄", "驗": "验", "驚": "惊", "驛": "驿", "驟": "骤", "驢": "驴", "驤": "骧", "驥": "骥", "驦": "骦", "驪": "骊", "驫": "骉", "骯": "肮", "髏": "髅", "髒": "脏", "體": "体", "髕": "髌", "髖": "髋", "髮": "发", "鬆": "松", "鬍": "胡", "鬚": "须", "鬢": "鬓", "鬥": "斗", "鬧": "闹", "鬨": "哄", "鬩": "阋", "鬮": "阄", "鬱": "郁", "鬹": "鬶", "魎": "魉", "魘": "魇", "魚": "鱼", "魛": "鱽", "魢": "鱾", "魨": "鲀", "魯": "鲁", "魴": "鲂", "魷": "鱿", "魺": "鲄", "鮁": "鲅", "鮃": "鲆", "鮊": "鲌", "鮋": "鲉", "鮍": "鲏", "鮎": "鲇", "鮐": "鲐", "鮑": "鲍", "鮒": "鲋", "鮓": "鲊", "鮚": "鲒", "鮜": "鲘", "鮝": "鲞", "鮞": "鲕", "鮣": "䲟", "鮦": "鲖", "鮪": "鲔", "鮫": "鲛", "鮭": "鲑", "鮮": "鲜", "鮳": "鲓", "鮶": "鲪", "鮺": "鲝", "鯀": "鲧", "鯁": "鲠", "鯇": "鲩", "鯉": "鲤", "鯊": "鲨", "鯒": "鲬", "鯔": "鲻", "鯕": "鲯", "鯖": "鲭", "鯗": "鲞", "鯛": "鲷", "鯝": "鲴", "鯡": "鲱", "鯢": "鲵", "鯤": "鲲", "鯧": "鲳", "鯨": "鲸", "鯪": "鲮", "鯫": "鲰", "鯰": "鲶", "鯴": "鲺", "鯷": "鳀", "鯽": "鲫", "鯿": "鳊", "鰁": "鳈", "鰂": "鲗", "鰃": "鳂", "鰆": "䲠", "鰈": "鲽", "鰉": "鳇", "鰌": "䲡", "鰍": "鳅", "鰏": "鲾", "鰐": "鳄", "鰒": "鳆", "鰓": "鳃", "鰛": "鳁", "鰜": "鳒", "鰟": "鳑", "鰠": "鳋", "鰣": "鲥", "鰥": "鳏", "鰧": "䲢", "鰨": "鳎", "鰩": "鳐", "鰭": "鳍", "鰮": "鳁", "鰱": "鲢", "鰲": "鳌", "鰳": "鳓", "鰵": "鳘", "鰷": "鲦", "鰹": "鲣", "鰺": "鲹", "鰻": "鳗", "鰼": "鳛", "鰾": "鳔", "鱂": "鳉", "鱅": "鳙", "鱈": "鳕", "鱉": "鳖", "鱒": "鳟", "鱔": "鳝", "鱖": "鳜", "鱗": "鳞", "鱘": "鲟", "鱝": "鲼", "鱟": "鲎", "鱠": "鲙", "鱣": "鳣", "鱤": "鳡", "鱧": "鳢", "鱨": "鲿", "鱭": "鲚", "鱯": "鳠", "鱷": "鳄", "鱸": "鲈", "鱺": "鲡", "鳥": "鸟", "鳧": "凫", "鳩": "鸠", "鳬": "凫", "鳲": "鸤", "鳳": "凤", "鳴": "鸣", "鳶": "鸢", "鳾": "䴓", "鴆": "鸩", "鴇": "鸨", "鴉": "鸦", "鴒": "鸰", "鴕": "鸵", "鴛": "鸳", "鴝": "鸲", "鴞": "鸮", "鴟": "鸱", "鴣": "鸪", "鴦": "鸯", "鴨": "鸭", "鴯": "鸸", "鴰": "鸹", "鴴": "鸻", "鴷": "䴕", "鴻": "鸿", "鴿": "鸽", "鵁": "䴔", "鵂": "鸺", "鵃": "鸼", "鵐": "鹀", "鵑": "鹃", "鵒": "鹆", "鵓": "鹁", "鵜": "鹈", "鵝": "鹅", "鵠": "鹄", "鵡": "鹉", "鵪": "鹌", "鵬": "鹏", "鵮": "鹐", "鵯": "鹎", "鵲": "鹊", "鵷": "鹓", "鵾": "鹍", "鶄": "䴖", "鶇": "鸫", "鶉": "鹑", "鶊": "鹒", "鶓": "鹋", "鶖": "鹙", "鶘": "鹕", "鶚": "鹗", "鶡": "鹖", "鶥": "鹛", "鶩": "鹜", "鶪": "䴗", "鶬": "鸧", "鶯": "莺", "鶲": "鹟", "鶴": "鹤", "鶹": "鹠", "鶺": "鹡", "鶻": "鹘", "鶼": "鹣", "鶿": "鹚", "鷀": "鹚", "鷁": "鹢", "鷂": "鹞", "鷄": "鸡", "鷈": "䴘", "鷉": "䴘", "鷊": "鹝", "鷓": "鹧", "鷖": "鹥", "鷗": "鸥", "鷙": "鸷", "鷚": "鹨", "鷥": "鸶", "鷦": "鹪", "鷫": "鹔", "鷯": "鹩", "鷲": "鹫", "鷳": "鹇", "鷴": "鹇", "鷸": "鹬", "鷹": "鹰", "鷺": "鹭", "鷽": "鸴", "鷿": "䴙", "鸂": "㶉", "鸇": "鹯", "鸊": "䴙", "鸌": "鹱", "鸏": "鹲", "鸕": "鸬", "鸘": "鹴", "鸚": "鹦", "鸛": "鹳", "鸝": "鹂", "鸞": "鸾", "鹵": "卤", "鹹": "咸", "鹺": "鹾", "鹼": "碱", "鹽": "盐", "麗": "丽", "麥": "麦", "麩": "麸", "麫": "面", "麯": "曲", "黃": "黄", "黌": "黉", "點": "点", "黨": "党", "黲": "黪", "黴": "霉", "黶": "黡", "黷": "黩", "黽": "黾", "黿": "鼋", "鼉": "鼍", "鼕": "冬", "鼴": "鼹", "齇": "齄", "齊": "齐", "齋": "斋", "齎": "赍", "齏": "齑", "齒": "齿", "齔": "龀", "齕": "龁", "齗": "龂", "齙": "龅", "齜": "龇", "齟": "龃", "齠": "龆", "齡": "龄", "齣": "出", "齦": "龈", "齪": "龊", "齬": "龉", "齲": "龋", "齶": "腭", "齷": "龌", "龍": "龙", "龎": "厐", "龐": "庞", "龑": "䶮", "龔": "龚", "龕": "龛", "龜": "龟", "鿁": "䜤", "妳": "你" }; var regexp; function cht2chs(text) { regexp || (regexp = new RegExp(Object.keys(aTC2SC).join("|"), "g")); return text.replace(regexp, (d) => aTC2SC[d]); } // src/utils/hook/method.ts function methodHook(target, propertyKey, callback, modifyArguments) { try { let modify2 = function() { loaded = true; if (values[0]) { Reflect.defineProperty(target, propertyKey, { configurable: true, value: values[0] }); iArguments.forEach((d) => values[0](...d)); } else { debug.error("拦截方法出错!", "目标方法", propertyKey, "所属对象", target); } }; var modify = modify2; const values = []; const iArguments = []; let loading2 = false; let loaded = false; Reflect.defineProperty(target, propertyKey, { configurable: true, set: (v) => { if (loading2 && !loaded) { values.unshift(v); } return true; }, get: () => { if (!loading2) { loading2 = true; setTimeout(() => { const res = callback(); if (res && res.finally) { res.finally(() => modify2()); } else { modify2(); } }); } return function() { modifyArguments?.(arguments); iArguments.push(arguments); }; } }); } catch (e) { debug.error(e); } } function propertyHook(target, propertyKey, propertyValue, configurable = true) { try { Reflect.defineProperty(target, propertyKey, { configurable, set: (v) => true, get: () => { Reflect.defineProperty(target, propertyKey, { configurable: true, value: propertyValue }); return propertyValue; } }); } catch (e) { debug.error(e); } } propertyHook.modify = (target, propertyKey, callback, once = false) => { try { let value = target[propertyKey]; value && (value = callback(value)); Reflect.defineProperty(target, propertyKey, { configurable: true, set: (v) => { value = callback(v); return true; }, get: () => { if (once) { Reflect.deleteProperty(target, propertyKey); Reflect.set(target, propertyKey, value); } return value; } }); } catch (e) { debug.error(e); } }; function ProxyHandler(target, parrent, key) { return new Proxy(target, { deleteProperty(target2, p) { const res = Reflect.deleteProperty(target2, p); parrent[key] = target2; return res; }, set(target2, p, newValue, receiver) { const res = Reflect.set(target2, p, newValue, receiver); parrent[key] = target2; return res; }, get(target2, p, receiver) { const res = Reflect.get(target2, p, receiver); if (isArray(res) || isObject(res)) { return ProxyHandler(res, receiver, p); } return res; } }); } function propertryChangeHook(target, callback) { return new Proxy(target, { deleteProperty(target2, p) { const res = Reflect.deleteProperty(target2, p); callback(p, void 0); return res; }, set(target2, p, newValue, receiver) { const res = Reflect.set(target2, p, newValue, receiver); callback(p, newValue); return res; }, get(target2, p, receiver) { const res = Reflect.get(target2, p, receiver); if (isArray(res) || isObject(res)) { return ProxyHandler(res, receiver, p); } return res; } }); } // src/utils/hook/xhr.ts var rules = []; var open = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(...rest) { const args = [...rest]; args[1] && rules.forEach((d) => { d && d[0].every((d2) => args[1].includes(d2)) && d[1].call(this, args); }); return open.call(this, ...args); }; function xhrHook(url, modifyOpen, modifyResponse, once = true) { let id; const one = Array.isArray(url) ? url : [url]; const two = function(args) { once && id && delete rules[id - 1]; if (modifyOpen) try { modifyOpen(args); } catch (e) { debug.error("modifyOpen of xhrhook", one, e); } if (modifyResponse) try { this.addEventListener("readystatechange", () => { try { if (this.readyState === 4) { const response = { response: this.response, responseType: this.responseType, status: this.status, statusText: this.statusText }; (this.responseType === "" || this.responseType === "text") && (response.responseText = this.responseText); (this.responseType === "" || this.responseType === "document") && (response.responseXML = this.responseXML); modifyResponse(response); Reflect.defineProperty(this, "response", { configurable: true, value: response.response }); response.responseText && Reflect.defineProperty(this, "responseText", { configurable: true, value: response.responseText }); response.responseXML && Reflect.defineProperty(this, "responseXML", { configurable: true, value: response.responseXML }); } } catch (e) { debug.error("modifyResponse of xhrhook", one, e); } }); } catch (e) { debug.error("modifyResponse of xhrhook", one, e); } }; const iid = rules.push([one, two]); return () => { removeXhrhook(iid); }; } xhrHook.async = (url, condition, modifyResponse, once = true) => { let id, temp; const one = Array.isArray(url) ? url : [url]; const two = function(args) { try { if (!condition || condition(args)) { this.xhrhookTimes = this.xhrhookTimes ? this.xhrhookTimes++ : 1; id && (temp = rules[id - 1]); delete rules[id - 1]; this.send = () => true; (!args[2] || args[2] === true) && (this.timeout = 0); const et = setInterval(() => { this.dispatchEvent(new ProgressEvent("progress")); }, 50); Reflect.defineProperty(this, "status", { configurable: true, value: 200 }); Reflect.defineProperty(this, "readyState", { configurable: true, value: 2 }); this.dispatchEvent(new ProgressEvent("readystatechange")); modifyResponse ? modifyResponse(args).then((d) => { clearInterval(et); if (d) { Reflect.defineProperty(this, "response", { configurable: true, value: d.response }); d.responseType && setResponseType(d.responseType, this); d.responseText && Reflect.defineProperty(this, "responseText", { configurable: true, value: d.responseText }); d.responseXML && Reflect.defineProperty(this, "responseXML", { configurable: true, value: d.responseXML }); !this.responseURL && Reflect.defineProperty(this, "responseURL", { configurable: true, value: args[1] }); Reflect.defineProperty(this, "readyState", { configurable: true, value: 4 }); this.dispatchEvent(new ProgressEvent("readystatechange")); this.dispatchEvent(new ProgressEvent("load")); this.dispatchEvent(new ProgressEvent("loadend")); } }).catch((d) => { if (this.xhrhookTimes === 1) { if (d && d.response) { Reflect.defineProperty(this, "response", { configurable: true, value: d.response }); d.responseType && setResponseType(d.responseType, this); d.responseText && Reflect.defineProperty(this, "responseText", { configurable: true, value: d.responseText }); d.responseXML && Reflect.defineProperty(this, "responseXML", { configurable: true, value: d.responseXML }); !this.responseURL && Reflect.defineProperty(this, "responseURL", { configurable: true, value: args[1] }); Reflect.defineProperty(this, "readyState", { configurable: true, value: 4 }); this.dispatchEvent(new ProgressEvent("readystatechange")); this.dispatchEvent(new ProgressEvent("load")); this.dispatchEvent(new ProgressEvent("loadend")); } else { this.dispatchEvent(new ProgressEvent("error")); } } else { this.xhrhookTimes--; } debug.error("modifyResponse of xhrhookasync", one, d); }).finally(() => { clearInterval(et); !once && (id = rules.push(temp)); }) : (this.abort(), !once && (id = rules.push(temp))); clearInterval(et); } } catch (e) { debug.error("condition of xhrhook", one, e); } }; const iid = rules.push([one, two]); return () => { removeXhrhook(iid); }; }; function removeXhrhook(id) { id >= 0 && delete rules[id - 1]; } xhrHook.ultra = (url, modify) => { const one = Array.isArray(url) ? url : [url]; const two = function(args) { try { modify.call(this, this, args); } catch (e) { debug.error("xhrhook modify", one, modify, e); } }; const iid = rules.push([one, two]); return () => { removeXhrhook(iid); }; }; function setResponseType(responseType, xhr) { Reflect.defineProperty(xhr, "responseType", { configurable: true, value: responseType }); xhr.getResponseHeader = (name) => { if (name === "content-type") { switch (xhr.responseType) { case "arraybuffer": case "blob": return "application/octet-stream"; case "document": return "text/xml; charset=utf-8"; case "json": return "application/json; charset=utf-8"; default: return "text/plain; charset=utf-8"; } } return "text/plain; charset=utf-8"; }; xhr.getAllResponseHeaders = () => { switch (xhr.responseType) { case "arraybuffer": case "blob": return "content-type: application/octet-stream\\r\\n"; case "document": return "content-type: text/xml; charset=utf-8\\r\\n"; case "json": return "content-type: application/json; charset=utf-8\\r\\n"; default: return "content-type: text/plain; charset=utf-8\\r\\n"; } }; } // src/utils/type.ts function toObject(input) { switch (input) { case "undefined": input = void 0; break; case "null": input = null; break; case "NaN": input = NaN; break; default: if (!input) break; try { const temp = JSON.parse(input); if (typeof temp !== "number" || input === String(temp)) { input = temp; } } catch { try { const temp = Number(input); if (String(temp) !== "NaN" && !input.startsWith("0")) { input = temp; } } catch { } try { if (/^\\d+n\$/.test(input)) input = BigInt(input.slice(0, -1)); } catch { } } break; } return input; } function toString(input, space = "\\n") { let result; try { result = input.toString(); } catch { result = String(input); } if (result.startsWith("[object") && result.endsWith("]")) { try { const str = JSON.stringify(input, void 0, space); str === "{}" || (result = str); } catch { } } return result; } // src/core/storage.ts var LocalStorage = class { /** 清空! */ static clear() { localStorage.clear(); } /** * 读取 * @param key 目标键名 * @returns 格式化后的数据 */ static getItem(key) { return toObject(localStorage.getItem(key)); } /** * 列出键名数组 * 原生Storage.key只返回但索引,感觉意义不大。 * @returns 键名数组 */ static keys() { return Object.keys(localStorage); } /** * 移除 * @param key 目标键名 */ static removeItem(key) { localStorage.removeItem(key); } /** * 添加/修改 * @param key * @param value */ static setItem(key, value) { localStorage.setItem(key, toString(value)); } }; var SessionStorage = class { /** 清空! */ static clear() { sessionStorage.clear(); } /** * 读取 * @param key 目标键名 * @returns 格式化后的数据 */ static getItem(key) { return toObject(sessionStorage.getItem(key)); } /** * 列出键名数组 * 原生Storage.key只返回但索引,感觉意义不大。 * @returns 键名数组 */ static keys() { return Object.keys(sessionStorage); } /** * 移除 * @param key 目标键名 */ static removeItem(key) { sessionStorage.removeItem(key); } /** * 添加/修改 * @param key * @param value */ static setItem(key, value) { sessionStorage.setItem(key, toString(value)); } }; // src/core/player.ts var _Player = class { constructor(BLOD2) { this.BLOD = BLOD2; propertyHook.modify(window, "nano", (v) => { debug("捕获新版播放器!"); const createPlayer = v.createPlayer; const that = this; propertyHook(v, "createPlayer", function() { debug("新版播放器试图启动!"); if (that.isEmbedPlayer) throw new Error("爆破新版播放器!"); that.nanoPlayer = createPlayer.call(v, ...arguments); that.createPlayer(...arguments); that.connect = that.nanoPlayer.connect; that.nanoPlayer.connect = function() { if (that.isConnect) { debug("允许新版播放器启动!"); return that.connect?.(); } else { that.isConnect = true; return Promise.resolve(true); } }; return that.nanoPlayer; }); if (window.player) { try { const manifest = window.player?.getManifest(); debug("播放器实例已存在,可能脚本注入过慢!", manifest); manifest && this.createPlayer(manifest); } catch (e) { debug("读取播放器启动参数失败!", e); } } return v; }); } /** 添加播放器启动参数修改命令 */ static addModifyArgument(callback) { this.modifyArgumentCallback.push(callback); } /** 捕获的新版播放器 */ nanoPlayer; connect; isConnect = false; /** 修改播放器启动参数 */ modifyArgument(args) { while (_Player.modifyArgumentCallback.length) { _Player.modifyArgumentCallback.shift()?.(args); } } initData = {}; dataInited = false; createPlayer(initData, theme) { this.dataInited = true; Object.entries(initData).forEach((d) => { switch (typeof d[1]) { case "bigint": case "boolean": case "number": case "string": case "undefined": this.initData[d[0]] = d[1]; break; default: break; } }); this.initData.as_wide = true; this.dataInitedCallback(); } /** 脚本初始化中 */ // private loading = true; /** 旧版播放器已启用 */ isEmbedPlayer = false; /** 旧版播放器正常引导 */ EmbedPlayer(loadPlayer, isEmbedPlayer = true) { this.nanoPermit = () => { }; this.isEmbedPlayer = isEmbedPlayer; methodHook(window, "EmbedPlayer", () => loadPlayer(), (d) => this.modifyArgument(d)); if (window.player?.disconnect) { try { debug("爆破新版播放器!"); window.player.disconnect(); this.nanoPlayer || (this.nanoPlayer = window.player); } catch { } } this.switchVideo(); this.simpleChinese(); } /** 通过hook新版播放器来引导旧版播放器 */ connectPlayer(loadPlayer) { this.EmbedPlayer(loadPlayer, false); this.dataInitedCallback(() => { window.EmbedPlayer("player", "", objUrl("", this.initData)); if (this.nanoPlayer) { Object.defineProperties(this.nanoPlayer, { addEventListener: { get: () => window.player?.addEventListener }, directiveDispatcher: { get: () => window.player?.directiveDispatcher }, editorCenter: { get: () => window.player?.editorCenter }, exitFullScreen: { get: () => window.player?.exitFullScreen }, getCurrentTime: { get: () => window.player?.getCurrentTime }, getDuration: { get: () => window.player?.getDuration }, next: { get: () => window.player?.next }, ogvUpdate: { get: () => window.player?.ogvUpdate }, pause: { get: () => window.player?.pause }, play: { get: () => window.player?.play }, prev: { get: () => window.player?.prev }, reload: { get: () => window.player?.reload }, seek: { get: () => window.player?.seek }, stop: { get: () => window.player?.stop }, volume: { get: () => window.player?.volume } }); } }); addCss(\`#bofqi .player,#bilibili-player .player{width: 100%;height: 100%;display: block;}.bilibili-player .bilibili-player-auxiliary-area{z-index: 1;}\`, "nano-fix"); } /** 不启用旧版播放器允许新版播放器启动 */ nanoPermit() { if (this.isConnect) { debug("允许新版播放器启动!"); this.connect?.(); } else { this.isConnect = true; } } /** 播放器启动栈 */ dataInitedCallbacks = []; /** 捕获启动数据后启动播放器 */ dataInitedCallback(callback) { callback && this.dataInitedCallbacks.push(callback); if (this.dataInited) { while (this.dataInitedCallbacks.length) { this.dataInitedCallbacks.shift()?.(); } } } regised = false; switchVideo() { if (this.regised) return; this.regised = true; let cache; switchVideo(() => { if (window.player.appendTopMessage) { const cfg = LocalStorage.getItem("bilibili_player_settings"); poll(() => document.querySelector(".bilibili-player-video-message-panel"), () => { if (cache) { window.player.appendTopMessage(cache); } else if (cfg.message) { const message = Object.keys(cfg.message).filter((d) => cfg.message[d]).sort(() => 0.5 - Math.random()); if (message[0]) { switch (message[0]) { case "system": apiWebshowLoc(4694).then((d) => { window.player.appendTopMessage(cache = d.filter((d2) => d2.name).map((d2) => { return { url: d2.url, type: message[0], name: d2.name }; })); }).catch((e) => { debug.error("播放器通知", e); }); break; case "bangumi": apiPgcSlideShow(531).then((d) => { window.player.appendTopMessage(cache = d.map((d2) => { return { url: d2.blink, type: message[0], name: d2.title }; })); }).catch((e) => { debug.error("播放器通知", e); }); break; case "news": apiSearchSquare().then((d) => { window.player.appendTopMessage(cache = d.map((d2) => { return { url: d2.uri || \`//search.bilibili.com/all?keyword=\${encodeURIComponent(d2.keyword)}\`, type: message[0], name: d2.show_name || d2.keyword }; })); }).catch((e) => { debug.error("播放器通知", e); }); break; default: break; } } } }); } }); } playbackRateTimer; /** 更改播放器速率 */ playbackRate(playbackRate = 1) { clearTimeout(this.playbackRateTimer); this.playbackRateTimer = setTimeout(() => { const video = document.querySelector("#bilibiliPlayer video"); if (!video) return this.BLOD.toast.warning("未找到播放器!请在播放页面使用。"); video.playbackRate = Number(playbackRate); }, 100); } /** 繁体字幕转简体 */ simpleChinese() { if (this.BLOD.status.simpleChinese) { xhrHook("x/player/v2?", void 0, (res) => { try { const response = jsonCheck(res.response); if (response?.data?.subtitle?.subtitles?.length) { response.data.subtitle.subtitles.forEach((d) => { if (typeof d.subtitle_url === "string") { switch (d.lan) { case "zh-Hant": xhrHook(d.subtitle_url, void 0, (res2) => { try { let response2 = res2.responseType === "json" ? JSON.stringify(res2.response) : res2.responseText; if (response2) { response2 = cht2chs(response2); if (res2.responseType === "json") { res2.response = JSON.parse(response2); } else { res2.response = res2.responseText = response2; } this.BLOD.toast.warning("字幕:繁 -> 简", \`原始语言:\${d.lan_doc}\`); } } catch (e) { debug.error("繁 -> 简", e); } }); break; default: break; } } }); } } catch { } }, false); } } }; var Player = _Player; /** 播放器启动参数修改回调栈 */ __publicField(Player, "modifyArgumentCallback", []); // src/core/automate.ts var Automate = class { constructor(BLOD2) { this.BLOD = BLOD2; this.modifyArgument(); this.danmakuFirst(); switchVideo(this.switchVideo); this.videospeed(); } /** 展开弹幕列表 */ danmakuFirst() { this.BLOD.status.automate.danmakuFirst && SessionStorage.setItem("player_last_filter_tab_info", 4); } /** 滚动到播放器 */ showBofqi() { const str = [".bangumi_player", "#bofqi", "#bilibiliPlayer"]; this.BLOD.status.automate.showBofqi && setTimeout(() => { const node = str.reduce((s, d) => { s = s || document.querySelector(d); return s; }, document.querySelector("#__bofqi")); node && node.scrollIntoView({ behavior: "smooth", block: "center" }); }, 500); } /** 自动网页全屏 */ webFullScreen() { this.BLOD.status.automate.webFullScreen && poll(() => document.querySelector(".bilibili-player-iconfont.bilibili-player-iconfont-web-fullscreen.icon-24webfull.player-tooltips-trigger"), () => document.querySelector(".bilibili-player-video-web-fullscreen").click()); } /** 记忆播放速率 */ videospeed() { if (this.BLOD.status.automate.videospeed) { this.BLOD.GM.getValue("videospeed").then((videospeed) => { if (videospeed) { let setting = SessionStorage.getItem("bilibili_player_settings"); setting ? setting.video_status ? setting.video_status.videospeed = videospeed : setting.video_status = { videospeed } : setting = { video_status: { videospeed } }; SessionStorage.setItem("bilibili_player_settings", setting); } }); switchVideo(() => { poll(() => document.querySelector("#bofqi")?.querySelector("video"), (d) => { d.addEventListener("ratechange", (e) => { this.BLOD.GM.setValue("videospeed", e.target.playbackRate || 1); }); }); }); } } /** 关闭抗锯齿 */ videoDisableAA() { this.BLOD.status.videoDisableAA && poll(() => document.querySelector("#bilibiliPlayer .bilibili-player-video video"), (d) => d.style.filter += "contrast(1)"); } /** 修改播放器启动参数 */ modifyArgument() { Player.addModifyArgument((args) => { const obj = urlObj(\`?\${args[2]}\`); this.BLOD.status.automate.screenWide && (obj.as_wide = 1); this.BLOD.status.automate.autoPlay && (obj.autoplay = 1); this.BLOD.status.automate.noDanmaku && (obj.danmaku = 0); args[2] = objUrl("", obj); }); } /** 切p回调 */ switchVideo = async () => { this.showBofqi(); this.webFullScreen(); this.videoDisableAA(); if (!this.BLOD.videoInfo.metadata && this.BLOD.aid) { apiArticleCards({ av: this.BLOD.aid }).then((d) => { Object.values(d).forEach((d2) => this.BLOD.videoInfo.aidDatail(d2)); this.BLOD.videoInfo.mediaSession(); }).catch((e) => { debug.error("获取aid详情出错!", e); }); } else { this.BLOD.videoInfo.mediaSession(); } }; }; // src/utils/hook/node.ts var appendChild = Element.prototype.appendChild; var insertBefore = Element.prototype.insertBefore; var jsonp = []; Element.prototype.appendChild = function(newChild) { this.parentElement === document.documentElement && newChild.nodeName == "SCRIPT" && newChild.src && jsonp.forEach((d) => { d[0].every((d2) => newChild.src.includes(d2)) && d[1].call(newChild); }); return appendChild.call(this, newChild); }; Element.prototype.insertBefore = function(newChild, refChild) { this.parentElement === document.documentElement && newChild.nodeName == "SCRIPT" && newChild.src && jsonp.forEach((d) => { d[0].every((d2) => newChild.src.includes(d2)) && d[1].call(newChild); }); return insertBefore.call(this, newChild, refChild); }; function jsonpHook(url, redirect, modifyResponse, once = true) { let id; const one = Array.isArray(url) ? url : [url]; const two = function() { once && id && delete jsonp[id - 1]; if (redirect) try { this.src = redirect(this.src) || this.src; } catch (e) { debug.error("redirect of jsonphook", one, e); } if (modifyResponse) { const obj = urlObj(this.src); if (obj) { const callback = obj.callback; const call = window[callback]; const url2 = this.src; if (call) { window[callback] = function(v) { try { v = modifyResponse(v, url2, call) || v; } catch (e) { debug.error("modifyResponse of jsonphook", one, e); } return v !== true && call(v); }; } } } }; const iid = jsonp.push([one, two]); return () => { removeJsonphook(iid); }; } jsonpHook.async = (url, condition, modifyResponse, once = true) => { let id; const one = Array.isArray(url) ? url : [url]; const two = function() { try { once && id && delete jsonp[id - 1]; if (!condition || condition(this.src)) { const obj = urlObj(this.src); if (obj) { const callback = obj.callback; const call = window[callback]; if (call) { modifyResponse && modifyResponse(this.src).then((d) => { window[callback](d); this.dispatchEvent(new ProgressEvent("load")); }).catch((e) => { this.dispatchEvent(new ProgressEvent("error")); debug.error("modifyResponse of xhrhookasync", one, e); }); } this.removeAttribute("src"); } } } catch (e) { debug.error("jsonphook", one, e); } }; const iid = jsonp.push([one, two]); return () => { removeJsonphook(iid); }; }; jsonpHook.scriptBlock = (url) => { const one = Array.isArray(url) ? url : [url]; const two = function() { try { this.removeAttribute("src"); setTimeout(() => { this.dispatchEvent(new ProgressEvent("load")); try { this.remove(); } catch (e) { } }, 100); } catch (e) { debug.error("脚本拦截失败!", one, e); } }; jsonp.push([one, two]); }; jsonpHook.scriptIntercept = (url, redirect, text) => { const one = Array.isArray(url) ? url : [url]; const two = function() { try { if (text) { this.text = text(this.src); this.removeAttribute("src"); setTimeout(() => { this.dispatchEvent(new ProgressEvent("load")); this?.remove(); }, 100); } else if (redirect) { this.src = redirect(this.src); } } catch (e) { debug.error("scriptIntercept", one, e); } }; const iid = jsonp.push([one, two]); return () => { removeJsonphook(iid); }; }; function removeJsonphook(id) { id >= 0 && delete jsonp[id - 1]; } // src/core/comment.ts var Feedback; var loading = false; var load = false; var events = {}; var Comment = class { constructor(BLOD2) { this.BLOD = BLOD2; Feedback = void 0; loading = false; load = false; events = {}; this.bbComment(); this.initComment(); this.pageCount(); } /** 捕获评论组件 */ bbComment() { Reflect.defineProperty(window, "bbComment", { configurable: true, set: (v) => { if (!v.prototype._createNickNameDom) { return loadScript("//s1.hdslb.com/bfs/seed/jinkela/commentpc/comment.min.js").then(() => { Array.from(document.styleSheets).forEach((d) => { d.href && d.href.includes("comment") && (d.disabled = true); }); }); } Feedback = v; this.bbCommentModify(); Reflect.defineProperty(window, "bbComment", { configurable: true, value: Feedback }); }, get: () => { return Feedback ? Feedback : class { constructor() { if (!loading) { loadScript("//s1.hdslb.com/bfs/seed/jinkela/commentpc/comment.min.js").then(() => { Array.from(document.styleSheets).forEach((d) => { d.href && d.href.includes("comment") && (d.disabled = true); }); }); loading = true; } setTimeout(() => { let bbcomment = new window.bbComment(...arguments); bbcomment.events && (bbcomment.events = Object.assign(bbcomment.events, events)); }); } on(eventName, cb) { if (!events[eventName]) { events[eventName] = []; } events[eventName].push(cb); } }; } }); } initComment() { Reflect.defineProperty(window, "initComment", { configurable: true, set: (v) => true, get: () => { if (load) { let initComment2 = function(tar, init) { new Feedback(tar, init.oid, init.pageType, init.userStatus); }; var initComment = initComment2; Reflect.defineProperty(window, "initComment", { configurable: true, value: initComment2 }); return initComment2; } return function() { if (!loading) { loadScript(\`//s1.hdslb.com/bfs/seed/jinkela/commentpc/comment.min.js\`).then(() => { load = true; }); } loading = true; setTimeout(() => window.initComment(...arguments), 100); }; } }); } /** 修复按时间排序评论翻页数 */ pageCount() { let page; jsonpHook(["api.bilibili.com/x/v2/reply?", "sort=2"], void 0, (res) => { if (0 === res.code && res.data?.page) { page = res.data.page; } return res; }, false); jsonpHook(["api.bilibili.com/x/v2/reply?", "sort=0"], void 0, (res) => { if (page && 0 === res.code && res.data?.page) { page.count && (res.data.page.count = page.count); page.acount && (res.data.page.acount = page.acount); } return res; }, false); } /** 修补评论组件 */ bbCommentModify() { this.styleFix(); this.initAbtest(); this._renderBottomPagination(); this._createListCon(); this._createSubReplyItem(); this._registerEvent(); this._resolvePictures(); this.BLOD.status.commentJumpUrlTitle && this._resolveJump(); } /** 样式修补 */ styleFix() { addCss(\`.bb-comment .comment-list .list-item .info .btn-hover, .comment-bilibili-fold .comment-list .list-item .info .btn-hover { line-height: 24px; }\`, "comment-btn-24pxH"); addCss(\`.operation.btn-hide-re .opera-list {visibility: visible}\`, "keep-operalist-visible"); addCss(".image-exhibition {margin-top: 8px;user-select: none;} .image-exhibition .image-item-wrap {max-width: 240px;display: flex;justify-content: center;position: relative;border-radius: 4px;overflow: hidden;cursor: zoom-in;} .image-exhibition .image-item-wrap.vertical {flex-direction: column} .image-exhibition .image-item-wrap.extra-long {justify-content: start;} .image-exhibition .image-item-wrap img {width: 100%;}", "image-exhibition"); } /** 退出abtest,获取翻页评论区 */ initAbtest() { Feedback.prototype.initAbtest = function() { this.abtest = {}; this.abtest.optimize = false; if (this.jumpId || this.noPage) { this.abtest.optimize = false; } if (this.appMode === "comic") { this.abtest.optimize = false; } this._registerEvent(); this.init(); }; } /** 添加回小页码区 */ _renderBottomPagination() { Feedback.prototype._renderBottomPagination = function(pageInfo) { if (this.noPage) { var isLastPage = pageInfo.count <= this.pageSize; var html = ""; if (isLastPage) { html = "没有更多了~"; } else { html = '查看更多评论'; } this.\$root.find(".bottom-page").addClass("center").html(html); return; } const count = Math.ceil(pageInfo.count / pageInfo.size); if (count > 1) { this.\$root.find(".header-interaction").addClass("paging-box").paging({ pageCount: count, current: pageInfo.num, backFn: (p) => { this.\$root.trigger("replyPageChange", { p, isBottom: true }); this.trigger("replyPageChange", { p, isBottom: true }); this.currentPage = p; } }); this.\$root.find(".bottom-page").paging({ pageCount: count, current: pageInfo.num, jump: true, smallSize: this.smallPager, backFn: (p) => { this.\$root.trigger("replyPageChange", { p, isBottom: true }); this.trigger("replyPageChange", { p, isBottom: true }); this.currentPage = p; } }); } else { this.\$root.find(".header-page").html(""); this.\$root.find(".bottom-page").html(""); } }; } /** 顶层评论ip属地 */ _createListCon() { Feedback.prototype._createListCon = function(item, i, pos) { const blCon = this._parentBlacklistDom(item, i, pos); const con = [ '
', '
' + this._createNickNameDom(item), this._createLevelLink(item), this._identity(item.mid, item.assist, item.member.fans_detail), this._createNameplate(item.member.nameplate) + this._createUserSailing(item) + "
", this._createMsgContent(item), this._resolvePictures(item.content), this._createPerfectReply(item), '
', item.floor ? '#' + item.floor + "" : "", this._createPlatformDom(item.content.plat), '', ''.concat(this._formateTime(item.ctime), ""), item?.reply_control?.location ? \`\${item?.reply_control?.location || ""}\` : "", "", item.lottery_id ? "" : '", item.lottery_id ? "" : '', item.lottery_id ? "" : this._createReplyBtn(item.rcount), item.lottery_id && item.mid !== this.userStatus.mid ? "" : '
    ' + (this._canSetTop(item) ? '
  • ' + (item.isUpTop ? "取消置顶" : "设为置顶") + "
  • " : "") + (this._canBlackList(item.mid) ? '
  • 加入黑名单
  • ' : "") + (this._canReport(item.mid) ? '
  • 举报
  • ' : "") + (this._canDel(item.mid) && !item.isTop ? '
  • 删除
  • ' : "") + "
", this._createLotteryContent(item.content), this._createVoteContent(item.content), this._createTags(item), "
", '
', this._createSubReplyList(item.replies, item.rcount, false, item.rpid, item.folder && item.folder.has_folded, item.reply_control), "
", '
', "
", "
" ].join(""); return item.state === this.blacklistCode ? blCon : con; }; } /** 楼中楼评论ip属地 */ _createSubReplyItem() { Feedback.prototype._createSubReplyItem = function(item, i) { if (item.invisible) { return ""; } return [ '
', this._createSubReplyUserFace(item), '
', '
', this._createNickNameDom(item), this._createLevelLink(item), this._identity(item.mid, item.assist, item.member.fans_detail), this._createSubMsgContent(item), "
", "
", '
', item.floor ? '#' + item.floor + "" : "", this._createPlatformDom(item.content.plat), '', ''.concat(this._formateTime(item.ctime), ""), item?.reply_control?.location ? \`\${item?.reply_control?.location || ""}\` : "", "", '", '', '回复', item.dialog != item.rpid ? '查看对话' : "", '
    ' + (this._canBlackList(item.mid) ? '
  • 加入黑名单
  • ' : "") + (this._canReport(item.mid) ? '
  • 举报
  • ' : "") + (this._canDel(item.mid) ? '
  • 删除
  • ' : "") + "
", "
", "
" ].join(""); }; } /** 楼中楼“查看对话按钮” & 让评论菜单可以通过再次点击按钮来关闭 */ _registerEvent() { const _registerEvent = Feedback.prototype._registerEvent; Feedback.prototype._registerEvent = function(e) { _registerEvent.call(this, e); let n = this.\$root; let \$ = window.\$; if (e) n = \$(e); let l = this; n.on("click.dialog", ".dialog", function() { let clickTarget = this; clickTarget.innerHTML = "正在载入……"; let rootid = clickTarget.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("data-id"); let dialogid = clickTarget.getAttribute("dialog-id"); let selfRpid = clickTarget.getAttribute("data-id"); addCss(\` .comment-dialog .dialog{display:none!important} .comment-dialog > .comment-list{transform:translateY(-13px)} .comment-dialog{min-height:200px;max-height:70vh;overflow-y:auto} .comment-dialog-container{width:600px;z-index:100000;position:fixed;background:#fff;left:50%;top:50%;transform:translate(-50%,-50%);box-shadow:0 0 20px 3px #0000005c;border-radius:10px;padding:0 18px;opacity:1;transition:opacity 0.1s} .comment-dialog-container.hidden{opacity:0}\`, "comment-dialog"); let container = document.createElement("div"); container.className = "comment-dialog-container hidden"; container.innerHTML = \`
\`; document.body.appendChild(container); let replyBox = container.getElementsByClassName("reply-box")[0]; setTimeout(() => { let closeWindow = (e2) => { if (!container.contains(e2.target) && e2.target != container) { container.className = "comment-dialog-container hidden"; setTimeout(() => container.remove(), 100); clickTarget.innerHTML = "查看对话"; window.removeEventListener("click", closeWindow, false); } }; window.addEventListener("click", closeWindow); }, 0); function fetchDialog(minFloor) { return \$.ajax({ url: "//api.bilibili.com/x/v2/reply/dialog/cursor", type: "GET", data: { type: l.pageType, oid: l.oid, root: rootid, dialog: dialogid, size: 20, min_floor: minFloor }, xhrFields: { withCredentials: true } }); } function fixEmojiPosition(node) { node = \$(node); node.find(".reply-item").each(function(_, n2) { var t = \$(n2).find(".reply-face"), r = \$(n2).find(".user"), n2 = \$(n2).find(".name"); t && r && n2 && (10 < n2.offset().top - r.offset().top ? t.css("top", "32px") : t.css("top", "0")); }); } fetchDialog(0).done((resp) => { if (resp.code == 0 && resp.data.replies && resp.data.replies.length > 0) { let nextPage2 = function(minFloor) { if (minFloor < resp.data.dialog.max_floor) { fetchDialog(minFloor + 1).done((resp2) => { if (resp2.code == 0 && resp2.data.replies && resp2.data.replies.length > 0) { replyBox.insertAdjacentHTML("beforeend", l._createSubReplyList(resp2.data.replies, resp2.data.replies.length, true, rootid, null, false)); nextPage2(resp2.data.cursor.max_floor); } }); } else { fixEmojiPosition(replyBox); replyBox.querySelector(\`div[data-id="\${selfRpid}"]\`).style.cssText = \` background: linear-gradient(45deg, rgba(115,108,231,0.13) 0%, rgba(0,161,214,0.13) 67%, rgba(0,212,255,0.13) 100%); border-radius: 15px; margin-right: 15px;\`; } }; var nextPage = nextPage2; replyBox.innerHTML = l._createSubReplyList(resp.data.replies, resp.data.replies.length, true, rootid, null, false); l._registerEvent(container); container.className = "comment-dialog-container"; fixEmojiPosition(replyBox); nextPage2(resp.data.cursor.max_floor); } }); }); n.off("click.operation", ".spot"); n.on("click.operation", ".spot", function(e2) { let operalist = this.parentNode.getElementsByClassName("opera-list")[0]; if (l.lastClickOperation != this || operalist && operalist.style.display == "none") { \$(".opera-list").hide(), \$(this).siblings(".opera-list").show(), e2.stopPropagation(), \$(this).hasClass("more-operation") && (e2 = +\$(this).parents(".reply-wrap:eq(0)").attr("data-id")); l.lastClickOperation = this; } else operalist && (operalist.style.display = "none"); }); }; } _resolveJump() { Feedback.prototype._resolveJump = function(str, jumpUrl) { var jumpUrlSortKeyList = []; for (var item in jumpUrl) { if (item.startsWith("http")) { jumpUrlSortKeyList.unshift(item); } else { jumpUrlSortKeyList.push(item); } } for (var _i = 0, _jumpUrlSortKeyList = jumpUrlSortKeyList; _i < _jumpUrlSortKeyList.length; _i++) { var jumpKey = _jumpUrlSortKeyList[_i]; if (str.includes(jumpKey)) { var _jumpInfo\$extra; var jumpInfo = jumpUrl[jumpKey]; var img = jumpInfo.prefix_icon ? '' : ""; var content = jumpKey; if ((_jumpInfo\$extra = jumpInfo.extra) !== null && _jumpInfo\$extra !== void 0 && _jumpInfo\$extra.is_word_search) { continue; } else { var url = jumpInfo.pc_url ? jumpInfo.pc_url : jumpKey.indexOf("http") === 0 ? jumpKey : this._createLinkById(jumpKey); var res = img + (jumpInfo.state === 0 ? '' + content + "" : content); var reg = new RegExp(jumpKey.replace(/\\?/, "\\\\?"), "ig"); try { var regStr = jumpKey.replace(/\\(/g, "\\\\(").replace(/\\)/g, "\\\\)").replace(/\\?/, "\\\\?"); var reg = new RegExp(regStr, "ig"); str = str.replace(reg, res); } catch (e) { } } this.jumpReport[this.jumpReportIndex] = jumpInfo.click_report; this.jumpReportIndex++; } } return BV2avAll(str); }; } /** 评论图片 */ _resolvePictures() { Feedback.prototype._resolvePictures = function(content) { const pictureList = []; if (content) { if (content.rich_text?.note?.images) { content.pictures || (content.pictures = []); content.rich_text.note.images.forEach((d) => { content.pictures.push({ img_src: d, click_url: content.rich_text.note.click_url }); }); } if (content.pictures && content.pictures.length) { pictureList.push(\`
\`); content.pictures.forEach((d) => { const type = d.img_width >= d.img_height ? "horizontal" : "vertical"; const extraLong = d.img_width / d.img_height >= 3 || d.img_height / d.img_width >= 3; pictureList.push( '\` ); }); pictureList.push(\`
\`); } } return pictureList.join(""); }; } }; // src/io/grpc/api-dm-web.ts var import_light = __toESM(require_light()); // src/json/dm-web.json var dm_web_default = { nested: { bilibili: { nested: { community: { nested: { service: { nested: { dm: { nested: { v1: { nested: { DmWebViewReply: { fields: { state: { type: "int32", id: 1 }, text: { type: "string", id: 2 }, textSide: { type: "string", id: 3 }, dmSge: { type: "DmSegConfig", id: 4 }, flag: { type: "DanmakuFlagConfig", id: 5 }, specialDms: { rule: "repeated", type: "string", id: 6 }, checkBox: { type: "bool", id: 7 }, count: { type: "int64", id: 8 }, commandDms: { rule: "repeated", type: "CommandDm", id: 9 }, dmSetting: { type: "DanmuWebPlayerConfig", id: 10 }, reportFilter: { rule: "repeated", type: "string", id: 11 } } }, CommandDm: { fields: { id: { type: "int64", id: 1 }, oid: { type: "int64", id: 2 }, mid: { type: "int64", id: 3 }, command: { type: "string", id: 4 }, content: { type: "string", id: 5 }, progress: { type: "int32", id: 6 }, ctime: { type: "string", id: 7 }, mtime: { type: "string", id: 8 }, extra: { type: "string", id: 9 }, idStr: { type: "string", id: 10 } } }, DmSegConfig: { fields: { pageSize: { type: "int64", id: 1 }, total: { type: "int64", id: 2 } } }, DanmakuFlagConfig: { fields: { recFlag: { type: "int32", id: 1 }, recText: { type: "string", id: 2 }, recSwitch: { type: "int32", id: 3 } } }, DmSegMobileReply: { fields: { elems: { rule: "repeated", type: "DanmakuElem", id: 1 } } }, DanmakuElem: { fields: { id: { type: "int64", id: 1 }, progress: { type: "int32", id: 2 }, mode: { type: "int32", id: 3 }, fontsize: { type: "int32", id: 4 }, color: { type: "uint32", id: 5 }, midHash: { type: "string", id: 6 }, content: { type: "string", id: 7 }, ctime: { type: "int64", id: 8 }, weight: { type: "int32", id: 9 }, action: { type: "string", id: 10 }, pool: { type: "int32", id: 11 }, idStr: { type: "string", id: 12 }, attr: { type: "int32", id: 13 } } }, DanmuWebPlayerConfig: { fields: { dmSwitch: { type: "bool", id: 1 }, aiSwitch: { type: "bool", id: 2 }, aiLevel: { type: "int32", id: 3 }, blocktop: { type: "bool", id: 4 }, blockscroll: { type: "bool", id: 5 }, blockbottom: { type: "bool", id: 6 }, blockcolor: { type: "bool", id: 7 }, blockspecial: { type: "bool", id: 8 }, preventshade: { type: "bool", id: 9 }, dmask: { type: "bool", id: 10 }, opacity: { type: "float", id: 11 }, dmarea: { type: "int32", id: 12 }, speedplus: { type: "float", id: 13 }, fontsize: { type: "float", id: 14 }, screensync: { type: "bool", id: 15 }, speedsync: { type: "bool", id: 16 }, fontfamily: { type: "string", id: 17 }, bold: { type: "bool", id: 18 }, fontborder: { type: "int32", id: 19 }, drawType: { type: "string", id: 20 } } } } } } } } } } } } } } }; // src/utils/danmaku.ts var DanmakuBase = class { /** 从小到大排序弹幕 */ static sortDmById(dms) { dms.sort((a, b) => this.bigInt(a.idStr, b.idStr) ? 1 : -1); } /** 比较两个弹幕ID先后 */ static bigInt(num1, num2) { String(num1).replace(/\\d+/, (d) => num1 = d.replace(/^0+/, "")); String(num2).replace(/\\d+/, (d) => num2 = d.replace(/^0+/, "")); if (num1.length > num2.length) return true; else if (num1.length < num2.length) return false; else { for (let i = 0; i < num1.length; i++) { if (num1[i] > num2[i]) return true; if (num1[i] < num2[i]) return false; } return false; } } /** 重构为旧版弹幕类型 */ static parseCmd(dms) { return dms.map((d) => { const dm = { class: d.pool || 0, color: d.color || 0, date: d.ctime || 0, dmid: d.idStr || "", mode: +d.mode || 1, pool: d.pool || 0, size: d.fontsize || 25, stime: d.progress / 1e3 || 0, text: d.content && d.mode != 8 && d.mode != 9 ? d.content.replace(/(\\/n|\\\\n|\\n|\\r\\n)/g, "\\n") : d.content, uhash: d.midHash || "", uid: d.midHash || "", weight: d.weight, attr: d.attr }; d.action?.startsWith("picture:") && (dm.html = \`\`); return dm; }); } /** 解析解码xml弹幕 */ static decodeXml(xml) { if (typeof xml === "string") { xml = xml.replace(/((?:[\\0-\\x08\\x0B\\f\\x0E-\\x1F\\uFFFD\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))/g, ""); xml = new DOMParser().parseFromString(xml, "application/xml"); } const items = xml.querySelectorAll("d"); const dms = []; items.forEach((d) => { const json = d.getAttribute("p").split(","); const text = d.textContent || d.text; if (text) { const dm = { pool: Number(json[5]), color: Number(json[3]), ctime: Number(json[4]), id: Number(json[7]), idStr: String(json[7]), mode: Number(json[1]), fontsize: Number(json[2]), progress: Number(json[0]) * 1e3, content: String(text), midHash: json[6] }; dms.push(dm); } }); return dms; } /** 编码xml弹幕 */ static encodeXml(dms, cid) { return dms.reduce((s, d) => { s += \`\${d.text.replace(/[<&]/g, (a) => { return { "<": "<", "&": "&" }[a]; }).replace(/(\\n|\\r\\n)/g, "/n")} \`; return s; }, \`chat.api.bilibili.com\${cid}0\${dms.length}00k-v \`) + ""; } }; // src/io/grpc/api-dm-web.ts var _ApiDmWeb = class { constructor(aid, cid) { this.aid = aid; this.cid = cid; _ApiDmWeb.Root || _ApiDmWeb.RootInit(); } static RootInit() { this.Root = import_light.Root.fromJSON(dm_web_default); this.DmWebViewReply = this.Root.lookupType("DmWebViewReply"); this.DmSegMobileReply = this.Root.lookupType("DmSegMobileReply"); } danmaku = []; /** 获取新版弹幕 */ async getData() { if (!this.danmaku.length) { const dmWebView = await this.DmWebViewReply(); const pageSize = dmWebView.dmSge.pageSize ? dmWebView.dmSge.pageSize / 1e3 : 360; const total = this.aid == window.aid && window.player?.getDuration?.() / pageSize + 1 || dmWebView.dmSge.total; const promises = []; for (let i = 1; i <= total; i++) { promises.push( this.DmSegMobileReply(i).then((d) => { d.elems && (this.danmaku = this.danmaku.concat(d.elems)); }).catch((e) => { console.warn("弹幕丢包:", \`segment_index=\${i}\`, e); }) ); } dmWebView.specialDms && dmWebView.specialDms.forEach((d) => { promises.push( this.specialDm(d.replace("http:", "")).then((d2) => { d2.elems && (this.danmaku = this.danmaku.concat(d2.elems)); }).catch((e) => { console.warn("高级弹幕丢包:", d, e); }) ); }); await Promise.all(promises); DanmakuBase.sortDmById(this.danmaku); } return this.danmaku; } /** 获取旧版弹幕 */ async toCmd() { const danmaku = await this.getData(); return DanmakuBase.parseCmd(danmaku); } /** 获取弹幕分包 */ async DmWebViewReply() { const response = await fetch(objUrl(URLS.DM_WEB_VIEW, { type: 1, oid: this.cid, pid: this.aid }), { credentials: "include", cache: "force-cache" }); const arraybuffer = await response.arrayBuffer(); const msg = _ApiDmWeb.DmWebViewReply.decode(new Uint8Array(arraybuffer)); return _ApiDmWeb.DmWebViewReply.toObject(msg); } /** 获取弹幕分包 */ async DmSegMobileReply(segment_index = 1) { const response = await fetch(objUrl(URLS.DM_WEB_SEG_SO, { type: 1, oid: this.cid, pid: this.aid, segment_index }), { credentials: "include" }); const arraybuffer = await response.arrayBuffer(); const msg = _ApiDmWeb.DmSegMobileReply.decode(new Uint8Array(arraybuffer)); return _ApiDmWeb.DmSegMobileReply.toObject(msg); } /** 获取高级弹幕 */ async specialDm(url) { const response = await fetch(url); const arraybuffer = await response.arrayBuffer(); const msg = _ApiDmWeb.DmSegMobileReply.decode(new Uint8Array(arraybuffer)); return _ApiDmWeb.DmSegMobileReply.toObject(msg); } }; var ApiDmWeb = _ApiDmWeb; __publicField(ApiDmWeb, "Root"); __publicField(ApiDmWeb, "DmWebViewReply"); __publicField(ApiDmWeb, "DmSegMobileReply"); // src/utils/file.ts function readAs(file, type = "string", encoding = "utf-8") { return new Promise((resolve, reject) => { const reader = new FileReader(); switch (type) { case "ArrayBuffer": reader.readAsArrayBuffer(file); break; case "DataURL": reader.readAsDataURL(file); break; case "string": reader.readAsText(file, encoding); break; } reader.onload = () => resolve(reader.result); reader.onerror = (e) => reject(e); }); } async function saveAs(content, fileName, contentType = "text/plain") { const a = document.createElement("a"); const file = new Blob([content], { type: contentType }); a.href = URL.createObjectURL(file); a.download = fileName; a.addEventListener("load", () => URL.revokeObjectURL(a.href)); a.click(); } function fileRead(accept, multiple) { return new Promise((resolve, reject) => { const input = document.createElement("input"); let selected = false; input.type = "file"; accept && (input.accept = accept); multiple && (input.multiple = multiple); input.style.opacity = "0"; input.addEventListener("change", () => { selected = true; resolve(input.files); }); document.body.appendChild(input); input.click(); window.addEventListener("focus", () => { setTimeout(() => { selected || reject("取消选择~"); }, 100); }, { once: true }); }); } // src/utils/format/size.ts function sizeFormat(size = 0) { let unit = ["B", "K", "M", "G"], i = unit.length - 1, dex = 1024 ** i, vor = 1e3 ** i; while (dex > 1) { if (size >= vor) { size = Number((size / dex).toFixed(2)); break; } dex = dex / 1024; vor = vor / 1e3; i--; } return size ? size + unit[i] : "N/A"; } // src/utils/hook/worker.ts var _WorkerHook = class { /** Worker.prototype.postMessage hook init. */ static postMessageHook() { this.postMessage = Worker.prototype.postMessage; Worker.prototype.postMessage = function(message, transfer) { let ishook = false; _WorkerHook.postMessageCallback.forEach((d) => { d.call(this, message, transfer) && (ishook = true); }); ishook || _WorkerHook.postMessage.call(this, message, transfer); }; } constructor() { _WorkerHook.postMessage || _WorkerHook.postMessageHook(); } /** * Worker.prototype.postMessage hook. * @param callback 检查并处理\`Worker.prototype.postMessage\`的回调函数,继承原传参,返回 **true** 时拦截该实例。 * @returns 取消该hook的方法,执行后不再hook。 */ postMessage(callback) { const id = _WorkerHook.postMessageCallback.push(callback); return () => { id >= 0 && delete _WorkerHook.postMessageCallback[id - 1]; }; } }; var WorkerHook = _WorkerHook; /** Worker.prototype.postMessage backup. */ __publicField(WorkerHook, "postMessage"); __publicField(WorkerHook, "postMessageCallback", []); // src/io/api-bangumi-season.ts async function apiBangumiSeason(data) { const response = await fetch(objUrl(URLS.BANGUMI_SEASON, data), { credentials: "include" }); const json = await response.json(); return jsonCheck(json).result; } // src/io/api-view-detail.ts var ApiViewDetail = class { code = 0; data = { Card: { archive_count: -1, article_count: -1, card: {}, follower: -1, following: false, like_num: -1, space: {} }, Related: [], Reply: { page: {}, replies: [] }, Spec: null, Tags: [], View: {}, elec: null, hot_share: {}, recommend: null, view_addit: {} }; message = "0"; ttl = 1; }; async function apiViewDetail(aid) { const response = await fetch(objUrl(URLS.VIEW_DETAIL, { aid })); const json = await response.json(); return jsonCheck(json).data; } // src/io/api-biliplus-view.ts var apiBiliplusView = class { constructor(aid) { this.aid = aid; this.fetch = fetch(objUrl("//www.biliplus.com/api/view", { id: aid })); } fetch; async getDate() { const respense = await this.fetch; return await respense.json(); } /** 转化为\`apiViewDetail\`格式 */ async toDetail() { const json = await this.getDate(); return this.view2Detail(json); } view2Detail(data) { const result = new ApiViewDetail(); if (data.v2_app_api) { delete data.v2_app_api.redirect_url; result.data.Card.follower = data.v2_app_api.owner_ext?.fans; result.data.Card.card = { ...data.v2_app_api.owner, ...data.v2_app_api.owner_ext }; result.data.Tags = data.v2_app_api.tag; result.data.View = data.v2_app_api; xhrHook(\`api.bilibili.com/x/web-interface/view?aid=\${this.aid}\`, void 0, (res) => { const t = \`{"code": 0,"message":"0","ttl":1,"data":\${JSON.stringify(result.data.View)}}\`; res.responseType === "json" ? res.response = JSON.parse(t) : res.response = res.responseText = t; }, false); xhrHook(\`api.bilibili.com/x/web-interface/archive/stat?aid=\${this.aid}\`, void 0, (res) => { const t = \`{"code": 0,"message":"0","ttl":1,"data":\${JSON.stringify({ ...result.data.View.stat, aid: this.aid })}}\`; res.responseType === "json" ? res.response = JSON.parse(t) : res.response = res.responseText = t; }, false); return JSON.parse(JSON.stringify(result)); } else return this.view2Detail_v1(data); } view2Detail_v1(data) { const result = new ApiViewDetail(); const p = Number(getUrlValue("p")); result.data.Card.card = { face: "//static.hdslb.com/images/akari.jpg", mid: data.mid, name: data.author, vip: {} }; result.data.View = { aid: data.aid || data.id || this.aid, cid: data.list[p ? p - 1 : 0].cid, copyright: 1, ctime: data.created, dimension: { width: 1920, height: 1080, rotate: 0 }, duration: -1, owner: result.data.Card.card, pages: data.list.map((d) => { d.dimension = { width: 1920, height: 1080, rotate: 0 }; return d; }), pic: data.pic, pubdate: data.lastupdatets, rights: {}, stat: { aid: data.aid || data.id || this.aid, coin: data.coins, danmaku: data.video_review, dislike: 0, evaluation: "", favorite: data.favorites, his_rank: 0, like: -1, now_rank: 0, reply: -1, share: -1, view: data.play }, state: 0, subtitle: { allow_submit: false, list: [] }, tid: data.tid, title: data.title, tname: data.typename, videos: data.list.length }; data.bangumi && (result.data.View.season = data.bangumi); xhrHook(\`api.bilibili.com/x/web-interface/view?aid=\${this.aid}\`, void 0, (res) => { const t = \`{"code": 0,"message":"0","ttl":1,"data":\${JSON.stringify(result.data.View)}}\`; res.responseType === "json" ? res.response = JSON.parse(t) : res.response = res.responseText = t; }, false); xhrHook(\`api.bilibili.com/x/web-interface/archive/stat?aid=\${this.aid}\`, void 0, (res) => { const t = \`{"code": 0,"message":"0","ttl":1,"data":\${JSON.stringify({ ...result.data.View.stat, aid: this.aid })}}\`; res.responseType === "json" ? res.response = JSON.parse(t) : res.response = res.responseText = t; }, false); return JSON.parse(JSON.stringify(result)); } }; // src/io/api-player-pagelist.ts async function apiPlayerPagelist(aid) { const response = await fetch(objUrl(URLS.PAGE_LIST, { aid })); const json = await response.json(); return jsonCheck(json).data; } // src/io/api-view.ts async function apiView(aid) { const response = await fetch(objUrl(URLS.VIEW, { appkey: "8e9fc618fbd41e28", id: aid, type: "json" })); return await response.json(); } // src/io/api-x-view.ts async function apiXView(aid) { const response = await fetch(objUrl(URLS.X_VIEW, { aid })); const json = await response.json(); return jsonCheck(json).data; } // src/utils/utils.ts function getUrlValue(name) { const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|\$)", "i"); const r = window.location.search.substr(1).match(reg); if (r != null) return decodeURIComponent(r[2]); return null; } var catchs = { aid: {}, ssid: {}, epid: {} }; async function urlParam(url, redirect = true) { url && !url.includes("?") && (url = "?" + url); const obj = urlObj(url); let { aid, cid, ssid, epid, p } = obj; let pgc = false; !aid && (aid = obj.avid); !aid && url.replace(/[aA][vV]\\d+/, (d) => aid = d.substring(2)); !aid && url.replace(/[bB][vV]1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}/, (d) => aid = abv(d)); !aid && obj.bvid && (aid = abv(obj.bvid)); aid && !Number(aid) && (aid = abv(aid)); p = p || 1; !ssid && (ssid = obj.seasonId); !ssid && (ssid = obj.season_id); !ssid && url.replace(/[sS][sS]\\d+/, (d) => ssid = d.substring(2)); !epid && (epid = obj.episodeId); !epid && (epid = obj.ep_id); !epid && url.replace(/[eE][pP]\\d+/, (d) => epid = d.substring(2)); if (!ssid && !epid && aid) { if (catchs.aid[aid]) return catchs.aid[aid][p - 1] || catchs.aid[aid][0]; if (!cid) { try { let data = await apiXView(aid); if (data.redirect_url) return urlParam(objUrl(data.redirect_url, { aid, cid, ssid, epid, p })); catchs.aid[aid] = data.pages; catchs.aid[aid].forEach((d) => d.aid = aid); return catchs.aid[aid][p - 1] || catchs.aid[aid][0]; } catch (e) { debug.error("view", e); try { catchs.aid[aid] = await apiPlayerPagelist(aid); catchs.aid[aid].forEach((d) => d.aid = aid); return catchs.aid[aid][p - 1] || catchs.aid[aid][0]; } catch (e2) { debug.error("pagelist", e2); try { catchs.aid[aid] = (await apiView(aid)).list; catchs.aid[aid].forEach((d) => d.aid = aid); return catchs.aid[aid][p - 1] || catchs.aid[aid][0]; } catch (e3) { debug.error("appkey", e3); try { let data = await new apiBiliplusView(aid).getDate(); catchs.aid[aid] = data.list || data.v2_app_api && data.v2_app_api.pages; catchs.aid[aid].forEach((d) => d.aid = aid); if (redirect && data.v2_app_api && data.v2_app_api.redirect_url) return urlParam(objUrl(data.v2_app_api.redirect_url, { aid, cid, ssid, epid, p })); return catchs.aid[aid][p - 1] || catchs.aid[aid][0]; } catch (e4) { debug.error("biliplus", e4); } } } } } } if (ssid || epid) { if (ssid && catchs.ssid[ssid]) return catchs.ssid[ssid][p - 1] || catchs.ssid[ssid][0]; if (epid && catchs.epid[epid]) return catchs.epid[epid]; pgc = true; let data = await apiBangumiSeason({ ep_id: epid, season_id: ssid }); ssid = data.season_id; catchs.ssid[ssid] = []; data.episodes.forEach((d) => { Object.assign(d, { ssid, pgc, epid: d.ep_id }); catchs.aid[d.aid] = catchs.aid[d.aid] || []; catchs.aid[d.aid].push(d); catchs.ssid[ssid].push(catchs.epid[d.ep_id] = d); }); if (epid) return catchs.epid[epid]; return catchs.ssid[ssid][p - 1] || catchs.ssid[ssid][0]; } return { aid, cid, ssid, epid, p, pgc }; } // src/core/danmaku.ts var Danmaku = class { constructor(BLOD2) { this.BLOD = BLOD2; BLOD2.userLoadedCallback((status) => { if (!status.bilibiliplayer) { this.listSoFix(); } }); } listSoFixed = false; /** 原生旧版播放器使用protobuf弹幕 */ listSoFix() { if (this.listSoFixed) return; this.listSoFixed = true; const that = this; new WorkerHook().postMessage(function(message) { if (message.url && message.url.includes("list.so")) { that.BLOD.status.dmwrap && that.trim(); if (!that.BLOD.status.dmproto) return false; const params = urlObj(message.url); const startTime = new Date().getTime(); that.getSegDanmaku(void 0, params.oid).then((d) => { this.dispatchEvent(new MessageEvent("message", { data: { code: 0, danmakuArray: d, loadTime: new Date().getTime() - startTime, parseTime: Math.random(), sendTip: "", state: 0, textSide: "", total: d.length.toString() } })); }).catch((e) => { console.error("protobuf 弹幕获取失败", e); }); return true; } return false; }); } /** 允许普权弹幕排版 */ trim() { propertyHook(String.prototype, "trim", function() { return String(this); }); } async getSegDanmaku(aid = this.BLOD.aid, cid = this.BLOD.cid) { if (!cid) throw new Error(\`无法获取弹幕 aid:\${aid} cid:\${cid}\`); return new ApiDmWeb(aid, cid).toCmd(); } /** 加载本地xml弹幕 */ localDmXml() { if (!window.player) return this.BLOD.toast.warning("未找到播放器实例!请在播放页面使用。"); if (!window.player?.appendDm) return this.BLOD.toast.warning("未启用【重构播放器】,无法载入弹幕!"); const data = ["请选择一个弹幕文件,拓展名:.xml,编码:utf-8"]; const toast = this.BLOD.toast.toast(0, "info", ...data); fileRead(".xml", false).then((d) => { if (d && d[0]) { data.push("-------loading-------", \`弹幕:\${d[0].name}\`, \`类型:\${d[0].type}\`, \`大小:\${sizeFormat(d[0].size)}\`); toast.data = data; toast.type = "warning"; return readAs(d[0]); } throw new Error(data[0]); }).then((d) => { const dm = DanmakuBase.decodeXml(d); window.player.appendDm(dm, !this.BLOD.status.dmContact); data.push("-------decoding-------", \`有效弹幕数:\${dm.length}\`, \`加载模式:\${this.BLOD.status.dmContact ? "与已有弹幕合并" : "清空已有弹幕"}\`); toast.data = data; toast.type = "success"; }).catch((e) => { data.push(e); debug.error(e); toast.data = data; toast.type = "error"; }).finally(() => { toast.delay = this.BLOD.status.toast.delay; }); } /** 加载本地json弹幕 */ localDmJson() { if (!window.player) return this.BLOD.toast.warning("未找到播放器实例!请在播放页面使用。"); if (!window.player?.appendDm) return this.BLOD.toast.warning("未启用【重构播放器】,无法载入弹幕!"); const data = ["请选择一个弹幕文件,拓展名:.json,编码:utf-8"]; const toast = this.BLOD.toast.toast(0, "info", ...data); fileRead(".json", false).then((d) => { if (d && d[0]) { data.push("-------loading-------", \`弹幕:\${d[0].name}\`, \`类型:\${d[0].type}\`, \`大小:\${sizeFormat(d[0].size)}\`); toast.data = data; toast.type = "warning"; return readAs(d[0]); } throw new Error(data[0]); }).then((d) => { const dm = JSON.parse(d); window.player.appendDm(dm, !this.BLOD.status.dmContact); data.push("-------decoding-------", \`有效弹幕数:\${dm.length}\`, \`加载模式:\${this.BLOD.status.dmContact ? "与已有弹幕合并" : "清空已有弹幕"}\`); toast.data = data; toast.type = "success"; }).catch((e) => { data.push(e); debug.error(e); toast.data = data; toast.type = "error"; }).finally(() => { toast.delay = this.BLOD.status.toast.delay; }); } /** 下载弹幕 */ async download(aid = this.BLOD.aid, cid = this.BLOD.cid) { if (!cid) return this.BLOD.toast.warning("未找到播放器实例!请在播放页面使用。"); const dms = window.player?.getDanmaku ? window.player.getDanmaku() : await new ApiDmWeb(aid, cid).getData(); const metadata = this.BLOD.videoInfo.metadata; const title = metadata ? \`\${metadata.album}(\${metadata.title})\` : \`\${aid}.\${cid}\`; if (this.BLOD.status.dmExtension === "json") { return saveAs(JSON.stringify(dms, void 0, " "), \`\${title}.json\`, "application/json"); } return saveAs(DanmakuBase.encodeXml(DanmakuBase.parseCmd(dms), cid), \`\${title}.xml\`, "application/xml"); } /** 加载在线弹幕 */ async onlineDm(str) { if (!window.player) return this.BLOD.toast.warning("未找到播放器实例!请在播放页面使用。"); if (!window.player?.appendDm) return this.BLOD.toast.warning("未启用【重构播放器】,无法载入弹幕!"); const data = ["-------在线弹幕-------", \`目标:\${str}\`]; const toast = this.BLOD.toast.toast(0, "info", ...data); const { aid, cid } = await urlParam(str); data.push(\`aid:\${aid}\`, \`cid:\${cid}\`); toast.data = data; if (!aid || !cid) { data.push("查询cid信息失败,已退出!"); toast.data = data; toast.type = "error"; toast.delay = this.BLOD.toast.delay; } else { new ApiDmWeb(aid, cid).getData().then((d) => { window.player.appendDm(d, !this.BLOD.status.dmContact); data.push(\`有效弹幕数:\${d.length}\`, \`加载模式:\${this.BLOD.status.dmContact ? "与已有弹幕合并" : "清空已有弹幕"}\`); toast.data = data; toast.type = "success"; }).catch((e) => { data.push(e); debug.error(e); toast.data = data; toast.type = "error"; }).finally(() => { toast.delay = this.BLOD.status.toast.delay; }); } } }; // src/io/fnval.ts var qn = 127; var fnver = 0; var fnval = 0 /* FLV */ + 16 /* DASH_H265 */ + 64 /* HDR */ + 128 /* DASH_4K */ + 256 /* DOLBYAUDIO */ + 512 /* DOLBYVIDEO */ + 1024 /* DASH_8K */ + 2048 /* DASH_AV1 */; // src/io/api-playurl.ts var PlayurlDescriptionMap = { 127: "超高清 8K", 126: "杜比视界", 125: "HDR", 121: "超清 4K", 120: "超清 4K", 116: "高清 1080P60", 112: "高清 1080P+", 80: "高清 1080P", 74: "高清 720P60", 64: "高清 720P", 48: "高清 720P", 32: "清晰 480P", 16: "流畅 360P", 15: "流畅 360P", 6: "流畅 240P", 5: "流畅 144P" }; var PlayurlFormatMap = { 127: "hdflv2", 126: "hdflv2", 125: "hdflv2", 121: "hdflv2", 120: "hdflv2", 116: "flv_p60", 112: "hdflv2", 80: "flv", 74: "flv720_p60", 64: "flv720", 48: "flv720", 32: "flv480", 16: "mp4", 15: "mp4", 6: "mp4", 5: "mp4" }; var PlayurlQualityMap = { 127: "8K", 126: "Dolby", 125: "HDR", 121: "4K", 120: "4K", 116: "1080P60", 112: "1080P+", 80: "1080P", 74: "720P60", 64: "720P", 48: "720P", 32: "480P", 16: "360P", 15: "360P", 6: "240P", 5: "144P" }; var PlayurlCodecs = { 30126: "hvc1.2.4.L153.90", 126: "hvc1.2.4.L153.90", 30121: "hev1.1.6.L156.90", 121: "hev1.1.6.L156.90", 30120: "avc1.64003C", 120: "avc1.64003C", 30112: "avc1.640028", // 1080P+ 112: "avc1.640028", // 1080P+ 30102: "hev1.1.6.L120.90", // HEVC 1080P+ 102: "hev1.1.6.L120.90", // HEVC 1080P+ 30080: "avc1.640028", // 1080P 80: "avc1.640028", // 1080P 30077: "hev1.1.6.L120.90", // HEVC 1080P 77: "hev1.1.6.L120.90", // HEVC 1080P 30064: "avc1.64001F", // 720P 64: "avc1.64001F", // 720P 30066: "hev1.1.6.L120.90", // HEVC 720P 66: "hev1.1.6.L120.90", // HEVC 720P 30032: "avc1.64001E", // 480P 32: "avc1.64001E", // 480P 30033: "hev1.1.6.L120.90", // HEVC 480P 33: "hev1.1.6.L120.90", // HEVC 480P 30011: "hev1.1.6.L120.90", // HEVC 360P 11: "hev1.1.6.L120.90", // HEVC 360P 30016: "avc1.64001E", // 360P 16: "avc1.64001E", // 360P 30006: "avc1.64001E", //240P 6: "avc1.64001E", // 240P 30005: "avc1.64001E", // 144P 5: "avc1.64001E", // 144P 30251: "fLaC", // Hires 30250: "ec-3", // Dolby 30280: "mp4a.40.2", // 高码音频 30232: "mp4a.40.2", // 中码音频 30216: "mp4a.40.2" // 低码音频 }; var PlayurlCodecsAPP = { 30016: "avc1.64001E", // APP源 360P 16: "avc1.64001E", // APP源 360P 30032: "avc1.64001F", // APP源 480P 32: "avc1.64001F", // APP源 480P 30064: "avc1.640028", // APP源 720P 64: "avc1.640028", // APP源 720P 30080: "avc1.640032", // APP源 1080P 80: "avc1.640032", // APP源 1080P 30216: "mp4a.40.2", // APP源 低码音频 30232: "mp4a.40.2", // APP源 中码音频 30280: "mp4a.40.2" // APP源 高码音频 }; var PlayurlFrameRate = { 30121: "16000/672", 121: "16000/672", 30120: "16000/672", 120: "16000/672", 30112: "16000/672", 112: "16000/672", 30102: "16000/672", 102: "16000/672", 30080: "16000/672", 80: "16000/672", 30077: "16000/656", 77: "16000/656", 30064: "16000/672", 64: "16000/672", 30066: "16000/656", 66: "16000/656", 30032: "16000/672", 32: "16000/672", 30033: "16000/656", 33: "16000/656", 30011: "16000/656", 11: "16000/656", 30016: "16000/672", 16: "16000/672", 30006: "16000/672", 6: "16000/672", 30005: "16000/672", 5: "16000/672" }; var PlayurlResolution = { 30121: [3840, 2160], 121: [3840, 2160], 30120: [3840, 2160], 120: [3840, 2160], 30112: [1920, 1080], // 1080P+ 112: [1920, 1080], // 1080P+ 30102: [1920, 1080], // HEVC 1080P+ 102: [1920, 1080], // HEVC 1080P+ 30080: [1920, 1080], // 1080P 80: [1920, 1080], // 1080P 30077: [1920, 1080], // HEVC 1080P 77: [1920, 1080], // HEVC 1080P 30064: [1280, 720], // 720P 64: [1280, 720], // 720P 30066: [1280, 720], // HEVC 720P 66: [1280, 720], // HEVC 720P 30032: [852, 480], // 480P 32: [852, 480], // 480P 30033: [852, 480], // HEVC 480P 33: [852, 480], // HEVC 480P 30011: [640, 360], // HEVC 360P 11: [640, 360], // HEVC 360P 30016: [640, 360], // 360P 16: [640, 360], // 360P 30006: [426, 240], // 240P 6: [426, 240], // 240P 30005: [256, 144], // 144P 5: [256, 144] // 144P }; var PlayurlDash = class { accept_description = []; accept_format = ""; accept_quality = []; bp = 0; code = 0; dash = { audio: [], dolby: { audio: [], type: 0 }, duration: 0, min_buffer_time: 1.5, minBufferTime: 1.5, video: [] }; fnval = 4048; fnver = 0; format = "flv"; from = "local"; has_paid = true; is_preview = 0; message = ""; no_rexcode = 1; quality = 80; result = "suee"; seek_param = "start"; seek_type = "offset"; status = 2; support_formats = []; timelength = 0; type = "DASH"; video_codecid = 7; video_project = true; }; async function apiPlayurl(data, dash = true, pgc = false, server = "api.bilibili.com") { data = Object.assign({ qn, otype: "json", fourk: 1 }, data, dash ? { fnver, fnval } : {}); const response = await fetch(objUrl(pgc ? URLS.PGC_PLAYURL.replace("api.bilibili.com", server) : URLS.PLAYURL, data), { credentials: "include" }); const json = await response.json(); if (pgc) { return jsonCheck(json).result; } return jsonCheck(json).data; } // src/io/api-playurl-interface.ts var ApiPlayurlInterface = class extends ApiSign { constructor(data, pgc = false) { super(pgc ? URLS.PLAYURL_BANGUMI : URLS.PLAYURL_INTERFACE, "YvirImLGlLANCLvM"); this.data = data; this.data = Object.assign({ otype: "json", qn: data.quality, type: "", fnver, fnval }, data, pgc ? { module: "bangumi", season_type: 1 } : {}); } async getData() { const response = await fetch(this.sign(this.data), { credentials: "include" }); return await response.json(); } toJSON() { return this.sign(this.data); } }; // src/io/api-playurl-intl.ts var ApiPlayurlIntl = class extends ApiSign { constructor(data, fetch2 = self.fetch, dash = true, pgc = false) { super(pgc ? URLS.INTL_OGV_PLAYURL : URLS.INTL_PLAYURL, "bb3101000e232e27"); this.data = data; this.fetch = fetch2; this.pgc = pgc; this.data = Object.assign({ device: "android", force_host: 1, mobi_app: "android_i", qn, platform: "android_i", fourk: 1, build: 2100110, otype: "json" }, data, dash ? { fnval, fnver } : {}); } async getData() { const response = await this.fetch(this.sign(this.data)); const json = await response.json(); if (this.pgc) { return jsonCheck(json); } return jsonCheck(json).data; } }; // src/io/api-playurl-tv.ts var ApiPlayurlTv = class extends ApiSign { constructor(data, dash = true, pgc = false) { super(pgc ? URLS.PGC_PLAYURL_TV : URLS.UGC_PLAYURL_TV, "4409e2ce8ffd12b8"); this.data = data; this.data = Object.assign({ qn, fourk: 1, otype: "json", platform: "android", mobi_app: "android_tv_yst", build: 102801 }, data, dash ? { fnval, fnver } : {}); } async getData() { const response = await fetch(this.sign(this.data)); const json = await response.json(); return jsonCheck(json); } }; // src/io/api-playurlproj.ts var ApiPlayurlProj = class extends ApiSign { constructor(data, pgc = false) { super(pgc ? URLS.PGC_PLAYURL_PROJ : URLS.PLAYURL_PROJ, "bb3101000e232e27"); this.data = data; this.data = Object.assign({ build: "2040100", device: "android", mobi_app: "android_i", otype: "json", platform: "android_i", qn }, data); pgc && (data.module = "bangumi"); } async getData() { const response = await fetch(this.sign(this.data)); return await response.json(); } }; // src/utils/base64.ts var Base64 = class { /** * Base64编码 * @param str 原始字符串 * @returns 编码结果 */ static encode(str) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) { return String.fromCharCode("0x" + p1); })); } /** * Base64解码 * @param str 原始字符串 * @returns 解码结果 */ static decode(str) { return decodeURIComponent(atob(str).split("").map(function(c) { return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); }).join("")); } }; // src/utils/mutex.ts function getMetux() { return Math.random().toString(36).substring(2); } // src/core/download/aria2.ts var Aria2 = class { constructor(userAgent, referer, dir, server = "http://localhost", port = 6800, token, split, size) { this.userAgent = userAgent; this.referer = referer; this.dir = dir; this.server = server; this.port = port; this.token = token; this.split = split; this.size = size; } get url() { return \`\${this.server}:\${this.port}/jsonrpc\`; } /** 命令行 */ cmdlet(data) { const arr2 = ["aria2c"]; data.urls.forEach((d) => arr2.push(\`"\${d}"\`)); data.out && arr2.push(\`--out="\${data.out}"\`); (data.userAgent || this.userAgent) && arr2.push(\`--user-agent="\${data.userAgent || this.userAgent}"\`); (data.referer || this.referer) && arr2.push(\`--referer="\${data.referer || this.referer}"\`); (data.dir || this.dir) && arr2.push(\`--dir="\${data.dir || this.dir}"\`); (data.split || this.split) && arr2.push(\`--split="\${data.split || this.split}"\`, \`--max-connection-per-server="\${data.split || this.split}"\`); (data.size || this.size) && arr2.push(\`--min-split-size="\${data.size || this.size}M"\`); data.header && Object.entries(data.header).forEach((d) => arr2.push(\`--header="\${d[0]}: \${d[1]}"\`)); return navigator.clipboard.writeText(arr2.join(" ")); } /** RPC */ rpc(data) { const options = {}; data.out && (options.out = data.out); (data.userAgent || this.userAgent) && (options["user-agent"] = data.userAgent || this.userAgent); (data.referer || this.referer) && (options.referer = data.referer || this.referer); (data.dir || this.dir) && (options.dir = data.dir || this.dir); (data.split || this.split) && (options.split = options["max-connection-per-server"] = data.split || this.split); (data.size || this.size) && (options["min-split-size"] = \`\${data.size || this.size}M\`); data.header && (options.header = data.header); return this.postMessage("aria2.addUri", data.id, [data.urls, options]); } /** 获取aria2配置信息 */ getVersion() { return this.postMessage("aria2.getVersion"); } postMessage(method, id = getMetux(), params = []) { this.token && params.unshift(\`token:\${this.token}\`); return new Promise((r, j) => { fetch(this.url, { method: "POST", body: JSON.stringify({ method, id, params }), headers: { "Content-Type": "application/json" } }).then((d) => d.json()).then((d) => { d.error && j(d.error); d.result && r(d.result); }).catch((e) => { debug.error("RPC", e); fetch(objUrl(this.url, { method, id, params: Base64.encode(JSON.stringify(params)) })).then((d) => d.json()).then((d) => { d.error && j(d.error); d.result && r(d.result); }).catch((e2) => { debug.error("RPC", e2); j(e2); }); }); }); } }; // src/core/download/ef2.ts var Ef2 = class { constructor(userAgent, referer, dir, delay = false, silence = false) { this.userAgent = userAgent; this.referer = referer; this.dir = dir; this.delay = delay; this.silence = silence; } /** 拉起IDM */ sendLinkToIDM(data) { this.rebuildData(data); const ef2str = Ef2.encode(data); const a = document.createElement("a"); a.href = ef2str; a.click(); return ef2str; } /** 生成ef2文件 */ file(data, fileName) { this.rebuildData(data); return Ef2.file([data], fileName); } /** 补全数据 */ rebuildData(data) { this.userAgent && !data.userAgent && (data.userAgent = this.userAgent); this.referer && !data.referer && (data.referer = this.referer); this.dir && !data.dir && (data.dir = this.dir); this.delay && !data.delay && (data.delay = this.delay); this.silence && !data.silence && (data.silence = this.silence); } /** 生成ef2文件 */ static file(data, fileName) { const result = []; data.forEach((d) => { const arr2 = []; Object.entries(d).forEach((d2) => { switch (d2[0]) { case "cookie": arr2.push(\`cookie: \${d2[1]}\`); break; case "delay": break; case "dir": d2[1] = d2[1].replace(/\\//, "\\\\"); d2[1].endsWith("\\\\") && (d2[1] = d2[1].slice(0, -1)); arr2.push(\`filepath: \${d2[1]}\`); break; case "out": arr2.push(\`filename: \${d2[1]}\`); break; case "password": arr2.push(\`password: \${d2[1]}\`); break; case "body": arr2.push(\`postdata: \${d2[1]}\`); break; case "referer": arr2.push(\`referer: \${d2[1]}\`); break; case "silence": break; case "url": d2[1].startsWith("//") && (d2[1] = "https:" + d2[1]); arr2.unshift(d2[1]); break; case "userAgent": arr2.push(\`User-Agent: \${d2[1]}\`); break; case "userName": arr2.push(\`username: \${d2[1]}\`); break; default: break; } }); arr2.unshift("<"); arr2.push(">"); result.push(...arr2); }); saveAs(result.join("\\r\\n"), fileName || \`\${data[0].out || getMetux()}.ef2\`); } /** 生成ef2协议 */ static encode(data) { const arr2 = []; Object.entries(data).forEach((d) => { switch (d[0]) { case "cookie": arr2.push("-c", d[1]); break; case "delay": arr2.push("-q"); break; case "dir": d[1] = d[1].replace(/\\//, "\\\\"); d[1].endsWith("\\\\") && (d[1] = d[1].slice(0, -1)); arr2.push("-o", d[1]); break; case "out": arr2.push("-s", d[1]); break; case "password": arr2.push("-P", d[1]); break; case "body": arr2.push("-d", d[1]); break; case "referer": arr2.push("-r", d[1]); break; case "silence": arr2.push("-f"); break; case "url": d[1].startsWith("//") && (d[1] = "https:" + d[1]); arr2.push("-u", d[1]); break; case "userAgent": arr2.push("-a", d[1]); break; case "userName": arr2.push("-U", d[1]); break; default: break; } }); return \`ef2://\${Base64.encode(arr2.join(" "))}\`; } /** 解码ef2协议 */ static decode(ef2str) { ef2str = ef2str.replace("ef2://", ""); ef2str = Base64.decode(ef2str); const arr2 = ef2str.split(" "); const data = {}; for (let i = 0; i < arr2.length; i++) { if (/-\\w/.test(arr2[i])) { switch (arr2[i]) { case "-c": data.cookie = arr2[i + 1]; i++; break; case "-q": data.delay = true; break; case "-o": data.dir = arr2[i + 1]; i++; break; case "-s": data.out = arr2[i + 1]; i++; break; case "-P": data.password = arr2[i + 1]; i++; break; case "-d": data.body = arr2[i + 1]; i++; break; case "-r": data.referer = arr2[i + 1]; i++; break; case "-f": data.silence = true; break; case "-u": data.url = arr2[i + 1]; i++; break; case "-a": data.userAgent = arr2[i + 1]; i++; break; case "-U": data.userName = arr2[i + 1]; i++; break; default: break; } } } return data; } }; // src/core/download/playinfo.ts var PlayinfoFilter = class { constructor(fileName) { this.fileName = fileName; } /** 数据 */ record = []; /** id => 质量 */ quality = { 100032: "8K", 100029: "4K", 100028: "1080P60", 100027: "1080P+", 100026: "1080P", 100024: "720P", 100023: "480P", 100022: "360P", 30280: "320Kbps", 30260: "320Kbps", 30259: "128Kbps", 30257: "64Kbps", 30255: "AUDIO", 30251: "FLAC", 30250: "ATMOS", 30232: "128Kbps", 30216: "64Kbps", 30127: "8K", 30126: "Dolby", 30125: "HDR", 30121: "4K", 30120: "4K", 30116: "1080P60", 30112: "1080P+", 30106: "1080P60", 30102: "1080P+", 30080: "1080P", 30077: "1080P", 30076: "720P", 30074: "720P", 30066: "720P", 30064: "720P", 30048: "720P", 30033: "480P", 30032: "480P", 30016: "360P", 30015: "360P", 30011: "360P", 464: "预览", 336: "1080P", 320: "720P", 288: "480P", 272: "360P", 208: "1080P", 192: "720P", 160: "480P", 127: "8K", 126: "Dolby", 125: "HDR", 120: "4K", 116: "1080P60", 112: "1080P+", 80: "1080P", 74: "720P60", 64: "720P", 48: "720P", 32: "480P", 16: "360P", 15: "360P", 6: "240P", 5: "144P" }; /** id => 类型(备用方案) */ codec = { hev: [30127, 30126, 30125, 30121, 30106, 30102, 30077, 30066, 30033, 30011], avc: [30120, 30112, 30080, 30064, 30032, 30016], av1: [100029, 100028, 100027, 100026, 100024, 100023, 100022] }; /** 颜色表 */ color = { "8K": "yellow", "Dolby": "pink", "FLAC": "pink", "ATMOS": "pink", "AUDIO": "pink", "HDR": "purple", "4K": "purple", "1080P60": "red", "1080P+": "red", "1080P": "red", "720P60": "orange", "720P": "orange", "480P": "blue", "360P": "green", "320Kbps": "red", "128Kbps": "blue", "64Kbps": "green" }; /** * 解码playurl的下载数据 * @param playinfo playurl返回值(json) */ filter(playinfo) { typeof playinfo === "string" && (playinfo = toObject(playinfo)); if (playinfo) { playinfo.data && this.filter(playinfo.data); playinfo.result && this.filter(playinfo.result); playinfo.durl && this.durl(playinfo.durl); playinfo.dash && this.dash(playinfo.dash); } return this.record; } /** * 整理durl部分 * @param durl durl信息 */ durl(durl) { let index = 0; durl.forEach((d) => { const url = d.backupUrl || d.backup_url || []; url.unshift(d.url); const qua = this.getQuality(url[0], d.id); const link = { type: "", url, quality: qua, size: sizeFormat(d.size), color: this.color[qua] || "" }; switch (d.url.includes("mp4?")) { case true: link.type = "mp4"; break; case false: link.type = "flv"; index++; link.flv = index; break; } this.fileName && (link.fileName = \`\${this.fileName}\${qua}.\${link.type}\`); this.record.push(link); }); } /** * 整理dash部分 * @param dash dash信息 */ dash(dash) { dash.video && this.dashVideo(dash.video, dash.duration); dash.audio && this.dashAudio(dash.audio, dash.duration); dash.dolby && dash.dolby.audio && Array.isArray(dash.dolby.audio) && this.dashAudio(dash.dolby.audio, dash.duration); dash.flac && dash.flac.audio && this.dashAudio([dash.flac.audio], dash.duration, ".flac"); } /** * 整理dash视频部分 * @param video dash视频信息 * @param duration duration信息,配合bandwidth能计算出文件大小 */ dashVideo(video, duration) { video.forEach((d) => { const url = d.backupUrl || d.backup_url || []; (d.baseUrl || d.base_url) && url.unshift(d.baseUrl || d.base_url); if (!url.length) return; let type = ""; if (d.codecs) { type = d.codecs.includes("avc") ? "avc" : d.codecs.includes("av01") ? "av1" : "hev"; } else { const id = this.getID(url[0]); type = this.codec.hev.find((d2) => d2 === id) ? "hev" : "avc"; } const qua = this.getQuality(url[0], d.id); this.record.push({ type, url, quality: qua, size: sizeFormat(d.bandwidth * duration / 8), color: this.color[qua] || "", fileName: \`\${this.fileName}\${qua}.m4v\` }); }); } /** * 整理dash音频部分 * @param audio dash音频信息 * @param duration duration信息,配合bandwidth能计算出文件大小 * @param fmt 音频拓展名,默认\`.m4a\` */ dashAudio(audio, duration, fmt = ".m4a") { audio.forEach((d) => { const url = d.backupUrl || d.backup_url || []; (d.baseUrl || d.base_url) && url.unshift(d.baseUrl || d.base_url); const qua = this.getQuality(url[0], d.id); url.length && this.record.push({ type: "aac", url, quality: qua, size: sizeFormat(d.bandwidth * duration / 8), color: this.color[qua] || "", fileName: \`\${this.fileName}\${qua}.\${fmt}\` }); }); } /** * 根据url确定画质/音质信息 * 需要维护quality表 * @param url 多媒体url * @param id 媒体流id * @returns 画质/音质信息 */ getQuality(url, id) { return this.quality[this.getID(url)] || id && this.quality[id] || "N/A"; } /** * 从url中提取可能的id * @param url 多媒体url */ getID(url) { let id = 0; url.replace(/\\d+\\.((flv)|(mp4)|(m4s))/, (d) => id = Number(d.split(".")[0])); return id; } }; // src/html/download.html var download_default = '
\\r\\n'; // src/core/ui/download.ts var BilioldDownload = class extends HTMLElement { _container; _cells = {}; _noData; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = download_default; this._container = root.children[0]; this.addEventListener("click", (e) => e.stopPropagation()); this._noData = addElement("div", void 0, this._container, "正在获取下载数据~"); } updateItem = (key, value) => { this._container.contains(this._noData) && this._noData.remove(); this._cells[key] || (this._cells[key] = addElement("div", { class: "cell" }, this._container)); this._cells[key].innerHTML = \`
\${key}
\`; value ? value.forEach((d) => { const a = addElement("a", { class: "item", target: "_blank" }, this._cells[key], \`
\${d.quality}
\${d.size}
\`); d.url && (a.href = d.url[0]); d.fileName && (a.download = d.fileName); d.onClick && a.addEventListener("click", (e) => d.onClick(e)); }) : this._cells[key]?.remove(); this._container.firstChild || this._container.replaceChildren(this._noData); }; show() { document.contains(this) || document.body.appendChild(this); this.style.display = ""; window.addEventListener("click", () => { this.style.display = "none"; }, { once: true }); } init() { return propertryChangeHook({}, this.updateItem); } disconnectedCallback() { this.destory(); } destory() { this._cells = {}; this._container.replaceChildren(this._noData); } }; customElements.get(\`download-\${"855f368"}\`) || customElements.define(\`download-\${"855f368"}\`, BilioldDownload); // src/html/popupbox.html var popupbox_default = '
\\r\\n
\\r\\n
\\r\\n
\\r\\n'; // src/svg/fork.svg var fork_default = ''; // src/svg/gear.svg var gear_default = ''; // src/svg/wrench.svg var wrench_default = ''; // src/svg/note.svg var note_default = ''; // src/svg/dmset.svg var dmset_default = ''; // src/svg/stethoscope.svg var stethoscope_default = ''; // src/svg/play.svg var play_default = ''; // src/svg/palette.svg var palette_default = ''; // src/svg/download.svg var download_default2 = ''; // src/svg/warn.svg var warn_default = ''; // src/svg/linechart.svg var linechart_default = ''; // src/svg/blind.svg var blind_default = ''; // src/svg/like.svg var like_default = ''; // src/svg/dislike.svg var dislike_default = ''; // src/utils/svg.ts var svg = { fork: fork_default, gear: gear_default, wrench: wrench_default, note: note_default, dmset: dmset_default, stethoscope: stethoscope_default, play: play_default, palette: palette_default, download: download_default2, warn: warn_default, linechart: linechart_default, blind: blind_default, like: like_default, dislike: dislike_default }; // src/core/ui/utils/popupbox.ts var ClickOutRemove = class { constructor(target) { this.target = target; target.addEventListener("click", (e) => e.stopPropagation()); } /** 已启用监听 */ enabled = false; /** 移除节点 */ remove = () => { this.target.remove(); }; /** 停止监听 */ disable = () => { if (this.enabled) { document.removeEventListener("click", this.remove); this.enabled = false; } return this; }; /** 开始监听 */ enable = () => { this.enabled || setTimeout(() => { document.addEventListener("click", this.remove, { once: true }); this.enabled = true; }, 100); return this; }; }; var PopupBox = class extends HTMLElement { _contain; _fork; clickOutRemove; \$fork = true; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = popupbox_default; this._contain = root.children[0].children[0]; this._fork = root.children[0].children[1]; this._fork.innerHTML = svg.fork; this._fork.addEventListener("click", () => this.remove()); this.clickOutRemove = new ClickOutRemove(this); document.body.appendChild(this); } append(...nodes) { this._contain.append(...nodes); } appendChild(node) { this._contain.appendChild(node); return node; } replaceChildren(...nodes) { this._contain.replaceChildren(...nodes); } setAttribute(qualifiedName, value) { this._contain.setAttribute(qualifiedName, value); } getAttribute(qualifiedName) { return this._contain.getAttribute(qualifiedName); } get style() { return this._contain.style; } get innerHTML() { return this._contain.innerHTML; } set innerHTML(v) { this._contain.innerHTML = v; } /** 设置是否显示关闭按钮,不显示则点击节点外部自动关闭 */ get fork() { return this.\$fork; } set fork(v) { this.\$fork = v; this._fork.style.display = v ? "" : "none"; if (v) { this.clickOutRemove.disable(); } else { this.clickOutRemove.enable(); } } }; customElements.get(\`popupbox-\${"855f368"}\`) || customElements.define(\`popupbox-\${"855f368"}\`, PopupBox); // src/core/download.ts var Download = class { constructor(BLOD2) { this.BLOD = BLOD2; switchVideo(() => this.destory()); } /** 下载界面 */ ui = new BilioldDownload(); /** 数据缓存 */ data = this.ui.init(); get fileName() { if (this.BLOD.videoInfo.metadata) { return \`\${this.BLOD.videoInfo.metadata.album}(\${this.BLOD.videoInfo.metadata.title})\`; } return ""; } /** 解码playinfo */ decodePlayinfo(playinfo, fileName = this.fileName) { const data = new PlayinfoFilter(fileName).filter(playinfo); data.forEach((d) => { this.data[d.type] || (this.data[d.type] = []); this.data[d.type].push({ url: d.url, fileName, quality: Reflect.has(d, "flv") ? \`\${d.quality}*\${d.flv}\` : d.quality, size: d.size, color: d.color, onClick: (ev) => this.pushDownload(d, ev) }); }); } /** 分发数据 */ pushDownload(data, ev) { if (data.onClick) { data.onClick(ev); } else if (data.url) { switch (this.BLOD.status.downloadMethod) { case "IDM": ev.preventDefault(); new Ef2(this.BLOD.status.userAgent, this.BLOD.status.referer, this.BLOD.status.filepath, this.BLOD.status.ef2.delay, this.BLOD.status.ef2.silence).file({ url: data.url[0], out: data.fileName }); this.BLOD.toast.success('保存IDM导出文件后,打开IDM -> 任务 -> 导入 -> 从"IDM导出文件"导入即可下载'); break; case "ef2": ev.preventDefault(); new Ef2(this.BLOD.status.userAgent, this.BLOD.status.referer, this.BLOD.status.filepath, this.BLOD.status.ef2.delay, this.BLOD.status.ef2.silence).sendLinkToIDM({ url: data.url[0], out: data.fileName }); this.BLOD.toast.warning("允许浏览器打开【IDM EF2辅助工具】即可开始下载", "如果浏览器和IDM都没有任何反应,那些请先安装ef2辅助工具。"); break; case "aria2": ev.preventDefault(); const cmdLine = new Aria2(this.BLOD.status.userAgent, this.BLOD.status.referer, this.BLOD.status.filepath, this.BLOD.status.aria2.server, this.BLOD.status.aria2.port, this.BLOD.status.aria2.token, this.BLOD.status.aria2.split, this.BLOD.status.aria2.size).cmdlet({ urls: data.url, out: data.fileName }); this.BLOD.toast.success( "已复制下载命令到剪切板,粘贴到终端里回车即可开始下载。当然前提是您的设备已配置好了aria2。", "--------------", cmdLine ); break; case "aria2rpc": ev.preventDefault(); new Aria2(this.BLOD.status.userAgent, this.BLOD.status.referer, this.BLOD.status.filepath, this.BLOD.status.aria2.server, this.BLOD.status.aria2.port, this.BLOD.status.aria2.token, this.BLOD.status.aria2.split, this.BLOD.status.aria2.size).rpc({ urls: data.url, out: data.fileName }).then((d) => { this.BLOD.toast.success("aria2已经开始下载", \`GUID: \${d}\`); }).catch((e) => { this.BLOD.toast.error("aria2[RPC]错误!", e); }); break; default: this.BLOD.toast.warning("当前下载方式设定为浏览器(默认),受限于浏览器安全策略,可能并未触发下载而是打开了一个标签页,所以更良好的习惯是右键要下载的链接【另存为】。另外如果下载失败(403无权访问),请尝试在设置里修改下载方式及其他下载相关选项。"); break; } } } /** 请求中 */ downloading = false; /** 已请求 */ gets = []; /** 下载当前视频 */ default() { if (this.downloading) return; if (!this.BLOD.cid) return this.BLOD.toast.warning("未找到视频文件"); this.downloading = true; this.ui.show(); this.BLOD.status.TVresource || this.gets.includes("_") || (this.decodePlayinfo(this.BLOD.videoLimit.__playinfo__), this.gets.push("_")); const tasks = []; this.BLOD.status.downloadType.includes("mp4") && (this.data.mp4 || this.gets.includes("mp4") || tasks.push(this.mp4(this.BLOD.cid).then((d) => { this.gets.push("mp4"); this.decodePlayinfo(d); }))); this.BLOD.status.downloadType.includes("flv") && (this.data.flv || this.gets.includes("flv") || tasks.push( (this.BLOD.status.TVresource ? this.tv(this.BLOD.aid, this.BLOD.cid, false, this.BLOD.status.downloadQn) : this.interface(this.BLOD.cid, this.BLOD.status.downloadQn)).then((d) => { this.gets.push("flv"); this.decodePlayinfo(d); }) )); this.BLOD.status.downloadType.includes("dash") && (this.data.aac || this.gets.includes("dash") || this.data.hev || this.data.av1 || tasks.push( (this.BLOD.status.TVresource ? this.tv(this.BLOD.aid, this.BLOD.cid) : this.dash(this.BLOD.aid, this.BLOD.cid)).then((d) => { this.gets.push("dash"); this.decodePlayinfo(d); }) )); Promise.allSettled(tasks).finally(() => { this.downloading = false; }); } /** 清空数据 */ destory() { this.ui.remove(); this.data = this.ui.init(); this.downloading = false; this.gets = []; this.BLOD.videoLimit.__playinfo__ = void 0; } mp4(cid) { return new ApiPlayurlProj({ cid, access_key: this.BLOD.status.accessKey.token }, this.BLOD.pgc).getData(); } // private flv(avid: number, cid: number) { // return >apiPlayurl({ avid, cid }, false, this.BLOD.pgc); // } dash(avid, cid) { return apiPlayurl({ avid, cid }, true, this.BLOD.pgc); } tv(avid, cid, dash = true, quality = qn) { return new ApiPlayurlTv({ avid, cid, access_key: this.BLOD.status.accessKey.token, qn: quality }, dash, this.BLOD.pgc).getData(); } intl(aid, cid, dash = true) { return new ApiPlayurlIntl({ aid, cid, access_key: this.BLOD.status.accessKey.token }, this.BLOD.GM.fetch, dash, this.BLOD.pgc).getData(); } interface(cid, quality = qn) { return new ApiPlayurlInterface({ cid, quality }, this.BLOD.pgc).getData(); } image() { const src = []; this.BLOD.videoInfo.metadata?.artwork?.forEach((d) => src.push(d.src)); if (location.host === "live.bilibili.com" && window.__NEPTUNE_IS_MY_WAIFU__?.roomInfoRes?.data?.room_info?.cover) { src.push(window.__NEPTUNE_IS_MY_WAIFU__?.roomInfoRes?.data?.room_info?.cover); } if (src.length) { const popup = new PopupBox(); popup.fork = false; popup.setAttribute("style", "display: flex;flex-direction: row;align-items: flex-start;;max-width: 100vw;"); popup.innerHTML = src.map((d) => \`\`).join(""); } else { this.BLOD.toast.warning("未找到封面信息!"); } } }; // src/core/report.ts var Cache = class { fpriskMsg = {}; }; var EventTracker = class { extMsgs = {}; legalContainer = "report-wrap-module"; bindEvent() { } bindHeatMapEvent() { } checkContainer() { } eventCB() { } handleSelfDefReport() { } todo() { } }; var LoadTracker = class { msg = {}; showRawPerformance() { } todo() { } }; var PvTracker = class { extMsgs = {}; _uuid = ""; sendPV() { } todo() { } }; var ScrollTracker = class { extMsgs = {}; ignoreHidden = true; reportedIds = []; scrollDivClass = ""; scrollLintenerFns = []; scrollMsg = {}; scrollReportOffset = 200; scrollSubDivClass = ""; addScrollListenNode() { } checkScroll() { } customReport() { } getOffset() { } inView() { } judgeAppear() { } judgeCustom() { } judgeHidden() { } judgeSubAppear() { } removeScrollListenNode() { } subInView() { } todo() { } todoCustom() { } }; var reportConfig = { msgObjects: "spmReportData", sample: -1, scrollTracker: false }; var reportMsgObj = {}; var ReportObserver = class { constructor() { propertyHook(window, "reportObserver", this); propertyHook(window, "reportConfig", reportConfig); } cache = new Cache(); eventTracker = new EventTracker(); loadTracker = new LoadTracker(); pvTracker = new PvTracker(); scrollTracker = new ScrollTracker(); forceCommit() { } importTracker() { } init() { } initBsource() { } initTracker() { } reportCustomData() { } reportWithAdditionalParam() { } reportWithSpmPrefix() { } sendPV() { } sendPerformance() { } setSPM_id() { } setSpeicalMsg() { } updateConfig() { } }; var statisObserverConfig = { blackEvents: [], clickConfig: { logId: "", isDoubleWrite: false }, loadPerform: false, loadSpecial: false, performConfig: { isWrite: false }, pvConfig: { isDoubleWrite: false, logId: "", selfDefMsg: {} }, selfConfig: { logId: "", isDoubleWrite: false, isSelfDefWrite: false, isDefaultWrite: false }, spmId: "" }; var StatisObserver = class { __bufferFuns = []; __initConfig = {}; __loadedFlag = { baidu: false, error: false, event: false, perform: false, pv: false, special: false }; __visitId = ""; constructor() { propertyHook(window, "__statisObserver", this); propertyHook(window, "reportMsgObj", reportMsgObj); propertyHook(window, "__statisObserverConfig", statisObserverConfig); } addClickTracker() { } addLegalContainer() { } addSelfDefineMsg() { } forceCommit() { } getPvid() { } removeLegalContainer() { } removeSelfDefineMsg() { } sendBaidu() { } sendClickEvent() { } sendCustomMetrics() { } sendError() { } sendPV() { } sendPerform() { } sendSpecial() { } setAttrName() { } setBaseUrl() { } setErrorInterval() { } setErrorLogId() { } setEventLogId() { } setEventSendStatus() { } setPVLogId() { } setPVSendStatus() { } setPerformLogId() { } setPvid() { } setSpecialFirstLoop() { } setSpecialInterval() { } setSpecialLogId() { } setSpmId() { } startPoolListen() { } startSpecialLoop() { } stopPoolListen() { } stopSpecialLoop() { } }; // src/html/toast.html var toast_default = '
\\r\\n\\r\\n'; // src/core/toast.ts var Toastconfig = { position: "top-right", rtl: false, delay: 4, disabled: false }; var Toast = class extends HTMLDivElement { /** 关闭按钮 */ closeButton = document.createElement("div"); /** 消息节点 */ message = document.createElement("div"); /** 延时 */ timer; /** 鼠标移入 */ hovering = false; /** 延时结束 */ timeout = false; constructor() { super(); this.classList.add("toast"); this.setAttribute("aria-live", "assertive"); this.setAttribute("style", "padding-top: 0px;padding-bottom: 0px;height: 0px;"); this.appendChild(this.message); this.message.className = "toast-message"; this.closeButton.className = "toast-close-button"; this.closeButton.innerHTML = svg.fork; this.closeButton.addEventListener("click", (e) => { this.timeout = true; this.delay = 1; e.stopPropagation(); }); this.addEventListener("mouseover", () => this.hovering = true); this.addEventListener("mouseout", () => { this.hovering = false; this.timeout && (this.delay = 1); }); } /** 内容 */ set data(v) { isArray(v) || (v = [v]); let html = ""; v.forEach((d, i) => { d = toString(d); html += i ? \`
\${d}\` : \`\`; }); const close = this.message.contains(this.closeButton); this.message.innerHTML = html; close && (this.delay = 0); this.setAttribute("style", \`height: \${this.message.scrollHeight + 30}px;\`); } /** 类型 */ set type(v) { this.classList.remove("toast-success", "toast-error", "toast-info", "toast-warning"); v && this.classList.add(\`toast-\${v}\`); } /** 镜像 */ set rtl(v) { v ? this.classList.add("rtl") : this.classList.remove("rtl"); } /** 时长 */ set delay(v) { clearTimeout(this.timer); v = Math.max(Math.trunc(v), 0); v ? this.message.contains(this.closeButton) && this.closeButton.remove() : this.message.contains(this.closeButton) || this.message.insertBefore(this.closeButton, this.message.firstChild); if (v === 1) { if (!this.hovering) { this.setAttribute("style", "padding-top: 0px;padding-bottom: 0px;height: 0px;"); setTimeout(() => this.remove(), 1e3); } } else if (v !== 0) { this.timer = setTimeout(() => { this.timeout = true; this.delay = 1; }, v * 1e3); } } }; customElements.get(\`toast-\${"855f368"}\`) || customElements.define(\`toast-\${"855f368"}\`, Toast, { extends: "div" }); var ToastContainer = class extends HTMLElement { /** 实际根节点 */ container; static get observedAttributes() { return [ "position", "rtl", "delay", "disabled" ]; } constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = toast_default; this.container = root.children[0]; } /** 刷新配置 */ update(value) { Object.entries(value).forEach((d) => { this[d[0]] = d[1]; }); } toast(delay, type = "info", ...data) { document.body.contains(this) || document.body.appendChild(this); const toast = new Toast(); toast.type = type; toast.rtl = this.rtl; this.container.insertBefore(toast, this.container.firstChild); toast.data = data; toast.delay = delay; return toast; } success(...data) { this.toast(this.delay, "success", ...data); return () => { debug(...data); }; } error(...data) { this.toast(this.delay, "error", ...data); return () => { debug.error(...data); }; } info(...data) { this.toast(this.delay, "info", ...data); return () => { debug.debug(...data); }; } warning(...data) { this.toast(this.delay, "warning", ...data); return () => { debug.warn(...data); }; } set position(v) { this.setAttribute("position", v); } /** 位置 */ get position() { return this.getAttribute("position"); } set rtl(v) { this.setAttribute("rtl", v); } /** 镜像 */ get rtl() { return toObject(this.getAttribute("rtl")); } set delay(v) { this.setAttribute("delay", v); } /** 延时 */ get delay() { return toObject(this.getAttribute("delay")); } set disabled(v) { this.setAttribute("disabled", v); } /** 禁用 */ get disabled() { return toObject(this.getAttribute("disabled")); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue === newValue) return; switch (name) { case "position": newValue && (this.container.className = \`toast-\${newValue}\`); break; case "rtl": this.container.querySelectorAll(".toast").forEach((d) => { d.rtl = toObject(newValue); }); break; case "delay": this.container.querySelectorAll(".toast").forEach((d) => { d.delay = toObject(newValue); }); break; case "disabled": this.container.style.display = toObject(newValue) ? "none" : ""; default: break; } } }; customElements.get(\`toast-container-\${"855f368"}\`) || customElements.define(\`toast-container-\${"855f368"}\`, ToastContainer); // src/io/api-login-app-third.ts var ApiLoginAppThird = class extends ApiSign { constructor(api) { super(URLS.LOGIN_APP_THIRD, "27eb53fc9058f8c3"); this.api = api; this.api = encodeURIComponent(api); } async getData() { const response = await fetch(this.sign({ api: this.api }, this.api), { credentials: "include" }); const json = await response.json(); return jsonCheck(json).data; } }; // src/utils/cookie.ts function getCookies() { return document.cookie.split("; ").reduce((s, d) => { let key = d.split("=")[0]; let val = d.split("=")[1]; s[key] = unescape(val); return s; }, {}); } function setCookie(name, value, days = 365) { const exp = new Date(); exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1e3); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toUTCString() + "; path=/; domain=.bilibili.com"; } // src/utils/conf/uid.ts var uid = Number(getCookies().DedeUserID); // src/html/button.html var button_default = '
按钮
\\r\\n'; // src/core/ui/utils/button.ts var PushButton = class extends HTMLElement { _button; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = button_default; this._button = root.querySelector(".button"); this._button.addEventListener("click", (e) => { e.stopPropagation(); this.dispatchEvent(new Event("change")); }); } set text(v) { this._button.textContent = v; } }; customElements.get(\`button-\${"855f368"}\`) || customElements.define(\`button-\${"855f368"}\`, PushButton); // src/core/ui/alert.ts function alert(msg, title, buttons) { isArray(msg) || (msg = [msg]); msg = msg.join("
"); const popup = new PopupBox(); popup.fork = false; popup.setAttribute("style", "max-width: 400px; max-height: 300px;line-height: 16px;"); popup.innerHTML = \`
\${title || "Bilibili Old"}
\${msg}
\`; if (buttons) { addElement("hr", { style: "width: 100%;opacity: .3;" }, popup); const div = addElement("div", { style: "display: flex;align-items: center;justify-content: space-around;" }, popup); buttons.forEach((d) => { const button = new PushButton(); button.text = d.text; button.addEventListener("change", () => { d.callback?.(); popup.remove(); }); div.appendChild(button); }); } } // src/core/accesskey.ts var AccessKey = class { constructor(BLOD2) { this.BLOD = BLOD2; const button = [{ text: "开始授权", callback: () => this.get() }]; if (this.BLOD.status.accessKey.token) { button[0].text = "刷新授权"; button.push({ text: "取消授权", callback: () => this.remove() }); } alert([ "【账户授权】将授权脚本获取您的登录鉴权,允许脚本访问一些网页端无权访问的B站接口,以实现【解除播放限制】等功能。", "警告:如果您启用了脚本的【解除播放限制】功能,并且选择使用【自定义】服务器,请务必自行确认服务器的可信度!", "第三方服务器获得授权等于您在上面登录了B站,好比在网吧登录又忘了退出,第三方能用您的账户实现任何登录状态能进行的操作!", "个中风险请务必知悉!如无必要,切莫授权!" ], "授权确认", button); } get() { if (uid) { const data = ["正在申请账户授权~"]; const toast = this.BLOD.toast.toast(0, "info", ...data); new ApiLoginAppThird("https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png").getData().then(async (d) => { data.push("成功获取到授权链接~"); toast.data = data; return this.BLOD.GM.fetch(d.confirm_uri, { credentials: "include" }); }).then((d) => { const date = new Date().getTime(); const dateStr = timeFormat(date, true); const obj = urlObj(d.url); this.BLOD.status.accessKey.token = obj.access_key; this.BLOD.status.accessKey.date = date; this.BLOD.status.accessKey.dateStr = dateStr; data.push("------- 授权成功 -------", \`鉴权: \${obj.access_key}\`, \`日期:\${dateStr}\`); toast.data = data; toast.type = "success"; toast.delay = 4; }).catch((e) => { debug.error("授权出错!", e); data.push("授权出错!", e); toast.data = data; toast.type = "error"; toast.delay = 4; }); } else { this.BLOD.toast.warning("请先登录B站账户!"); this.BLOD.biliQuickLogin(); } } remove() { this.BLOD.status.accessKey.token = void 0; this.BLOD.status.accessKey.date = 0; this.BLOD.status.accessKey.dateStr = ""; this.BLOD.toast.warning("已清除账户鉴权", "如果您在【解除播放限制】功能中选择【自定义】服务器,那么第三方服务器中很可能依然有鉴权。", "为求保险,您可以修改一次密码,这会强制所有鉴权失效。")(); } }; // src/css/desc.css var desc_default = ".container {\\r\\n position: fixed;\\r\\n top: 16px;\\r\\n left: 100%;\\r\\n background: hsla(0, 0%, 95.7%, .8);\\r\\n border-radius: 2px;\\r\\n box-shadow: 0 6px 12px 0 rgba(106, 115, 133, 22%);\\r\\n color: #000;\\r\\n width: 381px;\\r\\n z-index: 1;\\r\\n}\\r\\n\\r\\n.title {\\r\\n text-align: center;\\r\\n margin-top: 16px;\\r\\n margin-bottom: 3px;\\r\\n font-size: 12px;\\r\\n}\\r\\n\\r\\n.content {\\r\\n font-size: 12px;\\r\\n line-height: 19px;\\r\\n padding: 0 16px 16px;\\r\\n text-align: justify;\\r\\n white-space: pre-line;\\r\\n}"; // src/core/ui/desc.ts var Desc = class extends HTMLElement { _title; _content; show = true; timer; _container; _parrent; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = \`
\`; addCss(desc_default, void 0, root); this._container = root.querySelector(".container"); this._title = root.querySelector(".title"); this._content = root.querySelector(".content"); this.toggle(false); } /** * 更新浮窗 * @param title 标题 * @param content 内容 * @param appendTo 父节点 */ value(title, content, appendTo) { this._title.innerHTML = title; this._content.innerHTML = content; this._parrent = appendTo; appendTo.appendChild(this); appendTo.addEventListener("mouseover", () => { clearTimeout(this.timer); this.timer = setTimeout(() => { this.toggle(true); }, 300); }); appendTo.addEventListener("mouseout", () => { clearTimeout(this.timer); this.timer = setTimeout(() => { this.toggle(false); }, 300); }); } toggle(show) { this.show = show === void 0 ? !this.show : show; this.style.display = this.show ? "" : "none"; if (this._parrent) { const rect = this._parrent.getBoundingClientRect(); this._container.style.top = rect.top - rect.height * 2 + "px"; } } }; customElements.get(\`desc-\${"855f368"}\`) || customElements.define(\`desc-\${"855f368"}\`, Desc); // src/html/ui-entry.html var ui_entry_default = '
\\r\\n 设置\\r\\n
\\r\\n
\\r\\n'; // src/core/ui/entry.ts var UiEntryType = "new"; var BilioldEntry = class extends HTMLElement { /** 旧版按钮 */ stage; /** 新版按钮 */ gear; /** 实际节点 */ root; /** 实际根节点 */ static get observedAttributes() { return [ "type" ]; } constructor() { super(); this.root = this.attachShadow({ mode: "closed" }); this.root.innerHTML = ui_entry_default; this.stage = this.root.children[0]; this.gear = this.root.children[1]; this.gear.innerHTML = svg.gear; this.stage.remove(); this.gear.remove(); this.gear.addEventListener("mouseover", () => this.gear.style.opacity = "0.8"); this.gear.addEventListener("mouseout", () => this.gear.style.opacity = "0"); } get type() { return this.getAttribute("type"); } set type(v) { this.setAttribute("type", v); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue === newValue) return; switch (name) { case "type": if (newValue === "old") { this.root.contains(this.gear) && this.gear.remove(); this.root.contains(this.stage) || this.root.appendChild(this.stage); } else { this.root.contains(this.stage) && this.stage.remove(); if (!this.root.contains(this.gear)) { this.root.appendChild(this.gear); setTimeout(() => { this.gear.style.opacity = "0"; }, 2e3); } } break; default: break; } } }; customElements.get("biliold-entry-855f368") || customElements.define("bilibili-entry-855f368", BilioldEntry); // src/html/ui-interface.html var ui_interface_default = '
\\r\\n
\\r\\n
\\r\\n
Bilbili Old
\\r\\n
\\r\\n
\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n
\\r\\n
\\r\\n'; // src/core/ui/interface.ts var BiliOldInterface = class extends HTMLElement { /** 跟节点 */ _box; /** 标题栏 */ _tool; /** 关闭按钮 */ _close; /** 菜单栏 */ _menu; /** 项目栏 */ _item; /** 显示设置 */ showing = false; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = ui_interface_default; this._box = root.children[0]; this._tool = root.children[0].children[0]; this._close = root.children[0].children[0].children[0]; this._menu = root.children[0].children[1].children[0].children[0]; this._item = root.children[0].children[1].children[0].children[1]; this._close.innerHTML = svg.fork; this._close.addEventListener("click", () => this.hide()); } show() { document.body.contains(this) || document.body.appendChild(this); this._box.style.display = "block"; this.showing = true; } hide() { this._box.style.display = ""; this.showing = false; } addMenu(menu) { this._menu.appendChild(menu); const sets = menu.show(); menu.show = () => { this._item.replaceChildren(...sets); return sets; }; } }; customElements.get("bili-old") || customElements.define("bili-old", BiliOldInterface); // src/core/ui/item.ts var SettingItem = class extends HTMLDivElement { _value = document.createElement("div"); /** * 新建设置项 * @param id keyof typeof {@link userStatus} * @param title 标题 * @param sub 副标题 * @param svg 图标 */ init(id, title, sub, svg2) { this.innerHTML = \`
\${svg2 ? \`
\${svg2}
\` : ""}
\${title}\${sub ? \`
\${sub}
\` : ""}
\`; this._value.className = "value"; this.querySelector(".contain2")?.appendChild(this._value); } /** 添加值 */ value(value) { this._value.appendChild(value); } }; customElements.get(\`item-\${"855f368"}\`) || customElements.define(\`item-\${"855f368"}\`, SettingItem, { extends: "div" }); // src/core/ui/item-container.ts var ItemContainer = class extends HTMLDivElement { _title; /** 设置项容器 */ _card; constructor() { super(); this.innerHTML = \`

\`; this._title = this.querySelector(".title"); this._card = this.querySelector(".card"); } /** 初始化设置项容器 */ init(title) { this._title.textContent = title; } /** * 添加设置 * @param item 设置项 */ addSetting(item) { this._card.append(...item); } }; customElements.get(\`item-container-\${"855f368"}\`) || customElements.define(\`item-container-\${"855f368"}\`, ItemContainer, { extends: "div" }); // src/core/ui/menu.ts var Menuitem = class extends HTMLDivElement { container = [new ItemContainer()]; constructor() { super(); this.addEventListener("click", () => { this.parentElement?.querySelector(".selected")?.classList.remove("selected"); this.classList.add("selected"); this.show(); }); } /** * 初始化菜单项 * @param name 标题 * @param svg 图标 * @returns 默认设置项容器 */ init(name, svg2) { this.className = "menuitem"; this.innerHTML = (svg2 ? \`
\${svg2}
\` : "") + name; this.container[0].init(name); return this.container[0]; } /** * 添加设置分组 * @param name 分组名称 * @returns 分组设置项容器 */ addCard(name) { const con = new ItemContainer(); con.init(name); this.container.push(con); return con; } /** * 添加设置项到容器 * @param item 设置项 * @param i 容器序号 */ addSetting(item, i = 0) { isArray(item) || (item = [item]); item.forEach((d) => { d.addEventListener("show", (e) => { Promise.resolve(this.click()).then(() => { d.scrollIntoView({ behavior: "smooth", block: "start" }); e.stopPropagation(); }); }); }); i = Math.min(this.container.length - 1, i); this.container[i].addSetting(item); } /** 显示容器中的设置 */ show() { return this.container; } }; customElements.get(\`menuitem-\${"855f368"}\`) || customElements.define(\`menuitem-\${"855f368"}\`, Menuitem, { extends: "div" }); // src/html/checkbox.html var checkbox_default = \`\\r \\r \`; // src/core/ui/utils/checkbox.ts var CheckBox = class extends HTMLElement { _input; _text; static get observedAttributes() { return [ "label", "value" ]; } constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = checkbox_default; this._input = root.children[0]; this._text = root.children[1]; this._input.addEventListener("change", () => { this.setAttribute("value", this._input.checked); this.dispatchEvent(new Event("change")); }); } /** 是否选中 */ get value() { return this.getAttribute("value") === "true" ? true : false; } set value(v) { v || (v = false); this.setAttribute("value", v); } /** 标签 */ get label() { return this.getAttribute("label"); } set label(v) { v || (v = ""); this.setAttribute("label", v); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue === newValue) return; switch (name) { case "label": this._text.textContent = newValue; break; case "value": this._input.checked = newValue === "false" ? false : true; break; default: break; } } /** 刷新值 */ update(value) { Object.entries(value).forEach((d) => this[d[0]] = d[1]); } }; customElements.get(\`checkbox-\${"855f368"}\`) || customElements.define(\`checkbox-\${"855f368"}\`, CheckBox); var CheckBoxs = class extends HTMLDivElement { \$value = []; checkboxs = {}; get value() { return this.\$value; } set value(v) { v.forEach((d) => { if (!this.\$value.includes(d)) { if (this.checkboxs[d]) { this.checkboxs[d].value = true; } else { this.update(Object.keys(this.checkboxs).concat(d)); this.checkboxs[d].value = true; } } }); this.\$value.forEach((d) => { v.includes(d) || (this.checkboxs[d].value = false); }); this.\$value = [...v]; } update(labels) { labels.forEach((d) => { if (!this.checkboxs[d]) { const checkbox = new CheckBox(); checkbox.update({ label: d }); checkbox.addEventListener("change", () => { if (checkbox.value) { this.\$value.includes(d) || this.\$value.push(d); } else { const i = this.\$value.indexOf(d); i >= 0 && this.\$value.splice(i, 1); } this.dispatchEvent(new Event("change")); }); this.appendChild(checkbox); this.checkboxs[d] = checkbox; } }); this.\$value.forEach((d) => { if (!labels.includes(d)) { this.checkboxs[d]?.remove(); const i = this.\$value.indexOf(d); i >= 0 && this.\$value.splice(i, 1); } }); } }; customElements.get(\`checkboxs-\${"855f368"}\`) || customElements.define(\`checkboxs-\${"855f368"}\`, CheckBoxs, { extends: "div" }); // src/html/input.html var input_default = '
\\r\\n
    \\r\\n
    \\r\\n\\r\\n'; // src/core/ui/utils/input.ts var InputArea = class extends HTMLElement { _input; _ul; \$prop = {}; \$value = ""; \$candidate = []; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = input_default; this._input = root.children[0].children[0]; this._ul = root.children[0].children[1]; this._input.addEventListener("change", () => { this.\$value = this.\$prop.type === "file" ? this._input.files : this._input.value; this.dispatchEvent(new Event("change")); }); } /** input标签属性 */ get prop() { return this.\$prop; } set prop(v) { this.\$prop = v; Object.entries(v).forEach((d) => this._input.setAttribute(...d)); } /** 输入框值 */ get value() { return this.\$value; } set value(v) { if (this.\$value === v) return; this.\$value = v || ""; this._input.value = this.\$value; } /** 候选值 */ get candidate() { return this.\$candidate; } set candidate(v) { this.\$candidate = v; this._ul.replaceChildren(...v.map((d, i, t) => { const li = document.createElement("li"); li.className = "input-list-row"; li.addEventListener("click", (e) => { this.value = d; e.stopPropagation(); this.dispatchEvent(new Event("change")); }); const span = document.createElement("span"); span.textContent = d; const div = document.createElement("div"); div.className = "cancel"; div.addEventListener("click", (e) => { t.splice(i, 1); li.remove(); e.stopPropagation(); }); li.append(span, div); return li; })); } /** 刷新值 */ update(value) { Object.entries(value).forEach((d) => this[d[0]] = d[1]); } }; customElements.get(\`input-\${"855f368"}\`) || customElements.define(\`input-\${"855f368"}\`, InputArea); // src/html/select.html var select_default = '
    \\r\\n
    \\r\\n
    \\r\\n
      \\r\\n
      \\r\\n\\r\\n'; // src/core/ui/utils/select.ts var SelectMenu = class extends HTMLElement { _text; _list; \$value = ""; \$candidate = []; \$styles = {}; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = select_default; this._text = root.children[0].children[0].children[0]; this._list = root.children[0].children[2]; } /** 当前值 */ get value() { return this.\$value; } set value(v) { if (this.\$value === v) return; this.\$value = v || ""; this._text.textContent = v || ""; v && this.\$styles[v] && this._text.setAttribute("style", this.\$styles[v]); } /** 候选值 */ get candidate() { return this.\$candidate; } set candidate(v) { this.\$candidate = v; this._list.replaceChildren(...v.map((d, i, t) => { const li = document.createElement("li"); li.className = "selectmenu-list-row"; li.addEventListener("click", (e) => { this.value = d; this.dispatchEvent(new Event("change")); e.stopPropagation(); }); const span = document.createElement("span"); span.textContent = d; this.\$styles[d] && span.setAttribute("style", this.\$styles[d]); li.appendChild(span); return li; })); } /** 候选值对应的行内应该 格式 => 候选值: 样式 */ get styles() { return this.\$styles; } set styles(v) { this.\$styles = v; this.candidate = this.candidate; } /** 刷新值 */ update(value) { Object.entries(value).forEach((d) => this[d[0]] = d[1]); } }; customElements.get(\`select-\${"855f368"}\`) || customElements.define(\`select-\${"855f368"}\`, SelectMenu); // src/html/slider.html var slider_default = '
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n
      \\r\\n'; // src/core/ui/utils/slider.ts function offset(node) { const result = { top: 0, left: 0 }; const onwer = node.ownerDocument; if (node === onwer.body) { result.top = node.offsetTop; result.left = node.offsetLeft; } else { let rect = void 0; try { rect = node.getBoundingClientRect(); } catch { } if (!rect || !onwer.documentElement.contains(node)) { rect && (result.top = rect.top, result.left = rect.left); return result; } result.top = rect.top + onwer.body.scrollTop - onwer.documentElement.clientTop; result.left = rect.left + onwer.body.scrollLeft - onwer.documentElement.clientLeft; } return result; } var SliderBlock = class extends HTMLElement { _handle; _progress; _hinter; _wrp; \$value = 0; \$min = 0; \$max = 100; \$precision = 100; \$hint = true; \$solid = false; \$vertical = false; showChange; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = slider_default; this._handle = root.children[0].children[0].children[0].children[0].children[0]; this._progress = root.children[0].children[0].children[0].children[0].children[1]; this._hinter = root.children[0].children[0].children[0].children[0].children[0].children[0]; this._wrp = root.children[0].children[0].children[0]; const mouseLinster = (e) => { const { pageX, pageY } = e; const offsetX = this.\$vertical ? pageY - offset(this._wrp).top - 7 : pageX - offset(this._wrp).left - 7; const allX = this._wrp.offsetWidth - 14; const pv = (0 > offsetX ? 0 : offsetX > allX ? allX : offsetX) / allX; this.value = (this.\$max - this.\$min) * Math.round(pv * this.\$precision) / this.\$precision + this.\$min; this.dispatchEvent(new Event("change")); }; this.addEventListener("click", mouseLinster); const mouseClear = () => { window.removeEventListener("mousemove", mouseLinster); window.removeEventListener("mouseup", mouseClear); }; this._handle.addEventListener("mousedown", () => { window.addEventListener("mousemove", mouseLinster); window.addEventListener("mouseup", mouseClear); }); this._handle.addEventListener("mouseover", () => this.showChange()); let nHint = 0; this.showChange = () => { const pv = (this.\$value - this.\$min) / (this.\$max - this.\$min); this._handle.style.cssText = \`left: \${(pv * (this._wrp.offsetWidth - 14) + 7) / this._wrp.offsetWidth * 100}%;\`; this._progress.style.cssText = \`width: \${pv * 100}%;\`; if (this.\$hint) { this._hinter.textContent = this.\$value; if (this._hinter.style.display !== "block") this._hinter.style.display = "block"; if (this.\$solid) return; clearTimeout(nHint); nHint = setTimeout(() => this._hinter.style.display = "", 300); } ; }; } /** 默认值 */ get value() { return this.\$value; } set value(v) { if (this.\$vertical) v = this.\$max - v + this.\$min; v = (this.\$max - this.\$min) * Math.round((v - this.\$min) / (this.\$max - this.\$min) * this.\$precision) / this.\$precision + this.\$min; if (v === this.\$value) return; this.\$value = v; this.showChange(); } /** 最小值 */ get min() { return this.\$min; } set min(v) { if (v === this.\$min || v >= this.\$max) return; this.\$min = v; if (v > this.\$value) this.value = v; this.showChange(); } /** 最大值 */ get max() { return this.\$max; } set max(v) { if (v === this.\$max || v <= this.\$min) return; this.\$max = v; if (v < this.\$value) this.value = v; this.showChange(); } /** 刻度数 */ get precision() { return this.\$precision; } set precision(v) { if (v === this.\$precision) return; this.\$precision = v; this.value = this.\$value; } /** 提示信息 */ get hint() { return this.\$hint; } set hint(v) { if (v === this.\$hint) return; this.\$hint = v; } /** 固化提示 */ get solid() { return this.\$solid; } set solid(v) { if (v === this.\$solid) return; this.\$solid = v; this.showChange(); } /** 垂直 */ get vertical() { return this.\$vertical; } set vertical(v) { if (v === this.\$vertical) return; this.\$vertical = v; this.style.transform = v ? "rotate(-90deg)" : ""; } connectedCallback() { this.showChange(); } adoptedCallback() { this.showChange(); } /** 刷新值 */ update(value) { Object.entries(value).forEach((d) => this[d[0]] = d[1]); } }; customElements.get(\`slider-\${"855f368"}\`) || customElements.define(\`slider-\${"855f368"}\`, SliderBlock); // src/html/switch.html var switch_default = '
      \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n
      \\r\\n'; // src/core/ui/utils/switch.ts var SwitchButton = class extends HTMLElement { _bar; _knob; _circle; \$value = false; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = switch_default; this._bar = root.children[0].children[0]; this._knob = root.children[0].children[1]; this._circle = root.children[0].children[1].children[0]; root.children[0].addEventListener("click", (e) => { this.value = !this.\$value; e.stopPropagation(); this.dispatchEvent(new Event("change")); }); } get value() { return this.\$value; } set value(v) { if (this.\$value === v) return; if (v) { this._bar.setAttribute("checked", "checked"); this._knob.setAttribute("checked", "checked"); this._circle.setAttribute("checked", "checked"); } else { this._bar.removeAttribute("checked"); this._knob.removeAttribute("checked"); this._circle.removeAttribute("checked"); } this.\$value = v; } /** 刷新值 */ update(value) { value === void 0 || (this.value = value); return this; } }; customElements.get(\`switch-\${"855f368"}\`) || customElements.define(\`switch-\${"855f368"}\`, SwitchButton); // src/io/api-biliplus-playurl.ts async function apiBiliplusPlayurl(data) { const response = await fetch(objUrl("//www.biliplus.com/BPplayurl.php", data)); return await response.json(); } // src/io/sidx.ts var Sidx = class { /** * @param url 目标url * @param size 最大索引范围(不宜过大),默认6万字节 */ constructor(url, size = 6e4) { this.url = url; this.size = size; } /** range索引结束点 */ end = 5999; /** range索引开始点 */ start = 0; /** 结果hex字符串 */ hex_data = ""; getData() { return new Promise((resolve, reject) => { this.fetch(resolve, reject); }); } /** 请求片段 */ fetch(resolve, reject) { fetch(this.url.replace("http:", "https:"), { headers: { range: \`bytes=\${this.start}-\${this.end}\` } }).then((d) => { if ((d.status >= 300 || d.status < 200) && d.status !== 304) throw new Error(\`\${d.status} \${d.statusText}\`, { cause: d.status }); return d.arrayBuffer(); }).then((d) => { const data = new Uint8Array(d); this.hex_data += Array.prototype.map.call(data, (x) => ("00" + x.toString(16)).slice(-2)).join(""); if (this.hex_data.indexOf("73696478") > -1 && this.hex_data.indexOf("6d6f6f66") > -1) { const indexRangeStart = this.hex_data.indexOf("73696478") / 2 - 4; const indexRagneEnd = this.hex_data.indexOf("6d6f6f66") / 2 - 5; resolve(["0-" + String(indexRangeStart - 1), String(indexRangeStart) + "-" + String(indexRagneEnd)]); } else { this.start = this.end + 1; if (this.size && this.start > this.size) { reject("未能获取到sidx"); } else { this.end += 6e3; this.size && (this.end = Math.min(this.end, this.size)); this.fetch(resolve, reject); } } }).catch((e) => reject(e)); } }; // src/io/api-global-ogv-playurl.ts var ApiGlobalOgvPlayurl = class extends ApiSign { /** * @param data 查询参数 * @param server 东南亚(泰区)代理服务器 */ constructor(data, uposName, server = "api.global.bilibili.com") { super(URLS.GLOBAL_OGV_PLAYURL.replace("api.global.bilibili.com", server), "7d089525d3611b1c"); this.uposName = uposName; data = Object.assign({ area: "th", build: 1001310, device: "android", force_host: 2, download: 1, mobi_app: "bstar_a", platform: "android" }, data); this.fetch = fetch(this.sign(data)); } fetch; async getDate() { const response = await this.fetch; const text = await response.text(); return jsonCheck(VideoLimit.uposReplace(text, this.uposName)).data; } toPlayurl() { return new Promise((resolve, reject) => { this.fetch.then((d) => d.text()).then((d) => jsonCheck(VideoLimit.uposReplace(d, this.uposName)).data).then((d) => { const playurl = new PlayurlDash(); const set = []; playurl.quality = d.video_info.stream_list[0].stream_info.quality || d.video_info.quality; playurl.format = PlayurlFormatMap[playurl.quality]; playurl.timelength = d.video_info.timelength; playurl.dash.duration = Math.ceil(playurl.timelength / 1e3); playurl.dash.minBufferTime = playurl.dash.min_buffer_time = 1.5; Promise.all([ ...d.video_info.stream_list.map((d2) => (async () => { if (d2.dash_video && d2.dash_video.base_url) { const id = d2.stream_info.quality; playurl.accept_description.push(PlayurlDescriptionMap[id]); set.push(PlayurlFormatMap[id]); playurl.accept_quality.push(id); playurl.support_formats.push({ description: PlayurlDescriptionMap[id], display_desc: PlayurlQualityMap[id], format: PlayurlFormatMap[id], new_description: PlayurlDescriptionMap[id], quality: id, superscript: "", codecs: [PlayurlCodecs[id]] }); const sidx = await new Sidx(d2.dash_video.base_url, d2.dash_video.size).getData(); playurl.dash.video.push({ SegmentBase: { Initialization: sidx[0], indexRange: sidx[1] }, segment_base: { initialization: sidx[0], index_range: sidx[1] }, backupUrl: [], backup_url: [], bandwidth: d2.dash_video.bandwidth, baseUrl: d2.dash_video.base_url, base_url: d2.dash_video.base_url, codecid: d2.dash_video.codecid, codecs: PlayurlCodecsAPP[id] || PlayurlCodecs[id], frameRate: PlayurlFrameRate[id], frame_rate: PlayurlFrameRate[id], height: PlayurlResolution[id]?.[1], id: d2.stream_info.quality, mimeType: "video/mp4", mime_type: "video/mp4", sar: "1:1", startWithSap: 1, start_with_sap: 1, width: PlayurlResolution[id]?.[0] }); } })()), ...d.video_info.dash_audio.map((d2) => (async () => { const id = d2.id; const sidx = await new Sidx(d2.base_url, d2.size).getData(); playurl.dash.audio.push({ SegmentBase: { Initialization: sidx[0], indexRange: sidx[1] }, segment_base: { initialization: sidx[0], index_range: sidx[1] }, backupUrl: [], backup_url: [], bandwidth: d2.bandwidth, baseUrl: d2.base_url, base_url: d2.base_url, codecid: d2.codecid, codecs: PlayurlCodecsAPP[id] || PlayurlCodecs[id], frameRate: "", frame_rate: "", height: 0, id, mimeType: "audio/mp4", mime_type: "audio/mp4", sar: "", startWithSap: 0, start_with_sap: 0, width: 0 }); })()) ]).then(() => { const avc = [], hev = [], video = []; playurl.dash.video.forEach((d2) => { if (d2.codecid == 7) avc.push(d2); else hev.push(d2); }); let length = avc.length > hev.length ? avc.length : hev.length; for (let i = length - 1; i >= 0; i--) { if (avc[i]) video.push(avc[i]); if (hev[i]) video.push(hev[i]); } playurl.dash.video = video; playurl.accept_format = set.join(","); playurl.quality > 80 && (playurl.quality = 80); resolve(playurl); }).catch((e) => reject(e)); }).catch((e) => reject(e)); }); } }; // src/core/videolimit.ts var UPOS2 = { "ks3(金山)": "upos-sz-mirrorks3.bilivideo.com", "ks3b(金山)": "upos-sz-mirrorks3b.bilivideo.com", "ks3c(金山)": "upos-sz-mirrorks3c.bilivideo.com", "ks32(金山)": "upos-sz-mirrorks32.bilivideo.com", "kodo(七牛)": "upos-sz-mirrorkodo.bilivideo.com", "kodob(七牛)": "upos-sz-mirrorkodob.bilivideo.com", "cos(腾讯)": "upos-sz-mirrorcos.bilivideo.com", "cosb(腾讯)": "upos-sz-mirrorcosb.bilivideo.com", "coso1(腾讯)": "upos-sz-mirrorcoso1.bilivideo.com", "coso2(腾讯)": "upos-sz-mirrorcoso2.bilivideo.com", "bos(腾讯)": "upos-sz-mirrorbos.bilivideo.com", "hw(华为)": "upos-sz-mirrorhw.bilivideo.com", "hwb(华为)": "upos-sz-mirrorhwb.bilivideo.com", "uphw(华为)": "upos-sz-upcdnhw.bilivideo.com", "js(华为)": "upos-tf-all-js.bilivideo.com", "hk(香港)": "cn-hk-eq-bcache-01.bilivideo.com", "akamai(海外)": "upos-hz-mirrorakam.akamaized.net" }; var AREA = /* @__PURE__ */ ((AREA2) => { AREA2[AREA2["tw"] = 0] = "tw"; AREA2[AREA2["hk"] = 1] = "hk"; AREA2[AREA2["cn"] = 2] = "cn"; return AREA2; })(AREA || {}); var _VideoLimit = class { constructor(BLOD2) { this.BLOD = BLOD2; xhrHook("/playurl?", (args) => { const param2 = urlObj(args[1]); if (!uid && this.BLOD.status.show1080p && this.BLOD.status.accessKey.token) { param2.appkey = "27eb53fc9058f8c3"; param2.access_key = this.BLOD.status.accessKey.token; } param2.fnval && (param2.fnval = fnval); args[1] = objUrl(args[1], param2); return !(this.BLOD.limit || this.BLOD.th); }, (res) => { try { const result = res.responseType === "json" ? JSON.stringify(res) : res.responseText; if (this.BLOD.status.uposReplace.nor !== "不替换") { const nstr = _VideoLimit.uposReplace(result, this.BLOD.status.uposReplace.nor); this.BLOD.toast.warning("已替换UPOS服务器,卡加载时请到设置中更换服务器或者禁用!", \`CDN:\${this.BLOD.status.uposReplace.nor}\`, \`UPOS:\${UPOS2[this.BLOD.status.uposReplace.nor]}\`); if (res.responseType === "json") { res.response = JSON.parse(nstr); } else { res.response = res.responseText = nstr; } } } catch (e) { } }, false); } /** 数据备份 */ Backup = {}; /** 通知组件 */ toast; /** 通知信息 */ data = []; /** 监听中 */ listening = false; /** 播放数据备份 */ __playinfo__; /** 开始监听 */ enable() { if (this.listening) return; const disable = xhrHook.async("/playurl?", (args) => { const obj = urlObj(args[1]); this.updateVaribale(obj); return Boolean(this.BLOD.limit || this.BLOD.th); }, async (args) => { const response = this.BLOD.th ? await this._th(args) : await this._gat(args); return { response, responseType: "json", responseText: JSON.stringify(response) }; }, false); this.disable = () => { disable(); this.listening = false; }; this.listening = true; } /** 处理泰区 */ async _th(args) { this.data = ["泰区限制视频!"]; this.toast = this.BLOD.toast.toast(0, "info", ...this.data); const obj = urlObj(args[1]); this.data.push(\`aid:\${this.BLOD.aid}\`, \`cid:\${this.BLOD.cid}\`); this.toast.data = this.data; const epid = obj.ep_id || obj.episodeId || this.BLOD.epid; obj.access_key = this.BLOD.status.accessKey.token; if (!this.Backup[epid]) { try { this.BLOD.networkMock(); this.data.push(\`代理服务器:\${this.BLOD.status.videoLimit.th}\`); this.toast.data = this.data; this.Backup[epid] = { code: 0, message: "success", result: await this.th(obj) }; this.data.push("获取代理数据成功!"); this.toast.data = this.data; this.toast.type = "success"; } catch (e) { this.data.push("代理出错!", e); !obj.access_key && this.data.push("代理服务器要求【账户授权】才能进一步操作!"); this.toast.data = this.data; this.toast.type = "error"; debug.error(...this.data); this.toast.delay = 4; delete this.toast; this.data = []; return { code: -404, message: e, data: null }; } } this.toast.delay = 4; delete this.toast; this.data = []; return this.__playinfo__ = this.Backup[epid]; } /** 处理港澳台 */ async _gat(args) { this.data = ["港澳台限制视频!"]; this.toast = this.BLOD.toast.toast(0, "info", ...this.data); const obj = urlObj(args[1]); this.data.push(\`aid:\${this.BLOD.aid}\`, \`cid:\${this.BLOD.cid}\`); this.toast.data = this.data; const epid = obj.ep_id || obj.episodeId || this.BLOD.epid; obj.access_key = this.BLOD.status.accessKey.token; if (!this.Backup[epid]) { try { if (this.BLOD.status.videoLimit.server === "内置") { obj.module = "bangumi"; const upInfo = window.__INITIAL_STATE__?.upInfo; if (upInfo) { (upInfo.mid == 1988098633 || upInfo.mid == 2042149112) && (obj.module = "movie"); } this.data.push(\`代理服务器:内置\`, \`类型:\${obj.module}\`); this.toast.data = this.data; const res = await apiBiliplusPlayurl(obj); this.Backup[epid] = { code: 0, message: "success", result: res }; } else { const res = await this.gat(obj); this.Backup[epid] = { code: 0, message: "success", result: res }; } if (this.BLOD.status.uposReplace.gat !== "不替换") { this.Backup[epid] = JSON.parse(_VideoLimit.uposReplace(JSON.stringify(this.Backup[epid]), this.BLOD.status.uposReplace.gat)); this.BLOD.toast.warning("已替换UPOS服务器,卡加载时请到设置中更换服务器或者禁用!", \`CDN:\${this.BLOD.status.uposReplace.gat}\`, \`UPOS:\${UPOS2[this.BLOD.status.uposReplace.gat]}\`); } ; this.data.push("获取代理数据成功!"); this.toast.data = this.data; this.toast.type = "success"; } catch (e) { this.data.push("代理出错!", e); !obj.access_key && this.data.push("代理服务器要求【账户授权】才能进一步操作!"); this.toast.data = this.data; this.toast.type = "error"; debug.error(...this.data); this.toast.delay = 4; delete this.toast; this.data = []; return { code: -404, message: e, data: null }; } } this.toast.delay = 4; delete this.toast; this.data = []; return this.__playinfo__ = this.Backup[epid]; } /** 停止监听 */ disable() { this.listening = false; } /** 更新全局变量 */ updateVaribale(obj) { obj.seasonId && (this.BLOD.ssid = obj.seasonId); obj.episodeId && (this.BLOD.epid = obj.episodeId); obj.ep_id && (this.BLOD.epid = obj.ep_id); obj.aid && (this.BLOD.aid = Number(obj.aid)) && (this.BLOD.aid = obj.aid); obj.avid && (this.BLOD.aid = Number(obj.avid)) && (this.BLOD.aid = obj.avid); obj.cid && (this.BLOD.cid = Number(obj.cid)) && (this.BLOD.cid = obj.cid); } /** 访问泰区代理 */ async th(obj) { const d = await new ApiGlobalOgvPlayurl(obj, this.BLOD.status.uposReplace.th, this.BLOD.status.videoLimit.th).toPlayurl(); this.BLOD.toast.warning("已替换UPOS服务器,卡加载时请到设置中更换服务器或者禁用!", \`CDN:\${this.BLOD.status.uposReplace.th}\`, \`UPOS:\${UPOS2[this.BLOD.status.uposReplace.th]}\`); return d; } /** 代理服务器序号 */ area = 0; /** 访问港澳台代理 */ async gat(obj) { if (!this.BLOD.status.videoLimit[AREA[this.area]]) throw new Error(\`无有效代理服务器:\${AREA[this.area]}\`); const server = this.BLOD.status.videoLimit[AREA[this.area]]; obj.area = AREA[this.area]; this.data.push(\`代理服务器:\${server}\`); this.toast && (this.toast.data = this.data); try { return await apiPlayurl(obj, true, true, server); } catch (e) { this.data.push("代理服务器返回异常!", e); if (this.toast) { this.toast.data = this.data; this.toast.type = "warning"; } this.area++; if (this.area > 2) throw new Error("代理服务器不可用!"); return await this.gat(obj); } } /** * 替换upos服务器 * @param str playurl或包含视频URL的字符串 * @param uposName 替换的代理服务器名 keyof typeof {@link UPOS} */ static uposReplace(str, uposName) { if (uposName === "不替换") return str; this.upos = true; clearTimeout(this.timer); this.timer = setTimeout(() => this.upos = false, 1e3); return str.replace(/:\\\\?\\/\\\\?\\/[^\\/]+\\\\?\\//g, () => \`://\${UPOS2[uposName]}/\`); } }; var VideoLimit = _VideoLimit; /** 用于过滤upos提示 */ __publicField(VideoLimit, "upos", false); /** 用于取消过滤upos提示 */ __publicField(VideoLimit, "timer"); // src/core/ui.ts var Menus = { common: ["通用", svg.wrench], rewrite: ["重写", svg.note], danmaku: ["弹幕", svg.dmset], restore: ["修复", svg.stethoscope], player: ["播放", svg.play], style: ["样式", svg.palette], download: ["下载", svg.download] }; var UI = class { constructor(BLOD2) { this.BLOD = BLOD2; this.initMenu(); this.initSettings(); poll(() => document.readyState === "complete", () => { this.entry.type = this.BLOD.status.uiEntryType; document.body.appendChild(this.entry); this.updateCheck(); }, 1e3, 0); this.entry.addEventListener("click", (e) => { this.show(); e.stopPropagation(); }); } entry = new BilioldEntry(); interface = new BiliOldInterface(); menuitem = {}; settingItem = {}; /** 检查播放器脚本更新 */ async updateCheck() { if (this.BLOD.status.bilibiliplayer && this.BLOD.status.checkUpdate) { const version = await this.BLOD.GM.getValue("version"); if (version !== this.BLOD.version) { this.BLOD.loadplayer(true); } } } /** 初始化菜单 */ initMenu() { Object.entries(Menus).forEach((d) => { const menu = new Menuitem(); this.menuitem[d[0]] = menu; menu.init(d[1][0], d[1][1]); this.interface.addMenu(menu); }); } /** 初始化设置项 */ initSettings() { this.initSettingCommon(); this.initSettingRewrite(); this.initSettingStyle(); this.initSettingRestore(); this.initSettingPlayer(); this.initSettingDanmaku(); this.initSettingDownload(); } /** 通用设置 */ initSettingCommon() { this.menuitem.common.addSetting([ this.switch("development", "开发者模式", "暴露调试接口到控制台", svg.warn, (v) => { if (v) { propertyHook(window, "BLOD", this.BLOD); } else { Reflect.deleteProperty(window, "BLOD"); } }, "暴露一个名为【BLOD】的对象到全局,你可以在浏览器控制台里使用内部的属性及方法进行调试。"), this.switch("disableReport", "数据上报", "禁止网页跟踪上报", svg.linechart), this.select("uiEntryType", "设置入口样式", { candidate: ["old", "new"] }, "浮动齿轮或者贴边隐藏", svg.gear, (v) => this.entry.type = v, "【old】入口更具隐蔽性,鼠标移动到贴边位置才会浮现。【new】入口每次网页加载完成都会滚动浮现,隐藏会鼠标移动到对应位置便会浮现。"), this.button("userStatus", "管理设置数据", () => { alert([ "备份脚本设置或者恢复已备份的数据。", "当调整的选项过多时,备份一下是一个良好的主意,以免因为意外重复第二次操作。" ], "备份还原", [ { text: "默认", callback: () => this.BLOD.user.restoreUserStatus() }, { text: "导出", callback: () => this.BLOD.user.outputUserStatus() }, { text: "导入", callback: () => this.BLOD.user.inputUserStatus() } ]); }, "备份/恢复", "管理", svg.blind), this.switch("bilibiliplayer", "重构播放器", "修复及增强", svg.play, (v) => { if (v) { this.updateCheck(); } }, "旧版播放器已于 2019-10-31T07:38:36.004Z 失去官方维护,为了旧版播放器长期可持续维护,我们使用typescript完全重构了旧版播放器。修复了旧版播放器出现异常或失效的功能(如无法获取90分钟以后的弹幕问题),移植了一些B站后续推出的功能(如互动视频、全景视频、杜比视界、杜比全景声、AV1编码支持和DRM支持等)。能力有限无法做到100%复刻,如果您想体验原生的旧版播放器,可以禁用本功能。同时由于项目托管于Github,国内部分网络环境可能访问不畅,初次启动播放器可能耗时较久,加载失败后也会回滚原生播放器。如果您的网络环境始终无法正常加载,也请禁用本功能或者前往反馈。") ]); this.menuitem.common.addCard("toastr"); this.menuitem.common.addSetting([ this.switch("toast.disabled", "禁用", 'toastr', void 0, (v) => this.BLOD.toast.disabled = v), this.switch("toast.rtl", "镜像", "左右翻转", void 0, (v) => this.BLOD.toast.rtl = v), this.select("toast.position", "位置", { candidate: ["top-left", "top-center", "top-right", "top-full-width", "bottom-left", "bottom-right", "bottom-center", "bottom-full-width"] }, "相对屏幕", void 0, (v) => this.BLOD.toast.position = v), this.slider("toast.delay", "时长", { min: 2, max: 60, precision: 58 }, "单位:/秒", void 0, (v) => this.BLOD.toast.delay = v), this.select("toast.type", "类型", { candidate: ["info", "success", "warning", "error"], styles: { info: "color: #2F96B4", success: "color: #51A351", warning: "color: #F89406", error: "color: #BD362F" } }, "测试限定"), this.inputCustom("toast.test", "测试", { candidate: ["Hello World!"] }, (v) => { try { this.BLOD.toast.toast(this.BLOD.status.toast.delay, this.BLOD.status.toast.type, v); } catch (e) { this.BLOD.toast.error("非常抱歉!发生了错误", e); } }, "请输入一句话~") ], 1); this.menuitem.common.addCard("账户授权"); this.menuitem.common.addSetting([ this.input("accessKey.token", "token", { prop: { type: "text", readonly: "readonly" } }, "access_key", void 0, void 0, "鉴权。效果等同于网页端的cookie,B站服务器用以识别您的登录身份。本脚本只会在您本地保存鉴权,绝对不会泄露出去,唯一的例外是如果启用了【解除区域限制】功能并选择自定义服务器,则会向代理服务器发送鉴权,我们无法保证第三方服务器如何使用您的鉴权,所以万请自行必确认代理服务器的可信度,三思而后行!"), this.input("accessKey.dateStr", "授权日期", { prop: { type: "text", readonly: "readonly" } }, "有效期一般为一个月", void 0, void 0, "脚本不会代为检查鉴权是否失效,请失效时自行重新授权。"), this.button("accessKey.action", "进行授权", () => { new AccessKey(this.BLOD); }, "授权脚本使用登录鉴权", "授权", svg.warn) ], 2); if (true) { this.menuitem.common.addSetting([ this.switch("checkUpdate", "检查更新", "自动更新播放器", svg.download, void 0, "启用【重构播放器】后,脚本会自动检查并更新播放器组件,但可能因为网络原因更新失败,出现反复更新->反复失败的问题。您可以禁用此功能,以继续使用【重构播放器】,等待网络环境改善后再尝试启用。") ]); } } /** 重写设置 */ initSettingRewrite() { this.menuitem.rewrite.addSetting([ this.switch("av", "av/BV", "恢复旧版av页"), this.switch("bangumi", "bangumi", "恢复旧版bangumi页"), this.switch("watchlater", "稍后再看", "恢复旧版稍后再看"), this.switch("playlist", "播单", "恢复旧版播单页"), this.switch("index", "主页", "恢复旧版Bilibili主页"), this.switch("player", "播放器", "替换其他未重写页面的播放器"), this.switch("read", "专栏", "恢复旧版专栏"), this.switch("ranking", "排行榜", "恢复旧版全站排行榜页"), this.switch("search", "搜索", "恢复旧版搜索页"), this.switch("album", "相簿", "恢复相簿页") ]); } /** 弹幕设置 */ initSettingDanmaku() { this.menuitem.danmaku.addSetting([ this.switch("dmproto", "proto弹幕", "protobuf弹幕支持", void 0, void 0, "因为B站已放弃维护xml弹幕,带来一些问题,比如90分钟后无弹幕,所以此项不建议禁用。【重构播放器】默认启用且不受此项影响。"), this.switch("dmwrap", "弹幕提权", "允许普权弹幕排版", void 0, void 0, "上古时代存在大量使用换行及空格等特殊字符来提权以达到高级弹幕效果的作品,在html5时代无法正常显示,启用此项将恢复普权弹幕排版效果。尽情享受弹幕艺术。【重构播放器】默认启用且不受此项影响。"), this.select("dmExtension", "弹幕格式", { candidate: ["xml", "json"] }, "拓展名", void 0, void 0, "【下载弹幕】及【本地弹幕】使用的弹幕格式,xml是传统格式,json是protobuf弹幕实际格式,前者一般拥有更小的体积,只是可能丢失彩蛋彩蛋及部分非法字符。"), this.switch("dmContact", "合并弹幕", "本地弹幕或在线弹幕", void 0, void 0, "选择【本地弹幕】或【在线弹幕】是否与播放器内已有弹幕合并。"), this.inputCustom("onlineDm", "在线弹幕", { prop: { placeholder: "ss3398" } }, (v) => { v && typeof v === "string" && this.BLOD.danmaku.onlineDm(v); }, "从其他视频加载弹幕", void 0, "从其他B站视频加载弹幕,可以输入关键url或者查询参数,如:
      av806828803
      av806828803?p=1
      aid=806828803&p=1
      ss3398
      ep84795
      注意:【重构播放器】此处加载的弹幕会替换【下载弹幕】的内容!"), this.button("localDm", "本地弹幕", () => { this.BLOD.status.dmExtension === "json" ? this.BLOD.danmaku.localDmJson() : this.BLOD.danmaku.localDmXml(); }, "加载本地磁盘上的弹幕", "打开", void 0, "从本地磁盘上加载弹幕文件,拓展名.xml,编码utf-8。【合并弹幕】项能选择是否与播放器内已有弹幕合并。") ]); } /** 样式设置 */ initSettingStyle() { this.menuitem.style.addSetting([ this.switch("header", "恢复旧版顶栏", "替换所有B站页面中的顶栏为旧版", void 0, void 0, "除非替换后实在不和谐,一般都会进行替换。"), this.switch("comment", "恢复评论翻页", "替换瀑布流评论区", void 0, void 0, "评论区版本将被固定,可能享受不到B站后续为评论区推出的新功能。本功能有专门独立为一个脚本,不要重复安装。"), this.switch("staff", "合作UP主", "联合投稿显示合作UP主", void 0, void 0, "在原av页up主信息处列出所有合作up主。"), this.switch("bangumiEplist", "保留bangumi分P", "牺牲特殊背景图", void 0, void 0, "旧版bangumi遇到有特殊背景图的视频时,会隐藏播放器下方的分集选择界面,二者不可得兼。"), this.switch("jointime", "注册时间", "个人空间显示账户注册时间"), this.switch("history", "纯视频历史", "过滤历史记录页的非视频部分"), this.switch("liveRecord", "录屏动态", "允许动态页显示直播录屏"), this.switch("commentJumpUrlTitle", "评论超链接标题", "还原为链接或短链接", void 0, void 0, "直接显示链接标题固然方便,但有些时候还是直接显示链接合适。"), this.switch("like", "添加点赞功能", "不支持一键三连"), this.switch("fullBannerCover", "修正banner分辨率", "顶栏banner完整显示不裁剪", void 0, void 0, "旧版顶栏banner接口已不再更新,脚本使用新版banner接口进行修复,但二者图片分辨率不一致。脚本默认不会去动页面样式以尽可能原汁原味还原旧版页面,导致顶栏banner被裁剪显示不全,启用本项将调整顶栏分辨率以完整显示图片。"), this.switch("episodeData", "分集数据", "bangumi", void 0, void 0, "显示bangumi分集播放和弹幕数,原始合计数据移动到鼠标浮动提示中。"), this.switch("simpleChinese", "繁 -> 简", "将繁体字幕翻译为简体", void 0, void 0, "识别并替换CC字幕繁体并转化为简体,使用内置的简繁对照表机械翻译。") ]); } /** 修复设置 */ initSettingRestore() { this.menuitem.restore.addSetting([ this.switch("lostVideo", "失效视频", "尝试获取失效视频信息", void 0, void 0, "修复收藏的失效视频的封面和标题信息,并以红色删除线标记。使用缓存数据恢复的页面重构av页默认开启且不受此项影响,其中部分上古失效视频甚至还保留了评论区。"), this.switch("disableSleepChcek", "禁用直播间挂机检测", "就喜欢挂后台听个响不行吗!"), this.switch("show1080p", "不登录高画质支持", "dash模式限定", void 0, (v) => { if (v && !this.BLOD.status.accessKey.token) { this.BLOD.toast.warning("需要启用【账户授权】功能!"); alert("需要启用【账户授权】功能!是否前往?", "【账户授权】", [{ text: "前往【账户授权】", callback: () => this.show("accessKey.token") }]); this.BLOD.status.show1080p = false; } }, "B站砍掉了不登录能获取的画质,最多只能获取480P。您可以启用【账户授权】功能,授权本脚本使用您的登录信息,如此您退出登录后依然能获取高画质视频流。本功能只会在请求播放源时添加上登录鉴权,不影响页面其他功能的未登录状态,B站也不会记录您的播放记录。本功能适用于那些经常用浏览器无痕模式上B站的用户。若非常抱歉报错请关闭本选项!"), this.switch("timeLine", "港澳台新番时间表", "填充首页番剧板块", void 0, void 0, "在首页番剧板块中填充港澳台最新番剧更新信息。只提取了最新的30条番剧信息,所以数据中可能不会包含过于久远的更新。本功能只能显示已更新的番剧信息,而不能作为即将更新番剧的预测。") ]); } /** 播放设置 */ initSettingPlayer() { this.menuitem.player.addSetting([ this.sliderCustom("playbackRate", "播放速率", { min: 0.25, max: 5, precision: 95, value: 1, solid: true }, (e) => { this.BLOD.player.playbackRate(e); }, "播放速率调整拓展", void 0, "调节当前HTML5播放器速率,拥有比播放器自带的更宽的调整范围。注意:未调整前的当前速率默认为1。"), this.switch("webRTC", "WebRTC", "关闭以禁用p2p共享带宽", void 0, void 0, "B站使用【WebRTC】实现p2p共享,等同于将您的设备变成了B站的一个视频服务器节点,别人观看相同的视频或直播便可以从您的设备取流而不必访问B站固有的服务器。脚本默认关闭了此功能,以减轻小水管的带宽压力,如果您的带宽允许,还是推荐开启,人人为我,我为人人。bilibili~乾杯 - ( ゜-゜)つロ!"), this.switch("elecShow", "充电鸣谢", "允许视频结尾的充电鸣谢"), this.switch("videoDisableAA", "禁用视频渲染抗锯齿", '详见#292说明'), this.switch("ugcSection", "视频合集", "以播单形式呈现", void 0, void 0, "视频合集在旧版页面时代本不存在,但其实质类似于上古的播单,所以直接使用播单页面进行模拟。值得一提的是真正的播单页面相关接口已完全被404,如果有幸访问到脚本会直接替换为缓存的播单号769——因为只缓存了这一项数据。另外播单详情页面还是404状态,以后可能也会用缓存数据修复,让后人能一窥范例。") ]); this.menuitem.player.addCard("自动化操作"); this.menuitem.player.addSetting([ this.switch("automate.danmakuFirst", "展开弹幕列表", "而不是推荐视频", void 0, void 0, "载入播放器时右侧面板默认切换到弹幕列表。"), this.switch("automate.showBofqi", "滚动到播放器", "载入视频时", void 0, void 0, "载入播放器时自动滚动到播放器。"), this.switch("automate.screenWide", "宽屏模式", "隐藏播放器右侧面板", void 0, (v) => v && (this.BLOD.status.automate.webFullScreen = false), "载入播放器时自动启用宽屏模式。(与网页全屏二选一)"), this.switch("automate.noDanmaku", "无弹幕模式", "默认关闭弹幕", void 0, void 0, "载入播放器时默认关闭弹幕。"), this.switch("automate.autoPlay", "自动播放", "播放器初始化完成时", void 0, void 0, "播放器加载完成自动播放。"), this.switch("automate.webFullScreen", "网页全屏模式", "载入视频时", void 0, (v) => v && (this.BLOD.status.automate.screenWide = false), "载入播放器时自动网页全屏。(与宽屏模式二选一)"), this.switch("automate.videospeed", "记忆播放速率", "永久继承播放速率设定", void 0, void 0, "默认的记忆播放速率记忆仅同一个网页标签页有效,开启后将代为记忆固定下来。") ], 1); this.menuitem.player.addCard("限制视频"); this.menuitem.player.addSetting([ this.switch("videoLimit.status", "解除播放限制", "解除区域/APP限制", void 0, void 0, "内置服务器只能获取到360P,有条件请在下面自定义服务器。"), this.select("videoLimit.server", "代理服务器模式", { candidate: ["内置", "自定义"] }, "自定义模式须要填写下面的服务器", void 0, (v) => { if (v === "自定义") { if (!this.BLOD.status.videoLimit.cn && !this.BLOD.status.videoLimit.hk && !this.BLOD.status.videoLimit.tw) { this.BLOD.toast.warning("请至少填选以下代理服务器中的一下再选择!", "服务器请自行搭建或参考【公共反代服务器】"); this.BLOD.status.videoLimit.server = "内置"; alert('https://github.com/yujincheng08/BiliRoaming/', "公共反代服务器"); } else if (!this.BLOD.status.accessKey.token) { alert([ "【公共反代服务器】一般都要求识别您的登录身份才能正常登录", "点击【授权】将跳转到账户授权页面,点击【取消】或其他区域返回", "【账户授权】是高风险操作,请仔细阅读相关说明后三思而后操作!" ], void 0, [ { text: "授权", callback: () => { this.show("accessKey.token"); } }, { text: "取消" } ]); } } }, "大部分新视频【内置】服务器只能获取到360P,实在不堪入目,有条件的话还是【自定义】服务器吧。对于大陆用户而言,【自定义】服务器一般填一个台湾就行,或者加上一个泰区。"), this.input("videoLimit.th", "泰区", { prop: { type: "url", placeholder: "www.example.com" } }, "泰国(东南亚)限定视频反代服务器", void 0, void 0, "解析泰国(东南亚)限定视频所用的代理服务器。东南亚视频暂时无弹幕和评论,有也是其他视频乱入的。"), this.input("videoLimit.tw", "台湾", { prop: { type: "url", placeholder: "www.example.com" } }, "台湾限定视频反代服务器", void 0, void 0, "解析【仅限台湾地区】视频所用的代理服务器。港澳台限定视频的首选。"), this.input("videoLimit.hk", "港澳", { prop: { type: "url", placeholder: "www.example.com" } }, "香港澳门限定视频反代服务器", void 0, void 0, "解析【仅限香港澳门地区】视频所用的代理服务器。与台湾不同,香港澳门基本上是绑定在一起的。"), this.input("videoLimit.cn", "大陆", { prop: { type: "url", placeholder: "www.example.com" } }, "大陆限定视频反代服务器", void 0, void 0, "解析大陆(一般)视频所用的代理服务器。此项一般是留给海外用户用的。") ], 2); this.menuitem.player.addCard("替换 UPOS 服务器"); const upos = Object.keys(UPOS2); this.menuitem.player.addSetting([ this.select("uposReplace.th", "泰区", { candidate: upos }, "针对泰国(东南亚)限制视频", void 0, void 0, "泰区服务器ban了大陆ip,所以必须选一个进行替换。卡加载时请酌情切换。"), this.select("uposReplace.gat", "港澳台", { candidate: ["不替换"].concat(upos) }, "针对港澳台限制视频", void 0, void 0, "港澳台视频服务器一般为大陆外的Akamai,大陆用户有可能访问不畅,请按需酌情切换。若卡加载请关闭或者换一个。"), this.select("uposReplace.nor", "一般视频", { candidate: ["不替换"].concat(upos) }, "针对其他视频", void 0, void 0, "一般视频不需要替换,除非分配给您的视频服务器实在不行,请按需酌情切换。若卡加载请关闭或者换一个。"), this.select("uposReplace.download", "下载", { candidate: ["不替换"].concat(upos) }, "针对下载功能", void 0, void 0, "一般不需要替换,除非屡屡下载403。若还是403请关闭或者换一个。") ], 3); } /** 下载设置 */ initSettingDownload() { this.menuitem.download.addSetting([ this.button("download", "下载视频", () => { this.BLOD.download.default(); }, "下载当前视频", "视频", void 0, "根据当前设置下载当前网页(顶层)的视频,在页面底部列出所有可用下载源。仅在视频播放页可用。"), this.button("downloadDm", "下载弹幕", () => { this.BLOD.danmaku.download(); }, "下载当前弹幕", "弹幕", void 0, "下载当前视频的弹幕,你可以在【弹幕格式】里选择要保存的格式,详见对应设置项说明。文件名格式为“视频标题(分P标题).扩展名”或者“aid.cid.扩展名”。"), this.button("downloadImg", "下载封面", () => { this.BLOD.download.image(); }, "下载当前封面", "封面", void 0, "下载当前视频的封面,如果有其他特殊图片,也会一并显示。请右键对应的图片另存为。"), this.chockboxs("downloadType", "请求的文件类型", ["mp4", "dash", "flv"], "视频封装格式", void 0, () => this.BLOD.download.destory(), "勾选视频的封装类型,具体能不能获取到两说。封装类型≠编码类型:①mp4封装,视频编码avc+音频编码aac,画质上限1080P。②flv封装,编码同mp4,但可能切分成多个分段,须手动合并。③dash,未封装的视频轨和音频轨,以编码格式分类,aac为音频轨(含flac、杜比全景声),avc、hev和av1为视频轨(任选其一即可),须下载音视频轨各一条后手动封装为一个视频文件。另外【解除区域限制】功能获取到的下载源不受本项限制。
      ※ 2022年11月2日以后的视频已经没有flv封装。"), this.switch("TVresource", "请求tv端视频源", "无水印", void 0, (e) => { e && alert("下载TV源必须将【referer】置空,否则会403(无权访问)!另外浏览器不支持配置UA和referer,请更换【下载方式】!", "403警告", [ { text: "置空referer", callback: () => this.BLOD.status.referer = "" } ]); this.BLOD.download.destory(); }, "请求TV端下载源,唯一的优势是可能无Bilibili水印。注意:①B站tv端大会员不通用,所以可能无法获取到大会员视频或画质。②需要进行【账户授权】,否则只能以游客身份获取下载数据。③TV源要求特定的UA且不能发送referer,基本无法通过浏览器直接下载(403无权访问),请选择其他下载工具。④mp4封装的并非tv源。"), this.select("downloadQn", "画质", { candidate: ["0", "15", "16", "32", "48", "64", "74", "80", "112", "116", "120", "125", "126", "127"] }, "flv限定", void 0, () => this.BLOD.download.destory(), "画质参数,只针对flv封装。mp4封装没得选,dash则由于特性会一次性提供所有画质选项。"), this.select("downloadMethod", "下载方式", { candidate: ["浏览器", "IDM", "ef2", "aria2", "aria2rpc"] }, "浏览器或第三方工具", void 0, (e) => { switch (e) { case "浏览器": alert("由于浏览器安全限制,直接鼠标左键点击很难触发下载功能,更良好的习惯是右键要下载的文件选择【另存为】(不同浏览器可能命名不同)", "浏览器下载"); break; case "IDM": alert('IDM(Internet Download Manager)是Windows端著名的的下载工具,本方式将下载数据生成IDM导出文件,您可以在打开IDM -> 任务 -> 导入 -> 从"IDM导出文件"导入开始下载。虽然有点麻烦,但是IDM支持配置UA和referer,并且下载速度的确不是浏览器能比的。', "IDM导出文件"); break; case "ef2": alert('ef2是本脚本作者开发的一款开源的IDM辅助工具,支持直接从浏览器里拉起IDM进行下载,免去使用IDM导出文件的繁琐,同时解放你的鼠标左键。', "ef2辅助下载"); break; case "aria2": alert('aria2是著名的开源命令行下载工具,本方式将下载命令复制到剪切板。命令行不是一般人能使用的工具,没有相应知识储备和使用习惯不推荐选择。', "aria2"); break; case "aria2rpc": alert("aria2支持rpc方式进行下载,正确配置后方便程度不亚于ef2方式,唯一的问题是配置起来有亿点麻烦。
      是否跳转到rpc相关设置?", "aria2 rpc", [ { text: "RPC配置", callback: () => this.show("aria2.server") }, { text: "不必了" } ]); break; default: break; } }, "使用浏览器下载请右键另存为而不是左键点击!其他选项需要使用对应工具,详见对应选项弹窗说明。"), this.input("userAgent", "User-Agent", { candidate: [ "Bilibili Freedoooooom/MarkII", "Mozilla/5.0 BiliDroid/7.0.0 (bbcallen@gmail.com)", navigator.userAgent ] }, "鉴权参数", void 0, void 0, "下载工具发送给服务器的身份标志,鉴权关键参数之一,无效的User-Agent将导致403无权访问。除非你知道自己在修改什么,否则请不要轻易调整此项。此项只在使用第三方下载方式时有效。"), this.input("referer", "referer", { candidate: [location.origin] }, "鉴权参数", void 0, (v) => { v && alert("您勾选了下载TV源,根据经验必须将referer置空,不然会触发403(无权访问)!是否撤销输入将referer置空?还是取消勾选tv源?", "设置冲突", [ { text: "置空referer", callback: () => this.BLOD.status.referer = "" }, { text: "取消勾选tv源", callback: () => this.BLOD.status.TVresource = false } ]); }, "下载时发送给服务器的标志之一,鉴权关键参数之一,无效的User-Agent将导致403无权访问。此项在网页端必须存在,而且一般为主站域名,但是TV、APP等源此项必须为空!"), this.input("filepath", "下载目录", {}, "保存下载文件的本地磁盘目录", void 0, void 0, "ef2、aria2和aria2rpc方式限定。Windows平台请注意使用反斜杠哦。") ]); this.menuitem.download.addCard("aria2 相关"); this.menuitem.download.addSetting([ this.input("aria2.server", "RPC服务器", { prop: { type: "url", placeholder: "http://localhost" }, candidate: ["http://localhost"] }, "本地或远程链接", void 0, void 0, "端口号请另外输入。建议使用下方按钮测试RPC连接可用性。"), this.input("aria2.port", "端口", { prop: { type: "number", placeholder: "6800" }, candidate: ["6800"] }, "本地或远程端口", void 0, void 0, "服务器链接另外输入。建议使用下方按钮测试RPC连接可用性。"), this.input("aria2.token", "token", { prop: { type: "password" } }, "鉴权", void 0, void 0, "如果RPC服务器启用了token鉴权的话。"), this.slider("aria2.split", "分段数目", { min: 1, max: 16, precision: 15 }, "分段并发下载", void 0, void 0, "对于支持断点续传的文件,启用多线程同时并发下载通常是一种非常有效的提高下载速度的方法。如果需要请自行调整一个合适的并发数,1表示不并发下载。值得注意的是,部分服务器会限制并发连接数目,并发连接过多有触发风控甚至被临时封禁的风险,所以并不是并发数越多越好。"), this.slider("aria2.size", "分段大小", { min: 1, max: 20, precision: 19 }, "单位:/MB", void 0, void 0, "如果一个文件有多个下载源,那么此项会间接决定使用几个下载源。一旦要下载的文件不小于此项的2倍,aria2便会同时尝试连接多个下载源。这也是提高下载速率的有效方法。注意:某种意义上此项是越小越好,原因不言而喻。"), this.button("aria2.test", "测试RPC连接", () => { const data = ["正在测试RPC连接~"]; const toast = this.BLOD.toast.toast(0, "info", ...data); new Aria2().getVersion().then((d) => { toast.type = "success"; data.push(\`-------aria2 v\${d.version}-------\`, ...d.enabledFeatures); toast.data = data; }).catch((e) => { toast.type = "error"; data.push("RPC链接失败 ಥ_ಥ", e); debug.error("RPC链接失败 ಥ_ಥ", e); toast.data = data; }).finally(() => { toast.delay = 4; }); }, "获取aria2信息", "ping", void 0, "请确定正确配置并启用了aria2的RPC服务器。") ], 1); this.menuitem.download.addCard("ef2 相关"); this.menuitem.download.addSetting([ this.switch("ef2.delay", "稍后下载", "添加到IDM下载队列但不开始", void 0, void 0, "要开始时请手动到IDM队列里点击开始。本项可以用来批量下载而不弹出多个窗口。注意:B站视频源使用的是临时链接,过期后无法访问,请及时下载或清理。"), this.switch("ef2.silence", "静默下载", "跳过IDM确认对话框", void 0, void 0, "默认情况下IDM会弹窗询问是否确认下载,在该确认框中可以调整保存目录和文件名等操作。启用本项以跳过该确认框。") ], 2); } /** * 新建开关设置 * @param id 用户数据键或链式字符串,链式字符串用来提取深层数据 * @param label 标题 * @param sub 副标题 * @param svg 图标 * @param callback 用户调整设置的回调,将新值作为第一个参数传入 * @param desc 浮动窗口 */ switch(id, label, sub, svg2, callback, desc) { const item = new SettingItem(); const button = new SwitchButton(); const arr2 = id.split("."); let looping = false; item.init(arr2.join(""), label, sub, svg2); button.update(this.BLOD.getStatus(id)); button.addEventListener("change", () => { looping = true; this.BLOD.setStatus(id, button.value); callback && callback(button.value); }); this.BLOD.bindStatusChange(arr2.shift(), (v) => { looping || button.update(this.BLOD.getStatus(arr2.join("."), v)); looping = false; }); item.value(button); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 新建下拉菜单设置 * @param id 用户数据键或链式字符串,链式字符串用来提取深层数据 * @param label 标题 * @param value 配置数据 * @param sub 副标题 * @param svg 图标 * @param callback 用户调整设置的回调,将新值作为第一个参数传入 * @param desc 浮动窗口 */ select(id, label, value, sub, svg2, callback, desc) { const item = new SettingItem(); const select = new SelectMenu(); const arr2 = id.split("."); let looping = false; item.init(arr2.join(""), label, sub, svg2); value.value = this.BLOD.getStatus(id); select.update(value); select.addEventListener("change", () => { looping = true; this.BLOD.setStatus(id, select.value); callback && callback(select.value); }); this.BLOD.bindStatusChange(arr2.shift(), (v) => { looping || (select.value = this.BLOD.getStatus(arr2.join("."), v)); looping = false; }); item.value(select); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 创建滑动条菜单设置 * @param id 用户数据键或链式字符串,链式字符串用来提取深层数据 * @param label 标题 * @param value 配置数据 * @param sub 副标题 * @param svg 图标 * @param callback 用户调整设置的回调,将新值作为第一个参数传入 * @param desc 浮动窗口 */ slider(id, label, value, sub, svg2, callback, desc) { const item = new SettingItem(); const slider = new SliderBlock(); const arr2 = id.split("."); let looping = false; item.init(arr2.join(""), label, sub, svg2); value.value = this.BLOD.getStatus(id); slider.update(value); slider.addEventListener("change", () => { looping = true; this.BLOD.setStatus(id, slider.value); callback && callback(slider.value); }); this.BLOD.bindStatusChange(arr2.shift(), (v) => { looping || (slider.value = this.BLOD.getStatus(arr2.join("."), v)); looping = false; }); item.value(slider); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 创建自定义滑动条菜单设置 * @param id 用来索引的字符串 * @param label 标题 * @param value 配置数据 * @param callback 输入回调 * @param sub 副标题 * @param svg 图标 * @param desc 浮动窗口 */ sliderCustom(id, label, value, callback, sub, svg2, desc) { const item = new SettingItem(); const slider = new SliderBlock(); item.init("", label, sub, svg2); slider.update(value); slider.addEventListener("change", () => { callback(slider.value); }); item.value(slider); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 创建自定义输入框设置 * @param id 用来索引的字符串 * @param label 标题 * @param value 配置数据 * @param callback 输入回调 * @param sub 副标题 * @param svg 图标 * @param desc 浮动窗口 */ inputCustom(id, label, value, callback, sub, svg2, desc) { const item = new SettingItem(); const input = new InputArea(); item.init("", label, sub, svg2); input.update(value); input.addEventListener("change", () => { callback(input.value); }); item.value(input); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 创建输入框设置 * @param id 用户数据键或链式字符串,链式字符串用来提取深层数据 * @param label 标题 * @param value 配置数据 * @param sub 副标题 * @param svg 图标 * @param callback 输入回调 * @param desc 浮动窗口 */ input(id, label, value, sub, svg2, callback, desc) { const item = new SettingItem(); const input = new InputArea(); const arr2 = id.split("."); let looping = false; item.init(arr2.join(""), label, sub, svg2); value.value = this.BLOD.getStatus(id); input.update(value); input.addEventListener("change", () => { looping = true; this.BLOD.setStatus(id, input.value); callback && callback(input.value); }); this.BLOD.bindStatusChange(arr2.shift(), (v) => { looping || (input.value = this.BLOD.getStatus(arr2.join("."), v)); looping = false; }); item.value(input); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 创建按钮设置 * @param id 用来索引的字符串 * @param label 标题 * @param callback 按钮点击回调 * @param sub 副标题 * @param text 按钮文字 * @param svg 图标 * @param desc 浮动窗口 */ button(id, label, callback, sub, text, svg2, desc) { const item = new SettingItem(); const button = new PushButton(); item.init("", label, sub, svg2); text && (button.text = text); button.addEventListener("change", (ev) => { callback(); }); item.value(button); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 新建复选框设置 * @param id 用户数据键或链式字符串,链式字符串用来提取深层数据 * @param label 标题 * @param values 配置数据 * @param sub 副标题 * @param svg 图标 * @param callback 用户调整设置的回调,将新值作为第一个参数传入 * @param desc 浮动窗口 */ chockboxs(id, label, values, sub, svg2, callback, desc) { const item = new SettingItem(); const checkboxs = new CheckBoxs(); const arr2 = id.split("."); let looping = false; item.init(arr2.join(""), label, sub, svg2); checkboxs.update(values); checkboxs.value = Array.from(this.BLOD.getStatus(id)); checkboxs.addEventListener("change", () => { looping = true; this.BLOD.setStatus(id, checkboxs.value); callback && callback(checkboxs.value); }); this.BLOD.bindStatusChange(arr2.shift(), (v) => { looping || (checkboxs.value = this.BLOD.getStatus(arr2.join("."), v)); looping = false; }); item.value(checkboxs); this.settingItem[id] = item; desc && new Desc().value(label, desc, item); return item; } /** * 显示设置面板 * @param id 设置项注册id,id不在可选项时可以使用强制断言 * @example * this.show('accessKey.token') // 显示设置面板并滚动到【账户授权】那一项 * this.show(<'accessKey'>'accessKey.token') // TypeScript 强制断言 */ show(id) { this.interface.show(); if (id && this.settingItem[id]) { this.settingItem[id].dispatchEvent(new Event("show")); } else { this.menuitem.common.click(); } } }; // src/core/url.ts var paramsSet = /* @__PURE__ */ new Set([ "spm_id_from", "from_source", "msource", "bsource", "seid", "source", "session_id", "visit_id", "sourceFrom", "from_spmid", "share_source", "share_medium", "share_plat", "share_session_id", "share_tag", "unique_k", "vd_source", "csource" ]); var paramArr = Object.entries({ from: ["search"] }); var UrlCleaner = class { /** 垃圾参数序列 */ paramsSet = paramsSet; /** 精准爆破序列 */ paramArr = paramArr; constructor() { this.location(); window.navigation?.addEventListener("navigate", (e) => { const newURL = this.clear(e.destination.url); if (e.destination.url != newURL) { e.preventDefault(); if (newURL == window.location.href) return; this.updateLocation(newURL); } }); window.addEventListener("click", (e) => this.anchorClick(e)); window.addEventListener("contextmenu", (e) => this.anchorClick(e)); document.addEventListener("DOMContentLoaded", () => { this.location(); this.anchor(document.querySelectorAll("a")); }, { once: true }); } /** 净化url */ clear(str) { const url = new URL2(str); if (url && !str.includes("passport.bilibili.com")) { const params = url.params; if (params.bvid) { params.aid = abv(params.bvid); } if (params.aid && !Number(params.aid)) { params.aid = abv(params.aid); } paramsSet.forEach((d) => { delete params[d]; }); paramArr.forEach((d) => { if (params[d[0]]) { if (d[1].includes(params[d[0]])) { delete params[d[0]]; } } }); url.base = BV2avAll(url.base); url.hash && (url.hash = BV2avAll(url.hash)); return url.toJSON(); } else return str; } /** 净化URL */ location() { this.updateLocation(this.clear(location.href)); } /** 更新URL而不触发重定向 */ updateLocation(url) { const Url = new self.URL(url); if (Url.host === location.host) { window.history.replaceState(window.history.state, "", url); } } /** 点击回调 */ anchorClick(e) { var f = e.target; for (; f && "A" !== f.tagName; ) { f = f.parentNode; } if ("A" !== f?.tagName) { return; } this.anchor([f]); } /** 净化a标签 */ anchor(list) { list.forEach((d) => { if (!d.href) return; d.href = this.clear(d.href); }); } }; // src/core/userstatus.ts var userStatus = { /** 开发者模式 */ development: true, /** 主页 */ index: true, /** toastr */ toast: Toastconfig, /** 替换全局顶栏 */ header: true, /** 翻页评论区 */ comment: true, /** av */ av: true, /** 嵌入式播放器 */ player: true, /** WebRTC */ webRTC: false, /** 充电鸣谢 */ elecShow: true, /** 合作UP */ staff: false, /** bangumi */ bangumi: true, /** 解除限制 */ videoLimit: { /** 开关 */ status: false, /** 服务器类型 */ server: "内置", /** 东南亚(泰区)代理服务器 */ th: "api.global.bilibili.com", /** 台湾代理服务器 */ tw: "", /** 香港代理服务器 */ hk: "", /** 大陆代理服务器 */ cn: "" }, /** UPOS替换 */ uposReplace: { /** 东南亚(泰区) */ th: "ks3(金山)", /** 港澳台 */ gat: "不替换", /** 一般视频 */ nor: "不替换", /** 下载 */ download: "不替换" }, /** 强制显示bangumi分p */ bangumiEplist: false, /** 账户授权 */ accessKey: { /** access_key */ token: void 0, /** 授权日期 */ date: 0, /** 授权日期字符串 */ dateStr: "" }, /** 稍后再看 */ watchlater: true, /** 播单 */ playlist: true, /** 全站排行榜 */ ranking: true, /** 专栏 */ read: true, /** 搜索 */ search: true, /** 相簿 */ album: true, /** 注册时间 */ jointime: false, /** 失效视频 */ lostVideo: true, /** 纯视频历史 */ history: true, /** 动态里的直播录屏 */ liveRecord: false, /** 设置入口样式 */ uiEntryType: UiEntryType, /** 自动化操作 */ automate: { /** 展开弹幕列表 */ danmakuFirst: false, /** 滚动到播放器 */ showBofqi: false, /** 自动宽屏 */ screenWide: false, /** 自动关弹幕 */ noDanmaku: false, /** 自动播放 */ autoPlay: false, /** 自动网页全屏 */ webFullScreen: false, /** 记忆播放速率 */ videospeed: false }, /** 关闭抗锯齿 */ videoDisableAA: false, /** 禁用直播间挂机检测 */ disableSleepChcek: true, /** 禁止上报 */ disableReport: true, /** 禁用评论跳转标题 */ commentJumpUrlTitle: false, /** 合集 */ ugcSection: false, /** 请求的文件类型 */ downloadType: ["mp4"], /** 请求无水印源 */ TVresource: false, /** 画质 */ downloadQn: 127, /** 下载方式 */ downloadMethod: "浏览器", /** User-Agent */ userAgent: "Bilibili Freedoooooom/MarkII", /** referer */ referer: "https://www.bilibili.com", /** 下载目录 */ filepath: "", /** aria2 */ aria2: { /** 服务器 */ server: "http://localhost", /** 端口 */ port: 6800, /** 令牌 */ token: "", /** 分片数目 */ split: 4, /** 分片大小 */ size: 20 }, ef2: { /** 稍后下载 */ delay: false, /** 静默下载 */ silence: false }, /** 点赞功能 */ like: false, /** 重构播放器脚本 */ bilibiliplayer: true, /** 检查播放器脚本更新 */ checkUpdate: true, /** 不登录1080P支持 */ show1080p: false, /** 调整顶栏banner样式 */ fullBannerCover: false, /** 原生播放器新版弹幕 */ dmproto: true, /** 普权弹幕换行 */ dmwrap: true, /** 弹幕格式 */ dmExtension: "xml", /** 合并已有弹幕 */ dmContact: false, /** 分集数据 */ episodeData: false, /** 港澳台新番时间表 */ timeLine: false, /** 字幕:繁 -> 简 */ simpleChinese: true }; // src/core/user.ts var User = class { constructor(BLOD2) { this.BLOD = BLOD2; this.BLOD.GM.getValue("userStatus", userStatus).then((status) => { status = Object.assign(userStatus, status); const proxy = propertryChangeHook(status, (key, value) => { clearTimeout(this.timer); this.timer = setTimeout(() => this.BLOD.GM.setValue("userStatus", status)); this.emitChange(key, value); }); this.userStatus = proxy; this.initialized = true; while (this.BLOD.userLoadedCallbacks.length) { this.BLOD.userLoadedCallbacks.shift()?.(this.userStatus); } }); } /** 用户数据,不应直接使用,请使用\`addCallback\`用户数据回调代替 */ userStatus; /** 初始化标记 */ initialized = false; /** 更新CD */ updating; /** 回调栈 */ changes = {}; timer; /** * 监听设置改动 * @param key 设置键 * @param callback 设置项变动时执行的回调,新值将作为第一个参数传入 * @returns 用于取消监听的回调 */ bindChange(key, callback) { this.changes[key] || (this.changes[key] = []); const id = this.changes[key].push(callback); return () => { delete this.changes[key][id - 1]; }; } /** * 推送设置改动 * @param key 设置键 * @param newValue 新值 */ emitChange(key, newValue) { this.changes[key].forEach(async (d) => { d(newValue); }); } /** 用户数据回调 */ addCallback(callback) { if (typeof callback === "function") { if (this.initialized) { callback(this.userStatus); } else { this.BLOD.userLoadedCallbacks.push(callback); } } } /** 恢复默认数据 */ restoreUserStatus() { this.BLOD.GM.deleteValue("userStatus"); this.BLOD.toast.warning("已恢复默认设置数据,请刷新页面以避免数据紊乱!"); } /** 备份设置数据 */ outputUserStatus() { this.BLOD.GM.getValue("userStatus", userStatus).then((d) => { saveAs(JSON.stringify(d, void 0, " "), \`Bilibili-Old-\${timeFormat(void 0, true).replace(/ |:/g, (d2) => "-")}\`, "application/json"); }); } /** 恢复备份数据 */ inputUserStatus() { const msg = ["请选择一个备份的数据文件(.json)", "注意:无效的数据文件可能导致异常!"]; const toast = this.BLOD.toast.toast(0, "warning", ...msg); fileRead("application/json").then((d) => { if (d && d[0]) { msg.push(\`读取文件:\${d[0].name}\`); toast.data = msg; toast.type = "info"; return readAs(d[0]).then((d2) => { const data = JSON.parse(d2); if (typeof data === "object") { this.BLOD.GM.setValue("userStatus", data); const text = "已恢复设置数据,请刷新页面以避免数据紊乱!"; msg.push(text); toast.data = msg; toast.type = "success"; return alert(text, "刷新页面", [{ text: "刷新", callback: () => location.reload() }]); } }).catch((e) => { msg.push("读取文件出错!", e); toast.data = msg; toast.type = "error"; debug.error("恢复设置数据", e); }); } }).catch((e) => { msg.push(e); toast.data = msg; }).finally(() => { toast.delay = 4; }); } }; // src/core/video-info.ts var VideoInfo = class { constructor(BLOD2) { this.BLOD = BLOD2; } cids = {}; stats = {}; get metadata() { const cid = this.BLOD.cid; return cid ? this.cids[cid] : void 0; } get album() { return this.metadata?.album || this.title; } get artist() { return this.metadata?.artist; } get title() { return this.metadata?.title || document.title.slice(0, -26); } get artwork() { return this.metadata?.artwork; } get stat() { const aid = this.BLOD.aid; return aid ? this.stats[aid] : void 0; } /** 数据变动回调栈 */ callbacks = []; /** * 数据变动回调 * @param callback 数据变动时执行的回调函数 * @returns 撤销监听的函数 */ bindChange(callback) { const id = this.callbacks.push(callback); return () => { delete this.callbacks[id - 1]; }; } timer; /** 推送数据变动 */ emitChange() { clearTimeout(this.timer); this.timer = setTimeout(() => this.callbacks.forEach((d) => d(this)), 100); } /** 从\`IAidDatail\`中提取 */ aidDatail(data) { const album = data.title; const artist = data.owner.name; const pic = data.pic.replace("http:", ""); data.pages ? data.pages.forEach((d, i) => { this.cids[d.cid] = { album, artist, title: d.part || \`#\${i + 1}\`, artwork: [{ src: pic }] }; }) : this.cids[data.cid] = { album, artist, title: \`#1\`, artwork: [{ src: pic }] }; this.stats[data.aid] = data.stat; this.emitChange(); } /** 从\`IAidInfo\`中提取 */ aidInfo(data) { const album = data.title; const artist = data.upper.name; const pic = data.cover.replace("http:", ""); data.pages ? data.pages.forEach((d, i) => { this.cids[d.id] = { album, artist, title: d.title || \`#\${i + 1}\`, artwork: [{ src: pic }] }; }) : this.cids[data.id] = { album, artist, title: \`#1\`, artwork: [{ src: pic }] }; } /** 从\`IBangumiSeasonResponse\`中提取 */ bangumiSeason(data) { const album = data.title || data.jp_title; const artist = data.actors || data.staff || data.up_info?.name; const pic = data.cover.replace("http:", ""); const bkg_cover = data.bkg_cover?.replace("http:", ""); this.bangumiEpisode(data.episodes, album, artist, pic, bkg_cover); this.emitChange(); } /** 从\`IBangumiEpisode\`中提取 */ bangumiEpisode(data, album, artist, pic, bkg_cover) { data.forEach((d) => { const artwork = [{ src: d.cover.replace("http:", "") }, { src: pic }]; bkg_cover && artwork.push({ src: bkg_cover }); this.cids[d.cid] = { album, artist, title: d.index_title, artwork }; }); } toview(data) { const album = data.name; const pic = data.cover.replace("http:", ""); data.list.forEach((d) => { const title = d.title; const cover = d.pic.replace("http:", ""); const artist = d.owner.name; d.pages.forEach((d2, i) => { this.cids[d2.cid] = { album, artist, title: title + \`(\${d2.part})\`, artwork: [{ src: pic }, { src: cover }] }; }); }); this.emitChange(); } /** 设置浏览器媒体信息 */ mediaSession() { if (this.metadata) { navigator.mediaSession.metadata = new MediaMetadata({ ...this.metadata }); } } }; // src/core/webrtc.ts var WebTRC = class { static disable() { navigator.getUserMedia = void 0; window.MediaStreamTrack = void 0; window.RTCPeerConnection = void 0; window.RTCSessionDescription = void 0; navigator.mozGetUserMedia = void 0; window.mozMediaStreamTrack = void 0; window.mozRTCPeerConnection = void 0; window.mozRTCSessionDescription = void 0; navigator.webkitGetUserMedia = void 0; window.webkitMediaStreamTrack = void 0; window.webkitRTCPeerConnection = void 0; window.webkitRTCSessionDescription = void 0; } }; // src/html/index.html var html_default = '\\r\\n\\r\\n\\r\\n\\r\\n \\r\\n 哔哩哔哩 (゜-゜)つロ 干杯~-bilibili\\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n\\r\\n\\r\\n\\r\\n
      \\r\\n
      \\r\\n \\r\\n