@lensmcp/client-runtime 1.25.16 → 1.25.18

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.
@@ -0,0 +1,100 @@
1
+ "use strict";var Ws=Object.defineProperty;var c=(e,t)=>Ws(e,"name",{value:t,configurable:!0});var Us=Object.defineProperty,u=c((e,t)=>Us(e,"name",{value:t,configurable:!0}),"u"),Fs=Object.defineProperty,o=u((e,t)=>Fs(e,"name",{value:t,configurable:!0}),"o");/*! @lensmcp/client-runtime session replay recorder.
2
+ Third-party code in this bundle, each under the MIT License:
3
+
4
+ @rrweb/record, rrweb, rrweb-snapshot, @rrweb/utils, @rrweb/types 2.1.7 (https://github.com/rrweb-io/rrweb)
5
+ Copyright (c) 2018 Contributors (https://github.com/rrweb-io/rrweb/graphs/contributors)
6
+ mitt (https://github.com/developit/mitt)
7
+ Copyright (c) 2021 Jason Miller
8
+ base64-arraybuffer (https://github.com/niklasvh/base64-arraybuffer)
9
+ Copyright (c) 2012 Niklas von Hertzen
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
12
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
13
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
14
+ persons to whom the Software is furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
17
+ Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */var _r=Object.defineProperty,xr=o((e,t,r)=>t in e?_r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"xr"),g=o((e,t,r)=>xr(e,typeof t!="symbol"?t+"":t,r),"g"),Mt,M=(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))(M||{}),I=(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))(I||{}),z=(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))(z||{}),K=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(K||{}),pe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(pe||{}),le=(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))(le||{}),D=(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))(D||{}),Et={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},kt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ee={},Wt={},Lr=o(()=>!!globalThis.Zone,"Lr");function ut(e){if(Ee[e])return Ee[e];let t=globalThis[e],r=t.prototype,n=e in Et?Et[e]:void 0,s=!!(n&&n.every(d=>{var a,f;return!!((f=(a=Object.getOwnPropertyDescriptor(r,d))==null?void 0:a.get)!=null&&f.toString().includes("[native code]"))})),i=e in kt?kt[e]:void 0,l=!!(i&&i.every(d=>{var a;return typeof r[d]=="function"&&((a=r[d])==null?void 0:a.toString().includes("[native code]"))}));if(s&&l&&!Lr())return Ee[e]=t.prototype,t.prototype;try{let d=document.createElement("iframe");d.style.display="none",document.body.appendChild(d);let a=d.contentWindow;if(!a)return t.prototype;let f=a[e].prototype;if(!f)return d.remove(),r;let y=navigator.userAgent;return y.includes("Safari")&&!y.includes("Chrome")?(d.classList.add("rr-block"),d.setAttribute("__rrwebUntaintedMutationObserver",""),Wt[e]=()=>d.remove()):d.remove(),Ee[e]=f}catch{return r}}c(ut,"ut"),u(ut,"ut"),o(ut,"ut");var Xe={};function H(e,t,r){var n,s;let i=(n=Xe[e])==null?void 0:n[r];if(i)return i.call(t);let l=ut(e),d=(s=Object.getOwnPropertyDescriptor(l,r))==null?void 0:s.get;return d?((Xe[e]||(Xe[e]={}))[r]=d,d.call(t)):t[r]}c(H,"H"),u(H,"H"),o(H,"H");var Je={};function zt(e,t,r){let n=`${e}.${String(r)}`;if(Je[n])return Je[n].bind(t);let s=ut(e)[r];return typeof s!="function"?t[r]:(Je[n]=s,s.bind(t))}c(zt,"zt"),u(zt,"zt"),o(zt,"zt");function Dr(e){return H("Node",e,"ownerDocument")}c(Dr,"Dr"),u(Dr,"Dr"),o(Dr,"Dr");function Pr(e){return H("Node",e,"childNodes")}c(Pr,"Pr"),u(Pr,"Pr"),o(Pr,"Pr");function Fr(e){return H("Node",e,"parentNode")}c(Fr,"Fr"),u(Fr,"Fr"),o(Fr,"Fr");function Ur(e){return H("Node",e,"parentElement")}c(Ur,"Ur"),u(Ur,"Ur"),o(Ur,"Ur");function Wr(e){return H("Node",e,"textContent")}c(Wr,"Wr"),u(Wr,"Wr"),o(Wr,"Wr");function zr(e){return H("Node",e,"firstChild")}c(zr,"zr"),u(zr,"zr"),o(zr,"zr");function Br(e){return H("Node",e,"lastChild")}c(Br,"Br"),u(Br,"Br"),o(Br,"Br");function Hr(e){return H("Node",e,"nextSibling")}c(Hr,"Hr"),u(Hr,"Hr"),o(Hr,"Hr");function $r(e){return H("Node",e,"previousSibling")}c($r,"$r"),u($r,"$r"),o($r,"$r");function jr(e,t){return zt("Node",e,"contains")(t)}c(jr,"jr"),u(jr,"jr"),o(jr,"jr");function Gr(e){return zt("Node",e,"getRootNode")()}c(Gr,"Gr"),u(Gr,"Gr"),o(Gr,"Gr");function Vr(e){return!e||!("host"in e)?null:H("ShadowRoot",e,"host")}c(Vr,"Vr"),u(Vr,"Vr"),o(Vr,"Vr");function qr(e){return e.styleSheets}c(qr,"qr"),u(qr,"qr"),o(qr,"qr");function Xr(e){return!e||!("shadowRoot"in e)?null:H("Element",e,"shadowRoot")}c(Xr,"Xr"),u(Xr,"Xr"),o(Xr,"Xr");function Jr(e,t){return H("Element",e,"querySelector")(t)}c(Jr,"Jr"),u(Jr,"Jr"),o(Jr,"Jr");function Yr(e,t){return H("Element",e,"querySelectorAll")(t)}c(Yr,"Yr"),u(Yr,"Yr"),o(Yr,"Yr");function Bt(){return[ut("MutationObserver").constructor,Wt.MutationObserver??(()=>{})]}c(Bt,"Bt"),u(Bt,"Bt"),o(Bt,"Bt");var ve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ve=o(()=>new Date().getTime(),"ve"));function oe(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}c(oe,"oe"),u(oe,"oe"),o(oe,"oe");var S={ownerDocument:Dr,childNodes:Pr,parentNode:Fr,parentElement:Ur,textContent:Wr,firstChild:zr,lastChild:Br,nextSibling:Hr,previousSibling:$r,contains:jr,getRootNode:Gr,host:Vr,styleSheets:qr,shadowRoot:Xr,querySelector:Jr,querySelectorAll:Yr,nowTimestamp:ve,mutationObserverCtor:Bt,patch:oe};function Ht(e){return e.nodeType===e.ELEMENT_NODE}c(Ht,"Ht"),u(Ht,"Ht"),o(Ht,"Ht");function be(e){let t=e&&"host"in e&&"mode"in e&&S.host(e)||null;return!!(t&&"shadowRoot"in t&&S.shadowRoot(t)===e)}c(be,"be"),u(be,"be"),o(be,"be");function Se(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}c(Se,"Se"),u(Se,"Se"),o(Se,"Se");function Zr(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}c(Zr,"Zr"),u(Zr,"Zr"),o(Zr,"Zr");function Qr(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(" ")+";"}c(Qr,"Qr"),u(Qr,"Qr"),o(Qr,"Qr");function Qe(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,s=>$t(s,r)).join("");return Zr(n)}catch{return null}}c(Qe,"Qe"),u(Qe,"Qe"),o(Qe,"Qe");function $t(e,t){if(en(e)){let r;try{r=Qe(e.styleSheet)||Qr(e)}catch{r=e.cssText}return e.styleSheet.href?De(r,e.styleSheet.href):r}else{let r=e.cssText;return tn(e)&&e.selectorText.includes(":")&&(r=Kr(r)),t?De(r,t):r}}c($t,"$t"),u($t,"$t"),o($t,"$t");function Kr(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}c(Kr,"Kr"),u(Kr,"Kr"),o(Kr,"Kr");function en(e){return"styleSheet"in e}c(en,"en"),u(en,"en"),o(en,"en");function tn(e){return"selectorText"in e}c(tn,"tn"),u(tn,"tn"),o(tn,"tn");var _e=class{static{c(this,"_e")}static{u(this,"_e")}static{o(this,"_e")}constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function rn(){return new _e}c(rn,"rn"),u(rn,"rn"),o(rn,"rn");function xe({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:i}){let l=s||"",d=n&&te(n);return(t[r.toLowerCase()]||d&&t[d])&&(i?l=i(l,e):l="*".repeat(l.length)),l}c(xe,"xe"),u(xe,"xe"),o(xe,"xe");function te(e){return e.toLowerCase()}c(te,"te"),u(te,"te"),o(te,"te");var Tt="__rrweb_original__";function nn(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let i=t.getImageData,l=Tt in i?i[Tt]:i;if(new Uint32Array(l.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(d=>d!==0))return!1}return!0}c(nn,"nn"),u(nn,"nn"),o(nn,"nn");function Le(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?te(t):null}c(Le,"Le"),u(Le,"Le"),o(Le,"Le");function jt(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i;return r.pathname.match(n)?.[1]??null}c(jt,"jt"),u(jt,"jt"),o(jt,"jt");function sn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}c(sn,"sn"),u(sn,"sn"),o(sn,"sn");var on=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,an=/^(?:[a-z+]+:)?\/\//i,ln=/^www\..*/i,cn=/^(data:)([^,]*),(.*)/i;function De(e,t){return(e||"").replace(on,(r,n,s,i,l,d)=>{let a=s||l||d,f=n||i||"";if(!a)return r;if(an.test(a)||ln.test(a))return`url(${f}${a}${f})`;if(cn.test(a))return`url(${f}${a}${f})`;if(a[0]==="/")return`url(${f}${sn(t)+a}${f})`;let y=a.split("#")[0],h=a.substring(y.length),v=t.split("#")[0].split("/"),b=y.split("/");v.pop();for(let p of b)p!=="."&&(p===".."?v.pop():v.push(p));return`url(${f}${v.join("/")}${h}${f})`})}c(De,"De"),u(De,"De"),o(De,"De");var Gt="(?:/\\*[^*]*\\*/)|[\\s;]",un=new RegExp(`${Gt}|\\b(0)px?`,"g"),dn=new RegExp(Gt,"g");function ke(e,t=!1){return t?e.replace(dn,""):e.replace(un,"$1")}c(ke,"ke"),u(ke,"ke"),o(ke,"ke");function hn(e,t,r=!1){let n=Array.from(t.childNodes),s=[],i=0;if(n.length>1&&e&&typeof e=="string"){let l=ke(e,r),d=l.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let f=ke(n[a].textContent,r),y=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 v=f.substring(0,h),b=l.split(v),p=-1;if(b.length===2)p=b[0].length;else if(b.length>2&&b[0]===""&&n[a-1].textContent!=="")p=l.indexOf(v,1);else if(b.length===1){if(v=v.substring(0,v.length-1),b=l.split(v),b.length<=1)return s.push(e),s;h=y+1}else h===f.length-1&&(p=l.indexOf(v));if(b.length>=2&&h>y){let m=n[a-1].textContent;if(m&&typeof m=="string"){let w=ke(m).length;p=l.indexOf(v,w)}p===-1&&(p=b[0].length)}if(p!==-1){let m=Math.floor(p/d);for(;m>0&&m<e.length;){if(i+=1,i>50*n.length)return s.push(e),s;let w=ke(e.substring(0,m),r);if(w.length===p){s.push(e.substring(0,m)),e=e.substring(m),l=l.substring(p);break}else w.length<p?m+=Math.max(1,Math.floor((p-w.length)/d)):m-=Math.max(1,Math.floor((w.length-p)*d))}break}}}}return s.push(e),s}c(hn,"hn"),u(hn,"hn"),o(hn,"hn");function pn(e,t){return hn(e,t).join("/* rr_split */")}c(pn,"pn"),u(pn,"pn"),o(pn,"pn");var fn=1,mn=new RegExp("[^a-z0-9-_:]"),Pe=-2;function Vt(){return fn++}c(Vt,"Vt"),u(Vt,"Vt"),o(Vt,"Vt");function gn(e){if(e instanceof HTMLFormElement)return"form";let t=te(e.tagName);return mn.test(t)?"div":t}c(gn,"gn"),u(gn,"gn"),o(gn,"gn");var ae,At,yn=/^[^ \t\n\r\u000c]+/,bn=/^[, \t\n\r\u000c]+/;function Sn(e,t){if(t.trim()==="")return t;let r=0;function n(i){let l,d=i.exec(t.substring(r));return d?(l=d[0],r+=l.length,l):""}c(n,"n"),u(n,"n"),o(n,"n");let s=[];for(;n(bn),!(r>=t.length);){let i=n(yn);if(i.slice(-1)===",")i=ue(e,i.substring(0,i.length-1)),s.push(i);else{let l="";i=ue(e,i);let d=!1;for(;;){let a=t.charAt(r);if(a===""){s.push((i+l).trim());break}else if(d)a===")"&&(d=!1);else if(a===","){r+=1,s.push((i+l).trim());break}else a==="("&&(d=!0);l+=a,r+=1}}}return s.join(", ")}c(Sn,"Sn"),u(Sn,"Sn"),o(Sn,"Sn");var Nt=new WeakMap;function ue(e,t){return!t||t.trim()===""?t:dt(e,t)}c(ue,"ue"),u(ue,"ue"),o(ue,"ue");function wn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}c(wn,"wn"),u(wn,"wn"),o(wn,"wn");function dt(e,t){let r=Nt.get(e);if(r||(r=e.createElement("a"),Nt.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}c(dt,"dt"),u(dt,"dt"),o(dt,"dt");function qt(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)?ue(e,n):r==="srcset"?Sn(e,n):r==="style"?De(n,dt(e)):t==="object"&&r==="data"?ue(e,n):n)}c(qt,"qt"),u(qt,"qt"),o(qt,"qt");function Xt(e,t,r){return["video","audio"].includes(e)&&te(t)==="autoplay"}c(Xt,"Xt"),u(Xt,"Xt"),o(Xt,"Xt");function vn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}c(vn,"vn"),u(vn,"vn"),o(vn,"vn");function Fe(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Fe(S.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}return r?Fe(S.parentNode(e),t,r):!1}c(Fe,"Fe"),u(Fe,"Fe"),o(Fe,"Fe");function Jt(e,t,r,n){let s;if(Ht(e)){if(s=e,!S.childNodes(s).length)return!1}else{if(S.parentElement(e)===null)return!1;s=S.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(Fe(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}c(Jt,"Jt"),u(Jt,"Jt"),o(Jt,"Jt");function Cn(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let d=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(d),s=!0,t()});return}let l="about:blank";if(n.location.href!==l||e.src===l||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}c(Cn,"Cn"),u(Cn,"Cn"),o(Cn,"Cn");function In(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let i=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}c(In,"In"),u(In,"In"),o(In,"In");function Rn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:l,inlineStylesheet:d,maskInputOptions:a={},maskTextFn:f,maskInputFn:y,dataURLOptions:h={},inlineImages:v,recordCanvas:b,keepIframeSrcFn:p,newlyAddedElement:m=!1,cssCaptured:w=!1}=t,T=Mn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:e.compatMode}:{type:D.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:D.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:T};case e.ELEMENT_NODE:return kn(e,{doc:r,blockClass:s,blockSelector:i,inlineStylesheet:d,maskInputOptions:a,maskInputFn:y,dataURLOptions:h,inlineImages:v,recordCanvas:b,keepIframeSrcFn:p,newlyAddedElement:m,rootId:T});case e.TEXT_NODE:return En(e,{doc:r,needsMask:l,maskTextFn:f,rootId:T,cssCaptured:w});case e.CDATA_SECTION_NODE:return{type:D.CDATA,textContent:"",rootId:T};case e.COMMENT_NODE:return{type:D.Comment,textContent:S.textContent(e)||"",rootId:T};default:return!1}}c(Rn,"Rn"),u(Rn,"Rn"),o(Rn,"Rn");function Mn(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}c(Mn,"Mn"),u(Mn,"Mn"),o(Mn,"Mn");function En(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:i}=t,l=S.parentNode(e),d=l&&l.tagName,a="",f=d==="STYLE"?!0:void 0,y=d==="SCRIPT"?!0:void 0;return y?a="SCRIPT_PLACEHOLDER":i||(a=S.textContent(e),f&&a&&(a=De(a,dt(t.doc)))),!f&&!y&&a&&r&&(a=n?n(a,S.parentElement(e)):a.replace(/[\S]/g,"*")),{type:D.Text,textContent:a||"",rootId:s}}c(En,"En"),u(En,"En"),o(En,"En");function kn(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:i,maskInputOptions:l={},maskInputFn:d,dataURLOptions:a={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:v=!1,rootId:b}=t,p=vn(e,n,s),m=gn(e),w={},T=e.attributes.length;for(let C=0;C<T;C++){let O=e.attributes[C];Xt(m,O.name,O.value)||(w[O.name]=qt(r,m,te(O.name),O.value))}if(m==="link"&&i){let C=Array.from(r.styleSheets).find($=>$.href===e.href),O=null;C&&(O=Qe(C)),O&&(delete w.rel,delete w.href,w._cssText=O)}if(m==="style"&&e.sheet){let C=Qe(e.sheet);C&&(e.childNodes.length>1&&(C=pn(C,e)),w._cssText=C)}if(["input","textarea","select"].includes(m)){let C=e.value,O=e.checked;w.type!=="radio"&&w.type!=="checkbox"&&w.type!=="submit"&&w.type!=="button"&&C?w.value=xe({element:e,type:Le(e),tagName:m,value:C,maskInputOptions:l,maskInputFn:d}):O&&(w.checked=O)}if(m==="option"&&(e.selected&&!l.select?w.selected=!0:delete w.selected),m==="dialog"&&e.open&&(w.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&y){if(e.__context==="2d")nn(e)||(w.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let C=e.toDataURL(a.type,a.quality),O=r.createElement("canvas");O.width=e.width,O.height=e.height;let $=O.toDataURL(a.type,a.quality);C!==$&&(w.rr_dataURL=C)}}if(m==="img"&&f){ae||(ae=r.createElement("canvas"),At=ae.getContext("2d"));let C=e,O=C.currentSrc||C.getAttribute("src")||"<unknown-src>",$=C.crossOrigin,F=o(()=>{C.removeEventListener("load",F);try{ae.width=C.naturalWidth,ae.height=C.naturalHeight,At.drawImage(C,0,0),w.rr_dataURL=ae.toDataURL(a.type,a.quality)}catch(j){if(C.crossOrigin!=="anonymous"){C.crossOrigin="anonymous",C.complete&&C.naturalWidth!==0?F():C.addEventListener("load",F);return}else console.warn(`Cannot inline img src=${O}! Error: ${j}`)}C.crossOrigin==="anonymous"&&($?w.crossOrigin=$:C.removeAttribute("crossorigin"))},"O");C.complete&&C.naturalWidth!==0?F():C.addEventListener("load",F)}if(["audio","video"].includes(m)){let C=w;C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime,C.rr_mediaPlaybackRate=e.playbackRate,C.rr_mediaMuted=e.muted,C.rr_mediaLoop=e.loop,C.rr_mediaVolume=e.volume}if(v||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop)),p){let{width:C,height:O}=e.getBoundingClientRect();w={class:w.class,rr_width:`${C}px`,rr_height:`${O}px`}}m==="iframe"&&!h(w.src)&&(e.contentDocument||(w.rr_src=w.src),delete w.src);let k;try{customElements.get(m)&&(k=!0)}catch{}return{type:D.Element,tagName:m,attributes:w,childNodes:[],isSVG:wn(e)||void 0,needBlock:p,rootId:b,isCustom:k}}c(kn,"kn"),u(kn,"kn"),o(kn,"kn");function A(e){return e==null?"":e.toLowerCase()}c(A,"A"),u(A,"A"),o(A,"A");function Yt(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}c(Yt,"Yt"),u(Yt,"Yt"),o(Yt,"Yt");function Tn(e,t){return!!(t.comment&&e.type===D.Comment||e.type===D.Element&&(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"&&jt(e.attributes.href)==="js")||t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(A(e.attributes.name).match(/^msapplication-tile(image|color)$/)||A(e.attributes.name)==="application-name"||A(e.attributes.rel)==="icon"||A(e.attributes.rel)==="apple-touch-icon"||A(e.attributes.rel)==="shortcut icon"))||e.tagName==="meta"&&(t.headMetaDescKeywords&&A(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(A(e.attributes.property).match(/^(og|twitter|fb):/)||A(e.attributes.name).match(/^(og|twitter):/)||A(e.attributes.name)==="pinterest")||t.headMetaRobots&&(A(e.attributes.name)==="robots"||A(e.attributes.name)==="googlebot"||A(e.attributes.name)==="bingbot")||t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0||t.headMetaAuthorship&&(A(e.attributes.name)==="author"||A(e.attributes.name)==="generator"||A(e.attributes.name)==="framework"||A(e.attributes.name)==="publisher"||A(e.attributes.name)==="progid"||A(e.attributes.property).match(/^article:/)||A(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(A(e.attributes.name)==="google-site-verification"||A(e.attributes.name)==="yandex-verification"||A(e.attributes.name)==="csrf-token"||A(e.attributes.name)==="p:domain_verify"||A(e.attributes.name)==="verify-v1"||A(e.attributes.name)==="verification"||A(e.attributes.name)==="shopify-checkout-api-token"))))}c(Tn,"Tn"),u(Tn,"Tn"),o(Tn,"Tn");function de(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,maskTextClass:l,maskTextSelector:d,skipChild:a=!1,inlineStylesheet:f=!0,maskInputOptions:y={},maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:w=!1,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C=5e3,onStylesheetLoad:O,stylesheetLoadTimeout:$=5e3,keepIframeSrcFn:F=o(()=>!1,"O"),newlyAddedElement:j=!1,cssCaptured:se=!1}=t,{needsMask:q}=t,{preserveWhiteSpace:Q=!0}=t;q||(q=Jt(e,l,d,q===void 0));let re=Rn(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,dataURLOptions:p,inlineImages:m,recordCanvas:w,keepIframeSrcFn:F,newlyAddedElement:j,cssCaptured:se});if(!re)return console.warn(e,"not serialized"),null;let ne;n.hasNode(e)?ne=n.getId(e):Tn(re,b)||!Q&&re.type===D.Text&&!re.textContent.replace(/^\s+|\s+$/gm,"").length?ne=Pe:ne=Vt();let E=Object.assign(re,{id:ne});if(n.add(e,E),ne===Pe)return null;T&&T(e);let Re=!a;if(E.type===D.Element){Re=Re&&!E.needBlock,delete E.needBlock;let B=S.shadowRoot(e);B&&Se(B)&&(E.isShadowHost=!0)}if((E.type===D.Document||E.type===D.Element)&&Re){b.headWhitespace&&E.type===D.Element&&E.tagName==="head"&&(Q=!1);let B={doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:d,skipChild:a,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p,inlineImages:m,recordCanvas:w,preserveWhiteSpace:Q,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:$,keepIframeSrcFn:F,cssCaptured:!1};if(!(E.type===D.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===D.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(B.cssCaptured=!0);for(let me of Array.from(S.childNodes(e))){let Z=de(me,B);Z&&E.childNodes.push(Z)}}let G=null;if(Ht(e)&&(G=S.shadowRoot(e)))for(let me of Array.from(S.childNodes(G))){let Z=de(me,B);Z&&(Se(G)&&(Z.isShadow=!0),E.childNodes.push(Z))}}let qe=S.parentNode(e);return qe&&be(qe)&&Se(qe)&&(E.isShadow=!0),E.type===D.Element&&E.tagName==="iframe"&&Cn(e,()=>{let B=e.contentDocument;if(B&&k){let G=de(B,{doc:B,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p,inlineImages:m,recordCanvas:w,preserveWhiteSpace:Q,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:$,keepIframeSrcFn:F});G&&k(e,G)}},C),E.type===D.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&jt(E.attributes.href)==="css")&&In(e,()=>{if(O){let B=de(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p,inlineImages:m,recordCanvas:w,preserveWhiteSpace:Q,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:$,keepIframeSrcFn:F});B&&O(e,B)}},$),E}c(de,"de"),u(de,"de"),o(de,"de");function An(e,t){let{mirror:r=new _e,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:i="rr-mask",maskTextSelector:l=null,inlineStylesheet:d=!0,inlineImages:a=!1,recordCanvas:f=!1,maskAllInputs:y=!1,maskTextFn:h,maskInputFn:v,slimDOM:b=!1,dataURLOptions:p,preserveWhiteSpace:m,onSerialize:w,onIframeLoad:T,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:O,keepIframeSrcFn:$=o(()=>!1,"N")}=t,F=y===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:y===!1?{password:!0}:y,j=Yt(b);return de(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:F,maskTextFn:h,maskInputFn:v,slimDOMOptions:j,dataURLOptions:p,inlineImages:a,recordCanvas:f,preserveWhiteSpace:m,onSerialize:w,onIframeLoad:T,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:O,keepIframeSrcFn:$,newlyAddedElement:!1})}c(An,"An"),u(An,"An"),o(An,"An");var Ke=class Ps{static{c(this,"Os")}static{u(this,"Or")}static{o(this,"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 Ps){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}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 U(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}c(U,"U"),u(U,"U"),o(U,"U");var ce=`Please stop import mirror directly. Instead of that,\r
24
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
25
+ or you can use record.mirror to access the mirror instance during recording.`,Ot={map:{},getId(){return console.error(ce),-1},getNode(){return console.error(ce),null},removeNodeFromMap(){console.error(ce)},has(){return console.error(ce),!1},reset(){console.error(ce)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ot=new Proxy(Ot,{get(e,t,r){return t==="map"&&console.error(ce),Reflect.get(e,t,r)}}));function Ce(e,t,r={}){let n=null,s=0;return function(...i){let l=Date.now();!s&&r.leading===!1&&(s=l);let d=t-(l-s),a=this;d<=0||d>t?(n&&(clearTimeout(n),n=null),s=l,e.apply(a,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(a,i)},d))}}c(Ce,"Ce"),u(Ce,"Ce"),o(Ce,"Ce");function Be(e,t,r,n,s=window){let i=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(l){setTimeout(()=>{r.set.call(this,l)},0),i&&i.set&&i.set.call(this,l)}}),()=>Be(e,t,i||{},!0)}c(Be,"Be"),u(Be,"Be"),o(Be,"Be");function Zt(e){var t,r,n,s;let i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i.documentElement.scrollLeft||i?.body&&((t=S.parentElement(i.body))==null?void 0:t.scrollLeft)||((r=i?.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:i?.documentElement.scrollTop||i?.body&&((n=S.parentElement(i.body))==null?void 0:n.scrollTop)||((s=i?.body)==null?void 0:s.scrollTop)||0}}c(Zt,"Zt"),u(Zt,"Zt"),o(Zt,"Zt");function Qt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}c(Qt,"Qt"),u(Qt,"Qt"),o(Qt,"Qt");function Kt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}c(Kt,"Kt"),u(Kt,"Kt"),o(Kt,"Kt");function er(e){return e?e.nodeType===e.ELEMENT_NODE?e:S.parentElement(e):null}c(er,"er"),u(er,"er"),o(er,"er");function W(e,t,r,n){if(!e)return!1;let s=er(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(Fe(s,t,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}c(W,"W"),u(W,"W"),o(W,"W");function Nn(e,t){return t.getId(e)!==-1}c(Nn,"Nn"),u(Nn,"Nn"),o(Nn,"Nn");function Ye(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Pe}c(Ye,"Ye"),u(Ye,"Ye"),o(Ye,"Ye");function tr(e,t){if(be(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=S.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?tr(n,t):!0}c(tr,"tr"),u(tr,"tr"),o(tr,"tr");function et(e){return!!e.changedTouches}c(et,"et"),u(et,"et"),o(et,"et");function On(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)}c(On,"On"),u(On,"On"),o(On,"On");function rr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}c(rr,"rr"),u(rr,"rr"),o(rr,"rr");function nr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}c(nr,"nr"),u(nr,"nr"),o(nr,"nr");function tt(e){return e?e instanceof Ke&&"shadowRoot"in e?!!e.shadowRoot:!!S.shadowRoot(e):!1}c(tt,"tt"),u(tt,"tt"),o(tt,"tt");var rt=class{static{c(this,"rt")}static{u(this,"rt")}static{o(this,"rt")}constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function sr(e){var t;let r=null;return"getRootNode"in e&&((t=S.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&S.host(S.getRootNode(e))&&(r=S.host(S.getRootNode(e))),r}c(sr,"sr"),u(sr,"sr"),o(sr,"sr");function _n(e){let t=e,r;for(;r=sr(t);)t=r;return t}c(_n,"_n"),u(_n,"_n"),o(_n,"_n");function xn(e){let t=S.ownerDocument(e);if(!t)return!1;let r=_n(e);return S.contains(t,r)}c(xn,"xn"),u(xn,"xn"),o(xn,"xn");function ir(e){let t=S.ownerDocument(e);return t?S.contains(t,e)||xn(e):!1}c(ir,"ir"),u(ir,"ir"),o(ir,"ir");var _t=o((e,t)=>`${e}@${t}`,"_t"),nt=class{static{c(this,"nt")}static{u(this,"nt")}static{o(this,"nt")}constructor(){g(this,"frozen",!1),g(this,"locked",!1),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",e=>{e.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let h of this.movedSet){let v=S.parentNode(h);this.removesSubTreeCache.has(v)&&!this.movedSet.has(v)||this.addedSet.add(h)}let r=null,n=null,s=-1,i=null,l=!1,d=new Set,a=this.addedSet.values(),f=a.next();for(;this.addedSet.size;){if(r!==null&&this.addedSet.has(S.previousSibling(r)))i=r,r=S.previousSibling(r);else{for(this.addedSet.has(f.value)||(f=a.next()),r=f.value;;){if(n=S.parentNode(r),this.addedSet.has(n)){r=n;continue}break}if(d.has(n))n=null;else if(n){if(ir(n)?(l=xt(this.droppedSet,n)||this.removesSubTreeCache.has(n),l&&xt(this.movedSet,r)&&(l=!1)):l=!0,this.addedSet.has(S.lastChild(n)))r=S.lastChild(n),i=null;else for(;;){if(i=S.nextSibling(r),this.addedSet.has(i)){r=i;continue}break}if(s=be(n)?this.mirror.getId(sr(r)):this.mirror.getId(n),s===-1&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let p=S.host(n);s=this.mirror.getId(p)}}}if(this.addedSet.delete(r),!n||s===-1){d.add(r);continue}else if(l){this.droppedSet.add(r);continue}let h=!1;if(r.nodeType===Node.TEXT_NODE){let p=n.tagName;if(p==="TEXTAREA")continue;p==="STYLE"&&t.has(s)&&(h=!0)}let v=i?this.mirror.getId(i):null;for(;v===Pe;)i=i&&S.nextSibling(i),v=i&&this.mirror.getId(i);if(v===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",i),r=null;continue}let b=de(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:o(p=>{rr(p,this.mirror)&&this.iframeManager.addIframe(p),nr(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),tt(r)&&this.shadowDomManager.addShadowRoot(S.shadowRoot(r),this.doc)},"onSerialize"),onIframeLoad:o((p,m)=>{this.iframeManager.attachIframe(p,m),this.shadowDomManager.observeAttachShadow(p)},"onIframeLoad"),onStylesheetLoad:o((p,m)=>{this.stylesheetManager.attachLinkElement(p,m)},"onStylesheetLoad"),cssCaptured:h});b&&(e.push({parentId:s,nextId:v,node:b}),t.add(b.id))}let y={texts:this.texts.map(h=>{let v=h.node,b=S.parentNode(v);return b&&b.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(b),{id:this.mirror.getId(v),value:h.value}}).filter(h=>!t.has(h.id)).filter(h=>this.mirror.has(h.id)),attributes:this.attributes.map(h=>{let{attributes:v}=h;if(typeof v.style=="string"){let b=JSON.stringify(h.styleDiff),p=JSON.stringify(h._unchangedStyles);b.length<v.style.length&&(b+p).split("var(").length===v.style.split("var(").length&&(v.style=h.styleDiff)}return{id:this.mirror.getId(h.node),attributes:v}}).filter(h=>!t.has(h.id)).filter(h=>this.mirror.has(h.id)),removes:this.removes,adds:e};!y.texts.length&&!y.attributes.length&&!y.removes.length&&!y.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(y))}),g(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(S.childNodes(e),n=>S.textContent(n)||"").join("");t.attributes.value=xe({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Le(e),value:r,maskInputFn:this.maskInputFn})}),g(this,"processMutation",e=>{if(!Ye(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=S.textContent(e.target);!W(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Jt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,er(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=te(t.tagName),n=e.attributeName,s=e.target.getAttribute(n);if(n==="value"){let l=Le(t);s=xe({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:l,value:s,maskInputFn:this.maskInputFn})}if(W(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let i=this.attributeMap.get(e.target);if(r==="iframe"&&n==="src"&&!this.keepIframeSrcFn(s))if(!t.contentDocument)n="rr_src";else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),n==="type"&&r==="input"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Xt(r,n))if(i.attributes[n]=qt(this.doc,r,te(n),s),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let l=this.unattachedDoc.createElement("span");e.oldValue&&l.setAttribute("style",e.oldValue);for(let d of Array.from(t.style)){let a=t.style.getPropertyValue(d),f=t.style.getPropertyPriority(d);a!==l.style.getPropertyValue(d)||f!==l.style.getPropertyPriority(d)?f===""?i.styleDiff[d]=a:i.styleDiff[d]=[a,f]:i._unchangedStyles[d]=[a,f]}for(let d of Array.from(l.style))t.style.getPropertyValue(d)===""&&(i.styleDiff[d]=!1)}else n==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(W(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),n=be(e.target)?this.mirror.getId(S.host(e.target)):this.mirror.getId(e.target);W(e.target,this.blockClass,this.blockSelector,!1)||Ye(t,this.mirror,this.slimDOMOptions)||!Nn(t,this.mirror)||(this.addedSet.has(t)?(st(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||tr(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[_t(r,n)]?st(this.movedSet,t):(this.removes.push({parentId:n,id:r,isShadow:be(e.target)&&Se(e.target)?!0:void 0}),Ln(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),g(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ye(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[_t(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);W(e,this.blockClass,this.blockSelector,!1)||(S.childNodes(e).forEach(r=>this.genAdds(r)),tt(e)&&S.childNodes(S.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function st(e,t){e.delete(t),S.childNodes(t).forEach(r=>st(e,r))}c(st,"st"),u(st,"st"),o(st,"st");function Ln(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),S.childNodes(n).forEach(s=>r.push(s)))}}c(Ln,"Ln"),u(Ln,"Ln"),o(Ln,"Ln");function xt(e,t){return e.size===0?!1:or(e,t)}c(xt,"xt"),u(xt,"xt"),o(xt,"xt");function or(e,t){if(e.has(t))return!0;let r=S.parentNode(t);return r?or(e,r):!1}c(or,"or"),u(or,"or"),o(or,"or");var we;function Dn(e){we=e}c(Dn,"Dn"),u(Dn,"Dn"),o(Dn,"Dn");function Pn(){we=void 0}c(Pn,"Pn"),u(Pn,"Pn"),o(Pn,"Pn");var R=o(e=>we?(...t)=>{try{return e(...t)}catch(r){if(we&&we(r)===!0)return;throw r}}:e,"R"),ie=[];function Ie(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}c(Ie,"Ie"),u(Ie,"Ie"),o(Ie,"Ie");function ar(e,t){let r=new nt;ie.push(r),r.init(e);let[n,s]=Bt(),i=new n(R(r.processMutations.bind(r)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[i,s]}c(ar,"ar"),u(ar,"ar"),o(ar,"ar");function Fn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,l=[],d,a=Ce(R(h=>{let v=Date.now()-d;e(l.map(b=>(b.timeOffset-=v,b)),h),l=[],d=null}),i),f=R(Ce(R(h=>{let v=Ie(h),{clientX:b,clientY:p}=et(h)?h.changedTouches[0]:h;d||(d=ve()),l.push({x:b,y:p,id:n.getId(v),timeOffset:ve()-d}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),s,{trailing:!1})),y=[U("mousemove",f,r),U("touchmove",f,r),U("drag",f,r)];return R(()=>{y.forEach(h=>h())})}c(Fn,"Fn"),u(Fn,"Fn"),o(Fn,"Fn");function Un({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let l=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,d=[],a=null,f=o(y=>h=>{let v=Ie(h);if(W(v,n,s,!0))return;let b=null,p=y;if("pointerType"in h){switch(h.pointerType){case"mouse":b=K.Mouse;break;case"touch":b=K.Touch;break;case"pen":b=K.Pen;break}b===K.Touch?z[y]===z.MouseDown?p="TouchStart":z[y]===z.MouseUp&&(p="TouchEnd"):K.Pen}else et(h)&&(b=K.Touch);b!==null?(a=b,(p.startsWith("Touch")&&b===K.Touch||p.startsWith("Mouse")&&b===K.Mouse)&&(b=null)):z[y]===z.Click&&(b=a,a=null);let m=et(h)?h.changedTouches[0]:h;if(!m)return;let w=r.getId(v),{clientX:T,clientY:k}=m;R(e)({type:z[p],id:w,x:T,y:k,...b!==null&&{pointerType:b}})},"u");return Object.keys(z).filter(y=>Number.isNaN(Number(y))&&!y.endsWith("_Departed")&&l[y]!==!1).forEach(y=>{let h=te(y),v=f(y);if(window.PointerEvent)switch(z[y]){case z.MouseDown:case z.MouseUp:h=h.replace("mouse","pointer");break;case z.TouchStart:case z.TouchEnd:return}d.push(U(h,v,t))}),R(()=>{d.forEach(y=>y())})}c(Un,"Un"),u(Un,"Un"),o(Un,"Un");function lr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:i}){let l=R(Ce(R(d=>{let a=Ie(d);if(!a||W(a,n,s,!0))return;let f=r.getId(a);if(a===t&&t.defaultView){let y=Zt(t.defaultView);e({id:f,x:y.left,y:y.top})}else e({id:f,x:a.scrollLeft,y:a.scrollTop})}),i.scroll||100));return U("scroll",l,t)}c(lr,"lr"),u(lr,"lr"),o(lr,"lr");function Wn({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=R(Ce(R(()=>{let i=Qt(),l=Kt();(r!==i||n!==l)&&(e({width:Number(l),height:Number(i)}),r=i,n=l)}),200));return U("resize",s,t)}c(Wn,"Wn"),u(Wn,"Wn"),o(Wn,"Wn");var zn=["INPUT","TEXTAREA","SELECT"],Lt=new WeakMap;function Bn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:i,ignoreSelector:l,maskInputOptions:d,maskInputFn:a,sampling:f,userTriggeredOnInput:y}){function h(T){let k=Ie(T),C=T.isTrusted,O=k&&k.tagName;if(k&&O==="OPTION"&&(k=S.parentElement(k)),!k||!O||zn.indexOf(O)<0||W(k,n,s,!0)||k.classList.contains(i)||l&&k.matches(l))return;let $=k.value,F=!1,j=Le(k)||"";j==="radio"||j==="checkbox"?F=k.checked:(d[O.toLowerCase()]||d[j])&&($=xe({element:k,maskInputOptions:d,tagName:O,type:j,value:$,maskInputFn:a})),v(k,y?{text:$,isChecked:F,userTriggered:C}:{text:$,isChecked:F});let se=k.name;j==="radio"&&se&&F&&t.querySelectorAll(`input[type="radio"][name="${se}"]`).forEach(q=>{if(q!==k){let Q=q.value;v(q,y?{text:Q,isChecked:!F,userTriggered:!1}:{text:Q,isChecked:!F})}})}c(h,"d"),u(h,"c"),o(h,"h");function v(T,k){let C=Lt.get(T);if(!C||C.text!==k.text||C.isChecked!==k.isChecked){Lt.set(T,k);let O=r.getId(T);R(e)({...k,id:O})}}c(v,"b"),u(v,"y"),o(v,"f");let b=(f.input==="last"?["change"]:["input","change"]).map(T=>U(T,R(h),t)),p=t.defaultView;if(!p)return()=>{b.forEach(T=>T())};let m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),w=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&b.push(...w.map(T=>Be(T[0],T[1],{set(){R(h)({target:this,isTrusted:!1})}},!1,p))),R(()=>{b.forEach(T=>T())})}c(Bn,"Bn"),u(Bn,"Bn"),o(Bn,"Bn");function Ue(e){let t=[];function r(n,s){if(Te("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Te("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Te("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Te("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let i=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(i),r(n.parentRule,s)}else if(n.parentStyleSheet){let i=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(i)}return s}return c(r,"r"),u(r,"r"),o(r,"r"),r(e,t)}c(Ue,"Ue"),u(Ue,"Ue"),o(Ue,"Ue");function ee(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}c(ee,"ee"),u(ee,"ee"),o(ee,"ee");function Hn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:R((y,h,v)=>{let[b,p]=v,{id:m,styleId:w}=ee(h,t,r.styleMirror);return(m&&m!==-1||w&&w!==-1)&&e({id:m,styleId:w,adds:[{rule:b,index:p}]}),y.apply(h,v)})}),n.CSSStyleSheet.prototype.addRule=function(y,h,v=this.cssRules.length){let b=`${y} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[b,v])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:R((y,h,v)=>{let[b]=v,{id:p,styleId:m}=ee(h,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,removes:[{index:b}]}),y.apply(h,v)})}),n.CSSStyleSheet.prototype.removeRule=function(y){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[y])};let l;n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:R((y,h,v)=>{let[b]=v,{id:p,styleId:m}=ee(h,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replace:b}),y.apply(h,v)})}));let d;n.CSSStyleSheet.prototype.replaceSync&&(d=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:R((y,h,v)=>{let[b]=v,{id:p,styleId:m}=ee(h,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replaceSync:b}),y.apply(h,v)})}));let a={};Ae("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(Ae("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),Ae("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),Ae("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(a).forEach(([y,h])=>{f[y]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(f[y].insertRule,{apply:R((v,b,p)=>{let[m,w]=p,{id:T,styleId:k}=ee(b.parentStyleSheet,t,r.styleMirror);return(T&&T!==-1||k&&k!==-1)&&e({id:T,styleId:k,adds:[{rule:m,index:[...Ue(b),w||0]}]}),v.apply(b,p)})}),h.prototype.deleteRule=new Proxy(f[y].deleteRule,{apply:R((v,b,p)=>{let[m]=p,{id:w,styleId:T}=ee(b.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||T&&T!==-1)&&e({id:w,styleId:T,removes:[{index:[...Ue(b),m]}]}),v.apply(b,p)})})}),R(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=i,l&&(n.CSSStyleSheet.prototype.replace=l),d&&(n.CSSStyleSheet.prototype.replaceSync=d),Object.entries(a).forEach(([y,h])=>{h.prototype.insertRule=f[y].insertRule,h.prototype.deleteRule=f[y].deleteRule})})}c(Hn,"Hn"),u(Hn,"Hn"),o(Hn,"Hn");function cr({mirror:e,stylesheetManager:t},r){var n,s,i;let l=null;r.nodeName==="#document"?l=e.getId(r):l=e.getId(S.host(r));let d=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:i.ShadowRoot,a=d?.prototype?Object.getOwnPropertyDescriptor(d?.prototype,"adoptedStyleSheets"):void 0;return l===null||l===-1||!d||!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 y;let h=(y=a.set)==null?void 0:y.call(this,f);if(l!==null&&l!==-1)try{t.adoptStyleSheets(f,l)}catch{}return h}}),R(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}c(cr,"cr"),u(cr,"cr"),o(cr,"cr");function $n({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:R((d,a,f)=>{var y;let[h,v,b]=f;if(r.has(h))return i.apply(a,[h,v,b]);let{id:p,styleId:m}=ee((y=a.parentRule)==null?void 0:y.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,set:{property:h,value:v,priority:b},index:Ue(a.parentRule)}),d.apply(a,f)})});let l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:R((d,a,f)=>{var y;let[h]=f;if(r.has(h))return l.apply(a,[h]);let{id:v,styleId:b}=ee((y=a.parentRule)==null?void 0:y.parentStyleSheet,t,n.styleMirror);return(v&&v!==-1||b&&b!==-1)&&e({id:v,styleId:b,remove:{property:h},index:Ue(a.parentRule)}),d.apply(a,f)})}),R(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=l})}c($n,"$n"),u($n,"$n"),o($n,"$n");function jn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:i}){let l=R(a=>Ce(R(f=>{let y=Ie(f);if(!y||W(y,t,r,!0))return;let{currentTime:h,volume:v,muted:b,playbackRate:p,loop:m}=y;e({type:a,id:n.getId(y),currentTime:h,volume:v,muted:b,playbackRate:p,loop:m})}),s.media||500)),d=[U("play",l(le.Play),i),U("pause",l(le.Pause),i),U("seeked",l(le.Seeked),i),U("volumechange",l(le.VolumeChange),i),U("ratechange",l(le.RateChange),i)];return R(()=>{d.forEach(a=>a())})}c(jn,"jn"),u(jn,"jn"),o(jn,"jn");function Gn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,i=r.FontFace;r.FontFace=function(d,a,f){let y=new i(d,a,f);return s.set(y,{family:d,buffer:typeof a!="string",descriptors:f,fontSource:typeof a=="string"?a:JSON.stringify(Array.from(new Uint8Array(a)))}),y};let l=oe(t.fonts,"add",function(d){return function(a){return setTimeout(R(()=>{let f=s.get(a);f&&(e(f),s.delete(a))}),0),d.apply(this,[a])}});return n.push(()=>{r.FontFace=i}),n.push(l),R(()=>{n.forEach(d=>d())})}c(Gn,"Gn"),u(Gn,"Gn"),o(Gn,"Gn");function Vn(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:i}=e,l=!0,d=R(()=>{let a=t.getSelection();if(!a||l&&a?.isCollapsed)return;l=a.isCollapsed||!1;let f=[],y=a.rangeCount||0;for(let h=0;h<y;h++){let v=a.getRangeAt(h),{startContainer:b,startOffset:p,endContainer:m,endOffset:w}=v;W(b,n,s,!0)||W(m,n,s,!0)||f.push({start:r.getId(b),startOffset:p,end:r.getId(m),endOffset:w})}i({ranges:f})});return d(),U("selectionchange",d)}c(Vn,"Vn"),u(Vn,"Vn"),o(Vn,"Vn");function qn({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:oe(r.customElements,"define",function(n){return function(s,i,l){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return n.apply(this,[s,i,l])}})}c(qn,"qn"),u(qn,"qn"),o(qn,"qn");function Xn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:i,viewportResizeCb:l,inputCb:d,mediaInteractionCb:a,styleSheetRuleCb:f,styleDeclarationCb:y,canvasMutationCb:h,fontCb:v,selectionCb:b,customElementCb:p}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),s(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),i(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),l(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),d(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),a(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),f(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),y(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),h(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),v(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),b(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),p(...m)}}c(Xn,"Xn"),u(Xn,"Xn"),o(Xn,"Xn");function Jn(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};Xn(e,t);let n,s=o(()=>{},"s");e.recordDOM&&([n,s]=ar(e,e.doc));let i=Fn(e),l=Un(e),d=lr(e),a=Wn(e,{win:r}),f=Bn(e),y=jn(e),h=o(()=>{},"h"),v=o(()=>{},"f"),b=o(()=>{},"p"),p=o(()=>{},"m");e.recordDOM&&(h=Hn(e,{win:r}),v=cr(e,e.doc),b=$n(e,{win:r}),e.collectFonts&&(p=Gn(e)));let m=Vn(e),w=qn(e),T=[];for(let k of e.plugins)T.push(k.observer(k.callback,r,k.options));return R(()=>{ie.forEach(k=>k.reset()),n?.disconnect(),s(),i(),l(),d(),a(),f(),y(),h(),v(),b(),p(),m(),w(),T.forEach(k=>k())})}c(Jn,"Jn"),u(Jn,"Jn"),o(Jn,"Jn");function Te(e){return typeof window[e]<"u"}c(Te,"Te"),u(Te,"Te"),o(Te,"Te");function Ae(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}c(Ae,"Ae"),u(Ae,"Ae"),o(Ae,"Ae");var We=class{static{c(this,"We")}static{u(this,"We")}static{o(this,"We")}constructor(e){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){let s=r||this.getIdToRemoteIdMap(e),i=n||this.getRemoteIdToIdMap(e),l=s.get(t);return l||(l=this.generateIdFn(),s.set(t,l),i.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(s=>this.getId(e,s,r,n))}getRemoteId(e,t,r){let n=r||this.getRemoteIdToIdMap(e);return typeof t!="number"?t:n.get(t)||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(n=>this.getRemoteId(e,n,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},it=class{static{c(this,"it")}static{u(this,"it")}static{o(this,"it")}constructor(e){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new We(Vt)),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=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new We(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(n=this.loadListener)==null||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let r=this.crossOriginIframeMap.get(e.source);if(!r)return;let n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case M.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:M.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case M.Meta:case M.Load:case M.DomContentLoaded:return!1;case M.Plugin:return t;case M.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case M.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(n=>{this.replaceIds(n,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,e);let s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(n.node,s)}),t.data.removes.forEach(n=>{this.replaceIds(n,e,["parentId","id"])}),t.data.attributes.forEach(n=>{this.replaceIds(n,e,["id"])}),t.data.texts.forEach(n=>{this.replaceIds(n,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(n=>{this.replaceIds(n,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(n=>{this.replaceIds(n,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(n=>{this.replaceStyleIds(n,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(let s of n)!Array.isArray(t[s])&&typeof t[s]!="number"||(Array.isArray(t[s])?t[s]=e.getIds(r,t[s]):t[s]=e.getId(r,t[s]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==D.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},ot=class{static{c(this,"ot")}static{u(this,"ot")}static{o(this,"ot")}constructor(e){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Se(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let[r]=ar({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(lr({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(S.host(e))),this.restoreHandlers.push(cr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(oe(e.prototype,"attachShadow",function(n){return function(s){let i=n.call(this,s),l=S.shadowRoot(this);return l&&ir(this)&&r.addShadowRoot(l,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ye=0;ye<he.length;ye++)Yn[he.charCodeAt(ye)]=ye;var ye,Zn=o(function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=he[t[r]>>2],s+=he[(t[r]&3)<<4|t[r+1]>>4],s+=he[(t[r+1]&15)<<2|t[r+2]>>6],s+=he[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},"Zn"),Dt=new Map;function Qn(e,t){let r=Dt.get(e);return r||(r=new Map,Dt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}c(Qn,"Qn"),u(Qn,"Qn"),o(Qn,"Qn");var ur=o((e,t,r)=>{if(!e||!(hr(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=Qn(r,n),i=s.indexOf(e);return i===-1&&(i=s.length,s.push(e)),i},"ur");function Ne(e,t,r){if(e instanceof Array)return e.map(n=>Ne(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,s=Zn(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Ne(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Ne(e.data,t,r),e.width,e.height]};if(hr(e,t)||typeof e=="object"){let n=e.constructor.name,s=ur(e,t,r);return{rr_type:n,index:s}}}}return e}c(Ne,"Ne"),u(Ne,"Ne"),o(Ne,"Ne");var dr=o((e,t,r)=>e.map(n=>Ne(n,t,r)),"dr"),hr=o((e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(r=>typeof t[r]=="function").find(r=>e instanceof t[r]),"hr");function Kn(e,t,r,n){let s=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let l of i)try{if(typeof t.CanvasRenderingContext2D.prototype[l]!="function")continue;let d=oe(t.CanvasRenderingContext2D.prototype,l,function(a){return function(...f){return W(this.canvas,r,n,!0)||setTimeout(()=>{let y=dr(f,t,this);e(this.canvas,{type:pe["2D"],property:l,args:y})},0),a.apply(this,f)}});s.push(d)}catch{let d=Be(t.CanvasRenderingContext2D.prototype,l,{set(a){e(this.canvas,{type:pe["2D"],property:l,args:[a],setter:!0})}});s.push(d)}return()=>{s.forEach(l=>l())}}c(Kn,"Kn"),u(Kn,"Kn"),o(Kn,"Kn");function es(e){return e==="experimental-webgl"?"webgl":e}c(es,"es"),u(es,"es"),o(es,"es");function Pt(e,t,r,n){let s=[];try{let i=oe(e.HTMLCanvasElement.prototype,"getContext",function(l){return function(d,...a){if(!W(this,t,r,!0)){let f=es(d);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(a[0]&&typeof a[0]=="object"){let y=a[0];y.preserveDrawingBuffer||(y.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return l.apply(this,[d,...a])}});s.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(i=>i())}}c(Pt,"Pt"),u(Pt,"Pt"),o(Pt,"Pt");function Ft(e,t,r,n,s,i){let l=[],d=Object.getOwnPropertyNames(e);for(let a of d)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let f=oe(e,a,function(y){return function(...h){let v=y.apply(this,h);if(ur(v,i,this),"tagName"in this.canvas&&!W(this.canvas,n,s,!0)){let b=dr(h,i,this),p={type:t,property:a,args:b};r(this.canvas,p)}return v}});l.push(f)}catch{let f=Be(e,a,{set(y){r(this.canvas,{type:t,property:a,args:[y],setter:!0})}});l.push(f)}return l}c(Ft,"Ft"),u(Ft,"Ft"),o(Ft,"Ft");function ts(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext<"u"&&s.push(...Ft(t.WebGLRenderingContext.prototype,pe.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...Ft(t.WebGL2RenderingContext.prototype,pe.WebGL2,e,r,n,t)),()=>{s.forEach(i=>i())}}c(ts,"ts"),u(ts,"ts"),o(ts,"ts");var pr=`(function() {
26
+ "use strict";
27
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
28
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
29
+ for (var i = 0; i < chars.length; i++) {
30
+ lookup[chars.charCodeAt(i)] = i;
31
+ }
32
+ var encode = function(arraybuffer) {
33
+ var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
34
+ for (i2 = 0; i2 < len; i2 += 3) {
35
+ base64 += chars[bytes[i2] >> 2];
36
+ base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
37
+ base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
38
+ base64 += chars[bytes[i2 + 2] & 63];
39
+ }
40
+ if (len % 3 === 2) {
41
+ base64 = base64.substring(0, base64.length - 1) + "=";
42
+ } else if (len % 3 === 1) {
43
+ base64 = base64.substring(0, base64.length - 2) + "==";
44
+ }
45
+ return base64;
46
+ };
47
+ const lastBlobMap = /* @__PURE__ */ new Map();
48
+ const transparentBlobMap = /* @__PURE__ */ new Map();
49
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
50
+ const id = \`\${width}-\${height}\`;
51
+ if ("OffscreenCanvas" in globalThis) {
52
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
53
+ const offscreen = new OffscreenCanvas(width, height);
54
+ offscreen.getContext("2d");
55
+ const blob = await offscreen.convertToBlob(dataURLOptions);
56
+ const arrayBuffer = await blob.arrayBuffer();
57
+ const base64 = encode(arrayBuffer);
58
+ transparentBlobMap.set(id, base64);
59
+ return base64;
60
+ } else {
61
+ return "";
62
+ }
63
+ }
64
+ const worker = self;
65
+ worker.onmessage = async function(e) {
66
+ if ("OffscreenCanvas" in globalThis) {
67
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
68
+ const transparentBase64 = getTransparentBlobFor(
69
+ width,
70
+ height,
71
+ dataURLOptions
72
+ );
73
+ const offscreen = new OffscreenCanvas(width, height);
74
+ const ctx = offscreen.getContext("2d");
75
+ ctx.drawImage(bitmap, 0, 0);
76
+ bitmap.close();
77
+ const blob = await offscreen.convertToBlob(dataURLOptions);
78
+ const type = blob.type;
79
+ const arrayBuffer = await blob.arrayBuffer();
80
+ const base64 = encode(arrayBuffer);
81
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
82
+ lastBlobMap.set(id, base64);
83
+ return worker.postMessage({ id });
84
+ }
85
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
86
+ worker.postMessage({
87
+ id,
88
+ type,
89
+ base64,
90
+ width,
91
+ height
92
+ });
93
+ lastBlobMap.set(id, base64);
94
+ } else {
95
+ return worker.postMessage({ id: e.data.id });
96
+ }
97
+ };
98
+ })();
99
+ //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
100
+ `,Ut=typeof self<"u"&&self.Blob&&new Blob([pr],{type:"text/javascript;charset=utf-8"});function rs(e){let t;try{if(t=Ut&&(self.URL||self.webkitURL).createObjectURL(Ut),!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(pr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}c(rs,"rs"),u(rs,"rs"),o(rs,"rs");var at=class{static{c(this,"at")}static{u(this,"at")}static{o(this,"at")}constructor(e){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(d,a)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(d)||this.pendingCanvasMutations.set(d,[]),this.pendingCanvasMutations.get(d).push(a)});let{sampling:t="all",win:r,blockClass:n,blockSelector:s,recordCanvas:i,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&t==="all"&&this.initCanvasMutationObserver(r,n,s),i&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,n,s,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,n,s){let i=Pt(t,r,n,!0),l=new Map,d=new rs;d.onmessage=b=>{let{id:p}=b.data;if(l.set(p,!1),!("base64"in b.data))return;let{base64:m,type:w,width:T,height:k}=b.data;this.mutationCb({id:p,type:pe["2D"],commands:[{property:"clearRect",args:[0,0,T,k]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:m}],type:w}]},0,0]}]})};let a=1e3/e,f=0,y,h=o(()=>{let b=[];return t.document.querySelectorAll("canvas").forEach(p=>{W(p,r,n,!0)||b.push(p)}),b},"f"),v=o(b=>{if(f&&b-f<a){y=requestAnimationFrame(v);return}f=b,h().forEach(async p=>{var m;let w=this.mirror.getId(p);if(l.get(w)||p.width===0||p.height===0)return;if(l.set(w,!0),["webgl","webgl2"].includes(p.__context)){let k=p.getContext(p.__context);((m=k?.getContextAttributes())==null?void 0:m.preserveDrawingBuffer)===!1&&k.clear(k.COLOR_BUFFER_BIT)}let T=await createImageBitmap(p);d.postMessage({id:w,bitmap:T,width:p.width,height:p.height,dataURLOptions:s.dataURLOptions},[T])}),y=requestAnimationFrame(v)},"p");y=requestAnimationFrame(v),this.resetObservers=()=>{i(),cancelAnimationFrame(y)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=Pt(e,t,r,!1),s=Kn(this.processMutation.bind(this),e,t,r),i=ts(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=o(t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)},"t");requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let n=r.map(i=>{let{type:l,...d}=i;return d}),{type:s}=r[0];this.mutationCb({id:t,type:s,commands:n}),this.pendingCanvasMutations.delete(e)}},lt=class{static{c(this,"lt")}static{u(this,"lt")}static{o(this,"lt")}constructor(e){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new rt),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},n=[];for(let s of e){let i;this.styleMirror.has(s)?i=this.styleMirror.getId(s):(i=this.styleMirror.add(s),n.push({styleId:i,rules:Array.from(s.rules||CSSRule,(l,d)=>({rule:$t(l,s.href),index:d}))})),r.styleIds.push(i)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},ct=class{static{c(this,"ct")}static{u(this,"ct")}static{o(this,"ct")}constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(n=>n!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},L,Oe,Ze,ze=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Mt=e.contentWindow)==null?void 0:Mt.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var X=rn();function fe(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:i=null,ignoreClass:l="rr-ignore",ignoreSelector:d=null,maskTextClass:a="rr-mask",maskTextSelector:f=null,inlineStylesheet:y=!0,maskAllInputs:h,maskInputOptions:v,slimDOMOptions:b,maskInputFn:p,maskTextFn:m,hooks:w,packFn:T,sampling:k={},dataURLOptions:C={},mousemoveWait:O,recordDOM:$=!0,recordCanvas:F=!1,recordCrossOriginIframes:j=!1,recordAfter:se=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:q=!1,collectFonts:Q=!1,inlineImages:re=!1,plugins:ne,keepIframeSrcFn:E=o(()=>!1,"E"),ignoreCSSAttributes:Re=new Set([]),errorHandler:qe}=e;Dn(qe);let B=j?window.parent===window:!0,G=!1;if(!B)try{window.parent.document&&(G=!1)}catch{G=!0}if(B&&!t)throw new Error("emit function is required");if(!B&&!G)return()=>{};O!==void 0&&k.mousemove===void 0&&(k.mousemove=O),X.reset();let me=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:v!==void 0?v:{password:!0},Z=Yt(b);On();let It,yt=0,Rt=o(x=>{for(let Y of ne||[])Y.eventProcessor&&(x=Y.eventProcessor(x));return T&&!G&&(x=T(x)),x},"Ct");L=o((x,Y)=>{var _;let P=x;if(P.timestamp=ve(),(_=ie[0])!=null&&_.isFrozen()&&P.type!==M.FullSnapshot&&!(P.type===M.IncrementalSnapshot&&P.data.source===I.Mutation)&&ie.forEach(V=>V.unfreeze()),B)t?.(Rt(P),Y);else if(G){let V={type:"rrweb",event:Rt(P),origin:window.location.origin,isCheckout:Y};window.parent.postMessage(V,"*")}if(P.type===M.FullSnapshot)It=P,yt=0;else if(P.type===M.IncrementalSnapshot){if(P.data.source===I.Mutation&&P.data.isAttachIframe)return;yt++;let V=n&&yt>=n,N=r&&P.timestamp-It.timestamp>r;(V||N)&&Oe(!0)}},"L");let Ve=o(x=>{L({type:M.IncrementalSnapshot,data:{source:I.Mutation,...x}})},"Re"),Or=o(x=>L({type:M.IncrementalSnapshot,data:{source:I.Scroll,...x}}),"It"),Os=o(x=>L({type:M.IncrementalSnapshot,data:{source:I.CanvasMutation,...x}}),"Rt"),$s=o(x=>L({type:M.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...x}}),"Or"),ge=new lt({mutationCb:Ve,adoptedStyleSheetCb:$s}),Me=new it({mirror:X,mutationCb:Ve,stylesheetManager:ge,recordCrossOriginIframes:j,wrappedEmit:L});for(let x of ne||[])x.getMirror&&x.getMirror({nodeMirror:X,crossOriginIframeMirror:Me.crossOriginIframeMirror,crossOriginIframeStyleMirror:Me.crossOriginIframeStyleMirror});let vt=new ct;Ze=new at({recordCanvas:F,mutationCb:Os,win:window,blockClass:s,blockSelector:i,mirror:X,sampling:k.canvas,dataURLOptions:C});let Ge=new ot({mutationCb:Ve,scrollCb:Or,bypassOptions:{blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:f,inlineStylesheet:y,maskInputOptions:me,dataURLOptions:C,maskTextFn:m,maskInputFn:p,recordCanvas:F,inlineImages:re,sampling:k,slimDOMOptions:Z,iframeManager:Me,stylesheetManager:ge,canvasManager:Ze,keepIframeSrcFn:E,processedNodeManager:vt},mirror:X});Oe=o((x=!1)=>{if(!$)return;L({type:M.Meta,data:{href:window.location.href,width:Kt(),height:Qt()}},x),ge.reset(),Ge.init(),ie.forEach(_=>_.lock());let Y=An(document,{mirror:X,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:f,inlineStylesheet:y,maskAllInputs:me,maskTextFn:m,maskInputFn:p,slimDOM:Z,dataURLOptions:C,recordCanvas:F,inlineImages:re,onSerialize:o(_=>{rr(_,X)&&Me.addIframe(_),nr(_,X)&&ge.trackLinkElement(_),tt(_)&&Ge.addShadowRoot(S.shadowRoot(_),document)},"onSerialize"),onIframeLoad:o((_,P)=>{Me.attachIframe(_,P),Ge.observeAttachShadow(_)},"onIframeLoad"),onStylesheetLoad:o((_,P)=>{ge.attachLinkElement(_,P)},"onStylesheetLoad"),keepIframeSrcFn:E});if(!Y)return console.warn("Failed to snapshot the document");L({type:M.FullSnapshot,data:{node:Y,initialOffset:Zt(window)}},x),ie.forEach(_=>_.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ge.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))},"Oe");try{let x=[],Y=o(P=>{var V;return R(Jn)({mutationCb:Ve,mousemoveCb:o((N,Ct)=>L({type:M.IncrementalSnapshot,data:{source:Ct,positions:N}}),"mousemoveCb"),mouseInteractionCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.MouseInteraction,...N}}),"mouseInteractionCb"),scrollCb:Or,viewportResizeCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.ViewportResize,...N}}),"viewportResizeCb"),inputCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.Input,...N}}),"inputCb"),mediaInteractionCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.MediaInteraction,...N}}),"mediaInteractionCb"),styleSheetRuleCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.StyleSheetRule,...N}}),"styleSheetRuleCb"),styleDeclarationCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.StyleDeclaration,...N}}),"styleDeclarationCb"),canvasMutationCb:Os,fontCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.Font,...N}}),"fontCb"),selectionCb:o(N=>{L({type:M.IncrementalSnapshot,data:{source:I.Selection,...N}})},"selectionCb"),customElementCb:o(N=>{L({type:M.IncrementalSnapshot,data:{source:I.CustomElement,...N}})},"customElementCb"),blockClass:s,ignoreClass:l,ignoreSelector:d,maskTextClass:a,maskTextSelector:f,maskInputOptions:me,inlineStylesheet:y,sampling:k,recordDOM:$,recordCanvas:F,inlineImages:re,userTriggeredOnInput:q,collectFonts:Q,doc:P,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:E,blockSelector:i,slimDOMOptions:Z,dataURLOptions:C,mirror:X,iframeManager:Me,stylesheetManager:ge,shadowDomManager:Ge,processedNodeManager:vt,canvasManager:Ze,ignoreCSSAttributes:Re,plugins:((V=ne?.filter(N=>N.observer))==null?void 0:V.map(N=>({observer:N.observer,options:N.options,callback:o(Ct=>L({type:M.Plugin,data:{plugin:N.name,payload:Ct}}),"callback")})))||[]},w)},"q");Me.addLoadListener(P=>{try{x.push(Y(P.contentDocument))}catch(V){console.warn(V)}});let _=o(()=>{Oe(),x.push(Y(document)),ze=!0},"_");return["interactive","complete"].includes(document.readyState)?_():(x.push(U("DOMContentLoaded",()=>{L({type:M.DomContentLoaded,data:{}}),se==="DOMContentLoaded"&&_()})),x.push(U("load",()=>{L({type:M.Load,data:{}}),se==="load"&&_()},window))),()=>{x.forEach(P=>{try{P()}catch(V){String(V).toLowerCase().includes("cross-origin")||console.warn(V)}}),vt.destroy(),ze=!1,Pn()}}catch(x){console.warn(x)}}c(fe,"fe"),u(fe,"fe"),o(fe,"fe"),fe.addCustomEvent=(e,t)=>{if(!ze)throw new Error("please add custom event after start recording");L({type:M.Custom,data:{tag:e,payload:t}})},fe.freezePage=()=>{ie.forEach(e=>e.freeze())},fe.takeFullSnapshot=e=>{if(!ze)throw new Error("please take full snapshot after start recording");Oe(e)},fe.mirror=X;var fr="REDACTED",ns=["token","secret","password","passwd","apikey","credential","assertion","signature"],ss=new Set(["key","auth","authorization","jwt","code","sig","pwd","pass","session","sid","bearer","otp","cookie","set-cookie"]),is=/^(?:(?:prompt|completion|total|input|output|cache|cached|cacheread|cachewrite|reasoning|thinking|max|min|remaining|used|billed)tokens|tokens?(?:count|used|limit|remaining))$/;function os(e){let t=ht.get(e);if(t!==void 0)return t;let r=ls(e);return e.length<=64&&ht.size<as&&ht.set(e,r),r}c(os,"os"),u(os,"os"),o(os,"os");var as=4096,ht=new Map;function ls(e){let t=e.toLowerCase();if(is.test(t.replace(/[-_.]+/g,"")))return!1;if(ns.some(r=>t.includes(r)))return!0;for(let r of t.split(/[-_.]+/))if(r&&ss.has(r))return!0;return!1}c(ls,"ls"),u(ls,"ls"),o(ls,"ls");var cs=/^([a-z][a-z0-9+.-]*:\/\/)[^/?#@\s]*@/i,us=/([?&#])([^=&#\s]+)=([^&#\s]*)/g;function ds(e){return e&&e.replace(cs,`$1${fr}@`).replace(us,(t,r,n)=>os(n)?`${r}${n}=${fr}`:t)}c(ds,"ds"),u(ds,"ds"),o(ds,"ds");function mr(e){return e&&hs(ds(e),1024)}c(mr,"mr"),u(mr,"mr"),o(mr,"mr");function hs(e,t){return e.length<=t?e:`${e.slice(0,t)}\u2026[lensmcp truncated: ${e.length-t} more chars]`}c(hs,"hs"),u(hs,"hs"),o(hs,"hs");var pt=String.raw`(?:"(?:[^"]|"")+"|[A-Za-z_][\w$]*)`,ft=String.raw`${pt}(?:\s*\.\s*${pt})*`,ps=String.raw`(?:=|<>|!=|<=|>=|<|>|(?:NOT\s+)?I?LIKE|IS\s+(?:NOT\s+)?DISTINCT\s+FROM)`,_s=new RegExp(String.raw`(${ft})\s*${ps}\s*(?:[A-Za-z_]\w*\s*\(\s*)?\$(\d+)`,"gi"),xs=new RegExp(String.raw`(${ft})\s+(?:NOT\s+)?IN\s*\(([^()]*)\)`,"gi"),Ls=new RegExp(String.raw`\bINSERT\s+INTO\s+${ft}\s*\(([^()]*)\)\s*VALUES\s*`,"gi"),Ds=new RegExp(pt,"g"),fs=["lens/session","lens/flow","lens/target","lens/request","lens/response","lens/visit","lens/nav","lens/hmr","lens/error","lens/gap"],ms=new Set(fs);function gs(e){return typeof e=="string"&&ms.has(e)}c(gs,"gs"),u(gs,"gs"),o(gs,"gs");var gr=512,ys=20,bs=3,Ss=new Set(["url","to","from"]);function yr(e,t){if(!(!gs(e)||!t||typeof t!="object"||Array.isArray(t)))return mt(t,0,void 0)}c(yr,"yr"),u(yr,"yr"),o(yr,"yr");function mt(e,t,r){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string"){let s=r&&Ss.has(r)?mr(e):e;return s.length>gr?`${s.slice(0,gr-1)}\u2026`:s}if(typeof e!="object"||t>=bs)return;if(Array.isArray(e))return e.slice(0,ys).map(s=>mt(s,t+1,void 0));let n={};for(let[s,i]of Object.entries(e)){let l=mt(i,t+1,s);l!==void 0&&(n[s]=l)}return n}c(mt,"mt"),u(mt,"mt"),o(mt,"mt");function br(e,t){return e==="lens/flow"&&typeof t.flowId=="string"?[`f:${t.flowId}`]:(e==="lens/request"||e==="lens/response")&&typeof t.requestId=="string"?[`r:${t.requestId}`]:e==="lens/visit"&&typeof t.visitId=="string"?[`v:${t.visitId}`]:[]}c(br,"br"),u(br,"br"),o(br,"br");var Sr="\0lens-blob:";async function wr(e,t){let r=await e.digest("SHA-256",new TextEncoder().encode(t)),n="";for(let s of new Uint8Array(r))n+=s.toString(16).padStart(2,"0");return n}c(wr,"wr"),u(wr,"wr"),o(wr,"wr");async function vr(e,t){let r=[],n=new Map,s,i=0;for(let a of e){let f=t.perf();if(!t.subtle||a.type!==2&&a.type!==3){r.push(JSON.stringify(a)),i+=t.perf()-f;continue}if(a.type===2&&t.isBase(a)){let v=a.data,b=JSON.stringify(v.node);i+=t.perf()-f;let p=await wr(t.subtle,b);f=t.perf(),n.set(p,b),s=p,r.push(gt(a,JSON.stringify({...v,node:Sr+p}))),i+=t.perf()-f;continue}let y=JSON.stringify(a.data);if(y.length<t.blobMinChars){r.push(gt(a,y)),i+=t.perf()-f;continue}i+=t.perf()-f;let h=await wr(t.subtle,y);f=t.perf(),n.set(h,y),r.push(gt(a,JSON.stringify(Sr+h))),i+=t.perf()-f}let l=t.perf(),d=`[${r.join(",")}]`;return i+=t.perf()-l,{json:d,blobs:n,...s?{base:s}:{},ms:i}}c(vr,"vr"),u(vr,"vr"),o(vr,"vr");function gt(e,t){let r=e.delay;return`{"type":${e.type},"data":${t},"timestamp":${e.timestamp}${r!==void 0?`,"delay":${r}`:""}}`}c(gt,"gt"),u(gt,"gt"),o(gt,"gt");var He=class{static{c(this,"He")}static{u(this,"He")}static{o(this,"He")}constructor(e,t,r="lensmcp:replay:blobs"){this.max=e,this.storage=t,this.key=r,this.set=new Set;try{let n=t?.getItem(r),s=n?JSON.parse(n):[];if(Array.isArray(s))for(let i of s.slice(-e))typeof i=="string"&&/^[0-9a-f]{64}$/.test(i)&&this.set.add(i)}catch{}}has(e){return this.set.has(e)}add(e){for(this.set.delete(e),this.set.add(e);this.set.size>this.max;)this.set.delete(this.set.values().next().value);this.save()}forget(e){this.set.delete(e)&&this.save()}save(){try{this.storage?.setItem(this.key,JSON.stringify([...this.set]))}catch{}}},ws="a,button,input,select,textarea,label,summary,option,[role],[data-testid],[onclick],[tabindex]",vs=o(e=>!!e&&typeof e.closest=="function"&&typeof e.getAttribute=="function"&&typeof e.tagName=="string","vs");function Cr(e,t,r){if(!vs(e))return;let n=e.closest(ws)??e,s=o(w=>n.getAttribute(w)??void 0,"s"),i=(n.textContent??"").replace(/\s+/g," ").trim(),l=n.closest("[data-agent-source]"),d=n.closest("[data-agent-component]"),a=-1;try{a=r(n)}catch{}let f={kind:t,id:a,tag:n.tagName.toLowerCase()},y=s("role");y&&(f.role=y),i&&(f.text=i.length>80?`${i.slice(0,79)}\u2026`:i);let h=s("aria-label")??s("title")??s("placeholder")??s("name")??s("alt");h&&(f.label=h);let v=s("data-testid")??s("data-test")??s("data-cy");v&&(f.testId=v);let b=n.tagName==="INPUT"?s("type"):void 0;b&&(f.inputType=b);let p=l?.getAttribute("data-agent-source");p&&(f.source=p);let m=d?.getAttribute("data-agent-component");return m&&(f.component=m),f}c(Cr,"Cr"),u(Cr,"Cr"),o(Cr,"Cr");var Ir="2.1.7",Rr={maskAllInputs:!1,blockSelector:"[data-lens-private]"},Mr={flushMs:2e3,flushChars:256*1024,flushEvents:2e3,checkoutEveryMs:18e4,pendingChars:8*1024*1024,blobMinChars:8*1024,beaconMaxBytes:6e4,retryMaxMs:1e4,noChannelAfter:4,budgetMsPerSecond:50,budgetSeconds:5,knownHashes:2e3},Cs=4e3;async function bt(e){if(!(typeof CompressionStream!="function"||typeof Blob!="function"||typeof Response!="function"))try{let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}catch{return}}c(bt,"bt"),u(bt,"bt"),o(bt,"bt");var $e=class{static{c(this,"$e")}static{u(this,"$e")}static{o(this,"$e")}constructor(e){this.o=e,this.queue=[],this.busy=!1,this.queued=0,this.answered=!1,this.networkFailures=0,this.disabled=!1}get pendingSize(){return this.queued}enqueue(e){this.disabled||(this.queue.push(e),this.queued+=e.size,this.pump())}drop(){let e=this.queue[0]?.summary.seq;for(let t of this.queue.splice(0))this.queued-=t.size;return e}beaconQueued(){for(let e of this.queue.splice(0))this.queued-=e.size,[...e.blobs.keys()].every(t=>this.o.known.has(t))&&this.beacon(e.summary,e.body,e.enc)}beacon(e,t,r){let n=this.o.env.sendBeacon,s=typeof t=="string"?t.length:t.byteLength;if(this.disabled||!n||s>this.o.beaconMaxBytes)return!1;try{return n(this.url("/replay",this.params(e,r,[])),new Blob([t],{type:"text/plain"}))}catch{return!1}}async pump(){if(!this.busy){this.busy=!0;try{for(;!this.disabled&&this.queue.length;){let e=this.queue.shift(),t=await this.send(e);this.queued-=e.size,t==="refused"&&(this.disabled=!0),this.o.onOutcome(e,t)}}finally{this.busy=!1}}}async send(e){for(let t=0;!this.disabled;t++){t>0&&await this.sleep(Math.min(this.o.retryMaxMs,500*2**(t-1)));try{for(let[s,i]of e.blobs){if(this.o.known.has(s))continue;let l=await bt(i),d=await this.post("/replay/blob",{sha:s,enc:l?"gzip":"identity"},l??i);if(d.status>=200&&d.status<300){this.o.known.add(s);continue}let a=Er(d.status);if(a)return a;throw new Error(`blob ${d.status}`)}let r=await this.post("/replay",this.params(e.summary,e.enc,[...e.blobs.keys()]),e.body);if(r.status>=200&&r.status<300)return this.answered=!0,"ok";if(r.status===409){let s=await Is(r);for(let i of s.length?s:e.blobs.keys())this.o.known.forget(i);continue}let n=Er(r.status);if(n)return n}catch{if(!this.answered&&++this.networkFailures>=this.o.noChannelAfter)return"refused"}}return"refused"}params(e,t,r){let n={v:String(1),load:this.o.loadId,tab:this.o.tabId,seq:String(e.seq),t0:String(e.t0),t1:String(e.t1),n:String(e.n),full:e.full?"1":"0",enc:t};if(this.o.app&&(n.app=this.o.app),e.base&&(n.base=e.base),e.anchors.length){let s="";for(let i of e.anchors){if(s.length+i.length+1>Cs){n.am="1";break}s+=(s?",":"")+i}n.a=s}return r.length&&(n.b=r.join(",")),n}url(e,t){let r=new URLSearchParams(this.o.token?{token:this.o.token,...t}:t);return`${this.o.endpoint}${e}?${r.toString()}`}async post(e,t,r){let n=await this.o.env.fetch(this.url(e,t),{method:"POST",headers:{"content-type":"text/plain"},body:r,credentials:"omit",keepalive:(typeof r=="string"?r.length:r.byteLength)<=this.o.beaconMaxBytes}),s=await n.text().catch(()=>"");return{status:n.status,text:o(async()=>s,"text")}}sleep(e){return new Promise(t=>this.o.env.setTimeout(t,e))}};function Er(e){if(e===413)return"too-big";if(e===400||e===401||e===403||e===404||e===405||e===426)return"refused"}c(Er,"Er"),u(Er,"Er"),o(Er,"Er");async function Is(e){try{let t=JSON.parse(await e.text());return Array.isArray(t.missing)?t.missing.filter(r=>typeof r=="string"):[]}catch{return[]}}c(Is,"Is"),u(Is,"Is"),o(Is,"Is");var St=2,Rs=3,kr=4,Ms=5,Es=0;function ks(e){if(e.type===St)return 64*1024;if(e.type===Rs){let t=e.data;if(t.source===Es)return 64+160*(t.adds?.length??0)+60*(t.attributes?.length??0)+80*(t.texts?.length??0)+24*(t.removes?.length??0)}return 120}c(ks,"ks"),u(ks,"ks"),o(ks,"ks");var Ts=o(()=>`load-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,"Ts"),je=class{static{c(this,"je")}static{u(this,"je")}static{o(this,"je")}constructor(e,t){this.cfg=e,this.env=t,this.loadId=Ts(),this.state="idle",this.seq=0,this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.awaitingCheckout=!1,this.checkoutPending=!1,this.processing=Promise.resolve(),this.costWindowStart=0,this.costSpent=0,this.overSeconds=0,this.limits={...Mr,...e.limits},this.privacy={...Rr,...e.privacy},this.record=e.record,this.uploader=new $e({endpoint:e.endpoint.replace(/\/+$/,""),...e.token?{token:e.token}:{},tabId:e.tabId,loadId:this.loadId,...e.app?{app:e.app}:{},env:t,known:new He(this.limits.knownHashes,t.storage),retryMaxMs:this.limits.retryMaxMs,noChannelAfter:this.limits.noChannelAfter,beaconMaxBytes:this.limits.beaconMaxBytes,onOutcome:o((r,n)=>this.onOutcome(r,n),"onOutcome")})}get status(){return this.state}start(){this.state==="idle"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.begin(),this.mark("lens/session",{tabId:this.cfg.tabId,loadId:this.loadId,...this.cfg.app?{app:this.cfg.app}:{},url:this.env.href(),wire:1,rrweb:Ir,viewport:this.env.viewport()}))}mark(e,t){if(e==="lens/nav"&&this.state==="paused"&&this.resume(),this.state!=="recording")return;let r=yr(e,t);if(r)try{this.record.addCustomEvent(e,r)}catch{}}target(e,t){if(this.state!=="recording")return;let r=Cr(e,t,n=>this.record.mirror.getId(n));r&&this.mark("lens/target",r)}checkpoint(){this.state!=="recording"||this.checkoutPending||this.awaitingCheckout||(this.checkoutPending=!0,this.env.idle(()=>{this.checkoutPending=!1,this.checkoutNow()||this.env.idle(()=>this.checkoutNow())}))}pagehide(){if(this.state!=="recording"&&this.state!=="paused"||(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),this.uploader.beaconQueued(),!this.buffer.length||this.awaitingCheckout))return;let e=this.buffer,t=this.takeSummary(e);try{this.uploader.beacon(t,JSON.stringify(e),"identity")}catch{}}stop(){this.state!=="stopped"&&(this.state==="recording"&&this.cut(),this.halt())}begin(){let e=this.privacy;try{this.stopRecord=this.record({emit:o(t=>this.onEmit(t),"emit"),checkoutEveryNms:this.limits.checkoutEveryMs,maskAllInputs:e.maskAllInputs,...e.maskAllInputs?{}:{maskInputOptions:{password:!1}},...e.maskTextSelector?{maskTextSelector:e.maskTextSelector}:{},...e.blockSelector?{blockSelector:e.blockSelector}:{},slimDOMOptions:"all",sampling:{mousemove:50,scroll:150,media:800,input:"last"},recordCanvas:!1,collectFonts:!1,errorHandler:o(()=>!0,"errorHandler")})}catch{this.halt()}}onEmit(e){if(this.state!=="recording"||this.awaitingCheckout)return;let t=this.env.perf();if(e.type===kr&&this.buffer.length&&this.cut(),e.type===St&&!this.base&&(this.base=e),this.buffer.push(e),this.bufferChars+=ks(e),e.type===Ms){let r=e.data;typeof r.tag=="string"&&r.payload&&typeof r.payload=="object"&&this.bufferAnchors.push(...br(r.tag,r.payload))}this.buffer.length>=this.limits.flushEvents||this.bufferChars>=this.limits.flushChars?this.cut():this.timer===void 0&&(this.timer=this.env.setTimeout(()=>{this.timer=void 0,this.cut()},this.limits.flushMs)),this.spend(this.env.perf()-t)}takeSummary(e){let t={seq:this.seq++,t0:e[0]?.timestamp??0,t1:e[e.length-1]?.timestamp??0,n:e.length,full:e[0]?.type===kr&&e.some(r=>r.type===St),anchors:[...new Set(this.bufferAnchors)]};return this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],t}cut(){if(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),!this.buffer.length)return;let e=this.buffer,t=this.takeSummary(e);this.processing=this.processing.then(()=>this.prepare(t,e)).catch(()=>{})}async prepare(e,t){if(this.uploader.disabled||this.state==="stopped")return;let r=await vr(t,{...this.env.subtle?{subtle:this.env.subtle}:{},blobMinChars:this.limits.blobMinChars,isBase:o(d=>d===this.base,"isBase"),perf:o(()=>this.env.perf(),"perf")});this.spend(r.ms);let n=await bt(r.json),s=n??r.json,i=typeof s=="string"?s.length:s.byteLength;for(let d of r.blobs.values())i+=d.length;let l={summary:r.base?{...e,base:r.base}:e,body:s,enc:n?"gzip":"identity",blobs:r.blobs,size:i};this.uploader.enqueue(l),this.uploader.pendingSize>this.limits.pendingChars&&this.gap("overflow")}onOutcome(e,t){if(t==="refused"){this.halt();return}if(t==="too-big"){this.gap("too-big",e.summary.seq);return}this.awaitingCheckout&&(this.awaitingCheckout=!1,this.checkoutNow())}gap(e,t){if(this.state!=="recording"||this.awaitingCheckout)return;let r=this.uploader.drop();this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.mark("lens/gap",{fromSeq:t??r??this.seq,reason:e}),this.cut(),this.awaitingCheckout=!0,this.publish("replay-gap",`session replay lost a stretch of this page (${e})`,{reason:e,fromSeq:t??r??this.seq})}checkoutNow(){if(this.state!=="recording")return!0;let e=this.env.perf();try{return this.record.takeFullSnapshot(!0),!0}catch{return!1}finally{this.spend(this.env.perf()-e)}}spend(e){let t=this.env.perf();if(t-this.costWindowStart>=1e3&&(this.overSeconds=this.costSpent>this.limits.budgetMsPerSecond?this.overSeconds+1:0,this.costSpent=0,this.costWindowStart=t,this.overSeconds>=this.limits.budgetSeconds)){this.pause();return}this.costSpent+=e}pause(){if(this.state==="recording"){this.mark("lens/gap",{fromSeq:this.seq,reason:"budget"}),this.cut();try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.state="paused",this.overSeconds=0,this.publish("replay-paused",`session replay paused: its own work stayed over ${this.limits.budgetMsPerSecond} ms a second for ${this.limits.budgetSeconds} s`,{})}}resume(){this.state==="paused"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.costSpent=0,this.begin())}halt(){this.state="stopped",this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0);try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.uploader.drop(),this.buffer=[]}publish(e,t,r){try{this.env.publish?.({source:"client-runtime",category:"runtime",severity:"info",title:t,fingerprint:`replay:${e}:${this.loadId}`,raw:{kind:e,loadId:this.loadId,tabId:this.cfg.tabId,...r}})}catch{}}},wt="__LENSMCP_REPLAY__",As=["click","submit","change"];function Tr(e){if(typeof window>"u"||typeof document>"u")return;let t=globalThis;if(t[wt]===!1)return;let r=t[wt];if(r)return r;let n=new je(e,Ns(e.env)),s={loadId:n.loadId,mark:o((i,l)=>n.mark(i,l),"mark"),checkpoint:o(()=>n.checkpoint(),"checkpoint"),stop:o(()=>n.stop(),"stop")};t[wt]=s,n.start();for(let i of As)document.addEventListener(i,l=>n.target(l.target,i),{capture:!0,passive:!0});return window.addEventListener("pagehide",()=>n.pagehide()),s}c(Tr,"Tr"),u(Tr,"Tr"),o(Tr,"Tr");function Ns(e={}){let t=window,r;try{r=t.localStorage}catch{}let n=t.isSecureContext&&t.crypto?.subtle?t.crypto.subtle:void 0,s=typeof t.fetch=="function"?t.fetch.bind(t):void 0;return{fetch:o((i,l)=>s?s(i,l):Promise.reject(new Error("no fetch")),"fetch"),...typeof navigator<"u"&&typeof navigator.sendBeacon=="function"?{sendBeacon:o((i,l)=>navigator.sendBeacon(i,l),"sendBeacon")}:{},now:o(()=>Date.now(),"now"),perf:o(()=>typeof performance<"u"?performance.now():Date.now(),"perf"),setTimeout:o((i,l)=>t.setTimeout(i,l),"setTimeout"),clearTimeout:o(i=>t.clearTimeout(i),"clearTimeout"),idle:o(i=>{typeof t.requestIdleCallback=="function"?t.requestIdleCallback(i,{timeout:2e3}):t.setTimeout(i,50)},"idle"),...r?{storage:r}:{},...n?{subtle:n}:{},href:o(()=>t.location.href,"href"),viewport:o(()=>({width:t.innerWidth,height:t.innerHeight}),"viewport"),publish:o(i=>{let l=t.__LENSMCP_PUBLISH__;typeof l=="function"&&l(i)},"publish"),...e}}c(Ns,"Ns"),u(Ns,"Ns"),o(Ns,"Ns");var Ar="__LENSMCP_REPLAY_BOOT__",Nr=globalThis,J=Nr[Ar];if(J&&typeof J.endpoint=="string"&&typeof J.tabId=="string"){delete Nr[Ar];try{Tr({endpoint:J.endpoint,...J.token?{token:J.token}:{},tabId:J.tabId,...J.app?{app:J.app}:{},record:fe,...J.fetch?{env:{fetch:J.fetch}}:{}})}catch{}}
package/replay.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { type ReplayHandle } from './lib/replay/start.js';
2
+ import type { RecordApi, ReplayConfig } from './lib/replay/types.js';
3
+ export declare function startReplay(config: Omit<ReplayConfig, 'record'> & {
4
+ record?: RecordApi;
5
+ }): ReplayHandle | undefined;
6
+ export type { ReplayHandle } from './lib/replay/start.js';
7
+ export type { ReplayConfig, ReplayEnv, ReplayLimits, ReplayPrivacy, RecordApi, RrwebEvent } from './lib/replay/types.js';
8
+ export { DEFAULT_LIMITS, DEV_PRIVACY } from './lib/replay/types.js';
9
+ export * from './replay-format.js';
package/replay.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});var p=Object.defineProperty,a=t((r,e)=>p(r,"name",{value:e,configurable:!0}),"t"),c=Object.defineProperty,f=a((r,e)=>c(r,"name",{value:e,configurable:!0}),"t");import{record as n}from"@rrweb/record";import{startReplay as i}from"./lib/replay/start.js";export function startReplay(r){return i({...r,record:r.record??n})}t(startReplay,"startReplay"),a(startReplay,"startReplay"),f(startReplay,"startReplay");export{DEFAULT_LIMITS,DEV_PRIVACY}from"./lib/replay/types.js";export*from"./replay-format.js";