!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("@baidu/codeCover",["require"],e):t.urlEncodeCheck=e()}(this,(function(){"use strict";return function(){function t(t){this.pid="",this.sendFn=t,this.ls=this.initStorage(),this.sendNum=0,this.CVObj={},this.random=Math.random(),this.pid="19_103",this.sampleArr=[1e-4,1,.1,.01,.001,1e-4,1e-5];var e=parseInt(this.ls.getItem("CVStringTimestamp"))||0;if((new Date).getTime()>e)this.ls.setItem("CVObj",""),this.ls.setItem("CVStringTimestamp",this.getEndTimestamp());else try{this.CVObj=JSON.parse(this.ls.getItem("CVObj")||"{}")}catch(t){}}return t.prototype.init=function(){var t=this;"function"==typeof window.requestIdleCallback?window.requestIdleCallback((function(){t.sendDomCVcLog()})):setTimeout((function(){t.sendDomCVcLog()}),2e3)},t.prototype.send=function(t,e,n){void 0===e&&(e=0);var i=t.split("_"),o=!0;i.forEach((function(t){o=!isNaN(+t)&&o})),this.sendNum>10||2!==i.length||!o||this.setLog(t,this.sampleArr[e],n)},t.prototype.sendDomCVcLog=function(){var t=$("*[data-cv]");this.random0&&this.sendFn("et_comm",{msg:"Record data_cv length",length:t.length,url:window.location.href},{},{},{group:"codeCoverage"});for(var e=0;e10);e++){var n=t[e].getAttribute("data-cv");if(n){var i=n.split("_"),o="0";if(2!==i.length&&3!==i.length)continue;3===i.length&&(o=i.shift()||"",n=i.join("_")),t[e].removeAttribute("data-cv"),this.send(n,+o)}}},t.prototype.initStorage=function(){var t={enabled:!0};try{localStorage.setItem("_t","1"),localStorage.removeItem("_t")}catch(e){t.enabled=!1}return t.enabled?localStorage:{enabled:!1,storgae:{},setItem:function(t,e){this.storgae[t]=e},getItem:function(t){return this.storgae[t]}}},t.prototype.setLog=function(t,e,n){if(!(this.CVObj.hasOwnProperty(t)||this.random>e)){this.CVObj[t]=!0,this.ls.setItem("CVObj",JSON.stringify(this.CVObj)),this.sendNum++;var i={msg:t,url:window.location.href},o={group:"codeCoverage"};n&&(o.ext={info:n}),this.sendFn("et_comm",i,{},{},o)}},t.prototype.getEndTimestamp=function(){return(new Date).getTime()+864e5+""},t}()}));