UNPKG

@log-reporting/core

Version:
1 lines 87.6 kB
var logReportingCore=(i=>{let l="undefined"!=typeof window?window:{},n=(l.__log_reporting__=l.__log_reporting__||{},l.__log_reporting__),r=console.log,c=new class{constructor(){}log(e,t){r(`%c${e}%c `+t,"color: #fff;font-weight: blod;letter-spacing:2px;padding: 3px 5px;background-color: #73767a;border-radius: 3px;","color: #909399;font-weight: blod;letter-spacing:2px;padding: 3px 5px;")}info(e,t){r(`%c${e}%c `+t,"color: #fff;font-weight: blod;letter-spacing:2px;padding: 3px 5px;background-color: #337ecc;border-radius: 3px;","color: #409EFF;font-weight: blod;letter-spacing:2px;padding: 3px 5px;")}warn(e,t){r(`%c${e}%c `+t,"color: #fff;font-weight: blod;letter-spacing:2px;padding: 3px 5px;background-color: #b88230;border-radius: 3px;","color: #E6A23C;font-weight: blod;letter-spacing:2px;padding: 3px 5px;")}error(e,t){r(`%c${e}%c `+t,"color: #fff;font-weight: blod;letter-spacing:2px;padding: 3px 5px;background-color: #c45656;border-radius: 3px;","color: #F56C6C;font-weight: blod;letter-spacing:2px;padding: 3px 5px;")}success(e,t){r(`%c${e}%c `+t,"color: #fff;font-weight: blod;letter-spacing:2px;padding: 3px 5px;background-color: #529b2e;border-radius: 3px;","color: #67C23A;font-weight: blod;letter-spacing:2px;padding: 3px 5px;")}};function A(e,t){return Object.prototype.hasOwnProperty.call(t,e)}function w(e,t,r,o=!1){e.addEventListener(t,r,o)}function k(e){var t,r,o={};for([t,r]of new URLSearchParams(e).entries())o[t]=r;return o}c.log,c,c,c,c;class E{constructor(e){this.options=e}}let M,d=(i.EVENT_TYPES=void 0,(a=i.EVENT_TYPES||(i.EVENT_TYPES={})).ERROR="error",a.UNHANDLEDREJECTION="unhandledrejection",a.CONSOLE_ERROR="consoleError",a.XHR="xhr",a.FETCH="fetch",a.PV="pv",a.EXPOSURE="exposure",i.ERROR_TYPES=void 0,(a=i.ERROR_TYPES||(i.ERROR_TYPES={})).JS="js_error",a.PROMISE="promise_error",a.CONSOLE_ERROR="console_error",a.XHR="xhr_error",a.FETCH="fetch_error",n.eventBus||(n.eventBus=class Ir{constructor(){this._eventMap=new Map}static getInstance(){return this._instance||(this._instance=new Ir),this._instance}on(e,t){this._eventMap.has(e)||this._eventMap.set(e,[]),null!=(e=this._eventMap.get(e))&&e.push(t)}emit(e,...t){this._eventMap.has(e)&&null!=(e=this._eventMap.get(e))&&e.forEach(e=>{e(...t)})}off(r,o){var e;this._eventMap.has(r)&&null!=(e=this._eventMap.get(r))&&e.forEach((e,t)=>{e===o&&null!=(e=this._eventMap.get(r))&&e.splice(t,1)})}once(r,o){var e;this._eventMap.has(r)&&null!=(e=this._eventMap.get(r))&&e.forEach((e,t)=>{e===o&&null!=(e=this._eventMap.get(r))&&e.splice(t,1)})}}.getInstance()));function e(e){return e in navigator?navigator[e]:"该浏览器不支持!"}function T(){return{platform:e("platform"),appName:e("appName"),appVersion:e("appVersion"),appCodeName:e("appCodeName"),vendor:e("vendor"),userAgent:e("userAgent"),onLine:e("onLine"),language:e("language"),product:e("product"),productSub:e("productSub"),windowWidth:window.screen.width,windowHeight:window.screen.height,colorDepth:window.screen.colorDepth}}function R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var I,N,O,o,s,D;function _(e,t){if(!o[e]){o[e]={};for(var r=0;r<e.length;r++)o[e][e.charAt(r)]=r}return o[e][t]}t=a={exports:{}},I=String.fromCharCode,N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",o={},D=s={compressToBase64:function(e){if(null==e)return"";var t=s._compress(e,6,function(e){return N.charAt(e)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(t){return null==t?"":""==t?null:s._decompress(t.length,32,function(e){return _(N,t.charAt(e))})},compressToUTF16:function(e){return null==e?"":s._compress(e,15,function(e){return I(e+32)})+" "},decompressFromUTF16:function(t){return null==t?"":""==t?null:s._decompress(t.length,16384,function(e){return t.charCodeAt(e)-32})},compressToUint8Array:function(e){for(var t=s.compress(e),r=new Uint8Array(2*t.length),o=0,n=t.length;o<n;o++){var a=t.charCodeAt(o);r[2*o]=a>>>8,r[2*o+1]=a%256}return r},decompressFromUint8Array:function(e){if(null==e)return s.decompress(e);for(var t=new Array(e.length/2),r=0,o=t.length;r<o;r++)t[r]=256*e[2*r]+e[2*r+1];var n=[];return t.forEach(function(e){n.push(I(e))}),s.decompress(n.join(""))},compressToEncodedURIComponent:function(e){return null==e?"":s._compress(e,6,function(e){return O.charAt(e)})},decompressFromEncodedURIComponent:function(t){return null==t?"":""==t?null:(t=t.replace(/ /g,"+"),s._decompress(t.length,32,function(e){return _(O,t.charAt(e))}))},compress:function(e){return s._compress(e,16,function(e){return I(e)})},_compress:function(e,t,r){if(null==e)return"";for(var o,n,a,s,i={},l={},c="",d=2,u=3,p=2,h=[],g=0,m=0,f=0;f<e.length;f+=1)if(a=e.charAt(f),Object.prototype.hasOwnProperty.call(i,a)||(i[a]=u++,l[a]=!0),s=c+a,Object.prototype.hasOwnProperty.call(i,s))c=s;else{if(Object.prototype.hasOwnProperty.call(l,c)){if(c.charCodeAt(0)<256){for(o=0;o<p;o++)g<<=1,m==t-1?(m=0,h.push(r(g)),g=0):m++;for(n=c.charCodeAt(0),o=0;o<8;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1}else{for(n=1,o=0;o<p;o++)g=g<<1|n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n=0;for(n=c.charCodeAt(0),o=0;o<16;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1}0==--d&&(d=Math.pow(2,p),p++),delete l[c]}else for(n=i[c],o=0;o<p;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1;0==--d&&(d=Math.pow(2,p),p++),i[s]=u++,c=String(a)}if(""!==c){if(Object.prototype.hasOwnProperty.call(l,c)){if(c.charCodeAt(0)<256){for(o=0;o<p;o++)g<<=1,m==t-1?(m=0,h.push(r(g)),g=0):m++;for(n=c.charCodeAt(0),o=0;o<8;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1}else{for(n=1,o=0;o<p;o++)g=g<<1|n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n=0;for(n=c.charCodeAt(0),o=0;o<16;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1}0==--d&&(d=Math.pow(2,p),p++),delete l[c]}else for(n=i[c],o=0;o<p;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1;0==--d&&(d=Math.pow(2,p),p++)}for(n=2,o=0;o<p;o++)g=g<<1|1&n,m==t-1?(m=0,h.push(r(g)),g=0):m++,n>>=1;for(;;){if(g<<=1,m==t-1){h.push(r(g));break}m++}return h.join("")},decompress:function(t){return null==t?"":""==t?null:s._decompress(t.length,32768,function(e){return t.charCodeAt(e)})},_decompress:function(e,t,r){for(var o,n,a,s,i,l,c=[],d=4,u=4,p=3,h="",g=[],m={val:r(0),position:t,index:1},f=0;f<3;f+=1)c[f]=f;for(n=0,s=Math.pow(2,2),i=1;i!=s;)a=m.val&m.position,m.position>>=1,0==m.position&&(m.position=t,m.val=r(m.index++)),n|=(0<a?1:0)*i,i<<=1;switch(n){case 0:for(n=0,s=Math.pow(2,8),i=1;i!=s;)a=m.val&m.position,m.position>>=1,0==m.position&&(m.position=t,m.val=r(m.index++)),n|=(0<a?1:0)*i,i<<=1;l=I(n);break;case 1:for(n=0,s=Math.pow(2,16),i=1;i!=s;)a=m.val&m.position,m.position>>=1,0==m.position&&(m.position=t,m.val=r(m.index++)),n|=(0<a?1:0)*i,i<<=1;l=I(n);break;case 2:return""}for(o=c[3]=l,g.push(l);;){if(e<m.index)return"";for(n=0,s=Math.pow(2,p),i=1;i!=s;)a=m.val&m.position,m.position>>=1,0==m.position&&(m.position=t,m.val=r(m.index++)),n|=(0<a?1:0)*i,i<<=1;switch(l=n){case 0:for(n=0,s=Math.pow(2,8),i=1;i!=s;)a=m.val&m.position,m.position>>=1,0==m.position&&(m.position=t,m.val=r(m.index++)),n|=(0<a?1:0)*i,i<<=1;c[u++]=I(n),l=u-1,d--;break;case 1:for(n=0,s=Math.pow(2,16),i=1;i!=s;)a=m.val&m.position,m.position>>=1,0==m.position&&(m.position=t,m.val=r(m.index++)),n|=(0<a?1:0)*i,i<<=1;c[u++]=I(n),l=u-1,d--;break;case 2:return g.join("")}if(0==d&&(d=Math.pow(2,p),p++),c[l])h=c[l];else{if(l!==u)return null;h=o+o.charAt(0)}g.push(h),c[u++]=o+h.charAt(0),o=h,0==--d&&(d=Math.pow(2,p),p++)}}},null!=t?t.exports=D:"undefined"!=typeof angular&&null!=angular&&angular.module("LZString",[]).factory("LZString",function(){return D});var B=R(a.exports),t="3.7.7",a="function"==typeof Buffer;let V="function"==typeof TextDecoder?new TextDecoder:void 0,U="function"==typeof TextEncoder?new TextEncoder:void 0,u=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),X=(e=>{let r={};return e.forEach((e,t)=>r[e]=t),r})(u),Q=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,p=String.fromCharCode.bind(String),q="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),$=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),ee=e=>e.replace(/[^A-Za-z0-9\+\/]/g,"");var te=t=>{let r,o,n,a,s="";var e=t.length%3;for(let e=0;e<t.length;){if(255<(o=t.charCodeAt(e++))||255<(n=t.charCodeAt(e++))||255<(a=t.charCodeAt(e++)))throw new TypeError("invalid character found");r=o<<16|n<<8|a,s+=u[r>>18&63]+u[r>>12&63]+u[r>>6&63]+u[63&r]}return e?s.slice(0,e-3)+"===".substring(e):s};let re="function"==typeof btoa?e=>btoa(e):a?e=>Buffer.from(e,"binary").toString("base64"):te,oe=a?e=>Buffer.from(e).toString("base64"):r=>{var o=[];for(let e=0,t=r.length;e<t;e+=4096)o.push(p.apply(null,r.subarray(e,e+4096)));return re(o.join(""))},ne=(e,t=!1)=>t?$(oe(e)):oe(e),ae=e=>{var t;return e.length<2?(t=e.charCodeAt(0))<128?e:t<2048?p(192|t>>>6)+p(128|63&t):p(224|t>>>12&15)+p(128|t>>>6&63)+p(128|63&t):(t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320),p(240|t>>>18&7)+p(128|t>>>12&63)+p(128|t>>>6&63)+p(128|63&t))},se=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ie=e=>e.replace(se,ae),le=a?e=>Buffer.from(e,"utf8").toString("base64"):U?e=>oe(U.encode(e)):e=>re(ie(e)),h=(e,t=!1)=>t?$(le(e)):le(e);var g=e=>h(e,!0);let ce=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,de=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return p(55296+(t>>>10))+p(56320+(1023&t));case 3:return p((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return p((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},ue=e=>e.replace(ce,de);var pe=t=>{if(t=t.replace(/\s+/g,""),!Q.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let r,o="",n,a;for(let e=0;e<t.length;)r=X[t.charAt(e++)]<<18|X[t.charAt(e++)]<<12|(n=X[t.charAt(e++)])<<6|(a=X[t.charAt(e++)]),o+=64===n?p(r>>16&255):64===a?p(r>>16&255,r>>8&255):p(r>>16&255,r>>8&255,255&r);return o};let he="function"==typeof atob?e=>atob(ee(e)):a?e=>Buffer.from(e,"base64").toString("binary"):pe,ge=a?e=>q(Buffer.from(e,"base64")):e=>q(he(e).split("").map(e=>e.charCodeAt(0))),me=e=>ge(Ie(e)),fe=a?e=>Buffer.from(e,"base64").toString("utf8"):V?e=>V.decode(ge(e)):e=>ue(he(e)),Ie=e=>ee(e.replace(/[-_]/g,e=>"-"==e?"+":"/")),Ce=e=>fe(Ie(e));function ye(){var e=(e,t)=>Object.defineProperty(String.prototype,e,ve(t));e("fromBase64",function(){return Ce(this)}),e("toBase64",function(e){return h(this,e)}),e("toBase64URI",function(){return h(this,!0)}),e("toBase64URL",function(){return h(this,!0)}),e("toUint8Array",function(){return me(this)})}function be(){var e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,ve(t));e("toBase64",function(e){return ne(this,e)}),e("toBase64URI",function(){return ne(this,!0)}),e("toBase64URL",function(){return ne(this,!0)})}let ve=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),Se={version:t,VERSION:"3.7.7",atob:he,atobPolyfill:pe,btoa:re,btoaPolyfill:te,fromBase64:Ce,toBase64:h,encode:h,encodeURI:g,encodeURL:g,utob:ie,btou:ue,decode:Ce,isValid:e=>"string"==typeof e&&(e=e.replace(/\s+/g,"").replace(/={0,2}$/,""),!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)),fromUint8Array:ne,toUint8Array:me,extendString:ye,extendUint8Array:be,extendBuiltins:()=>{ye(),be()}};function Ae(e,t){var e=JSON.stringify(e),r=n.baseInfo.options.encryptMethod;return"lz"===r?B.compress(e):Se.encode(e)}function m(e,t){if(n.baseInfo.options.isReport){e={appId:n.baseInfo.options.appId,baseInfo:Object.assign({title:document.title,url:location.href,date:Date.now()},T()),reportInfo:Object.assign({eventId:e,snapshot:Ae(n.record.snapshot)},t)};let a=n.baseInfo.options.dsn,s=null!=(t=n.baseInfo.options.method)?t:"beacon",i=JSON.stringify(e);new Promise(e=>{switch(s){case"beacon":t=a,n=i,new Promise(e=>{navigator.sendBeacon(t,n),e(!0)}).then(()=>{e({type:"xhr",success:!0})});break;case"xhr":r=a,o=i,new Promise(e=>{let t=new XMLHttpRequest;t.open("post",r,!0),t.setRequestHeader("Content-Type","application/json"),t.send(o),e(!0),t.onreadystatechange=function(){4===t.readyState&&e(!0)}}).then(()=>{e({type:"xhr",success:!0})});break;default:c.warn("上报方式不支持:","上报方式只支持 'beacon' 和 'xhr'")}var r,o,t,n})}}function we(){for(var e in i.EVENT_TYPES)if(A(e,i.EVENT_TYPES)){r=t=void 0;var t=e;if(A(t,i.EVENT_TYPES)){var r=i.EVENT_TYPES[t];switch(r){case i.EVENT_TYPES.ERROR:(t=>{d.on(t,e=>{n.baseInfo.options.isDebug&&c.error("js逻辑错误:",JSON.stringify(e)),m(t,e)})})(r);break;case i.EVENT_TYPES.CONSOLE_ERROR:(t=>{d.on(t,e=>{n.baseInfo.options.isDebug&&c.info("console错误:",JSON.stringify(e)),m(t,e)})})(r);break;case i.EVENT_TYPES.UNHANDLEDREJECTION:(t=>{d.on(t,e=>{n.baseInfo.options.isDebug&&c.error("Promise错误:",JSON.stringify(e)),m(t,e)})})(r);break;case i.EVENT_TYPES.XHR:(t=>{"XMLHttpRequest"in l&&d.on(t,e=>{n.baseInfo.options.isDebug&&c.error("xhr接口错误:",JSON.stringify(e)),m(t,e)})})(r);break;case i.EVENT_TYPES.FETCH:(t=>{"fetch"in l&&d.on(t,e=>{n.baseInfo.options.isDebug&&c.error("fetch接口错误:",JSON.stringify(e)),m(t,e)})})(r)}}}}let ke;function Ee(e,t=1){return(e||"").split("\n").slice(t).map(e=>e.replace(/^\s+at\s+/g,"")).join("~~")}function Me(e){var t={errorMessage:"",time:Date.now(),colno:0,lineno:0,stackMessage:"",fileName:""};try{var r,o,n,a,s=/http[s]?:\/\/[^:]+(:\d+)?\/([^:]+):(\d+):(\d+)/,i=Ee(e.stack).split("~~")[1];return i?(r=i.match(s))?(o=r[2],n=parseInt(r[3],10),a=parseInt(r[4],10),{errorMessage:e.message,time:Date.now(),colno:a,lineno:n,stackMessage:Ee(e.stack),fileName:o}):t:t}catch(e){return t}}function Te(e){var t,e=e||ke;let r={};return r=e?{pointerId:e.pointerId,pointerType:e.pointerType,timeStamp:e.timeStamp,type:e.type,layerX:e.x,layerY:e.y,nodeName:null!=(t=e.nodeName)?t:e.target.nodeName,nodeType:null!=(t=e.nodeType)?t:e.target.nodeType,textContent:null!=(t=e.textContent)?t:e.target.textContent,className:null!=(t=e.className)?t:e.target.className,elId:null!=(t=e.id)?t:e.target.id}:r}function Re(e){var t=Me(e);let r;return r=t.stackMessage?t:{errorMessage:e.error?e.error.message:"",stackMessage:Ee(null==(t=e.error)?void 0:t.stack),lineno:e.lineno,colno:e.colno,fileName:e.filename,time:Date.now()},Object.assign(Object.assign({bubbles:e.bubbles,eventType:e.type,isTrusted:e.isTrusted},r),{time:Date.now(),timeStamp:Math.round(e.timeStamp),el:Te()})}function Ne(e,t){return Object.assign(Object.assign({},Re(e)),{questOptions:t})}function Oe(e,t={}){return Object.assign({questOptions:e,el:Te()},t)}function xe(){for(var e in i.EVENT_TYPES)if(A(e,i.EVENT_TYPES)){r=t=void 0;var t=e;if(A(t,i.EVENT_TYPES)){var r=i.EVENT_TYPES[t];switch(r){case i.EVENT_TYPES.ERROR:(t=>{n.baseInfo.options.isError&&w(l,t,e=>d.emit(t,Object.assign({errorType:i.ERROR_TYPES.JS},Re(e))),!0)})(r);break;case i.EVENT_TYPES.CONSOLE_ERROR:(o=>{if(n.baseInfo.options.isConsoleError){let r=console.error;console.error=function(...e){var t=e.map(e=>"string"==typeof e?e:JSON.stringify(e)).join(" "),t=new Error(t);d.emit(o,Object.assign({errorType:i.ERROR_TYPES.CONSOLE_ERROR},Me(t))),r.apply(console,e)}}})(r);break;case i.EVENT_TYPES.UNHANDLEDREJECTION:(t=>{n.baseInfo.options.isError&&w(l,t,e=>d.emit(t,Object.assign({errorType:i.ERROR_TYPES.PROMISE},(e=>{let t,r,o=0,n=0,a="";var s,i=e.reason;return"string"==typeof i?t=i:"object"==typeof i&&(t=i.message,i.stack&&(s=i.stack.match(/at\s+(.+):(\d+):(\d+)/),r=s[1],n=s[2],o=s[3]),a=Ee(i.stack)),Object.assign(Object.assign({},Re(e)),{errorMessage:t,stackMessage:a,fileName:r,lineno:Number(n),colno:Number(o)})})(e))))})(r);break;case i.EVENT_TYPES.XHR:(s=>{if(n.baseInfo.options.isXhr&&"XMLHttpRequest"in l){let n={},a=XMLHttpRequest.prototype.send,r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,t){return n.method=e,n.url=t,r.call(this,e,t,!0)},XMLHttpRequest.prototype.send=function(e){var t;["get","delete"].includes(n.method.toLowerCase())&&n.url&&-1!==n.url.indexOf("?")&&(t=null==(t=n.url)?void 0:t.substring(n.url.indexOf("?")+1),n.params=k(t));let r=()=>({method:n.method.toLowerCase(),url:n.url||"",status:this.status,params:"string"==typeof(e||n.params)?e||n.params:JSON.stringify(e||n.params),message:this.statusText}),o={errorType:i.ERROR_TYPES.XHR};return this.addEventListener("readystatechange",e=>{4===this.readyState&&(this.status<200||300<=this.status)&&d.emit(s,Object.assign(Object.assign({},o),Ne(e,r())))}),this.addEventListener("error",e=>{d.emit(s,Object.assign(Object.assign({},o),Ne(e,r())))},!1),this.addEventListener("abort",e=>{d.emit(s,Object.assign(Object.assign({},o),Ne(e,r())))},!1),a.call(this,e)}}})(r);break;case i.EVENT_TYPES.FETCH:(s=>{if(n.baseInfo.options.isXhr&&"fetch"in l){let o=l.fetch,n={},a={errorType:i.ERROR_TYPES.FETCH};l.fetch=function(e,t={}){var{method:r="GET"}=t||{method:"GET"},r=(n.method=r.toLowerCase(),n.url=e.toString(),["get","delete"].includes(n.method.toLowerCase())&&n.url&&(r=null==(r=n.url)?void 0:r.substring(n.url.indexOf("?")+1),n.params=k(r)),["post","put"].includes(n.method.toLowerCase())&&(n.params=JSON.stringify(t.body||{})),o(e,t));return r.then(t=>{(t.status<200||300<=t.status)&&t.text().then(()=>{var e={method:n.method.toLowerCase(),url:n.url||"",status:t.status,params:n.params||{},message:t.statusText};d.emit(s,Object.assign(Object.assign({},a),Oe(e)))})},e=>{var t={method:n.method.toLowerCase(),url:n.url||"",status:500,params:n.params||{},message:"请求失败"};d.emit(s,Object.assign(Object.assign({},a),Oe(t,Me(e))))}),r}}})(r)}}}}["click","touchstart","mousedown","keydown","mouseover"].forEach(e=>{document.addEventListener(e,e=>{ke=e},{capture:!0,passive:!0})});var W,a="@log-reporting/core",t="1.0.8",pe="前端日志上报SDK",te="王小泽 <wangze@anbangke.com>";class Fe{constructor(e){this.data=e}}let Le;class De{constructor(e){this.data=e}}let _e;function Be(){var e=new PerformanceObserver(()=>{}),e=(e.observe({type:"navigation",buffered:!0}),e.observe({type:"resource",buffered:!0}),e.takeRecords()),t=e.find(e=>"navigation"===e.entryType),r=(t&&(t=(e=>{var{domainLookupEnd:e,domainLookupStart:t,connectEnd:r,connectStart:o,secureConnectionStart:n,responseStart:a,requestStart:s,domInteractive:i,domComplete:l,loadEventEnd:c,loadEventStart:d,fetchStart:u}=e;return{dns:e-t,tcp:r-o,ssl:n,ttfb:a-s,render:null!=i?i:0,dom:null!=l?l:0,load:(null!=c?c:0)-(null!=d?d:0),total:(null!=c?c:0)-(null!=u?u:0)}})(t),null!=(r=null==(r=n.baseInfo)?void 0:r.options))&&r.isPerformance&&(Le=new Fe(t),n.performance=Le),e.filter(e=>"resource"===e.entryType));t=r,null!=(e=null==(e=n.baseInfo)?void 0:e.options)&&e.isResource&&(_e=new De(t),n.reource=_e)}function x(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function F(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Ve(e){try{var t=e.rules||e.cssRules;return t?r=(r=Array.from(t).map(We).join("")).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")?r.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;"):r:null}catch(e){return null}var r}function We(e){var t=e.cssText;if("styleSheet"in e)try{t=Ve(e.styleSheet)||t}catch(e){}return t}(g=W=W||{})[g.Document=0]="Document",g[g.DocumentType=1]="DocumentType",g[g.Element=2]="Element",g[g.Text=3]="Text",g[g.CDATA=4]="CDATA",g[g.Comment=5]="Comment",f.prototype.getId=function(e){return e&&null!=(e=null==(e=this.getMeta(e))?void 0:e.id)?e:-1},f.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},f.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},f.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},f.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},f.prototype.has=function(e){return this.idNodeMap.has(e)},f.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},f.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},f.prototype.replace=function(e,t){var r=this.getNode(e);r&&(r=this.nodeMetaMap.get(r))&&this.nodeMetaMap.set(t,r),this.idNodeMap.set(e,t)},f.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap};var Ze=f;function f(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}function Ue(e){var t=e.maskInputOptions,r=e.tagName,o=e.type,n=e.maskInputFn,e=e.value||"";return e=t[r.toLowerCase()]||t[o]?n?n(e):"*".repeat(e.length):e}var Z,Ge,Ye="__rrweb_original__",Ke=1,Pe=new RegExp("[^a-z0-9-_:]"),je=-2;function Je(){return Ke++}var ze=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,He=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Xe=/^(data:)([^,]*),(.*)/i;function Qe(e,d){return(e||"").replace(ze,function(e,t,r,o,n,a){r=r||n||a,n=t||o||"";if(!r)return e;if(!He.test(r))return"url(".concat(n).concat(r).concat(n,")");if(Xe.test(r))return"url(".concat(n).concat(r).concat(n,")");if("/"===r[0])return"url(".concat(n).concat((-1<(a=d).indexOf("//")?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+r).concat(n,")");var s=d.split("/"),t=r.split("/");s.pop();for(var i=0,l=t;i<l.length;i++){var c=l[i];"."!==c&&(".."===c?s.pop():s.push(c))}return"url(".concat(n).concat(s.join("/")).concat(n,")")})}var qe=/^[^ \t\n\r\u000c]+/,$e=/^[, \t\n\r\u000c]+/;function et(e,t){return t&&""!==t.trim()?((e=e.createElement("a")).href=t,e.href):t}function tt(){var e=document.createElement("a");return e.href="",e.href}function rt(e,t,r,o){if("src"===r||"href"===r&&o&&("use"!==t||"#"!==o[0]))return et(e,o);if("xlink:href"===r&&o&&"#"!==o[0]||"background"===r&&o&&("table"===t||"td"===t||"th"===t))return et(e,o);if("srcset"===r&&o){var n=e,a=o;if(""===a.trim())return a;var s=0;function i(e){var e=e.exec(a.substring(s));return e?(e=e[0],s+=e.length,e):""}for(var l=[];i($e),!(s>=a.length);)if(","===(d=i(qe)).slice(-1))d=et(n,d.substring(0,d.length-1)),l.push(d);else for(var c="",d=et(n,d),u=!1;;){var p=a.charAt(s);if(""===p){l.push((d+c).trim());break}if(u)")"===p&&(u=!1);else{if(","===p){s+=1,l.push((d+c).trim());break}"("===p&&(u=!0)}c+=p,s+=1}return l.join(", ")}return"style"===r&&o?Qe(o,tt()):"object"===t&&"data"===r&&o?et(e,o):o}function ot(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&ot(e.parentNode,t,r);for(var o=e.classList.length;o--;){var n=e.classList[o];if(t.test(n))return!0}return!!r&&ot(e.parentNode,t,r)}function nt(e,t,r){e=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null!==e){if("string"==typeof t){if(e.classList.contains(t))return 1;if(e.closest(".".concat(t)))return 1}else if(ot(e,t,!0))return 1;if(r){if(e.matches(r))return 1;if(e.closest(r))return 1}}}function at(e,t){var r=t.doc,o=t.blockClass,n=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,i=t.inlineStylesheet,l=t.maskInputOptions,c=void 0===l?{}:l,d=t.maskTextFn,u=t.maskInputFn,l=t.dataURLOptions,p=void 0===l?{}:l,h=t.inlineImages,g=t.recordCanvas,m=t.keepIframeSrcFn,l=t.newlyAddedElement,_=void 0!==l&&l,f=(l=r,!(t=t.mirror).hasNode(l)||1===(t=t.getId(l))?void 0:t);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:W.Document,childNodes:[],compatMode:e.compatMode}:{type:W.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:W.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:f};case e.ELEMENT_NODE:for(var I,C,y=e,b=(R={doc:r,blockClass:o,blockSelector:n,inlineStylesheet:i,maskInputOptions:c,maskInputFn:u,dataURLOptions:p,inlineImages:h,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:_,rootId:f}).doc,v=R.inlineStylesheet,S=void 0===(S=R.maskInputOptions)?{}:S,A=R.maskInputFn,w=void 0===(k=R.dataURLOptions)?{}:k,k=R.inlineImages,E=R.recordCanvas,M=R.keepIframeSrcFn,T=void 0!==(T=R.newlyAddedElement)&&T,B=R.rootId,R=((e,t,r)=>{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var o=e.classList.length;o--;){var n=e.classList[o];if(t.test(n))return!0}return!!r&&e.matches(r)})(y,R.blockClass,R.blockSelector),N=(e=>e instanceof HTMLFormElement?"form":(e=e.tagName.toLowerCase().trim(),Pe.test(e)?"div":e))(y),O={},V=y.attributes.length,x=0;x<V;x++){var F=y.attributes[x];O[F.name]=rt(b,N,F.name,F.value)}return"link"===N&&v&&(v=Array.from(b.styleSheets).find(function(e){return e.href===y.href}),D=null,D=v?Ve(v):D)&&(delete O.rel,delete O.href,O._cssText=Qe(D,v.href)),"style"===N&&y.sheet&&!(y.innerText||y.textContent||"").trim().length&&(D=Ve(y.sheet))&&(O._cssText=Qe(D,tt())),"input"!==N&&"textarea"!==N&&"select"!==N||(v=y.value,D=y.checked,"radio"!==O.type&&"checkbox"!==O.type&&"submit"!==O.type&&"button"!==O.type&&v?O.value=Ue({type:O.type,tagName:N,value:v,maskInputOptions:S,maskInputFn:A}):D&&(O.checked=D)),"option"===N&&(y.selected&&!S.select?O.selected=!0:delete O.selected),"canvas"===N&&E&&("2d"===y.__context?(e=>{var t=e.getContext("2d");if(t)for(var r=0;r<e.width;r+=50)for(var o=0;o<e.height;o+=50){var n=t.getImageData,n=Ye in n?n[Ye]:n;if(new Uint32Array(n.call(t,r,o,Math.min(50,e.width-r),Math.min(50,e.height-o)).data.buffer).some(function(e){return 0!==e}))return}return 1})(y)||(O.rr_dataURL=y.toDataURL(w.type,w.quality)):"__context"in y||(v=y.toDataURL(w.type,w.quality),(A=document.createElement("canvas")).width=y.width,A.height=y.height,D=A.toDataURL(w.type,w.quality),v!==D&&(O.rr_dataURL=v))),"img"===N&&k&&(Z||(Z=b.createElement("canvas"),Ge=Z.getContext("2d")),C=(I=y).crossOrigin,I.crossOrigin="anonymous",S=function(){try{Z.width=I.naturalWidth,Z.height=I.naturalHeight,Ge.drawImage(I,0,0),O.rr_dataURL=Z.toDataURL(w.type,w.quality)}catch(e){console.warn("Cannot inline img src=".concat(I.currentSrc,"! Error: ").concat(e))}C?O.crossOrigin=C:I.removeAttribute("crossorigin")},I.complete&&0!==I.naturalWidth?S():I.onload=S),"audio"!==N&&"video"!==N||(O.rr_mediaState=y.paused?"paused":"played",O.rr_mediaCurrentTime=y.currentTime),T||(y.scrollLeft&&(O.rr_scrollLeft=y.scrollLeft),y.scrollTop&&(O.rr_scrollTop=y.scrollTop)),R&&(E=y.getBoundingClientRect(),A=E.width,D=E.height,O={class:O.class,rr_width:"".concat(A,"px"),rr_height:"".concat(D,"px")}),"iframe"!==N||M(O.src)||(y.contentDocument||(O.rr_src=O.src),delete O.src),{type:W.Element,tagName:N,attributes:O,childNodes:[],isSVG:(e=>Boolean("svg"===e.tagName||e.ownerSVGElement))(y)||void 0,needBlock:R,rootId:B};case e.TEXT_NODE:var L,v=e,S=(k={maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:f}).maskTextClass,T=k.maskTextSelector,E=k.maskTextFn,k=k.rootId,A=v.parentNode&&v.parentNode.tagName,D=v.textContent,M="STYLE"===A||void 0,A="SCRIPT"===A||void 0;if(M&&D){try{v.nextSibling||v.previousSibling||null!=(L=v.parentNode.sheet)&&L.cssRules&&(D=(e=>e.cssRules?Array.from(e.cssRules).map(function(e){return e.cssText||""}).join(""):"")(v.parentNode.sheet))}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(e),v)}D=Qe(D,tt())}return A&&(D="SCRIPT_PLACEHOLDER"),!M&&!A&&D&&nt(v,S,T)&&(D=E?E(D):D.replace(/[\S]/g,"*")),{type:W.Text,textContent:D||"",isStyle:M,rootId:k};case e.CDATA_SECTION_NODE:return{type:W.CDATA,textContent:"",rootId:f};case e.COMMENT_NODE:return{type:W.Comment,textContent:e.textContent||"",rootId:f};default:return!1}}function L(e){return void 0===e?"":e.toLowerCase()}function G(t,e){var r=e.doc,o=e.mirror,n=e.blockClass,a=e.blockSelector,s=e.maskTextClass,i=e.maskTextSelector,l=e.skipChild,l=void 0!==l&&l,c=e.inlineStylesheet,d=void 0===c||c,c=e.maskInputOptions,u=void 0===c?{}:c,p=e.maskTextFn,h=e.maskInputFn,g=e.slimDOMOptions,c=e.dataURLOptions,m=void 0===c?{}:c,c=e.inlineImages,f=void 0!==c&&c,c=e.recordCanvas,I=void 0!==c&&c,C=e.onSerialize,y=e.onIframeLoad,c=e.iframeLoadTimeout,b=void 0===c?5e3:c,v=e.onStylesheetLoad,c=e.stylesheetLoadTimeout,S=void 0===c?5e3:c,c=e.keepIframeSrcFn,A=void 0===c?function(){return!1}:c,c=e.newlyAddedElement,e=e.preserveWhiteSpace,w=void 0===e||e,e=at(t,{doc:r,mirror:o,blockClass:n,blockSelector:a,maskTextClass:s,maskTextSelector:i,inlineStylesheet:d,maskInputOptions:u,maskTextFn:p,maskInputFn:h,dataURLOptions:m,inlineImages:f,recordCanvas:I,keepIframeSrcFn:A,newlyAddedElement:void 0!==c&&c});if(!e)return console.warn(t,"not serialized"),null;var c=o.hasNode(t)?o.getId(t):((e,t)=>{if(t.comment&&e.type===W.Comment)return 1;if(e.type===W.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return 1;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(L(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===L(e.attributes.name)||"icon"===L(e.attributes.rel)||"apple-touch-icon"===L(e.attributes.rel)||"shortcut icon"===L(e.attributes.rel))))return 1;if("meta"===e.tagName){if(t.headMetaDescKeywords&&L(e.attributes.name).match(/^description|keywords$/))return 1;if(t.headMetaSocial&&(L(e.attributes.property).match(/^(og|twitter|fb):/)||L(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===L(e.attributes.name)))return 1;if(t.headMetaRobots&&("robots"===L(e.attributes.name)||"googlebot"===L(e.attributes.name)||"bingbot"===L(e.attributes.name)))return 1;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return 1;if(t.headMetaAuthorship&&("author"===L(e.attributes.name)||"generator"===L(e.attributes.name)||"framework"===L(e.attributes.name)||"publisher"===L(e.attributes.name)||"progid"===L(e.attributes.name)||L(e.attributes.property).match(/^article:/)||L(e.attributes.property).match(/^product:/)))return 1;if(t.headMetaVerification&&("google-site-verification"===L(e.attributes.name)||"yandex-verification"===L(e.attributes.name)||"csrf-token"===L(e.attributes.name)||"p:domain_verify"===L(e.attributes.name)||"verify-v1"===L(e.attributes.name)||"verification"===L(e.attributes.name)||"shopify-checkout-api-token"===L(e.attributes.name)))return 1}}})(e,g)||!w&&e.type===W.Text&&!e.isStyle&&!e.textContent.replace(/^\s+|\s+$/gm,"").length?je:Ke++,k=Object.assign(e,{id:c});if(o.add(t,k),c===je)return null;C&&C(t);e=!l;if(k.type===W.Element&&(e=e&&!k.needBlock,delete k.needBlock,c=t.shadowRoot)&&F(c)&&(k.isShadowHost=!0),(k.type===W.Document||k.type===W.Element)&&e){g.headWhitespace&&k.type===W.Element&&"head"===k.tagName&&(w=!1);for(var E={doc:r,mirror:o,blockClass:n,blockSelector:a,maskTextClass:s,maskTextSelector:i,skipChild:l,inlineStylesheet:d,maskInputOptions:u,maskTextFn:p,maskInputFn:h,slimDOMOptions:g,dataURLOptions:m,inlineImages:f,recordCanvas:I,preserveWhiteSpace:w,onSerialize:C,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:A},M=0,T=Array.from(t.childNodes);M<T.length;M++)(R=G(T[M],E))&&k.childNodes.push(R);if(t.nodeType===t.ELEMENT_NODE&&t.shadowRoot)for(var R,N=0,O=Array.from(t.shadowRoot.childNodes);N<O.length;N++)(R=G(O[N],E))&&(F(t.shadowRoot)&&(R.isShadow=!0),k.childNodes.push(R))}return t.parentNode&&x(t.parentNode)&&F(t.parentNode)&&(k.isShadow=!0),k.type===W.Element&&"iframe"===k.tagName&&((e,t,r)=>{var o=e.contentWindow;if(o){var n,a,s=!1;try{a=o.document.readyState}catch(e){return}if("complete"===a)return o.location.href!==(a="about:blank")||e.src===a||""===e.src?(setTimeout(t,0),e.addEventListener("load",t)):e.addEventListener("load",t);n=setTimeout(function(){s||(t(),s=!0)},r),e.addEventListener("load",function(){clearTimeout(n),s=!0,t()})}})(t,function(){var e=t.contentDocument;e&&y&&(e=G(e,{doc:e,mirror:o,blockClass:n,blockSelector:a,maskTextClass:s,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:p,maskInputFn:h,slimDOMOptions:g,dataURLOptions:m,inlineImages:f,recordCanvas:I,preserveWhiteSpace:w,onSerialize:C,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:A}))&&y(t,e)},b),k.type===W.Element&&"link"===k.tagName&&"stylesheet"===k.attributes.rel&&((e,t,r)=>{var o,n,a=!1;try{o=e.sheet}catch(e){return}o||(n=setTimeout(function(){a||(t(),a=!0)},r),e.addEventListener("load",function(){clearTimeout(n),a=!0,t()}))})(t,function(){var e;v&&(e=G(t,{doc:r,mirror:o,blockClass:n,blockSelector:a,maskTextClass:s,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:p,maskInputFn:h,slimDOMOptions:g,dataURLOptions:m,inlineImages:f,recordCanvas:I,preserveWhiteSpace:w,onSerialize:C,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:A}))&&v(t,e)},S),k}function Y(e,t,r=document){let o={capture:!0,passive:!0};return r.addEventListener(e,t,o),()=>r.removeEventListener(e,t,o)}let C="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";function st(n,a,s={}){let i=null,l=0;return function(...e){var t=Date.now(),r=(l||!1!==s.leading||(l=t),a-(t-l));let o=this;r<=0||a<r?(i&&(clearTimeout(i),i=null),l=t,n.apply(o,e)):i||!1===s.trailing||(i=setTimeout(()=>{l=!1===s.leading?0:Date.now(),i=null,n.apply(o,e)},r))}}function it(e,t,r,o,n=window){let a=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,o?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),a&&a.set&&a.set.call(this,e)}}),()=>it(e,t,a||{},!0)}function y(t,r,o){try{if(!(r in t))return()=>{};let e=t[r];var n=o(e);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:e}})),t[r]=n,()=>{t[r]=e}}catch(e){return()=>{}}}function lt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ct(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function b(e,t,r,o){if(e){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(n){if("string"==typeof t){if(n.classList.contains(t))return!0;if(o&&null!==n.closest("."+t))return!0}else if(ot(n,t,o))return!0;if(r){if(e.matches(r))return!0;if(o&&null!==n.closest(r))return!0}}}return!1}function dt(e,t){return t.getId(e)===je}function ut(e){return Boolean(e.changedTouches)}function pt(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ht(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function gt(e){return Boolean(null==e?void 0:e.shadowRoot)}g={map:{},getId(){return console.error(C),-1},getNode(){return console.error(C),null},removeNodeFromMap(){console.error(C)},has(){return console.error(C),!1},reset(){console.error(C)}},"undefined"!=typeof window&&window.Proxy&&window.Reflect&&new Proxy(g,{get(e,t,r){return"map"===t&&console.error(C),Reflect.get(e,t,r)}});class mt{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return null!=(e=this.styleIDMap.get(e))?e:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var K=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))({}),P=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(P||{}),ft=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ft||{}),It=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))({});function Ct(e){return"__ln"in e}class yt{constructor(){this.length=0,this.head=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let e=0;e<t;e++)r=(null==r?void 0:r.next)||null;return r}addNode(e){var t,r={value:e,previous:null,next:null};e.__ln=r,e.previousSibling&&Ct(e.previousSibling)?(t=e.previousSibling.__ln.next,r.next=t,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,t&&(t.previous=r)):e.nextSibling&&Ct(e.nextSibling)&&e.nextSibling.__ln.previous?(t=e.nextSibling.__ln.previous,r.previous=t,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,t&&(t.next=r)):(this.head&&(this.head.previous=r),r.next=this.head,this.head=r),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}class bt{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(!this.frozen&&!this.locked){let d=[],u=new yt,p=e=>{let t=e,r=je;for(;r===je;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r};for(var t,r,o,n,a=t=>{let e,r,o,n,a=null,s=a=(null==(r=null==(e=t.getRootNode)?void 0:e.call(t))?void 0:r.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host?t.getRootNode().host:a;for(;(null==(n=null==(o=null==s?void 0:s.getRootNode)?void 0:o.call(s))?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host;)s=s.getRootNode().host;var i,l,c=!(this.doc.contains(t)||s&&this.doc.contains(s));if(t.parentNode&&!c)return c=x(t.parentNode)?this.mirror.getId(a):this.mirror.getId(t.parentNode),i=p(t),-1===c||-1===i?u.addNode(t):void((l=G(t,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{pt(e,this.mirror)&&this.iframeManager.addIframe(e),ht(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),gt(t)&&this.shadowDomManager.addShadowRoot(t.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}}))&&d.push({parentId:c,nextId:i,node:l}))};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(t of Array.from(this.movedSet.values()))St(this.removes,t,this.mirror)&&!this.movedSet.has(t.parentNode)||a(t);for(r of Array.from(this.addedSet.values()))!At(this.droppedSet,r)&&!St(this.removes,r,this.mirror)||At(this.movedSet,r)?a(r):this.droppedSet.add(r);let e=null;for(;u.length;){let t=null;if(!(t=e&&(o=this.mirror.getId(e.value.parentNode),n=p(e.value),-1!==o)&&-1!==n?e:t))for(let e=u.length-1;0<=e;e--){var s=u.get(e);if(s){var i=this.mirror.getId(s.value.parentNode),l=p(s.value);if(-1!==l){if(-1!==i){t=s;break}l=s.value;if(l.parentNode&&l.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){i=l.parentNode.host;if(-1!==this.mirror.getId(i)){t=s;break}}}}}if(!t){for(;u.head;)u.removeNode(u.head.value);break}e=t.previous,u.removeNode(t.value),a(t.value)}var c={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:d};(c.texts.length||c.attributes.length||c.removes.length||c.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(c))}},this.processMutation=o=>{if(!dt(o.target,this.mirror))switch(o.type){case"characterData":var e=o.target.textContent;b(o.target,this.blockClass,this.blockSelector,!1)||e===o.oldValue||this.texts.push({value:nt(o.target,this.maskTextClass,this.maskTextSelector)&&e?this.maskTextFn?this.maskTextFn(e):e.replace(/[\S]/g,"*"):e,node:o.target});break;case"attributes":{var r=o.target;let e=o.target.getAttribute(o.attributeName);if("value"===o.attributeName&&(e=Ue({maskInputOptions:this.maskInputOptions,tagName:o.target.tagName,type:o.target.getAttribute("type"),value:e,maskInputFn:this.maskInputFn})),b(o.target,this.blockClass,this.blockSelector,!1)||e===o.oldValue)return;let t=this.attributes.find(e=>e.node===o.target);if("IFRAME"===r.tagName&&"src"===o.attributeName&&!this.keepIframeSrcFn(e)){if(r.contentDocument)return;o.attributeName="rr_src"}if(t||(t={node:o.target,attributes:{}},this.attributes.push(t)),"style"===o.attributeName){var n,a,s=this.doc.createElement("span"),i=(o.oldValue&&s.setAttribute("style",o.oldValue),null==t.attributes.style&&(t.attributes.style={}),t.attributes.style);for(n of Array.from(r.style)){var l=r.style.getPropertyValue(n),c=r.style.getPropertyPriority(n);l===s.style.getPropertyValue(n)&&c===s.style.getPropertyPriority(n)||(i[n]=""===c?l:[l,c])}for(a of Array.from(s.style))""===r.style.getPropertyValue(a)&&(i[a]=!1)}else t.attributes[o.attributeName]=rt(this.doc,r.tagName,o.attributeName,e);break}case"childList":b(o.target,this.blockClass,this.blockSelector,!0)||(o.addedNodes.forEach(e=>this.genAdds(e,o.target)),o.removedNodes.forEach(e=>{var t=this.mirror.getId(e),r=x(o.target)?this.mirror.getId(o.target.host):this.mirror.getId(o.target);b(o.target,this.blockClass,this.blockSelector,!1)||dt(e,this.mirror)||-1===this.mirror.getId(e)||(this.addedSet.has(e)?(vt(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(o.target)&&-1===t||function e(t,r){var o;return!x(t)&&(o=r.getId(t),!r.has(o)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode,r)))}(o.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[t+"@"+r]?vt(this.movedSet,e):this.removes.push({parentId:r,id:t,isShadow:!(!x(o.target)||!F(o.target))||void 0})),this.mapRemoves.push(e))}))}},this.genAdds=(t,r)=>{if(this.mirror.hasNode(t)){if(dt(t,this.mirror))return;this.movedSet.add(t);let e=null;(e=r&&this.mirror.hasNode(r)?this.mirror.getId(r):e)&&-1!==e&&(this.movedMap[this.mirror.getId(t)+"@"+e]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);b(t,this.blockClass,this.blockSelector,!1)||t.childNodes.forEach(e=>this.genAdds(e))}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(e=>{this[e]=t[e]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function vt(t,e){t.delete(e),e.childNodes.forEach(e=>vt(t,e))}function St(e,t,r){return 0!==e.length&&function e(t,r,o){let n=r.parentNode;if(!n)return!1;let a=o.getId(n);if(t.some(e=>e.id===a))return!0;return e(t,n,o)}(e,t,r)}function At(e,t){return 0!==e.size&&function e(t,r){let o=r.parentNode;if(!o)return!1;if(t.has(o))return!0;return e(t,o)}(e,t)}let j=[],wt="undefined"!=typeof CSSGroupingRule,kt="undefined"!=typeof CSSMediaRule,Et="undefined"!=typeof CSSSupportsRule,Mt="undefined"!=typeof CSSConditionRule;function Tt(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch(e){return t.target}}function Rt(e,t){var r=new bt;j.push(r),r.init(e);let o=window.MutationObserver||window.__rrMutationObserver;var n=null==(n=null==(e=null==window?void 0:window.Zone)?void 0:e.__symbol__)?void 0:n.call(e,"MutationObserver"),e=new(o=n&&window[n]?window[n]:o)(r.processMutations.bind(r));return e.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),e}function Nt({mouseInteractionCb:n,doc:r,mirror:a,blockClass:s,blockSelector:i,sampling:e}){if(!1===e.mouseInteraction)return()=>{};let t=!0===e.mouseInteraction||void 0===e.mouseInteraction?{}:e.mouseInteraction,l=[];return Object.keys(ft).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==t[e]).forEach(e=>{var o,t=e.toLowerCase(),e=(o=e,e=>{var t,r=Tt(e);b(r,s,i,!0)||(e=ut(e)?e.changedTouches[0]:e)&&(r=a.getId(r),{clientX:e,clientY:t}=e,n({type:ft[o],id:r,x:e,y:t}))});l.push(Y(t,e,r))}),()=>{l.forEach(e=>e())}}function Ot({scrollCb:o,doc:n,mirror:a,blockClass:s,blockSelector:i,sampling:e}){return Y("scroll",st(e=>{var t,r,e=Tt(e);e&&!b(e,s,i,!0)&&(t=a.getId(e),e===n?(r=n.scrollingElement||n.documentElement,o({id:t,x:r.scrollLeft,y:r.scrollTop})):o({id:t,x:e.scrollLeft,y:e.scrollTop}))},e.scroll||100),n)}function xt(e,t){e=Object.assign({},e);return t||delete e.userTriggered,e}let Ft=["INPUT","TEXTAREA","SELECT"],Lt=new WeakMap;function Dt(e){var t,r;return e=e,t=[],wt&&e.parentRule instanceof CSSGroupingRule||kt&&e.parentRule instanceof CSSMediaRule||Et&&e.parentRule instanceof CSSSupportsRule||Mt&&e.parentRule instanceof CSSConditionRule?(r=Array.from(e.parentRule.cssRules).indexOf(e),t.unshift(r)):e.parentStyleSheet&&(r=Array.from(e.parentStyleSheet.cssRules).indexOf(e),t.unshift(r)),t}function v(e,t,r){let o,n;return e?(e.ownerNode?o=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:o}):{}}function _t({mirror:e,stylesheetManager:r},t){let o,n,a,s=null;s="#document"===t.nodeName?e.getId(t):e.getId(t.host);e="#document"===t.nodeName?null==(o=t.defaultView)?void 0:o.Document:null==(a=null==(n=t.ownerDocument)?void 0:n.defaultView)?void 0:a.ShadowRoot;let i=Object.getOwnPropertyDescriptor(null==e?void 0:e.prototype,"adoptedStyleSheets");return null!==s&&-1!==s&&e&&i?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var e;return null==(e=i.get)?void 0:e.call(this)},set(e){var t=null==(t=i.set)?void 0:t.call(this,e);if(null!==s&&-1!==s)try{r.adoptStyleSheets(e,s)}catch(e){}return t}}),()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}):()=>{}}function Bt(e,h={}){var t,r=e.doc.defaultView;if(!r)return()=>{};{var g=e,m=h;let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:o,scrollCb:n,viewportResizeCb:a,inputCb:s,mediaInteractionCb:i,styleSheetRuleCb:l,styleDeclarationCb:c,canvasMutationCb:d,fontCb:u,selectionCb:p}=g;g.mutationCb=(...e)=>{m.mutation&&m.mutation(...e),t(...e)},g.mousemoveCb=(...e)=>{m.mousemove&&m.mousemove(...e),r(...e)},g.mouseInteractionCb=(...e)=>{m.mouseInteraction&&m.mouseInteraction(...e),o(...e)},g.scrollCb=(...e)=>{m.scroll&&m.scroll(...e),n(...e)},g.viewportResizeCb=(...e)=>{m.viewportResize&&m.viewportResize(...e),a(...e)},g.inputCb=(...e)=>{m.input&&m.input(...e),s(...e)},g.mediaInteractionCb=(...e)=>{m.mediaInteaction&&m.mediaInteaction(...e),i(...e)},g.styleSheetRuleCb=(...e)=>{m.styleSheetRule&&m.styleSheetRule(...e),l(...e)},g.styleDeclarationCb=(...e)=>{m.styleDeclaration&&m.styleDeclaration(...e),c(...e)},g.canvasMutationCb=(...e)=>{m.canvasMutation&&m.canvasMutation(...e),d(...e)},g.fontCb=(...e)=>{m.font&&m.font(...e),u(...e)},g.selectionCb=(...e)=>{m.selection&&m.selection(...e),p(...e)}}let o=Rt(e,e.doc),n=(({mousemoveCb:r,sampling:e,doc:t,mirror:n})=>{if(!1===e.mousemove)return()=>{};var o="number"==typeof e.mousemove?e.mousemove:50,e="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let a=[],s,i=st(e=>{let t=Date.now()-s;r(a.map(e=>(e.timeOffset-=t,e)),e),a=[],s=null},e),l=[Y("mousemove",e=st(e=>{var t=Tt(e),{clientX:r,clientY:o}=ut(e)?e.changedTouches[0]:e;s=s||Date.now(),a.push({x:r,y:o,id:n.getId(t),timeOffset:Date.now()-s}),i("undefined"!=typeof DragEvent&&e instanceof DragEvent?P.Drag:e instanceof MouseEvent?P.MouseMove:P.TouchMove)},o,{trailing:!1}),t),Y("touchmove",e,t),Y("drag",e,t)];return()=>{l.forEach(e=>e())}})(e),a=Nt(e),s=Ot(e),i=(({viewportResizeCb:r})=>{let o=-1,n=-1;return Y("resize",st(()=>{var e=lt(),t=ct();o===e&&n===t||(r({width:Number(t),height:Number(e)}),o=e,n=t)},200),window)})(e),l=(({inputCb:o,doc:a,mirror:n,blockClass:e,blockSelector:t,ignoreClass:s,maskInputOptions:i,maskInputFn:l,sampling:r,userTriggeredOnInput:c})=>{function d(r){let o=Tt(r);r=r.isTrusted;if((o=o&&"OPTION"===o.tagName?o.parentElement:o)&&o.tagName&&!(Ft.indexOf(o.tagName)<0)&&!b(o,e,t,!0)){var n=o.type;if(!o.classList.contains(s)){let e=o.value,t=!1;"radio"===n||"checkbox"===n?t=o.checked:(i[o.tagName.toLowerCase()]||i[n])&&(e=Ue({maskInputOptions:i,tagName:o.tagName,type:n,value:e,maskInputFn:l})),u(o,xt({text:e,isChecked:t,userTriggered:r},c));r=o.name;"radio"===n&&r&&t&&a.querySelectorAll(`input[type="radio"][name="${r}"]`).forEach(e=>{e!==o&&u(e,xt({text:e.value,isChecked:!t,use