window.__YSFWINTYPE__ = Number('3'); window.__YSFMODILEWINTYPE__ = Number('3'); window.__YSFTHEMELAYEROUT__ = 1; window.__YSFBGCOLOR__ = "#0099f2"; window.__YSFBGTONE__ = "notone"; window.__YSFBGIMG__ = ""; window.__YSFSDKADR__ = "https://qiyukf.com"; window.__YSFDASWITCH__ = 0; window.__YSFDAROOT__ = "https://da.qiyukf.com/webda/da.gif"; window.__YSFISGA__ = 0; window.__YSFVISITORRECORD__ = 1; window.__YSFISUPINFOTOSERVER__ = 0; window.__YSFAPPPATH__ = "/sdk/"; window.MIN_LBS = 'https://lbs.chatnos.com/lbs/webconf.jsp?devflag=qyonline'; !function(){function PromisePolyfill(e){this.state="pending";this.value=void 0;this.handlers=[];var t=function(e){if("pending"===this.state){this.state="fulfilled";this.value=e;this.handlers.forEach(function(t){t.onFulfilled(e)})}}.bind(this);var i=function(e){if("pending"===this.state){this.state="rejected";this.value=e;this.handlers.forEach(function(t){t.onRejected(e)})}}.bind(this);try{e(t,i)}catch(o){i(o)}}function execEvent(e,t){var i=ysf[e];if(util.isFunction(i))if(inited)return i.apply(null,t);else switch(e){case"onready":case"onLayerload":case"onunread":case"config":case"product":case"logoff":case"setAuthToken":case"pollAuthToken":case"onConversation":case"onSessionMessage":case"getConversation":case"cardMessage":case"customMessage":callbacksBeforeLoad.push({func:i,arg:t});break;case"open":case"url":case"track":case"getUnreadMsg":util.consoleWarn("can not exec"+e+"before sdk ready")}}function sendData2box(){function e(e){var t,i;var o="";for(i=0;i-1||~navigator.userAgent.indexOf("AppleWebKit"))&&navigator.userAgent.indexOf("Chrome")==-1)return!0;else return!1},isFirefox:function(){if(navigator.userAgent.indexOf("Firefox")!=-1)return!0;else return!1},getcookie:function(e){var t=document.cookie,i="\\b"+e+"=",o=t.search(i);if(o<0)return"";o+=i.length-2;var n=t.indexOf(";",o);if(n<0)n=t.length;return t.substring(o,n)||""},createAjax:function(){var e=null;var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.5.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];if(window.XMLHttpRequest){e=new XMLHttpRequest;if("withCredentials"in e)return e}if(window.xDomainRequest)e=new Window.xDomainRequest;return e},mergeParams:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i))t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")},ajax:function(conf){var method=conf.method||"get",contentType=conf.contentType,url=conf.url,data=conf.data,result={},success=conf.success,error=conf.error,fullResult=conf.fullResult||!1;var xhr=util.createAjax();if(xhr){try{if("GET"===method.toUpperCase())if(data)url=url+"?"+util.mergeParams(data);if(conf.synchronous)xhr.open(method,url,!1);else xhr.open(method,url)}catch(ex){console.error(ex);error(ex);return}xhr.onreadystatechange=function(){if(4==xhr.readyState)if(200===xhr.status){try{result=eval("("+xhr.responseText+")")}catch(err){error(err);return}if(200==(result&&result.code))success(fullResult?result:result.result);else error(result)}else error()};if("GET"==method.toUpperCase())xhr.send(null);else if("json"==contentType){xhr.setRequestHeader("content-type","application/json");xhr.send(JSON.stringify(data))}else{xhr.setRequestHeader("content-type","application/x-www-form-urlencoded");xhr.send(util.mergeParams(data))}}else error("NOT SUPPORT XHR")},findLocalItems:function(e,t){var i,o=[],n;for(i in localStorage)if(i.match(e)||!e&&"string"==typeof i){n=!t?localStorage.getItem(i):JSON.parse(localStorage.getItem(i));o.push({key:i,val:n})}return o},clearLocalItems:function(e){for(var t=0;t-1},addLoadEventForProxy:function(){function e(){for(var e=i.length-1;e>=0;e--)i[e]()}var t=!1;var i=[];return function(o){i.push(o);if(!t){if(proxy.addEventListener)proxy.addEventListener("load",e,!1);else if(proxy.attachEvent)proxy.attachEvent("onload",e);t=!0}}}(),mergeUrl:function(e,t){var i=e.split("?"),o=i.shift(),n=util.query2Object(i.shift()||"","&");for(var a in t)n[a]=t[a];return o+"?"+serialize(n)},query2Object:function(e,t){var i=e.split(t),o={};for(var n=0;n-1?i.icon:window.__YSFSDKADR__+i.icon});util.playAudio();e.onclick=function(){e&&e.close();window.focus();ysf.openLayer();ysf.NotifyMsgAndBubble({category:"clearCircle"})};t=window.setTimeout(function(){ e.close()},2e4)}}}(),playAudio:function(){if(window.__YSFSDKADR__){var e=document.createElement("audio");e.src="//ysf.nosdn.127.net/webapi/38a7410cdf36ef88290e0136e0f86998";return function(){e.play()}}}(),encode:function(e,t){t=""+t;if(!e||!t)return t||"";else return t.replace(e.r,function(t){var i=e[!e.i?t.toLowerCase():t];return null!=i?i:t})},escape:function(){var e=/$/,t={r:/\<|\>|\&|\r|\n|\s|\'|\"/g,"<":"<",">":">","&":"&"," ":" ",'"':""","'":"'","\n":"
","\r":""};return function(i){i=util.encode(t,i);return i.replace(e,"

