!function(){"use strict";function e(e){return!(!e||!e.countryCodeMap&&!e.pageHostMap)}function n(){if("1"==localStorage.getItem("openDebugMode")){var e=Array.prototype.slice.call(arguments),n=["%c debugLog-common-config ","border:1px solid red;color: blue; font-weight: bold;"];console.log.apply(this,n.concat(e))}}-1!=location.href.indexOf("openDebugMode=1")?localStorage.setItem("openDebugMode","1"):-1!=location.href.indexOf("openDebugMode=0")&&localStorage.removeItem("openDebugMode");var o="_remote_xhr_replace_conf_";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(n("xhr.readyState",i.readyState),n("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(o,JSON.stringify(e))}(t),r(c)):a(c)}catch(e){a(e)}}else a("respError")},i.onerror=function(){n("请求onerror",t),a("onerror")},i.timeout=1e4,i.ontimeout=function(){n("请求ontimeout",t),a("ontimeout")},i.send()}}function r(){var e={};try{e=window.localStorage.getItem(o)||"{}",e=JSON.parse(e)}catch(e){}return e}function a(e,o){var a=(r()||{}).extraOptions||{},i=Number(a.lastFetchTimestamp)||0,c=Number(a.expireSeconds)||600,s=Date.now(),d=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_";e=function(e,n){var o=e.indexOf(n);if(o>-1){var t=e.splice(o);e=t.concat(e)}return e}(e,localStorage.getItem(r)),n("拉取配置顺序",JSON.stringify(e));var a=0;!function n(){if(a-1?"&":"?",c+p+d),(function(){localStorage.setItem(r,i)}),(function(){a+=1,n()}))}else"function"==typeof o&&o();var c,d,p}()};c>3600&&(c=3600),(c<0||e||(s-i)/1e3>=c)&&d()}window.initFetchXhrConfig=a;var i=(r()||{}).extraOptions||{},c=Number(i.delayFetchSeconds)||0;setTimeout((function(){a(!1,(function(){n("遍历执行完毕")}))}),1e3*c);var s={countryCodeMap:{},pageHostMap:{},extraOptions:{lastFetchTimestamp:0,expireSeconds:600,delayFetchSeconds:1,perfConfig:{sampleRate:.2},sentryConfig:{}}};function d(e,n){for(var o in n)n.hasOwnProperty(o)&&(n[o]instanceof Object&&o in e?d(e[o],n[o]):e[o]=n[o]);return e}function p(){var e=r(),n=d(s,e),o=d(n,window.$_XHR_REPLACE_OPTIONS||{});return window.$_FinalXhrReplaceConf=o,o}window.getFinalXhrReplaceConf=p;var u=p(),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);n("【sentry】finalSentryConf:",l);var m=p(),v=m&&m.extraOptions&&m.extraOptions.perfConfig||{},w=Object.assign({},{sampleRate:.05,costTimeLimit:2e4,api:"https://front-perf.like-video.com/api/call",reportWaitMilliseconds:2e3},{sampleRate:.2},v);n("【perf】finalPerfConfig:",w);var _=function(){try{var e=navigator.userAgent,n=(e=(e=e.replace("__nimbus","")).replace("__webkit","")).match(/BIGO-baiguoyuan \((.+)\)/i);if(n){var o=n[1],t={},r=o.split("__");return["phoneName","appName","appVersion","sysName","sysVersion","appEnv","deviceid","userid","appVersionCode","countryCode"].forEach((function(e,n){t[e]=r[n]})),t}return{}}catch(e){return{}}}().countryCode;function g(e,o){var t=/^(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),r=t&&t[2];if(!r)return e;var a,i,c,s=p(),d=!1,u=(a=o&&o.customCountryCode||_,i=(s.countryCodeMap||{})[r]||{},(c="string"==typeof i?i:i[a])?e.replace(r,c):i.other?e.replace(r,i.other):""),f=function(){var n=(s.pageHostMap||{})[r]||{},o=location.host,t=("string"==typeof n?n:n[o])||n.other;if(t){if(0===t.indexOf("/")){var a=new RegExp("^(http://|https://|wss://|//)".concat(r),"");return d=!0,e.replace(a,t)}return e.replace(r,t)}return""}(),l="";return l=_?d?f||u||e:u||f||e:f||e,n("=============== 【begin doBlockHostReplace】 ================"),n("originApiUrl",e),n("finalApiUrlFromCCMap",u),n("finalApiUrlFromHostMap",f),n("finalUrl",l),n("=============== 【endof doBlockHostReplace】 ================"),l}function h(n,o,t){var r=n,a=o;if(t=t||{},e(p())){var i=(o||"")+n;o&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(n)?a=g(o,t):r=g(n,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,n,o){if(n in e){var t=o(e[n]);if("function"==typeof t)try{t.prototype=t.prototype||{}}catch(e){}e[n]=t}}(XMLHttpRequest.prototype,"open",(function(e){return function(){for(var n=arguments.length,o=new Array(n),t=0;t0)for(var r=0;r-1&&(a.onload=function(){o(2)},a.addEventListener("load",(function(){o(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)}();