!function(){"use strict";function e(e){return!(!e||!(e.countryCodeMap||e.pageHostMap||e.advancePageHostMap||e.advanceCountryCodeMap))}function o(){if("1"==localStorage.getItem("openDebugMode")){var e=Array.prototype.slice.call(arguments),o=["%c debugLog-common-config ","border:1px solid red;color: blue; font-weight: bold;"];console.log.apply(this,o.concat(e))}}-1!=location.href.indexOf("openDebugMode=1")?localStorage.setItem("openDebugMode","1"):-1!=location.href.indexOf("openDebugMode=0")&&localStorage.removeItem("openDebugMode");var n="_remote_xhr_replace_conf_sy_";function t(t,r,a){if(!(!1 in window)&&"function"==typeof window.XMLHttpRequest){"function"!=typeof r&&(r=function(){}),"function"!=typeof a&&(a=function(){}),t=t||"";var i=new XMLHttpRequest;i.open("GET",t,!0),i.onreadystatechange=function(){if(o("xhr.readyState",i.readyState),o("xhr.status",i.status),4===i.readyState)if(200===i.status){var t,c=i.responseText;try{"string"==typeof c&&(t=JSON.parse(c)),e(t)?(!function(e){(e=e||{}).extraOptions=e.extraOptions||{},e.extraOptions.lastFetchTimestamp=Date.now(),e.extraOptions.expireSeconds=Number(e.extraOptions.expireSeconds)||600,e.extraOptions.expireSeconds>3600&&(e.extraOptions.expireSeconds=3600),window.localStorage.setItem(n,JSON.stringify(e))}(t),r(c)):a(c)}catch(e){a(e)}}else a("respError")},i.onerror=function(){o("请求onerror",t),a("onerror")},i.timeout=1e4,i.ontimeout=function(){o("请求ontimeout",t),a("ontimeout")},i.send()}}function r(){var e={};try{e=window.localStorage.getItem(n)||"{}",e=JSON.parse(e)}catch(e){}return e}function a(e,n){var a=(r()||{}).extraOptions||{},i=Number(a.lastFetchTimestamp)||0,c=Number(a.expireSeconds)||600,s=Date.now(),p=function(){var e=["/live/transparent_cdn/HostConf_SY.json","https://static-act.saya.chat/live/transparent_cdn/HostConf_SY.json","https://d150mn8qjj5880.cloudfront.net/live/transparent_cdn/HostConf_SY.json","https://d2fg91fzjsrcv1.cloudfront.net/live/transparent_cdn/HostConf_SY.json","https://static-act.saya.cool/live/transparent_cdn/HostConf_SY.json","https://static-act.sayaparty.com/live/transparent_cdn/HostConf_SY.json"],r="_remote_xhr_available_url_sy_";e=function(e,o){var n=e.indexOf(o);if(n>-1){var t=e.splice(n);e=t.concat(e)}return e}(e,localStorage.getItem(r)),o("拉取配置顺序",JSON.stringify(e));var a=0;!function o(){if(a-1?"&":"?",c+d+p),(function(){localStorage.setItem(r,i)}),(function(){a+=1,o()}))}else"function"==typeof n&&n();var c,p,d}()};c>3600&&(c=3600),(c<0||e||(s-i)/1e3>=c)&&p()}window.initFetchXhrConfig=a;var i=(r()||{}).extraOptions||{},c=Number(i.delayFetchSeconds)||0;setTimeout((function(){a(!1,(function(){o("遍历执行完毕")}))}),1e3*c);var s={countryCodeMap:{},pageHostMap:{},extraOptions:{lastFetchTimestamp:0,expireSeconds:600,delayFetchSeconds:1,perfConfig:{sampleRate:.2},sentryConfig:{}}};function p(e,o){for(var n in o)o.hasOwnProperty(n)&&(o[n]instanceof Object&&n in e?p(e[n],o[n]):e[n]=o[n]);return e}function d(){var e=r(),o=p(s,e),n=p(o,window.$_XHR_REPLACE_OPTIONS||{});return window.$_FinalXhrReplaceConf=n,n}window.getFinalXhrReplaceConf=d;var u=d(),f=u&&u.extraOptions&&u.extraOptions.sentryConfig||{},l=Object.assign({},{categoryMap:{request:"request"},tagMap:{actName:"act.name",actDeveloper:"act.developer"},maxBreadcrumbs:50,sampleRate:.3,autoCategoryRule:{},ignoreEventRule:[/vid_mate_check is not defined/],ignoreBreadcrumbRule:[],changeEvent:function(e){return e}},f);o("【sentry】finalSentryConf:",l);var m=d(),v=m&&m.extraOptions&&m.extraOptions.perfConfig||{},w=Object.assign({},{sampleRate:.05,costTimeLimit:2e4,api:"https://front-perf.saya.chat/api/call",reportWaitMilliseconds:2e3},{sampleRate:.2},v);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}o("【perf】finalPerfConfig:",w);var g=function(){try{var e=navigator.userAgent,o=(e=(e=e.replace("__nimbus","")).replace("__webkit","")).match(/BIGO-baiguoyuan \((.+)\)/i);if(o){var n=o[1],t={},r=n.split("__");return["phoneName","appName","appVersion","sysName","sysVersion","appEnv","deviceid","userid","appVersionCode","countryCode"].forEach((function(e,o){t[e]=r[o]})),t}return{}}catch(e){return{}}}().countryCode;function _(e,n){var t=n&&n.customCountryCode||g,r=/^(http:\/\/|https:\/\/|wss:\/\/|\/\/)([a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?)/.exec(e),a=r&&r[2];if(!a)return e;var i=d();function c(e){var o="";return"string"==typeof e?o=e:"object"===y(e)&&(o=navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)&&e.ios?e.ios:(navigator.userAgent.indexOf("Android")>-1||navigator.userAgent.indexOf("Adr")>-1)&&e.android?e.android:e.other),o}var s,p,u=!1,f=!1,l=function(){var o=(i.advanceCountryCodeMap||{})[a]||{};if("string"==typeof o)return e.replace(a,o);if("object"===y(o)){var n=c(o[t])||c(o.other);if(n)return e.replace(a,n)}return""}(),m=function(){var o=(i.advancePageHostMap||{})[a]||{},n=location.host,t="";if("string"==typeof o?t=o:"object"===y(o)&&(t=c(o[n])||c(o.other)),t){if(0===t.indexOf("/")){var r=new RegExp("^(http://|https://|wss://|//)".concat(a),"");return u=!0,e.replace(r,t)}return e.replace(a,t)}return""}(),v=(s=(i.countryCodeMap||{})[a]||{},p="","string"==typeof s&&(p=s),"object"===y(s)&&(p=s[t]||s.other),p?e.replace(a,p):""),w=function(){var o,n=(i.pageHostMap||{})[a]||{},t=location&&location.host;if("string"==typeof n&&(o=n),"object"===y(n)&&(o=n[t]||n.other),o){if(0===o.indexOf("/")){var r=new RegExp("^(http://|https://|wss://|//)".concat(a),"");return f=!0,e.replace(r,o)}return e.replace(a,o)}return""}(),_="";return _=t?u?m||e:f?w||e:l||m||v||w||e:m||w||e,o("=============== 【begin doBlockHostReplace】 ================"),o("【originApiUrl】",e),o("【finalApiUrlFromAdvanceCCmap】",l),o("【finalApiUrlFromAdvanceHostMap】",m),o("【finalApiUrlFromCCMap】",v),o("【finalApiUrlFromHostMap】",w),o("【finalUrl】",_),o("=============== 【endof doBlockHostReplace】 ================"),_}function h(o,n,t){var r=o,a=n;if(t=t||{},e(d())){var i=(n||"")+o;n&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(o)?a=_(n,t):r=_(o,t);var c=(a||"")+r;i!==c&&(console.info("替换前",i,"extraParams: ",JSON.stringify(t)),console.info("替换后",c))}return{url:r,baseURL:a}}window.doBlockHostReplace=h,"XMLHttpRequest"in window&&function(e,o,n){if(o in e){var t=n(e[o]);if("function"==typeof t)try{t.prototype=t.prototype||{}}catch(e){}e[o]=t}}(XMLHttpRequest.prototype,"open",(function(e){return function(){for(var o=arguments.length,n=new Array(o),t=0;t0)for(var r=0;r-1||a.src.indexOf("common_vendor")>-1)&&(a.onload=function(){n(2)},a.addEventListener("load",(function(){n(2)})))}}))}))).observe(document,{childList:!0,subtree:!0})}catch(e){console.error("【commonVendorObserver】",e)}}(),setTimeout((function(){void 0!==e&&e.disconnect&&e.disconnect()}),2e4))}(),window.$_SENTRY_OPTIONS=l,window.$_PERF_OPTIONS=w;var O=h(w&&w.api||"");O&&O.url&&(window.$_JSSDK_OPTIONS=window.$_JSSDK_OPTIONS||{},window.$_JSSDK_OPTIONS.api=O.url,window.$_PERF_OPTIONS=window.$_PERF_OPTIONS||{},window.$_PERF_OPTIONS.api=O.url)}();