@askdepth/replay 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use strict';var ze=45e3,Xe=45e3,wt=3145728,vn=Math.floor(1572864),Ct=45*1024,Mt=8,ue=2,Je=3,Ke=0,Qe=1;var rr=3;var et=6;var nr=typeof TextEncoder<"u"?new TextEncoder:void 0;function Rt(e){if(nr)return nr.encode(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function tt(e){return Rt(JSON.stringify(e)).length}function ir(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function sr(e,t){if(e.byteLength<=t)return [e];let r=[];for(let n=0;n<e.byteLength;n+=t)r.push(e.subarray(n,Math.min(n+t,e.byteLength)));return r}function Ue(e){let t=/Mobi|Android|iPhone|iPad|iPod/i.test(e),r=/AppleWebKit/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Android/i.test(e);return t||r?Math.floor(1.5*1024*1024):3*1024*1024}var ce=Uint8Array,ae=Uint16Array,Ot=Int32Array,At=new ce([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Nt=new ce([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),or=new ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cr=function(e,t){for(var r=new ae(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Ot(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return {b:r,r:i}},fr=cr(At,2),bn=fr.b,It=fr.r;bn[28]=258,It[258]=28;var hr=cr(Nt,0),ar=hr.r,xt=new ae(32768);for(P=0;P<32768;++P)de=(P&43690)>>1|(P&21845)<<1,de=(de&52428)>>2|(de&13107)<<2,de=(de&61680)>>4|(de&3855)<<4,xt[P]=((de&65280)>>8|(de&255)<<8)>>1;var de,P,Be=(function(e,t,r){for(var n=e.length,i=0,s=new ae(t);i<n;++i)e[i]&&++s[e[i]-1];var o=new ae(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var c;for(c=new ae(n),i=0;i<n;++i)e[i]&&(c[i]=xt[o[e[i]-1]++]>>15-e[i]);return c}),Ce=new ce(288);for(P=0;P<144;++P)Ce[P]=8;var P;for(P=144;P<256;++P)Ce[P]=9;var P;for(P=256;P<280;++P)Ce[P]=7;var P;for(P=280;P<288;++P)Ce[P]=8;var P,rt=new ce(32);for(P=0;P<32;++P)rt[P]=5;var P,Sn=Be(Ce,9);var wn=Be(rt,5);var dr=function(e){return (e+7)/8|0},Cn=function(e,t,r){return (r==null||r>e.length)&&(r=e.length),new ce(e.subarray(t,r))};var pe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},Pe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16;},Et=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return {t:mr,l:0};if(i==1){var o=new ce(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(I,x){return I.f-x.f}),r.push({s:-1,f:25001});var c=r[0],a=r[1],f=0,l=1,h=2;for(r[0]={s:-1,f:c.f+a.f,l:c,r:a};l!=i-1;)c=r[r[f].f<r[h].f?f++:h++],a=r[f!=l&&r[f].f<r[h].f?f++:h++],r[l++]={s:-1,f:c.f+a.f,l:c,r:a};for(var d=s[0].s,n=1;n<i;++n)s[n].s>d&&(d=s[n].s);var p=new ae(d+1),m=kt(r[l-1],p,0);if(m>t){var n=0,u=0,v=m-t,C=1<<v;for(s.sort(function(x,k){return p[k.s]-p[x.s]||x.f-k.f});n<i;++n){var b=s[n].s;if(p[b]>t)u+=C-(1<<m-p[b]),p[b]=t;else break}for(u>>=v;u>0;){var y=s[n].s;p[y]<t?u-=1<<t-p[y]++-1:++n;}for(;n>=0&&u;--n){var M=s[n].s;p[M]==t&&(--p[M],++u);}m=t;}return {t:new ce(p),l:m}},kt=function(e,t,r){return e.s==-1?Math.max(kt(e.l,t,r+1),kt(e.r,t,r+1)):t[e.s]=r},lr=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ae(++t),n=0,i=e[0],s=1,o=function(a){r[n++]=a;},c=1;c<=t;++c)if(e[c]==i&&c!=t)++s;else {if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0);}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0);}for(;s--;)o(i);s=1,i=e[c];}return {c:r.subarray(0,n),n:t}},Fe=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},pr=function(e,t,r){var n=r.length,i=dr(t+2);e[i]=n&255,e[i+1]=n>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<n;++s)e[i+s+4]=r[s];return (i+4+n)*8},ur=function(e,t,r,n,i,s,o,c,a,f,l){pe(t,l++,r),++i[256];for(var h=Et(i,15),d=h.t,p=h.l,m=Et(s,15),u=m.t,v=m.l,C=lr(d),b=C.c,y=C.n,M=lr(u),I=M.c,x=M.n,k=new ae(19),E=0;E<b.length;++E)++k[b[E]&31];for(var E=0;E<I.length;++E)++k[I[E]&31];for(var R=Et(k,7),B=R.t,A=R.l,T=19;T>4&&!B[or[T-1]];--T);var S=f+5<<3,L=Fe(i,Ce)+Fe(s,rt)+o,j=Fe(i,d)+Fe(s,u)+o+14+3*T+Fe(k,B)+2*k[16]+3*k[17]+7*k[18];if(a>=0&&S<=L&&S<=j)return pr(t,l,e.subarray(a,a+f));var U,N,q,Z;if(pe(t,l,1+(j<L)),l+=2,j<L){U=Be(d,p),N=d,q=Be(u,v),Z=u;var ye=Be(B,A);pe(t,l,y-257),pe(t,l+5,x-1),pe(t,l+10,T-4),l+=14;for(var E=0;E<T;++E)pe(t,l+3*E,B[or[E]]);l+=3*T;for(var J=[b,I],he=0;he<2;++he)for(var Q=J[he],E=0;E<Q.length;++E){var K=Q[E]&31;pe(t,l,ye[K]),l+=B[K],K>15&&(pe(t,l,Q[E]>>5&127),l+=Q[E]>>12);}}else U=Sn,N=Ce,q=wn,Z=rt;for(var E=0;E<c;++E){var V=n[E];if(V>255){var K=V>>18&31;Pe(t,l,U[K+257]),l+=N[K+257],K>7&&(pe(t,l,V>>23&31),l+=At[K]);var X=V&31;Pe(t,l,q[X]),l+=Z[X],X>3&&(Pe(t,l,V>>5&8191),l+=Nt[X]);}else Pe(t,l,U[V]),l+=N[V];}return Pe(t,l,U[256]),l+N[256]},Mn=new Ot([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),mr=new ce(0),Rn=function(e,t,r,n,i,s){var o=s.z||e.length,c=new ce(n+o+5*(1+Math.ceil(o/7e3))+i),a=c.subarray(n,c.length-i),f=s.l,l=(s.r||0)&7;if(t){l&&(a[0]=s.r>>3);for(var h=Mn[t-1],d=h>>13,p=h&8191,m=(1<<r)-1,u=s.p||new ae(32768),v=s.h||new ae(m+1),C=Math.ceil(r/3),b=2*C,y=function(H){return (e[H]^e[H+1]<<C^e[H+2]<<b)&m},M=new Ot(25e3),I=new ae(288),x=new ae(32),k=0,E=0,R=s.i||0,B=0,A=s.w||0,T=0;R+2<o;++R){var S=y(R),L=R&32767,j=v[S];if(u[L]=j,v[S]=L,A<=R){var U=o-R;if((k>7e3||B>24576)&&(U>423||!f)){l=ur(e,a,0,M,I,x,E,B,T,R-T,l),B=k=E=0,T=R;for(var N=0;N<286;++N)I[N]=0;for(var N=0;N<30;++N)x[N]=0;}var q=2,Z=0,ye=p,J=L-j&32767;if(U>2&&S==y(R-J))for(var he=Math.min(d,U)-1,Q=Math.min(32767,R),K=Math.min(258,U);J<=Q&&--ye&&L!=j;){if(e[R+q]==e[R+q-J]){for(var V=0;V<K&&e[R+V]==e[R+V-J];++V);if(V>q){if(q=V,Z=J,V>he)break;for(var X=Math.min(J,V-2),re=0,N=0;N<X;++N){var ne=R-J+N&32767,Se=u[ne],we=ne-Se&32767;we>re&&(re=we,j=ne);}}}L=j,j=u[L],J+=L-j&32767;}if(Z){M[B++]=268435456|It[q]<<18|ar[Z];var _=It[q]&31,ie=ar[Z]&31;E+=At[_]+Nt[ie],++I[257+_],++x[ie],A=R+q,++k;}else M[B++]=e[R],++I[e[R]];}}for(R=Math.max(R,A);R<o;++R)M[B++]=e[R],++I[e[R]];l=ur(e,a,f,M,I,x,E,B,T,R-T,l),f||(s.r=l&7|a[l/8|0]<<3,l-=7,s.h=v,s.p=u,s.i=R,s.w=A);}else {for(var R=s.w||0;R<o+f;R+=65535){var W=R+65535;W>=o&&(a[l/8|0]=f,W=o),l=pr(a,l+1,e.subarray(R,W));}s.i=o;}return Cn(c,0,n+dr(l)+i)},En=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r;}return e})(),In=function(){var e=-1;return {p:function(t){for(var r=e,n=0;n<t.length;++n)r=En[r&255^t[n]]^r>>>8;e=r;},d:function(){return ~e}}};var xn=function(e,t,r,n,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new ce(s.length+e.length);o.set(s),o.set(e,s.length),e=o,i.w=s.length;}return Rn(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,i)};var Tt=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},kn=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Tt(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n);}};var Tn=function(e){return 10+(e.filename?e.filename.length+1:0)};function yr(e,t){t||(t={});var r=In(),n=e.length;r.p(e);var i=xn(e,t,Tn(t),8),s=i.length;return kn(i,t),Tt(i,s-8,r.d()),Tt(i,s-4,n),i}var On=typeof TextDecoder<"u"&&new TextDecoder,An=0;try{On.decode(mr,{stream:!0}),An=1;}catch{}async function Nn(e){let t=new Uint8Array(e.byteLength);t.set(e);let r=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=await new Response(r).arrayBuffer();return new Uint8Array(n)}async function Dt(e,t="auto"){if(t==="none"||e.byteLength===0)return {bytes:e,algorithm:"none"};if(t!=="fflate"&&typeof CompressionStream=="function")try{return {bytes:await Nn(e),algorithm:"gzip"}}catch{}try{return {bytes:yr(e),algorithm:"gzip"}}catch{return {bytes:e,algorithm:"none"}}}var Dn=Object.defineProperty,Ln=(e,t,r)=>t in e?Dn(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,g=(e,t,r)=>Ln(e,typeof t!="symbol"?t+"":t,r),gr,z=(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[e.Asset=7]="Asset",e))(z||{}),O=(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[e.CustomElement=16]="CustomElement",e))(O||{}),se=(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))(se||{}),me=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(me||{}),De=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(De||{}),ke=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ke||{}),Y=(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",e))(Y||{}),vr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},br={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},nt={},Ar={},_n=()=>!!globalThis.Zone;function Xt(e){if(nt[e])return nt[e];let t=globalThis[e],r=t.prototype,n=e in vr?vr[e]:void 0,i=!!(n&&n.every(c=>{var a,f;return !!((f=(a=Object.getOwnPropertyDescriptor(r,c))==null?void 0:a.get)!=null&&f.toString().includes("[native code]"))})),s=e in br?br[e]:void 0,o=!!(s&&s.every(c=>{var a;return typeof r[c]=="function"&&((a=r[c])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!_n())return nt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let a=c.contentWindow;if(!a)return t.prototype;let f=a[e].prototype;if(!f)return c.remove(),r;let l=navigator.userAgent;return l.includes("Safari")&&!l.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Ar[e]=()=>c.remove()):c.remove(),nt[e]=f}catch{return r}}var Lt={};function le(e,t,r){var n,i;let s=(n=Lt[e])==null?void 0:n[r];if(s)return s.call(t);let o=Xt(e),c=(i=Object.getOwnPropertyDescriptor(o,r))==null?void 0:i.get;return c?((Lt[e]||(Lt[e]={}))[r]=c,c.call(t)):t[r]}var _t={};function Nr(e,t,r){let n=`${e}.${String(r)}`;if(_t[n])return _t[n].bind(t);let s=Xt(e)[r];return typeof s!="function"?t[r]:(_t[n]=s,s.bind(t))}function zn(e){return le("Node",e,"ownerDocument")}function Un(e){return le("Node",e,"childNodes")}function Pn(e){return le("Node",e,"parentNode")}function Fn(e){return le("Node",e,"parentElement")}function Bn(e){return le("Node",e,"textContent")}function Wn(e){return le("Node",e,"firstChild")}function Hn(e){return le("Node",e,"lastChild")}function Gn(e){return le("Node",e,"nextSibling")}function jn(e){return le("Node",e,"previousSibling")}function Vn(e,t){return Nr("Node",e,"contains")(t)}function $n(e){return Nr("Node",e,"getRootNode")()}function qn(e){return !e||!("host"in e)?null:le("ShadowRoot",e,"host")}function Zn(e){return e.styleSheets}function Yn(e){return !e||!("shadowRoot"in e)?null:le("Element",e,"shadowRoot")}function Xn(e,t){return le("Element",e,"querySelector")(t)}function Jn(e,t){return le("Element",e,"querySelectorAll")(t)}function Dr(){return [Xt("MutationObserver").constructor,Ar.MutationObserver??(()=>{})]}var Ve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ve=()=>new Date().getTime());function Re(e,t,r){try{if(!(t in e))return ()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n;}}catch{return ()=>{}}}var w={ownerDocument:zn,childNodes:Un,parentNode:Pn,parentElement:Fn,textContent:Bn,firstChild:Wn,lastChild:Hn,nextSibling:Gn,previousSibling:jn,contains:Vn,getRootNode:$n,host:qn,styleSheets:Zn,shadowRoot:Yn,querySelector:Xn,querySelectorAll:Jn,nowTimestamp:Ve,mutationObserverCtor:Dr,patch:Re};function Lr(e){return e.nodeType===e.ELEMENT_NODE}function He(e){let t=e&&"host"in e&&"mode"in e&&w.host(e)||null;return !!(t&&"shadowRoot"in t&&w.shadowRoot(t)===e)}function Ge(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Kn(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Qn(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Pt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>_r(i,r)).join("");return Kn(n)}catch{return null}}function _r(e,t){if(ti(e)){let r;try{r=Pt(e.styleSheet)||Qn(e);}catch{r=e.cssText;}return e.styleSheet.href?ht(r,e.styleSheet.href):r}else {let r=e.cssText;return ri(e)&&e.selectorText.includes(":")&&(r=ei(r)),t?ht(r,t):r}}function ei(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function ti(e){return "styleSheet"in e}function ri(e){return "selectorText"in e}var ut=class{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap);}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n));}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i);}this.idNodeMap.set(t,r);}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}};function ni(){return new ut}function ct({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:s}){let o=i||"",c=n&&ve(n);return (t[r.toLowerCase()]||c&&t[c])&&(s?o=s(o,e):o="*".repeat(o.length)),o}function ve(e){return e.toLowerCase()}var Sr="__rrweb_original__";function ii(e){let t=e.getContext("2d");if(!t)return true;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let s=t.getImageData,o=Sr in s?s[Sr]:s;if(new Uint32Array(o.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(a=>a!==0))return false}return true}function ft(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ve(t):null}function zr(e,t){let r;try{r=new URL(e,t??window.location.href);}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function si(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var oi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ai=/^(?:[a-z+]+:)?\/\//i,li=/^www\..*/i,ui=/^(data:)([^,]*),(.*)/i;function ht(e,t){return (e||"").replace(oi,(r,n,i,s,o,c)=>{let a=i||o||c,f=n||s||"";if(!a)return r;if(ai.test(a)||li.test(a))return `url(${f}${a}${f})`;if(ui.test(a))return `url(${f}${a}${f})`;if(a[0]==="/")return `url(${f}${si(t)+a}${f})`;let l=a.split("#")[0],h=a.substring(l.length),d=t.split("#")[0].split("/"),p=l.split("/");d.pop();for(let m of p)m!=="."&&(m===".."?d.pop():d.push(m));return `url(${f}${d.join("/")}${h}${f})`})}function it(e,t=false){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function ci(e,t,r=false){let n=Array.from(t.childNodes),i=[],s=0;if(n.length>1&&e&&typeof e=="string"){let o=it(e,r),c=o.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let f=it(n[a].textContent,r),l=100,h=3;for(;h<f.length&&(f[h].match(/[a-zA-Z0-9]/)||f.indexOf(f.substring(0,h),1)!==-1);h++);for(;h<f.length;h++){let d=f.substring(0,h),p=o.split(d),m=-1;if(p.length===2)m=p[0].length;else if(p.length>2&&p[0]===""&&n[a-1].textContent!=="")m=o.indexOf(d,1);else if(p.length===1){if(d=d.substring(0,d.length-1),p=o.split(d),p.length<=1)return i.push(e),i;h=l+1;}else h===f.length-1&&(m=o.indexOf(d));if(p.length>=2&&h>l){let u=n[a-1].textContent;if(u&&typeof u=="string"){let v=it(u).length;m=o.indexOf(d,v);}m===-1&&(m=p[0].length);}if(m!==-1){let u=Math.floor(m/c);for(;u>0&&u<e.length;){if(s+=1,s>50*n.length)return i.push(e),i;let v=it(e.substring(0,u),r);if(v.length===m){i.push(e.substring(0,u)),e=e.substring(u),o=o.substring(m);break}else v.length<m?u+=Math.max(1,Math.floor((m-v.length)/c)):u-=Math.max(1,Math.floor((v.length-m)*c));}break}}}}return i.push(e),i}function fi(e,t){return ci(e,t).join("/* rr_split */")}var hi=1,di=new RegExp("[^a-z0-9-_:]"),dt=-2;function Ur(){return hi++}function pi(e){if(e instanceof HTMLFormElement)return "form";let t=ve(e.tagName);return di.test(t)?"div":t}var xe,wr,mi=/^[^ \t\n\r\u000c]+/,yi=/^[, \t\n\r\u000c]+/;function gi(e,t){if(t.trim()==="")return t;let r=0;function n(s){let o,c=s.exec(t.substring(r));return c?(o=c[0],r+=o.length,o):""}let i=[];for(;n(yi),!(r>=t.length);){let s=n(mi);if(s.slice(-1)===",")s=Oe(e,s.substring(0,s.length-1)),i.push(s);else {let o="";s=Oe(e,s);let c=false;for(;;){let a=t.charAt(r);if(a===""){i.push((s+o).trim());break}else if(c)a===")"&&(c=false);else if(a===","){r+=1,i.push((s+o).trim());break}else a==="("&&(c=true);o+=a,r+=1;}}}return i.join(", ")}var Cr=new WeakMap;function Oe(e,t){return !t||t.trim()===""?t:Jt(e,t)}function vi(e){return !!(e.tagName==="svg"||e.ownerSVGElement)}function Jt(e,t){let r=Cr.get(e);if(r||(r=e.createElement("a"),Cr.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Pr(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Oe(e,n):r==="srcset"?gi(e,n):r==="style"?ht(n,Jt(e)):t==="object"&&r==="data"?Oe(e,n):n)}function Fr(e,t,r){return ["video","audio"].includes(e)&&ve(t)==="autoplay"}function bi(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return !0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return !0}if(r)return e.matches(r)}catch{}return false}function pt(e,t,r){if(!e)return false;if(e.nodeType!==e.ELEMENT_NODE)return r?pt(w.parentNode(e),t,r):false;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return true}return r?pt(w.parentNode(e),t,r):false}function Br(e,t,r,n){let i;if(Lr(e)){if(i=e,!w.childNodes(i).length)return false}else {if(w.parentElement(e)===null)return false;i=w.parentElement(e);}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return !0}else if(i.classList.contains(t))return !0}else if(pt(i,t,n))return !0;if(r){if(n){if(i.closest(r))return !0}else if(i.matches(r))return !0}}catch{}return false}function Si(e,t,r){let n=e.contentWindow;if(!n)return;let i=false,s;try{s=n.document.readyState;}catch{return}if(s!=="complete"){let c=setTimeout(()=>{i||(t(),i=true);},r);e.addEventListener("load",()=>{clearTimeout(c),i=true,t();});return}let o="about:blank";if(n.location.href!==o||e.src===o||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t);}function wi(e,t,r){let n=false,i;try{i=e.sheet;}catch{return}if(i)return;let s=setTimeout(()=>{n||(t(),n=true);},r);e.addEventListener("load",()=>{clearTimeout(s),n=true,t();});}function Ci(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:o,inlineStylesheet:c,maskInputOptions:a={},maskTextFn:f,maskInputFn:l,dataURLOptions:h={},inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:u=false,cssCaptured:v=false}=t,C=Mi(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Y.Document,childNodes:[],compatMode:e.compatMode}:{type:Y.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return {type:Y.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return Ei(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:c,maskInputOptions:a,maskInputFn:l,dataURLOptions:h,inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:u,rootId:C});case e.TEXT_NODE:return Ri(e,{doc:r,needsMask:o,maskTextFn:f,rootId:C,cssCaptured:v});case e.CDATA_SECTION_NODE:return {type:Y.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return {type:Y.Comment,textContent:w.textContent(e)||"",rootId:C};default:return false}}function Mi(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Ri(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:s}=t,o=w.parentNode(e),c=o&&o.tagName,a="",f=c==="STYLE"?true:void 0,l=c==="SCRIPT"?true:void 0;return l?a="SCRIPT_PLACEHOLDER":s||(a=w.textContent(e),f&&a&&(a=ht(a,Jt(t.doc)))),!f&&!l&&a&&r&&(a=n?n(a,w.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Y.Text,textContent:a||"",rootId:i}}function Ei(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:s,maskInputOptions:o={},maskInputFn:c,dataURLOptions:a={},inlineImages:f,recordCanvas:l,keepIframeSrcFn:h,newlyAddedElement:d=false,rootId:p}=t,m=bi(e,n,i),u=pi(e),v={},C=e.attributes.length;for(let y=0;y<C;y++){let M=e.attributes[y];Fr(u,M.name,M.value)||(v[M.name]=Pr(r,u,ve(M.name),M.value));}if(u==="link"&&s){let y=Array.from(r.styleSheets).find(I=>I.href===e.href),M=null;y&&(M=Pt(y)),M&&(delete v.rel,delete v.href,v._cssText=M);}if(u==="style"&&e.sheet){let y=Pt(e.sheet);y&&(e.childNodes.length>1&&(y=fi(y,e)),v._cssText=y);}if(["input","textarea","select"].includes(u)){let y=e.value,M=e.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&y?v.value=ct({element:e,type:ft(e),tagName:u,value:y,maskInputOptions:o,maskInputFn:c}):M&&(v.checked=M);}if(u==="option"&&(e.selected&&!o.select?v.selected=true:delete v.selected),u==="dialog"&&e.open&&(v.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),u==="canvas"&&l){if(e.__context==="2d")ii(e)||(v.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let y=e.toDataURL(a.type,a.quality),M=r.createElement("canvas");M.width=e.width,M.height=e.height;let I=M.toDataURL(a.type,a.quality);y!==I&&(v.rr_dataURL=y);}}if(u==="img"&&f){xe||(xe=r.createElement("canvas"),wr=xe.getContext("2d"));let y=e,M=y.currentSrc||y.getAttribute("src")||"<unknown-src>",I=y.crossOrigin,x=()=>{y.removeEventListener("load",x);try{xe.width=y.naturalWidth,xe.height=y.naturalHeight,wr.drawImage(y,0,0),v.rr_dataURL=xe.toDataURL(a.type,a.quality);}catch(k){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);return}else console.warn(`Cannot inline img src=${M}! Error: ${k}`);}y.crossOrigin==="anonymous"&&(I?v.crossOrigin=I:y.removeAttribute("crossorigin"));};y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);}if(["audio","video"].includes(u)){let y=v;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume;}if(d||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),m){let{width:y,height:M}=e.getBoundingClientRect();v={class:v.class,rr_width:`${y}px`,rr_height:`${M}px`};}u==="iframe"&&!h(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src);let b;try{customElements.get(u)&&(b=!0);}catch{}return {type:Y.Element,tagName:u,attributes:v,childNodes:[],isSVG:vi(e)||void 0,needBlock:m,rootId:p,isCustom:b}}function G(e){return e==null?"":e.toLowerCase()}function Wr(e){return e===true||e==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Ii(e,t){if(t.comment&&e.type===Y.Comment)return true;if(e.type===Y.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&zr(e.attributes.href)==="js"))return true;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(G(e.attributes.name).match(/^msapplication-tile(image|color)$/)||G(e.attributes.name)==="application-name"||G(e.attributes.rel)==="icon"||G(e.attributes.rel)==="apple-touch-icon"||G(e.attributes.rel)==="shortcut icon")))return true;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&G(e.attributes.name).match(/^description|keywords$/))return true;if(t.headMetaSocial&&(G(e.attributes.property).match(/^(og|twitter|fb):/)||G(e.attributes.name).match(/^(og|twitter):/)||G(e.attributes.name)==="pinterest"))return true;if(t.headMetaRobots&&(G(e.attributes.name)==="robots"||G(e.attributes.name)==="googlebot"||G(e.attributes.name)==="bingbot"))return true;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return true;if(t.headMetaAuthorship&&(G(e.attributes.name)==="author"||G(e.attributes.name)==="generator"||G(e.attributes.name)==="framework"||G(e.attributes.name)==="publisher"||G(e.attributes.name)==="progid"||G(e.attributes.property).match(/^article:/)||G(e.attributes.property).match(/^product:/)))return true;if(t.headMetaVerification&&(G(e.attributes.name)==="google-site-verification"||G(e.attributes.name)==="yandex-verification"||G(e.attributes.name)==="csrf-token"||G(e.attributes.name)==="p:domain_verify"||G(e.attributes.name)==="verify-v1"||G(e.attributes.name)==="verification"||G(e.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function Ae(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:c,skipChild:a=false,inlineStylesheet:f=true,maskInputOptions:l={},maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m={},inlineImages:u=false,recordCanvas:v=false,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y=5e3,onStylesheetLoad:M,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>false,newlyAddedElement:k=false,cssCaptured:E=false}=t,{needsMask:R}=t,{preserveWhiteSpace:B=true}=t;R||(R=Br(e,o,c,R===void 0));let A=Ci(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,dataURLOptions:m,inlineImages:u,recordCanvas:v,keepIframeSrcFn:x,newlyAddedElement:k,cssCaptured:E});if(!A)return console.warn(e,"not serialized"),null;let T;n.hasNode(e)?T=n.getId(e):Ii(A,p)||!B&&A.type===Y.Text&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?T=dt:T=Ur();let S=Object.assign(A,{id:T});if(n.add(e,S),T===dt)return null;C&&C(e);let L=!a;if(S.type===Y.Element){L=L&&!S.needBlock,delete S.needBlock;let U=w.shadowRoot(e);U&&Ge(U)&&(S.isShadowHost=true);}if((S.type===Y.Document||S.type===Y.Element)&&L){p.headWhitespace&&S.type===Y.Element&&S.tagName==="head"&&(B=false);let U={doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:c,skipChild:a,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:u,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x,cssCaptured:false};if(!(S.type===Y.Element&&S.tagName==="textarea"&&S.attributes.value!==void 0)){S.type===Y.Element&&S.attributes._cssText!==void 0&&typeof S.attributes._cssText=="string"&&(U.cssCaptured=true);for(let q of Array.from(w.childNodes(e))){let Z=Ae(q,U);Z&&S.childNodes.push(Z);}}let N=null;if(Lr(e)&&(N=w.shadowRoot(e)))for(let q of Array.from(w.childNodes(N))){let Z=Ae(q,U);Z&&(Ge(N)&&(Z.isShadow=true),S.childNodes.push(Z));}}let j=w.parentNode(e);return j&&He(j)&&Ge(j)&&(S.isShadow=true),S.type===Y.Element&&S.tagName==="iframe"&&Si(e,()=>{let U=e.contentDocument;if(U&&b){let N=Ae(U,{doc:U,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:c,skipChild:false,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:u,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x});N&&b(e,N);}},y),S.type===Y.Element&&S.tagName==="link"&&typeof S.attributes.rel=="string"&&(S.attributes.rel==="stylesheet"||S.attributes.rel==="preload"&&typeof S.attributes.href=="string"&&zr(S.attributes.href)==="css")&&wi(e,()=>{if(M){let U=Ae(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:c,skipChild:false,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:u,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x});U&&M(e,U);}},I),S}function xi(e,t){let{mirror:r=new ut,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:c=true,inlineImages:a=false,recordCanvas:f=false,maskAllInputs:l=false,maskTextFn:h,maskInputFn:d,slimDOM:p=false,dataURLOptions:m,preserveWhiteSpace:u,onSerialize:v,onIframeLoad:C,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:I=()=>false}=t,x=l===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:l===false?{password:true}:l,k=Wr(p);return Ae(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:s,maskTextSelector:o,skipChild:false,inlineStylesheet:c,maskInputOptions:x,maskTextFn:h,maskInputFn:d,slimDOMOptions:k,dataURLOptions:m,inlineImages:a,recordCanvas:f,preserveWhiteSpace:u,onSerialize:v,onIframeLoad:C,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:I,newlyAddedElement:false})}var Ft=class e{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType");}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return false;if(t===this)return true}else return false;for(;t.parentNode;){if(t.parentNode===this)return true;t=t.parentNode;}return false}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return "RRNode"}};function ee(e,t,r=document){let n={capture:true,passive:true};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Te=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
'use strict';var protocolVersion=require('@askdepth/contracts/protocol-version');var ze=45e3,Ke=45e3,Mt=3145728,Sn=Math.floor(1572864),Ue=45*1024,nr=128,ir=4*1024*1024,Rt=8,ue=2,Je=3,Qe=0,et=1;var sr=3;var tt=6;var or=typeof TextEncoder<"u"?new TextEncoder:void 0;function Et(e){if(or)return or.encode(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function rt(e){return Et(JSON.stringify(e)).length}function ar(e,t){if(e.byteLength<=t)return [e];let r=[];for(let n=0;n<e.byteLength;n+=t)r.push(e.subarray(n,Math.min(n+t,e.byteLength)));return r}function Pe(e){let t=/Mobi|Android|iPhone|iPad|iPod/i.test(e),r=/AppleWebKit/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Android/i.test(e);return t||r?Math.floor(1.5*1024*1024):3*1024*1024}var ce=Uint8Array,oe=Uint16Array,At=Int32Array,Nt=new ce([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Dt=new ce([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),lr=new ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hr=function(e,t){for(var r=new oe(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new At(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return {b:r,r:i}},dr=hr(Nt,2),wn=dr.b,xt=dr.r;wn[28]=258,xt[258]=28;var pr=hr(Dt,0),ur=pr.r,kt=new oe(32768);for(P=0;P<32768;++P)de=(P&43690)>>1|(P&21845)<<1,de=(de&52428)>>2|(de&13107)<<2,de=(de&61680)>>4|(de&3855)<<4,kt[P]=((de&65280)>>8|(de&255)<<8)>>1;var de,P,We=(function(e,t,r){for(var n=e.length,i=0,s=new oe(t);i<n;++i)e[i]&&++s[e[i]-1];var o=new oe(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var l;for(l=new oe(n),i=0;i<n;++i)e[i]&&(l[i]=kt[o[e[i]-1]++]>>15-e[i]);return l}),Ce=new ce(288);for(P=0;P<144;++P)Ce[P]=8;var P;for(P=144;P<256;++P)Ce[P]=9;var P;for(P=256;P<280;++P)Ce[P]=7;var P;for(P=280;P<288;++P)Ce[P]=8;var P,nt=new ce(32);for(P=0;P<32;++P)nt[P]=5;var P,Cn=We(Ce,9);var Mn=We(nt,5);var mr=function(e){return (e+7)/8|0},Rn=function(e,t,r){return (r==null||r>e.length)&&(r=e.length),new ce(e.subarray(t,r))};var pe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},Fe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16;},It=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return {t:gr,l:0};if(i==1){var o=new ce(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(I,x){return I.f-x.f}),r.push({s:-1,f:25001});var l=r[0],a=r[1],f=0,u=1,h=2;for(r[0]={s:-1,f:l.f+a.f,l,r:a};u!=i-1;)l=r[r[f].f<r[h].f?f++:h++],a=r[f!=u&&r[f].f<r[h].f?f++:h++],r[u++]={s:-1,f:l.f+a.f,l,r:a};for(var d=s[0].s,n=1;n<i;++n)s[n].s>d&&(d=s[n].s);var p=new oe(d+1),m=Tt(r[u-1],p,0);if(m>t){var n=0,c=0,v=m-t,C=1<<v;for(s.sort(function(x,k){return p[k.s]-p[x.s]||x.f-k.f});n<i;++n){var b=s[n].s;if(p[b]>t)c+=C-(1<<m-p[b]),p[b]=t;else break}for(c>>=v;c>0;){var y=s[n].s;p[y]<t?c-=1<<t-p[y]++-1:++n;}for(;n>=0&&c;--n){var M=s[n].s;p[M]==t&&(--p[M],++c);}m=t;}return {t:new ce(p),l:m}},Tt=function(e,t,r){return e.s==-1?Math.max(Tt(e.l,t,r+1),Tt(e.r,t,r+1)):t[e.s]=r},cr=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new oe(++t),n=0,i=e[0],s=1,o=function(a){r[n++]=a;},l=1;l<=t;++l)if(e[l]==i&&l!=t)++s;else {if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0);}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0);}for(;s--;)o(i);s=1,i=e[l];}return {c:r.subarray(0,n),n:t}},Be=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},yr=function(e,t,r){var n=r.length,i=mr(t+2);e[i]=n&255,e[i+1]=n>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<n;++s)e[i+s+4]=r[s];return (i+4+n)*8},fr=function(e,t,r,n,i,s,o,l,a,f,u){pe(t,u++,r),++i[256];for(var h=It(i,15),d=h.t,p=h.l,m=It(s,15),c=m.t,v=m.l,C=cr(d),b=C.c,y=C.n,M=cr(c),I=M.c,x=M.n,k=new oe(19),E=0;E<b.length;++E)++k[b[E]&31];for(var E=0;E<I.length;++E)++k[I[E]&31];for(var R=It(k,7),B=R.t,A=R.l,T=19;T>4&&!B[lr[T-1]];--T);var S=f+5<<3,L=Be(i,Ce)+Be(s,nt)+o,V=Be(i,d)+Be(s,c)+o+14+3*T+Be(k,B)+2*k[16]+3*k[17]+7*k[18];if(a>=0&&S<=L&&S<=V)return yr(t,u,e.subarray(a,a+f));var U,N,q,Y;if(pe(t,u,1+(V<L)),u+=2,V<L){U=We(d,p),N=d,q=We(c,v),Y=c;var ye=We(B,A);pe(t,u,y-257),pe(t,u+5,x-1),pe(t,u+10,T-4),u+=14;for(var E=0;E<T;++E)pe(t,u+3*E,B[lr[E]]);u+=3*T;for(var J=[b,I],he=0;he<2;++he)for(var Q=J[he],E=0;E<Q.length;++E){var X=Q[E]&31;pe(t,u,ye[X]),u+=B[X],X>15&&(pe(t,u,Q[E]>>5&127),u+=Q[E]>>12);}}else U=Cn,N=Ce,q=Mn,Y=nt;for(var E=0;E<l;++E){var j=n[E];if(j>255){var X=j>>18&31;Fe(t,u,U[X+257]),u+=N[X+257],X>7&&(pe(t,u,j>>23&31),u+=Nt[X]);var K=j&31;Fe(t,u,q[K]),u+=Y[K],K>3&&(Fe(t,u,j>>5&8191),u+=Dt[K]);}else Fe(t,u,U[j]),u+=N[j];}return Fe(t,u,U[256]),u+N[256]},En=new At([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gr=new ce(0),In=function(e,t,r,n,i,s){var o=s.z||e.length,l=new ce(n+o+5*(1+Math.ceil(o/7e3))+i),a=l.subarray(n,l.length-i),f=s.l,u=(s.r||0)&7;if(t){u&&(a[0]=s.r>>3);for(var h=En[t-1],d=h>>13,p=h&8191,m=(1<<r)-1,c=s.p||new oe(32768),v=s.h||new oe(m+1),C=Math.ceil(r/3),b=2*C,y=function(H){return (e[H]^e[H+1]<<C^e[H+2]<<b)&m},M=new At(25e3),I=new oe(288),x=new oe(32),k=0,E=0,R=s.i||0,B=0,A=s.w||0,T=0;R+2<o;++R){var S=y(R),L=R&32767,V=v[S];if(c[L]=V,v[S]=L,A<=R){var U=o-R;if((k>7e3||B>24576)&&(U>423||!f)){u=fr(e,a,0,M,I,x,E,B,T,R-T,u),B=k=E=0,T=R;for(var N=0;N<286;++N)I[N]=0;for(var N=0;N<30;++N)x[N]=0;}var q=2,Y=0,ye=p,J=L-V&32767;if(U>2&&S==y(R-J))for(var he=Math.min(d,U)-1,Q=Math.min(32767,R),X=Math.min(258,U);J<=Q&&--ye&&L!=V;){if(e[R+q]==e[R+q-J]){for(var j=0;j<X&&e[R+j]==e[R+j-J];++j);if(j>q){if(q=j,Y=J,j>he)break;for(var K=Math.min(J,j-2),le=0,N=0;N<K;++N){var re=R-J+N&32767,Se=c[re],we=re-Se&32767;we>le&&(le=we,V=re);}}}L=V,V=c[L],J+=L-V&32767;}if(Y){M[B++]=268435456|xt[q]<<18|ur[Y];var _=xt[q]&31,ne=ur[Y]&31;E+=Nt[_]+Dt[ne],++I[257+_],++x[ne],A=R+q,++k;}else M[B++]=e[R],++I[e[R]];}}for(R=Math.max(R,A);R<o;++R)M[B++]=e[R],++I[e[R]];u=fr(e,a,f,M,I,x,E,B,T,R-T,u),f||(s.r=u&7|a[u/8|0]<<3,u-=7,s.h=v,s.p=c,s.i=R,s.w=A);}else {for(var R=s.w||0;R<o+f;R+=65535){var W=R+65535;W>=o&&(a[u/8|0]=f,W=o),u=yr(a,u+1,e.subarray(R,W));}s.i=o;}return Rn(l,0,n+mr(u)+i)},xn=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r;}return e})(),kn=function(){var e=-1;return {p:function(t){for(var r=e,n=0;n<t.length;++n)r=xn[r&255^t[n]]^r>>>8;e=r;},d:function(){return ~e}}};var Tn=function(e,t,r,n,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new ce(s.length+e.length);o.set(s),o.set(e,s.length),e=o,i.w=s.length;}return In(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,i)};var Ot=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},On=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Ot(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n);}};var An=function(e){return 10+(e.filename?e.filename.length+1:0)};function vr(e,t){t||(t={});var r=kn(),n=e.length;r.p(e);var i=Tn(e,t,An(t),8),s=i.length;return On(i,t),Ot(i,s-8,r.d()),Ot(i,s-4,n),i}var Nn=typeof TextDecoder<"u"&&new TextDecoder,Dn=0;try{Nn.decode(gr,{stream:!0}),Dn=1;}catch{}async function Ln(e){let t=new Uint8Array(e.byteLength);t.set(e);let r=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=await new Response(r).arrayBuffer();return new Uint8Array(n)}async function Lt(e,t="auto"){if(t==="none"||e.byteLength===0)return {bytes:e,algorithm:"none"};if(t!=="fflate"&&typeof CompressionStream=="function")try{return {bytes:await Ln(e),algorithm:"gzip"}}catch{}try{return {bytes:vr(e),algorithm:"gzip"}}catch{return {bytes:e,algorithm:"none"}}}var _n=Object.defineProperty,zn=(e,t,r)=>t in e?_n(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,g=(e,t,r)=>zn(e,typeof t!="symbol"?t+"":t,r),br,z=(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[e.Asset=7]="Asset",e))(z||{}),O=(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[e.CustomElement=16]="CustomElement",e))(O||{}),ie=(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))(ie||{}),me=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(me||{}),De=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(De||{}),ke=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ke||{}),Z=(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",e))(Z||{}),Sr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},wr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},it={},Dr={},Un=()=>!!globalThis.Zone;function Kt(e){if(it[e])return it[e];let t=globalThis[e],r=t.prototype,n=e in Sr?Sr[e]:void 0,i=!!(n&&n.every(l=>{var a,f;return !!((f=(a=Object.getOwnPropertyDescriptor(r,l))==null?void 0:a.get)!=null&&f.toString().includes("[native code]"))})),s=e in wr?wr[e]:void 0,o=!!(s&&s.every(l=>{var a;return typeof r[l]=="function"&&((a=r[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!Un())return it[e]=t.prototype,t.prototype;try{let l=document.createElement("iframe");l.style.display="none",document.body.appendChild(l);let a=l.contentWindow;if(!a)return t.prototype;let f=a[e].prototype;if(!f)return l.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(l.classList.add("rr-block"),l.setAttribute("__rrwebUntaintedMutationObserver",""),Dr[e]=()=>l.remove()):l.remove(),it[e]=f}catch{return r}}var _t={};function ae(e,t,r){var n,i;let s=(n=_t[e])==null?void 0:n[r];if(s)return s.call(t);let o=Kt(e),l=(i=Object.getOwnPropertyDescriptor(o,r))==null?void 0:i.get;return l?((_t[e]||(_t[e]={}))[r]=l,l.call(t)):t[r]}var zt={};function Lr(e,t,r){let n=`${e}.${String(r)}`;if(zt[n])return zt[n].bind(t);let s=Kt(e)[r];return typeof s!="function"?t[r]:(zt[n]=s,s.bind(t))}function Pn(e){return ae("Node",e,"ownerDocument")}function Fn(e){return ae("Node",e,"childNodes")}function Bn(e){return ae("Node",e,"parentNode")}function Wn(e){return ae("Node",e,"parentElement")}function Hn(e){return ae("Node",e,"textContent")}function Gn(e){return ae("Node",e,"firstChild")}function Vn(e){return ae("Node",e,"lastChild")}function jn(e){return ae("Node",e,"nextSibling")}function $n(e){return ae("Node",e,"previousSibling")}function qn(e,t){return Lr("Node",e,"contains")(t)}function Yn(e){return Lr("Node",e,"getRootNode")()}function Zn(e){return !e||!("host"in e)?null:ae("ShadowRoot",e,"host")}function Xn(e){return e.styleSheets}function Kn(e){return !e||!("shadowRoot"in e)?null:ae("Element",e,"shadowRoot")}function Jn(e,t){return ae("Element",e,"querySelector")(t)}function Qn(e,t){return ae("Element",e,"querySelectorAll")(t)}function _r(){return [Kt("MutationObserver").constructor,Dr.MutationObserver??(()=>{})]}var $e=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||($e=()=>new Date().getTime());function Re(e,t,r){try{if(!(t in e))return ()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n;}}catch{return ()=>{}}}var w={ownerDocument:Pn,childNodes:Fn,parentNode:Bn,parentElement:Wn,textContent:Hn,firstChild:Gn,lastChild:Vn,nextSibling:jn,previousSibling:$n,contains:qn,getRootNode:Yn,host:Zn,styleSheets:Xn,shadowRoot:Kn,querySelector:Jn,querySelectorAll:Qn,nowTimestamp:$e,mutationObserverCtor:_r,patch:Re};function zr(e){return e.nodeType===e.ELEMENT_NODE}function Ge(e){let t=e&&"host"in e&&"mode"in e&&w.host(e)||null;return !!(t&&"shadowRoot"in t&&w.shadowRoot(t)===e)}function Ve(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function ei(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function ti(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Ft(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>Ur(i,r)).join("");return ei(n)}catch{return null}}function Ur(e,t){if(ni(e)){let r;try{r=Ft(e.styleSheet)||ti(e);}catch{r=e.cssText;}return e.styleSheet.href?dt(r,e.styleSheet.href):r}else {let r=e.cssText;return ii(e)&&e.selectorText.includes(":")&&(r=ri(r)),t?dt(r,t):r}}function ri(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function ni(e){return "styleSheet"in e}function ii(e){return "selectorText"in e}var ct=class{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap);}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n));}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i);}this.idNodeMap.set(t,r);}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}};function si(){return new ct}function ft({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:s}){let o=i||"",l=n&&ve(n);return (t[r.toLowerCase()]||l&&t[l])&&(s?o=s(o,e):o="*".repeat(o.length)),o}function ve(e){return e.toLowerCase()}var Cr="__rrweb_original__";function oi(e){let t=e.getContext("2d");if(!t)return true;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let s=t.getImageData,o=Cr in s?s[Cr]:s;if(new Uint32Array(o.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(a=>a!==0))return false}return true}function ht(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ve(t):null}function Pr(e,t){let r;try{r=new URL(e,t??window.location.href);}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function ai(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var li=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ui=/^(?:[a-z+]+:)?\/\//i,ci=/^www\..*/i,fi=/^(data:)([^,]*),(.*)/i;function dt(e,t){return (e||"").replace(li,(r,n,i,s,o,l)=>{let a=i||o||l,f=n||s||"";if(!a)return r;if(ui.test(a)||ci.test(a))return `url(${f}${a}${f})`;if(fi.test(a))return `url(${f}${a}${f})`;if(a[0]==="/")return `url(${f}${ai(t)+a}${f})`;let u=a.split("#")[0],h=a.substring(u.length),d=t.split("#")[0].split("/"),p=u.split("/");d.pop();for(let m of p)m!=="."&&(m===".."?d.pop():d.push(m));return `url(${f}${d.join("/")}${h}${f})`})}function st(e,t=false){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function hi(e,t,r=false){let n=Array.from(t.childNodes),i=[],s=0;if(n.length>1&&e&&typeof e=="string"){let o=st(e,r),l=o.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let f=st(n[a].textContent,r),u=100,h=3;for(;h<f.length&&(f[h].match(/[a-zA-Z0-9]/)||f.indexOf(f.substring(0,h),1)!==-1);h++);for(;h<f.length;h++){let d=f.substring(0,h),p=o.split(d),m=-1;if(p.length===2)m=p[0].length;else if(p.length>2&&p[0]===""&&n[a-1].textContent!=="")m=o.indexOf(d,1);else if(p.length===1){if(d=d.substring(0,d.length-1),p=o.split(d),p.length<=1)return i.push(e),i;h=u+1;}else h===f.length-1&&(m=o.indexOf(d));if(p.length>=2&&h>u){let c=n[a-1].textContent;if(c&&typeof c=="string"){let v=st(c).length;m=o.indexOf(d,v);}m===-1&&(m=p[0].length);}if(m!==-1){let c=Math.floor(m/l);for(;c>0&&c<e.length;){if(s+=1,s>50*n.length)return i.push(e),i;let v=st(e.substring(0,c),r);if(v.length===m){i.push(e.substring(0,c)),e=e.substring(c),o=o.substring(m);break}else v.length<m?c+=Math.max(1,Math.floor((m-v.length)/l)):c-=Math.max(1,Math.floor((v.length-m)*l));}break}}}}return i.push(e),i}function di(e,t){return hi(e,t).join("/* rr_split */")}var pi=1,mi=new RegExp("[^a-z0-9-_:]"),pt=-2;function Fr(){return pi++}function yi(e){if(e instanceof HTMLFormElement)return "form";let t=ve(e.tagName);return mi.test(t)?"div":t}var xe,Mr,gi=/^[^ \t\n\r\u000c]+/,vi=/^[, \t\n\r\u000c]+/;function bi(e,t){if(t.trim()==="")return t;let r=0;function n(s){let o,l=s.exec(t.substring(r));return l?(o=l[0],r+=o.length,o):""}let i=[];for(;n(vi),!(r>=t.length);){let s=n(gi);if(s.slice(-1)===",")s=Oe(e,s.substring(0,s.length-1)),i.push(s);else {let o="";s=Oe(e,s);let l=false;for(;;){let a=t.charAt(r);if(a===""){i.push((s+o).trim());break}else if(l)a===")"&&(l=false);else if(a===","){r+=1,i.push((s+o).trim());break}else a==="("&&(l=true);o+=a,r+=1;}}}return i.join(", ")}var Rr=new WeakMap;function Oe(e,t){return !t||t.trim()===""?t:Jt(e,t)}function Si(e){return !!(e.tagName==="svg"||e.ownerSVGElement)}function Jt(e,t){let r=Rr.get(e);if(r||(r=e.createElement("a"),Rr.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Br(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Oe(e,n):r==="srcset"?bi(e,n):r==="style"?dt(n,Jt(e)):t==="object"&&r==="data"?Oe(e,n):n)}function Wr(e,t,r){return ["video","audio"].includes(e)&&ve(t)==="autoplay"}function wi(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return !0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return !0}if(r)return e.matches(r)}catch{}return false}function mt(e,t,r){if(!e)return false;if(e.nodeType!==e.ELEMENT_NODE)return r?mt(w.parentNode(e),t,r):false;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return true}return r?mt(w.parentNode(e),t,r):false}function Hr(e,t,r,n){let i;if(zr(e)){if(i=e,!w.childNodes(i).length)return false}else {if(w.parentElement(e)===null)return false;i=w.parentElement(e);}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return !0}else if(i.classList.contains(t))return !0}else if(mt(i,t,n))return !0;if(r){if(n){if(i.closest(r))return !0}else if(i.matches(r))return !0}}catch{}return false}function Ci(e,t,r){let n=e.contentWindow;if(!n)return;let i=false,s;try{s=n.document.readyState;}catch{return}if(s!=="complete"){let l=setTimeout(()=>{i||(t(),i=true);},r);e.addEventListener("load",()=>{clearTimeout(l),i=true,t();});return}let o="about:blank";if(n.location.href!==o||e.src===o||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t);}function Mi(e,t,r){let n=false,i;try{i=e.sheet;}catch{return}if(i)return;let s=setTimeout(()=>{n||(t(),n=true);},r);e.addEventListener("load",()=>{clearTimeout(s),n=true,t();});}function Ri(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:f,maskInputFn:u,dataURLOptions:h={},inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:c=false,cssCaptured:v=false}=t,C=Ei(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Z.Document,childNodes:[],compatMode:e.compatMode}:{type:Z.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return {type:Z.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return xi(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:l,maskInputOptions:a,maskInputFn:u,dataURLOptions:h,inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:c,rootId:C});case e.TEXT_NODE:return Ii(e,{doc:r,needsMask:o,maskTextFn:f,rootId:C,cssCaptured:v});case e.CDATA_SECTION_NODE:return {type:Z.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return {type:Z.Comment,textContent:w.textContent(e)||"",rootId:C};default:return false}}function Ei(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Ii(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:s}=t,o=w.parentNode(e),l=o&&o.tagName,a="",f=l==="STYLE"?true:void 0,u=l==="SCRIPT"?true:void 0;return u?a="SCRIPT_PLACEHOLDER":s||(a=w.textContent(e),f&&a&&(a=dt(a,Jt(t.doc)))),!f&&!u&&a&&r&&(a=n?n(a,w.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Z.Text,textContent:a||"",rootId:i}}function xi(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:s,maskInputOptions:o={},maskInputFn:l,dataURLOptions:a={},inlineImages:f,recordCanvas:u,keepIframeSrcFn:h,newlyAddedElement:d=false,rootId:p}=t,m=wi(e,n,i),c=yi(e),v={},C=e.attributes.length;for(let y=0;y<C;y++){let M=e.attributes[y];Wr(c,M.name,M.value)||(v[M.name]=Br(r,c,ve(M.name),M.value));}if(c==="link"&&s){let y=Array.from(r.styleSheets).find(I=>I.href===e.href),M=null;y&&(M=Ft(y)),M&&(delete v.rel,delete v.href,v._cssText=M);}if(c==="style"&&e.sheet){let y=Ft(e.sheet);y&&(e.childNodes.length>1&&(y=di(y,e)),v._cssText=y);}if(["input","textarea","select"].includes(c)){let y=e.value,M=e.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&y?v.value=ft({element:e,type:ht(e),tagName:c,value:y,maskInputOptions:o,maskInputFn:l}):M&&(v.checked=M);}if(c==="option"&&(e.selected&&!o.select?v.selected=true:delete v.selected),c==="dialog"&&e.open&&(v.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),c==="canvas"&&u){if(e.__context==="2d")oi(e)||(v.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let y=e.toDataURL(a.type,a.quality),M=r.createElement("canvas");M.width=e.width,M.height=e.height;let I=M.toDataURL(a.type,a.quality);y!==I&&(v.rr_dataURL=y);}}if(c==="img"&&f){xe||(xe=r.createElement("canvas"),Mr=xe.getContext("2d"));let y=e,M=y.currentSrc||y.getAttribute("src")||"<unknown-src>",I=y.crossOrigin,x=()=>{y.removeEventListener("load",x);try{xe.width=y.naturalWidth,xe.height=y.naturalHeight,Mr.drawImage(y,0,0),v.rr_dataURL=xe.toDataURL(a.type,a.quality);}catch(k){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);return}else console.warn(`Cannot inline img src=${M}! Error: ${k}`);}y.crossOrigin==="anonymous"&&(I?v.crossOrigin=I:y.removeAttribute("crossorigin"));};y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);}if(["audio","video"].includes(c)){let y=v;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume;}if(d||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),m){let{width:y,height:M}=e.getBoundingClientRect();v={class:v.class,rr_width:`${y}px`,rr_height:`${M}px`};}c==="iframe"&&!h(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src);let b;try{customElements.get(c)&&(b=!0);}catch{}return {type:Z.Element,tagName:c,attributes:v,childNodes:[],isSVG:Si(e)||void 0,needBlock:m,rootId:p,isCustom:b}}function G(e){return e==null?"":e.toLowerCase()}function Gr(e){return e===true||e==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function ki(e,t){if(t.comment&&e.type===Z.Comment)return true;if(e.type===Z.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Pr(e.attributes.href)==="js"))return true;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(G(e.attributes.name).match(/^msapplication-tile(image|color)$/)||G(e.attributes.name)==="application-name"||G(e.attributes.rel)==="icon"||G(e.attributes.rel)==="apple-touch-icon"||G(e.attributes.rel)==="shortcut icon")))return true;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&G(e.attributes.name).match(/^description|keywords$/))return true;if(t.headMetaSocial&&(G(e.attributes.property).match(/^(og|twitter|fb):/)||G(e.attributes.name).match(/^(og|twitter):/)||G(e.attributes.name)==="pinterest"))return true;if(t.headMetaRobots&&(G(e.attributes.name)==="robots"||G(e.attributes.name)==="googlebot"||G(e.attributes.name)==="bingbot"))return true;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return true;if(t.headMetaAuthorship&&(G(e.attributes.name)==="author"||G(e.attributes.name)==="generator"||G(e.attributes.name)==="framework"||G(e.attributes.name)==="publisher"||G(e.attributes.name)==="progid"||G(e.attributes.property).match(/^article:/)||G(e.attributes.property).match(/^product:/)))return true;if(t.headMetaVerification&&(G(e.attributes.name)==="google-site-verification"||G(e.attributes.name)==="yandex-verification"||G(e.attributes.name)==="csrf-token"||G(e.attributes.name)==="p:domain_verify"||G(e.attributes.name)==="verify-v1"||G(e.attributes.name)==="verification"||G(e.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function Ae(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:l,skipChild:a=false,inlineStylesheet:f=true,maskInputOptions:u={},maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m={},inlineImages:c=false,recordCanvas:v=false,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y=5e3,onStylesheetLoad:M,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>false,newlyAddedElement:k=false,cssCaptured:E=false}=t,{needsMask:R}=t,{preserveWhiteSpace:B=true}=t;R||(R=Hr(e,o,l,R===void 0));let A=Ri(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,inlineStylesheet:f,maskInputOptions:u,maskTextFn:h,maskInputFn:d,dataURLOptions:m,inlineImages:c,recordCanvas:v,keepIframeSrcFn:x,newlyAddedElement:k,cssCaptured:E});if(!A)return console.warn(e,"not serialized"),null;let T;n.hasNode(e)?T=n.getId(e):ki(A,p)||!B&&A.type===Z.Text&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?T=pt:T=Fr();let S=Object.assign(A,{id:T});if(n.add(e,S),T===pt)return null;C&&C(e);let L=!a;if(S.type===Z.Element){L=L&&!S.needBlock,delete S.needBlock;let U=w.shadowRoot(e);U&&Ve(U)&&(S.isShadowHost=true);}if((S.type===Z.Document||S.type===Z.Element)&&L){p.headWhitespace&&S.type===Z.Element&&S.tagName==="head"&&(B=false);let U={doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:f,maskInputOptions:u,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:c,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x,cssCaptured:false};if(!(S.type===Z.Element&&S.tagName==="textarea"&&S.attributes.value!==void 0)){S.type===Z.Element&&S.attributes._cssText!==void 0&&typeof S.attributes._cssText=="string"&&(U.cssCaptured=true);for(let q of Array.from(w.childNodes(e))){let Y=Ae(q,U);Y&&S.childNodes.push(Y);}}let N=null;if(zr(e)&&(N=w.shadowRoot(e)))for(let q of Array.from(w.childNodes(N))){let Y=Ae(q,U);Y&&(Ve(N)&&(Y.isShadow=true),S.childNodes.push(Y));}}let V=w.parentNode(e);return V&&Ge(V)&&Ve(V)&&(S.isShadow=true),S.type===Z.Element&&S.tagName==="iframe"&&Ci(e,()=>{let U=e.contentDocument;if(U&&b){let N=Ae(U,{doc:U,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:false,inlineStylesheet:f,maskInputOptions:u,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:c,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x});N&&b(e,N);}},y),S.type===Z.Element&&S.tagName==="link"&&typeof S.attributes.rel=="string"&&(S.attributes.rel==="stylesheet"||S.attributes.rel==="preload"&&typeof S.attributes.href=="string"&&Pr(S.attributes.href)==="css")&&Mi(e,()=>{if(M){let U=Ae(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:false,inlineStylesheet:f,maskInputOptions:u,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:c,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x});U&&M(e,U);}},I),S}function Ti(e,t){let{mirror:r=new ct,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=true,inlineImages:a=false,recordCanvas:f=false,maskAllInputs:u=false,maskTextFn:h,maskInputFn:d,slimDOM:p=false,dataURLOptions:m,preserveWhiteSpace:c,onSerialize:v,onIframeLoad:C,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:I=()=>false}=t,x=u===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:u===false?{password:true}:u,k=Gr(p);return Ae(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:s,maskTextSelector:o,skipChild:false,inlineStylesheet:l,maskInputOptions:x,maskTextFn:h,maskInputFn:d,slimDOMOptions:k,dataURLOptions:m,inlineImages:a,recordCanvas:f,preserveWhiteSpace:c,onSerialize:v,onIframeLoad:C,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:I,newlyAddedElement:false})}var Bt=class e{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType");}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return false;if(t===this)return true}else return false;for(;t.parentNode;){if(t.parentNode===this)return true;t=t.parentNode;}return false}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return "RRNode"}};function ee(e,t,r=document){let n={capture:true,passive:true};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Te=`Please stop import mirror directly. Instead of that,\r
|
|
2
2
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
-
or you can use record.mirror to access the mirror instance during recording.`,Mr={map:{},getId(){return console.error(Te),-1},getNode(){return console.error(Te),null},removeNodeFromMap(){console.error(Te);},has(){return console.error(Te),false},reset(){console.error(Te);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Mr=new Proxy(Mr,{get(e,t,r){return t==="map"&&console.error(Te),Reflect.get(e,t,r)}}));function $e(e,t,r={}){let n=null,i=0;return function(...s){let o=Date.now();!i&&r.leading===false&&(i=o);let c=t-(o-i),a=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),i=o,e.apply(a,s)):!n&&r.trailing!==false&&(n=setTimeout(()=>{i=r.leading===false?0:Date.now(),n=null,e.apply(a,s);},c));}}function vt(e,t,r,n,i=window){let s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(o){setTimeout(()=>{r.set.call(this,o);},0),s&&s.set&&s.set.call(this,o);}}),()=>vt(e,t,s||{},true)}function Hr(e){var t,r,n,i;let s=e.document;return {left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=w.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((n=w.parentElement(s.body))==null?void 0:n.scrollTop)||((i=s?.body)==null?void 0:i.scrollTop)||0}}function Gr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function jr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Vr(e){return e?e.nodeType===e.ELEMENT_NODE?e:w.parentElement(e):null}function te(e,t,r,n){if(!e)return false;let i=Vr(e);if(!i)return false;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return !0}else if(pt(i,t,n))return !0}catch{}return !!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function ki(e,t){return t.getId(e)!==-1}function zt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?true:t.getId(e)===dt}function $r(e,t){if(He(e))return false;let r=t.getId(e);if(!t.has(r))return true;let n=w.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?false:n?$r(n,t):true}function Bt(e){return !!e.changedTouches}function Ti(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach);}function qr(e,t){return !!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Zr(e,t){return !!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Wt(e){return e?e instanceof Ft&&"shadowRoot"in e?!!e.shadowRoot:!!w.shadowRoot(e):false}var Ht=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map);}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};function Yr(e){var t;let r=null;return "getRootNode"in e&&((t=w.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&w.host(w.getRootNode(e))&&(r=w.host(w.getRootNode(e))),r}function Oi(e){let t=e,r;for(;r=Yr(t);)t=r;return t}function Ai(e){let t=w.ownerDocument(e);if(!t)return false;let r=Oi(e);return w.contains(t,r)}function Xr(e){let t=w.ownerDocument(e);return t?w.contains(t,e)||Ai(e):false}var Rr=(e,t)=>`${e}@${t}`,Gt=class{constructor(){g(this,"frozen",false),g(this,"locked",false),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit();}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let d of this.movedSet){let p=w.parentNode(d);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(d);}let n=null,i=null,s=-1,o=null,c=false,a=new Set,f=this.addedSet.values(),l=f.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(w.previousSibling(n)))o=n,n=w.previousSibling(n);else {for(this.addedSet.has(l.value)||(l=f.next()),n=l.value;;){if(i=w.parentNode(n),this.addedSet.has(i)){n=i;continue}break}if(a.has(i))i=null;else if(i){if(Xr(i)?(c=Er(this.droppedSet,i)||this.removesSubTreeCache.has(i),c&&Er(this.movedSet,n)&&(c=false)):c=true,this.addedSet.has(w.lastChild(i)))n=w.lastChild(i),o=null;else for(;;){if(o=w.nextSibling(n),this.addedSet.has(o)){n=o;continue}break}if(s=He(i)?this.mirror.getId(Yr(n)):this.mirror.getId(i),s===-1&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let u=w.host(i);s=this.mirror.getId(u);}}}if(this.addedSet.delete(n),!i||s===-1){a.add(n);continue}else if(c){this.droppedSet.add(n);continue}let d=false;if(n.nodeType===Node.TEXT_NODE){let u=i.tagName;if(u==="TEXTAREA")continue;u==="STYLE"&&r.has(s)&&(d=true);}let p=o?this.mirror.getId(o):null;for(;p===dt;)o=o&&w.nextSibling(o),p=o&&this.mirror.getId(o);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",o),n=null;continue}let m=Ae(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,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:u=>{qr(u,this.mirror)&&this.iframeManager.addIframe(u),Zr(u,this.mirror)&&this.stylesheetManager.trackLinkElement(u),Wt(n)&&this.shadowDomManager.addShadowRoot(w.shadowRoot(n),this.doc);},onIframeLoad:(u,v)=>{this.iframeManager.attachIframe(u,v),this.shadowDomManager.observeAttachShadow(u);},onStylesheetLoad:(u,v)=>{this.stylesheetManager.attachLinkElement(u,v);},cssCaptured:d});m&&(t.push({parentId:s,nextId:p,node:m}),r.add(m.id));}let h={texts:this.texts.map(d=>{let p=d.node,m=w.parentNode(p);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(p),value:d.value}}).filter(d=>!r.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{let{attributes:p}=d;if(typeof p.style=="string"){let m=JSON.stringify(d.styleDiff),u=JSON.stringify(d._unchangedStyles);m.length<p.style.length&&(m+u).split("var(").length===p.style.split("var(").length&&(p.style=d.styleDiff);}return {id:this.mirror.getId(d.node),attributes:p}}).filter(d=>!r.has(d.id)).filter(d=>this.mirror.has(d.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(h));}),g(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(w.childNodes(t),i=>w.textContent(i)||"").join("");r.attributes.value=ct({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ft(t),value:n,maskInputFn:this.maskInputFn});}),g(this,"processMutation",t=>{if(!zt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case "characterData":{let r=w.textContent(t.target);!te(t.target,this.blockClass,this.blockSelector,false)&&r!==t.oldValue&&this.texts.push({value:Br(t.target,this.maskTextClass,this.maskTextSelector,true)&&r?this.maskTextFn?this.maskTextFn(r,Vr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case "attributes":{let r=t.target,n=ve(r.tagName),i=t.attributeName,s=t.target.getAttribute(i);if(i==="value"){let c=ft(r);s=ct({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:s,maskInputFn:this.maskInputFn});}if(te(t.target,this.blockClass,this.blockSelector,false)||s===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n==="iframe"&&i==="src"&&!this.keepIframeSrcFn(s))if(!r.contentDocument)i="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),i==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Fr(n,i))if(o.attributes[i]=Pr(this.doc,n,ve(i),s),i==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument();}catch{this.unattachedDoc=this.doc;}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let a of Array.from(r.style)){let f=r.style.getPropertyValue(a),l=r.style.getPropertyPriority(a);f!==c.style.getPropertyValue(a)||l!==c.style.getPropertyPriority(a)?l===""?o.styleDiff[a]=f:o.styleDiff[a]=[f,l]:o._unchangedStyles[a]=[f,l];}for(let a of Array.from(c.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=false);}else i==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case "childList":{if(te(t.target,this.blockClass,this.blockSelector,true))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=He(t.target)?this.mirror.getId(w.host(t.target)):this.mirror.getId(t.target);te(t.target,this.blockClass,this.blockSelector,false)||zt(r,this.mirror,this.slimDOMOptions)||!ki(r,this.mirror)||(this.addedSet.has(r)?(jt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||$r(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Rr(n,i)]?jt(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:He(t.target)&&Ge(t.target)?true:void 0}),Ni(r,this.removesSubTreeCache))),this.mapRemoves.push(r));});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(zt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Rr(this.mirror.getId(t),n)]=true);}else this.addedSet.add(t),this.droppedSet.delete(t);te(t,this.blockClass,this.blockSelector,false)||(w.childNodes(t).forEach(n=>this.genAdds(n)),Wt(t)&&w.childNodes(w.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t);}));}});}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function jt(e,t){e.delete(t),w.childNodes(t).forEach(r=>jt(e,r));}function Ni(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),w.childNodes(n).forEach(i=>r.push(i)));}}function Er(e,t){return e.size===0?false:Jr(e,t)}function Jr(e,t){if(e.has(t))return true;let r=w.parentNode(t);return r?Jr(e,r):false}var je;function Di(e){je=e;}function Li(){je=void 0;}var D=e=>je?(...r)=>{try{return e(...r)}catch(n){if(je&&je(n)===true)return;throw n}}:e,Me=[];function qe(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Kr(e,t){let r=new Gt;Me.push(r),r.init(e);let[n,i]=Dr(),s=new n(D(r.processMutations.bind(r)));return s.observe(t,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),[s,i]}function _i({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===false)return ()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,o=[],c,a=$e(D(h=>{let d=Date.now()-c;e(o.map(p=>(p.timeOffset-=d,p)),h),o=[],c=null;}),s),f=D($e(D(h=>{let d=qe(h),{clientX:p,clientY:m}=Bt(h)?h.changedTouches[0]:h;c||(c=Ve()),o.push({x:p,y:m,id:n.getId(d),timeOffset:Ve()-c}),a(typeof DragEvent<"u"&&h instanceof DragEvent?O.Drag:h instanceof MouseEvent?O.MouseMove:O.TouchMove);}),i,{trailing:!1})),l=[ee("mousemove",f,r),ee("touchmove",f,r),ee("drag",f,r)];return D(()=>{l.forEach(h=>h());})}function zi({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){if(s.mouseInteraction===false)return ()=>{};let o=s.mouseInteraction===true||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],a=null,f=l=>h=>{let d=qe(h);if(te(d,n,i,true))return;let p=null,m=l;if("pointerType"in h){switch(h.pointerType){case "mouse":p=me.Mouse;break;case "touch":p=me.Touch;break;case "pen":p=me.Pen;break}p===me.Touch?se[l]===se.MouseDown?m="TouchStart":se[l]===se.MouseUp&&(m="TouchEnd"):me.Pen;}else Bt(h)&&(p=me.Touch);p!==null?(a=p,(m.startsWith("Touch")&&p===me.Touch||m.startsWith("Mouse")&&p===me.Mouse)&&(p=null)):se[l]===se.Click&&(p=a,a=null);let u=Bt(h)?h.changedTouches[0]:h;if(!u)return;let v=r.getId(d),{clientX:C,clientY:b}=u;D(e)({type:se[m],id:v,x:C,y:b,...p!==null&&{pointerType:p}});};return Object.keys(se).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&o[l]!==false).forEach(l=>{let h=ve(l),d=f(l);if(window.PointerEvent)switch(se[l]){case se.MouseDown:case se.MouseUp:h=h.replace("mouse","pointer");break;case se.TouchStart:case se.TouchEnd:return}c.push(ee(h,d,t));}),D(()=>{c.forEach(l=>l());})}function Qr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){let o=D($e(D(c=>{let a=qe(c);if(!a||te(a,n,i,!0))return;let f=r.getId(a);if(a===t&&t.defaultView){let l=Hr(t.defaultView);e({id:f,x:l.left,y:l.top});}else e({id:f,x:a.scrollLeft,y:a.scrollTop});}),s.scroll||100));return ee("scroll",o,t)}function Ui({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=D($e(D(()=>{let s=Gr(),o=jr();(r!==s||n!==o)&&(e({width:Number(o),height:Number(s)}),r=s,n=o);}),200));return ee("resize",i,t)}var Pi=["INPUT","TEXTAREA","SELECT"],Ir=new WeakMap;function Fi({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:s,ignoreSelector:o,maskInputOptions:c,maskInputFn:a,sampling:f,userTriggeredOnInput:l}){function h(b){let y=qe(b),M=b.isTrusted,I=y&&y.tagName;if(y&&I==="OPTION"&&(y=w.parentElement(y)),!y||!I||Pi.indexOf(I)<0||te(y,n,i,true)||y.classList.contains(s)||o&&y.matches(o))return;let x=y.value,k=false,E=ft(y)||"";E==="radio"||E==="checkbox"?k=y.checked:(c[I.toLowerCase()]||c[E])&&(x=ct({element:y,maskInputOptions:c,tagName:I,type:E,value:x,maskInputFn:a})),d(y,l?{text:x,isChecked:k,userTriggered:M}:{text:x,isChecked:k});let R=y.name;E==="radio"&&R&&k&&t.querySelectorAll(`input[type="radio"][name="${R}"]`).forEach(B=>{if(B!==y){let A=B.value;d(B,l?{text:A,isChecked:!k,userTriggered:false}:{text:A,isChecked:!k});}});}function d(b,y){let M=Ir.get(b);if(!M||M.text!==y.text||M.isChecked!==y.isChecked){Ir.set(b,y);let I=r.getId(b);D(e)({...y,id:I});}}let m=(f.input==="last"?["change"]:["input","change"]).map(b=>ee(b,D(h),t)),u=t.defaultView;if(!u)return ()=>{m.forEach(b=>b());};let v=u.Object.getOwnPropertyDescriptor(u.HTMLInputElement.prototype,"value"),C=[[u.HTMLInputElement.prototype,"value"],[u.HTMLInputElement.prototype,"checked"],[u.HTMLSelectElement.prototype,"value"],[u.HTMLTextAreaElement.prototype,"value"],[u.HTMLSelectElement.prototype,"selectedIndex"],[u.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&m.push(...C.map(b=>vt(b[0],b[1],{set(){D(h)({target:this,isTrusted:false});}},false,u))),D(()=>{m.forEach(b=>b());})}function mt(e){let t=[];function r(n,i){if(st("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||st("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||st("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||st("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let o=Array.from(n.parentRule.cssRules).indexOf(n);return i.unshift(o),r(n.parentRule,i)}else if(n.parentStyleSheet){let o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(o);}return i}return r(e,t)}function ge(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Bi({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return ()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:D((l,h,d)=>{let[p,m]=d,{id:u,styleId:v}=ge(h,t,r.styleMirror);return (u&&u!==-1||v&&v!==-1)&&e({id:u,styleId:v,adds:[{rule:p,index:m}]}),l.apply(h,d)})}),n.CSSStyleSheet.prototype.addRule=function(l,h,d=this.cssRules.length){let p=`${l} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,d])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:D((l,h,d)=>{let[p]=d,{id:m,styleId:u}=ge(h,t,r.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,removes:[{index:p}]}),l.apply(h,d)})}),n.CSSStyleSheet.prototype.removeRule=function(l){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[l])};let o;n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:D((l,h,d)=>{let[p]=d,{id:m,styleId:u}=ge(h,t,r.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,replace:p}),l.apply(h,d)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:D((l,h,d)=>{let[p]=d,{id:m,styleId:u}=ge(h,t,r.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,replaceSync:p}),l.apply(h,d)})}));let a={};ot("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(ot("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),ot("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),ot("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(a).forEach(([l,h])=>{f[l]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(f[l].insertRule,{apply:D((d,p,m)=>{let[u,v]=m,{id:C,styleId:b}=ge(p.parentStyleSheet,t,r.styleMirror);return (C&&C!==-1||b&&b!==-1)&&e({id:C,styleId:b,adds:[{rule:u,index:[...mt(p),v||0]}]}),d.apply(p,m)})}),h.prototype.deleteRule=new Proxy(f[l].deleteRule,{apply:D((d,p,m)=>{let[u]=m,{id:v,styleId:C}=ge(p.parentStyleSheet,t,r.styleMirror);return (v&&v!==-1||C&&C!==-1)&&e({id:v,styleId:C,removes:[{index:[...mt(p),u]}]}),d.apply(p,m)})});}),D(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=s,o&&(n.CSSStyleSheet.prototype.replace=o),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(a).forEach(([l,h])=>{h.prototype.insertRule=f[l].insertRule,h.prototype.deleteRule=f[l].deleteRule;});})}function en({mirror:e,stylesheetManager:t},r){var n,i,s;let o=null;r.nodeName==="#document"?o=e.getId(r):o=e.getId(w.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(s=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:s.ShadowRoot,a=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!c||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var f;return (f=a.get)==null?void 0:f.call(this)},set(f){var l;let h=(l=a.set)==null?void 0:l.call(this,f);if(o!==null&&o!==-1)try{t.adoptStyleSheets(f,o);}catch{}return h}}),D(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set});}))}function Wi({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:D((c,a,f)=>{var l;let[h,d,p]=f;if(r.has(h))return s.apply(a,[h,d,p]);let{id:m,styleId:u}=ge((l=a.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,set:{property:h,value:d,priority:p},index:mt(a.parentRule)}),c.apply(a,f)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:D((c,a,f)=>{var l;let[h]=f;if(r.has(h))return o.apply(a,[h]);let{id:d,styleId:p}=ge((l=a.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return (d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,remove:{property:h},index:mt(a.parentRule)}),c.apply(a,f)})}),D(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o;})}function Hi({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:s}){let o=D(a=>$e(D(f=>{let l=qe(f);if(!l||te(l,t,r,!0))return;let{currentTime:h,volume:d,muted:p,playbackRate:m,loop:u}=l;e({type:a,id:n.getId(l),currentTime:h,volume:d,muted:p,playbackRate:m,loop:u});}),i.media||500)),c=[ee("play",o(ke.Play),s),ee("pause",o(ke.Pause),s),ee("seeked",o(ke.Seeked),s),ee("volumechange",o(ke.VolumeChange),s),ee("ratechange",o(ke.RateChange),s)];return D(()=>{c.forEach(a=>a());})}function Gi({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return ()=>{};let n=[],i=new WeakMap,s=r.FontFace;r.FontFace=function(a,f,l){let h=new s(a,f,l);return i.set(h,{family:a,buffer:typeof f!="string",descriptors:l,fontSource:typeof f=="string"?f:JSON.stringify(Array.from(new Uint8Array(f)))}),h};let o=Re(t.fonts,"add",function(c){return function(a){return setTimeout(D(()=>{let f=i.get(a);f&&(e(f),i.delete(a));}),0),c.apply(this,[a])}});return n.push(()=>{r.FontFace=s;}),n.push(o),D(()=>{n.forEach(c=>c());})}function ji(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e,o=true,c=D(()=>{let a=t.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let f=[],l=a.rangeCount||0;for(let h=0;h<l;h++){let d=a.getRangeAt(h),{startContainer:p,startOffset:m,endContainer:u,endOffset:v}=d;te(p,n,i,!0)||te(u,n,i,!0)||f.push({start:r.getId(p),startOffset:m,end:r.getId(u),endOffset:v});}s({ranges:f});});return c(),ee("selectionchange",c)}function Vi({doc:e,customElementCb:t}){let r=e.defaultView;return !r||!r.customElements?()=>{}:Re(r.customElements,"define",function(i){return function(s,o,c){try{t({define:{name:s}});}catch{console.warn(`Custom element callback failed for ${s}`);}return i.apply(this,[s,o,c])}})}function $i(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:c,mediaInteractionCb:a,styleSheetRuleCb:f,styleDeclarationCb:l,canvasMutationCb:h,fontCb:d,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...u)=>{t.mutation&&t.mutation(...u),r(...u);},e.mousemoveCb=(...u)=>{t.mousemove&&t.mousemove(...u),n(...u);},e.mouseInteractionCb=(...u)=>{t.mouseInteraction&&t.mouseInteraction(...u),i(...u);},e.scrollCb=(...u)=>{t.scroll&&t.scroll(...u),s(...u);},e.viewportResizeCb=(...u)=>{t.viewportResize&&t.viewportResize(...u),o(...u);},e.inputCb=(...u)=>{t.input&&t.input(...u),c(...u);},e.mediaInteractionCb=(...u)=>{t.mediaInteaction&&t.mediaInteaction(...u),a(...u);},e.styleSheetRuleCb=(...u)=>{t.styleSheetRule&&t.styleSheetRule(...u),f(...u);},e.styleDeclarationCb=(...u)=>{t.styleDeclaration&&t.styleDeclaration(...u),l(...u);},e.canvasMutationCb=(...u)=>{t.canvasMutation&&t.canvasMutation(...u),h(...u);},e.fontCb=(...u)=>{t.font&&t.font(...u),d(...u);},e.selectionCb=(...u)=>{t.selection&&t.selection(...u),p(...u);},e.customElementCb=(...u)=>{t.customElement&&t.customElement(...u),m(...u);};}function qi(e,t={}){let r=e.doc.defaultView;if(!r)return ()=>{};$i(e,t);let n,i=()=>{};e.recordDOM&&([n,i]=Kr(e,e.doc));let s=_i(e),o=zi(e),c=Qr(e),a=Ui(e,{win:r}),f=Fi(e),l=Hi(e),h=()=>{},d=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(h=Bi(e,{win:r}),d=en(e,e.doc),p=Wi(e,{win:r}),e.collectFonts&&(m=Gi(e)));let u=ji(e),v=Vi(e),C=[];for(let b of e.plugins)C.push(b.observer(b.callback,r,b.options));return D(()=>{Me.forEach(b=>b.reset()),n?.disconnect(),i(),s(),o(),c(),a(),f(),l(),h(),d(),p(),m(),u(),v(),C.forEach(b=>b());})}function st(e){return typeof window[e]<"u"}function ot(e){return !!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var yt=class{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t;}getId(t,r,n,i){let s=n||this.getIdToRemoteIdMap(t),o=i||this.getRemoteIdToIdMap(t),c=s.get(r);return c||(c=this.generateIdFn(),s.set(r,c),o.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=i.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t);}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Vt=class{constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new yt(Ur)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new yt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(t){this.iframes.set(t,true),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t);}addLoadListener(t){this.loadListener=t;}attachIframe(t,r){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument));}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let s=this.transformCrossOriginEvent(i,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout);}transformCrossOriginEvent(t,r){var n;switch(r.type){case z.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:z.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}}}case z.Meta:case z.Load:case z.DomContentLoaded:return false;case z.Plugin:return r;case z.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case z.IncrementalSnapshot:switch(r.data.source){case O.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(i.node,s);}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"]);}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"]);}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case O.Drag:case O.TouchMove:case O.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case O.ViewportResize:return false;case O.MediaInteraction:case O.MouseInteraction:case O.Scroll:case O.CanvasMutation:case O.Input:return this.replaceIds(r.data,t,["id"]),r;case O.StyleSheetRule:case O.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case O.Font:return r;case O.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"]);}),r;case O.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"]);}),r}}return false}replace(t,r,n,i){for(let s of i)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}patchRootIdOnNode(t,r){t.type!==Y.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r);});}},$t=class{constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init();}init(){this.reset(),this.patchAttachShadow(Element,document);}addShadowRoot(t,r){if(!Ge(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[n]=Kr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Qr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(w.host(t))),this.restoreHandlers.push(en({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t));},0);}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument);}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Re(t.prototype,"attachShadow",function(i){return function(s){let o=i.call(this,s),c=w.shadowRoot(this);return c&&Xr(this)&&n.addShadowRoot(c,r),o}}));}reset(){this.restoreHandlers.forEach(t=>{try{t();}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet;}},Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(We=0;We<Ne.length;We++)Zi[Ne.charCodeAt(We)]=We;var We,Yi=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=Ne[t[r]>>2],i+=Ne[(t[r]&3)<<4|t[r+1]>>4],i+=Ne[(t[r+1]&15)<<2|t[r+2]>>6],i+=Ne[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i},xr=new Map;function Xi(e,t){let r=xr.get(e);return r||(r=new Map,xr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var tn=(e,t,r)=>{if(!e||!(nn(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=Xi(r,n),s=i.indexOf(e);return s===-1&&(s=i.length,i.push(e)),s};function at(e,t,r){if(e instanceof Array)return e.map(n=>at(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return {rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,i=Yi(e);return {rr_type:n,base64:i}}else {if(e instanceof DataView)return {rr_type:e.constructor.name,args:[at(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return {rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return {rr_type:n,src:i}}else {if(e instanceof ImageData)return {rr_type:e.constructor.name,args:[at(e.data,t,r),e.width,e.height]};if(nn(e,t)||typeof e=="object"){let n=e.constructor.name,i=tn(e,t,r);return {rr_type:n,index:i}}}}return e}var rn=(e,t,r)=>e.map(n=>at(n,t,r)),nn=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Ji(e,t,r,n){let i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of s)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!="function")continue;let c=Re(t.CanvasRenderingContext2D.prototype,o,function(a){return function(...f){return te(this.canvas,r,n,!0)||setTimeout(()=>{let l=rn(f,t,this);e(this.canvas,{type:De["2D"],property:o,args:l});},0),a.apply(this,f)}});i.push(c);}catch{let c=vt(t.CanvasRenderingContext2D.prototype,o,{set(a){e(this.canvas,{type:De["2D"],property:o,args:[a],setter:true});}});i.push(c);}return ()=>{i.forEach(o=>o());}}function Ki(e){return e==="experimental-webgl"?"webgl":e}function kr(e,t,r,n){let i=[];try{let s=Re(e.HTMLCanvasElement.prototype,"getContext",function(o){return function(c,...a){if(!te(this,t,r,!0)){let f=Ki(c);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(a[0]&&typeof a[0]=="object"){let l=a[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0);}else a.splice(0,1,{preserveDrawingBuffer:!0});}return o.apply(this,[c,...a])}});i.push(s);}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{i.forEach(s=>s());}}function Tr(e,t,r,n,i,s){let o=[],c=Object.getOwnPropertyNames(e);for(let a of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let f=Re(e,a,function(l){return function(...h){let d=l.apply(this,h);if(tn(d,s,this),"tagName"in this.canvas&&!te(this.canvas,n,i,!0)){let p=rn(h,s,this),m={type:t,property:a,args:p};r(this.canvas,m);}return d}});o.push(f);}catch{let f=vt(e,a,{set(l){r(this.canvas,{type:t,property:a,args:[l],setter:true});}});o.push(f);}return o}function Qi(e,t,r,n){let i=[];return typeof t.WebGLRenderingContext<"u"&&i.push(...Tr(t.WebGLRenderingContext.prototype,De.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Tr(t.WebGL2RenderingContext.prototype,De.WebGL2,e,r,n,t)),()=>{i.forEach(s=>s());}}var sn=`(function() {
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,Er={map:{},getId(){return console.error(Te),-1},getNode(){return console.error(Te),null},removeNodeFromMap(){console.error(Te);},has(){return console.error(Te),false},reset(){console.error(Te);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Er=new Proxy(Er,{get(e,t,r){return t==="map"&&console.error(Te),Reflect.get(e,t,r)}}));function qe(e,t,r={}){let n=null,i=0;return function(...s){let o=Date.now();!i&&r.leading===false&&(i=o);let l=t-(o-i),a=this;l<=0||l>t?(n&&(clearTimeout(n),n=null),i=o,e.apply(a,s)):!n&&r.trailing!==false&&(n=setTimeout(()=>{i=r.leading===false?0:Date.now(),n=null,e.apply(a,s);},l));}}function bt(e,t,r,n,i=window){let s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(o){setTimeout(()=>{r.set.call(this,o);},0),s&&s.set&&s.set.call(this,o);}}),()=>bt(e,t,s||{},true)}function Vr(e){var t,r,n,i;let s=e.document;return {left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=w.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((n=w.parentElement(s.body))==null?void 0:n.scrollTop)||((i=s?.body)==null?void 0:i.scrollTop)||0}}function jr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $r(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function qr(e){return e?e.nodeType===e.ELEMENT_NODE?e:w.parentElement(e):null}function te(e,t,r,n){if(!e)return false;let i=qr(e);if(!i)return false;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return !0}else if(mt(i,t,n))return !0}catch{}return !!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function Oi(e,t){return t.getId(e)!==-1}function Ut(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?true:t.getId(e)===pt}function Yr(e,t){if(Ge(e))return false;let r=t.getId(e);if(!t.has(r))return true;let n=w.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?false:n?Yr(n,t):true}function Wt(e){return !!e.changedTouches}function Ai(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach);}function Zr(e,t){return !!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Xr(e,t){return !!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ht(e){return e?e instanceof Bt&&"shadowRoot"in e?!!e.shadowRoot:!!w.shadowRoot(e):false}var Gt=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map);}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};function Kr(e){var t;let r=null;return "getRootNode"in e&&((t=w.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&w.host(w.getRootNode(e))&&(r=w.host(w.getRootNode(e))),r}function Ni(e){let t=e,r;for(;r=Kr(t);)t=r;return t}function Di(e){let t=w.ownerDocument(e);if(!t)return false;let r=Ni(e);return w.contains(t,r)}function Jr(e){let t=w.ownerDocument(e);return t?w.contains(t,e)||Di(e):false}var Ir=(e,t)=>`${e}@${t}`,Vt=class{constructor(){g(this,"frozen",false),g(this,"locked",false),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit();}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let d of this.movedSet){let p=w.parentNode(d);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(d);}let n=null,i=null,s=-1,o=null,l=false,a=new Set,f=this.addedSet.values(),u=f.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(w.previousSibling(n)))o=n,n=w.previousSibling(n);else {for(this.addedSet.has(u.value)||(u=f.next()),n=u.value;;){if(i=w.parentNode(n),this.addedSet.has(i)){n=i;continue}break}if(a.has(i))i=null;else if(i){if(Jr(i)?(l=xr(this.droppedSet,i)||this.removesSubTreeCache.has(i),l&&xr(this.movedSet,n)&&(l=false)):l=true,this.addedSet.has(w.lastChild(i)))n=w.lastChild(i),o=null;else for(;;){if(o=w.nextSibling(n),this.addedSet.has(o)){n=o;continue}break}if(s=Ge(i)?this.mirror.getId(Kr(n)):this.mirror.getId(i),s===-1&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let c=w.host(i);s=this.mirror.getId(c);}}}if(this.addedSet.delete(n),!i||s===-1){a.add(n);continue}else if(l){this.droppedSet.add(n);continue}let d=false;if(n.nodeType===Node.TEXT_NODE){let c=i.tagName;if(c==="TEXTAREA")continue;c==="STYLE"&&r.has(s)&&(d=true);}let p=o?this.mirror.getId(o):null;for(;p===pt;)o=o&&w.nextSibling(o),p=o&&this.mirror.getId(o);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",o),n=null;continue}let m=Ae(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,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:c=>{Zr(c,this.mirror)&&this.iframeManager.addIframe(c),Xr(c,this.mirror)&&this.stylesheetManager.trackLinkElement(c),Ht(n)&&this.shadowDomManager.addShadowRoot(w.shadowRoot(n),this.doc);},onIframeLoad:(c,v)=>{this.iframeManager.attachIframe(c,v),this.shadowDomManager.observeAttachShadow(c);},onStylesheetLoad:(c,v)=>{this.stylesheetManager.attachLinkElement(c,v);},cssCaptured:d});m&&(t.push({parentId:s,nextId:p,node:m}),r.add(m.id));}let h={texts:this.texts.map(d=>{let p=d.node,m=w.parentNode(p);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(p),value:d.value}}).filter(d=>!r.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{let{attributes:p}=d;if(typeof p.style=="string"){let m=JSON.stringify(d.styleDiff),c=JSON.stringify(d._unchangedStyles);m.length<p.style.length&&(m+c).split("var(").length===p.style.split("var(").length&&(p.style=d.styleDiff);}return {id:this.mirror.getId(d.node),attributes:p}}).filter(d=>!r.has(d.id)).filter(d=>this.mirror.has(d.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(h));}),g(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(w.childNodes(t),i=>w.textContent(i)||"").join("");r.attributes.value=ft({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ht(t),value:n,maskInputFn:this.maskInputFn});}),g(this,"processMutation",t=>{if(!Ut(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case "characterData":{let r=w.textContent(t.target);!te(t.target,this.blockClass,this.blockSelector,false)&&r!==t.oldValue&&this.texts.push({value:Hr(t.target,this.maskTextClass,this.maskTextSelector,true)&&r?this.maskTextFn?this.maskTextFn(r,qr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case "attributes":{let r=t.target,n=ve(r.tagName),i=t.attributeName,s=t.target.getAttribute(i);if(i==="value"){let l=ht(r);s=ft({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:l,value:s,maskInputFn:this.maskInputFn});}if(te(t.target,this.blockClass,this.blockSelector,false)||s===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n==="iframe"&&i==="src"&&!this.keepIframeSrcFn(s))if(!r.contentDocument)i="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),i==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Wr(n,i))if(o.attributes[i]=Br(this.doc,n,ve(i),s),i==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument();}catch{this.unattachedDoc=this.doc;}let l=this.unattachedDoc.createElement("span");t.oldValue&&l.setAttribute("style",t.oldValue);for(let a of Array.from(r.style)){let f=r.style.getPropertyValue(a),u=r.style.getPropertyPriority(a);f!==l.style.getPropertyValue(a)||u!==l.style.getPropertyPriority(a)?u===""?o.styleDiff[a]=f:o.styleDiff[a]=[f,u]:o._unchangedStyles[a]=[f,u];}for(let a of Array.from(l.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=false);}else i==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case "childList":{if(te(t.target,this.blockClass,this.blockSelector,true))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=Ge(t.target)?this.mirror.getId(w.host(t.target)):this.mirror.getId(t.target);te(t.target,this.blockClass,this.blockSelector,false)||Ut(r,this.mirror,this.slimDOMOptions)||!Oi(r,this.mirror)||(this.addedSet.has(r)?(jt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Yr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Ir(n,i)]?jt(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:Ge(t.target)&&Ve(t.target)?true:void 0}),Li(r,this.removesSubTreeCache))),this.mapRemoves.push(r));});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ut(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Ir(this.mirror.getId(t),n)]=true);}else this.addedSet.add(t),this.droppedSet.delete(t);te(t,this.blockClass,this.blockSelector,false)||(w.childNodes(t).forEach(n=>this.genAdds(n)),Ht(t)&&w.childNodes(w.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t);}));}});}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function jt(e,t){e.delete(t),w.childNodes(t).forEach(r=>jt(e,r));}function Li(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),w.childNodes(n).forEach(i=>r.push(i)));}}function xr(e,t){return e.size===0?false:Qr(e,t)}function Qr(e,t){if(e.has(t))return true;let r=w.parentNode(t);return r?Qr(e,r):false}var je;function _i(e){je=e;}function zi(){je=void 0;}var D=e=>je?(...r)=>{try{return e(...r)}catch(n){if(je&&je(n)===true)return;throw n}}:e,Me=[];function Ye(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function en(e,t){let r=new Vt;Me.push(r),r.init(e);let[n,i]=_r(),s=new n(D(r.processMutations.bind(r)));return s.observe(t,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),[s,i]}function Ui({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===false)return ()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,o=[],l,a=qe(D(h=>{let d=Date.now()-l;e(o.map(p=>(p.timeOffset-=d,p)),h),o=[],l=null;}),s),f=D(qe(D(h=>{let d=Ye(h),{clientX:p,clientY:m}=Wt(h)?h.changedTouches[0]:h;l||(l=$e()),o.push({x:p,y:m,id:n.getId(d),timeOffset:$e()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?O.Drag:h instanceof MouseEvent?O.MouseMove:O.TouchMove);}),i,{trailing:!1})),u=[ee("mousemove",f,r),ee("touchmove",f,r),ee("drag",f,r)];return D(()=>{u.forEach(h=>h());})}function Pi({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){if(s.mouseInteraction===false)return ()=>{};let o=s.mouseInteraction===true||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[],a=null,f=u=>h=>{let d=Ye(h);if(te(d,n,i,true))return;let p=null,m=u;if("pointerType"in h){switch(h.pointerType){case "mouse":p=me.Mouse;break;case "touch":p=me.Touch;break;case "pen":p=me.Pen;break}p===me.Touch?ie[u]===ie.MouseDown?m="TouchStart":ie[u]===ie.MouseUp&&(m="TouchEnd"):me.Pen;}else Wt(h)&&(p=me.Touch);p!==null?(a=p,(m.startsWith("Touch")&&p===me.Touch||m.startsWith("Mouse")&&p===me.Mouse)&&(p=null)):ie[u]===ie.Click&&(p=a,a=null);let c=Wt(h)?h.changedTouches[0]:h;if(!c)return;let v=r.getId(d),{clientX:C,clientY:b}=c;D(e)({type:ie[m],id:v,x:C,y:b,...p!==null&&{pointerType:p}});};return Object.keys(ie).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&o[u]!==false).forEach(u=>{let h=ve(u),d=f(u);if(window.PointerEvent)switch(ie[u]){case ie.MouseDown:case ie.MouseUp:h=h.replace("mouse","pointer");break;case ie.TouchStart:case ie.TouchEnd:return}l.push(ee(h,d,t));}),D(()=>{l.forEach(u=>u());})}function tn({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){let o=D(qe(D(l=>{let a=Ye(l);if(!a||te(a,n,i,!0))return;let f=r.getId(a);if(a===t&&t.defaultView){let u=Vr(t.defaultView);e({id:f,x:u.left,y:u.top});}else e({id:f,x:a.scrollLeft,y:a.scrollTop});}),s.scroll||100));return ee("scroll",o,t)}function Fi({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=D(qe(D(()=>{let s=jr(),o=$r();(r!==s||n!==o)&&(e({width:Number(o),height:Number(s)}),r=s,n=o);}),200));return ee("resize",i,t)}var Bi=["INPUT","TEXTAREA","SELECT"],kr=new WeakMap;function Wi({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:s,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:f,userTriggeredOnInput:u}){function h(b){let y=Ye(b),M=b.isTrusted,I=y&&y.tagName;if(y&&I==="OPTION"&&(y=w.parentElement(y)),!y||!I||Bi.indexOf(I)<0||te(y,n,i,true)||y.classList.contains(s)||o&&y.matches(o))return;let x=y.value,k=false,E=ht(y)||"";E==="radio"||E==="checkbox"?k=y.checked:(l[I.toLowerCase()]||l[E])&&(x=ft({element:y,maskInputOptions:l,tagName:I,type:E,value:x,maskInputFn:a})),d(y,u?{text:x,isChecked:k,userTriggered:M}:{text:x,isChecked:k});let R=y.name;E==="radio"&&R&&k&&t.querySelectorAll(`input[type="radio"][name="${R}"]`).forEach(B=>{if(B!==y){let A=B.value;d(B,u?{text:A,isChecked:!k,userTriggered:false}:{text:A,isChecked:!k});}});}function d(b,y){let M=kr.get(b);if(!M||M.text!==y.text||M.isChecked!==y.isChecked){kr.set(b,y);let I=r.getId(b);D(e)({...y,id:I});}}let m=(f.input==="last"?["change"]:["input","change"]).map(b=>ee(b,D(h),t)),c=t.defaultView;if(!c)return ()=>{m.forEach(b=>b());};let v=c.Object.getOwnPropertyDescriptor(c.HTMLInputElement.prototype,"value"),C=[[c.HTMLInputElement.prototype,"value"],[c.HTMLInputElement.prototype,"checked"],[c.HTMLSelectElement.prototype,"value"],[c.HTMLTextAreaElement.prototype,"value"],[c.HTMLSelectElement.prototype,"selectedIndex"],[c.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&m.push(...C.map(b=>bt(b[0],b[1],{set(){D(h)({target:this,isTrusted:false});}},false,c))),D(()=>{m.forEach(b=>b());})}function yt(e){let t=[];function r(n,i){if(ot("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||ot("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||ot("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||ot("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let o=Array.from(n.parentRule.cssRules).indexOf(n);return i.unshift(o),r(n.parentRule,i)}else if(n.parentStyleSheet){let o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(o);}return i}return r(e,t)}function ge(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Hi({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return ()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:D((u,h,d)=>{let[p,m]=d,{id:c,styleId:v}=ge(h,t,r.styleMirror);return (c&&c!==-1||v&&v!==-1)&&e({id:c,styleId:v,adds:[{rule:p,index:m}]}),u.apply(h,d)})}),n.CSSStyleSheet.prototype.addRule=function(u,h,d=this.cssRules.length){let p=`${u} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,d])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:D((u,h,d)=>{let[p]=d,{id:m,styleId:c}=ge(h,t,r.styleMirror);return (m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,removes:[{index:p}]}),u.apply(h,d)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let o;n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:D((u,h,d)=>{let[p]=d,{id:m,styleId:c}=ge(h,t,r.styleMirror);return (m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,replace:p}),u.apply(h,d)})}));let l;n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:D((u,h,d)=>{let[p]=d,{id:m,styleId:c}=ge(h,t,r.styleMirror);return (m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,replaceSync:p}),u.apply(h,d)})}));let a={};at("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(at("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),at("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),at("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(a).forEach(([u,h])=>{f[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(f[u].insertRule,{apply:D((d,p,m)=>{let[c,v]=m,{id:C,styleId:b}=ge(p.parentStyleSheet,t,r.styleMirror);return (C&&C!==-1||b&&b!==-1)&&e({id:C,styleId:b,adds:[{rule:c,index:[...yt(p),v||0]}]}),d.apply(p,m)})}),h.prototype.deleteRule=new Proxy(f[u].deleteRule,{apply:D((d,p,m)=>{let[c]=m,{id:v,styleId:C}=ge(p.parentStyleSheet,t,r.styleMirror);return (v&&v!==-1||C&&C!==-1)&&e({id:v,styleId:C,removes:[{index:[...yt(p),c]}]}),d.apply(p,m)})});}),D(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=s,o&&(n.CSSStyleSheet.prototype.replace=o),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=f[u].insertRule,h.prototype.deleteRule=f[u].deleteRule;});})}function rn({mirror:e,stylesheetManager:t},r){var n,i,s;let o=null;r.nodeName==="#document"?o=e.getId(r):o=e.getId(w.host(r));let l=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(s=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:s.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var f;return (f=a.get)==null?void 0:f.call(this)},set(f){var u;let h=(u=a.set)==null?void 0:u.call(this,f);if(o!==null&&o!==-1)try{t.adoptStyleSheets(f,o);}catch{}return h}}),D(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set});}))}function Gi({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:D((l,a,f)=>{var u;let[h,d,p]=f;if(r.has(h))return s.apply(a,[h,d,p]);let{id:m,styleId:c}=ge((u=a.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return (m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,set:{property:h,value:d,priority:p},index:yt(a.parentRule)}),l.apply(a,f)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:D((l,a,f)=>{var u;let[h]=f;if(r.has(h))return o.apply(a,[h]);let{id:d,styleId:p}=ge((u=a.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return (d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,remove:{property:h},index:yt(a.parentRule)}),l.apply(a,f)})}),D(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o;})}function Vi({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:s}){let o=D(a=>qe(D(f=>{let u=Ye(f);if(!u||te(u,t,r,!0))return;let{currentTime:h,volume:d,muted:p,playbackRate:m,loop:c}=u;e({type:a,id:n.getId(u),currentTime:h,volume:d,muted:p,playbackRate:m,loop:c});}),i.media||500)),l=[ee("play",o(ke.Play),s),ee("pause",o(ke.Pause),s),ee("seeked",o(ke.Seeked),s),ee("volumechange",o(ke.VolumeChange),s),ee("ratechange",o(ke.RateChange),s)];return D(()=>{l.forEach(a=>a());})}function ji({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return ()=>{};let n=[],i=new WeakMap,s=r.FontFace;r.FontFace=function(a,f,u){let h=new s(a,f,u);return i.set(h,{family:a,buffer:typeof f!="string",descriptors:u,fontSource:typeof f=="string"?f:JSON.stringify(Array.from(new Uint8Array(f)))}),h};let o=Re(t.fonts,"add",function(l){return function(a){return setTimeout(D(()=>{let f=i.get(a);f&&(e(f),i.delete(a));}),0),l.apply(this,[a])}});return n.push(()=>{r.FontFace=s;}),n.push(o),D(()=>{n.forEach(l=>l());})}function $i(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e,o=true,l=D(()=>{let a=t.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let f=[],u=a.rangeCount||0;for(let h=0;h<u;h++){let d=a.getRangeAt(h),{startContainer:p,startOffset:m,endContainer:c,endOffset:v}=d;te(p,n,i,!0)||te(c,n,i,!0)||f.push({start:r.getId(p),startOffset:m,end:r.getId(c),endOffset:v});}s({ranges:f});});return l(),ee("selectionchange",l)}function qi({doc:e,customElementCb:t}){let r=e.defaultView;return !r||!r.customElements?()=>{}:Re(r.customElements,"define",function(i){return function(s,o,l){try{t({define:{name:s}});}catch{console.warn(`Custom element callback failed for ${s}`);}return i.apply(this,[s,o,l])}})}function Yi(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:f,styleDeclarationCb:u,canvasMutationCb:h,fontCb:d,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...c)=>{t.mutation&&t.mutation(...c),r(...c);},e.mousemoveCb=(...c)=>{t.mousemove&&t.mousemove(...c),n(...c);},e.mouseInteractionCb=(...c)=>{t.mouseInteraction&&t.mouseInteraction(...c),i(...c);},e.scrollCb=(...c)=>{t.scroll&&t.scroll(...c),s(...c);},e.viewportResizeCb=(...c)=>{t.viewportResize&&t.viewportResize(...c),o(...c);},e.inputCb=(...c)=>{t.input&&t.input(...c),l(...c);},e.mediaInteractionCb=(...c)=>{t.mediaInteaction&&t.mediaInteaction(...c),a(...c);},e.styleSheetRuleCb=(...c)=>{t.styleSheetRule&&t.styleSheetRule(...c),f(...c);},e.styleDeclarationCb=(...c)=>{t.styleDeclaration&&t.styleDeclaration(...c),u(...c);},e.canvasMutationCb=(...c)=>{t.canvasMutation&&t.canvasMutation(...c),h(...c);},e.fontCb=(...c)=>{t.font&&t.font(...c),d(...c);},e.selectionCb=(...c)=>{t.selection&&t.selection(...c),p(...c);},e.customElementCb=(...c)=>{t.customElement&&t.customElement(...c),m(...c);};}function Zi(e,t={}){let r=e.doc.defaultView;if(!r)return ()=>{};Yi(e,t);let n,i=()=>{};e.recordDOM&&([n,i]=en(e,e.doc));let s=Ui(e),o=Pi(e),l=tn(e),a=Fi(e,{win:r}),f=Wi(e),u=Vi(e),h=()=>{},d=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(h=Hi(e,{win:r}),d=rn(e,e.doc),p=Gi(e,{win:r}),e.collectFonts&&(m=ji(e)));let c=$i(e),v=qi(e),C=[];for(let b of e.plugins)C.push(b.observer(b.callback,r,b.options));return D(()=>{Me.forEach(b=>b.reset()),n?.disconnect(),i(),s(),o(),l(),a(),f(),u(),h(),d(),p(),m(),c(),v(),C.forEach(b=>b());})}function ot(e){return typeof window[e]<"u"}function at(e){return !!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var gt=class{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t;}getId(t,r,n,i){let s=n||this.getIdToRemoteIdMap(t),o=i||this.getRemoteIdToIdMap(t),l=s.get(r);return l||(l=this.generateIdFn(),s.set(r,l),o.set(l,r)),l}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=i.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t);}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},$t=class{constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new gt(Fr)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new gt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(t){this.iframes.set(t,true),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t);}addLoadListener(t){this.loadListener=t;}attachIframe(t,r){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument));}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let s=this.transformCrossOriginEvent(i,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout);}transformCrossOriginEvent(t,r){var n;switch(r.type){case z.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:z.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}}}case z.Meta:case z.Load:case z.DomContentLoaded:return false;case z.Plugin:return r;case z.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case z.IncrementalSnapshot:switch(r.data.source){case O.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(i.node,s);}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"]);}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"]);}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case O.Drag:case O.TouchMove:case O.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case O.ViewportResize:return false;case O.MediaInteraction:case O.MouseInteraction:case O.Scroll:case O.CanvasMutation:case O.Input:return this.replaceIds(r.data,t,["id"]),r;case O.StyleSheetRule:case O.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case O.Font:return r;case O.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"]);}),r;case O.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"]);}),r}}return false}replace(t,r,n,i){for(let s of i)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}patchRootIdOnNode(t,r){t.type!==Z.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r);});}},qt=class{constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init();}init(){this.reset(),this.patchAttachShadow(Element,document);}addShadowRoot(t,r){if(!Ve(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[n]=en({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(tn({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(w.host(t))),this.restoreHandlers.push(rn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t));},0);}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument);}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Re(t.prototype,"attachShadow",function(i){return function(s){let o=i.call(this,s),l=w.shadowRoot(this);return l&&Jr(this)&&n.addShadowRoot(l,r),o}}));}reset(){this.restoreHandlers.forEach(t=>{try{t();}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet;}},Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(He=0;He<Ne.length;He++)Xi[Ne.charCodeAt(He)]=He;var He,Ki=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=Ne[t[r]>>2],i+=Ne[(t[r]&3)<<4|t[r+1]>>4],i+=Ne[(t[r+1]&15)<<2|t[r+2]>>6],i+=Ne[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Tr=new Map;function Ji(e,t){let r=Tr.get(e);return r||(r=new Map,Tr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var nn=(e,t,r)=>{if(!e||!(on(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=Ji(r,n),s=i.indexOf(e);return s===-1&&(s=i.length,i.push(e)),s};function lt(e,t,r){if(e instanceof Array)return e.map(n=>lt(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return {rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,i=Ki(e);return {rr_type:n,base64:i}}else {if(e instanceof DataView)return {rr_type:e.constructor.name,args:[lt(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return {rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return {rr_type:n,src:i}}else {if(e instanceof ImageData)return {rr_type:e.constructor.name,args:[lt(e.data,t,r),e.width,e.height]};if(on(e,t)||typeof e=="object"){let n=e.constructor.name,i=nn(e,t,r);return {rr_type:n,index:i}}}}return e}var sn=(e,t,r)=>e.map(n=>lt(n,t,r)),on=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Qi(e,t,r,n){let i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of s)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Re(t.CanvasRenderingContext2D.prototype,o,function(a){return function(...f){return te(this.canvas,r,n,!0)||setTimeout(()=>{let u=sn(f,t,this);e(this.canvas,{type:De["2D"],property:o,args:u});},0),a.apply(this,f)}});i.push(l);}catch{let l=bt(t.CanvasRenderingContext2D.prototype,o,{set(a){e(this.canvas,{type:De["2D"],property:o,args:[a],setter:true});}});i.push(l);}return ()=>{i.forEach(o=>o());}}function es(e){return e==="experimental-webgl"?"webgl":e}function Or(e,t,r,n){let i=[];try{let s=Re(e.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!te(this,t,r,!0)){let f=es(l);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(a[0]&&typeof a[0]=="object"){let u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0);}else a.splice(0,1,{preserveDrawingBuffer:!0});}return o.apply(this,[l,...a])}});i.push(s);}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{i.forEach(s=>s());}}function Ar(e,t,r,n,i,s){let o=[],l=Object.getOwnPropertyNames(e);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let f=Re(e,a,function(u){return function(...h){let d=u.apply(this,h);if(nn(d,s,this),"tagName"in this.canvas&&!te(this.canvas,n,i,!0)){let p=sn(h,s,this),m={type:t,property:a,args:p};r(this.canvas,m);}return d}});o.push(f);}catch{let f=bt(e,a,{set(u){r(this.canvas,{type:t,property:a,args:[u],setter:true});}});o.push(f);}return o}function ts(e,t,r,n){let i=[];return typeof t.WebGLRenderingContext<"u"&&i.push(...Ar(t.WebGLRenderingContext.prototype,De.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Ar(t.WebGL2RenderingContext.prototype,De.WebGL2,e,r,n,t)),()=>{i.forEach(s=>s());}}var an=`(function() {
|
|
4
4
|
"use strict";
|
|
5
5
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
6
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
@@ -75,6 +75,6 @@ or you can use record.mirror to access the mirror instance during recording.`,Mr
|
|
|
75
75
|
};
|
|
76
76
|
})();
|
|
77
77
|
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
78
|
-
`,Or=typeof self<"u"&&self.Blob&&new Blob([sn],{type:"text/javascript;charset=utf-8"});function es(e){let t;try{if(t=Or&&(self.URL||self.webkitURL).createObjectURL(Or),!t)throw "";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t);}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(sn),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t);}}var qt=class{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",false),g(this,"locked",false),g(this,"processMutation",(a,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(f);});let{sampling:r="all",win:n,blockClass:i,blockSelector:s,recordCanvas:o,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&r==="all"&&this.initCanvasMutationObserver(n,i,s),o&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,s,{dataURLOptions:c});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(t,r,n,i,s){let o=kr(r,n,i,true),c=new Map,a=new es;a.onmessage=m=>{let{id:u}=m.data;if(c.set(u,false),!("base64"in m.data))return;let{base64:v,type:C,width:b,height:y}=m.data;this.mutationCb({id:u,type:De["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:C}]},0,0]}]});};let f=1e3/t,l=0,h,d=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(u=>{te(u,n,i,true)||m.push(u);}),m},p=m=>{if(l&&m-l<f){h=requestAnimationFrame(p);return}l=m,d().forEach(async u=>{var v;let C=this.mirror.getId(u);if(c.get(C)||u.width===0||u.height===0)return;if(c.set(C,true),["webgl","webgl2"].includes(u.__context)){let y=u.getContext(u.__context);((v=y?.getContextAttributes())==null?void 0:v.preserveDrawingBuffer)===false&&y.clear(y.COLOR_BUFFER_BIT);}let b=await createImageBitmap(u);a.postMessage({id:C,bitmap:b,width:u.width,height:u.height,dataURLOptions:s.dataURLOptions},[b]);}),h=requestAnimationFrame(p);};h=requestAnimationFrame(p),this.resetObservers=()=>{o(),cancelAnimationFrame(h);};}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=kr(t,r,n,false),s=Ji(this.processMutation.bind(this),t,r,n),o=Qi(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),s(),o();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t);};requestAnimationFrame(t);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(o=>{let{type:c,...a}=o;return a}),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:i}),this.pendingCanvasMutations.delete(t);}},Zt=class{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new Ht),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb;}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t);}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t));}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},i=[];for(let s of t){let o;this.styleMirror.has(s)?o=this.styleMirror.getId(s):(o=this.styleMirror.add(s),i.push({styleId:o,rules:Array.from(s.rules||CSSRule,(c,a)=>({rule:_r(c,s.href),index:a}))})),n.styleIds.push(o);}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(t){}},Yt=class{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",false);}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=true,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=false;})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r));}destroy(){}},$,lt,Ut,gt=false;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((gr=e.contentWindow)==null?void 0:gr.Array.from)||Array.from,document.body.removeChild(e);}}catch(e){console.debug("Unable to override Array.from",e);}var fe=ni();function Ee(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",ignoreSelector:c=null,maskTextClass:a="rr-mask",maskTextSelector:f=null,inlineStylesheet:l=true,maskAllInputs:h,maskInputOptions:d,slimDOMOptions:p,maskInputFn:m,maskTextFn:u,hooks:v,packFn:C,sampling:b={},dataURLOptions:y={},mousemoveWait:M,recordDOM:I=true,recordCanvas:x=false,recordCrossOriginIframes:k=false,recordAfter:E=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:R=false,collectFonts:B=false,inlineImages:A=false,plugins:T,keepIframeSrcFn:S=()=>false,ignoreCSSAttributes:L=new Set([]),errorHandler:j}=e;Di(j);let U=k?window.parent===window:true,N=false;if(!U)try{window.parent.document&&(N=!1);}catch{N=true;}if(U&&!t)throw new Error("emit function is required");if(!U&&!N)return ()=>{};M!==void 0&&b.mousemove===void 0&&(b.mousemove=M),fe.reset();let q=h===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:d!==void 0?d:{password:true},Z=Wr(p);Ti();let ye,J=0,he=_=>{for(let ie of T||[])ie.eventProcessor&&(_=ie.eventProcessor(_));return C&&!N&&(_=C(_)),_};$=(_,ie)=>{var W;let H=_;if(H.timestamp=Ve(),(W=Me[0])!=null&&W.isFrozen()&&H.type!==z.FullSnapshot&&!(H.type===z.IncrementalSnapshot&&H.data.source===O.Mutation)&&Me.forEach(oe=>oe.unfreeze()),U)t?.(he(H),ie);else if(N){let oe={type:"rrweb",event:he(H),origin:window.location.origin,isCheckout:ie};window.parent.postMessage(oe,"*");}if(H.type===z.FullSnapshot)ye=H,J=0;else if(H.type===z.IncrementalSnapshot){if(H.data.source===O.Mutation&&H.data.isAttachIframe)return;J++;let oe=n&&J>=n,F=r&&H.timestamp-ye.timestamp>r;(oe||F)&<(true);}};let Q=_=>{$({type:z.IncrementalSnapshot,data:{source:O.Mutation,..._}});},K=_=>$({type:z.IncrementalSnapshot,data:{source:O.Scroll,..._}}),V=_=>$({type:z.IncrementalSnapshot,data:{source:O.CanvasMutation,..._}}),X=_=>$({type:z.IncrementalSnapshot,data:{source:O.AdoptedStyleSheet,..._}}),re=new Zt({mutationCb:Q,adoptedStyleSheetCb:X}),ne=new Vt({mirror:fe,mutationCb:Q,stylesheetManager:re,recordCrossOriginIframes:k,wrappedEmit:$});for(let _ of T||[])_.getMirror&&_.getMirror({nodeMirror:fe,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});let Se=new Yt;Ut=new qt({recordCanvas:x,mutationCb:V,win:window,blockClass:i,blockSelector:s,mirror:fe,sampling:b.canvas,dataURLOptions:y});let we=new $t({mutationCb:Q,scrollCb:K,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:f,inlineStylesheet:l,maskInputOptions:q,dataURLOptions:y,maskTextFn:u,maskInputFn:m,recordCanvas:x,inlineImages:A,sampling:b,slimDOMOptions:Z,iframeManager:ne,stylesheetManager:re,canvasManager:Ut,keepIframeSrcFn:S,processedNodeManager:Se},mirror:fe});lt=(_=false)=>{if(!I)return;$({type:z.Meta,data:{href:window.location.href,width:jr(),height:Gr()}},_),re.reset(),we.init(),Me.forEach(W=>W.lock());let ie=xi(document,{mirror:fe,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:f,inlineStylesheet:l,maskAllInputs:q,maskTextFn:u,maskInputFn:m,slimDOM:Z,dataURLOptions:y,recordCanvas:x,inlineImages:A,onSerialize:W=>{qr(W,fe)&&ne.addIframe(W),Zr(W,fe)&&re.trackLinkElement(W),Wt(W)&&we.addShadowRoot(w.shadowRoot(W),document);},onIframeLoad:(W,H)=>{ne.attachIframe(W,H),we.observeAttachShadow(W);},onStylesheetLoad:(W,H)=>{re.attachLinkElement(W,H);},keepIframeSrcFn:S});if(!ie)return console.warn("Failed to snapshot the document");$({type:z.FullSnapshot,data:{node:ie,initialOffset:Hr(window)}},_),Me.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,fe.getId(document));};try{let _=[],ie=H=>{var oe;return D(qi)({mutationCb:Q,mousemoveCb:(F,St)=>$({type:z.IncrementalSnapshot,data:{source:St,positions:F}}),mouseInteractionCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.MouseInteraction,...F}}),scrollCb:K,viewportResizeCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.ViewportResize,...F}}),inputCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.Input,...F}}),mediaInteractionCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.MediaInteraction,...F}}),styleSheetRuleCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.StyleSheetRule,...F}}),styleDeclarationCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.StyleDeclaration,...F}}),canvasMutationCb:V,fontCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.Font,...F}}),selectionCb:F=>{$({type:z.IncrementalSnapshot,data:{source:O.Selection,...F}});},customElementCb:F=>{$({type:z.IncrementalSnapshot,data:{source:O.CustomElement,...F}});},blockClass:i,ignoreClass:o,ignoreSelector:c,maskTextClass:a,maskTextSelector:f,maskInputOptions:q,inlineStylesheet:l,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:A,userTriggeredOnInput:R,collectFonts:B,doc:H,maskInputFn:m,maskTextFn:u,keepIframeSrcFn:S,blockSelector:s,slimDOMOptions:Z,dataURLOptions:y,mirror:fe,iframeManager:ne,stylesheetManager:re,shadowDomManager:we,processedNodeManager:Se,canvasManager:Ut,ignoreCSSAttributes:L,plugins:((oe=T?.filter(F=>F.observer))==null?void 0:oe.map(F=>({observer:F.observer,options:F.options,callback:St=>$({type:z.Plugin,data:{plugin:F.name,payload:St}})})))||[]},v)};ne.addLoadListener(H=>{try{_.push(ie(H.contentDocument));}catch(oe){console.warn(oe);}});let W=()=>{lt(),_.push(ie(document)),gt=!0;};return ["interactive","complete"].includes(document.readyState)?W():(_.push(ee("DOMContentLoaded",()=>{$({type:z.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&W();})),_.push(ee("load",()=>{$({type:z.Load,data:{}}),E==="load"&&W();},window))),()=>{_.forEach(H=>{try{H();}catch(oe){String(oe).toLowerCase().includes("cross-origin")||console.warn(oe);}}),Se.destroy(),gt=!1,Li();}}catch(_){console.warn(_);}}Ee.addCustomEvent=(e,t)=>{if(!gt)throw new Error("please add custom event after start recording");$({type:z.Custom,data:{tag:e,payload:t}});};Ee.freezePage=()=>{Me.forEach(e=>e.freeze());};Ee.takeFullSnapshot=e=>{if(!gt)throw new Error("please take full snapshot after start recording");lt(e);};Ee.mirror=fe;var ts=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,on=/(?:\+\d{1,3}[\s.-]?)?(?:\(?\d{2,4}\)?[\s.-])\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g,rs=/\b(?:паспорт|passport|ssn)\s*[:#-]?\s*[A-Z0-9][A-Z0-9\s-]{4,}\b/gi,ns=/\b\d{4}\s\d{6}\b/g,is=/(?<!\d)(?:\d[ -]?){12,18}\d(?!\d)/g,an=/\b(?:card|карта|cc|pan)\s*[:#-]?\s*([0-9][0-9 -]{11,20}[0-9])\b/gi,ss=/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\b/g,os=/\bBearer\s+[A-Za-z0-9_\-\.=]{16,}\b/gi,as=/\b(?:api[_-]?key|auth[_-]?token|client[_-]?secret|private[_-]?key)\s*[:=]\s*['"]?[A-Za-z0-9_\-]{16,}['"]?/gi,dn=/token|email|phone|password|secret|key|card|cvv|cvc|ssn|auth/i;function ls(e){let t=0,r=false;for(let n=e.length-1;n>=0;n-=1){let i=e.charCodeAt(n)-48;if(i<0||i>9)return false;r&&(i*=2,i>9&&(i-=9)),t+=i,r=!r;}return t%10===0}function Ie(e,t,r){return e.lastIndex=0,t.replace(e,r)}function Le(e){if(e.length<6)return e;let t=e;return t.includes("eyJ")&&(t=Ie(ss,t,"[REDACTED_JWT]")),/(?:bearer)/i.test(t)&&(t=Ie(os,t,"Bearer [REDACTED_TOKEN]")),/(?:api[_-]?key|auth[_-]?token|client[_-]?secret|private[_-]?key)/i.test(t)&&(t=Ie(as,t,"[REDACTED_SECRET]")),/(?:card|карта|cc|pan)/i.test(t)&&(an.lastIndex=0,t=t.replace(an,(r,n)=>{let i=n.replace(/[ -]/g,"");return i.length>=12&&i.length<=19?r.replace(n,"[REDACTED_CARD]"):r})),/\d{4}/.test(t)&&(t=Ie(is,t,r=>{let n=r.replace(/[ -]/g,"");return n.length<13||n.length>19||!ls(n)?r:"[REDACTED_CARD]"})),t.includes("@")&&(t=Ie(ts,t,"[REDACTED_EMAIL]")),/\d{3,}/.test(t)&&(on.lastIndex=0,t=t.replace(on,r=>{let n=r.replace(/\D/g,"");return n.length<10||n.length>15?r:"[REDACTED_PHONE]"})),/(?:паспорт|passport|ssn)/i.test(t)&&(t=Ie(rs,t,"[REDACTED_DOCUMENT]")),/\d{4}\s\d{6}/.test(t)&&(t=Ie(ns,t,"[REDACTED_DOCUMENT]")),t}function _e(e){let t=Le(e);return t!==e?t:"*".repeat(e.length)}function be(e){return "*".repeat(e.length)}function pn(e){try{let t=/^[a-z][a-z0-9+.-]*:/i.test(e),r=new URL(e,"https://assets.invalid"),n=[];r.searchParams.forEach((i,s)=>{dn.test(s)&&n.push(s);});for(let i of n)r.searchParams.delete(i);return t?r.toString():`${r.pathname}${r.search}${r.hash}`}catch{return e.replace(/([?&])((?:access_)?token|email|phone|password|secret|key|card|cvv|cvc|ssn)=[^&#]*/gi,"$1$2=")}}function us(e){return e.toLowerCase().includes("url(")?e.replace(/url\((['"]?)(.*?)\1\)/gi,(t,r,n)=>`url(${r}${pn(n)}${r})`):e}function ln(e,t){return e.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"))?.[1]?.trim()||void 0}function bt(e,t){let r=e.class??e.className;return typeof r!="string"?false:r.split(/\s+/).includes(t)}function un(e){return "data-askdepth-block"in e||"data-rr-block"in e||bt(e,"askdepth-block")||bt(e,"rr-block")}function cn(e){return "data-askdepth-mask"in e||"data-rr-mask"in e||bt(e,"askdepth-mask")||bt(e,"rr-mask")}function fn(e){return "contenteditable"in e&&e.contenteditable!=="false"&&e.contenteditable!==false}function hn(e,t){let r={};for(let[n,i]of Object.entries(e)){if(n==="placeholder"){r[n]="";continue}if(n==="value"&&typeof i=="string"){r[n]=t?be(i):_e(i);continue}if((n==="aria-label"||n==="title"||n==="alt")&&typeof i=="string"){r[n]=t?be(i):Le(i);continue}if((n==="src"||n==="href")&&typeof i=="string"){r[n]=i.includes("?")?pn(i):i;continue}if(n==="style"&&typeof i=="string"){r[n]=us(i);continue}if(n.startsWith("data-")&&dn.test(n)&&typeof i=="string"){r[n]=be(i);continue}r[n]=i;}return r}var Ze=class{maskedIds=new Set;blockedIds=new Set;clear(){this.maskedIds.clear(),this.blockedIds.clear();}sanitize(t){let r=JSON.parse(JSON.stringify(t));if(r.type===2){if(this.clear(),r.data&&typeof r.data=="object"){let n=r.data;n.node&&typeof n.node=="object"&&this.sanitizeNode(n.node,false,false);}return r}return r.type===3&&r.data&&typeof r.data=="object"?(this.sanitizeIncremental(r.data),r):(r.data&&typeof r.data=="object"&&this.sanitizeNode(r.data,false,false),r)}sanitizeIncremental(t){if(Array.isArray(t.removes))for(let r of t.removes)r&&typeof r.id=="number"&&(this.maskedIds.delete(r.id),this.blockedIds.delete(r.id));if(Array.isArray(t.adds)){for(let r of t.adds)if(r&&r.node&&typeof r.node=="object"){let n=typeof r.parentId=="number"&&this.maskedIds.has(r.parentId),i=typeof r.parentId=="number"&&this.blockedIds.has(r.parentId);this.sanitizeNode(r.node,n,i);}}if(Array.isArray(t.attributes)){for(let r of t.attributes)if(r&&typeof r.id=="number"&&r.attributes&&typeof r.attributes=="object"){let n=r.attributes;if(un(n)&&this.blockedIds.add(r.id),this.blockedIds.has(r.id)){let s={"data-askdepth-block":""};"width"in n&&(s.width=n.width),"height"in n&&(s.height=n.height),"rr_width"in n&&(s.rr_width=n.rr_width),"rr_height"in n&&(s.rr_height=n.rr_height),r.attributes=s;continue}(cn(n)||fn(n))&&this.maskedIds.add(r.id);let i=this.maskedIds.has(r.id);r.attributes=hn(n,i);}}if(Array.isArray(t.texts)){for(let r of t.texts)if(r&&typeof r.value=="string"){if(typeof r.id=="number"&&this.blockedIds.has(r.id)){r.value="";continue}let n=typeof r.id=="number"&&this.maskedIds.has(r.id);r.value=n?be(r.value):Le(r.value);}}if(t.source===5&&typeof t.text=="string"){if(typeof t.id=="number"&&this.blockedIds.has(t.id)){t.text="";return}let r=typeof t.id=="number"&&this.maskedIds.has(t.id);t.text=r?be(t.text):_e(t.text);}}sanitizeNode(t,r,n){let i=typeof t.id=="number"?t.id:void 0,s=t.attributes,o=s&&typeof s=="object"&&!Array.isArray(s)?s:null,c=typeof t.tagName=="string"?t.tagName.toLowerCase():"",a=!!(c&&o),f=n||!!(a&&o&&un(o));if(i!==void 0&&f&&this.blockedIds.add(i),a&&o&&f){let d=typeof o.style=="string"?o.style:"",p=o.width??o.rr_width??ln(d,"width")??120,m=o.height??o.rr_height??ln(d,"height")??40;t.childNodes=[];let u={"data-askdepth-block":"",width:p,height:m,rr_width:String(p),rr_height:String(m)};t.attributes=u;return}let l=!!(o&&fn(o)),h=r||l||!!(o&&cn(o));if(i!==void 0&&h&&this.maskedIds.add(i),o&&(t.attributes=hn(o,h)),typeof t.textContent=="string"&&(t.textContent=h?be(t.textContent):Le(t.textContent)),!c&&typeof t.id=="number"&&typeof t.value=="string"&&(t.value=h?be(t.value):Le(t.value)),t.source===5&&typeof t.text=="string"&&(t.text=h?be(t.text):_e(t.text)),Array.isArray(t.childNodes))for(let d of t.childNodes)d&&typeof d=="object"&&this.sanitizeNode(d,h,f);for(let d of ["adds","texts","attributes","removes","node"]){let p=t[d];if(Array.isArray(p))for(let m of p)m&&typeof m=="object"&&this.sanitizeNode(m,h,f);else p&&typeof p=="object"&&this.sanitizeNode(p,h,f);}}};function Kt(){return new Ze}var cs=new Ze;function fs(e){return cs.sanitize(e)}function Qt(e){let t=Ue(e.userAgent??"")<3145728;return {emit:e.emit,checkoutEveryNms:e.checkoutEveryNms??45e3,inlineStylesheet:true,collectFonts:false,inlineImages:false,recordCanvas:false,maskAllInputs:true,maskInputFn:r=>_e(r),maskTextFn:r=>r?r.replace(/[^\s]/g,"*"):"",maskTextSelector:e.maskTextSelector??'[data-askdepth-mask], .askdepth-mask, [contenteditable]:not([contenteditable="false"])',maskTextClass:"askdepth-mask",blockSelector:"[data-askdepth-block], [data-rr-block], .askdepth-block, .rr-block",blockClass:"askdepth-block",sampling:{mousemove:t?false:50,mouseInteraction:{MouseUp:false,MouseDown:true,Click:true,ContextMenu:true,DblClick:false,Focus:false,Blur:false,TouchStart:true,TouchEnd:false,TouchCancel:false},scroll:150,input:"last"}}}function er(e){if(!e.data||typeof e.data!="object")return null;let t=e.data.source;return typeof t=="number"?t:null}function mn(e){let t=er(e);return t===Qe||t===et}function hs(e){return er(e)===rr}function yn(e){return e.type===ue||e.type!==Je?false:er(e)===Ke}var Ye=class{windowMs;maxBytes;now;onPressure;items=[];bytes=0;baseline=null;constructor(t){this.windowMs=t?.windowMs??45e3,this.maxBytes=t?.maxBytes??3145728,this.now=t?.now??(()=>Date.now()),this.onPressure=t?.onPressure;}get byteLength(){return this.bytes}clear(){this.items=[],this.bytes=0,this.baseline=null;}push(t){let r={event:t,bytes:tt(t)};t.type===ue?(this.baseline=t,this.items=this.items.filter(n=>n.event.timestamp>=t.timestamp&&n.event.type!==ue),this.items.unshift(r),this.recount()):(this.items.push(r),this.bytes+=r.bytes),this.evict();}evict(){let t=this.now()-this.windowMs,r=this.baseline?.timestamp;this.items=this.items.filter(n=>n.event.type===ue&&n.event===this.baseline?true:r!==void 0&&n.event.timestamp<r?false:r!==void 0&&yn(n.event)?true:n.event.timestamp>=t),this.recount(),this.evictByMemory();}dropPointerSamples(){let t=this.items.filter(r=>!mn(r.event));t.length!==this.items.length&&(this.items=t,this.recount());}toArray(){return this.items.map(t=>t.event)}slice(t){let r=t-this.windowMs,n=this.baseline&&this.baseline.timestamp<=t?this.baseline:null,i=this.items.map(s=>s.event).filter(s=>n&&s===n||n&&s.timestamp<n.timestamp||s.timestamp>t?false:n&&yn(s)?true:s.timestamp>=r);return n?[n,...i]:i}evictByMemory(){for(;this.bytes>this.maxBytes;){let t=this.items.findIndex(i=>mn(i.event));if(t>=0){this.removeAt(t);continue}let r=this.items.reduce((i,s,o)=>(hs(s.event)&&i.push(o),i),[]),n=r.length>1?r[0]:void 0;if(n!==void 0){this.removeAt(n);continue}this.onPressure&&this.onPressure();break}}removeAt(t){let r=this.items.splice(t,1)[0];r&&(this.bytes-=r.bytes,this.bytes<0&&(this.bytes=0));}recount(){this.bytes=0;for(let t of this.items)this.bytes+=t.bytes;}};var ds=1e4,tr=2;async function gn(e,t,r=fetch){let n=typeof t.payload=="string"?t.payload:ir(t.payload),i=JSON.stringify({manifest:t.manifest,payload:n,part_index:t.part_index,total_parts:t.total_parts}),s=i.length<=64*1024,o=0;for(;o<=tr;){let c=typeof AbortController<"u"?new AbortController:null,a=c?setTimeout(()=>c.abort(),ds):null;try{let f=await r(e,{method:"POST",keepalive:s,headers:{"content-type":"application/json"},body:i,...c?{signal:c.signal}:{}});if(a&&clearTimeout(a),f.ok||f.status<500)return;if(o===tr)throw new Error(`Upload failed with status ${f.status}`);await new Promise(l=>setTimeout(l,150*Math.pow(2,o)));}catch(f){if(a&&clearTimeout(a),o===tr)throw f;await new Promise(l=>setTimeout(l,150*Math.pow(2,o)));}o+=1;}}var ps=500,ms=1e3;function ys(){return typeof performance<"u"?performance.now():Date.now()}function gs(e){typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):queueMicrotask(e);}function vs(){let e=typeof navigator<"u"?navigator:void 0;if(e&&typeof e.deviceMemory=="number"&&e.deviceMemory<=1)return true;let t=performance.memory;return !t||t.jsHeapSizeLimit<=0?false:t.usedJSHeapSize/t.jsHeapSizeLimit>.85}function bs(e){let t=e.now??(()=>Date.now()),r=e.clock??ys,n=e.schedule??gs,i=e.fetchImpl??fetch,s=e.compress??(A=>Dt(A)),o=e.memoryPressure??vs,c=e.userAgent??(typeof navigator<"u"?navigator.userAgent:""),a=e.windowMs??45e3,f=null,l=new Ye({windowMs:a,maxBytes:e.maxBytes??Ue(c),now:t,onPressure:()=>f?.checkpoint()}),h=Kt(),d=[],p=false,m=false,u=null,v=null,C=null,b=0,y=[],M=0,I=()=>{let A=r(),T=0;for(;d.length>0;){if(T>0&&r()-A>=Mt){x();return}let S=d.shift();S&&l.push(S),T+=1,o()&&l.dropPointerSamples();}},x=()=>{p||(p=true,n(()=>{p=false,I();}));},k=A=>{let T=h.sanitize(A);if(T.type===ue){l.push(T);return}if(d.length>=ps){let S=d.filter(L=>{if(L.type===ue||L.type===Je&&L.data?.source===Ke)return true;let j=L.data?.source;return j!==Qe&&j!==et});d.length=0,d.push(...S);}d.push(T),x();},E=()=>{for(p=false;d.length>0;){let A=d.shift();A&&l.push(A);}},R=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&(E(),l.dropPointerSamples());};return {start(){if(!m){if(m=true,typeof document<"u"&&(document.addEventListener("visibilitychange",R),u=()=>document.removeEventListener("visibilitychange",R)),e.recorder){f=e.recorder(k);return}B();}},stop(){m=false,E(),l.clear(),h.clear(),C=null,y=[],f?.stop(),f=null,u?.(),u=null,v?.(),v=null;},push(A){k(A);},dump(){return l.slice(t())},async flash(A,T){let S=T??t();return C||(S-b<ms&&y.length>0?y:(C=(async()=>{try{E();let L=l.slice(S).filter(X=>X.timestamp<=S),j=l.baseline,N=L.filter(X=>X.type!==ue)[0],q=N?.timestamp??j?.timestamp??S,Z=Math.min(a,Math.max(0,S-(N?N.timestamp:S)));if(L.length===0)return [];M+=1;let ye=crypto.randomUUID(),J=JSON.stringify(L),he=Rt(J),Q=await s(he),K=sr(Q.bytes,Ct),V=K.map((X,re)=>{let ne=new Uint8Array(new ArrayBuffer(X.byteLength));return ne.set(X),{manifest:{slice_id:ye,triggering_anomaly_id:A,session_id:e.sessionId,environment:e.environment,start_timestamp:q,trigger_timestamp:S,duration_ms:Z,has_baseline_snapshot:!!j||L.some(Se=>Se.type===ue),events_count:L.length,uncompressed_byte_size:tt(L),compressed_byte_size:Q.bytes.byteLength,compression_algorithm:Q.algorithm,sequence_number:M},payload:ne,part_index:re,total_parts:K.length}});return await Promise.all(V.map(async X=>{try{await gn(e.endpoint,X,i);}catch(re){console.warn("[Askdepth] Failed to upload replay slice",re);}})),b=S,y=V,V}finally{C=null;}})(),C))}};function B(){if(typeof window>"u"||typeof document>"u"||!m)return;let A=Qt({emit:(L,j)=>{if(j&&L.type!==ue){k({...L,type:ue});return}k(L);},...e.checkoutEveryNms!==void 0?{checkoutEveryNms:e.checkoutEveryNms}:{checkoutEveryNms:45e3},userAgent:c}),T=Ee(A),S=()=>{Ee.takeFullSnapshot(true);};f={stop:()=>T?.(),checkpoint:S},v=Ss(S);}}function Ss(e){if(typeof window>"u"||typeof history>"u")return ()=>{};let t=history.pushState,r=history.replaceState,n=0,i=()=>{let o=Date.now();o-n<1e3||(n=o,e());};history.pushState=(...o)=>{t.apply(history,o),i();},history.replaceState=(...o)=>{r.apply(history,o),i();};let s=()=>i();return window.addEventListener("popstate",s),window.addEventListener("hashchange",s),()=>{history.pushState=t,history.replaceState=r,window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s);}}
|
|
79
|
-
exports.CHECKOUT_EVERY_MS=
|
|
78
|
+
`,Nr=typeof self<"u"&&self.Blob&&new Blob([an],{type:"text/javascript;charset=utf-8"});function rs(e){let t;try{if(t=Nr&&(self.URL||self.webkitURL).createObjectURL(Nr),!t)throw "";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t);}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(an),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t);}}var Yt=class{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",false),g(this,"locked",false),g(this,"processMutation",(a,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(f);});let{sampling:r="all",win:n,blockClass:i,blockSelector:s,recordCanvas:o,dataURLOptions:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&r==="all"&&this.initCanvasMutationObserver(n,i,s),o&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,s,{dataURLOptions:l});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(t,r,n,i,s){let o=Or(r,n,i,true),l=new Map,a=new rs;a.onmessage=m=>{let{id:c}=m.data;if(l.set(c,false),!("base64"in m.data))return;let{base64:v,type:C,width:b,height:y}=m.data;this.mutationCb({id:c,type:De["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:C}]},0,0]}]});};let f=1e3/t,u=0,h,d=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(c=>{te(c,n,i,true)||m.push(c);}),m},p=m=>{if(u&&m-u<f){h=requestAnimationFrame(p);return}u=m,d().forEach(async c=>{var v;let C=this.mirror.getId(c);if(l.get(C)||c.width===0||c.height===0)return;if(l.set(C,true),["webgl","webgl2"].includes(c.__context)){let y=c.getContext(c.__context);((v=y?.getContextAttributes())==null?void 0:v.preserveDrawingBuffer)===false&&y.clear(y.COLOR_BUFFER_BIT);}let b=await createImageBitmap(c);a.postMessage({id:C,bitmap:b,width:c.width,height:c.height,dataURLOptions:s.dataURLOptions},[b]);}),h=requestAnimationFrame(p);};h=requestAnimationFrame(p),this.resetObservers=()=>{o(),cancelAnimationFrame(h);};}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Or(t,r,n,false),s=Qi(this.processMutation.bind(this),t,r,n),o=ts(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),s(),o();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t);};requestAnimationFrame(t);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(o=>{let{type:l,...a}=o;return a}),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:i}),this.pendingCanvasMutations.delete(t);}},Zt=class{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new Gt),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb;}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t);}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t));}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},i=[];for(let s of t){let o;this.styleMirror.has(s)?o=this.styleMirror.getId(s):(o=this.styleMirror.add(s),i.push({styleId:o,rules:Array.from(s.rules||CSSRule,(l,a)=>({rule:Ur(l,s.href),index:a}))})),n.styleIds.push(o);}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(t){}},Xt=class{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",false);}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=true,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=false;})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r));}destroy(){}},$,ut,Pt,vt=false;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((br=e.contentWindow)==null?void 0:br.Array.from)||Array.from,document.body.removeChild(e);}}catch(e){console.debug("Unable to override Array.from",e);}var fe=si();function Ee(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:f=null,inlineStylesheet:u=true,maskAllInputs:h,maskInputOptions:d,slimDOMOptions:p,maskInputFn:m,maskTextFn:c,hooks:v,packFn:C,sampling:b={},dataURLOptions:y={},mousemoveWait:M,recordDOM:I=true,recordCanvas:x=false,recordCrossOriginIframes:k=false,recordAfter:E=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:R=false,collectFonts:B=false,inlineImages:A=false,plugins:T,keepIframeSrcFn:S=()=>false,ignoreCSSAttributes:L=new Set([]),errorHandler:V}=e;_i(V);let U=k?window.parent===window:true,N=false;if(!U)try{window.parent.document&&(N=!1);}catch{N=true;}if(U&&!t)throw new Error("emit function is required");if(!U&&!N)return ()=>{};M!==void 0&&b.mousemove===void 0&&(b.mousemove=M),fe.reset();let q=h===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:d!==void 0?d:{password:true},Y=Gr(p);Ai();let ye,J=0,he=_=>{for(let ne of T||[])ne.eventProcessor&&(_=ne.eventProcessor(_));return C&&!N&&(_=C(_)),_};$=(_,ne)=>{var W;let H=_;if(H.timestamp=$e(),(W=Me[0])!=null&&W.isFrozen()&&H.type!==z.FullSnapshot&&!(H.type===z.IncrementalSnapshot&&H.data.source===O.Mutation)&&Me.forEach(se=>se.unfreeze()),U)t?.(he(H),ne);else if(N){let se={type:"rrweb",event:he(H),origin:window.location.origin,isCheckout:ne};window.parent.postMessage(se,"*");}if(H.type===z.FullSnapshot)ye=H,J=0;else if(H.type===z.IncrementalSnapshot){if(H.data.source===O.Mutation&&H.data.isAttachIframe)return;J++;let se=n&&J>=n,F=r&&H.timestamp-ye.timestamp>r;(se||F)&&ut(true);}};let Q=_=>{$({type:z.IncrementalSnapshot,data:{source:O.Mutation,..._}});},X=_=>$({type:z.IncrementalSnapshot,data:{source:O.Scroll,..._}}),j=_=>$({type:z.IncrementalSnapshot,data:{source:O.CanvasMutation,..._}}),K=_=>$({type:z.IncrementalSnapshot,data:{source:O.AdoptedStyleSheet,..._}}),le=new Zt({mutationCb:Q,adoptedStyleSheetCb:K}),re=new $t({mirror:fe,mutationCb:Q,stylesheetManager:le,recordCrossOriginIframes:k,wrappedEmit:$});for(let _ of T||[])_.getMirror&&_.getMirror({nodeMirror:fe,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});let Se=new Xt;Pt=new Yt({recordCanvas:x,mutationCb:j,win:window,blockClass:i,blockSelector:s,mirror:fe,sampling:b.canvas,dataURLOptions:y});let we=new qt({mutationCb:Q,scrollCb:X,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:f,inlineStylesheet:u,maskInputOptions:q,dataURLOptions:y,maskTextFn:c,maskInputFn:m,recordCanvas:x,inlineImages:A,sampling:b,slimDOMOptions:Y,iframeManager:re,stylesheetManager:le,canvasManager:Pt,keepIframeSrcFn:S,processedNodeManager:Se},mirror:fe});ut=(_=false)=>{if(!I)return;$({type:z.Meta,data:{href:window.location.href,width:$r(),height:jr()}},_),le.reset(),we.init(),Me.forEach(W=>W.lock());let ne=Ti(document,{mirror:fe,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:f,inlineStylesheet:u,maskAllInputs:q,maskTextFn:c,maskInputFn:m,slimDOM:Y,dataURLOptions:y,recordCanvas:x,inlineImages:A,onSerialize:W=>{Zr(W,fe)&&re.addIframe(W),Xr(W,fe)&&le.trackLinkElement(W),Ht(W)&&we.addShadowRoot(w.shadowRoot(W),document);},onIframeLoad:(W,H)=>{re.attachIframe(W,H),we.observeAttachShadow(W);},onStylesheetLoad:(W,H)=>{le.attachLinkElement(W,H);},keepIframeSrcFn:S});if(!ne)return console.warn("Failed to snapshot the document");$({type:z.FullSnapshot,data:{node:ne,initialOffset:Vr(window)}},_),Me.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&le.adoptStyleSheets(document.adoptedStyleSheets,fe.getId(document));};try{let _=[],ne=H=>{var se;return D(Zi)({mutationCb:Q,mousemoveCb:(F,Ct)=>$({type:z.IncrementalSnapshot,data:{source:Ct,positions:F}}),mouseInteractionCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.MouseInteraction,...F}}),scrollCb:X,viewportResizeCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.ViewportResize,...F}}),inputCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.Input,...F}}),mediaInteractionCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.MediaInteraction,...F}}),styleSheetRuleCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.StyleSheetRule,...F}}),styleDeclarationCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.StyleDeclaration,...F}}),canvasMutationCb:j,fontCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.Font,...F}}),selectionCb:F=>{$({type:z.IncrementalSnapshot,data:{source:O.Selection,...F}});},customElementCb:F=>{$({type:z.IncrementalSnapshot,data:{source:O.CustomElement,...F}});},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:f,maskInputOptions:q,inlineStylesheet:u,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:A,userTriggeredOnInput:R,collectFonts:B,doc:H,maskInputFn:m,maskTextFn:c,keepIframeSrcFn:S,blockSelector:s,slimDOMOptions:Y,dataURLOptions:y,mirror:fe,iframeManager:re,stylesheetManager:le,shadowDomManager:we,processedNodeManager:Se,canvasManager:Pt,ignoreCSSAttributes:L,plugins:((se=T?.filter(F=>F.observer))==null?void 0:se.map(F=>({observer:F.observer,options:F.options,callback:Ct=>$({type:z.Plugin,data:{plugin:F.name,payload:Ct}})})))||[]},v)};re.addLoadListener(H=>{try{_.push(ne(H.contentDocument));}catch(se){console.warn(se);}});let W=()=>{ut(),_.push(ne(document)),vt=!0;};return ["interactive","complete"].includes(document.readyState)?W():(_.push(ee("DOMContentLoaded",()=>{$({type:z.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&W();})),_.push(ee("load",()=>{$({type:z.Load,data:{}}),E==="load"&&W();},window))),()=>{_.forEach(H=>{try{H();}catch(se){String(se).toLowerCase().includes("cross-origin")||console.warn(se);}}),Se.destroy(),vt=!1,zi();}}catch(_){console.warn(_);}}Ee.addCustomEvent=(e,t)=>{if(!vt)throw new Error("please add custom event after start recording");$({type:z.Custom,data:{tag:e,payload:t}});};Ee.freezePage=()=>{Me.forEach(e=>e.freeze());};Ee.takeFullSnapshot=e=>{if(!vt)throw new Error("please take full snapshot after start recording");ut(e);};Ee.mirror=fe;var ns=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,ln=/(?:\+\d{1,3}[\s.-]?)?(?:\(?\d{2,4}\)?[\s.-])\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g,is=/\b(?:passport|ssn)\s*[:#-]?\s*[A-Z0-9][A-Z0-9\s-]{4,}\b/gi,ss=/\b\d{4}\s\d{6}\b/g,os=/(?<!\d)(?:\d[ -]?){12,18}\d(?!\d)/g,un=/\b(?:card|cc|pan)\s*[:#-]?\s*([0-9][0-9 -]{11,20}[0-9])\b/gi,as=/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\b/g,ls=/\bBearer\s+[A-Za-z0-9_\-\.=]{16,}\b/gi,us=/\b(?:api[_-]?key|auth[_-]?token|client[_-]?secret|private[_-]?key)\s*[:=]\s*['"]?[A-Za-z0-9_\-]{16,}['"]?/gi,mn=/token|email|phone|password|secret|key|card|cvv|cvc|ssn|auth/i;function cs(e){let t=0,r=false;for(let n=e.length-1;n>=0;n-=1){let i=e.charCodeAt(n)-48;if(i<0||i>9)return false;r&&(i*=2,i>9&&(i-=9)),t+=i,r=!r;}return t%10===0}function Ie(e,t,r){return e.lastIndex=0,t.replace(e,r)}function Le(e){if(e.length<6)return e;let t=e;return t.includes("eyJ")&&(t=Ie(as,t,"[REDACTED_JWT]")),/(?:bearer)/i.test(t)&&(t=Ie(ls,t,"Bearer [REDACTED_TOKEN]")),/(?:api[_-]?key|auth[_-]?token|client[_-]?secret|private[_-]?key)/i.test(t)&&(t=Ie(us,t,"[REDACTED_SECRET]")),/(?:card|cc|pan)/i.test(t)&&(un.lastIndex=0,t=t.replace(un,(r,n)=>{let i=n.replace(/[ -]/g,"");return i.length>=12&&i.length<=19?r.replace(n,"[REDACTED_CARD]"):r})),/\d{4}/.test(t)&&(t=Ie(os,t,r=>{let n=r.replace(/[ -]/g,"");return n.length<13||n.length>19||!cs(n)?r:"[REDACTED_CARD]"})),t.includes("@")&&(t=Ie(ns,t,"[REDACTED_EMAIL]")),/\d{3,}/.test(t)&&(ln.lastIndex=0,t=t.replace(ln,r=>{let n=r.replace(/\D/g,"");return n.length<10||n.length>15?r:"[REDACTED_PHONE]"})),/(?:passport|ssn)/i.test(t)&&(t=Ie(is,t,"[REDACTED_DOCUMENT]")),/\d{4}\s\d{6}/.test(t)&&(t=Ie(ss,t,"[REDACTED_DOCUMENT]")),t}function _e(e){let t=Le(e);return t!==e?t:"*".repeat(e.length)}function be(e){return "*".repeat(e.length)}function yn(e){try{let t=/^[a-z][a-z0-9+.-]*:/i.test(e),r=new URL(e,"https://assets.invalid"),n=[];r.searchParams.forEach((i,s)=>{mn.test(s)&&n.push(s);});for(let i of n)r.searchParams.delete(i);return t?r.toString():`${r.pathname}${r.search}${r.hash}`}catch{return e.replace(/([?&])((?:access_)?token|email|phone|password|secret|key|card|cvv|cvc|ssn)=[^&#]*/gi,"$1$2=")}}function fs(e){return e.toLowerCase().includes("url(")?e.replace(/url\((['"]?)(.*?)\1\)/gi,(t,r,n)=>`url(${r}${yn(n)}${r})`):e}function cn(e,t){return e.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"))?.[1]?.trim()||void 0}function St(e,t){let r=e.class??e.className;return typeof r!="string"?false:r.split(/\s+/).includes(t)}function fn(e){return "data-askdepth-block"in e||"data-rr-block"in e||St(e,"askdepth-block")||St(e,"rr-block")}function hn(e){return "data-askdepth-mask"in e||"data-rr-mask"in e||St(e,"askdepth-mask")||St(e,"rr-mask")}function dn(e){return "contenteditable"in e&&e.contenteditable!=="false"&&e.contenteditable!==false}function pn(e,t){let r={};for(let[n,i]of Object.entries(e)){if(n==="placeholder"){r[n]="";continue}if(n==="value"&&typeof i=="string"){r[n]=t?be(i):_e(i);continue}if((n==="aria-label"||n==="title"||n==="alt")&&typeof i=="string"){r[n]=t?be(i):Le(i);continue}if((n==="src"||n==="href")&&typeof i=="string"){r[n]=i.includes("?")?yn(i):i;continue}if(n==="style"&&typeof i=="string"){r[n]=fs(i);continue}if(n.startsWith("data-")&&mn.test(n)&&typeof i=="string"){r[n]=be(i);continue}r[n]=i;}return r}var Ze=class{maskedIds=new Set;blockedIds=new Set;clear(){this.maskedIds.clear(),this.blockedIds.clear();}sanitize(t){let r=JSON.parse(JSON.stringify(t));if(r.type===2){if(this.clear(),r.data&&typeof r.data=="object"){let n=r.data;n.node&&typeof n.node=="object"&&this.sanitizeNode(n.node,false,false);}return r}return r.type===3&&r.data&&typeof r.data=="object"?(this.sanitizeIncremental(r.data),r):(r.data&&typeof r.data=="object"&&this.sanitizeNode(r.data,false,false),r)}sanitizeIncremental(t){if(Array.isArray(t.removes))for(let r of t.removes)r&&typeof r.id=="number"&&(this.maskedIds.delete(r.id),this.blockedIds.delete(r.id));if(Array.isArray(t.adds)){for(let r of t.adds)if(r&&r.node&&typeof r.node=="object"){let n=typeof r.parentId=="number"&&this.maskedIds.has(r.parentId),i=typeof r.parentId=="number"&&this.blockedIds.has(r.parentId);this.sanitizeNode(r.node,n,i);}}if(Array.isArray(t.attributes)){for(let r of t.attributes)if(r&&typeof r.id=="number"&&r.attributes&&typeof r.attributes=="object"){let n=r.attributes;if(fn(n)&&this.blockedIds.add(r.id),this.blockedIds.has(r.id)){let s={"data-askdepth-block":""};"width"in n&&(s.width=n.width),"height"in n&&(s.height=n.height),"rr_width"in n&&(s.rr_width=n.rr_width),"rr_height"in n&&(s.rr_height=n.rr_height),r.attributes=s;continue}(hn(n)||dn(n))&&this.maskedIds.add(r.id);let i=this.maskedIds.has(r.id);r.attributes=pn(n,i);}}if(Array.isArray(t.texts)){for(let r of t.texts)if(r&&typeof r.value=="string"){if(typeof r.id=="number"&&this.blockedIds.has(r.id)){r.value="";continue}let n=typeof r.id=="number"&&this.maskedIds.has(r.id);r.value=n?be(r.value):Le(r.value);}}if(t.source===5&&typeof t.text=="string"){if(typeof t.id=="number"&&this.blockedIds.has(t.id)){t.text="";return}let r=typeof t.id=="number"&&this.maskedIds.has(t.id);t.text=r?be(t.text):_e(t.text);}}sanitizeNode(t,r,n){let i=typeof t.id=="number"?t.id:void 0,s=t.attributes,o=s&&typeof s=="object"&&!Array.isArray(s)?s:null,l=typeof t.tagName=="string"?t.tagName.toLowerCase():"",a=!!(l&&o),f=n||!!(a&&o&&fn(o));if(i!==void 0&&f&&this.blockedIds.add(i),a&&o&&f){let d=typeof o.style=="string"?o.style:"",p=o.width??o.rr_width??cn(d,"width")??120,m=o.height??o.rr_height??cn(d,"height")??40;t.childNodes=[];let c={"data-askdepth-block":"",width:p,height:m,rr_width:String(p),rr_height:String(m)};t.attributes=c;return}let u=!!(o&&dn(o)),h=r||u||!!(o&&hn(o));if(i!==void 0&&h&&this.maskedIds.add(i),o&&(t.attributes=pn(o,h)),typeof t.textContent=="string"&&(t.textContent=h?be(t.textContent):Le(t.textContent)),!l&&typeof t.id=="number"&&typeof t.value=="string"&&(t.value=h?be(t.value):Le(t.value)),t.source===5&&typeof t.text=="string"&&(t.text=h?be(t.text):_e(t.text)),Array.isArray(t.childNodes))for(let d of t.childNodes)d&&typeof d=="object"&&this.sanitizeNode(d,h,f);for(let d of ["adds","texts","attributes","removes","node"]){let p=t[d];if(Array.isArray(p))for(let m of p)m&&typeof m=="object"&&this.sanitizeNode(m,h,f);else p&&typeof p=="object"&&this.sanitizeNode(p,h,f);}}};function Qt(){return new Ze}var hs=new Ze;function ds(e){return hs.sanitize(e)}function er(e){let t=Pe(e.userAgent??"")<3145728;return {emit:e.emit,checkoutEveryNms:e.checkoutEveryNms??45e3,inlineStylesheet:true,collectFonts:false,inlineImages:false,recordCanvas:false,maskAllInputs:true,maskInputFn:r=>_e(r),maskTextFn:r=>r?r.replace(/[^\s]/g,"*"):"",maskTextSelector:e.maskTextSelector??'[data-askdepth-mask], .askdepth-mask, [contenteditable]:not([contenteditable="false"])',maskTextClass:"askdepth-mask",blockSelector:"[data-askdepth-block], [data-rr-block], .askdepth-block, .rr-block",blockClass:"askdepth-block",sampling:{mousemove:t?false:50,mouseInteraction:{MouseUp:false,MouseDown:true,Click:true,ContextMenu:true,DblClick:false,Focus:false,Blur:false,TouchStart:true,TouchEnd:false,TouchCancel:false},scroll:150,input:"last"}}}function tr(e){if(!e.data||typeof e.data!="object")return null;let t=e.data.source;return typeof t=="number"?t:null}function gn(e){let t=tr(e);return t===et||t===tt}function ps(e){return tr(e)===sr}function vn(e){return e.type===ue||e.type!==Je?false:tr(e)===Qe}var Xe=class{windowMs;maxBytes;now;onPressure;items=[];bytes=0;baseline=null;constructor(t){this.windowMs=t?.windowMs??45e3,this.maxBytes=t?.maxBytes??3145728,this.now=t?.now??(()=>Date.now()),this.onPressure=t?.onPressure;}get byteLength(){return this.bytes}clear(){this.items=[],this.bytes=0,this.baseline=null;}push(t){let r={event:t,bytes:rt(t)};t.type===ue?(this.baseline=t,this.items=this.items.filter(n=>n.event.timestamp>=t.timestamp&&n.event.type!==ue),this.items.unshift(r),this.recount()):(this.items.push(r),this.bytes+=r.bytes),this.evict();}evict(){let t=this.now()-this.windowMs,r=this.baseline?.timestamp;this.items=this.items.filter(n=>n.event.type===ue&&n.event===this.baseline?true:r!==void 0&&n.event.timestamp<r?false:r!==void 0&&vn(n.event)?true:n.event.timestamp>=t),this.recount(),this.evictByMemory();}dropPointerSamples(){let t=this.items.filter(r=>!gn(r.event));t.length!==this.items.length&&(this.items=t,this.recount());}toArray(){return this.items.map(t=>t.event)}slice(t){let r=t-this.windowMs,n=this.baseline&&this.baseline.timestamp<=t?this.baseline:null,i=this.items.map(s=>s.event).filter(s=>n&&s===n||n&&s.timestamp<n.timestamp||s.timestamp>t?false:n&&vn(s)?true:s.timestamp>=r);return n?[n,...i]:i}evictByMemory(){for(;this.bytes>this.maxBytes;){let t=this.items.findIndex(i=>gn(i.event));if(t>=0){this.removeAt(t);continue}let r=this.items.reduce((i,s,o)=>(ps(s.event)&&i.push(o),i),[]),n=r.length>1?r[0]:void 0;if(n!==void 0){this.removeAt(n);continue}this.onPressure&&this.onPressure();break}}removeAt(t){let r=this.items.splice(t,1)[0];r&&(this.bytes-=r.bytes,this.bytes<0&&(this.bytes=0));}recount(){this.bytes=0;for(let t of this.items)this.bytes+=t.bytes;}};var ys=1e4,rr=2,wt=class extends Error{};async function bn(e,t,r,n=fetch){if(!r)throw new Error("Replay upload requires a write key");let i=typeof t.payload=="string"?new TextEncoder().encode(t.payload):t.payload;if(i.byteLength>Ue)throw new Error("Replay chunk exceeds 45 KiB");let s={"content-type":"application/octet-stream","x-askdepth-protocol-version":protocolVersion.PROTOCOL_VERSION,"x-askdepth-write-key":r,"x-askdepth-session-id":t.manifest.session_id,"x-askdepth-slice-id":t.manifest.slice_id,"x-askdepth-chunk-index":String(t.part_index),"x-askdepth-total-chunks":String(t.total_parts)},o=0;for(;o<=rr;){let l=typeof AbortController<"u"?new AbortController:null,a=l?setTimeout(()=>l.abort(),ys):null;try{let f=await n(e,{method:"POST",keepalive:!0,headers:s,body:i,...l?{signal:l.signal}:{}});if(a&&clearTimeout(a),f.ok)return;if(f.status<500)throw new wt(`Replay upload rejected with status ${f.status}`);if(o===rr)throw new Error(`Upload failed with status ${f.status}`);await new Promise(u=>setTimeout(u,150*Math.pow(2,o)));}catch(f){if(a&&clearTimeout(a),f instanceof wt||o===rr)throw f;await new Promise(u=>setTimeout(u,150*Math.pow(2,o)));}o+=1;}}var gs=500,vs=1e3;function bs(){return typeof performance<"u"?performance.now():Date.now()}function Ss(e){typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):queueMicrotask(e);}function ws(){let e=typeof navigator<"u"?navigator:void 0;if(e&&typeof e.deviceMemory=="number"&&e.deviceMemory<=1)return true;let t=performance.memory;return !t||t.jsHeapSizeLimit<=0?false:t.usedJSHeapSize/t.jsHeapSizeLimit>.85}function Cs(e){let t=e.now??(()=>Date.now()),r=e.clock??bs,n=e.schedule??Ss,i=e.fetchImpl??fetch,s=e.compress??(A=>Lt(A)),o=e.memoryPressure??ws,l=e.userAgent??(typeof navigator<"u"?navigator.userAgent:""),a=e.windowMs??45e3,f=null,u=new Xe({windowMs:a,maxBytes:e.maxBytes??Pe(l),now:t,onPressure:()=>f?.checkpoint()}),h=Qt(),d=[],p=false,m=false,c=null,v=null,C=null,b=0,y=[],M=0,I=()=>{let A=r(),T=0;for(;d.length>0;){if(T>0&&r()-A>=Rt){x();return}let S=d.shift();S&&u.push(S),T+=1,o()&&u.dropPointerSamples();}},x=()=>{p||(p=true,n(()=>{p=false,I();}));},k=A=>{let T=h.sanitize(A);if(T.type===ue){u.push(T);return}if(d.length>=gs){let S=d.filter(L=>{if(L.type===ue||L.type===Je&&L.data?.source===Qe)return true;let V=L.data?.source;return V!==et&&V!==tt});d.length=0,d.push(...S);}d.push(T),x();},E=()=>{for(p=false;d.length>0;){let A=d.shift();A&&u.push(A);}},R=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&(E(),u.dropPointerSamples());};return {start(){if(!m){if(m=true,typeof document<"u"&&(document.addEventListener("visibilitychange",R),c=()=>document.removeEventListener("visibilitychange",R)),e.recorder){f=e.recorder(k);return}B();}},stop(){m=false,E(),u.clear(),h.clear(),C=null,y=[],f?.stop(),f=null,c?.(),c=null,v?.(),v=null;},push(A){k(A);},dump(){return u.slice(t())},async flash(A,T){let S=T??t();return C||(S-b<vs&&y.length>0?y:(C=(async()=>{try{E();let L=u.slice(S).filter(K=>K.timestamp<=S),V=u.baseline,N=L.filter(K=>K.type!==ue)[0],q=N?.timestamp??V?.timestamp??S,Y=Math.min(a,Math.max(0,S-(N?N.timestamp:S)));if(L.length===0)return [];M+=1;let ye=crypto.randomUUID(),J=JSON.stringify(L),he=Et(J),Q=await s(he);if(Q.bytes.byteLength>ir)return [];let X=ar(Q.bytes,Ue);if(X.length>nr)return [];let j=X.map((K,le)=>{let re=new Uint8Array(new ArrayBuffer(K.byteLength));return re.set(K),{manifest:{slice_id:ye,triggering_anomaly_id:A,session_id:e.sessionId,environment:e.environment,start_timestamp:q,trigger_timestamp:S,duration_ms:Y,has_baseline_snapshot:!!V||L.some(Se=>Se.type===ue),events_count:L.length,uncompressed_byte_size:rt(L),compressed_byte_size:Q.bytes.byteLength,compression_algorithm:Q.algorithm,sequence_number:M},payload:re,part_index:le,total_parts:X.length}});for(let K of j)try{await bn(e.endpoint,K,e.writeKey,i);}catch{console.warn("[Askdepth] Failed to upload replay slice");break}return b=S,y=j,j}finally{C=null;}})(),C))}};function B(){if(typeof window>"u"||typeof document>"u"||!m)return;let A=er({emit:(L,V)=>{if(V&&L.type!==ue){k({...L,type:ue});return}k(L);},...e.checkoutEveryNms!==void 0?{checkoutEveryNms:e.checkoutEveryNms}:{checkoutEveryNms:45e3},userAgent:l}),T=Ee(A),S=()=>{Ee.takeFullSnapshot(true);};f={stop:()=>T?.(),checkpoint:S},v=Ms(S);}}function Ms(e){if(typeof window>"u"||typeof history>"u")return ()=>{};let t=history.pushState,r=history.replaceState,n=0,i=()=>{let a=Date.now();a-n<1e3||(n=a,e());},s=(...a)=>{t.apply(history,a),i();},o=(...a)=>{r.apply(history,a),i();};history.pushState=s,history.replaceState=o;let l=()=>i();return window.addEventListener("popstate",l),window.addEventListener("hashchange",l),()=>{history.pushState===s&&(history.pushState=t),history.replaceState===o&&(history.replaceState=r),window.removeEventListener("popstate",l),window.removeEventListener("hashchange",l);}}
|
|
79
|
+
exports.CHECKOUT_EVERY_MS=Ke;exports.CHUNK_BYTES=Ue;exports.DESKTOP_MAX_BYTES=Mt;exports.EventSanitizer=Ze;exports.FRAME_BUDGET_MS=Rt;exports.MOBILE_MAX_BYTES=Sn;exports.REPLAY_WINDOW_MS=ze;exports.RingBuffer=Xe;exports.compressBytes=Lt;exports.createEventSanitizer=Qt;exports.createRecordOptions=er;exports.createReplayEngine=Cs;exports.maskInputValue=_e;exports.maskText=Le;exports.maxBufferBytes=Pe;exports.sanitizeEvent=ds;//# sourceMappingURL=index.cjs.map
|
|
80
80
|
//# sourceMappingURL=index.cjs.map
|