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