")}}(),unescape:function(){var e={r:/\&(?:lt|gt|amp|nbsp|#39|quot)\;|\/gi,"<":"<",">":">","&":"&"," ":" ","'":"'",""":'"',"
":"\n"};return function(t){return util.encode(e,t)}}(),replaceRichAndUnescape:function(e){var t=/]+>/g;e=e.replace(t,"["+(local.IMAGE||"图片")+"]");var i=/<\/?[^>]*>/g;e=e.replace(i,"");return util.unescape(e)},consoleError:function(e){window.console&&window.console.error(e)},consoleWarn:function(e){window.console&&window.console.warn(e)},getToday:function(){var e=new Date;return e.getFullYear()+"-"+e.getMonth()+"-"+e.getDate()},Base64:function(){_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";this.encode=function(e){var t="";var i,o,n,a,c,r,s;var l=0;e=_utf8_encode(e);for(;l>2;c=(3&i)<<4|o>>4;r=(15&o)<<2|n>>6;s=63&n;if(isNaN(o))r=s=64;else if(isNaN(n))s=64;t=t+_keyStr.charAt(a)+_keyStr.charAt(c)+_keyStr.charAt(r)+_keyStr.charAt(s)}return t};this.decode=function(e){var t="";var i,o,n;var a,c,r,s;var l=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(;l>4;o=(15&c)<<4|r>>2;n=(3&r)<<6|s;t+=String.fromCharCode(i);if(64!=r)t+=String.fromCharCode(o);if(64!=s)t+=String.fromCharCode(n)}t=_utf8_decode(t);return t};_utf8_encode=function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var i=0;i127&&o<2048){t+=String.fromCharCode(o>>6|192);t+=String.fromCharCode(63&o|128)}else{t+=String.fromCharCode(o>>12|224);t+=String.fromCharCode(o>>6&63|128);t+=String.fromCharCode(63&o|128)}}return t};_utf8_decode=function(e){var t="";var i=0;var o=c1=c2=0;for(;i191&&o<224){c2=e.charCodeAt(i+1);t+=String.fromCharCode((31&o)<<6|63&c2);i+=2}else{c2=e.charCodeAt(i+1);c3=e.charCodeAt(i+2);t+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3);i+=3}}return t}},throttleDebounce:function(e,t,i){var o,n,a,c;var r=null;var s=null;var l=0;var m=Date.now||function(){return(new Date).getTime()};if(!i)i={};var f=function(){l=i.leading===!1?0:m();r=null;a=e.apply(o,n);if(!r)o=n=null};var d=function(){var i=m()-c;if(i=0)s=setTimeout(d,t-i);else{s=null;a=e.apply(o,n);if(!s)o=n=null}};return function(){var d=m();c=d;if(!l&&i.leading===!1)l=d;var u=t-(d-l);o=this;n=arguments;if(u<=0||u>t){if(r){clearTimeout(r);r=null}l=d;a=e.apply(o,n);if(!r)o=n=null}else{if(!r&&i.trailing!==!1)r=setTimeout(f,u);if(!s)s=setTimeout(f,t)}return a}},loadJS:function(e,t){var i=document.createElement("script"),o=t||function(){};i.type="text/javascript";i.async=!1;if(i.readyState)i.onreadystatechange=function(){if("loaded"==i.readyState||"complete"==i.readyState){i.onreadystatechange=null;o()}};else i.onload=function(){o()};i.src=e;document.getElementsByTagName("head")[0].appendChild(i)},includes:function(e,t){return String(e).indexOf(t)>-1},getSearchParams:function(e,t){var i=e.split("?")[1]||"";var o=util.query2Object(i,"&");return o[t]||null}};var corpStatus=!0;var winParam={};var cache={};var configKeys=[];var proxy;var chatProxy;var layerCnt;var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var firstBtnClick=!0;var hasConnected=!1;var connectTimer;var doConnectInterval=5e3;var CircleNumberFlag=0;var msgSessionIds=[];var getUnreadTimer;var unreadPollingInterval=5e3;var inited=!1;var callbacksBeforeLoad=[];var cachedArgs=[];var dvcswitched=!1;var callbacksBeforeLoadIsRun=!1;var initChatProxyBuild=!1;var chatProxySendConnect=!1;var maxTemplateId;var bodyscrollTop=0;if(window.ysf&&window.ysf.a)cachedArgs=window.ysf.a;if(window.ysf)var RESROOT=window.ysf.RESROOT;window.ysf=function(){try{var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return execEvent(e,t)}catch(i){}};ysf.ROOT=window.__YSFSDKADR__||"";ysf.RESROOT=RESROOT;var each=function(e,t){if(e&&t)for(var i in e)if(e.hasOwnProperty(i))t.call(null,i,e[i])};var rand=function(e){if(e)return"ysf-"+e;var t=[];for(var i=0,o;i<20;++i){o=Math.floor(Math.random()*chars.length);t.push(chars.charAt(o))}return t.join("").toLowerCase()};var initPageId=function(e){e=e||10;var t=[];for(var i=0,o;i';proxy=proxy.getElementsByTagName("IFRAME")[0];proxy.domain=document.domain;util.addLoadEventForProxy(function(){inited=!0;syncWebAnalytics();if(!util.isMobilePlatform());ysf.analytics(window.__YSFDASWITCH__);if(util.isFrameModule()){if(dvcswitched&&!callbacksBeforeLoadIsRun){callbacksBeforeLoadIsRun=!0;for(var e=0;e0;cache["IN_SESSION"]=1===e.dvcSwitch;updateUnread(e.count,e.lastMessage);if(e.count>0){var t=layerCnt&&layerCnt.getAttribute("data-switch");if("1"==t)sendChatMsg("doconnect",{reconnect:1})}if(e.needPolling)getUnreadTimer=setTimeout(getUnread,e.delay||unreadPollingInterval)},error:function(e){var t=unreadPollingInterval;if(e&&e.result&&e.result.delay)t=e.result.delay;if(!e||8112!=e.code&&19104!=e.code&&14001!=e.code&&16001!=e.code&&8013!=e.code)getUnreadTimer=setTimeout(getUnread,t)}});else getUnreadTimer=setTimeout(getUnread,unreadPollingInterval)};var updateUnread=function(e,t){if(e>0){if(ysf.isInInviteLayerMode())ysf.displayInviteLayer(!1);formatMessage(t);if(cache["notifyContent"]&&t.time';return t};var t=/(\[[^\]]+\])/gi;var i=window.__YSFSDKADR__+window.__YSFAPPPATH__+"res/portrait/emoji/";var o=window.__YSF_EMOJI__;return function(n){n=n.replace(/alt="(\[[^\]]+\])"/gi,'alt=""');var a=o.pmap;var c=o.pmap2;n=n.replace(t,function(t,n){if(c[n]){var r=e({id:c[n],tag:n,src:i+a[c[n]].file});return r}else if(o.mapEmojiLists&&o.mapEmojiLists.length){var s;for(var l=0;l)/g,"["+local.IMAGE+"]").replace(/


<\/p>/g,"").replace(/

/g,"pStartElement").replace(/<\/p>/g,"pCloseElement").replace(/<.+?>/g,"").replace(/pStartElement/g,"

").replace(/pCloseElement/g,"

");var c="";if(i)c='';t.innerHTML=c+'
';t.onclick=function(){if(ysf.isInInviteLayerMode())ysf.open({invitePatternVo:e.inviteSetting.invitePatternVo,inviteTemplateId:e.inviteSetting.id});else ysf.open();ysf.HAS_QIYU_OPEND=!0;ysf.displayInviteLayer(!1)};document.body.appendChild(t);if(i)document.querySelector("#YSF-ONLINE-INVITE-LAYER-CLOSE").onclick=function(e){e.stopPropagation();ysf.displayInviteLayer(!1);ysf.INVITE_REJECT=!0;setTimeout(function(){ysf.displayInviteLayer(!0)},1e3*inviteSetting.intervalTime)};if(e.inviteSetting&&1===e.inviteSetting.switchType&&e.inviteSetting.waitTime)setTimeout(function(){ysf.displayInviteLayer(!0)},1e3*e.inviteSetting.waitTime);return t};var i=function(e){var t=document.createElement("span");t.setAttribute("id","YSF-BTN-CIRCLE");e.appendChild(t)};var o=function(e){var t=document.createElement("div"),i=document.createElement("div"),o=document.createElement("span"),n=document.createElement("span");t.setAttribute("id","YSF-BTN-BUBBLE");i.setAttribute("id","YSF-BTN-CONTENT");o.setAttribute("id","YSF-BTN-ARROW");n.setAttribute("id","YSF-BTN-CLOSE");n.onclick=function(e){e.stopPropagation();e.preventDefault();ysf.NotifyMsgAndBubble({category:"clearCircle"})};e.appendChild(t);t.appendChild(i);t.appendChild(o);t.appendChild(n)};var n=t();i(n);o(n)};ysf.hasTodayInviteTimes=function(e){var t="YSF_INVITE_SHOW_TIMES";var i=JSON.parse(localStorage.getItem(t)||"{}")[util.getToday()]||0;var o=e&&1===e.switchType&&(0===i||1===e.rejectType&&(!e.timesLimitType||e.timesLimit>i)||0===e.rejectType&&!ysf.INVITE_REJECT&&(!e.timesLimitType||e.timesLimit>i));return o};ysf.setTodayShowInviteTimes=function(){var e="YSF_INVITE_SHOW_TIMES";var t=JSON.parse(localStorage.getItem(e)||"{}");var i=util.getToday();var o={};o[i]=t[i]?t[i]+1:1;localStorage.setItem(e,JSON.stringify(o));util.ajax({url:ysf.DOMAIN+"webapi/invite/num",method:"get",data:{appKey:cache.appKey},success:function(e){console.log("[success]会话邀请次数统计接口")},error:function(e){console.log("[err]会话邀请次数统计接口",e)}})};ysf.inviteText=function(e){var t=e&&e.invitePatternVo;var i="";if(t)i=0===t.robotSwitch?t.humanWelcomePrompt:t.robotWelcomePrompt;return i};ysf.isInInviteLayerMode=function(){return document.querySelector(".YSF-INVITE-LAYER-WRAPPER")&&"none"!==document.querySelector(".YSF-INVITE-LAYER-WRAPPER").style.display};ysf.isInvitedLayer=function(){var e=ysf.inviteText(window.inviteSetting);var t=window.inviteSetting&&window.inviteSetting.invitePatternVo&&1===window.inviteSetting.invitePatternVo.mode&&e&&ysf.hasTodayInviteTimes(window.inviteSetting)&&!ysf.HAS_MESSAGE_COUNT&&!cache["IN_SESSION"]&&!ysf.HAS_QIYU_OPEND&&!!cache["sessionInvite"];return t};ysf.displayInviteLayer=function(e){function t(e){return e?"block":"none"}e=e&&ysf.isInvitedLayer();if(e)ysf.setTodayShowInviteTimes();var i=document.querySelector("#YSF-BTN-HOLDER");var o="#YSF-CUSTOM-ENTRY-"+window.__YSFTHEMELAYEROUT__;var n=document.querySelector(".YSF-INVITE-LAYER-WRAPPER");var a=document.querySelector("#YSF-INVITE-LAYER-WRAPPER-ENTRY");var c=document.querySelector(o);var r=document.querySelector("#YSF-BTN-CIRCLE");var s=document.querySelector("#YSF-BTN-BUBBLE");if(ysf.inviteText(window.inviteSetting)){n.style.display=t(e);a.style.display=t(e)}c.style.display=t(!e);if(e){i.style.maxHeight="none";i.style.maxWidth="none";r.style.display=t(!1);s.style.display=t(!1)}};ysf.entryPanel=function(e,t){var i=document.createElement("div"),o=util.isFrameModule()?0:1;if(util.isMobilePlatform()){i.setAttribute("id","YSF-PANEL-MOBILE");i.onclick=function(){if(!ysf.inviteLayer.isInviteLayerShow())receivePkg({category:"closeIframe"})}}else parseInt(e)?i.setAttribute("id","YSF-PANEL-CORPINFO"):i.setAttribute("id","YSF-PANEL-INFO");i.className="ysf-chat-layer";document.body.appendChild(i);i.setAttribute("data-switch",o);layerCnt=i;try{sendChatMsg("status",{layerOpen:o})}catch(n){}createDvcTimer();if(cache.preloadIframe)ysf.openInline(ysf.url());if(t&&util.isFunction(t.success))t.success()};ysf.invite=function(){ var e,t,i,o=document.createDocumentFragment();var n=function(){if(!e){e=document.createElement("div");e.className="ysf-online-invite-wrap";if(i.style&&i.style.type){e.innerHTML='
';var t=e.childNodes[0],o=t.childNodes,n=o[0];if(util.isArray(i.style.oprs)){var s=null,l=null;for(var m=0;m';var t=e.childNodes[0],o=t.childNodes,f=o[0];if("innerText"in f)f.innerText=i.style.welcomeText;else f.textContent=i.style.welcomeText;t.onclick=function(){ysf.open({invited:1});r()};o[1].onclick=c;o[2].onload=function(){window.setTimeout(a,100)}}}};var a=function(){e.style.visibility="visible"};var c=function(e){e=e||window.event||{};if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=!0;r();ysf.INVITE_REJECT=!0;if(0!=i.rejectType)window.setTimeout(s,1e3*i.intervalTime)};var r=function(){o.appendChild(e);e.getElementsByTagName("IMG")[0].src=ysf.CDNROOT+"res/nej_blank.gif"};var s=function(){if(cache["sessionInvite"]&&ysf.hasTodayInviteTimes(window.inviteSetting)){ysf.setTodayShowInviteTimes();n();e.style.visibility="hidden";document.body.appendChild(e);e.getElementsByTagName("IMG")[0].src=i.style&&i.style.type?i.style.bdImageUrl:ysf.CDNROOT+"res/invite/1/bg.png"}};return function(e){if(!e||!e.invitePatternVo||0===e.invitePatternVo.mode){if(!i){i=e||{};if(util.isMobilePlatform())i.style=i.h5Style}var t=function(){window.setTimeout(s,1e3*(i.waitTime||15))};if(cache.timestamp)t();else cache.onackdone=t}}}();ysf.checkOpenLayerSize=function(e,t){var i=360,o=500;if(cache.layerSize&&!util.isMobilePlatform()){var n=cache.layerSize;var a=parseInt(n.height)>o;var c=parseInt(n.width)>i;if(!t){if(c)e.style.width=util.includes(n.width,"px")?n.width:n.width+"px";if(a)e.style.height=util.includes(n.height,"px")?n.height:n.height+"px"}else{c&&(e.style.width=0);a&&(e.style.height=0)}}};ysf.openLayer=function(){return function(e){var t=document.getElementById("YSF-PANEL-CORPINFO")||document.getElementById("YSF-PANEL-INFO")||document.getElementById("YSF-PANEL-MOBILE"),i=document.getElementById("YSF-BTN-HOLDER"),o=document.getElementById("YSF-IFRAME-LAYER");if(t){i.style.display="none";t.className="ysf-chat-layer ysf-chat-layeropen";ysf.checkOpenLayerSize(t);if(util.isMobilePlatform()&&o)o.className="ysf-chat-mobile-layeropen"+(e===ysf.INVITE_TPYE?" ysf-chat-mobile-invite-layer":"");bodyscrollTop=document.body.scrollTop||document.documentElement.scrollTop;if(document.getElementById("YSF-PANEL-MOBILE")){document.body.classList.add("YSF-PANEL-BODY-FIXED");document.getElementById("YSF-PANEL-MOBILE").addEventListener("touchmove",function(e){e.stopPropagation()})}t.setAttribute("data-switch",1);try{sendChatMsg("status",{layerOpen:1})}catch(n){}}}}();window.windowurl="";ysf.openWin=function(){return function(e,t,i){if(util.isMobilePlatform())if(i&&i.replace)window.location.replace(e);else window.location.href=e;else{window.windowurl=window.open(e,"YSF_SERVICE_"+(cache.appKey||"").toUpperCase(),t.param);if(!window.windowurl&&!util.isIe())window.location.href=e}}}();ysf.openUrl=function(){return function(e,t,i){var o=e.replace(/\/iframe/g,"");window.windowurl=window.open(o,"YSF_SERVICE_"+(cache.appKey||"").toUpperCase(),t.param);if(!window.windowurl&&!util.isIe())if(i&&i.replace)window.location.replace(o);else window.location.href=o}}();ysf.close=function(){if(window.windowurl)window.windowurl.close();else if("layer"===winParam.type){var e=document.getElementById("YSF-PANEL-CORPINFO")||document.getElementById("YSF-PANEL-INFO")||document.getElementById("YSF-PANEL-MOBILE"),t=document.getElementById("YSF-BTN-HOLDER");delete ysf.openInline.loadStatus;document.body.removeChild(e);document.body.removeChild(t);firstBtnClick=!0}};ysf.NotifyMsgAndBubble=function(e){var t={clearCircle:function(e){var t="YSF-"+device()+"-MSGNUMBERS",i=document.getElementById("YSF-BTN-CIRCLE"),o=document.getElementById("YSF-BTN-BUBBLE");o&&(o.style.display="none");i&&(i.style.display="none");localStorage.setItem(t,0);cache["notifyNumber"]=0;cache["notifyContent"]="";CircleNumberFlag=0},notifyCircle:function(e){var t="YSF-"+device()+"-MSGNUMBERS";localStorage.setItem(t,e.data.circleNum);var i=document.getElementById("YSF-BTN-BUBBLE"),o=document.getElementById("YSF-BTN-CONTENT"),n=document.getElementById("YSF-BTN-CIRCLE");var a=document.getElementById("YSF-PANEL-CORPINFO")||document.getElementById("YSF-PANEL-INFO")||document.getElementById("YSF-PANEL-MOBILE");var c={image:function(e){return"["+(local.IMAGE||"图片")+"]"},audio:function(e){return"["+(local.AUDIO||"音频")+"]"},video:function(e){return"["+(local.VIDEO||"视频")+"]"},file:function(e){return"["+(local.FILE||"文件")+"]"+e.name},text:function(e){return e},rich:function(e){return util.replaceRichAndUnescape(e)},productinfo:function(e){return"["+(local.PRD_LINK||"商品链接")+"]"},staffInviteDetail:function(e){return util.replaceRichAndUnescape(e)},userJoinEvaluate:function(e){return util.replaceRichAndUnescape(e)}};var r=util.isFrameModule()&&a&&0==a.getAttribute("data-switch")&&c[e.data.type]&&0==cache["sdkCustom"];if(!util.isFrameModule()||r){n&&(n.style.display="block");i&&(i.style.display="block");n&&(n.innerHTML=e.data.circleNum>99?"99+":e.data.circleNum);o&&(o.innerHTML=c[e.data.type](e.data.notifyCnt))}}};var i=t[e.category];if(i)i(e)};ysf.getUnreadMsg=function(){return{type:cache["notifyContent"].type,message:cache["notifyContent"].content,total:cache["notifyNumber"]}};ysf.getConversationThrottle=util.throttleDebounce(function(){getSessionList(ysf._onConversation)},2e3);ysf.initNim=function(){function e(e){var i=cache["yunxin-user"];if(!i)cache["yunxin-user"]=e;else t(i,e)}function t(e,t){each(t,function(t,i){e[t]=i});return e}function i(e){var i=e.idClient.split("#")[0];if(!i){console.error("msg idClient without #",e.idClient,e);return e}return t(e,{id:e.idClient,bid:e.from,sessionid:i})}function o(e,o){console.log(e,o,"_cbReceiveMessage");var c={image:"file",audio:"file",video:"file"};var r={60:!0,90:!0,95:!0,72:!0,200:!0,65:!0,203:!0,121:!0,59:!0};e=i(e);if("custom"!=e.type)a(t(e,{content:e[c[e.type]||e.type],reallyType:e.type}));else{e.isOffline=o;n(e,r)}}function n(e,i,o){var n=e.content||"";var c=[9,17,59,42,1002,"-1000",11056,108,11060];try{n=JSON.parse(n);if(i&&!i[n.cmd]&&!o)return;if(~c.indexOf(n.cmd)||~c.indexOf(o))return;if(65==n.cmd){n.content=util.replaceRichAndUnescape(n.content);e.content=JSON.stringify(n)}}catch(r){}var s=n.sessionid||n.currentSessionId||n.workSheetTemplateVo&&n.workSheetTemplateVo.sessionId;a(t(e,{cmd:n.cmd,sessionid:s}))}function a(e){ysf._onSessionMessage(e);if(cache["onConversation"])ysf.getConversationThrottle()}function c(t){console.log(t,"_cbConnect2Yunxin");if(t.ip)e({ip:t.ip});j(_.CONNECTED);m()}function r(e){var t={302:function(){console.error("连接失败")}};var i=t[e.code];if(util.isFunction(i))i.call(this);else if("string"==typeof i)t[i].call(this)}function s(){j(_.NULL)}function l(e){e.sort(function(e,t){return e.time>t.time});e.forEach(function(e){o(e,!0)})}function m(){var e=this;var t=function(){f({content:{cmd:-1e3,deviceid:device()}});if(e._timeout)clearTimeout(e._timeout);e._timeout=setTimeout(function(){t()},h)};t()}function f(e){ysf.nim.sendCustomSysMsg({to:e.bid||g,cc:!0,filter:!0,scene:"p2p",content:JSON.stringify(e.content),done:e.done})}function d(){ysf.nim&&ysf.nim.disconnect();j(_.NULL)}function u(){return~ysf.DOMAIN.indexOf("qytest.netease")}var _={NULL:0,INIT:1,CONNECTED:2};var g=-1;var p=3e3;var y=_.NULL;var h=8e3;var v=function(){return{db:!1,syncBroadcastMsgs:!1,syncExtraTeamInfo:!1,syncFilter:!0,syncFriendUsers:!1,syncFriends:!1,syncRelations:!1,syncRoamingMsgs:!1,syncRobots:!1,syncSessionUnread:!1,syncStickTopSessions:!1,syncSuperTeamRoamingMsgs:!1,syncSuperTeams:!1,syncTeamMembers:!1,syncTeams:!1,defaultLinkUrl:"https://weblink-qiyu.netease.im",privateConf:{lbs_web:window.MIN_LBS},onmsg:o,onerror:r,onconnect:c,ondisconnect:s,oncustomsysmsg:n,onofflinefiltermsgs:l}}();var j=function(e){cache["yinxin-state"]=e};var I=function(){return cache["yinxin-state"]};var w=function(e){var t=cache["yunxin-user"]||{};if(window.localStorage){var i="X-"+e.toUpperCase()+"-YSF-INFO",o=localStorage.getItem(i);if(!o)return;var n=util.query2Object(o);if(n.uid)t.fid=n.uid;n.source=o;return n}};var S=function(e){try{return JSON.parse(e)}catch(t){return null}};var T=function(i,o){if(o){e(o);o.appKey=i;t(o,v);window.nim=ysf.nim=new NIM(o);getSessionList(ysf._getConversation)()}else window.setTimeout(C._$bind(this,appkey),p)};var E=function(e,t){util.ajax({url:ysf.DOMAIN+"webapi/user/create.action?appKey="+t,data:e,method:"post",fullResult:!0,contentType:"json",success:function(e){var i=e.info;e.result={token:i.token,account:i.accid,exchange:i.exchange,bid:i.bid};T(t,e.result)},error:function(e){console.log(e,"userCreate error")}})};var C=function(e){var t={deviceid:cache.uid||cache.device,appKey:e,token:cache.uuid||""};if(cache.uid)t.foreignid=cache.uid;if(cache.authToken)t.authtoken=cache.authToken;E(t,e)};var N=function(e,t){if(util.isArray(e)&&util.isFunction(t)){var i=e.length;var o=0;e.forEach(function(e){util.loadJS(e,function(){o++;if(o>=i)t()})})}};return{_$connect:function(e){ d();if(I()===_.NULL){j(_.INIT);var t=["//res.qiyukf.net/storage/NIM_Web_NIM_v9.8.103.js"];N(t,function(){C(e)})}},_$disConnect:function(){d()}}}();ysf.checkBaiduSelfBuild=function(){try{var e=document.referrer;var t=util.getSearchParams(e,"xst");if(t&&util.includes(e,"baidu.com"))return t;else return null}catch(i){return null}};ysf.config=function(e,t){if(e){e.reallyUid=e.uid;merge(e);if(!t)each(e,function(e){if(configKeys.indexOf(e)<0)configKeys.push(e)});if(cache.appKey){refresh(e.uid);syncProfile({upToServer:!0,success:e.success,error:e.error,local:t||0});initWinConfig();getUnread();if(cache["connectYunxin"])ysf.initNim._$connect(cache["appKey"])}}};var childMerchantsIsOpen=function(e,t){util.ajax({url:ysf.DOMAIN+"webapi/user/company/get/getCorpStatus.action",method:"get",data:{appKey:cache.appKey,shopCode:e},success:function(e){corpStatus=e;if(util.isFunction(t))t()},error:function(e){console.log("[err]平台企业子企业是否开启",e);if(util.isFunction(t))t()}})};ysf.url=function(e,t){if(!cache.appKey)return"";var i={k:cache.appKey,u:cache.uid||"",d:device(),uuid:cache.uuid,gid:cache.groupid||0,sid:cache.staffid||0,qtype:cache.qtype||0,welcomeTemplateId:cache.welcomeTemplateId||0,dvctimer:cache.dvctimer||0,robotShuntSwitch:cache.robotShuntSwitch||0,hc:cache.hc||0,robotId:cache.robotId||0,pageId:ysf.PAGEID,shuntId:cache.shuntId||0,ctm:(new util.Base64).encode(cache.uid+"--"+(new Date).getTime()),wxwId:cache.wxworkAppId||"",language:cache.language||"",isShowBack:cache.isShowBack||0,shortcutTemplateId:cache.shortcutTemplateId||""};if(1==cache.spkf)i.spkf=1;if(cache.APPbackPop)i.APPbackPop=cache.APPbackPop;if(cache.APPBridgePermission)i.APPBridgePermission=cache.APPBridgePermission;if(cache.usealipayjs)i.usealipayjs=cache.usealipayjs;if(cache.isCaptureSupported)i.isCaptureSupported=cache.isCaptureSupported;if(cache.isCustomPickSource)i.isCustomPickSource=cache.isCustomPickSource;if(cache.usewxjs)i.usewxjs=cache.usewxjs;if(cache.downloadPageUrl)i.downloadPageUrl=cache.downloadPageUrl;if(cache.customUrl)i.customUrl=cache.customUrl;if(cache.appName)i.appName=cache.appName;if(cache.checkPermission)i.checkPermission=cache.checkPermission;if(cache.disableMultiple)i.disableMultiple=cache.disableMultiple;if(cache.emojiPopoverWidth)i.emojiPopoverWidth=cache.emojiPopoverWidth;if(t==ysf.INVITE_TPYE)i.isInvite=1;if(window.sdkTemplateId)i.templateId=window.sdkTemplateId;if(window.shuntId)i.shuntId=window.shuntId;if(e&&e.templateId)i.templateId=e.templateId;if(e&&e.invited)i.invited=1;if(e&&e.invitePatternVo&&t!=ysf.INVITE_TPYE){i.invited=1;i.inviteTemplateId=e.inviteTemplateId;i.robotSwitch=e.invitePatternVo.robotSwitch;i.humanWelcomeTemplateId=e.invitePatternVo.welcomeTemplateId;i.robotId=e.invitePatternVo.robotId;i.welcomeTemplateId=e.invitePatternVo.robotWelcomeTemplateId;i.inviteGroupId=e.invitePatternVo.inviteGroupId}if(!util.isMobilePlatform()&&1==window.__YSFWINTYPE__&&cache.layerSize&&cache.layerSize.inputHeight)i.ipth=cache.layerSize.inputHeight;if(e&&e.language)i.language=e.language;if(cache.unconfirm)i.unconfirm=cache.unconfirm;if(cache["debugger"])i["debugger"]=cache["debugger"];if(!util.isMobilePlatform()&&1==window.__YSFWINTYPE__)i.allowNewTab=cache.allowNewTab||0;each({n:"name",e:"email",m:"mobile"},function(e,t){var o=cache[t];if(o)i[e]=o});if(cache.customSkin)each({topbarBgColor:"topbarBgColor",chatPanelBgColor:"chatPanelBgColor",lMsgColor:"lMsgColor",rMsgColor:"rMsgColor",lMsgBgColor:"lMsgBgColor",rMsgBgColor:"rMsgBgColor",buttonColor:"buttonColor",buttonBgColor:"buttonBgColor",editorColor:"editorColor",editorBgColor:"editorBgColor",corpInfoColor:"corpInfoColor",corpInfoTitleColor:"corpInfoTitleColor",corpInfoBgColor:"corpInfoBgColor",tipColor:"tipColor",linkColor:"linkColor",borderColor:"borderColor"},function(e,t){var o=cache.customSkin[t];if(o)i[e]=o});i.t=encodeURIComponent(cache.title||document.title);if(cache.goodsCId)i.goodsCId=cache.goodsCId;if(cache.goodsCName)i.goodsCName=cache.goodsCName;if(cache.goodsId)i.goodsId=cache.goodsId;if(cache.orderId)i.orderId=cache.orderId;if(cache.orderStageType)i.orderStageType=cache.orderStageType;if((e&&e.bid||cache.bid)&&corpStatus){i.bid=e&&e.bid||cache.bid;return ysf.getImRoot(t)+"/trade?"+serialize(i)}return ysf.getImRoot(t)+"?"+serialize(i)};ysf.track=function(e,t){var i=cache.appKey,o=device(),n=encodeURIComponent(location.href),a=localStorage.getItem("DA-LANDPAGE")||"",c=(new Date).getTime(),r=e,s="";desc=JSON.stringify(t),tp=1;var l=function(){try{var e=window.__YSFDAROOT__+"?ak="+i+"&dv="+o+"&cup="+n+"&lp="+a+"&tm="+c+"&ct="+r+"<="+s+"&tp="+tp+"&desc="+desc+"&u="+window.ysf.PAGEID;loadImage(e)}catch(t){}};l()};ysf.logoff=function(){updateDevice();util.clearLocalItems(util.findLocalItems(/msgnumbers/gi));configKeys.forEach(function(e){delete cache[e]})};ysf.openByLink=function(e){var t=ysf.url();if(t){e=e||{};var i=e.target||e.srcElement;if(i&&"A"==i.tagName)i.href=t}};var formatProduct=function(e){if(e.clear)return null;e.title=e.title&&e.title.length>100?e.title.slice(0,100):e.title;e.desc=e.desc&&e.desc.length>300?e.desc.slice(0,300):e.desc;e.note=e.note&&e.note.length>100?e.note.slice(0,100):e.note;var t={pageId:ysf.PAGEID,template:e.template,cardType:e.cardType,sendByUser:e.sendByUser,auto:1===e.sendByUser?0:1,show:1===e.sendByUser?1:e.show,actionText:e.actionText,actionTextColor:e.actionTextColor,sendProToRobot:e.sendProToRobot,picture:e.picture,title:e.title,desc:e.desc,url:e.url,note:e.note,price:e.price,goodsId:e.goodsId,goodsCId:e.goodsCId,goodsCName:e.goodsCName,intent:e.intent,payMoney:e.payMoney,orderId:e.orderId,orderTime:e.orderTime,orderSku:e.orderSku,orderCount:e.orderCount,orderStatus:e.orderStatus,orderStageType:e.orderStageType,floatCardSend:e.floatCardSend||0,info:e.info,agentId:e.agentId};if(e.tags&&util.isArray(e.tags))t.tags=JSON.stringify(e.tags);if(e.sendKefuOffline)t.sendKefuOffline=e.sendKefuOffline;if(e.customLabel)t.customLabel=JSON.stringify(e.customLabel);if(e.params)t.params=e.params;if(cache.bid)t.bid=cache.bid;return t};ysf.product=function(e){var t=formatProduct(e);syncCustomProfile({data:t,success:e.success,error:e.error})};ysf.clearProduct=function(e){e=e||{};ysf.product({clear:!0,success:e.success,error:e.error})};var formatCardMessage=function(e){if(e.clear)return null;var t={uuid:e.uuid,type:e.type,cards:e.cards||[],floatCards:e.floatCards||[],auto:1===e.sendByUser?0:1,sendByUser:e.sendByUser,sendKefuOffline:e.sendKefuOffline||0,sendProToRobot:e.sendProToRobot,intent:e.intent,params:e.params||{}};if(1===e.sendByUser){if(e.actionText)t.actionText=e.actionText;if(e.actionTextColor)t.actionTextColor=e.actionTextColor;if(e.hideAction)t.hideAction=e.hideAction}if(cache.bid)t.bid=cache.bid;return t};ysf.cardMessage=function(e){if(!e.clear)if(e.cards&&0!==e.cards.length){var t=formatCardMessage(e);syncCardInfoProfile({data:t,success:e.success,error:e.error})}else{console.error("cards is required");e.error&&e.error("cards is required")}else syncCardInfoProfile({data:null,success:e.success,error:e.error})};var formatCustomMessage=function(e){if(void 0===e.data||null===e.data)return null;var t={uuid:e.uuid,data:e.data,description:e.description||"",auto:1===e.sendByUser?0:1,sendByUser:e.sendByUser};if(1===e.sendByUser){if(e.actionText)t.actionText=e.actionText;if(e.actionTextColor)t.actionTextColor=e.actionTextColor;if(e.hideAction)t.hideAction=e.hideAction}if(cache.bid)t.bid=cache.bid;return t};ysf.customMessage=function(e){var t=formatCustomMessage(e);syncCustomMessageProfile({data:t,success:e.success,error:e.error})};ysf.sendProduct=function(e){var t=e.success;var i=e.error;delete e.success;delete e.error;var o=formatProduct(e);sendChatMsgNew({type:"sendProduct",data:o}).then(t)["catch"](i)};ysf.sendCardMessage=function(e){if(e.cards&&0!==e.cards.length){var t=e.success;var i=e.error;delete e.success;delete e.error;var o=formatCardMessage(e);sendChatMsgNew({type:"sendCardMessage",data:o}).then(t)["catch"](i)}else{console.error("cards is required");e.error&&e.error("cards is required")}};ysf.clearCustomCard=function(e){e=e||{};ysf.cardMessage({clear:!0,success:e.success,error:e.error})};ysf.sendCustomMessage=function(e){var t=e.success;var i=e.error;delete e.success;delete e.error;var o=formatCustomMessage(e);sendChatMsgNew({type:"sendCustomMessage",data:o}).then(t)["catch"](i)};ysf.open=function(e,t,i){maxTemplateId=e;var o=ysf.url(e,t);if(o){var n=t||winParam.type;switch(n){case"win":ysf.openWin(o,winParam,i);break;case"layer":ysf.openInline(o,function(){var i=e&&e.invitePatternVo&&2==e.invitePatternVo.screenType&&util.isMobilePlatform()?"":t;ysf.openLayer(i);try{if(firstBtnClick&&0==cache["dvcswitch"]){sendChatMsg("doconnect",{doconnect:1});firstBtnClick=!1}}catch(o){}if(0==cache["dvcswitch"]&&1==cache["pushswitch"]||CircleNumberFlag>0){sendChatMsg("dopushmsgread",{ids:msgSessionIds});msgSessionIds=[]}if(!firstBtnClick&&cache["notifyNumber"]>0)sendChatMsg("doconnect");ysf.NotifyMsgAndBubble({category:"clearCircle"})});break;case"url":ysf.openUrl(o,winParam,i)}}};ysf.init=function(e,t,i){window.inviteSetting=t||{};var o=function(){ysf.entry({src:e,inviteSetting:t||{}});var o=t&&t.invitePatternVo&&2===t.invitePatternVo.mode&&1===t.switchType;if(util.isFrameModule()||o)ysf.entryPanel(cache["corpInfo"],i);ysf.showInviteLayerAuto(t)};if(util.isFrameModule())setTimeout(function(){util.ajax({url:ysf.DOMAIN+"webapi/user/dvcSession.action?appKey="+cache["appKey"]+"&d="+cache["device"]+"&f="+cache["uid"],method:"post",success:function(e){dvcswitched=!0;cache["dvcswitch"]=e.dvcSwitch;cache["pushswitch"]=e.pushSwitch||0;cache["pushmsgid"]=e.batchIdList||0;if("mobileFrame"==util.isFrameModule())cache["dvcswitch"]=0;o();if(inited&&!callbacksBeforeLoadIsRun){callbacksBeforeLoadIsRun=!0;for(var t=0;t0)localStorage.setItem(e,--i);util.clearLocalItems(util.findLocalItems(new RegExp(t,"ig")))});ysf.on=function(){var e={onload:"load",unread:1};return function(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/object/gi.test(t)){for(var i in e)if("onload"==i&&util.isFunction(e[i]))if(!inited)util.addLoadEventForProxy(e[i]);else e[i]();else if("onLayerload"==i&&util.isFunction(e[i]))if("loaded"==ysf.openInline.loadStatus)e[i]();else ysf["_"+i]=e[i];else if(util.isFunction(ysf[i])&&util.isFunction(e[i]))ysf["_"+i]=e[i]}else util.consoleWarn("波比(。・∀・)ノ: 请保持正确的监听姿势...")}}();ysf.getPushMessage=function(e){sendChatMsg("dogetpushmsg",{ids:e})};ysf._unread=function(){};ysf.unread=function(){return{type:cache["notifyContent"].type,message:cache["notifyContent"].content,total:cache["notifyNumber"]}};ysf._onLayerload=function(){};ysf.clearDragresize=function(e){try{var t=window.location.hostname.split(".")[0];var i=["callcenter","session","qualitysession","qualitycallsession","worksheet","callflow","leave","monitor","usercenter"];if(i.indexOf(e)>-1)util.clearLocalItems(util.findLocalItems(new RegExp(t+"-"+e,"ig")));else for(var o=0;o