");var t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),o=t.exec(n);return o?o[2]?decodeURIComponent(o[2].replace(/\+/g," ")):"":null}function t(e){var n=document.location.search||document.location.hash;if(n){if("?"===n[0]&&(n=n.slice(1)),null===e)return decodeURIComponent(n);for(var t=n.split("&"),o=0,s=t.length;o=1-(Number(n)||.1)&&((new Image).src="https://support.weixin.qq.com/cgi-bin/mmsupportmeshnodelogicsvr-bin/cube?biz=3512&label=connect.qrconnect&action="+e)}function s(e,n,t){var o="";if(t){var s=new Date;s.setTime(s.getTime()+24*t*60*60*1e3),o="; expires="+s.toUTCString()}document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+o+"; path=/; SameSite=None; Secure"}function i(e){for(var n=encodeURIComponent(e)+"=",t=document.cookie.split(";"),o=0;o-1?"&":"?")+"code="+wx_code+"&state=op";var a=n("self_redirect");if(f)if("true"!==a&&"false"!==a)try{document.domain="qq.com";var d=window.top.location.host.toLowerCase();d&&(window.location=c)}catch(e){window.top.location=c}else if("true"===a)try{window.location=c}catch(e){window.top.location=c}else window.top.location=c;else window.location=c;break;case 404:o("connect_qrconnect_longpull_success_404",.01),jQuery(".js_status").hide(),jQuery(".js_qr_img").hide(),jQuery(".js_wx_after_scan").show(),setTimeout(l,100,r);break;case 403:o("connect_qrconnect_longpull_success_403",.01),jQuery(".js_status").hide(),jQuery(".js_qr_img").hide(),jQuery(".js_wx_after_cancel").show(),setTimeout(l,2e3,r);break;case 402:o("connect_qrconnect_longpull_success_402",.01),s("reloadTriggered",!0,100),I=!0,B>-1?f&&1!==v||y?$(".js_qrcode_img").attr("src","https://res.wx.qq.com/t/fed_upload/46a73b115c002aa8d49ae255da18c592/qrcode_expired.jpg"):($(".js_refresh_qrcode").show(),$(".js_refresh_qrcode_mask").show()):setTimeout(function(){window.location.reload()},200);break;case 500:o("connect_qrconnect_longpull_success_500",.01),setTimeout(function(){window.location.reload()},200);break;case 408:o("connect_qrconnect_longpull_success_408",.01),M<1&&setTimeout(l,2e3);break;default:o("connect_qrconnect_longpull_success_others",.01)}},error:function(e,n,t){o("connect_qrconnect_longpull_error",.01);var s=window.wx_errcode;408==s?(o("connect_qrconnect_longpull_error_408",.01),setTimeout(l,5e3)):(o("connect_qrconnect_longpull_error_others",.01),setTimeout(l,5e3,s))}})}function d(e,n){var t,o,s=screen.width,i=screen.height,r=window.outerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=window.outerHeight||document.documentElement.clientHeight||document.body.clientHeight,a=window.screenX||window.screenLeft||0,l=window.screenY||window.screenTop||0,d=window.screen.availLeft||0,_=window.screen.availTop||0;return window.top!=window?void 0===window.screen.availLeft?(t=a+r/2-e/2,o=l+c/2-n/2,console.log("availLeft undefined && centerX: ",t)):(t=s/2-e/2+d, o=i/2-n/2+_,console.log("centerX: ",t)):(t=a+r/2,o=l+c/2,t=0===d?Math.min(Math.max(t-e/2,0),s+d-e):Math.min(Math.max(t-e/2,d),s+d-e),o=0===_?Math.min(Math.max(o-n/2,0),i+_-n):Math.min(Math.max(o-n/2,_),i+_-n)),{x:t,y:o}}function _(){M=0,$(".js_quick_login").hide(),$(".js_normal_login").show(),$(".js_switchToFast_wrp").show(),r("reloadTriggered"),a(),setTimeout(l,100)}function u(){M=1,$("#quick_login_loading_toast").fadeIn(300),p([D]).then(function(){$("#quick_login_loading_toast").fadeOut(300),console.log("switchToQuickLogin, fastLogin: ",K),K?($(".js_quick_login").show(),$(".js_normal_login").hide()):(a(),setTimeout(l,1e3))})}function A(e,n,t,o,s,i){0===e.length&&($(".js_quick_login").hide(),$(".js_normal_login").show(),$(".js_switchToFast_wrp").hide(),K=!1,console.log("所有端口均无法连接")),D=e[0],console.log("port: ",D),$.ajax({url:"https://localhost.weixin.qq.com:"+D+n,type:t,contentType:"application/json",data:JSON.stringify(o),success:s,error:function(r,c,a){console.log("端口"+D+"连接失败,尝试下一个端口"),e.length>1?A(e.slice(1),n,t,o,s,i):i&&i()}})}function p(n){var t=jQuery.Deferred();return A(n,"/api/check-login","POST",{apiname:"qrconnectchecklogin",jsdata:{appid:e("appid"),scope:e("scope"),redirect_uri:e("redirect_uri"),state:e("state")}},function(e){var n=JSON.parse(e);if(console.log("登录状态检查成功",n),O=n.jsdata&&n.jsdata.authorize_uuid||"",M>-1)return void t.resolve();var s=n.errcode;K=!(0!==s||f&&!V),K?(o("connect_qrconnect_fastLogin_show",.01),$(".js_quick_login").show(),$(".js_normal_login").hide(),$(".js_switchToFast_wrp").show(),$(".js_quick_login_nickname").text(n.jsdata&&n.jsdata.nickname||""),$(".js_quick_login_avatar").attr("src",n.jsdata&&n.jsdata.headimgurl||"https://res.wx.qq.com/t/fed_upload/937b4aa0-2cc5-42ec-81d7-e641da427fff/avatar_default.svg")):($(".js_quick_login").hide(),$(".js_normal_login").show(),$(".js_switchToFast_wrp").hide()),t.resolve()},function(){console.log("checklogin local error"),t.resolve()}),t.promise()}function g(){var e=jQuery.Deferred();return setTimeout(function(){e.resolve()},1e3),jQuery(window).load(function(){e.resolve()}),e.promise()}function w(){var e=jQuery.Deferred();r("reloadTriggered");var n=window.location.href.replace(/#.*$/,"")+"&f=xml&"+(new Date).getTime();return jQuery.ajax({url:n,type:"GET",dataType:"xml",cache:!1,success:function(n){$(".js_refresh_qrcode_loading").hide(),$(".js_refresh_qrcode_mask").hide(),S=jQuery(n).find("uuid").text(),$(".js_qrcode_img").attr("src","/connect/qrcode/"+S),setTimeout(l,2e3),e.resolve()},error:function(n,t,o){$(".js_refresh_qrcode_loading").hide(),$(".js_refresh_qrcode_mask").hide(),$("#quick_login_error_toast").fadeIn(300,function(){var e=this;setTimeout(function(){$(e).fadeOut(300)},1e3)}),console.log("qrcode img error: ",t,o),e.resolve()}}),e.promise()}"undefined"==typeof console&&(console={log:function(){}}),jQuery(".js_web_qrcode_reload").click(function(){window.location.reload()});var f=window.top!=window,m=t("self_redirect")||t("style")||t("href")||t("oldstyle"),h=parseInt(e("styletype"),10),q=NaN,b="",v=parseInt(e("stylelite"),10),y=!1;if(1!==h&&0!==h&&1===q&&(h=0),1!==v&&1!==h&&0!==h&&b){y=!0,o("connect_qrconnect_css_href");var j=document.createElement("link");j.rel="stylesheet",j.href=b.replace(new RegExp("javascript:","gi"),""),document.getElementsByTagName("head")[0].appendChild(j)}if(1===v&&(jQuery("#tpl_old_iframe").hide(),jQuery("#tpl_iframe").show()),f){o("connect_qrconnect_iframe"),document.body.className+=" web_qrcode_type_iframe";var x="";"white"!=x&&(document.body.style.color="#373737"),jQuery("#tpl_for_iframe").show()}else{o("connect_qrconnect_page"),document.getElementsByClassName||(document.getElementsByClassName=function(e){for(var n=[],t=new RegExp("(^| )"+e+"( |$)"),o=document.getElementsByTagName("*"),s=0,i=o.length;s