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