@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.
- package/lib/auto.d.ts +13 -0
- package/lib/auto.js +1 -1
- package/lib/install.js +1 -1
- package/lib/replay/anchors.d.ts +87 -0
- package/lib/replay/anchors.js +1 -0
- package/lib/replay/blobs.d.ts +61 -0
- package/lib/replay/blobs.js +1 -0
- package/lib/replay/recorder.d.ts +57 -0
- package/lib/replay/recorder.js +1 -0
- package/lib/replay/start.d.ts +13 -0
- package/lib/replay/start.js +1 -0
- package/lib/replay/target.d.ts +7 -0
- package/lib/replay/target.js +1 -0
- package/lib/replay/types.d.ts +121 -0
- package/lib/replay/types.js +1 -0
- package/lib/replay/uploader.d.ts +92 -0
- package/lib/replay/uploader.js +1 -0
- package/package.json +19 -1
- package/replay-boot.d.ts +1 -0
- package/replay-boot.js +1 -0
- package/replay-format.d.ts +8 -0
- package/replay-format.js +1 -0
- package/replay-source.d.ts +2 -0
- package/replay-source.js +1 -0
- package/replay.bundle.js +100 -0
- package/replay.d.ts +9 -0
- package/replay.js +1 -0
package/replay-format.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{BLOB_PREFIX,rehydrate}from"./lib/replay/blobs.js";export{LENS_TAGS,isLensTag,anchorIds}from"./lib/replay/anchors.js";export{REPLAY_WIRE_VERSION,RRWEB_VERSION}from"./lib/replay/types.js";
|
package/replay-source.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export const REPLAY_BUNDLE='/*! @lensmcp/client-runtime session replay recorder.\nThird-party code in this bundle, each under the MIT License:\n\n@rrweb/record, rrweb, rrweb-snapshot, @rrweb/utils, @rrweb/types 2.1.7 (https://github.com/rrweb-io/rrweb)\n Copyright (c) 2018 Contributors (https://github.com/rrweb-io/rrweb/graphs/contributors)\nmitt (https://github.com/developit/mitt)\n Copyright (c) 2021 Jason Miller\nbase64-arraybuffer (https://github.com/niklasvh/base64-arraybuffer)\n Copyright (c) 2012 Niklas von Hertzen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the "Software"), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nvar _r=Object.defineProperty,xr=(e,t,r)=>t in e?_r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t,r)=>xr(e,typeof t!="symbol"?t+"":t,r),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=()=>!!globalThis.Zone;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(c=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(r,c))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),i=e in kt?kt[e]:void 0,o=!!(i&&i.every(c=>{var a;return typeof r[c]=="function"&&((a=r[c])==null?void 0:a.toString().includes("[native code]"))}));if(s&&o&&!Lr())return Ee[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let a=c.contentWindow;if(!a)return t.prototype;let u=a[e].prototype;if(!u)return c.remove(),r;let d=navigator.userAgent;return d.includes("Safari")&&!d.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Wt[e]=()=>c.remove()):c.remove(),Ee[e]=u}catch{return r}}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 o=ut(e),c=(s=Object.getOwnPropertyDescriptor(o,r))==null?void 0:s.get;return c?((Xe[e]||(Xe[e]={}))[r]=c,c.call(t)):t[r]}var Je={};function zt(e,t,r){let n=`${e}.${String(r)}`;if(Je[n])return Je[n].bind(t);let i=ut(e)[r];return typeof i!="function"?t[r]:(Je[n]=i,i.bind(t))}function Dr(e){return H("Node",e,"ownerDocument")}function Pr(e){return H("Node",e,"childNodes")}function Fr(e){return H("Node",e,"parentNode")}function Ur(e){return H("Node",e,"parentElement")}function Wr(e){return H("Node",e,"textContent")}function zr(e){return H("Node",e,"firstChild")}function Br(e){return H("Node",e,"lastChild")}function Hr(e){return H("Node",e,"nextSibling")}function $r(e){return H("Node",e,"previousSibling")}function jr(e,t){return zt("Node",e,"contains")(t)}function Gr(e){return zt("Node",e,"getRootNode")()}function Vr(e){return!e||!("host"in e)?null:H("ShadowRoot",e,"host")}function qr(e){return e.styleSheets}function Xr(e){return!e||!("shadowRoot"in e)?null:H("Element",e,"shadowRoot")}function Jr(e,t){return H("Element",e,"querySelector")(t)}function Yr(e,t){return H("Element",e,"querySelectorAll")(t)}function Bt(){return[ut("MutationObserver").constructor,Wt.MutationObserver??(()=>{})]}var ve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ve=()=>new Date().getTime());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()=>{}}}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}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)}function Se(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}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}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(" ")+";"}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}}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}}function Kr(e){let t=/(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;return e.replace(t,"$1\\\\$2")}function en(e){return"styleSheet"in e}function tn(e){return"selectorText"in e}var _e=class{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function rn(){return new _e}function xe({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:i}){let o=s||"",c=n&&te(n);return(t[r.toLowerCase()]||c&&t[c])&&(i?o=i(o,e):o="*".repeat(o.length)),o}function te(e){return e.toLowerCase()}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,o=Tt in i?i[Tt]:i;if(new Uint32Array(o.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(a=>a!==0))return!1}return!0}function Le(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?te(t):null}function jt(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return s?.[1]??null}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}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,o,c)=>{let a=s||o||c,u=n||i||"";if(!a)return r;if(an.test(a)||ln.test(a))return`url(${u}${a}${u})`;if(cn.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${sn(t)+a}${u})`;let d=a.split("#")[0],h=a.substring(d.length),f=t.split("#")[0].split("/"),p=d.split("/");f.pop();for(let m of p)m!=="."&&(m===".."?f.pop():f.push(m));return`url(${u}${f.join("/")}${h}${u})`})}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")}function hn(e,t,r=!1){let n=Array.from(t.childNodes),s=[],i=0;if(n.length>1&&e&&typeof e=="string"){let o=ke(e,r),c=o.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let u=ke(n[a].textContent,r),d=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let f=u.substring(0,h),p=o.split(f),m=-1;if(p.length===2)m=p[0].length;else if(p.length>2&&p[0]===""&&n[a-1].textContent!=="")m=o.indexOf(f,1);else if(p.length===1){if(f=f.substring(0,f.length-1),p=o.split(f),p.length<=1)return s.push(e),s;h=d+1}else h===u.length-1&&(m=o.indexOf(f));if(p.length>=2&&h>d){let l=n[a-1].textContent;if(l&&typeof l=="string"){let b=ke(l).length;m=o.indexOf(f,b)}m===-1&&(m=p[0].length)}if(m!==-1){let l=Math.floor(m/c);for(;l>0&&l<e.length;){if(i+=1,i>50*n.length)return s.push(e),s;let b=ke(e.substring(0,l),r);if(b.length===m){s.push(e.substring(0,l)),e=e.substring(l),o=o.substring(m);break}else b.length<m?l+=Math.max(1,Math.floor((m-b.length)/c)):l-=Math.max(1,Math.floor((b.length-m)*c))}break}}}}return s.push(e),s}function pn(e,t){return hn(e,t).join("/* rr_split */")}var fn=1,mn=new RegExp("[^a-z0-9-_:]"),Pe=-2;function Vt(){return fn++}function gn(e){if(e instanceof HTMLFormElement)return"form";let t=te(e.tagName);return mn.test(t)?"div":t}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 o,c=i.exec(t.substring(r));return c?(o=c[0],r+=o.length,o):""}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 o="";i=ue(e,i);let c=!1;for(;;){let a=t.charAt(r);if(a===""){s.push((i+o).trim());break}else if(c)a===")"&&(c=!1);else if(a===","){r+=1,s.push((i+o).trim());break}else a==="("&&(c=!0);o+=a,r+=1}}}return s.join(", ")}var Nt=new WeakMap;function ue(e,t){return!t||t.trim()===""?t:dt(e,t)}function wn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}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}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)}function Xt(e,t,r){return["video","audio"].includes(e)&&te(t)==="autoplay"}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}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}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}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 c=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),s=!0,t()});return}let o="about:blank";if(n.location.href!==o||e.src===o||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function 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()})}function Rn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:o,inlineStylesheet:c,maskInputOptions:a={},maskTextFn:u,maskInputFn:d,dataURLOptions:h={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:l=!1,cssCaptured:b=!1}=t,v=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:v};case e.ELEMENT_NODE:return kn(e,{doc:r,blockClass:s,blockSelector:i,inlineStylesheet:c,maskInputOptions:a,maskInputFn:d,dataURLOptions:h,inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:l,rootId:v});case e.TEXT_NODE:return En(e,{doc:r,needsMask:o,maskTextFn:u,rootId:v,cssCaptured:b});case e.CDATA_SECTION_NODE:return{type:D.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:D.Comment,textContent:S.textContent(e)||"",rootId:v};default:return!1}}function Mn(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function En(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:i}=t,o=S.parentNode(e),c=o&&o.tagName,a="",u=c==="STYLE"?!0:void 0,d=c==="SCRIPT"?!0:void 0;return d?a="SCRIPT_PLACEHOLDER":i||(a=S.textContent(e),u&&a&&(a=De(a,dt(t.doc)))),!u&&!d&&a&&r&&(a=n?n(a,S.parentElement(e)):a.replace(/[\\S]/g,"*")),{type:D.Text,textContent:a||"",rootId:s}}function kn(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:i,maskInputOptions:o={},maskInputFn:c,dataURLOptions:a={},inlineImages:u,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:p}=t,m=vn(e,n,s),l=gn(e),b={},v=e.attributes.length;for(let y=0;y<v;y++){let C=e.attributes[y];Xt(l,C.name,C.value)||(b[C.name]=qt(r,l,te(C.name),C.value))}if(l==="link"&&i){let y=Array.from(r.styleSheets).find(N=>N.href===e.href),C=null;y&&(C=Qe(y)),C&&(delete b.rel,delete b.href,b._cssText=C)}if(l==="style"&&e.sheet){let y=Qe(e.sheet);y&&(e.childNodes.length>1&&(y=pn(y,e)),b._cssText=y)}if(["input","textarea","select"].includes(l)){let y=e.value,C=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&y?b.value=xe({element:e,type:Le(e),tagName:l,value:y,maskInputOptions:o,maskInputFn:c}):C&&(b.checked=C)}if(l==="option"&&(e.selected&&!o.select?b.selected=!0:delete b.selected),l==="dialog"&&e.open&&(b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&d){if(e.__context==="2d")nn(e)||(b.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let y=e.toDataURL(a.type,a.quality),C=r.createElement("canvas");C.width=e.width,C.height=e.height;let N=C.toDataURL(a.type,a.quality);y!==N&&(b.rr_dataURL=y)}}if(l==="img"&&u){ae||(ae=r.createElement("canvas"),At=ae.getContext("2d"));let y=e,C=y.currentSrc||y.getAttribute("src")||"<unknown-src>",N=y.crossOrigin,O=()=>{y.removeEventListener("load",O);try{ae.width=y.naturalWidth,ae.height=y.naturalHeight,At.drawImage(y,0,0),b.rr_dataURL=ae.toDataURL(a.type,a.quality)}catch(F){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?O():y.addEventListener("load",O);return}else console.warn(`Cannot inline img src=${C}! Error: ${F}`)}y.crossOrigin==="anonymous"&&(N?b.crossOrigin=N:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?O():y.addEventListener("load",O)}if(["audio","video"].includes(l)){let y=b;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),m){let{width:y,height:C}=e.getBoundingClientRect();b={class:b.class,rr_width:`${y}px`,rr_height:`${C}px`}}l==="iframe"&&!h(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src);let w;try{customElements.get(l)&&(w=!0)}catch{}return{type:D.Element,tagName:l,attributes:b,childNodes:[],isSVG:wn(e)||void 0,needBlock:m,rootId:p,isCustom:w}}function A(e){return e==null?"":e.toLowerCase()}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||{}}function Tn(e,t){if(t.comment&&e.type===D.Comment)return!0;if(e.type===D.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&jt(e.attributes.href)==="js"))return!0;if(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")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&A(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(A(e.attributes.property).match(/^(og|twitter|fb):/)||A(e.attributes.name).match(/^(og|twitter):/)||A(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(A(e.attributes.name)==="robots"||A(e.attributes.name)==="googlebot"||A(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(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:/)))return!0;if(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"))return!0}}return!1}function de(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,maskTextClass:o,maskTextSelector:c,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:d={},maskTextFn:h,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m={},inlineImages:l=!1,recordCanvas:b=!1,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:y=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:O=()=>!1,newlyAddedElement:F=!1,cssCaptured:Y=!1}=t,{needsMask:$}=t,{preserveWhiteSpace:V=!0}=t;$||($=Jt(e,o,c,$===void 0));let j=Rn(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:$,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:f,dataURLOptions:m,inlineImages:l,recordCanvas:b,keepIframeSrcFn:O,newlyAddedElement:F,cssCaptured:Y});if(!j)return console.warn(e,"not serialized"),null;let Z;n.hasNode(e)?Z=n.getId(e):Tn(j,p)||!V&&j.type===D.Text&&!j.textContent.replace(/^\\s+|\\s+$/gm,"").length?Z=Pe:Z=Vt();let E=Object.assign(j,{id:Z});if(n.add(e,E),Z===Pe)return null;v&&v(e);let me=!a;if(E.type===D.Element){me=me&&!E.needBlock,delete E.needBlock;let P=S.shadowRoot(e);P&&Se(P)&&(E.isShadowHost=!0)}if((E.type===D.Document||E.type===D.Element)&&me){p.headWhitespace&&E.type===D.Element&&E.tagName==="head"&&(V=!1);let P={doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:$,maskTextClass:o,maskTextSelector:c,skipChild:a,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:V,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:N,keepIframeSrcFn:O,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"&&(P.cssCaptured=!0);for(let re of Array.from(S.childNodes(e))){let Q=de(re,P);Q&&E.childNodes.push(Q)}}let G=null;if(Ht(e)&&(G=S.shadowRoot(e)))for(let re of Array.from(S.childNodes(G))){let Q=de(re,P);Q&&(Se(G)&&(Q.isShadow=!0),E.childNodes.push(Q))}}let ge=S.parentNode(e);return ge&&be(ge)&&Se(ge)&&(E.isShadow=!0),E.type===D.Element&&E.tagName==="iframe"&&Cn(e,()=>{let P=e.contentDocument;if(P&&w){let G=de(P,{doc:P,mirror:n,blockClass:s,blockSelector:i,needsMask:$,maskTextClass:o,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:V,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:N,keepIframeSrcFn:O});G&&w(e,G)}},y),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(C){let P=de(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:$,maskTextClass:o,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:V,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:N,keepIframeSrcFn:O});P&&C(e,P)}},N),E}function An(e,t){let{mirror:r=new _e,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:i="rr-mask",maskTextSelector:o=null,inlineStylesheet:c=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:f,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:N=()=>!1}=t,O=d===!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}:d===!1?{password:!0}:d,F=Yt(p);return de(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:i,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:O,maskTextFn:h,maskInputFn:f,slimDOMOptions:F,dataURLOptions:m,inlineImages:a,recordCanvas:u,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:N,newlyAddedElement:!1})}var Ke=class e{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!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)}var ce=`Please stop import mirror directly. Instead of that,\\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\nor you can use record.mirror to access the mirror instance during recording.`,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 o=Date.now();!s&&r.leading===!1&&(s=o);let c=t-(o-s),a=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),s=o,e.apply(a,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(a,i)},c))}}function Be(e,t,r,n,s=window){let i=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(o){setTimeout(()=>{r.set.call(this,o)},0),i&&i.set&&i.set.call(this,o)}}),()=>Be(e,t,i||{},!0)}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}}function Qt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Kt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function er(e){return e?e.nodeType===e.ELEMENT_NODE?e:S.parentElement(e):null}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))}function Nn(e,t){return t.getId(e)!==-1}function Ye(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Pe}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}function et(e){return!!e.changedTouches}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)}function rr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function nr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function tt(e){return e?e instanceof Ke&&"shadowRoot"in e?!!e.shadowRoot:!!S.shadowRoot(e):!1}var rt=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function 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}function _n(e){let t=e,r;for(;r=sr(t);)t=r;return t}function xn(e){let t=S.ownerDocument(e);if(!t)return!1;let r=_n(e);return S.contains(t,r)}function ir(e){let t=S.ownerDocument(e);return t?S.contains(t,e)||xn(e):!1}var _t=(e,t)=>`${e}@${t}`,nt=class{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",t=>{t.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let f of this.movedSet){let p=S.parentNode(f);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(f)}let n=null,s=null,i=-1,o=null,c=!1,a=new Set,u=this.addedSet.values(),d=u.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(S.previousSibling(n)))o=n,n=S.previousSibling(n);else{for(this.addedSet.has(d.value)||(d=u.next()),n=d.value;;){if(s=S.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(a.has(s))s=null;else if(s){if(ir(s)?(c=xt(this.droppedSet,s)||this.removesSubTreeCache.has(s),c&&xt(this.movedSet,n)&&(c=!1)):c=!0,this.addedSet.has(S.lastChild(s)))n=S.lastChild(s),o=null;else for(;;){if(o=S.nextSibling(n),this.addedSet.has(o)){n=o;continue}break}if(i=be(s)?this.mirror.getId(sr(n)):this.mirror.getId(s),i===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let l=S.host(s);i=this.mirror.getId(l)}}}if(this.addedSet.delete(n),!s||i===-1){a.add(n);continue}else if(c){this.droppedSet.add(n);continue}let f=!1;if(n.nodeType===Node.TEXT_NODE){let l=s.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(i)&&(f=!0)}let p=o?this.mirror.getId(o):null;for(;p===Pe;)o=o&&S.nextSibling(o),p=o&&this.mirror.getId(o);if(p===-1){console.warn("Couldn\'t record new node. Couldn\'t find mirror id for nextSibling:",o),n=null;continue}let m=de(n,{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:l=>{rr(l,this.mirror)&&this.iframeManager.addIframe(l),nr(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),tt(n)&&this.shadowDomManager.addShadowRoot(S.shadowRoot(n),this.doc)},onIframeLoad:(l,b)=>{this.iframeManager.attachIframe(l,b),this.shadowDomManager.observeAttachShadow(l)},onStylesheetLoad:(l,b)=>{this.stylesheetManager.attachLinkElement(l,b)},cssCaptured:f});m&&(t.push({parentId:i,nextId:p,node:m}),r.add(m.id))}let h={texts:this.texts.map(f=>{let p=f.node,m=S.parentNode(p);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(p),value:f.value}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),attributes:this.attributes.map(f=>{let{attributes:p}=f;if(typeof p.style=="string"){let m=JSON.stringify(f.styleDiff),l=JSON.stringify(f._unchangedStyles);m.length<p.style.length&&(m+l).split("var(").length===p.style.split("var(").length&&(p.style=f.styleDiff)}return{id:this.mirror.getId(f.node),attributes:p}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(h))}),g(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(S.childNodes(t),s=>S.textContent(s)||"").join("");r.attributes.value=xe({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Le(t),value:n,maskInputFn:this.maskInputFn})}),g(this,"processMutation",t=>{if(!Ye(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=S.textContent(t.target);!W(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Jt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,er(t.target)):r.replace(/[\\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=te(r.tagName),s=t.attributeName,i=t.target.getAttribute(s);if(s==="value"){let c=Le(r);i=xe({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:i,maskInputFn:this.maskInputFn})}if(W(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)s="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Xt(n,s))if(o.attributes[s]=qt(this.doc,n,te(s),i),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let a of Array.from(r.style)){let u=r.style.getPropertyValue(a),d=r.style.getPropertyPriority(a);u!==c.style.getPropertyValue(a)||d!==c.style.getPropertyPriority(a)?d===""?o.styleDiff[a]=u:o.styleDiff[a]=[u,d]:o._unchangedStyles[a]=[u,d]}for(let a of Array.from(c.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(W(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),s=be(t.target)?this.mirror.getId(S.host(t.target)):this.mirror.getId(t.target);W(t.target,this.blockClass,this.blockSelector,!1)||Ye(r,this.mirror,this.slimDOMOptions)||!Nn(r,this.mirror)||(this.addedSet.has(r)?(st(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||tr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[_t(n,s)]?st(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:be(t.target)&&Se(t.target)?!0:void 0}),Ln(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ye(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[_t(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);W(t,this.blockClass,this.blockSelector,!1)||(S.childNodes(t).forEach(n=>this.genAdds(n)),tt(t)&&S.childNodes(S.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!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))}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)))}}function xt(e,t){return e.size===0?!1:or(e,t)}function or(e,t){if(e.has(t))return!0;let r=S.parentNode(t);return r?or(e,r):!1}var we;function Dn(e){we=e}function Pn(){we=void 0}var R=e=>we?(...r)=>{try{return e(...r)}catch(n){if(we&&we(n)===!0)return;throw n}}:e,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}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]}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,o=[],c,a=Ce(R(h=>{let f=Date.now()-c;e(o.map(p=>(p.timeOffset-=f,p)),h),o=[],c=null}),i),u=R(Ce(R(h=>{let f=Ie(h),{clientX:p,clientY:m}=et(h)?h.changedTouches[0]:h;c||(c=ve()),o.push({x:p,y:m,id:n.getId(f),timeOffset:ve()-c}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),s,{trailing:!1})),d=[U("mousemove",u,r),U("touchmove",u,r),U("drag",u,r)];return R(()=>{d.forEach(h=>h())})}function Un({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let o=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,c=[],a=null,u=d=>h=>{let f=Ie(h);if(W(f,n,s,!0))return;let p=null,m=d;if("pointerType"in h){switch(h.pointerType){case"mouse":p=K.Mouse;break;case"touch":p=K.Touch;break;case"pen":p=K.Pen;break}p===K.Touch?z[d]===z.MouseDown?m="TouchStart":z[d]===z.MouseUp&&(m="TouchEnd"):K.Pen}else et(h)&&(p=K.Touch);p!==null?(a=p,(m.startsWith("Touch")&&p===K.Touch||m.startsWith("Mouse")&&p===K.Mouse)&&(p=null)):z[d]===z.Click&&(p=a,a=null);let l=et(h)?h.changedTouches[0]:h;if(!l)return;let b=r.getId(f),{clientX:v,clientY:w}=l;R(e)({type:z[m],id:b,x:v,y:w,...p!==null&&{pointerType:p}})};return Object.keys(z).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&o[d]!==!1).forEach(d=>{let h=te(d),f=u(d);if(window.PointerEvent)switch(z[d]){case z.MouseDown:case z.MouseUp:h=h.replace("mouse","pointer");break;case z.TouchStart:case z.TouchEnd:return}c.push(U(h,f,t))}),R(()=>{c.forEach(d=>d())})}function lr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:i}){let o=R(Ce(R(c=>{let a=Ie(c);if(!a||W(a,n,s,!0))return;let u=r.getId(a);if(a===t&&t.defaultView){let d=Zt(t.defaultView);e({id:u,x:d.left,y:d.top})}else e({id:u,x:a.scrollLeft,y:a.scrollTop})}),i.scroll||100));return U("scroll",o,t)}function Wn({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=R(Ce(R(()=>{let i=Qt(),o=Kt();(r!==i||n!==o)&&(e({width:Number(o),height:Number(i)}),r=i,n=o)}),200));return U("resize",s,t)}var zn=["INPUT","TEXTAREA","SELECT"],Lt=new WeakMap;function Bn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:i,ignoreSelector:o,maskInputOptions:c,maskInputFn:a,sampling:u,userTriggeredOnInput:d}){function h(w){let y=Ie(w),C=w.isTrusted,N=y&&y.tagName;if(y&&N==="OPTION"&&(y=S.parentElement(y)),!y||!N||zn.indexOf(N)<0||W(y,n,s,!0)||y.classList.contains(i)||o&&y.matches(o))return;let O=y.value,F=!1,Y=Le(y)||"";Y==="radio"||Y==="checkbox"?F=y.checked:(c[N.toLowerCase()]||c[Y])&&(O=xe({element:y,maskInputOptions:c,tagName:N,type:Y,value:O,maskInputFn:a})),f(y,d?{text:O,isChecked:F,userTriggered:C}:{text:O,isChecked:F});let $=y.name;Y==="radio"&&$&&F&&t.querySelectorAll(`input[type="radio"][name="${$}"]`).forEach(V=>{if(V!==y){let j=V.value;f(V,d?{text:j,isChecked:!F,userTriggered:!1}:{text:j,isChecked:!F})}})}function f(w,y){let C=Lt.get(w);if(!C||C.text!==y.text||C.isChecked!==y.isChecked){Lt.set(w,y);let N=r.getId(w);R(e)({...y,id:N})}}let m=(u.input==="last"?["change"]:["input","change"]).map(w=>U(w,R(h),t)),l=t.defaultView;if(!l)return()=>{m.forEach(w=>w())};let b=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),v=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return b&&b.set&&m.push(...v.map(w=>Be(w[0],w[1],{set(){R(h)({target:this,isTrusted:!1})}},!1,l))),R(()=>{m.forEach(w=>w())})}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 o=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(o),r(n.parentRule,s)}else if(n.parentStyleSheet){let o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(o)}return s}return r(e,t)}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}):{}}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((d,h,f)=>{let[p,m]=f,{id:l,styleId:b}=ee(h,t,r.styleMirror);return(l&&l!==-1||b&&b!==-1)&&e({id:l,styleId:b,adds:[{rule:p,index:m}]}),d.apply(h,f)})}),n.CSSStyleSheet.prototype.addRule=function(d,h,f=this.cssRules.length){let p=`${d} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,f])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:R((d,h,f)=>{let[p]=f,{id:m,styleId:l}=ee(h,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,removes:[{index:p}]}),d.apply(h,f)})}),n.CSSStyleSheet.prototype.removeRule=function(d){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[d])};let o;n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:R((d,h,f)=>{let[p]=f,{id:m,styleId:l}=ee(h,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replace:p}),d.apply(h,f)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:R((d,h,f)=>{let[p]=f,{id:m,styleId:l}=ee(h,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replaceSync:p}),d.apply(h,f)})}));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 u={};return Object.entries(a).forEach(([d,h])=>{u[d]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[d].insertRule,{apply:R((f,p,m)=>{let[l,b]=m,{id:v,styleId:w}=ee(p.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,adds:[{rule:l,index:[...Ue(p),b||0]}]}),f.apply(p,m)})}),h.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:R((f,p,m)=>{let[l]=m,{id:b,styleId:v}=ee(p.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||v&&v!==-1)&&e({id:b,styleId:v,removes:[{index:[...Ue(p),l]}]}),f.apply(p,m)})})}),R(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=i,o&&(n.CSSStyleSheet.prototype.replace=o),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(a).forEach(([d,h])=>{h.prototype.insertRule=u[d].insertRule,h.prototype.deleteRule=u[d].deleteRule})})}function cr({mirror:e,stylesheetManager:t},r){var n,s,i;let o=null;r.nodeName==="#document"?o=e.getId(r):o=e.getId(S.host(r));let c=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=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!c||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var d;let h=(d=a.set)==null?void 0:d.call(this,u);if(o!==null&&o!==-1)try{t.adoptStyleSheets(u,o)}catch{}return h}}),R(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}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((c,a,u)=>{var d;let[h,f,p]=u;if(r.has(h))return i.apply(a,[h,f,p]);let{id:m,styleId:l}=ee((d=a.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,set:{property:h,value:f,priority:p},index:Ue(a.parentRule)}),c.apply(a,u)})});let o=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:R((c,a,u)=>{var d;let[h]=u;if(r.has(h))return o.apply(a,[h]);let{id:f,styleId:p}=ee((d=a.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||p&&p!==-1)&&e({id:f,styleId:p,remove:{property:h},index:Ue(a.parentRule)}),c.apply(a,u)})}),R(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=o})}function jn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:i}){let o=R(a=>Ce(R(u=>{let d=Ie(u);if(!d||W(d,t,r,!0))return;let{currentTime:h,volume:f,muted:p,playbackRate:m,loop:l}=d;e({type:a,id:n.getId(d),currentTime:h,volume:f,muted:p,playbackRate:m,loop:l})}),s.media||500)),c=[U("play",o(le.Play),i),U("pause",o(le.Pause),i),U("seeked",o(le.Seeked),i),U("volumechange",o(le.VolumeChange),i),U("ratechange",o(le.RateChange),i)];return R(()=>{c.forEach(a=>a())})}function Gn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,i=r.FontFace;r.FontFace=function(a,u,d){let h=new i(a,u,d);return s.set(h,{family:a,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=oe(t.fonts,"add",function(c){return function(a){return setTimeout(R(()=>{let u=s.get(a);u&&(e(u),s.delete(a))}),0),c.apply(this,[a])}});return n.push(()=>{r.FontFace=i}),n.push(o),R(()=>{n.forEach(c=>c())})}function Vn(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:i}=e,o=!0,c=R(()=>{let a=t.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],d=a.rangeCount||0;for(let h=0;h<d;h++){let f=a.getRangeAt(h),{startContainer:p,startOffset:m,endContainer:l,endOffset:b}=f;W(p,n,s,!0)||W(l,n,s,!0)||u.push({start:r.getId(p),startOffset:m,end:r.getId(l),endOffset:b})}i({ranges:u})});return c(),U("selectionchange",c)}function qn({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:oe(r.customElements,"define",function(s){return function(i,o,c){try{t({define:{name:i}})}catch{console.warn(`Custom element callback failed for ${i}`)}return s.apply(this,[i,o,c])}})}function Xn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:i,viewportResizeCb:o,inputCb:c,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:d,canvasMutationCb:h,fontCb:f,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l)},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l)},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),s(...l)},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),i(...l)},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),o(...l)},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l)},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),a(...l)},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),u(...l)},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),d(...l)},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),h(...l)},e.fontCb=(...l)=>{t.font&&t.font(...l),f(...l)},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),p(...l)},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),m(...l)}}function Jn(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};Xn(e,t);let n,s=()=>{};e.recordDOM&&([n,s]=ar(e,e.doc));let i=Fn(e),o=Un(e),c=lr(e),a=Wn(e,{win:r}),u=Bn(e),d=jn(e),h=()=>{},f=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(h=Hn(e,{win:r}),f=cr(e,e.doc),p=$n(e,{win:r}),e.collectFonts&&(m=Gn(e)));let l=Vn(e),b=qn(e),v=[];for(let w of e.plugins)v.push(w.observer(w.callback,r,w.options));return R(()=>{ie.forEach(w=>w.reset()),n?.disconnect(),s(),i(),o(),c(),a(),u(),d(),h(),f(),p(),m(),l(),b(),v.forEach(w=>w())})}function Te(e){return typeof window[e]<"u"}function Ae(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var We=class{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,s){let i=n||this.getIdToRemoteIdMap(t),o=s||this.getRemoteIdToIdMap(t),c=i.get(r);return c||(c=this.generateIdFn(),i.set(r,c),o.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(i=>this.getId(t,i,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let i=s.get(r);return i||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},it=class{constructor(t){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=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new We(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n,s;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let i=this.transformCrossOriginEvent(s,r.data.event);i&&this.wrappedEmit(i,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case M.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:M.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case M.Meta:case M.Load:case M.DomContentLoaded:return!1;case M.Plugin:return r;case M.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case M.IncrementalSnapshot:switch(r.data.source){case I.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);let i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(s.node,i)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case I.Drag:case I.TouchMove:case I.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(r.data,t,["id"]),r;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case I.Font:return r;case I.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case I.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(let i of s)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=t.getIds(n,r[i]):r[i]=t.getId(n,r[i]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==D.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},ot=class{constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Se(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[n]=ar({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(lr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(S.host(t))),this.restoreHandlers.push(cr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(oe(t.prototype,"attachShadow",function(s){return function(i){let o=s.call(this,i),c=S.shadowRoot(this);return c&&ir(this)&&n.addShadowRoot(c,r),o}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}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=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},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)}var ur=(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};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}var dr=(e,t,r)=>e.map(n=>Ne(n,t,r)),hr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function Kn(e,t,r,n){let s=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of i)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!="function")continue;let c=oe(t.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return W(this.canvas,r,n,!0)||setTimeout(()=>{let d=dr(u,t,this);e(this.canvas,{type:pe["2D"],property:o,args:d})},0),a.apply(this,u)}});s.push(c)}catch{let c=Be(t.CanvasRenderingContext2D.prototype,o,{set(a){e(this.canvas,{type:pe["2D"],property:o,args:[a],setter:!0})}});s.push(c)}return()=>{s.forEach(o=>o())}}function es(e){return e==="experimental-webgl"?"webgl":e}function Pt(e,t,r,n){let s=[];try{let i=oe(e.HTMLCanvasElement.prototype,"getContext",function(o){return function(c,...a){if(!W(this,t,r,!0)){let u=es(c);if("__context"in this||(this.__context=u),n&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let d=a[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[c,...a])}});s.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(i=>i())}}function Ft(e,t,r,n,s,i){let o=[],c=Object.getOwnPropertyNames(e);for(let a of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let u=oe(e,a,function(d){return function(...h){let f=d.apply(this,h);if(ur(f,i,this),"tagName"in this.canvas&&!W(this.canvas,n,s,!0)){let p=dr(h,i,this),m={type:t,property:a,args:p};r(this.canvas,m)}return f}});o.push(u)}catch{let u=Be(e,a,{set(d){r(this.canvas,{type:t,property:a,args:[d],setter:!0})}});o.push(u)}return o}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())}}var pr=`(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = \\`\\${width}-\\${height}\\`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n`,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)}}var at=class{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:r="all",win:n,blockClass:s,blockSelector:i,recordCanvas:o,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&r==="all"&&this.initCanvasMutationObserver(n,s,i),o&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,i,{dataURLOptions:c})}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(t,r,n,s,i){let o=Pt(r,n,s,!0),c=new Map,a=new rs;a.onmessage=m=>{let{id:l}=m.data;if(c.set(l,!1),!("base64"in m.data))return;let{base64:b,type:v,width:w,height:y}=m.data;this.mutationCb({id:l,type:pe["2D"],commands:[{property:"clearRect",args:[0,0,w,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:b}],type:v}]},0,0]}]})};let u=1e3/t,d=0,h,f=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(l=>{W(l,n,s,!0)||m.push(l)}),m},p=m=>{if(d&&m-d<u){h=requestAnimationFrame(p);return}d=m,f().forEach(async l=>{var b;let v=this.mirror.getId(l);if(c.get(v)||l.width===0||l.height===0)return;if(c.set(v,!0),["webgl","webgl2"].includes(l.__context)){let y=l.getContext(l.__context);((b=y?.getContextAttributes())==null?void 0:b.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let w=await createImageBitmap(l);a.postMessage({id:v,bitmap:w,width:l.width,height:l.height,dataURLOptions:i.dataURLOptions},[w])}),h=requestAnimationFrame(p)};h=requestAnimationFrame(p),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let s=Pt(t,r,n,!1),i=Kn(this.processMutation.bind(this),t,r,n),o=ts(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let s=n.map(o=>{let{type:c,...a}=o;return a}),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:s}),this.pendingCanvasMutations.delete(t)}},lt=class{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new rt),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let i of t){let o;this.styleMirror.has(i)?o=this.styleMirror.getId(i):(o=this.styleMirror.add(i),s.push({styleId:o,rules:Array.from(i.rules||CSSRule,(c,a)=>({rule:$t(c,i.href),index:a}))})),n.styleIds.push(o)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},ct=class{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}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:o="rr-ignore",ignoreSelector:c=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:p,maskInputFn:m,maskTextFn:l,hooks:b,packFn:v,sampling:w={},dataURLOptions:y={},mousemoveWait:C,recordDOM:N=!0,recordCanvas:O=!1,recordCrossOriginIframes:F=!1,recordAfter:Y=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:$=!1,collectFonts:V=!1,inlineImages:j=!1,plugins:Z,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:me=new Set([]),errorHandler:ge}=e;Dn(ge);let P=F?window.parent===window:!0,G=!1;if(!P)try{window.parent.document&&(G=!1)}catch{G=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!G)return()=>{};C!==void 0&&w.mousemove===void 0&&(w.mousemove=C),X.reset();let re=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}:f!==void 0?f:{password:!0},Q=Yt(p);On();let vt,Ge=0,Ct=k=>{for(let q of Z||[])q.eventProcessor&&(k=q.eventProcessor(k));return v&&!G&&(k=v(k)),k};L=(k,q)=>{var _;let x=k;if(x.timestamp=ve(),(_=ie[0])!=null&&_.isFrozen()&&x.type!==M.FullSnapshot&&!(x.type===M.IncrementalSnapshot&&x.data.source===I.Mutation)&&ie.forEach(B=>B.unfreeze()),P)t?.(Ct(x),q);else if(G){let B={type:"rrweb",event:Ct(x),origin:window.location.origin,isCheckout:q};window.parent.postMessage(B,"*")}if(x.type===M.FullSnapshot)vt=x,Ge=0;else if(x.type===M.IncrementalSnapshot){if(x.data.source===I.Mutation&&x.data.isAttachIframe)return;Ge++;let B=n&&Ge>=n,T=r&&x.timestamp-vt.timestamp>r;(B||T)&&Oe(!0)}};let Re=k=>{L({type:M.IncrementalSnapshot,data:{source:I.Mutation,...k}})},It=k=>L({type:M.IncrementalSnapshot,data:{source:I.Scroll,...k}}),Rt=k=>L({type:M.IncrementalSnapshot,data:{source:I.CanvasMutation,...k}}),Or=k=>L({type:M.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...k}}),ne=new lt({mutationCb:Re,adoptedStyleSheetCb:Or}),se=new it({mirror:X,mutationCb:Re,stylesheetManager:ne,recordCrossOriginIframes:F,wrappedEmit:L});for(let k of Z||[])k.getMirror&&k.getMirror({nodeMirror:X,crossOriginIframeMirror:se.crossOriginIframeMirror,crossOriginIframeStyleMirror:se.crossOriginIframeStyleMirror});let Ve=new ct;Ze=new at({recordCanvas:O,mutationCb:Rt,win:window,blockClass:s,blockSelector:i,mirror:X,sampling:w.canvas,dataURLOptions:y});let Me=new ot({mutationCb:Re,scrollCb:It,bypassOptions:{blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:re,dataURLOptions:y,maskTextFn:l,maskInputFn:m,recordCanvas:O,inlineImages:j,sampling:w,slimDOMOptions:Q,iframeManager:se,stylesheetManager:ne,canvasManager:Ze,keepIframeSrcFn:E,processedNodeManager:Ve},mirror:X});Oe=(k=!1)=>{if(!N)return;L({type:M.Meta,data:{href:window.location.href,width:Kt(),height:Qt()}},k),ne.reset(),Me.init(),ie.forEach(_=>_.lock());let q=An(document,{mirror:X,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:re,maskTextFn:l,maskInputFn:m,slimDOM:Q,dataURLOptions:y,recordCanvas:O,inlineImages:j,onSerialize:_=>{rr(_,X)&&se.addIframe(_),nr(_,X)&&ne.trackLinkElement(_),tt(_)&&Me.addShadowRoot(S.shadowRoot(_),document)},onIframeLoad:(_,x)=>{se.attachIframe(_,x),Me.observeAttachShadow(_)},onStylesheetLoad:(_,x)=>{ne.attachLinkElement(_,x)},keepIframeSrcFn:E});if(!q)return console.warn("Failed to snapshot the document");L({type:M.FullSnapshot,data:{node:q,initialOffset:Zt(window)}},k),ie.forEach(_=>_.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ne.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))};try{let k=[],q=x=>{var B;return R(Jn)({mutationCb:Re,mousemoveCb:(T,qe)=>L({type:M.IncrementalSnapshot,data:{source:qe,positions:T}}),mouseInteractionCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.MouseInteraction,...T}}),scrollCb:It,viewportResizeCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.ViewportResize,...T}}),inputCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.Input,...T}}),mediaInteractionCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.MediaInteraction,...T}}),styleSheetRuleCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.StyleSheetRule,...T}}),styleDeclarationCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.StyleDeclaration,...T}}),canvasMutationCb:Rt,fontCb:T=>L({type:M.IncrementalSnapshot,data:{source:I.Font,...T}}),selectionCb:T=>{L({type:M.IncrementalSnapshot,data:{source:I.Selection,...T}})},customElementCb:T=>{L({type:M.IncrementalSnapshot,data:{source:I.CustomElement,...T}})},blockClass:s,ignoreClass:o,ignoreSelector:c,maskTextClass:a,maskTextSelector:u,maskInputOptions:re,inlineStylesheet:d,sampling:w,recordDOM:N,recordCanvas:O,inlineImages:j,userTriggeredOnInput:$,collectFonts:V,doc:x,maskInputFn:m,maskTextFn:l,keepIframeSrcFn:E,blockSelector:i,slimDOMOptions:Q,dataURLOptions:y,mirror:X,iframeManager:se,stylesheetManager:ne,shadowDomManager:Me,processedNodeManager:Ve,canvasManager:Ze,ignoreCSSAttributes:me,plugins:((B=Z?.filter(T=>T.observer))==null?void 0:B.map(T=>({observer:T.observer,options:T.options,callback:qe=>L({type:M.Plugin,data:{plugin:T.name,payload:qe}})})))||[]},b)};se.addLoadListener(x=>{try{k.push(q(x.contentDocument))}catch(B){console.warn(B)}});let _=()=>{Oe(),k.push(q(document)),ze=!0};return["interactive","complete"].includes(document.readyState)?_():(k.push(U("DOMContentLoaded",()=>{L({type:M.DomContentLoaded,data:{}}),Y==="DOMContentLoaded"&&_()})),k.push(U("load",()=>{L({type:M.Load,data:{}}),Y==="load"&&_()},window))),()=>{k.forEach(x=>{try{x()}catch(B){String(B).toLowerCase().includes("cross-origin")||console.warn(B)}}),Ve.destroy(),ze=!1,Pn()}}catch(k){console.warn(k)}}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";var 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}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}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,(r,n,s)=>os(s)?`${n}${s}=${fr}`:r)}function mr(e){return e&&hs(ds(e),1024)}function hs(e,t){return e.length<=t?e:`${e.slice(0,t)}\\u2026[lensmcp truncated: ${e.length-t} more chars]`}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");var 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)}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)}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 o=mt(i,t+1,s);o!==void 0&&(n[s]=o)}return n}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}`]:[]}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}async function vr(e,t){let r=[],n=new Map,s,i=0;for(let a of e){let u=t.perf();if(!t.subtle||a.type!==2&&a.type!==3){r.push(JSON.stringify(a)),i+=t.perf()-u;continue}if(a.type===2&&t.isBase(a)){let f=a.data,p=JSON.stringify(f.node);i+=t.perf()-u;let m=await wr(t.subtle,p);u=t.perf(),n.set(m,p),s=m,r.push(gt(a,JSON.stringify({...f,node:Sr+m}))),i+=t.perf()-u;continue}let d=JSON.stringify(a.data);if(d.length<t.blobMinChars){r.push(gt(a,d)),i+=t.perf()-u;continue}i+=t.perf()-u;let h=await wr(t.subtle,d);u=t.perf(),n.set(h,d),r.push(gt(a,JSON.stringify(Sr+h))),i+=t.perf()-u}let o=t.perf(),c=`[${r.join(",")}]`;return i+=t.perf()-o,{json:c,blobs:n,...s?{base:s}:{},ms:i}}function gt(e,t){let r=e.delay;return`{"type":${e.type},"data":${t},"timestamp":${e.timestamp}${r!==void 0?`,"delay":${r}`:""}}`}var He=class{constructor(t,r,n="lensmcp:replay:blobs"){this.max=t;this.storage=r;this.key=n;this.set=new Set;try{let s=r?.getItem(n),i=s?JSON.parse(s):[];if(Array.isArray(i))for(let o of i.slice(-t))typeof o=="string"&&/^[0-9a-f]{64}$/.test(o)&&this.set.add(o)}catch{}}has(t){return this.set.has(t)}add(t){for(this.set.delete(t),this.set.add(t);this.set.size>this.max;)this.set.delete(this.set.values().next().value);this.save()}forget(t){this.set.delete(t)&&this.save()}save(){try{this.storage?.setItem(this.key,JSON.stringify([...this.set]))}catch{}}};var ws="a,button,input,select,textarea,label,summary,option,[role],[data-testid],[onclick],[tabindex]";var vs=e=>!!e&&typeof e.closest=="function"&&typeof e.getAttribute=="function"&&typeof e.tagName=="string";function Cr(e,t,r){if(!vs(e))return;let n=e.closest(ws)??e,s=b=>n.getAttribute(b)??void 0,i=(n.textContent??"").replace(/\\s+/g," ").trim(),o=n.closest("[data-agent-source]"),c=n.closest("[data-agent-component]"),a=-1;try{a=r(n)}catch{}let u={kind:t,id:a,tag:n.tagName.toLowerCase()},d=s("role");d&&(u.role=d),i&&(u.text=i.length>80?`${i.slice(0,79)}\\u2026`:i);let h=s("aria-label")??s("title")??s("placeholder")??s("name")??s("alt");h&&(u.label=h);let f=s("data-testid")??s("data-test")??s("data-cy");f&&(u.testId=f);let p=n.tagName==="INPUT"?s("type"):void 0;p&&(u.inputType=p);let m=o?.getAttribute("data-agent-source");m&&(u.source=m);let l=c?.getAttribute("data-agent-component");return l&&(u.component=l),u}var Ir="2.1.7";var 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};var 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}}var $e=class{constructor(t){this.o=t;this.queue=[];this.busy=!1;this.queued=0;this.answered=!1;this.networkFailures=0;this.disabled=!1}get pendingSize(){return this.queued}enqueue(t){this.disabled||(this.queue.push(t),this.queued+=t.size,this.pump())}drop(){let t=this.queue[0]?.summary.seq;for(let r of this.queue.splice(0))this.queued-=r.size;return t}beaconQueued(){for(let t of this.queue.splice(0))this.queued-=t.size,[...t.blobs.keys()].every(r=>this.o.known.has(r))&&this.beacon(t.summary,t.body,t.enc)}beacon(t,r,n){let s=this.o.env.sendBeacon,i=typeof r=="string"?r.length:r.byteLength;if(this.disabled||!s||i>this.o.beaconMaxBytes)return!1;try{return s(this.url("/replay",this.params(t,n,[])),new Blob([r],{type:"text/plain"}))}catch{return!1}}async pump(){if(!this.busy){this.busy=!0;try{for(;!this.disabled&&this.queue.length;){let t=this.queue.shift(),r=await this.send(t);this.queued-=t.size,r==="refused"&&(this.disabled=!0),this.o.onOutcome(t,r)}}finally{this.busy=!1}}}async send(t){for(let r=0;!this.disabled;r++){r>0&&await this.sleep(Math.min(this.o.retryMaxMs,500*2**(r-1)));try{for(let[i,o]of t.blobs){if(this.o.known.has(i))continue;let c=await bt(o),a=await this.post("/replay/blob",{sha:i,enc:c?"gzip":"identity"},c??o);if(a.status>=200&&a.status<300){this.o.known.add(i);continue}let u=Er(a.status);if(u)return u;throw new Error(`blob ${a.status}`)}let n=await this.post("/replay",this.params(t.summary,t.enc,[...t.blobs.keys()]),t.body);if(n.status>=200&&n.status<300)return this.answered=!0,"ok";if(n.status===409){let i=await Is(n);for(let o of i.length?i:t.blobs.keys())this.o.known.forget(o);continue}let s=Er(n.status);if(s)return s}catch{if(!this.answered&&++this.networkFailures>=this.o.noChannelAfter)return"refused"}}return"refused"}params(t,r,n){let s={v:String(1),load:this.o.loadId,tab:this.o.tabId,seq:String(t.seq),t0:String(t.t0),t1:String(t.t1),n:String(t.n),full:t.full?"1":"0",enc:r};if(this.o.app&&(s.app=this.o.app),t.base&&(s.base=t.base),t.anchors.length){let i="";for(let o of t.anchors){if(i.length+o.length+1>Cs){s.am="1";break}i+=(i?",":"")+o}s.a=i}return n.length&&(s.b=n.join(",")),s}url(t,r){let n=new URLSearchParams(this.o.token?{token:this.o.token,...r}:r);return`${this.o.endpoint}${t}?${n.toString()}`}async post(t,r,n){let s=await this.o.env.fetch(this.url(t,r),{method:"POST",headers:{"content-type":"text/plain"},body:n,credentials:"omit",keepalive:(typeof n=="string"?n.length:n.byteLength)<=this.o.beaconMaxBytes}),i=await s.text().catch(()=>"");return{status:s.status,text:async()=>i}}sleep(t){return new Promise(r=>this.o.env.setTimeout(r,t))}};function Er(e){if(e===413)return"too-big";if(e===400||e===401||e===403||e===404||e===405||e===426)return"refused"}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[]}}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}var Ts=()=>`load-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,je=class{constructor(t,r){this.cfg=t;this.env=r;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,...t.limits},this.privacy={...Rr,...t.privacy},this.record=t.record,this.uploader=new $e({endpoint:t.endpoint.replace(/\\/+$/,""),...t.token?{token:t.token}:{},tabId:t.tabId,loadId:this.loadId,...t.app?{app:t.app}:{},env:r,known:new He(this.limits.knownHashes,r.storage),retryMaxMs:this.limits.retryMaxMs,noChannelAfter:this.limits.noChannelAfter,beaconMaxBytes:this.limits.beaconMaxBytes,onOutcome:(n,s)=>this.onOutcome(n,s)})}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(t,r){if(t==="lens/nav"&&this.state==="paused"&&this.resume(),this.state!=="recording")return;let n=yr(t,r);if(n)try{this.record.addCustomEvent(t,n)}catch{}}target(t,r){if(this.state!=="recording")return;let n=Cr(t,r,s=>this.record.mirror.getId(s));n&&this.mark("lens/target",n)}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 t=this.buffer,r=this.takeSummary(t);try{this.uploader.beacon(r,JSON.stringify(t),"identity")}catch{}}stop(){this.state!=="stopped"&&(this.state==="recording"&&this.cut(),this.halt())}begin(){let t=this.privacy;try{this.stopRecord=this.record({emit:r=>this.onEmit(r),checkoutEveryNms:this.limits.checkoutEveryMs,maskAllInputs:t.maskAllInputs,...t.maskAllInputs?{}:{maskInputOptions:{password:!1}},...t.maskTextSelector?{maskTextSelector:t.maskTextSelector}:{},...t.blockSelector?{blockSelector:t.blockSelector}:{},slimDOMOptions:"all",sampling:{mousemove:50,scroll:150,media:800,input:"last"},recordCanvas:!1,collectFonts:!1,errorHandler:()=>!0})}catch{this.halt()}}onEmit(t){if(this.state!=="recording"||this.awaitingCheckout)return;let r=this.env.perf();if(t.type===kr&&this.buffer.length&&this.cut(),t.type===St&&!this.base&&(this.base=t),this.buffer.push(t),this.bufferChars+=ks(t),t.type===Ms){let n=t.data;typeof n.tag=="string"&&n.payload&&typeof n.payload=="object"&&this.bufferAnchors.push(...br(n.tag,n.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()-r)}takeSummary(t){let r={seq:this.seq++,t0:t[0]?.timestamp??0,t1:t[t.length-1]?.timestamp??0,n:t.length,full:t[0]?.type===kr&&t.some(n=>n.type===St),anchors:[...new Set(this.bufferAnchors)]};return this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],r}cut(){if(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),!this.buffer.length)return;let t=this.buffer,r=this.takeSummary(t);this.processing=this.processing.then(()=>this.prepare(r,t)).catch(()=>{})}async prepare(t,r){if(this.uploader.disabled||this.state==="stopped")return;let n=await vr(r,{...this.env.subtle?{subtle:this.env.subtle}:{},blobMinChars:this.limits.blobMinChars,isBase:a=>a===this.base,perf:()=>this.env.perf()});this.spend(n.ms);let s=await bt(n.json),i=s??n.json,o=typeof i=="string"?i.length:i.byteLength;for(let a of n.blobs.values())o+=a.length;let c={summary:n.base?{...t,base:n.base}:t,body:i,enc:s?"gzip":"identity",blobs:n.blobs,size:o};this.uploader.enqueue(c),this.uploader.pendingSize>this.limits.pendingChars&&this.gap("overflow")}onOutcome(t,r){if(r==="refused"){this.halt();return}if(r==="too-big"){this.gap("too-big",t.summary.seq);return}this.awaitingCheckout&&(this.awaitingCheckout=!1,this.checkoutNow())}gap(t,r){if(this.state!=="recording"||this.awaitingCheckout)return;let n=this.uploader.drop();this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.mark("lens/gap",{fromSeq:r??n??this.seq,reason:t}),this.cut(),this.awaitingCheckout=!0,this.publish("replay-gap",`session replay lost a stretch of this page (${t})`,{reason:t,fromSeq:r??n??this.seq})}checkoutNow(){if(this.state!=="recording")return!0;let t=this.env.perf();try{return this.record.takeFullSnapshot(!0),!0}catch{return!1}finally{this.spend(this.env.perf()-t)}}spend(t){let r=this.env.perf();if(r-this.costWindowStart>=1e3&&(this.overSeconds=this.costSpent>this.limits.budgetMsPerSecond?this.overSeconds+1:0,this.costSpent=0,this.costWindowStart=r,this.overSeconds>=this.limits.budgetSeconds)){this.pause();return}this.costSpent+=t}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(t,r,n){try{this.env.publish?.({source:"client-runtime",category:"runtime",severity:"info",title:r,fingerprint:`replay:${t}:${this.loadId}`,raw:{kind:t,loadId:this.loadId,tabId:this.cfg.tabId,...n}})}catch{}}};var 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:(i,o)=>n.mark(i,o),checkpoint:()=>n.checkpoint(),stop:()=>n.stop()};t[wt]=s,n.start();for(let i of As)document.addEventListener(i,o=>n.target(o.target,i),{capture:!0,passive:!0});return window.addEventListener("pagehide",()=>n.pagehide()),s}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:(i,o)=>s?s(i,o):Promise.reject(new Error("no fetch")),...typeof navigator<"u"&&typeof navigator.sendBeacon=="function"?{sendBeacon:(i,o)=>navigator.sendBeacon(i,o)}:{},now:()=>Date.now(),perf:()=>typeof performance<"u"?performance.now():Date.now(),setTimeout:(i,o)=>t.setTimeout(i,o),clearTimeout:i=>t.clearTimeout(i),idle:i=>{typeof t.requestIdleCallback=="function"?t.requestIdleCallback(i,{timeout:2e3}):t.setTimeout(i,50)},...r?{storage:r}:{},...n?{subtle:n}:{},href:()=>t.location.href,viewport:()=>({width:t.innerWidth,height:t.innerHeight}),publish:i=>{let o=t.__LENSMCP_PUBLISH__;typeof o=="function"&&o(i)},...e}}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{}}\n';
|