var rrwebConsoleRecord=function(g){"use strict";var O;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(O||(O={}));const p=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`;let v={map:{},getId(){return console.error(p),-1},getNode(){return console.error(p),null},removeNodeFromMap(){console.error(p)},has(){return console.error(p),!1},reset(){console.error(p)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(v=new Proxy(v,{get(e,r,n){return r==="map"&&console.error(p),Reflect.get(e,r,n)}}));function C(e,r,n){try{if(!(r in e))return()=>{};const t=e[r],i=n(t);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:t}})),e[r]=i,()=>{e[r]=t}}catch{return()=>{}}}class m{constructor(r){this.fileName=r.fileName||"",this.functionName=r.functionName||"",this.lineNumber=r.lineNumber,this.columnNumber=r.columnNumber}toString(){const r=this.lineNumber||"",n=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+r+":"+n+")":this.fileName+":"+r+":"+n}}const S=/(^|@)\S+:\d+/,b=/^\s*at .*(\S+:\d+|\(native\))/m,j=/^(eval@)?(\[native code])?$/,L={parse:function(e){if(!e)return[];if(typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u")return this.parseOpera(e);if(e.stack&&e.stack.match(b))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];const r=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!r)throw new Error(`Cannot parse given url: ${e}`);return[r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(e){return e.stack.split(`
`).filter(function(r){return!!r.match(b)},this).map(function(r){r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let n=r.replace(/^\s+/,"").replace(/\(eval code/g,"(");const t=n.match(/ (\((.+):(\d+):(\d+)\)$)/);n=t?n.replace(t[0],""):n;const i=n.split(/\s+/).slice(1),c=this.extractLocation(t?t[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(c[0])>-1?void 0:c[0];return new m({functionName:s,fileName:a,lineNumber:c[1],columnNumber:c[2]})},this)},parseFFOrSafari:function(e){return e.stack.split(`
`).filter(function(r){return!r.match(j)},this).map(function(r){if(r.indexOf(" > eval")>-1&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),r.indexOf("@")===-1&&r.indexOf(":")===-1)return new m({functionName:r});{const n=/((.*".+"[^@]*)?[^@]*)(?:@)/,t=r.match(n),i=t&&t[1]?t[1]:void 0,c=this.extractLocation(r.replace(n,""));return new m({functionName:i,fileName:c[0],lineNumber:c[1],columnNumber:c[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf(`
`)>-1&&e.message.split(`
`).length>e.stacktrace.split(`
`).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const r=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split(`
`),t=[];for(let i=2,c=n.length;i<c;i+=2){const s=r.exec(n[i]);s&&t.push(new m({fileName:s[2],lineNumber:parseFloat(s[1])}))}return t},parseOpera10:function(e){const r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split(`
`),t=[];for(let i=0,c=n.length;i<c;i+=2){const s=r.exec(n[i]);s&&t.push(new m({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return t},parseOpera11:function(e){return e.stack.split(`
`).filter(function(r){return!!r.match(S)&&!r.match(/^Error created at/)},this).map(function(r){const n=r.split("@"),t=this.extractLocation(n.pop()),i=(n.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new m({functionName:i,fileName:t[0],lineNumber:t[1],columnNumber:t[2]})},this)}};function T(e){if(!e||!e.outerHTML)return"";let r="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const t=e.parentElement,i=[];if(t.children&&t.children.length>0)for(let c=0;c<t.children.length;c++){const s=t.children[c];s.localName&&s.localName.toLowerCase&&s.localName.toLowerCase()===n&&i.push(s)}i.length>1&&(n+=":eq("+i.indexOf(e)+")"),r=n+(r?">"+r:""),e=t}return r}function N(e){return Object.prototype.toString.call(e)==="[object Object]"}function E(e,r){if(r===0)return!0;const n=Object.keys(e);for(const t of n)if(N(e[t])&&E(e[t],r-1))return!0;return!1}function y(e,r){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,r);const t=[],i=[];return JSON.stringify(e,function(a,o){if(t.length>0){const l=t.indexOf(this);~l?t.splice(l+1):t.push(this),~l?i.splice(l,1/0,a):i.push(a),~t.indexOf(o)&&(t[0]===o?o="[Circular ~]":o="[Circular ~."+i.slice(0,t.indexOf(o)).join(".")+"]")}else t.push(o);if(o==null)return o;if(c(o))return s(o);if(o instanceof Event){const l={};for(const f in o){const u=o[f];Array.isArray(u)?l[f]=T(u.length?u[0]:null):l[f]=u}return l}else{if(o instanceof Node)return o instanceof HTMLElement?o?o.outerHTML:"":o.nodeName;if(o instanceof Error)return o.stack?o.stack+`
End of stack for Error object`:o.name+": "+o.message}return o});function c(a){return!!(N(a)&&Object.keys(a).length>n.numOfKeysLimit||typeof a=="function"||N(a)&&E(a,n.depthOfLimit))}function s(a){let o=a.toString();return n.stringLengthLimit&&o.length>n.stringLengthLimit&&(o=`${o.slice(0,n.stringLengthLimit)}...`),o}}const k={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function $(e,r,n){const t=n.logger;if(!t)return()=>{};let i;typeof t=="string"?i=r[t]:i=t;let c=0;const s=[];if(n.level.includes("error")&&window){const o=l=>{const{message:f,error:u}=l,d=L.parse(u).map(h=>h.toString()),w=[y(f,n.stringifyOptions)];e({level:"error",trace:d,payload:w})};window.addEventListener("error",o),s.push(()=>{window&&window.removeEventListener("error",o)})}for(const o of n.level)s.push(a(i,o));return()=>{s.forEach(o=>o())};function a(o,l){return o[l]?C(o,l,f=>(...u)=>{f.apply(this,u);try{const d=L.parse(new Error).map(h=>h.toString()).splice(1),w=u.map(h=>y(h,n.stringifyOptions));c++,c<n.lengthThreshold?e({level:l,trace:d,payload:w}):c===n.lengthThreshold&&e({level:"warn",trace:[],payload:[y("The number of log records reached the threshold.")]})}catch(d){f("rrweb logger error:",d,...u)}}):()=>{}}}const x="rrweb/console@1",P=e=>({name:x,observer:$,options:e?Object.assign({},k,e):k});return g.PLUGIN_NAME=x,g.getRecordConsolePlugin=P,Object.defineProperty(g,"__esModule",{value:!0}),g}({});
