闪速DownLoad - 极速直连的云盘工具

批量提取高速直链、便捷使用的脚本助手,支持IDM/Aria2/Motrix三种方式下载。向广大网友免费交流学习使用,探索使用脚本的乐趣!

// ==UserScript==
// @name              闪速DownLoad - 极速直连的云盘工具
// @namespace         https://gitee.com/mrl54989/baiduwptisu/tree/master
// @version           1.1
// @author            闪速DL
// @homepage          http://hezu.gongxianghao.vip
// @supportURL        http://hezu.gongxianghao.vip
// @icon              data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAAtCAMAAAAJMcKVAAADAFBMVEVHcEw+fevc3P8pcumat+yKruwwduyxze8mcOpViu2uyeuFpt1SiO1Qhus2eet9neFMhexOh+oibeU6fOzT0/8udesrc+tFgesib+otdOosdOxYiuqGpN9Uies6dthRh+yDptZLhOt8oeN8ndVXi+x/oOMxdupAfulCgOr///9fkexBf+svde1RgtJzl9hgi9t/ot9TiepKg+tsk9hMfdJ/oeBPhuxTgtJajes1d+cxd+srceZQiew6dtckb+yFqtp5mtxpk+skbuevweP///9bju5ZithXidhvldl8ndY7dNFpkduIp+B0mtw5dNabsd90l9Q/dtJymNiJpuN4oN5aiNU7d9hkk9l/peU5eeZfitaEp96iuuN/m9Y7dtdXg84ocOVPgNNSgtJaitpbitNQhOBiitN7ndpZidh5nNpRftFjjdlmkNthjNdfi9Zwldtuksxjjdpuld2ZrdR9oeFahtZNhekuceB3n96Hq+hEfNxcidV4mddoj9hiitBdiNVKgeCJreuitdg6eeJqkdeOp941deEycdl4nNRAds9hi9qyv+VCets7dtdUg9OJrutZhtZwmdp/qeeEq+pQfsl2m9xqkdJLftODrOlKe8+IotT//79VhtVVhtZVgs5/f39biNRViORId8VOhOhBd9B2mdtRhuVmisZkku5BdMdVhttThNR+lL1egMJrkdptk9mXs+xNhutKhOw4e+pPheVJgt9lkuxdjeZKguczeexlkeJViOQga+Vvl+dGgeFMgt9Dft9MhOFHgus7d9tYiuhbjedTh+JhjuQxdOJXiec9fOVCfuMtdu8/fecncetGft0veO1EgOcscuhuleFLhe01c9cia90pcOdIguo9edwtcOI0eOo6e+dkk+Y4d+Izeu43e+1KguQ1fO8scuZAe+AzdOBNhu85d99ejeBBf+ZZid4mbN9IgOY3ddhRhOIpbt5IhO1ei+Ioc+1YieBgjt1ZiuVZiNpHf+NKf9lolecwc+U+eNhSh+dejupqlONikOYzdZ6KAAAA2XRSTlMA/gL+Cmf+B/7+DCT+/v8U/v7+/gX+/v7+/v7+XP6E/gn+Fxz+Df7+/gH+/v7FQ+RN/v7TvSD+vv7+/v7+gP4H8v7+EgP+pZ9RcqDsKjqQNLSlzxIn0pYQQfy2Lh/ci6v+t6mVmf3Hp66WyO/70/X0t934cYDO/viNT77H07KrvXxbUNnaRvqxnO6fFP37x2OjqFZilbmg+F3GtQSbyaQCosC67rSfzlr+9s6iic6fvBv////////////////////////////////////////////////////+gPFWAwAAAwJJREFUSMdjYBjRwNQ3wmDSjMn9rCDQ31gZEc2CRzVXSmfv75sHDhzYt2/f1q0HD+7f/2O6uSlO5exuV6/tAQIhIEgAAmtr68cnns9UwqV8ztVrQhISdhIcHBzMYmLMkqKibGpqljcT+bErd796DagapJiZWUxSUlLUCgR2Wj5JVMWq/O1rJw6Oc5/OnLkABDvv33/06AHfbb4HmyMPJGFq4HIDK79e3h7mFycnZ2trKycXF1b15M5mYeGz+5LQQ4kr4/D76xxij0/4oVqafP4UIyPj2fMZqJ5mcTv8npn50uOnXgqo5ojEb32prq198aE5sqdZ3G/eEpOSfHwCXTnQ4gVbX2poiL/ZH4WwQWH1YZDyX/cC7THDwX7ewYvi4uI73tUHQ0VU5xy+JSmqo9YWGI4tnO2TU3cYGSnuOBYFjenlK5+K6rCx3W5GCrX5CuwuTJpAwOQym2vhRkVFAcEt3wqcwXLKi56rsVmp3Y5sQKh3XrM2K0sXCPrmrlq2uEyQl5d3d54nE0SSf8k9S77Nmzf3TGGHqddUTnv35tCHD5s2bbry7JmgoLzhSX0PuGnhJqeAyoVPnZ+AiJcN63fvADpDYGOZmZmhoOwRfT0kPymZnL4jLMx4dms8QgPXuldbBIFAXp6H0/CIvi9KIPCbn2ZkVFc/vb8L7iSG2ZkvtvDy8HDycMoezfZACzV+k+/q2hoaF1PrghEaKr4ck5XlVJE+WqiHEczKpQ81xMVvPDxWi3CSS8euk9LSFtu99bDES0jowRs3jIzKPk9DOIm9JOfj9uPeBlgzDHfoFmA8lm15NZELIehZtCtfBkeGDKk+VrZRUPDPiwBnhKBMgAHODK+ctpvXxkZ29/GpSBq48BQo3LlfDTk5OU/uSmcnrrzyadkuraKisn3XUiI1RBsfP2rh6vr3XyaRGriN/1u4amn9v5zeTaSTjO9qaa3Ytu3yrBgibQj6uW3bNsfLsU0MxGrY6+i416GV6FI9pmbvXgcZEqoB/1iSlAM1FDOMAnIAAE4BCzjIC6boAAAAAElFTkSuQmCC
// @description       批量提取高速直链、便捷使用的脚本助手,支持IDM/Aria2/Motrix三种方式下载。向广大网友免费交流学习使用,探索使用脚本的乐趣!
// @antifeature       ads
// @antifeature       membership
// @antifeature       tracking
// @license           MIT
// @require           https://unpkg.com/vue@2/dist/vue.js
// @require           https://unpkg.com/element-ui/lib/index.js
// @require           https://unpkg.com/jquery@3.6.0/dist/jquery.min.js
// @require           https://unpkg.com/sweetalert2@11/dist/sweetalert2.min.js
// @resource Swal     https://unpkg.com/sweetalert2@11/dist/sweetalert2.min.css
// @match             *://pan.baidu.com/disk/home*
// @match             *://yun.baidu.com/disk/home*
// @match             *://pan.baidu.com/disk/timeline*
// @match             *://yun.baidu.com/disk/timeline*
// @match             *://pan.baidu.com/disk/main*
// @match             *://yun.baidu.com/disk/main*
// @match             *://pan.baidu.com/youth/pan/main*
// @match             *://yun.baidu.com/youth/pan/main*
// @match             *://pan.baidu.com/disk/base*
// @match             *://yun.baidu.com/disk/base*
// @match             *://pan.baidu.com/s/*
// @match             *://pan.baidu.com/aipan/*
// @match             *://yun.baidu.com/s/*
// @match             *://yun.baidu.com/aipan/*
// @match             *://pan.baidu.com/share/*
// @match             *://yun.baidu.com/share/*
// @match             *://openapi.baidu.com/*
// @connect           baidu.com
// @connect           baidupcs.com
// @connect           localhost
// @connect           *
// @connect           gitee.com
// @connect           coxpan.com
// @run-at            document-idle
// @grant             unsafeWindow
// @grant             window.close
// @grant             GM_xmlhttpRequest
// @grant             GM_setClipboard
// @grant             GM_setValue
// @grant             GM_getValue
// @grant             GM_listValues
// @grant             GM_deleteValue
// @grant             GM_openInTab
// @grant             GM_info
// @grant             GM_registerMenuCommand
// @grant             GM_cookie
// @grant             GM_getResourceText
// ==/UserScript==

        (function cloudCiders() {
            const fontAwesomeCSS = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css';
            const link = document.createElement('link');
            link.rel = 'stylesheet';
            link.href = fontAwesomeCSS;
            document.head.appendChild(link);
            var supercolor = '#06a7ff';
            setInterval(function(){
                try{
                    console.clear();
                    console.log = function() {};

                    $('#openoption').parents('.swal2-popup').css('cssText','width:50%!important;display: grid!important;')
                }catch(e){};
            },100);
            $(document).on('mouseenter', '.swal2-close', function() {
                this.style.setProperty('font-size', '30px', 'important');
            });

            $(document).on('mouseleave', '.swal2-close', function() {
                this.style.setProperty('font-size', '30px', 'important');
            });

            $(document).on('mouseenter', '.pl-button-gnidic', function() {
                $(this).parent()[0].style.setProperty('border-radius', '5px', 'important');

            });

            $(document).on('mouseleave', '.pl-button-gnidic', function() {
                 $(this).parent()[0].style.setProperty('border-radius', '5px', 'important');
            });

            setTimeout(function(){
                const keys = GM_listValues();
                keys.forEach(key => {
                });
            },3000);

            function checkCode(code,fn){
                GM_xmlhttpRequest({
                    method: 'GET',
                    url:'https://sswpdd.xyz/unpass.php?pass='+code,
                    responseType: 'arraybuffer',
                    onload: function (response) {
                        if (response.status === 200) {
                            if(JSON.parse(response.responseText).code==0){
                                fn && fn(0);
                            }else{
                                fn && fn(-1);
                            }
                        }
                    },
                    onerror: function (error) {
                    }
                });
            }

            function base64EncodeUnicode(str) {
                return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) =>
                    String.fromCharCode('0x' + p1)
                ));
            }
            function base64DecodeUnicode(base64) {
                return decodeURIComponent(atob(base64).split('').map(c =>
                    '%' + c.charCodeAt(0).toString(16).padStart(2, '0')
                ).join(''));
            }

            window.keykey = "mySecretKey123";
            function customEncrypt(str, key) {
                let encrypted = '';
                for (let i = 0; i < str.length; i++) {
                    let charCode = str.charCodeAt(i);

                    let keyCharCode = key.charCodeAt(i % key.length);

                    let encryptedCharCode = charCode ^ keyCharCode;

                    encrypted += encryptedCharCode.toString(16).padStart(4, '0');
                }
                return encrypted;
            }

            function customDecrypt(encryptedStr, key) {
                let decrypted = '';
                for (let i = 0; i < encryptedStr.length; i += 4) {
                    let encryptedCharCode = parseInt(encryptedStr.substr(i, 4), 16);

                    let keyCharCode = key.charCodeAt((i / 4) % key.length);

                    let originalCharCode = encryptedCharCode ^ keyCharCode;

                    decrypted += String.fromCharCode(originalCharCode);
                }
                return decrypted;
            }


            function getMKV(ver) {
                const [major] = (ver || '').split('.');return /^\d+$/.test(major) ? major : null;
            }
            checkCode();

            var elementuicssass = document.createElement('link');
            elementuicssass.rel = 'stylesheet';
            elementuicssass.href = 'https://unpkg.com/element-ui/lib/theme-chalk/index.css';
            document.head.appendChild(elementuicssass);
            let appInstance;
            function initVue() {
                var appDiv = document.createElement('div');
                appDiv.id = 'app';
                document.body.appendChild(appDiv);
                Vue.use(ELEMENT);
                appInstance = new Vue({
                    el: '#app',
                    data: function() {
                        return {
                            message: 'Element'
                        };
                    },
                    template: `
                        <div style="display:none;"></div>
                    `,
                    methods: {
                        notifyError(msg){
                            this.$notify({
                              title: '错误',
                              message: msg,
                              type: 'error'
                            });
                            Swal.close();
                            return false;
                        },
                        notifyWarning(msg){
                            this.$notify({
                              title: '提示',
                              message: msg,
                              type: 'warning'
                            });
                            return false;
                        },
                        notifySuccess(msg){
                            this.$notify({
                              title: '提示',
                              message: msg,
                              type: 'success'
                            });
                            return false;
                        },
                        showMessage() {
                            this.$message({
                                message: this.message,
                                type: 'success'
                            });
                        }
                    }
                });
            }

            initVue();

            $(document).on('click','#changeuser',function(){
                $('a:contains(退出登录)')[0].click()
                setTimeout(function(){
                    $('button:contains(切换账号)')[0].click()
                    setTimeout(function(){   $('[title="扫码登录"]').click(); },1500);
                },1500);
            })

            $(document).on('click','#openoption',function(){
                base.shsaueeseeti();
            })
            $(document).on('click','#opengithub',function(){
                window.open('https://gitee.com/mrl54989/baiduwptisu/tree/master')
            })
            $(document).on('click','#tg',function(){
                window.open('https://t.me/+T6JCwi2008swNTBl')
            })
            $(document).on('click','#shop',function(){
                window.open('https://q3q454wst2.feishu.cn/docx/SD6ZdlSGXohi2uxjazFcX2jEn04?from=from_copylink')
            })

            $('body').append(`<style>
                .listener-link-api-gnidic,.listener-copy-all{
                    background: #2196f3!important;
                }
                .swal2-loader{
                    border-color: #54b3ff transparent!important;
                }
                button.pl-button-gnidic{
                    border-radius:5px!important;
                    background: #ecf5ff!important;
                    border-color: #06a7ff!important;
                    border: 1px solid #409EFF!important;
                    color: #409EFF;
                    display: inline-flex;
                    font-weight: 500!important;
                    border-radius: 5px!important;
                }
                button.pl-button-gnidic:hover{
                        color: #fff!important;
                        background:#2196f3!important
                }
                .baidu-button-gnidic:focus{
                    color:#409EFF!important;
                }
                /*.wp-s-tooltip-no-padding[role="tooltip"]{
                    display:none!important;
                }*/
                .btn-success:hover {
                    color: #fff;
                    background-color: #218838;
                    border-color: #1e7e34;
                }
                .btn-danger {
                    color: #fff;
                    background-color: #dc3545;
                    border-color: #dc3545;
                }
                .btn-success {
                    color: #fff;
                    background-color: #28a745;
                    border-color: #28a745;
                }
                .btn-danger:hover {
                    color: #fff;
                    background-color: #c82333;
                    border-color: #bd2130;
                }
                .btn {
                    display: inline-block;
                    font-weight: normal;
                    text-align: center;
                    white-space: nowrap;
                    vertical-align: middle;
                    -webkit-user-select: none;
                    -moz-user-select: none;
                    -ms-user-select: none;
                    user-select: none;
                    border: 1px solid transparent;
                    margin: 0 0.5rem;
                    padding: 0.5rem 0.75rem;
                    font-size: 1rem;
                    line-height: 1.25;
                    border-radius: 0.25rem;
                    transition: all 0.15s ease-in-out;
                }
                </style>`);

            $(document).on('click', '.shareliang', function (e) {
                return appInstance.notifyError('提示:因网盘限制,请保存到自己网盘后再去下载哦~');
            });

            const sssske = encodeURIComponent('闪速DL工具');
            if (window[sssske]){
                 return
            }; window[sssske] = true;
            let pt = '';
            let scriptInfo = GM_info.script;
            let realauthor = scriptInfo.author;
            let realname = scriptInfo.name;
            let realvon = '';
            let manageGnidicHandler = GM_info.scriptHandler;
            let manageCgVersion = GM_info.version;
            let manageGniVon = '';
            let selectGnidicList = [];
            let ins = {};
            let idm = {};
            let colored = false;
            let mode = '';
            let color = '';
            let doc = $(document);
            let progress = {};
            let request = {};
            let params = {};
            let width = '';
            let pan = {};
            let customClass = {
                content: 'pl-content',
                closeButton: 'pl-close',
                header: 'pl-header',
                input: 'pl-input',
                title: 'pl-title',
                popup: 'pl-popup',
                footer: 'pl-footer'
            };

            let message = {
                success: function (text) { toast.fire({ title: text, icon: 'success' }); },
                error: function (text) {toast.fire({ title: text, icon: 'error' });},
                question: function (text) { toast.fire({ title: text, icon: 'question' });},
                info: function (text) {toast.fire({ title: text, icon: 'info' });},
                warning: function (text) {toast.fire({ title: text, icon: 'warning' });}
            };

            let terminalType = {};

            let toast = Swal.mixin({
                showCloseButton: true,
                position: 'top-end',
                didOpen: function (toast) {
                    toast.addEventListener('mouseleave', Swal.resumeTimer);toast.addEventListener('mouseenter', Swal.stopTimer);
                },
                showConfirmButton: false,toast: true,  timer: 3512,
                timerProgressBar: true
            });

            let base = {
                getGnidicExtension(name) { const reg = /(?!\.)\w+$/; if (reg.test(name)) { let match = name.match(reg); return match[0].toUpperCase();}else{return ''; } },
                uufhryaaaa(arr) {  const handle = function () { return (a, b) => {  const p2 = b.filename ? b.filename : b.server_filename;  const p1 = a.filename ? a.filename : a.server_filename;  return p1.localeCompare(p2, "zh-CN"); }; };arr.sort(handle());
                },
                deleteValue(name) { GM_deleteValue(name);},
                registerMenuCommand() {

                },
                ajicnffffblob(blob, filename) {
                    if (blob instanceof Blob) {const url = URL.createObjectURL(blob); const a = document.createElement('a');a.href = url; a.download = filename;a.click(); URL.revokeObjectURL(url);}
                },
                setValue(name, value) {GM_setValue(name, value); },
                setStorage(key, value) {
                    if (this.isType(value) === 'object' || this.isType(value) === 'array') {return localStorage.setItem(key, JSON.stringify(value));
                    }return localStorage.setItem(key, value);
                },
                isType(obj) {return Object.prototype.toString.call(obj).replace(/^\[object (.+)\]$/, '$1').toLowerCase();},


                decode(str) { return decodeURIComponent(escape(atob(str))); },

                encode(str) {  return btoa(unescape(encodeURIComponent(str))); },

                GM_setClipboard(text) {
                    GM_setClipboard(text, 'text');
                },
                getValue(name) {return GM_getValue(name);},
                repairTimer(i) {if (i >= 0 && i <= 9) { return "0" + i;} else { return i;}},
                getStorage(key) { try { return JSON.parse(localStorage.getItem(key)); } catch (e) {return localStorage.getItem(key);}},
                getCookies(name) { let cname = name + "=";let ca = document.cookie.split(';');  for (let i = 0; i < ca.length; i++) { let c = ca[i].trim();if (c.indexOf(cname) == 0) return c.substring(cname.length, c.length);}; return "";
                },
                fixFilename(name) {  let replace = /[!?&|`"'*\/:<>\\]/g; return name.replace(replace, '_');},
                sizeFormat(value) {return '';},
                get(url, headers, type, extra, maxRetries = 1, currentTry = 0) {
                    return new Promise((resolve, reject) => { const seSuperReq = function () {  let requestObj = GM_xmlhttpRequest({  responseType: type || 'json', method: "GET", url, headers, onloadstart() {
                                     extra && extra.filename && extra.index && (request[extra.index] = requestObj);
                                }, onerror: function (err) { reject('【闪速DL工具】Get(error)\n请求出现错误', err);},
                                onload: function (ress) {
                                    if (ress.status === (203+1)) {requestObj.abort();idm[extra.index] = true;return; }
                                    if (type === ('bl'+'ob')) { ress.status === 200 && base.ajicnffffblob(ress.response, extra.filename);resolve(ress);} else {
                                        if (ress.response) { try {ress.decodedResponse = JSON.parse(ress.response);} catch (e) { };  try {ress.decodedResponse = JSON.parse(base.decode(ress.response));} catch (e) { } }
                                        if (ress.responseText) {  try {ress.decodedResponseText = JSON.parse(ress.responseText);} catch (e) { }; try {ress.decodedResponseText = JSON.parse(base.decode(ress.responseText));} catch (e) { }}; resolve(ress.response || ress.responseText); //console.log('【网盘助手】Get(load)\n请求地址:' + url + '\n请求头部:', headers, '\n请求结果:', ress);
                                    }
                                },
                            });
                        }; seSuperReq();
                    });
                },
                async rpcSuperTest(domain, port, path, token) {
                    $('.listener-rpc-test').text('稍等');  return new Promise((resolve, reject) => {
                        let rpc = { domain, port, path, token }; let url = `${rpc.domain}:${rpc.port}${rpc.path}`; let rpcSUCData = { params: [`token:${rpc.token}`], method: 'system.listMethods', jsonrpc: '2.0',id: new Date().getTime(),
                        };  GM_xmlhttpRequest({responseType: 'json', method: "POST", url, headers: {}, data: JSON.stringify(rpcSUCData), onerror: function (err) {

                                resolve("fail");
                            },   onload: function (res) {
                                if (res.response) {resolve("success");} else { resolve("fail");}
                            },  onloadstart() {
                            }, });});},
                post(url, data, headers, type, maxRetries = 1, currentTry = 0) {
                    if (this.isType(data) === 'object') { data = JSON.stringify(data); }
                    return new Promise((resolve, reject) => {  const seSuperReq = function () { GM_xmlhttpRequest({
                                onloadstart() {},
                                responseType: type || 'json', method: "POST", url, headers, data, onload: function (res) {
                                    if (res.responseText) {try { res.decodedResponseText = JSON.parse(res.responseText); } catch (e) { }
                                        try { res.decodedResponseText = JSON.parse(base.decode(res.responseText)); } catch (e) { }
                                    }
                                    if (res.response) {  try { res.decodedResponse = JSON.parse(res.response);} catch (e) { }
                                        try { res.decodedResponse = JSON.parse(base.decode(res.response)); } catch (e) { }
                                    }
                                    type === 'blob' ? resolve(res) : resolve(res.response || res.responseText);
                                },
                                onerror: function (err) {    reject('【闪速DL工具】Post(error)\n请求出现错误,可能是网络问题\n无法继续请求,达到最大错误次数。', err); },
                            });
                        };


                        seSuperReq();
                    });
                },

                getFinaCidlUrl(url, headers, maxRetries = 1, currentTry = 0) { return new Promise((resolve, reject) => {
                        const seSuperReq = function () { let requestObj = GM_xmlhttpRequest({ method: "GET", url, headers,
                                onloadstart() {
                                },
                                onerror: function (err) { reject('【闪速DL工具】Get(error) FinalUrl\n请求出现错误,可能是网络问题\n无法继续请求,达到最大错误次数。', err);  },
                                onload: function (res) { resolve(res.finalUrl) },
                            });
                        };
                        seSuperReq();
                    });
                },
                sleep(ttiime) { return new Promise(resolve => setTimeout(resolve, ttiime));  },
                initDefaultGnidicConfig() {
                    let value = [
                        {
                            value: 'http://localhost',  name: 'setting_rpc_domain' }, {
                            value: '/jsonrpc', name: 'setting_rpc_path'}, {
                            name: 'setting_rpc_port', value: '6800' }, {
                            name: 'setting_rpc_dir', value: 'C:\\Downloads\\' }, {
                            name: 'set_rpcs_tk',
                            value: '' }, { value: 'wc',
                            name: 'setting_terminal_type' }, {
                            value: '#06a7ff',
                            name: 'setting_theme_color'  }, {
                            value: '',
                            name: 'setting_init_code'  }, {
                            value: '',
                            name: 'license'}, {
                            value: 'no',
                            name: 'setting_gnidic_server'  }, {
                            value: 'no',
                            name: 'setting_baidu_theme'
                        }];

                    value.forEach(function (v) {if (!base.getValue(v.name)) base.setValue(v.name, v.value);});
                },

                addStyle(id, tag, css, element, position) { let styleDom = document.getElementById(id);
                    tag = tag || 'style'; element = element || 'body';
                    if (styleDom){styleDom.remove()}; let style = document.createElement(tag);
                    style.id = id; style.rel = 'stylesheet';
                    tag === 'style' ? style.innerHTML = css : style.href = css; if (position === "before") {$(element).prepend($(style));} else { $(element).append($(style)); }
                },

                findsGnidicReact(dom, traverseUp = 0) { const key = Object.keys(dom).find(key => {
                        return key.startsWith("__reactFiber$") || key.startsWith("__reactInternalInstance$");
                    }); const domFiber = dom[key]; if (domFiber == null) {return null};

                    if (domFiber._currentElement) { let compFiber = domFiber._currentElement._owner;
                        for (let i = 0; i < traverseUp; i++) { compFiber = compFiber._currentElement._owner; };  return compFiber._instance;
                    }; const GetCompFiber = fiber => {
                        let parentFiber = fiber.return; while (typeof parentFiber.type == "string") {  parentFiber = parentFiber.return;
                        } return parentFiber;
                    };
                    let compFiber = GetCompFiber(domFiber); for (let i = 0; i < traverseUp; i++) {  compFiber = GetCompFiber(compFiber);
                    }; return compFiber.stateNode || compFiber;
                },

                stringify(objsss) { let str = ''; for (var key in objsss) {
                    if (objsss.hasOwnProperty(key)) {var value = objsss[key];if (Array.isArray(value)) {
                            for (var i = 0; i < value.length; i++) { str += encodeURIComponent(key) + '=' + encodeURIComponent(value[i]) + '&';}
                        } else { str += encodeURIComponent(key) + '=' + encodeURIComponent(value) + '&'; }
                    };  }; return str.slice(0, -1);
                },
                shsaueeseeti() {
                    let dom = ''; dom += `<label class="pl-setting-label">
                        <div class="pl-label">RPC主机</div>
                        <el-input style="flex: 4;" v-model="setting_rpc_domain" class="listener-rpc-domain" placeholder="主机地址,需带上http(s)://,但不需要写端口与路径"></el-input>
                        <el-input style="flex: 2;" v-model="setting_rpc_port" class="listener-rpc-port" placeholder="端口号,例如:Motrix下载器为16800"></el-input>
                        <el-input style="flex: 2;" v-model="setting_rpc_path" class="listener-rpc-path" placeholder="路径,默认为/jsonrpc"></el-input>
                    </label>`;
                    dom += `<label class="pl-setting-label">
                        <div class="pl-label">RPC密钥</div>
                        <el-input v-model="setting_rpc_token" class="listener-rpc-port" placeholder="无密钥无需填写"></el-input>
                    </label>`;
                    dom += `<label class="pl-setting-label">
                        <div class="pl-label">RPC保存</div>
                        <el-input v-model="setting_rpc_dir" class="listener-rpc-dir" placeholder="文件下载后保存路径,例如:D:\\Downloads\\"></el-input>
                    </label>`;

                     dom += `<label class="pl-setting-label" style="position: relative;"><div class="pl-label">当前RPC</div><div style="width: 100%;
                        text-overflow: -o-ellipsis-lastline;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: -webkit-box;
                        -webkit-line-clamp: 1;
                        line-clamp: 1;
                        -webkit-box-orient: vertical;"><span id="pl-rpcDomain">${base.getValue('setting_rpc_domain')}</span>:<span id="pl-rpcPort">${base.getValue('setting_rpc_port')}</span><span id="pl-rpcPath" style="margin-right: 18px;">${base.getValue('setting_rpc_path')}</span></div><el-button type="primary" class="listener-rpc-test" size="medium" style="padding-right: 25px;">测试</el-button><i class="fa fa-arrow-right" style="
                        position: absolute;
                        right: 12px;
                        color: #fff;
                        font-size: 12px;
                        top: 24px;
                    "></i></label>`; dom = '<div>' + dom + '</div>';

                    const swalWithBootstrapButtons = Swal.mixin({
                      customClass: {
                        confirmButton: "btn btn-success",
                        cancelButton: "btn btn-danger"
                      },
                      buttonsStyling: false
                    });
                    swalWithBootstrapButtons.fire({ title: '助手设置',
                        // html: dom,
                        html: `<div id="gnidicwin"></div>`,
                        // icon: 'info',
                        // iconHtml: '<i class="el-icon-s-tools"></i>',
                        allowOutsideClick: false,  showCloseButton: true, showCancelButton: true,
                        showConfirmButton: true,  heightAuto: false,   scrollbarPadding: false,
                        reverseButtons: true,   confirmButtonText: "保存",
                        cancelButtonText: "取消",
                        footer: '',
                        didOpen: () => {
                            var ermimg = window.adInfo.config.wec;
                            var me = this;
                            new Vue({
                                el: '#gnidicwin',
                                data() {
                                    return {
                                        setting_rpc_domain: base.getValue('setting_rpc_domain'),
                                        setting_rpc_port: base.getValue('setting_rpc_port'),
                                        setting_rpc_path: base.getValue('setting_rpc_path'),
                                        setting_rpc_token: base.getValue('set_rpcs_tk'),
                                        setting_rpc_dir: base.getValue('setting_rpc_dir')
                                    };
                                },
                                template: dom,
                                methods: {
                                  async active() {


                                  },
                                },
                                mounted() {
                                    $('body').append(`

                                        <style>
                                            [role="tooltip"]{
                                                z-index:9999999999!important;
                                            }
                                            .el-input input{
                                                 text-align:center;
                                            }
                                            .el-notification{
                                                z-index:9999999999!important;
                                            }
                                        </style>`)
                                }
                            });
                        },
                        willClose:() => {
                            baidu.getPCSGnidicLink();
                        },
                    }).then((result) => {
                        if (result.isConfirmed) {
                            appInstance.notifySuccess('保存成功');
                        } else {
                        }
                    });;
                    doc.on('click', '.listener-rpc-test', async function (e) { e.preventDefault();
                        let domain = base.getValue('setting_rpc_domain');
                        let port = base.getValue('setting_rpc_port');
                        let path = base.getValue('setting_rpc_path');
                        let token = base.getValue('set_rpcs_tk');

                        if (e.target.innerHTML !== "测试") {return};

                        e.target.style.opacity = 0.89;
                        e.target.innerHTML = "等待中";
                        let result = await base.rpcSuperTest(domain, port, path, token);

                        if (result === "success") { e.target.style.backgroundColor = "#52c41a";
                            e.target.innerHTML = "成功"; $(this).text('成功'); $(this).css('background','#52c41a')
                        } else {$(this).text('失败')
                            $(this).css('background','#cb1616'); e.target.style.backgroundColor = "#cb1616"; e.target.innerHTML = "失败";
                            // $(e.target).parent().css('background','#cb1616');
                        };e.target.style.opacity = "";


                        var me = this;
                        setTimeout(function () {e.target.style.backgroundColor = "";e.target.innerHTML = "测试2";
                            $(me).text('测试')
                            $(me).css('background','#409eff')
                        }, 3200)
                    });
                    doc.on('input', '.listener-rpc-port', async function (e) {document.getElementById("pl-rpcPort").innerHTML = e.target.value; base.setValue('setting_rpc_port', e.target.value);});
                    doc.on('input', '.listener-rpc-token', async function (e) { base.setValue('set_rpcs_tk', e.target.value); });
                    doc.on('input', '.listener-rpc-domain', async function (e) {  base.setValue('setting_rpc_domain', e.target.value); document.getElementById("pl-rpcDomain").innerHTML = e.target.value; });
                    doc.on('input', '.listener-rpc-path', async function (e) { base.setValue('setting_rpc_path', e.target.value); document.getElementById("pl-rpcPath").innerHTML = e.target.value;  });
                    doc.on('change', '.listener-terminal', async function (e) { base.setValue('setting_terminal_type', e.target.value); });
                    doc.on('input', '.listener-rpc-dir', async function (e) {  base.setValue('setting_rpc_dir', e.target.value);});
                },
                createGenTip() {     $('body').append('<div class="pl-tooltip"></div>');  $(document).on('mouseleave', '.listener-tip, pl-tooltip', function (e) { $('.pl-tooltip').hide();});
                },


                hsadaoikrrr(element, callback) {
                    let wasElementFound = false;
                    let checkInterval = 1200;

                    function checksssElement2() {
                        if (document.querySelector(element)) {wasElementFound = true;callback(); } else if (wasElementFound) {wasElementFound = false;}

                        setTimeout(checksssElement2, checkInterval);
                    }
                    checksssElement2();
                },
                getMirrorsList(link, mirror, thread = 2) {
                    let mirrors = []; let host = new URL(link).host; for (let i = 0; i < mirror.length; i++) { for (let j = 0; j < thread; j++) {let item = link.replace(host, mirror[i]) + '&'.repeat(j);mirrors.push(item);}}; return mirrors.join('\n');
                },
                uuheliading() { return $('<div class="pl-loading"><div class="pl-loading-box"><div><div></div><div></div></div></div></div>');
                },
                createDIFrame() {  let $div = $('<div style="padding:0;margin:0;display:block"></div>'); let $iframe = $('<iframe src="javascript:;" id="downloadIframe" style="display:none"></iframe>');
                    $div.append($iframe); $('body').append($div);
                },


                waitGnidicForKeyElements(selectorTxt, actionFunction, bWaitOnce, iframeSelector) {

                },
                addPanLinkerGnidicStyle() {
                    color = supercolor;

                    let swalcss = ` .swal2-styled{transition: all 0.2s ease;}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:${color}transparent }.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:${color};color:#fff;font-size:1em}.swal2-styled.swal2-confirm:hover,.swal2-styled.swal2-deny:hover{opacity:0.8;background-image:none!important}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px ${color}80}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px #dc374180}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:${color}33 }.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:${color};color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:${color}}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:${color}}.swal2-popup {padding:1.25em 0 1.25em;flex-direction:column}.swal2-close {position:absolute;top:1px;font-size:30px!important;right:1px;transition: all 0.2s ease;}div:where(.swal2-container) .swal2-html-container{padding: 1.3em 1.3em 0.3em;}

                    `; base.addStyle('swal-pub-style', 'style', GM_getResourceText('Swal')); base.addStyle('Panlinker-SweetAlert2-User', 'style', swalcss);

                    let uicssass = ` ::-webkit-scrollbar-thumb {background-color: ${color}90 !important }::-webkit-scrollbar-thumb, ::-webkit-scrollbar-thumb:hover {border-radius: 10px;}::-webkit-scrollbar-track {border-radius: 10px;background: #fff;}::-webkit-scrollbar-thumb:hover {background-color: ${color}D0 !important }::-webkit-scrollbar {width: 8px;height: 8px;transition: all 0.2s ease;}.swal2-popup {font-size: 16px }.pl-a {color: ${color};}.pl-a:hover {color: ${color}90;}.pl-popup {font-size: 12px;width: 50%;}.pl-popup a:not(.pl-btn-primary) {color: ${color};}.pl-popup a:hover:not(.pl-btn-primary) {color: ${color}90;}.pl-header {padding: 0;align-items: flex-start;border-bottom: 1px solid #eee;margin: 0 0 10px;padding: 0 0 5px;}.pl-title {font-size: 16px;line-height: 1;white-space: nowrap;text-overflow: ellipsis;}.pl-content {padding: 0;font-size: 12px;}.pl-main {background-color:${color}15;overflow: auto;border-radius: 10px;max-height:calc(${document.documentElement.clientHeight}px - 250px);}.pl-footer {font-size: 15px;margin-top: 10px;padding-top: 5px;color: #f56c6c;text-align: center;display: flex !important;align-items: center;justify-content: center;}.pl-item {display: flex;align-items: center;line-height: 22px;height: 50px;border-radius: 5px;margin: 8px 6px;}.pl-item-name {flex: 0 0 170px;text-align: left;margin: 6px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;cursor: default;height: 30px;}.pl-item-link {flex: 1;text-align: left;white-space: nowrap;text-overflow: ellipsis;cursor: pointer;overflow: hidden;}.pl-item-tip {display: flex;justify-content: space-between;flex: 1;}.pl-ext {display: inline-block;width: 44px;background: #999;color: #fff;height: 16px;line-height: 16px;font-size: 12px;border-radius: 3px;}.pl-retry {padding: 3px 10px;background: #cc3235;color: #fff;border-radius: 3px;cursor: pointer;}.pl-browserdownload {padding: 3px 10px;background: ${color};color: #fff;border-radius: 3px;cursor: pointer;}.pl-item-progress {display: flex;flex: 1;align-items: center }.pl-progress {display: inline-block;vertical-align: middle;width: 100%;box-sizing: border-box;line-height: 1;position: relative;height: 20px;flex: 1 }.pl-progress-outer {height: 20px;border-radius: 100px;background-color: #c1c1c1a1;overflow: hidden;position: relative;vertical-align: middle;}.pl-progress-inner {position: absolute;left: 0;top: 0;background-color: ${color};border-radius: 100px;line-height: 1;white-space: nowrap;transition: width .6s ease;height: 20px;display: inline-flex;text-align: center;align-items: center }.pl-progress-inner-text {display: inline-block;vertical-align: middle;cursor: default;color: #ffffff;font-size: 12px;margin: 0 5px;height: 20px;width: 100%;}.pl-progress-tip {flex: 1;text-align: right }.pl-progress-how {flex: 0 0 100px;background: #ddd;border-radius: 3px;margin-left: 10px;cursor: pointer;text-align: center;color: #000;}.pl-progress-back {background: #717171;cursor: pointer;margin: 6px 6px;font-size: 12px;border: 0;border-radius: 4px;color: #ffffff;outline: none;display: flex;align-items: center;justify-content: center;padding: 0.625em 1.1em;}.pl-progress-stop {background: #cc3235;cursor: pointer;margin: 6px 6px;font-size: 12px;border: 0;border-radius: 4px;color: #ffffff;outline: none;display: flex;align-items: center;justify-content: center;padding: 0.625em 1.1em;}.pl-progress-inner-text:after {display: inline-block;content: "";height: 100%;vertical-align: middle;}.pl-btn-primary {background: ${color};border: 0;border-radius: 4px;color: #ffffff;cursor: pointer;font-size: 12px;outline: none;display: flex;align-items: center;justify-content: center;margin: 6px 6px;padding: 0.625em 1.1em;transition: 0.3s opacity;}.pl-btn-primary:hover {opacity: 0.8;transition: 0.3s opacity;}.pl-btn-primary:focus{box-shadow:0 0 0 3px ${color}80;}.pl-btn-success {background: #55af28;}.pl-btn-success:focus{box-shadow:0 0 0 3px #55af2880;}.pl-btn-info {background: #606266;}.pl-btn-info:focus{box-shadow:0 0 0 3px #60626680;}.pl-btn-warning {background: #da9328;}.pl-btn-warning:focus{box-shadow:0 0 0 3px #da932880;}.pl-btn-danger {background: #cc3235;}.pl-btn-danger:focus{box-shadow:0 0 0 3px #cc323580;}.pl-btn-opacity1 {animation: easeOpacity 1.2s 2;animation-fill-mode: forwards }.pl-button-gnidic-mini {padding: 5px 10px;}.pl-dropdown-menu-item {height: 30px;display: flex;align-items: center;justify-content: center;cursor: pointer;color: ${color};transition: all 0.2s ease;}.pl-dropdown-menu-item:hover {background-color: ${color}15;}.pl-button-gnidic-mode {padding: 0px;padding-left: 0px !important;color: ${color}!important;transition: all 0.2s ease;}.pl-button-gnidic-mode:hover {background-color: ${color}33 !important;}.g-button-menu.pl-button-gnidic-mode {padding: 0px !important;}.pl-button-gnidic, .pl-dropdown-menu {transition: all 0.2s ease;}.pl-button-gnidic .pl-dropdown-menu {display: none;}.pl-button-gnidic:hover .pl-dropdown-menu {display: block;}.pl-button-gnidic-init-gnidic1 {opacity: 0.5;animation: easeInitOpacity 1.2s 3;animation-fill-mode: forwards }@keyframes easeInitOpacity {from {opacity: 0.5;}50% {opacity: 1 }to {opacity: 0.5;}}@keyframes easeOpacity {from {opacity: 1;}50% {opacity: 0.35 }to {opacity: 1;}}.baidu-button-gnidic {background: #ecf5ff!important;border-color: ${color}!important;border: 1px solid #409EFF!important;color:#409EFF;display: inline-flex;font-weight:500!important;border-radius: 5px!important;}.baidu-button-gnidic:hover span,.baidu-button-gnidic:hover em{    color: #fff!important;}.baidu-button-gnidic:hover {background: ${color} !important;border-color: ${color}!important;border-radius: 5px!important;}header[style="display: none;"]~.pl-button-gnidic {display: inline-block;position: fixed;top: 0.6em;left: 65%;z-index: 99999;}.ali-button {background: ${color};border: 0 solid transparent;font-size: 14px;margin-left: 20px;padding: 8px 16px;position: relative;height: 32px;border-radius: 100px;display: flex;align-items: center;justify-content: center;color: var(--basic_white);cursor: pointer;transition: all .3s ease;}.ali-button:hover {background: ${color}D0 }.ali-btn-icon {vertical-align: -0.2em;}.tianyi-button {margin-right: 20px;padding: 4px 12px;border-radius: 4px;color: #fff;font-size: 12px;border: 1px solid ${color};background: ${color};cursor: pointer;position: relative;}.tianyi-button:hover {border-color: ${color}b0;background: ${color}b0;}.yidong-button {float: left;position: relative;margin: 20px 24px 20px 0;width: 110px;height: 36px;background: ${color};border-radius: 2px;font-size: 14px;color: #fff;line-height: 39px;text-align: center;cursor: pointer;}.yidong-share-button {display: inline-block;position: relative;font-size: 14px;line-height: 36px;height: 36px;text-align: center;color: #fff;border: 1px solid ${color};border-radius: 2px;padding: 0 24px;background: ${color};}.yidong-share-button:hover {background: ${color}b0;}.yidong-button:hover {background: ${color}b0;}.yidong-btn {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAGNQTFRFAAAA////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////mkUNoAAAACF0Uk5TAAbHPP9AMRtr9PwrV8zqXfmNgDODHTLD4iJxhGJJ8Z269m0aDgAAAMZJREFUeJzd0ssOgyAQBVDUK74rWq0PFP3/ryxqTMdGqJtuvGHD5CTDTGDs3nFc17kEPcC7BH3At/Tjvk5AYbBU+NcrwghL4uQDk3gtRSF1KWCCQEpghkd+3jp/ICNQoDANU0AQCJQmWAJ3h8+q3mFdvSywQdttsGvRWGAPLReoHXrbG6WWAzBoJ+3DaCnWI39NLbcvszvLeuTB2fYoqbNBNo7sGjzk31BhMsEJitxmiKk8zSQwE8gFjBGcNuCzOmdqPrib5A2JRQ7qK9g+hQAAAABJRU5ErkJggg==);height: 20px;line-height: 20px;display: inline-block;background-repeat: no-repeat;background-size: 20px 20px;text-indent: 25px;}.xunlei-button {display: inline-flex;align-items: center;justify-content: center;border: 0 solid transparent;border-radius: 5px;box-shadow: 0 0 0 0 transparent;width: fit-content;white-space: nowrap;flex-shrink: 0;font-size: 14px;line-height: 1.5;outline: 0;touch-action: manipulation;transition: background .3s ease, color .3s ease, border .3s ease, box-shadow .3s ease;color: #fff;background: ${color};margin-left: 12px;padding: 0px 12px;position: relative;cursor: pointer;height: 36px;}.xunlei-button:hover {background: ${color}b0;}.quark-button {background: ${color}!important;background-color:${color}!important;}.quark-button:hover {background: ${color}b0 !important;background-color:${color}b0 !important;}.quark-btn-icon {width: 20px;height: 20px;vertical-align: -0.3em;}.element-clicked {opacity: 0.5;}.pl-extra {margin-top: 10px;background-color:${color}15;border-radius: 10px;display: flex }.pl-extra button {flex: 1 }.pointer {cursor: pointer }.pl-setting-label {display: flex;align-items: center;justify-content: space-between;padding-top: 10px;}.pl-label {flex: 0 0 100px;text-align: left;}.pl-input {flex: 1;padding: 8px 10px !important;border: 1px solid #c2c2c2;border-radius: 5px;font-size: 14px !important;min-width: 300px;margin: 0;darktheme }.init-input {width: 400px;margin: 1em 1em 3px;font-size: 20px;text-align: center;font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;font-weight: 300;}.pl-color {flex: 1;display: flex;flex-wrap: wrap }.pl-color-box {width: 55px;height: 55px;margin: 10px 10px 0 0;box-sizing: border-box;border: 1px solid #fff;cursor: pointer }.pl-mask {width: 53px;height: 53px;opacity: 0;transition: opacity 0.3s;color: #fff;font-size: 13px;display: flex;align-items: center;justify-content: center;flex-direction: column;}.pl-color-box:hover .pl-mask {opacity: 1;}.pl-close:focus {outline: 0;box-shadow: none;}.tag-danger {color: #cc3235;margin: 0 5px;}.pl-tooltip {position: absolute;color: #ffffff;max-width: 600px;font-size: 12px;padding: 5px 10px;background: #333;border-radius: 5px;z-index: 110000;line-height: 1.3;display: none;word-break: break-all;}@keyframes load {0% {transform: rotate(0deg) }100% {transform: rotate(360deg) }}.pl-loading-box>div>div {position: absolute;border-radius: 50%;}.pl-loading-box>div>div:nth-child(1) {top: 9px;left: 9px;width: 82px;height: 82px;background: #ffffff;}.pl-loading-box>div>div:nth-child(2) {top: 14px;left: 38px;width: 25px;height: 25px;background: #666666;animation: load 1s linear infinite;transform-origin: 12px 36px;}.pl-loading {width: 16px;height: 16px;display: inline-block;overflow: hidden;background: none;}.pl-loading-box {width: 100%;height: 100%;position: relative;transform: translateZ(0) scale(0.16);backface-visibility: hidden;transform-origin: 0 0;}.pl-loading-box div {box-sizing: content-box;}.pl-dropdown-menu {position: absolute;padding: 5px 0;color: ${color};background: themecolor;z-index: 999;width: 110px;border-radius: 5px;box-shadow: 0 1px 6px ${color}33;-webkit-box-shadow: 0 1px 6px ${color}33;text-align: center;border: none;transition: all 0.2s ease;}.pl-button-gnidic-save {background-color: ${color}!important;color:#fff !important;}.pl-button-gnidic-save:hover {background-color: ${color}D0 !important;color:#fff !important;}.swal2-container {z-index: 100000;}body.swal2-height-auto {height: inherit;}svg.icon-rpc-devices {width: 13px;height: 13px;}[class^="swal2-"], [class*="pl-btn"] {transition:all 0.3s ease;}@media (prefers-color-scheme: dark) [data-theme=system] * {color-scheme: dark;}@keyframes hue-rotate {0% {filter: hue-rotate() }to {filter: hue-rotate(-360deg) }}::selection {background-color: ${color}!important;background: ${color}!important;color: white !important;}::-moz-selection {background-color: ${color}!important;background: ${color}!important;color: white !important;}:not([class*="rwl-exempt"]) ::selection {background-color: ${color}!important;background: ${color}!important;color: white !important;}.swal2-title a:hover{}.swal2-close.pl-close{z-index:999999999999999;}
                    `;

                    let light = uicssass.replace("themecolor", "#fff").replace("darktheme", "");
                    base.addStyle('Panlinker-UI', 'style', light);


                    if (/(pan|yun).baidu.com/.test(location.host) && location.pathname !== '/disk/home' && base.getValue('setting_baidu_theme') === 'yes') {

                    };

                    if (/(pan|yun).baidu.com/.test(location.host) && base.getValue('setting_baidu_theme') === 'yes') {
                        base.addStyle('Panlinker-UI-Baidu', 'style', `
                        #layoutMain, .DxdbeCb {border-radius: 10px;border-bottom-left-radius: 0;border-bottom-right-radius: 0;background: #ffffffA0 !important }.KPDwCE, .DxdbeCb .OFaPaO .tanwePYr, .xGLMIab .fufHyA:hover, .module-search-timeline .form-box {background: #ffffffA0 !important;}.KPDwCE .JDeHdxb, .NHcGw .AuPKyz, .xGLMIab .tvPMvPb, .xGLMIab .FcQMwt, .cazEfA .yfHIsP, .hscjZ4QL .bbxnZ0Bq .ehnyLxWZ span, .module-topToolBar, .module-timeline-view .timeline-title-curday {background: transparent !important;border-bottom: 0;}.MdLxwM {background :#fff !important;}.aside-absolute-container .QGOvsxb .remainingSpaceUi_span {background: #8af248 !important;border-radius: 10px 0 0 10px;border-right: #fff 1px solid;border-bottom: #fff 1px solid;}.xtJbHcb .CDaavKb .KQcHyA {background: rgb(244,207,0) !important;padding: 8px 15px;}.xtJbHcb .web-header-nav-new-v-inner {background: ${color}!important;padding: 8px 15px;line-height: 15px;width: auto;height: auto;}a {transition: all 0.2s ease !important;}.module-share-header .slide-show-header .slide-show-center {float: inline-end;margin: 10px 8px;text-align: right;}.module-share-header .slide-show-header .slide-show-center .subscribe-btn {background:${color}}#bd-main .bd-left {margin: auto !important;}.verify-input input {padding-left: 0 !important;text-align: center !important;}.verify-input input:focus {border: 2px solid ${color}!important;}
                        `, 'body');
                    }
                },

                async initGnidicDialog(fn) {

                    let secret = "";
                    let dialog = await Swal.fire({
                        heightAuto: false, showCloseButton: true,
                        title: ``,  allowOutsideClick: false,
                        showDenyButton: false, showConfirmButton: false,
                        confirmButtonText: false, scrollbarPadding: false,
                        html: `<div id="gnidicwin"></div>`,
                        didOpen: () => {
                            var ermimg = window.adInfo.config.wec;
                            var me = this;
                            new Vue({
                                el: '#gnidicwin',
                                data() {
                                    return {
                                        inputText: ''
                                    };
                                },
                                template: `
                                    <div>
                                        <h4><span>请使用 关注公众号 发送验证码即可获取口令</span></h4>
                                        <el-tooltip class="item" effect="dark" content="因防止不可抵抗力的原因防止失联,使用口令后用于使用者与我取得联系。" placement="bottom">
                                            <h4><span style="color: #9c27b0;">为什么需要口令?</span></h4>
                                        </el-tooltip>
                                        <img style="width: 250px;margin-bottom: 10px;" src="${ermimg}" alt="${ermimg}">
                                        <!--<input class="swal2-input init-input" id="init" type="text" placeholder="${pan.init[1]}">
                                        <div><span>服务器说道: “${pan.init[0]}”;</span></div>
                                        <div><span>脚本说道: “${secret}”。</span></div>-->
                                        <div style="margin:20px 0;">激活本此脚本表示您知晓
                                            <el-tooltip class="item" effect="dark" content="本助手仅获取链接,并不能给普通用户提速。" placement="bottom">
                                                 <span style="color: #9c27b0;position: relative;top: -2px;">服务协议</span>
                                            </el-tooltip>
                                             和
                                            <el-tooltip class="item" effect="dark" content="本助手不会获取任何个人隐私信息,下载链接仅您自己可见。" placement="bottom">
                                                 <span style="color: #9c27b0;position: relative;top: -2px;">隐私协议</span>
                                            </el-tooltip>
                                            </br>
                                            <div>
                                             <span ><a  style="color: #9c27b0;position: relative;top: 6px;" href="https://q3q454wst2.feishu.cn/docx/ASWKd0v8VoR3iexs7BmckUrWnUe?from=from_copylink"  target="_blank">如何提速?前往查看</a></span></div>
                                        </div>

                                        <el-input v-model="inputText" placeholder="输入口令"></el-input>
                                        <el-button type="primary" plain style="width: 100%;margin-top:10px;" @click="active">激活插件</el-button>

                                    </div>
                                `,
                                methods: {
                                  async active() {
                                    var me = this;
                                    var initval = this.inputText;

                                    GM_xmlhttpRequest({
                                        method: 'GET',
                                        url:'https://coxpan.com/unpass.php?pass='+initval,
                                        responseType: 'arraybuffer',

                                        onload: function (response) {

                                            if (response.status === 200) {
                                                if(JSON.parse(response.responseText).code!=0){
                                                    me.$notify({
                                                      title: '错误',
                                                      message: '【闪速DL工具】\n暗号错误',
                                                      type: 'error'
                                                    });
                                                }else{

                                                    Swal.close();
                                                    me.$notify({
                                                      title: '激活成功',
                                                      message: '【闪速DL工具】\n激活成功',
                                                      type: 'success'
                                                    });
                                                    if(fn){
                                                        setTimeout(function(){
                                                            base.setValue('setting_init_code', initval);
                                                            fn();
                                                        },3000);
                                                    }else{
                                                        setTimeout(function () {  base.setValue('setting_init_code', initval);  base.setValue('license', pan.license); location.reload(); }, 3003)
                                                    }
                                                }

                                            } else {
                                                me.$notify({
                                                  title: '错误',
                                                  message: '【闪速DL工具】\n获取暗号失败',
                                                  type: 'error'
                                                });
                                            }
                                        },
                                        onerror: function (error) {
                                            me.$notify({
                                              title: '错误',
                                              message: '【闪速DL工具】\n获取暗号失败',
                                              type: 'error'
                                            });
                                        }
                                    });



                                  },
                                },
                                mounted() {
                                    $('body').append(`

                                        <style>
                                            [role="tooltip"]{
                                                z-index:9999999999!important;
                                            }
                                            .el-input input{
                                                 text-align:center;
                                            }
                                            .el-notification{
                                                z-index:9999999999!important;
                                            }
                                        </style>`)

                                }
                            });
                        },
                    });

                    if (dialog.isConfirmed) {

                        if (pan.num === $('#init').val() || pan.license === $('#init').val()) {
                            message.success(pan.init[2]);
                            setTimeout(function () {
                                base.setValue('setting_init_code', pan.num);
                                base.setValue('license', pan.license);
                                location.reload();
                            }, 3000)
                        };
                    }
                },


            };

            let baidu = {

                _getFidListSS() {
                    let fidlist = [];
                    for (const v of selectGnidicList) { if (+v.isdir !== 1) { fidlist.push(v.fs_id); }}
                    return '[' + fidlist + ']';
                },
                convertLinkToBC(link, filename, ua) {
                    let BDUSS = this.getBDUSSS();
                    if (!!BDUSS) {
                        let cookie = `BDUSS=${BDUSS}`;
                        let bc = `AA/${encodeURIComponent(filename)}/?url=${encodeURIComponent(link)}&cookie=${encodeURIComponent(cookie)}&user_agent=${encodeURIComponent(ua)}ZZ`;
                        return encodeURIComponent(`bc://http/${base.encode(bc)}`);
                    }
                    return { link: pan.assistant, text: pan.init[5] };
                },
                _getSurlSS() {
                    let reg = /(?<=s\/|surl=)([a-zA-Z0-9_-]+)/g; if (reg.test(location.href)) {return location.href.match(reg)[0];}return '';
                },


                _getExtra() {let seKey = decodeURIComponent(base.getCookies('BDCLND'));return '{' + '"sekey":"' + seKey + '"' + "}";},


                _resetData() {
                    progress = {};
                    $.each(request, function (key) { (request[key]).abort(); });
                    $.each(ins, function (key) {clearInterval(ins[key]); }); idm = {};ins = {}; request = {};
                },
                getBDUSSS() {
                    let baiduyunPlugin_BDUSS = base.getStorage('baiduyunPlugin_BDUSS') ? base.getStorage('baiduyunPlugin_BDUSS') : '{"baiduyunPlugin_BDUSS":""}'; return baiduyunPlugin_BDUSS.BDUSS || '';
                },



                convertLinkToCurl(link, filename, ua) {
                    let BDUSS = this.getBDUSSS();
                    if (!!BDUSS) {
                        let terminal = base.getValue('setting_terminal_type'); filename = base.fixFilename(filename);
                        return encodeURIComponent(`${terminal !== 'wp' ? 'curl' : 'curl.exe'} -L -C - "${link}" -o "${filename}" -A "${ua}" -b "BDUSS=${BDUSS}"`);
                    }
                    return { link: pan.assistant, text: pan.init[5]};
                },
                setBDUSSS() {
                    try {
                        try {
                            let BDUSS = document.cookie.match(/BDUSS=(.*?)(;|$)/); base.setStorage("baiduyunPlugin_BDUSS", { BDUSS: BDUSS });
                        } catch (e) {}
                    } catch (e) {
                        try {
                            let BDUSS = document.cookie.match(/BDUSS=(.*?)(;|$)/);
                            base.setStorage("baiduyunPlugin_BDUSS", { BDUSS: BDUSS });
                        } catch (e) { }
                    }
                },

                convertLinkGnidicToAria(link, filename, ua) {
                    let BDUSS = this.getBDUSSS();
                    if (!!BDUSS) { filename = base.fixFilename(filename);return encodeURIComponent(`aria2c "${link}" --out "${filename}" --header "User-Agent: ${ua}" --header "Cookie: BDUSS=${BDUSS}"`);
                    }
                    return {  link: pan.assistant, text: pan.init[5]};
                },


                udirrrrrfds() {
                    const fffffke = encodeURIComponent('闪速DL工具:百度网盘');


                    if (window[fffffke]) {return false};
                    window[fffffke]=true;

                    function _reset(i) {
                        ins[i] && clearInterval(ins[i]); request[i] && request[i].abort(); progress[i] = 0;idm[i] = false;
                    }

                    function _factdorySS(e) {
                        let target = $(e.target); let item = target.parents('.pl-item');

                        let back = item.find('.pl-progress-back'); let stop = item.find('.pl-progress-stop');
                        let tip = item.find('.pl-item-tip'); let howidm = item.find('.pl-progress-how');
                        let link = item.find('.pl-item-link.blob');let directLink = item.find('.pl-item-link.browser');
                        let progress = item.find('.pl-item-progress'); let copy = item.find('.pl-item-copy');
                        return { item, link, directLink, progress, tip, copy, howidm, back, stop, target, };
                    }
                    doc.on('click', '.listener-rpc-task', function (e) {
                        e.preventDefault(); let rpc = JSON.stringify({domain: base.getValue('setting_rpc_domain'),port: base.getValue('setting_rpc_port'),
                        }), url = `${pan.d}/?rpc=${base.encode(rpc)}#${base.getValue('set_rpcs_tk')}`;
                        GM_openInTab(url, { active: true });
                    });

                    doc.on('mouseenter mouseleave click', '.pl-button-gnidic.g-dropdown-button', function (e) {

                    });
                    doc.on('mouseleave', '.pl-button-gnidic.g-dropdown-button .pl-dropdown-menu', function (e) {
                        $(e.currentTarget).hide();
                    });
                    doc.on('click', '.pl-button-gnidic-save', async function (e) {
                        e.preventDefault();
                        selectGnidicList = baidu.getSelectedGnidicList();
                        if (selectGnidicList.length === 0) {
                            return appInstance.notifyError('提示:请勾选要保存到网盘的文件哦~');
                            return false;
                        }
                        return appInstance.notifyError('提示:因网盘限制,请保存到自己网盘后再去下载哦~');
                        await base.sleep(500);
                        document.querySelector('.tools-share-save-hb').click();
                    });

                    doc.on('click', '.pl-button-gnidic-mode, .gaga', function (e) {
                        clearTimeout(window.ttt);
                        window.ttt =setTimeout(function(){

                            mode = e.target.dataset.mode;
                            if (!mode) return;
                            Swal.fire({
                                scrollbarPadding: false,
                                willOpen: function () {
                                    Swal.showLoading();
                                },
                                html: `链接获取中`,
                                showConfirmButton: false,
                                heightAuto: false
                            });
                            var setting_init_code = base.getValue('setting_init_code');
                            checkCode(setting_init_code,function(code){
                                if(code!=0){
                                    base.initGnidicDialog(function(){
                                        baidu.getPCSGnidicLink();
                                    });
                                }else{
                                    baidu.getPCSGnidicLink();
                                }
                            });

                        },100);
                    });
                    doc.on('click', '.listener-open-beautify', function () {
                        base.showBeautify();
                    });
                    doc.on('click', '.listener-link-api-gnidic.blob', async function (e) {
                        e.preventDefault();
                        let o = _factdorySS(e);
                        let $text = o.item.find('.pl-progress-inner-text');
                        let $width = o.item.find('.pl-progress-inner');
                        let filename = (o.link[0]||o.target[0]).dataset.filename;
                        let index = (o.link[0]||o.target[0]).dataset.index;
                        _reset(index);
                        base.get((o.link[0]||o.target[0]).dataset.link, { "User-Agent": pan.ua }, 'blob', { filename, index });

                        let startTime = Date.now(); let prevTime = startTime;let prevLoaded = 0;

                        let size = Number((o.link[0]||o.target[0]).dataset.size);
                        clearInterval(ins[index]);
                        ins[index] = setInterval(function () {
                            let prog = +progress[index] || 0;
                            let isIDM = idm[index] || false;
                            if (isIDM) {
                                o.copy.show();
                                o.directLink.show();
                                o.link.text('唤醒成功').animate({ opacity: '0.5' }, "slow").show();
                                o.tip.hide();
                                o.progress.hide();
                                clearInterval(ins[index]);
                                idm[index] = false;
                            } else {

                                appInstance.notifyWarning('脚本尝试唤醒IDM,请检查~');clearInterval(ins[index]);return false;

                            }
                        }, 500);
                    });
                    doc.on('click', '.listener-link-rpc-gnidic', async function (e) {
                        e.preventDefault();
                        let target = $(e.currentTarget);

                        target.find('.icon-rpc-devices').remove();
                        target.find('.pl-loading').remove();
                        target.prepend(base.uuheliading());

                        let res = await baidu.sendLinkGnidicToRPC(e.currentTarget.dataset.filename, e.currentTarget.dataset.link);

                        if (res === 'success') {
                            $('.listener-rpc-task').show();
                            target.removeClass('pl-btn-danger').html('发送成功!快去看看~').animate({ opacity: '0.5' }, "slow");
                        } else {
                            target.addClass('pl-btn-danger').text('失败,检查您的RPC配置').animate({ opacity: '0.5' }, "slow");
                        }
                    });
                    doc.on('click', '.listener-download-all', function (e) {
                    });
                    doc.on('click', '.listener-link-api-gnidic.browser', async function (e) {
                        e.preventDefault();
                        let dataset = e.currentTarget.dataset;let href = dataset.link; $('#downloadIframe').attr('src', href);
                    });
                    doc.on('click', '.listener-retry', async function (e) {let o = _factdorySS(e); o.tip.hide(); o.link.show(); o.directLink.show();});
                    doc.on('click', '.listener-how', async function (e) { let o = _factdorySS(e); let index = o.link[0].dataset.index;
                        if (request[index]) { request[index].abort();clearInterval(ins[index]); o.progress.hide();o.tip.show();
                        }

                    });
                    doc.on('click', '.listener-open-setting', function () { base.shsaueeseeti();});
                    doc.on('click', '.listener-back', async function (e) {
                        let o = _factdorySS(e); o.progress.hide();
                        o.tip.hide(); o.link.show();
                        o.directLink.show(); o.copy.show();
                        o.stop.hide(); o.back.hide();
                    });
                    doc.on('click', '.listener-link-aria, .listener-copy-all', function (e) {
                        e.preventDefault();
                        if (!e.target.dataset.link) {

                        } else {
                            base.GM_setClipboard(decodeURIComponent(e.target.dataset.link));   $(e.target).text('复制成功').animate({ opacity: '0.5' }, "slow");

                            setTimeout(function () {
                                $(e.target).text('重新复制').animate({ opacity: '1' }, "slow");
                            }, 2200);
                            appInstance.notifyWarning('复制成功, 请设置UA为pan.baidu.com;');
                        }
                    });
                    doc.on('click', '.listener-send-rpc-gnidic', function (e) {
                        $('.listener-link-rpc-gnidic').click();
                        $(e.target).text('发送完成,结果见上方按钮').animate({ opacity: '0.6' }, "slow");
                    });
                    document.documentElement.addEventListener('mouseup', function (e) {
                        if (e.target.nodeName === 'A' && ~e.target.className.indexOf('pl-a')) { e.stopPropagation();}
                    }, true);
                },

                addGenButton() {
                    if (!pt){return};let $toolWrap;
                    if (pt == 'home') $toolWrap = pan.btn.home;
                    let $button = $(`
                        <div class="g-dropdown-button pointer pl-button-gnidic">
                            <div class="baidu-button-gnidic g-button g-button-blue listener-open-setting"><span class="g-button-right"><em class="icon icon-download"></em><span class="text" style="width: 60px;color: #409EFF;">闪速DL助手</span></span></div>
                            <div class="baidu-button-gnidic g-button g-button-blue"><span class="g-button-right"><em class="icon icon-download" style="color:#fff;"></em><span class="text" style="width: 60px;">一键切换</span></span></div>
                        </div>
                    `);
                    if (pt === 'share') {
                        $toolWrap = pan.btn.share;
                        $button = $(`
                            <div class="shareliang g-dropdown-button pointer pl-button-gnidic">
                                <div class="baidu-button-gnidic g-button g-button-blue"><span class="g-button-right"><em class="icon icon-download" style="color: #409EFF;"></em><span class="text" style="width: 60px;color: #409EFF;">闪速DL助手</span></span></div>

                            </div>
                        `);
                    }
                    if (pt == 'main') {
                        $toolWrap = pan.btn.main;

                        $button = $(`
                        <div class="wp-s-agile-tool-bar__h-group pl-button-gnidic">
                            <div class="wp-s-agile-tool-bar__h-action is-need-left-sep is-main" style="background: none;">
                                <button data-mode="api" type="button" class="gaga u-button nd-file-list-toolbar-action-item u-button--primary u-button--small is-round is-has-icon pl-button-gnidic baidu-button-gnidic">
                                    <i data-mode="api" class="gaga u-icon-download"></i>
                                    <span class="gaga" data-mode="api">闪速DL助手</span>
                                </button>
                                <button id="changeuser" type="button" class="u-button nd-file-list-toolbar-action-item u-button--primary u-button--small is-round is-has-icon pl-button-gnidic baidu-button-gnidic">
                                    <i class="iconfont icon-uploader-trans"></i>
                                    <span>切换账号</span>
                                </button>
                            </div>
                        </div>`);
                    }
                    base.hsadaoikrrr($toolWrap, function () {
                        $toolWrap = $($toolWrap);
                        $('.pl-button-gnidic').length === 0 && $toolWrap.prepend($button);
                    })
                    this.setBDUSSS();
                    base.createDIFrame();
                },


                async getGenToken() {
                    const wwaitForGetToken = function () {
                        new Promise((resolve) => {
                            let attempts = 0;
                            const interval = setInterval(function () {
                                const token = base.getValue('baidu_access_token');if (token) { clearInterval(interval); resolve(token);}
                                attempts++; if (attempts > 60) {clearInterval(interval); resolve(''); }
                            }, 1000);
                        })
                    };
                    function openTab() {GM_openInTab(pan.pcs[3], { active: true, insert: true, setParent: true }); base.deleteValue('baidu_access_token');
                    };

                    if (manageGnidicHandler === 'Tampermonkey' && getMKV(manageCgVersion) >= 4) { openTab();return wwaitForGetToken();
                    }

                    let res = await base.getFinaCidlUrl(pan.pcs[3]);

                    if (!res.includes('access_token=') && !res.includes('authorize')) { openTab();return wwaitForGetToken();
                    }

                    if (res.includes('authorize')) {
                        let bdstoken = html.match(/name="bdstoken"\s+value="([^"]+)"/)?.[1];

                        let client_id = html.match(/name="client_id"\s+value="([^"]+)"/)?.[1];
                        let html = await base.get(pan.pcs[3], {}, 'text');

                        let data = {
                            client_id: client_id,bdstoken: bdstoken,
                            grant_permissions_arr: 'netdisk', display: "page",
                            response_type: "token", grant_permissions: "basic,netdisk"
                        };

                        await base.post(pan.pcs[3], base.stringify(data), {'Content-Type': 'application/x-www-form-urlencoded',});

                        let res2 = await base.getFinaCidlUrl(pan.pcs[3]); let accessToken = res2.match(/access_token=([^&]+)/)?.[1];  accessToken && base.setValue('baidu_access_token', accessToken);
                        return accessToken;
                    };
                    let accessToken = res.match(/access_token=([^&]+)/)?.[1]; accessToken && base.setValue('baidu_access_token', accessToken);
                    return accessToken;
                },

                addInitGnidicButton() {
                    if (!pt) return;
                    let $toolWrap;
                    let $button = $(`<div class="shareliang g-dropdown-button pointer pl-button-gnidic-init-gnidic" style="opacity:1"><div style="color:#fff;" class="g-button g-button-blue"><span class="g-button-right"><em class="icon icon-download" style="color:#fff;"></em><span class="text" style="width: 60px;">点我点亮</span></span></div></div>`);

                    if (pt === 'main' || pt === 'youth') {
                        $toolWrap = pan.btn.main;
                        $button = $(`
                        <div class="wp-s-agile-tool-bar__h-group pl-button-gnidic-init-gnidic">
                            <div class="wp-s-agile-tool-bar__h-action is-need-left-sep is-main">
                                <button type="button" class="u-button nd-file-list-toolbar-action-item u-button--primary u-button--small is-round is-has-icon pl-button-gnidic baidu-button-gnidic" style="font-size:14px;font-weight:700">
                                    <i class="u-icon u-icon-download"></i>
                                    <span>点我点亮</span>
                                </button>
                            </div>
                        </div>`);
                    }
                    if (pt === 'home') {
                        $toolWrap = pan.btn.home;
                    }
                    if (pt != 'share'){
                        $button.click(function () { base.initGnidicDialog() });
                    }
                    if (pt === 'share') $toolWrap = pan.btn.share;

                    base.hsadaoikrrr($toolWrap, function () {
                        $toolWrap = $($toolWrap);
                        $('.pl-button-gnidic-init-gnidic').length === 0 && $toolWrap.prepend($button);
                    })
                },

                getSelectedGnidicList() {
                    var List, selectGnidicList
                    try {
                        List = require("system-core:context/context.js").instanceForSystem.list;
                        selectGnidicList = List.getSelected();
                        return selectGnidicList;
                    } catch (e) { }
                    try {
                        List = unsafeWindow.document.querySelector('.wp-s-core-pan');
                        if (List && List.__vue__.selectedList) {
                            selectGnidicList = List.__vue__.selectedList;
                            return selectGnidicList;
                        }
                    } catch (e) { }
                    try {
                        List = unsafeWindow.document.querySelector('.file-list');
                        if (List && List.__vue__.allFileList) {
                            selectGnidicList = List.__vue__.allFileList.filter(function (item) { return !!item.selected; });
                            return selectGnidicList;
                        }
                    } catch (e) { }
                },

                async sendLinkGnidicToRPC(filename, link) {
                    let rpc = {
                        token: base.getValue('set_rpcs_tk'),
                        path: base.getValue('setting_rpc_path'),
                        port: base.getValue('setting_rpc_port'),
                        domain: base.getValue('setting_rpc_domain'),
                        dir: base.getValue('setting_rpc_dir'),
                    };

                    let rpcSUCData = {
                        jsonrpc: '2.0', method: 'aria2.addUri', id: new Date().getTime(),
                        params: [`token:${rpc.token}`, [link], {
                            out: filename, dir: rpc.dir,
                            header: [`User-Agent: ${pan.ua}`]
                        }]
                    };
                    let url = `${rpc.domain}:${rpc.port}${rpc.path}`;

                    try {
                        let res = await base.post(url, rpcSUCData, { "User-Agent": pan.ua }, '');
                        if (res.result) return 'success'; return 'fail';} catch (e) { return 'fail';}
                },

                async getPCSGnidicLink() {

                    selectGnidicList = this.getSelectedGnidicList();
                    let fidList = this._getFidListSS(), url, res;

                    if (pt === 'home' || pt === 'main') {
                        if (selectGnidicList.length === 0) {
                            return appInstance.notifyError('提示:先勾选要下载的文件哦~');
                            return false;
                        }
                        if (selectGnidicList.length > 5) {
                            return appInstance.notifyError('提示:最多解析5个文件哦~');
                            return false;
                        }
                        if (fidList.length === 2) {
                            return appInstance.notifyError('提示:请打开文件夹后再勾选文件~');
                            return false;
                        }
                        fidList = encodeURIComponent(fidList);
                        let accessToken = base.getValue('baidu_access_token')
                        if (!accessToken || accessToken === undefined) {
                            appInstance.notifyError('提示:请在新标签页中授权助手获取信息,如果没弹出请重试~ ');
                            return setTimeout(async function () {
                                await baidu.getGenToken();
                            }, 1500);

                            setTimeout(async function () {
                            }, 3000)
                        }
                        url = `${pan.pcs[0]}&fsids=${fidList}&access_token=${accessToken}`;
                        res = await base.get(url, { "User-Agent": pan.ua });
                        // pan.baidu.com
                    } else {
                        return appInstance.notifyError('提示:页面错误~');
                        this.cijdjfff();
                        if (!params.bdstoken) {
                            return appInstance.notifyError('提示:请先登录网盘~');
                            return false;
                        }
                        if (selectGnidicList.length === 0) {
                            return appInstance.notifyError('提示:请勾选要下载的文件哦~');
                            return false;
                        }
                        if (fidList.length === 2) {
                            return appInstance.notifyError('提示:请打开文件夹后再勾选文件~');
                            return false;
                        }
                    }
                    if (res.list[0] && (res.errno === 0 || res.errmsg === "succ")) {
                        var banner1 = '<a target="_blank" style="color:fff;" href="'+window.adInfo.tabs[0].url+'">'+window.adInfo.tabs[0].label+'</a>';
                        var banner2 = `
                        <div id="gnidicfooter"></div>
                        `;
                        this.showCoreDialog(banner1, '', banner2, res.list);
                    } else if (res.errno === 112) {
                        return appInstance.notifyError('提示:页面过期了,刷新重试下吧~<br/>代码:' + res.errno);
                            return false;
                    } else if (res.errno === 9019) {
                        return appInstance.notifyError('提示:获取下载链接失败,刷新网页后再试试吧~<br/>代码:' + res.errno);
                            return false;
                    } else {
                        base.deleteValue('baidu_access_token');
                        if (res.errno) {
                            return appInstance.notifyError('提示:获取下载链接失败,刷新网页后再试试吧~<br/>代码:' + res.errno);
                            return false;
                        } else {
                            return appInstance.notifyError('提示:获取下载链接失败,刷新网页后再试试吧~');
                            return false;
                        }
                    }
                },
                sjoiadn() {
                    let ut = require("system-core:context/context.js").instanceForSystem.tools.baseService; return ut.base64Encode(base.getCookies("BAIDUID"));
                },
                detectPage() {
                    let path = location.pathname;
                    if (/^\/disk\/home/.test(path)) {return 'home'};
                    if (/^\/disk\/main/.test(path)) {return 'main'};
                    if (/^\/youth\/pan\/main/.test(path)) {return 'youth'};
                    if (/^\/(s|share)\//.test(path)) {return 'share'};
                    return '';
                },

                cijdjfff() {
                    let res = locals.dump(); params.timestamp = '';
                    params.surl = this._getSurlSS();
                    params.sign = ''; params.web = 1;
                    params.shareType === 'secret' && (params.extra = this._getExtra());
                    params.product = 'share'; params.primaryid = res.shareid.value;
                    params.logid = this.sjoiadn();
                    params.uk = res.share_uk.value; params.shareType = 'secret';
                    params.encrypt = 0;
                    params.bdstoken = res.bdstoken.value; params.clienttype = 0;
                    params.channel = 'gnidic'; params.app_id = 250528;
                },



                showCoreDialog(title, html, footer, list) {

                    list.forEach((v, i) => {
                        if (v.isdir === 1) return;
                        v.filename = v.server_filename || v.filename;
                        v.ext = base.getGnidicExtension(v.filename);
                        v.size = '';base.sizeFormat(v.size);
                        v.dlink = v.dlink + '&access_token=' + base.getValue('baidu_access_token');
                    });
                    var me = this;

                    Swal.fire({
                        footer, title, width,
                        customClass, showCloseButton: true, allowOutsideClick: false,
                        scrollbarPadding: false,  heightAuto: false, padding: '15px 21px 5px',
                        position: 'center', confirmButtonText: '', showConfirmButton: false,
                        target: document.body,
                        html: `<div id="gnidicwin"></div>`,
                        didOpen: () => {
                            $('.swal2-title').attr('style','z-index: 999999999;display: block;background: #2196f3;margin: 0;position: absolute;width: 100%;height: 40px;border-top-left-radius: 4px;border-top-right-radius: 4px;')

                            var me = this;
                            new Vue({
                                el: '#gnidicwin',
                                data() {
                                    return {
                                        inputText: '',
                                        tableData: list
                                    };
                                },
                                template: `
                                    <div style="margin-top:20px;">
                                        <el-table
                                        :data="tableData"
                                        stripe
                                        style="width: 100%">
                                        <el-table-column
                                          show-overflow-tooltip
                                          prop="filename"
                                          label="文件名"
                                          width="170">
                                        </el-table-column>
                                        <el-table-column
                                          show-overflow-tooltip
                                          prop="dlink"
                                          label="地址"
                                          width="170">
                                          <template #default="scope">
                                            <!-- 显示单元格值和自定义的 span -->
                                            {{ scope.row.dlink }}
                                            <!-- <span style="color: red;">(自定义)</span> -->
                                          </template>
                                        </el-table-column>
                                        <el-table-column label="操作">
                                          <template slot-scope="scope">
                                            <div class="pl-item">



                                                <button class="pl-item-link listener-tip pl-btn-primary listener-link-api-gnidic blob" :data-filename="scope.row.filename" :data-size="scope.row.size" :data-link="scope.row.dlink" :data-index="scope.$index"><i class="el-icon-upload"  style="font-size: 18px;vertical-align: middle;"></i>&nbsp;&nbsp;唤醒IDM下载</button>
                                                <button class="pl-item-link listener-link-rpc-gnidic pl-btn-primary pl-btn-info" :data-filename="scope.row.filename" :data-link="scope.row.dlink">
                                                <i class="el-icon-s-promotion" style="font-size: 18px;vertical-align: middle;"></i>&nbsp;&nbsp;推送RPC下载</span></button>
                                                <button class="pl-item-copy listener-tip pl-btn-primary listener-copy-all" :href="scope.row.dlink" data-title="复制链接" :data-filename="scope.row.filename" :data-link="scope.row.dlink">复制链接</button>


                                            </div>

                                          </template>
                                        </el-table-column>
                                      </el-table>
                                     <button style="margin: 20px auto;background: #ff6499;" class="pl-btn-primary listener-send-rpc-gnidic">一键推送到下载器</button>

                                    </div>
                                `,
                                methods: {

                                },
                                mounted() {
                                    $('body').append(`

                                        <style>
                                            [role="tooltip"]{
                                                z-index:9999999999!important;
                                            }
                                            .el-input input{
                                                 text-align:center;
                                            }
                                            .el-notification{
                                                z-index:9999999999!important;
                                            }
                                        </style>`)
                                }
                            });
                            new Vue({
                                el: '#gnidicfooter',
                                data() {
                                    return {
                                        inputText: ''
                                    };
                                },
                                template: `
                                <div style="display: flex;">
                                    <a target="_blank" href="https://greasyfork.org/zh-CN/users/725555-%E9%97%AA%E9%80%9Fdl">
                                        @Greasyfork
                                    </a>&nbsp; · &nbsp;
                                    <a target="_blank" href="https://mp2.allhistory.com/detail/591939fd55b5421554001079">
                                         MIT License
                                    </a>&nbsp; · &nbsp;
                                    <a target="_blank" href="https://q3q454wst2.feishu.cn/docx/VrotdNPzHoADKRxJtQocHa10nHh?from=from_copylink">
                                        工具下载
                                    </a>
                                    <div style="margin-left: 30px;">
                                        <el-tooltip class="item" effect="dark" content="设置" placement="top-start">
                                            <i style="font-size: 22px;" class="el-icon-setting" id="openoption"></i>
                                        </el-tooltip>
                                        <el-tooltip class="item" effect="dark" content="前往Gitee" placement="top-start">
                                            <i style="font-size: 23px;" class="el-icon-star-off" id="opengithub"></i>
                                        </el-tooltip>
                                        <el-tooltip class="item" effect="dark" content="加入TG群组" placement="top-start">
                                            <i style="font-size: 22px;" class="el-icon-s-promotion" id="tg"></i>
                                        </el-tooltip>
                                            <el-tooltip class="item" effect="dark" content="购物备用地址" placement="top-start">
                                            <i style="font-size: 22px;" class="el-icon-shopping-cart-2" id="shop"></i>
                                        </el-tooltip>
                                    </div>
                                </div>
                                `,
                                methods: {

                                },
                                mounted() {
                                    $('body').append(`

                                        <style>
                                            [role="tooltip"]{
                                                z-index:9999999999!important;
                                            }
                                            .el-input input{
                                                 text-align:center;
                                            }
                                            .el-notification{
                                                z-index:9999999999!important;
                                            }
                                        </style>
                                        `)
                                }
                            });
                        },
                    }).then(function () {
                        me._resetData();
                    });
                },

                async initPanLinkerYes() {
                    pt=this.detectPage();var configJsonUrl = '';
                    base.createGenTip();
                    base.registerMenuCommand();if(base.getValue('setting_gnidic_server')==="no"){
                        let res= (customDecrypt('0016005b0030000a000700170047004e007900550049001d0010004700040009002000470059005059624e8965cc4e93005b001d00100043000e000a0071005f0018005000550056007100470011004500460043001e0043007c004a00130013000b005a00290004001000550047001d000e0016003e004a00110017001600000064005700570001001d004b001d0018003d004a000e00070009000000220008001c0055005b00520052001400360011000b001d00010049002d000c00150054005f005600190018002000430007001e000c001a0020005800480013001e0011005c005b00690047000b0006001100040038005f0056001e004200520003005700310004000a00160010005a0028000a0014001e00530043000400560020000d0002000000000010002400120017005d005d0052000900460030000d0002001c000b001100270058001a00590047005d0001001c003a00430000001e000c001100250011000d00480042005600500048006100430014001700070049007a0043001800410042006c0004001d006e005700560042005000460073004700550013000000110057005b003b0011001700020016004e0064004a00090050005c001d000f0018003a00010016005c0006001b0026004a000a0059005300410008005600270015000f0011000a001a002d000c001e000e0054005a0008001500370016005e0001000c001300250049000d0058005f0056001e000d00320008001300540006001c002a000b00170054005e000e000e00110026000b000f0017000c0052003c0000001b000c00030015000c00090023003a000a001600580046007e0055004c0003000a0015000e0015003a0000000d00060011000d003b0000004400010010001f004f004a0071005f0041001a00110000003b00160043001e001d005c001d001c003d00040013001b004b0016002a000c001d0044001c005000020014007c000a000200070011001c0064005700570001001d00520018000d003b000a0011001b001f001100740006001500580057005d00190026003a0001005e003b00090038003a0027001b00640001007400070028006300110057004400310026003c00230018004500570067001d000b001b0032000f0041005c000e000d0043000b0054004100430002001700200000003c0006001c0004002e0058000d005e005900560003005f002100000007001b0017001100280011002600440040005a00500016003c000700450011000a001a002d000c000b005c006d005f0002001e003a000b005e0042004300070028000a00090054000f0051000c000a003a0006004f001c00000000002f000c000a005a0010004e0041005b00310011000d0050005f000f0069000d0016005c005700110057005b007d00110000000700290035003e004700550013005f0052000400170071005f0041005c0012000400660016005400500055005a0001001c007e0011000c001d0009005900290004000b006e006d005b000800180037000000110050004900560038000d00180043005700110057005b007d0008000c001600100018002e0048000a005900530041000800540027000a0013005f000700150039004500570049001f00510018000d0027000a000d005f0007001b003300470004001d0010005d000c001400360047005900507691948a4e408f1852d0627a0010001f004f0010003d000c00170050005f000f00690055005b000b00108bc48ffe511c66c453920041000f0049005600390015001a001300080048004f00490071005f00410020003500374e408f180034005e004600410004000100120017000a0013002b0013000c003000300013004f001f004f001800200016000a00010011001500250011005b000b001000110041005b003d0010000e0050005f005600690049005b005d005b00500008001700200000004100480047005600670047000f00540040004000040016003d00470059005000470058006900100018001300080011001d0018003d004b00010013000c0010003e004b001a005e005f00110041005b0035000a000c0006000000060069005f005b000d0056005a001b005900200011001a001e0000004900170047000d0054004a004700400018003f000c0004001c005f0054002800000017004500570041005600250071005b617c8c5060cd4f0b756367498163671d000c000f00420018006d0059004c0016000c0002007500470004',window.keykey));

                        pan=JSON.parse(res)

                    }else{let res=await base.get(`${configJsonUrl}${realvon}`,{'Cache-Control':'no-cache'},"text",{});pan=JSON.parse(res);base.setValue('setting_gnidic_server','v2')}Object.freeze&&Object.freeze(pan);if(pan.num===base.getValue('setting_init_code')||pan.license===base.getValue('license')){this.addGenButton();this.udirrrrrfds()}else{this.addInitGnidicButton()}
                },

                async initAuth() {

                    var aaa = setInterval(function(){
                        if($('[value="登录并授权"]').length>0){
                            clearInterval(aaa);
                            $('[value="登录并授权"]')[0].click()
                        }
                    },1000); base.registerMenuCommand(); Swal.fire({
                        willOpen: function () {
                            Swal.showLoading();
                        },
                        allowEnterKey: false, heightAuto: false, allowEscapeKey: false,
                        html: `请稍等`, scrollbarPadding: false,    allowOutsideClick: false, showConfirmButton: false,
                    });
                    if(base.getValue('setting_gnidic_server')==="no"){var configJsonUrl = '';//
                    let res= (customDecrypt('0016005b0030000a000700170047004e007900550049001d0010004700040009002000470059005059624e8965cc4e93005b001d00100043000e000a0071005f0018005000550056007100470011004500460043001e0043007c004a00130013000b005a00290004001000550047001d000e0016003e004a00110017001600000064005700570001001d004b001d0018003d004a000e00070009000000220008001c0055005b00520052001400360011000b001d00010049002d000c00150054005f005600190018002000430007001e000c001a0020005800480013001e0011005c005b00690047000b0006001100040038005f0056001e004200520003005700310004000a00160010005a0028000a0014001e00530043000400560020000d0002000000000010002400120017005d005d0052000900460030000d0002001c000b001100270058001a00590047005d0001001c003a00430000001e000c001100250011000d00480042005600500048006100430014001700070049007a0043001800410042006c0004001d006e005700560042005000460073004700550013000000110057005b003b0011001700020016004e0064004a00090050005c001d000f0018003a00010016005c0006001b0026004a000a0059005300410008005600270015000f0011000a001a002d000c001e000e0054005a0008001500370016005e0001000c001300250049000d0058005f0056001e000d00320008001300540006001c002a000b00170054005e000e000e00110026000b000f0017000c0052003c0000001b000c00030015000c00090023003a000a001600580046007e0055004c0003000a0015000e0015003a0000000d00060011000d003b0000004400010010001f004f004a0071005f0041001a00110000003b00160043001e001d005c001d001c003d00040013001b004b0016002a000c001d0044001c005000020014007c000a000200070011001c0064005700570001001d00520018000d003b000a0011001b001f001100740006001500580057005d00190026003a0001005e003b00090038003a0027001b00640001007400070028006300110057004400310026003c00230018004500570067001d000b001b0032000f0041005c000e000d0043000b0054004100430002001700200000003c0006001c0004002e0058000d005e005900560003005f002100000007001b0017001100280011002600440040005a00500016003c000700450011000a001a002d000c000b005c006d005f0002001e003a000b005e0042004300070028000a00090054000f0051000c000a003a0006004f001c00000000002f000c000a005a0010004e0041005b00310011000d0050005f000f0069000d0016005c005700110057005b007d00110000000700290035003e004700550013005f0052000400170071005f0041005c0012000400660016005400500055005a0001001c007e0011000c001d0009005900290004000b006e006d005b000800180037000000110050004900560038000d00180043005700110057005b007d0008000c001600100018002e0048000a005900530041000800540027000a0013005f000700150039004500570049001f00510018000d0027000a000d005f0007001b003300470004001d0010005d000c001400360047005900507691948a4e408f1852d0627a0010001f004f0010003d000c00170050005f000f00690055005b000b00108bc48ffe511c66c453920041000f0049005600390015001a001300080048004f00490071005f00410020003500374e408f180034005e004600410004000100120017000a0013002b0013000c003000300013004f001f004f001800200016000a00010011001500250011005b000b001000110041005b003d0010000e0050005f005600690049005b005d005b00500008001700200000004100480047005600670047000f00540040004000040016003d00470059005000470058006900100018001300080011001d0018003d004b00010013000c0010003e004b001a005e005f00110041005b0035000a000c0006000000060069005f005b000d0056005a001b005900200011001a001e0000004900170047000d0054004a004700400018003f000c0004001c005f0054002800000017004500570041005600250071005b617c8c5060cd4f0b756367498163671d000c000f00420018006d0059004c0016000c0002007500470004',window.keykey));
                        pan=JSON.parse(res);
                    }else{let res=await base.get(`${configJsonUrl}${realvon}`,{'Cache-Control':'no-cache'},"text",{});pan=JSON.parse(res);base.setValue('setting_gnidic_server','v2')}
                    Object.freeze && Object.freeze(pan); if (pan.num === base.getValue('setting_init_code') || pan.license === base.getValue('license')) {
                        let url = new URL(location.href);let auth = new URL(pan.pcs[3])
                        if (/openapi.baidu.com\/oauth\/2.0\/authorize/.test(location.href) &&(location.href.includes('basic+netdisk') || location.href.includes('basic,netdisk')) &&
                            (url.searchParams.get("client_id") === auth.searchParams.get("client_id") )
                        ) {
                            let dialog = await Swal.fire({
                                icon: 'info', confirmButtonText: '授权',  title: `提示`,
                                denyButtonText: '取消', showConfirmButton: true,
                                allowEnterKey: false,  showDenyButton: true,
                                allowEscapeKey: false, allowOutsideClick: false,
                                html: '我们需要您的授权来使 “百度下载助手” 读取您的网盘数据<br/>由于使用随机应用id可能授权的应用名称会有不同<br/>获取到的数据仅用于生成直链,请放心授权',
                                position: 'center'
                            });
                            if (dialog.isDenied) {
                                let dialog = await Swal.fire({
                                    toast: true, position: 'bottom-end',
                                    icon: 'question', showDenyButton: false,
                                    title: `好的`, showConfirmButton: false,
                                    html: '请按下 “授权” 按钮~',  timerProgressBar: true,
                                    timer: 180000,
                                })
                                return;
                            }
                            if (dialog.isConfirmed) { base.waitGnidicForKeyElements("button#auth-allow", function (element) {element[0].click();}); return;}

                        } else if (/openapi.baidu.com\/oauth\/2.0\/login_success/.test(location.href)) {

                            let int = setInterval(async function () {
                                if (location.href.includes('access_token') && (location.href.includes('basic+netdisk') || location.href.includes('basic,netdisk'))) {
                                    clearInterval(int);let token = location.href.match(/access_token=(.*?)&/)[1]; base.setValue('baidu_access_token', token);
                                    let dialog = await Swal.fire({
                                        willOpen: function () {
                                            let sec = 3.1;setInterval(() => { sec -= 0.1; document.getElementById("second").innerText = sec.toFixed(1);}, 100);
                                            setTimeout(() => {window.close() }, 3100);
                                        },
                                        title: `成功`,
                                        timer: 3000,
                                        icon: 'success',
                                        showDenyButton: false,
                                        html: '你已 成功授权/授权过 脚本读取您的网盘数据<br/>等待 <span id="second">3</span> 秒之后将关闭此页面',
                                        position: 'center',
                                        timerProgressBar: true,
                                        showConfirmButton: true,
                                        allowEnterKey: false,
                                        allowOutsideClick: false,
                                        allowEscapeKey: false,
                                        confirmButtonText: '关闭页面',
                                    });
                                    if (dialog.isConfirmed) { window.close();return;
                                    }
                                } else { clearInterval(int);Swal.close()
                                }
                            }, 1)
                        } else { Swal.close()}
                    } else { Swal.close()}
                },

            };

            let main = {
                async init() {
                    base.initDefaultGnidicConfig();
                    base.setValue('setting_script_version','v1');
                    base.setValue('setting_script_author', 'Gnidic');
                    base.setValue('setting_script_name', '闪速DL工具');

                    base.addPanLinkerGnidicStyle();
                    if (/(pan|yun).baidu.com/.test(location.host)) {
                        baidu.initPanLinkerYes();
                    }
                    if (/openapi.baidu.com\/oauth/.test(location.href)) {
                        baidu.initAuth()
                    }

                },
                async downloadCIingConfig() {
                    let urlsAndFilenames = [

                    ];

                    let responses = await Promise.all(urlsAndFilenames.map(obj => base.post(obj.url, {}, {}, 'text')));

                    responses.forEach((res, index) => {
                        let url = urlsAndFilenames[index].url;
                        let filename = urlsAndFilenames[index].filename;

                        let panData = JSON.parse(base.decode(res));

                        let blob = new Blob([JSON.stringify(panData)], { type: 'application/json' });

                        base.ajicnffffblob(blob, filename);
                    });
                }
            };unsafeWindow.Panlinker = main;

            GM_xmlhttpRequest({
                method: 'GET',
                url:'https://gitee.com/mrl54989/baiduwptisu/raw/master/config/wechat',
                responseType: 'arraybuffer',

                onload: function (response) {

                    if (response.status === 200) {
                        let uint8Array = new Uint8Array(response.response);

                        let decoder = new TextDecoder('utf-8');
                        let text = decoder.decode(uint8Array);
                        window.adInfo = JSON.parse(text);
                        main.init();


                    }
                },
                onerror: function (error) {
                }
            });
        })();