landom-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ (function(se,Ce){typeof exports=="object"&&typeof module!="undefined"?Ce(exports):typeof define=="function"&&define.amd?define(["exports"],Ce):(se=typeof globalThis!="undefined"?globalThis:se||self,Ce(se.LandOm={}))})(this,(function(se){"use strict";const Ce={endpoint:"/api/v1/events",flushInterval:3e3,flushQueueSize:20,maxQueueSize:100,maxRetries:3,enableReplay:!0,replayMaskAllInputs:!0,replayBlockClass:"rr-block",replayBlockSelector:".no-record",replayMaskTextClass:"rr-mask",replayInlineStylesheet:!0,replayCheckoutEveryNms:6e5,replayMousemoveSampling:!1,replayMousemoveCallbackSampling:500,replayScrollSampling:200,replayInputSampling:"last",debug:!1},Pe=()=>{};function _t(e){return e?{log:(...t)=>console.log("[LandOm]",...t),warn:(...t)=>console.warn("[LandOm]",...t)}:{log:Pe,warn:Pe}}function Zt(e){const{endpoint:t,apiKey:r,maxRetries:n,logger:o}=e;function s(d){return d===429||d>=500}const a=6e4;async function i(d){const p=JSON.stringify(d),g=p.length<=a;g||o.warn("\uD398\uC774\uB85C\uB4DC \uD06C\uAE30 \uCD08\uACFC, keepalive \uBE44\uD65C\uC131\uD654:",p.length,"bytes");for(let h=0;h<=n;h++){try{const I=new AbortController,y=setTimeout(()=>I.abort(),1e4),m=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Project-Key":r},body:p,keepalive:g,signal:I.signal});if(clearTimeout(y),m.ok)return o.log("\uC804\uC1A1 \uC644\uB8CC:",d.events.length,"\uAC74"),!0;if(!s(m.status))return o.warn("\uC804\uC1A1 \uC2E4\uD328 (\uC7AC\uC2DC\uB3C4 \uBD88\uAC00):",m.status,m.statusText),!1;o.warn(`\uC804\uC1A1 \uC2E4\uD328 (${m.status}), \uC7AC\uC2DC\uB3C4 ${h+1}/${n}`)}catch(I){o.warn(`\uC804\uC1A1 \uC5D0\uB7EC, \uC7AC\uC2DC\uB3C4 ${h+1}/${n}:`,I)}if(h<n){const I=1e3*2**h;await new Promise(y=>setTimeout(y,I))}}return o.warn("\uCD5C\uB300 \uC7AC\uC2DC\uB3C4 \uCD08\uACFC, \uC804\uC1A1 \uD3EC\uAE30:",d.events.length,"\uAC74"),!1}const l=6e4;function u(d,p){const g=JSON.stringify({...d,apiKey:r,events:[]}).length,h=p-g-8,I=[];let y=[],m=0;for(const f of d.events){const C=JSON.stringify(f).length+1;y.length>0&&m+C>h&&(I.push(y),y=[],m=0),y.push(f),m+=C}return y.length>0&&I.push(y),I}function c(d){const p=u(d,l);for(const g of p){const h=JSON.stringify({...d,apiKey:r,events:g});if(h.length>l){o.warn("sendSync: \uB2E8\uC77C \uCCAD\uD06C\uAC00 sendBeacon \uD55C\uACC4 \uCD08\uACFC, \uB4DC\uB86D:",h.length,"bytes,",g.length,"\uAC74");continue}const I=new Blob([h],{type:"application/json"});navigator.sendBeacon(t,I)?o.log("sendBeacon \uC804\uC1A1:",g.length,"\uAC74"):o.warn("sendBeacon \uC2E4\uD328, \uCCAD\uD06C \uB4DC\uB86D:",g.length,"\uAC74")}}return{send:i,sendSync:c}}const Ne="landom_session";function Vt(){const e=Date.now(),t=new Uint8Array(16);crypto.getRandomValues(t),t[0]=e/2**40&255,t[1]=e/2**32&255,t[2]=e/2**24&255,t[3]=e/2**16&255,t[4]=e/2**8&255,t[5]=e&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128;const r=Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Ut(e){try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return null}}function _e(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(r){}}function Kt(){const e=Date.now(),t={sessionId:Vt(),startedAt:e,lastActivityAt:e};return _e(Ne,t),t}function zt(e){const t=Date.now(),r=t-e.lastActivityAt>18e5,n=t-e.startedAt>864e5;return r||n}function Xe(){const e=Ut(Ne);return e&&!zt(e)?e:Kt()}function De(){const e=Xe();e.lastActivityAt=Date.now(),_e(Ne,e)}function Ht(){const e=Xe();return e.lastActivityAt=Date.now(),_e(Ne,e),e.sessionId}function Yt(e){const{flushInterval:t,flushQueueSize:r,maxQueueSize:n,beforeSend:o,transport:s,logger:a}=e;let i=[],l=null;function u(m){return{sessionId:Ht(),userAgent:navigator.userAgent,url:location.href,events:m}}function c(){if(i.length<=n)return;let m=i.length-n,f=0;const C=[];for(const F of i){if(m>0&&F.type==="replay"){m--,f++;continue}C.push(F)}let b=0;m>0&&(b=Math.min(m,C.length),C.splice(0,b)),i=C,a.warn(`\uD050 \uCD08\uACFC: replay ${f}\uAC74, \uAE30\uD0C0 ${b}\uAC74 \uB4DC\uB86D`)}function d(m){const f=o?o(m):m;if(!f){a.log("beforeSend\uC5D0 \uC758\uD574 \uC81C\uC678\uB428:",m.type);return}i.push(f),c(),i.length>=r&&p()}async function p(){if(i.length===0)return;if(!navigator.onLine){a.log("\uC624\uD504\uB77C\uC778 \uC0C1\uD0DC, \uC804\uC1A1 \uBCF4\uB958:",i.length,"\uAC74");return}const m=i.splice(0),f=u(m);a.log("flush:",m.length,"\uAC74"),await s.send(f)||(i.unshift(...m),c())}function g(){if(i.length===0)return;const m=i.splice(0),f=u(m);a.log("flushSync:",m.length,"\uAC74"),s.sendSync(f)}function h(){a.log("\uC628\uB77C\uC778 \uBCF5\uADC0, \uBCF4\uB958 \uC774\uBCA4\uD2B8 \uC804\uC1A1"),p()}function I(){l===null&&(l=setInterval(p,t),window.addEventListener("online",h),a.log(`\uD050 \uC2DC\uC791 (${t}ms \uAC04\uACA9)`))}function y(){l!==null&&(clearInterval(l),l=null),window.removeEventListener("online",h),p()}return{push:d,flush:p,flushSync:g,start:I,stop:y}}let je,qe,$e;function Qt(e,t,r){je=e,qe=t,$e=r}function ne(){return je}function Jt(){return qe}function et(){return $e}function Pt(){return{setup(){ne().push({type:"start",timestamp:Date.now(),cssSelector:null,payload:{}})},teardown(){}}}function Xt(){function e(){const t=document.visibilityState==="visible";t&&De(),ne().push({type:"visibility",timestamp:Date.now(),cssSelector:null,payload:{isVisible:t}})}return{setup(){document.addEventListener("visibilitychange",e)},teardown(){document.removeEventListener("visibilitychange",e)}}}function jt(e,t){let r=null,n=null;return(...o)=>{n=o,r===null&&(r=setTimeout(()=>{r=null,n&&(e(...n),n=null)},t))}}const qt=500;function $t(){const e=jt(()=>{De();const t=window.scrollY,r=document.documentElement.scrollHeight-window.innerHeight,n=r>0?Math.round(t/r*100)/100:0;ne().push({type:"scroll",timestamp:Date.now(),cssSelector:null,payload:{yOffset:t,percentage:n}})},qt);return{setup(){window.addEventListener("scroll",e,{passive:!0})},teardown(){window.removeEventListener("scroll",e)}}}function Ze(e){if(e.id)return`#${e.id}`;const t=e.tagName.toLowerCase();if(typeof e.className=="string"&&e.className.trim()){const r=e.className.trim().split(/\s+/)[0];return`${t}.${r}`}return t}function Re(e,t=document.body){const r=[],n=t.parentElement;let o=e;for(;o&&o!==n;){const s=o.getAttribute("id");if(s){const l=s.replace(/"/g,'\\"');r.push(`${o.tagName.toLowerCase()}[id="${l}"]`);break}let a=1,i=o.previousElementSibling;for(;i;)i.tagName===o.tagName&&a++,i=i.previousElementSibling;if(r.push(`${o.tagName.toLowerCase()}:nth-of-type(${a})`),o===t)break;o=o.parentElement}return r.reverse().join(" > ")}function er(){function e(t){const r=t.target;r&&(De(),ne().push({type:"click",timestamp:Date.now(),cssSelector:Re(r),payload:{targetId:Ze(r)}}))}return{setup(){document.addEventListener("click",e,{capture:!0})},teardown(){document.removeEventListener("click",e,{capture:!0})}}}const tr=new Set(["INPUT","TEXTAREA","SELECT"]);function rr(){function e(t){const r=t.target;!r||!tr.has(r.tagName)||(De(),ne().push({type:"input",timestamp:Date.now(),cssSelector:Re(r),payload:{fieldId:Ze(r)}}))}return{setup(){document.addEventListener("focus",e,{capture:!0})},teardown(){document.removeEventListener("focus",e,{capture:!0})}}}var O;(function(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"})(O||(O={}));function nr(e){return e.nodeType===e.ELEMENT_NODE}function Ie(e){var t=e==null?void 0:e.host;return(t==null?void 0:t.shadowRoot)===e}function ye(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function or(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Ve(e){try{var t=e.rules||e.cssRules;return t?or(Array.from(t).map(tt).join("")):null}catch(r){return null}}function tt(e){var t=e.cssText;if(ir(e))try{t=Ve(e.styleSheet)||t}catch(r){}return t}function ir(e){return"styleSheet"in e}var rt=(function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var r;if(!t)return-1;var n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n!=null?n:-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(o){return r.removeNodeFromMap(o)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)},e.prototype.replace=function(t,r){var n=this.getNode(t);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e})();function sr(){return new rt}function Ue(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,o=e.value,s=e.maskInputFn,a=o||"";return(t[r.toLowerCase()]||t[n])&&(s?a=s(a):a="*".repeat(a.length)),a}var nt="__rrweb_original__";function ar(e){var t=e.getContext("2d");if(!t)return!0;for(var r=50,n=0;n<e.width;n+=r)for(var o=0;o<e.height;o+=r){var s=t.getImageData,a=nt in s?s[nt]:s,i=new Uint32Array(a.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer);if(i.some(function(l){return l!==0}))return!1}return!0}var lr=1,ur=new RegExp("[^a-z0-9-_:]"),Se=-2;function ot(){return lr++}function cr(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return ur.test(t)?"div":t}function dr(e){return e.cssRules?Array.from(e.cssRules).map(function(t){return t.cssText||""}).join(""):""}function hr(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ue,it,pr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,gr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,fr=/^(data:)([^,]*),(.*)/i;function Ee(e,t){return(e||"").replace(pr,function(r,n,o,s,a,i){var l=o||a||i,u=n||s||"";if(!l)return r;if(!gr.test(l)||fr.test(l))return"url(".concat(u).concat(l).concat(u,")");if(l[0]==="/")return"url(".concat(u).concat(hr(t)+l).concat(u,")");var c=t.split("/"),d=l.split("/");c.pop();for(var p=0,g=d;p<g.length;p++){var h=g[p];h!=="."&&(h===".."?c.pop():c.push(h))}return"url(".concat(u).concat(c.join("/")).concat(u,")")})}var mr=/^[^ \t\n\r\u000c]+/,Cr=/^[, \t\n\r\u000c]+/;function Ir(e,t){if(t.trim()==="")return t;var r=0;function n(u){var c,d=u.exec(t.substring(r));return d?(c=d[0],r+=c.length,c):""}for(var o=[];n(Cr),!(r>=t.length);){var s=n(mr);if(s.slice(-1)===",")s=ce(e,s.substring(0,s.length-1)),o.push(s);else{var a="";s=ce(e,s);for(var i=!1;;){var l=t.charAt(r);if(l===""){o.push((s+a).trim());break}else if(i)l===")"&&(i=!1);else if(l===","){r+=1,o.push((s+a).trim());break}else l==="("&&(i=!0);a+=l,r+=1}}}return o.join(", ")}function ce(e,t){if(!t||t.trim()==="")return t;var r=e.createElement("a");return r.href=t,r.href}function yr(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Ke(){var e=document.createElement("a");return e.href="",e.href}function st(e,t,r,n){return r==="src"||r==="href"&&n&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(t==="table"||t==="td"||t==="th")?ce(e,n):r==="srcset"&&n?Ir(e,n):r==="style"&&n?Ee(n,Ke()):t==="object"&&r==="data"&&n?ce(e,n):n}function Sr(e,t,r){if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var o=e.classList[n];if(t.test(o))return!0}return r?e.matches(r):!1}function Oe(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Oe(e.parentNode,t,r):!1;for(var n=e.classList.length;n--;){var o=e.classList[n];if(t.test(o))return!0}return r?Oe(e.parentNode,t,r):!1}function at(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(n===null)return!1;if(typeof t=="string"){if(n.classList.contains(t)||n.closest(".".concat(t)))return!0}else if(Oe(n,t,!0))return!0;return!!(r&&(n.matches(r)||n.closest(r)))}function vr(e,t,r){var n=e.contentWindow;if(n){var o=!1,s;try{s=n.document.readyState}catch(l){return}if(s!=="complete"){var a=setTimeout(function(){o||(t(),o=!0)},r);e.addEventListener("load",function(){clearTimeout(a),o=!0,t()});return}var i="about:blank";if(n.location.href!==i||e.src===i||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function br(e,t,r){var n=!1,o;try{o=e.sheet}catch(a){return}if(!o){var s=setTimeout(function(){n||(t(),n=!0)},r);e.addEventListener("load",function(){clearTimeout(s),n=!0,t()})}}function Ar(e,t){var r=t.doc,n=t.mirror,o=t.blockClass,s=t.blockSelector,a=t.maskTextClass,i=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=u===void 0?{}:u,d=t.maskTextFn,p=t.maskInputFn,g=t.dataURLOptions,h=g===void 0?{}:g,I=t.inlineImages,y=t.recordCanvas,m=t.keepIframeSrcFn,f=t.newlyAddedElement,C=f===void 0?!1:f,b=wr(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:O.Document,childNodes:[],compatMode:e.compatMode}:{type:O.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:O.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return Mr(e,{doc:r,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:h,inlineImages:I,recordCanvas:y,keepIframeSrcFn:m,newlyAddedElement:C,rootId:b});case e.TEXT_NODE:return kr(e,{maskTextClass:a,maskTextSelector:i,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:O.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:O.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function wr(e,t){if(t.hasNode(e)){var r=t.getId(e);return r===1?void 0:r}}function kr(e,t){var r,n=t.maskTextClass,o=t.maskTextSelector,s=t.maskTextFn,a=t.rootId,i=e.parentNode&&e.parentNode.tagName,l=e.textContent,u=i==="STYLE"?!0:void 0,c=i==="SCRIPT"?!0:void 0;if(u&&l){try{e.nextSibling||e.previousSibling||!((r=e.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(l=dr(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}l=Ee(l,Ke())}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&at(e,n,o)&&(l=s?s(l):l.replace(/[\S]/g,"*")),{type:O.Text,textContent:l||"",isStyle:u,rootId:a}}function Mr(e,t){for(var r=t.doc,n=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,a=t.maskInputOptions,i=a===void 0?{}:a,l=t.maskInputFn,u=t.dataURLOptions,c=u===void 0?{}:u,d=t.inlineImages,p=t.recordCanvas,g=t.keepIframeSrcFn,h=t.newlyAddedElement,I=h===void 0?!1:h,y=t.rootId,m=Sr(e,n,o),f=cr(e),C={},b=e.attributes.length,F=0;F<b;F++){var L=e.attributes[F];C[L.name]=st(r,f,L.name,L.value)}if(f==="link"&&s){var B=Array.from(r.styleSheets).find(function(Y){return Y.href===e.href}),M=null;B&&(M=Ve(B)),M&&(delete C.rel,delete C.href,C._cssText=Ee(M,B.href))}if(f==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var M=Ve(e.sheet);M&&(C._cssText=Ee(M,Ke()))}if(f==="input"||f==="textarea"||f==="select"){var K=e.value,z=e.checked;C.type!=="radio"&&C.type!=="checkbox"&&C.type!=="submit"&&C.type!=="button"&&K?C.value=Ue({type:C.type,tagName:f,value:K,maskInputOptions:i,maskInputFn:l}):z&&(C.checked=z)}if(f==="option"&&(e.selected&&!i.select?C.selected=!0:delete C.selected),f==="canvas"&&p){if(e.__context==="2d")ar(e)||(C.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var J=e.toDataURL(c.type,c.quality),P=document.createElement("canvas");P.width=e.width,P.height=e.height;var X=P.toDataURL(c.type,c.quality);J!==X&&(C.rr_dataURL=J)}}if(f==="img"&&d){ue||(ue=r.createElement("canvas"),it=ue.getContext("2d"));var E=e,H=E.crossOrigin;E.crossOrigin="anonymous";var q=function(){try{ue.width=E.naturalWidth,ue.height=E.naturalHeight,it.drawImage(E,0,0),C.rr_dataURL=ue.toDataURL(c.type,c.quality)}catch(Y){console.warn("Cannot inline img src=".concat(E.currentSrc,"! Error: ").concat(Y))}H?C.crossOrigin=H:E.removeAttribute("crossorigin")};E.complete&&E.naturalWidth!==0?q():E.onload=q}if((f==="audio"||f==="video")&&(C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime),I||(e.scrollLeft&&(C.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(C.rr_scrollTop=e.scrollTop)),m){var ee=e.getBoundingClientRect(),re=ee.width,Z=ee.height;C={class:C.class,rr_width:"".concat(re,"px"),rr_height:"".concat(Z,"px")}}return f==="iframe"&&!g(C.src)&&(e.contentDocument||(C.rr_src=C.src),delete C.src),{type:O.Element,tagName:f,attributes:C,childNodes:[],isSVG:yr(e)||void 0,needBlock:m,rootId:y}}function k(e){return e===void 0?"":e.toLowerCase()}function Tr(e,t){if(t.comment&&e.type===O.Comment)return!0;if(e.type===O.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(k(e.attributes.name).match(/^msapplication-tile(image|color)$/)||k(e.attributes.name)==="application-name"||k(e.attributes.rel)==="icon"||k(e.attributes.rel)==="apple-touch-icon"||k(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&k(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(k(e.attributes.property).match(/^(og|twitter|fb):/)||k(e.attributes.name).match(/^(og|twitter):/)||k(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(k(e.attributes.name)==="robots"||k(e.attributes.name)==="googlebot"||k(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(k(e.attributes.name)==="author"||k(e.attributes.name)==="generator"||k(e.attributes.name)==="framework"||k(e.attributes.name)==="publisher"||k(e.attributes.name)==="progid"||k(e.attributes.property).match(/^article:/)||k(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(k(e.attributes.name)==="google-site-verification"||k(e.attributes.name)==="yandex-verification"||k(e.attributes.name)==="csrf-token"||k(e.attributes.name)==="p:domain_verify"||k(e.attributes.name)==="verify-v1"||k(e.attributes.name)==="verification"||k(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function de(e,t){var r=t.doc,n=t.mirror,o=t.blockClass,s=t.blockSelector,a=t.maskTextClass,i=t.maskTextSelector,l=t.skipChild,u=l===void 0?!1:l,c=t.inlineStylesheet,d=c===void 0?!0:c,p=t.maskInputOptions,g=p===void 0?{}:p,h=t.maskTextFn,I=t.maskInputFn,y=t.slimDOMOptions,m=t.dataURLOptions,f=m===void 0?{}:m,C=t.inlineImages,b=C===void 0?!1:C,F=t.recordCanvas,L=F===void 0?!1:F,B=t.onSerialize,M=t.onIframeLoad,K=t.iframeLoadTimeout,z=K===void 0?5e3:K,J=t.onStylesheetLoad,P=t.stylesheetLoadTimeout,X=P===void 0?5e3:P,E=t.keepIframeSrcFn,H=E===void 0?function(){return!1}:E,q=t.newlyAddedElement,ee=q===void 0?!1:q,re=t.preserveWhiteSpace,Z=re===void 0?!0:re,Y=Ar(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,dataURLOptions:f,inlineImages:b,recordCanvas:L,keepIframeSrcFn:H,newlyAddedElement:ee});if(!Y)return console.warn(e,"not serialized"),null;var ie;n.hasNode(e)?ie=n.getId(e):Tr(Y,y)||!Z&&Y.type===O.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?ie=Se:ie=ot();var D=Object.assign(Y,{id:ie});if(n.add(e,D),ie===Se)return null;B&&B(e);var $=!u;if(D.type===O.Element){$=$&&!D.needBlock,delete D.needBlock;var te=e.shadowRoot;te&&ye(te)&&(D.isShadowHost=!0)}if((D.type===O.Document||D.type===O.Element)&&$){y.headWhitespace&&D.type===O.Element&&D.tagName==="head"&&(Z=!1);for(var me={doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:u,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,slimDOMOptions:y,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:Z,onSerialize:B,onIframeLoad:M,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:H},S=0,G=Array.from(e.childNodes);S<G.length;S++){var V=G[S],T=de(V,me);T&&D.childNodes.push(T)}if(nr(e)&&e.shadowRoot)for(var Q=0,w=Array.from(e.shadowRoot.childNodes);Q<w.length;Q++){var V=w[Q],T=de(V,me);T&&(ye(e.shadowRoot)&&(T.isShadow=!0),D.childNodes.push(T))}}return e.parentNode&&Ie(e.parentNode)&&ye(e.parentNode)&&(D.isShadow=!0),D.type===O.Element&&D.tagName==="iframe"&&vr(e,function(){var U=e.contentDocument;if(U&&M){var Te=de(U,{doc:U,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,slimDOMOptions:y,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:Z,onSerialize:B,onIframeLoad:M,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:H});Te&&M(e,Te)}},z),D.type===O.Element&&D.tagName==="link"&&D.attributes.rel==="stylesheet"&&br(e,function(){if(J){var U=de(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,slimDOMOptions:y,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:Z,onSerialize:B,onIframeLoad:M,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:H});U&&J(e,U)}},X),D}function Nr(e,t){var r=t||{},n=r.mirror,o=n===void 0?new rt:n,s=r.blockClass,a=s===void 0?"rr-block":s,i=r.blockSelector,l=i===void 0?null:i,u=r.maskTextClass,c=u===void 0?"rr-mask":u,d=r.maskTextSelector,p=d===void 0?null:d,g=r.inlineStylesheet,h=g===void 0?!0:g,I=r.inlineImages,y=I===void 0?!1:I,m=r.recordCanvas,f=m===void 0?!1:m,C=r.maskAllInputs,b=C===void 0?!1:C,F=r.maskTextFn,L=r.maskInputFn,B=r.slimDOM,M=B===void 0?!1:B,K=r.dataURLOptions,z=r.preserveWhiteSpace,J=r.onSerialize,P=r.onIframeLoad,X=r.iframeLoadTimeout,E=r.onStylesheetLoad,H=r.stylesheetLoadTimeout,q=r.keepIframeSrcFn,ee=q===void 0?function(){return!1}:q,re=b===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:b===!1?{password:!0}:b,Z=M===!0||M==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:M==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:M===!1?{}:M;return de(e,{doc:e,mirror:o,blockClass:a,blockSelector:l,maskTextClass:c,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:re,maskTextFn:F,maskInputFn:L,slimDOMOptions:Z,dataURLOptions:K,inlineImages:y,recordCanvas:f,preserveWhiteSpace:z,onSerialize:J,onIframeLoad:P,iframeLoadTimeout:X,onStylesheetLoad:E,stylesheetLoadTimeout:H,keepIframeSrcFn:ee,newlyAddedElement:!1})}function x(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const he=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`;let lt={map:{},getId(){return console.error(he),-1},getNode(){return console.error(he),null},removeNodeFromMap(){console.error(he)},has(){return console.error(he),!1},reset(){console.error(he)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(lt=new Proxy(lt,{get(e,t,r){return t==="map"&&console.error(he),Reflect.get(e,t,r)}}));function ve(e,t,r={}){let n=null,o=0;return function(...s){const a=Date.now();!o&&r.leading===!1&&(o=a);const i=t-(a-o),l=this;i<=0||i>t?(n&&(clearTimeout(n),n=null),o=a,e.apply(l,s)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(l,s)},i))}}function Fe(e,t,r,n,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>Fe(e,t,s||{},!0)}function pe(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch(n){return()=>{}}}function ut(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ct(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function W(e,t,r,n){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!o)return!1;if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(Oe(o,t,n))return!0;return!!(r&&(e.matches(r)||n&&o.closest(r)!==null))}function Dr(e,t){return t.getId(e)!==-1}function ze(e,t){return t.getId(e)===Se}function dt(e,t){if(Ie(e))return!1;const r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?dt(e.parentNode,t):!0:!0}function ht(e){return!!e.changedTouches}function Rr(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),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function pt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function gt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function ft(e){return!!(e!=null&&e.shadowRoot)}class Er{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var r;return(r=this.styleIDMap.get(t))!==null&&r!==void 0?r:-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++}}var A=(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))(A||{}),v=(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))(v||{}),He=(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))(He||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{});function mt(e){return"__ln"in e}class Or{constructor(){this.length=0,this.head=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=(r==null?void 0:r.next)||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&mt(t.previousSibling)){const n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&mt(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next&&(r.next.previous=r.previous)):(this.head=r.next,this.head&&(this.head.previous=null)),t.__ln&&delete t.__ln,this.length--)}}const Ct=(e,t)=>`${e}@${t}`;class Fr{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],r=new Or,n=i=>{let l=i,u=Se;for(;u===Se;)l=l&&l.nextSibling,u=l&&this.mirror.getId(l);return u},o=i=>{var l,u,c,d;let p=null;((u=(l=i.getRootNode)===null||l===void 0?void 0:l.call(i))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&i.getRootNode().host&&(p=i.getRootNode().host);let g=p;for(;((d=(c=g==null?void 0:g.getRootNode)===null||c===void 0?void 0:c.call(g))===null||d===void 0?void 0:d.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&g.getRootNode().host;)g=g.getRootNode().host;const h=!this.doc.contains(i)&&(!g||!this.doc.contains(g));if(!i.parentNode||h)return;const I=Ie(i.parentNode)?this.mirror.getId(p):this.mirror.getId(i.parentNode),y=n(i);if(I===-1||y===-1)return r.addNode(i);const m=de(i,{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:f=>{pt(f,this.mirror)&&this.iframeManager.addIframe(f),gt(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),ft(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(f,C)=>{this.iframeManager.attachIframe(f,C),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,C)=>{this.stylesheetManager.attachLinkElement(f,C)}});m&&t.push({parentId:I,nextId:y,node:m})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const i of Array.from(this.movedSet.values()))It(this.removes,i,this.mirror)&&!this.movedSet.has(i.parentNode)||o(i);for(const i of Array.from(this.addedSet.values()))!St(this.droppedSet,i)&&!It(this.removes,i,this.mirror)||St(this.movedSet,i)?o(i):this.droppedSet.add(i);let s=null;for(;r.length;){let i=null;if(s){const l=this.mirror.getId(s.value.parentNode),u=n(s.value);l!==-1&&u!==-1&&(i=s)}if(!i)for(let l=r.length-1;l>=0;l--){const u=r.get(l);if(u){const c=this.mirror.getId(u.value.parentNode);if(n(u.value)===-1)continue;if(c!==-1){i=u;break}else{const p=u.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const g=p.parentNode.host;if(this.mirror.getId(g)!==-1){i=u;break}}}}}if(!i){for(;r.head;)r.removeNode(r.head.value);break}s=i.previous,r.removeNode(i.value),o(i.value)}const a={texts:this.texts.map(i=>({id:this.mirror.getId(i.node),value:i.value})).filter(i=>this.mirror.has(i.id)),attributes:this.attributes.map(i=>({id:this.mirror.getId(i.node),attributes:i.attributes})).filter(i=>this.mirror.has(i.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!ze(t.target,this.mirror))switch(t.type){case"characterData":{const r=t.target.textContent;!W(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:at(t.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let n=t.target.getAttribute(t.attributeName);if(t.attributeName==="value"&&(n=Ue({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),W(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;let o=this.attributes.find(s=>s.node===t.target);if(r.tagName==="IFRAME"&&t.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)t.attributeName="rr_src";else return;if(o||(o={node:t.target,attributes:{}},this.attributes.push(o)),t.attributeName==="style"){const s=this.doc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});const a=o.attributes.style;for(const i of Array.from(r.style)){const l=r.style.getPropertyValue(i),u=r.style.getPropertyPriority(i);(l!==s.style.getPropertyValue(i)||u!==s.style.getPropertyPriority(i))&&(u===""?a[i]=l:a[i]=[l,u])}for(const i of Array.from(s.style))r.style.getPropertyValue(i)===""&&(a[i]=!1)}else o.attributes[t.attributeName]=st(this.doc,r.tagName,t.attributeName,n);break}case"childList":{if(W(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const n=this.mirror.getId(r),o=Ie(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);W(t.target,this.blockClass,this.blockSelector,!1)||ze(r,this.mirror)||!Dr(r,this.mirror)||(this.addedSet.has(r)?(Ye(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||dt(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Ct(n,o)]?Ye(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:Ie(t.target)&&ye(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,r)=>{if(this.mirror.hasNode(t)){if(ze(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Ct(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);W(t,this.blockClass,this.blockSelector,!1)||t.childNodes.forEach(n=>this.genAdds(n))}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].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 Ye(e,t){e.delete(t),t.childNodes.forEach(r=>Ye(e,r))}function It(e,t,r){return e.length===0?!1:yt(e,t,r)}function yt(e,t,r){const{parentNode:n}=t;if(!n)return!1;const o=r.getId(n);return e.some(s=>s.id===o)?!0:yt(e,n,r)}function St(e,t){return e.size===0?!1:vt(e,t)}function vt(e,t){const{parentNode:r}=t;return r?e.has(r)?!0:vt(e,r):!1}const ae=[],bt=typeof CSSGroupingRule!="undefined",At=typeof CSSMediaRule!="undefined",wt=typeof CSSSupportsRule!="undefined",kt=typeof CSSConditionRule!="undefined";function be(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function Mt(e,t){var r,n;const o=new Fr;ae.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const a=(n=(r=window==null?void 0:window.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");a&&window[a]&&(s=window[a]);const i=new s(o.processMutations.bind(o));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Lr({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};const o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],i;const l=ve(d=>{const p=Date.now()-i;e(a.map(g=>(g.timeOffset-=p,g)),d),a=[],i=null},s),u=ve(d=>{const p=be(d),{clientX:g,clientY:h}=ht(d)?d.changedTouches[0]:d;i||(i=Date.now()),a.push({x:g,y:h,id:n.getId(p),timeOffset:Date.now()-i}),l(typeof DragEvent!="undefined"&&d instanceof DragEvent?v.Drag:d instanceof MouseEvent?v.MouseMove:v.TouchMove)},o,{trailing:!1}),c=[x("mousemove",u,r),x("touchmove",u,r),x("drag",u,r)];return()=>{c.forEach(d=>d())}}function Br({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,i=[],l=u=>c=>{const d=be(c);if(W(d,n,o,!0))return;const p=ht(c)?c.changedTouches[0]:c;if(!p)return;const g=r.getId(d),{clientX:h,clientY:I}=p;e({type:He[u],id:g,x:h,y:I})};return Object.keys(He).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{const c=u.toLowerCase(),d=l(u);i.push(x(c,d,t))}),()=>{i.forEach(u=>u())}}function Tt({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){const a=ve(i=>{const l=be(i);if(!l||W(l,n,o,!0))return;const u=r.getId(l);if(l===t){const c=t.scrollingElement||t.documentElement;e({id:u,x:c.scrollLeft,y:c.scrollTop})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})},s.scroll||100);return x("scroll",a,t)}function xr({viewportResizeCb:e}){let t=-1,r=-1;const n=ve(()=>{const o=ut(),s=ct();(t!==o||r!==s)&&(e({width:Number(s),height:Number(o)}),t=o,r=s)},200);return x("resize",n,window)}function Nt(e,t){const r=Object.assign({},e);return t||delete r.userTriggered,r}const Wr=["INPUT","TEXTAREA","SELECT"],Dt=new WeakMap;function Gr({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:s,maskInputOptions:a,maskInputFn:i,sampling:l,userTriggeredOnInput:u}){function c(m){let f=be(m);const C=m.isTrusted;if(f&&f.tagName==="OPTION"&&(f=f.parentElement),!f||!f.tagName||Wr.indexOf(f.tagName)<0||W(f,n,o,!0))return;const b=f.type;if(f.classList.contains(s))return;let F=f.value,L=!1;b==="radio"||b==="checkbox"?L=f.checked:(a[f.tagName.toLowerCase()]||a[b])&&(F=Ue({maskInputOptions:a,tagName:f.tagName,type:b,value:F,maskInputFn:i})),d(f,Nt({text:F,isChecked:L,userTriggered:C},u));const B=f.name;b==="radio"&&B&&L&&t.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(M=>{M!==f&&d(M,Nt({text:M.value,isChecked:!L,userTriggered:!1},u))})}function d(m,f){const C=Dt.get(m);if(!C||C.text!==f.text||C.isChecked!==f.isChecked){Dt.set(m,f);const b=r.getId(m);e(Object.assign(Object.assign({},f),{id:b}))}}const g=(l.input==="last"?["change"]:["input","change"]).map(m=>x(m,c,t)),h=t.defaultView;if(!h)return()=>{g.forEach(m=>m())};const I=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),y=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return I&&I.set&&g.push(...y.map(m=>Fe(m[0],m[1],{set(){c({target:this})}},!1,h))),()=>{g.forEach(m=>m())}}function Le(e){const t=[];function r(n,o){if(bt&&n.parentRule instanceof CSSGroupingRule||At&&n.parentRule instanceof CSSMediaRule||wt&&n.parentRule instanceof CSSSupportsRule||kt&&n.parentRule instanceof CSSConditionRule){const a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a)}else if(n.parentStyleSheet){const a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a)}return o}return r(e,t)}function oe(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function _r({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){const o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(c,d){const{id:p,styleId:g}=oe(this,t,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&e({id:p,styleId:g,adds:[{rule:c,index:d}]}),o.apply(this,[c,d])};const s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(c){const{id:d,styleId:p}=oe(this,t,r.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,removes:[{index:c}]}),s.apply(this,[c])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(c){const{id:d,styleId:p}=oe(this,t,r.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,replace:c}),a.apply(this,[c])});let i;n.CSSStyleSheet.prototype.replaceSync&&(i=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(c){const{id:d,styleId:p}=oe(this,t,r.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,replaceSync:c}),i.apply(this,[c])});const l={};bt?l.CSSGroupingRule=n.CSSGroupingRule:(At&&(l.CSSMediaRule=n.CSSMediaRule),kt&&(l.CSSConditionRule=n.CSSConditionRule),wt&&(l.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=function(p,g){const{id:h,styleId:I}=oe(this.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||I&&I!==-1)&&e({id:h,styleId:I,adds:[{rule:p,index:[...Le(this),g||0]}]}),u[c].insertRule.apply(this,[p,g])},d.prototype.deleteRule=function(p){const{id:g,styleId:h}=oe(this.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||h&&h!==-1)&&e({id:g,styleId:h,removes:[{index:[...Le(this),p]}]}),u[c].deleteRule.apply(this,[p])}}),()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=s,a&&(n.CSSStyleSheet.prototype.replace=a),i&&(n.CSSStyleSheet.prototype.replaceSync=i),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})}}function Rt({mirror:e,stylesheetManager:t},r){var n,o,s;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(r.host);const i=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(s=(o=r.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,l=Object.getOwnPropertyDescriptor(i==null?void 0:i.prototype,"adoptedStyleSheets");return a===null||a===-1||!i||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)===null||u===void 0?void 0:u.call(this)},set(u){var c;const d=(c=l.set)===null||c===void 0?void 0:c.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch(p){}return d}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})}function Zr({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(i,l,u){var c;if(r.has(i))return s.apply(this,[i,l,u]);const{id:d,styleId:p}=oe((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,n.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,set:{property:i,value:l,priority:u},index:Le(this.parentRule)}),s.apply(this,[i,l,u])};const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(i){var l;if(r.has(i))return a.apply(this,[i]);const{id:u,styleId:c}=oe((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return(u&&u!==-1||c&&c!==-1)&&e({id:u,styleId:c,remove:{property:i},index:Le(this.parentRule)}),a.apply(this,[i])},()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a}}function Vr({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o}){const s=i=>ve(l=>{const u=be(l);if(!u||W(u,t,r,!0))return;const{currentTime:c,volume:d,muted:p,playbackRate:g}=u;e({type:i,id:n.getId(u),currentTime:c,volume:d,muted:p,playbackRate:g})},o.media||500),a=[x("play",s(0)),x("pause",s(1)),x("seeked",s(2)),x("volumechange",s(3)),x("ratechange",s(4))];return()=>{a.forEach(i=>i())}}function Ur({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(l,u,c){const d=new s(l,u,c);return o.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=pe(t.fonts,"add",function(i){return function(l){return setTimeout(()=>{const u=o.get(l);u&&(e(u),o.delete(l))},0),i.apply(this,[l])}});return n.push(()=>{r.FontFace=s}),n.push(a),()=>{n.forEach(i=>i())}}function Kr(e){const{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:s}=e;let a=!0;const i=()=>{const l=t.getSelection();if(!l||a&&(l!=null&&l.isCollapsed))return;a=l.isCollapsed||!1;const u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){const p=l.getRangeAt(d),{startContainer:g,startOffset:h,endContainer:I,endOffset:y}=p;W(g,n,o,!0)||W(I,n,o,!0)||u.push({start:r.getId(g),startOffset:h,end:r.getId(I),endOffset:y})}s({ranges:u})};return i(),x("selectionchange",i)}function zr(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:i,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:p,selectionCb:g}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),r(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),n(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),o(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),s(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),i(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),l(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),u(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),c(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),d(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),p(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),g(...h)}}function Hr(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};zr(e,t);const n=Mt(e,e.doc),o=Lr(e),s=Br(e),a=Tt(e),i=xr(e),l=Gr(e),u=Vr(e),c=_r(e,{win:r}),d=Rt(e,e.doc),p=Zr(e,{win:r}),g=e.collectFonts?Ur(e):()=>{},h=Kr(e),I=[];for(const y of e.plugins)I.push(y.observer(y.callback,r,y.options));return()=>{ae.forEach(y=>y.reset()),n.disconnect(),o(),s(),a(),i(),l(),u(),c(),d(),p(),g(),h(),I.forEach(y=>y())}}class Et{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,r,n,o){const s=n||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t);let i=s.get(r);return i||(i=this.generateIdFn(),s.set(r,i),a.set(i,r)),i}getIds(t,r){const n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,o))}getRemoteId(t,r,n){const o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const s=o.get(r);return s||-1}getRemoteIds(t,r){const n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,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}}class Yr{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Et(ot),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Et(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;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)===null||n===void 0||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){if(t.data.type==="rrweb"){if(!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const o=this.transformCrossOriginEvent(n,t.data.event);o&&this.wrappedEmit(o,t.data.isCheckout)}}transformCrossOriginEvent(t,r){var n;switch(r.type){case A.FullSnapshot:return this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t),{timestamp:r.timestamp,type:A.IncrementalSnapshot,data:{source:v.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case A.Meta:case A.Load:case A.DomContentLoaded:return!1;case A.Plugin:return r;case A.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case A.IncrementalSnapshot:switch(r.data.source){case v.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case v.Drag:case v.TouchMove:case v.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case v.ViewportResize:return!1;case v.MediaInteraction:case v.MouseInteraction:case v.Scroll:case v.CanvasMutation:case v.Input:return this.replaceIds(r.data,t,["id"]),r;case v.StyleSheetRule:case v.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case v.Font:return r;case v.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case v.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}}replace(t,r,n,o){for(const s of o)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}}class Qr{constructor(t){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror;const r=this;this.restorePatches.push(pe(Element.prototype,"attachShadow",function(n){return function(o){const s=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),s}}))}addShadowRoot(t,r){ye(t)&&(this.shadowDoms.has(t)||(this.shadowDoms.add(t),Mt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),Tt(Object.assign(Object.assign({},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(t.host)),Rt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)},0)))}observeAttachShadow(t){if(t.contentWindow){const r=this;this.restorePatches.push(pe(t.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(o){const s=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,t.contentDocument),s}}))}}reset(){this.restorePatches.forEach(t=>t()),this.shadowDoms=new WeakSet}}/*! *****************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */function Jr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function Pr(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function i(c){try{u(n.next(c))}catch(d){a(d)}}function l(c){try{u(n.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):o(c.value).then(i,l)}u((n=n.apply(e,[])).next())})}for(var fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xr=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Be=0;Be<fe.length;Be++)Xr[fe.charCodeAt(Be)]=Be;var jr=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=fe[t[r]>>2],o+=fe[(t[r]&3)<<4|t[r+1]>>4],o+=fe[(t[r+1]&15)<<2|t[r+2]>>6],o+=fe[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const Ot=new Map;function qr(e,t){let r=Ot.get(e);return r||(r=new Map,Ot.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const Ft=(e,t,r)=>{if(!e||!(Bt(e,t)||typeof e=="object"))return;const n=e.constructor.name,o=qr(r,n);let s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function xe(e,t,r){if(e instanceof Array)return e.map(n=>xe(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){const n=e.constructor.name,o=jr(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[xe(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){const n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[xe(e.data,t,r),e.width,e.height]};if(Bt(e,t)||typeof e=="object"){const n=e.constructor.name,o=Ft(e,t,r);return{rr_type:n,index:o}}}}return e}const Lt=(e,t,r)=>[...e].map(n=>xe(n,t,r)),Bt=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function $r(e,t,r,n){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const i=pe(t.CanvasRenderingContext2D.prototype,a,function(l){return function(...u){return W(this.canvas,r,n,!0)||setTimeout(()=>{const c=Lt([...u],t,this);e(this.canvas,{type:ge["2D"],property:a,args:c})},0),l.apply(this,u)}});o.push(i)}catch(i){const l=Fe(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:ge["2D"],property:a,args:[u],setter:!0})}});o.push(l)}return()=>{o.forEach(a=>a())}}function xt(e,t,r){const n=[];try{const o=pe(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...i){return W(this,t,r,!0)||"__context"in this||(this.__context=a),s.apply(this,[a,...i])}});n.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(o=>o())}}function Wt(e,t,r,n,o,s,a){const i=[],l=Object.getOwnPropertyNames(e);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const c=pe(e,u,function(d){return function(...p){const g=d.apply(this,p);if(Ft(g,a,this),!W(this.canvas,n,o,!0)){const h=Lt([...p],a,this),I={type:t,property:u,args:h};r(this.canvas,I)}return g}});i.push(c)}catch(c){const d=Fe(e,u,{set(p){r(this.canvas,{type:t,property:u,args:[p],setter:!0})}});i.push(d)}return i}function en(e,t,r,n,o){const s=[];return s.push(...Wt(t.WebGLRenderingContext.prototype,ge.WebGL,e,r,n,o,t)),typeof t.WebGL2RenderingContext!="undefined"&&s.push(...Wt(t.WebGL2RenderingContext.prototype,ge.WebGL2,e,r,n,o,t)),()=>{s.forEach(a=>a())}}var Gt=null;try{var tn=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof require=="function"&&require("worker_threads");Gt=tn.Worker}catch(e){}function rn(e,t){return Buffer.from(e,"base64").toString("utf8")}function nn(e,t,r){var n=rn(e),o=n.indexOf(`
17
+ `,10)+1,s=n.substring(o)+"";return function(i){return new Gt(s,Object.assign({},i,{eval:!0}))}}function on(e,t){var r=atob(e);return r}function sn(e,t,r){var n=on(e),o=n.indexOf(`
18
+ `,10)+1,s=n.substring(o)+"",a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}function an(e,t,r){var n;return function(s){return n=n||sn(e),new Worker(n,s)}}var ln=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function un(){return ln}function cn(e,t,r){return un()?nn(e):an(e)}var dn=cn("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");class hn{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)};const{sampling:r="all",win:n,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:i}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,s,{dataURLOptions:i})}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,o,s){const a=xt(r,n,o),i=new Map,l=new dn;l.onmessage=h=>{const{id:I}=h.data;if(i.set(I,!1),!("base64"in h.data))return;const{base64:y,type:m,width:f,height:C}=h.data;this.mutationCb({id:I,type:ge["2D"],commands:[{property:"clearRect",args:[0,0,f,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:m}]},0,0]}]})};const u=1e3/t;let c=0,d;const p=()=>{const h=[];return r.document.querySelectorAll("canvas").forEach(I=>{W(I,n,o,!0)||h.push(I)}),h},g=h=>{if(c&&h-c<u){d=requestAnimationFrame(g);return}c=h,p().forEach(I=>Pr(this,void 0,void 0,function*(){var y;const m=this.mirror.getId(I);if(i.get(m))return;if(i.set(m,!0),["webgl","webgl2"].includes(I.__context)){const C=I.getContext(I.__context);((y=C==null?void 0:C.getContextAttributes())===null||y===void 0?void 0:y.preserveDrawingBuffer)===!1&&(C==null||C.clear(C.COLOR_BUFFER_BIT))}const f=yield createImageBitmap(I);l.postMessage({id:m,bitmap:f,width:I.width,height:I.height,dataURLOptions:s.dataURLOptions},[f])})),d=requestAnimationFrame(g)};d=requestAnimationFrame(g),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=xt(t,r,n),s=$r(this.processMutation.bind(this),t,r,n),a=en(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const o=n.map(a=>Jr(a,["type"])),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}}class pn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Er,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;const n={id:r,styleIds:[]},o=[];for(const s of t){let a;if(this.styleMirror.has(s))a=this.styleMirror.getId(s);else{a=this.styleMirror.add(s);const i=Array.from(s.rules||CSSRule);o.push({styleId:a,rules:i.map((l,u)=>({rule:tt(l),index:u}))})}n.styleIds.push(a)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}function R(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let N,We,Qe,Ge=!1;const j=sr();function Ae(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",maskTextClass:i="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:c,maskInputOptions:d,slimDOMOptions:p,maskInputFn:g,maskTextFn:h,hooks:I,packFn:y,sampling:m={},dataURLOptions:f={},mousemoveWait:C,recordCanvas:b=!1,recordCrossOriginIframes:F=!1,userTriggeredOnInput:L=!1,collectFonts:B=!1,inlineImages:M=!1,plugins:K,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:J=new Set([])}=e,P=F?window.parent===window:!0;let X=!1;if(!P)try{window.parent.document,X=!1}catch(S){X=!0}if(P&&!t)throw new Error("emit function is required");C!==void 0&&m.mousemove===void 0&&(m.mousemove=C),j.reset();const E=c===!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!==void 0?d:{password:!0},H=p===!0||p==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all"}:p||{};Rr();let q,ee=0;const re=S=>{for(const G of K||[])G.eventProcessor&&(S=G.eventProcessor(S));return y&&(S=y(S)),S};N=(S,G)=>{var V;if(!((V=ae[0])===null||V===void 0)&&V.isFrozen()&&S.type!==A.FullSnapshot&&!(S.type===A.IncrementalSnapshot&&S.data.source===v.Mutation)&&ae.forEach(T=>T.unfreeze()),P)t==null||t(re(S),G);else if(X){const T={type:"rrweb",event:re(S),isCheckout:G};window.parent.postMessage(T,"*")}if(S.type===A.FullSnapshot)q=S,ee=0;else if(S.type===A.IncrementalSnapshot){if(S.data.source===v.Mutation&&S.data.isAttachIframe)return;ee++;const T=n&&ee>=n,Q=r&&S.timestamp-q.timestamp>r;(T||Q)&&We(!0)}};const Z=S=>{N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.Mutation},S)}))},Y=S=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.Scroll},S)})),ie=S=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.CanvasMutation},S)})),D=S=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.AdoptedStyleSheet},S)})),$=new pn({mutationCb:Z,adoptedStyleSheetCb:D}),te=new Yr({mirror:j,mutationCb:Z,stylesheetManager:$,recordCrossOriginIframes:F,wrappedEmit:N});for(const S of K||[])S.getMirror&&S.getMirror({nodeMirror:j,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});Qe=new hn({recordCanvas:b,mutationCb:ie,win:window,blockClass:o,blockSelector:s,mirror:j,sampling:m.canvas,dataURLOptions:f});const me=new Qr({mutationCb:Z,scrollCb:Y,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:E,dataURLOptions:f,maskTextFn:h,maskInputFn:g,recordCanvas:b,inlineImages:M,sampling:m,slimDOMOptions:H,iframeManager:te,stylesheetManager:$,canvasManager:Qe,keepIframeSrcFn:z},mirror:j});We=(S=!1)=>{var G,V,T,Q,w,U;N(R({type:A.Meta,data:{href:window.location.href,width:ct(),height:ut()}}),S),$.reset(),ae.forEach(_=>_.lock());const Te=Nr(document,{mirror:j,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:E,maskTextFn:h,slimDOM:H,dataURLOptions:f,recordCanvas:b,inlineImages:M,onSerialize:_=>{pt(_,j)&&te.addIframe(_),gt(_,j)&&$.trackLinkElement(_),ft(_)&&me.addShadowRoot(_.shadowRoot,document)},onIframeLoad:(_,Je)=>{te.attachIframe(_,Je),me.observeAttachShadow(_)},onStylesheetLoad:(_,Je)=>{$.attachLinkElement(_,Je)},keepIframeSrcFn:z});if(!Te)return console.warn("Failed to snapshot the document");N(R({type:A.FullSnapshot,data:{node:Te,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((V=(G=document==null?void 0:document.body)===null||G===void 0?void 0:G.parentElement)===null||V===void 0?void 0:V.scrollLeft)||((T=document==null?void 0:document.body)===null||T===void 0?void 0:T.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((w=(Q=document==null?void 0:document.body)===null||Q===void 0?void 0:Q.parentElement)===null||w===void 0?void 0:w.scrollTop)||((U=document==null?void 0:document.body)===null||U===void 0?void 0:U.scrollTop)||0}}})),ae.forEach(_=>_.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,j.getId(document))};try{const S=[];S.push(x("DOMContentLoaded",()=>{N(R({type:A.DomContentLoaded,data:{}}))}));const G=T=>{var Q;return Hr({mutationCb:Z,mousemoveCb:(w,U)=>N(R({type:A.IncrementalSnapshot,data:{source:U,positions:w}})),mouseInteractionCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.MouseInteraction},w)})),scrollCb:Y,viewportResizeCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.ViewportResize},w)})),inputCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.Input},w)})),mediaInteractionCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.MediaInteraction},w)})),styleSheetRuleCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.StyleSheetRule},w)})),styleDeclarationCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.StyleDeclaration},w)})),canvasMutationCb:ie,fontCb:w=>N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.Font},w)})),selectionCb:w=>{N(R({type:A.IncrementalSnapshot,data:Object.assign({source:v.Selection},w)}))},blockClass:o,ignoreClass:a,maskTextClass:i,maskTextSelector:l,maskInputOptions:E,inlineStylesheet:u,sampling:m,recordCanvas:b,inlineImages:M,userTriggeredOnInput:L,collectFonts:B,doc:T,maskInputFn:g,maskTextFn:h,keepIframeSrcFn:z,blockSelector:s,slimDOMOptions:H,dataURLOptions:f,mirror:j,iframeManager:te,stylesheetManager:$,shadowDomManager:me,canvasManager:Qe,ignoreCSSAttributes:J,plugins:((Q=K==null?void 0:K.filter(w=>w.observer))===null||Q===void 0?void 0:Q.map(w=>({observer:w.observer,options:w.options,callback:U=>N(R({type:A.Plugin,data:{plugin:w.name,payload:U}}))})))||[]},I)};te.addLoadListener(T=>{S.push(G(T.contentDocument))});const V=()=>{We(),S.push(G(document)),Ge=!0};return document.readyState==="interactive"||document.readyState==="complete"?V():S.push(x("load",()=>{N(R({type:A.Load,data:{}})),V()},window)),()=>{S.forEach(T=>T()),Ge=!1}}catch(S){console.warn(S)}}Ae.addCustomEvent=(e,t)=>{if(!Ge)throw new Error("please add custom event after start recording");N(R({type:A.Custom,data:{tag:e,payload:t}}))},Ae.freezePage=()=>{ae.forEach(e=>e.freeze())},Ae.takeFullSnapshot=e=>{if(!Ge)throw new Error("please take full snapshot after start recording");We(e)},Ae.mirror=j;function gn(e){let t="";for(let r=0;r<e.length;r+=32768){const n=e.subarray(r,r+32768);t+=String.fromCharCode(...n)}return btoa(t)}async function fn(e){const t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip")),r=await new Response(t).arrayBuffer();return new Uint8Array(r)}async function mn(e,t){const r=await fn(JSON.stringify({event:e,isCheckout:t,version:"rrweb"}));return{compressed:!0,compression:"gzip",encoding:"base64",data:gn(r),version:"rrweb"}}function Cn(){let e;return{setup(){const t=Jt(),r=et();e=Ae({emit(n,o){mn(n,!!o).then(s=>{var a;const i={type:"replay",timestamp:(a=n.timestamp)!=null?a:Date.now(),cssSelector:null,payload:s};ne().push(i)}).catch(s=>{r.warn("rrweb payload \uC555\uCD95 \uC2E4\uD328, \uC774\uBCA4\uD2B8 \uB4DC\uB86D:",s)})},maskAllInputs:t.replayMaskAllInputs,blockClass:t.replayBlockClass,blockSelector:t.replayBlockSelector,maskTextClass:t.replayMaskTextClass,maskTextSelector:t.replayMaskTextSelector,slimDOMOptions:"all",inlineStylesheet:t.replayInlineStylesheet,checkoutEveryNms:t.replayCheckoutEveryNms,sampling:{mousemove:t.replayMousemoveSampling,mousemoveCallback:t.replayMousemoveCallbackSampling,scroll:t.replayScrollSampling,input:t.replayInputSampling}}),e?r.log("rrweb \uB9AC\uD50C\uB808\uC774 \uC218\uC9D1 \uC2DC\uC791"):r.warn("rrweb \uB9AC\uD50C\uB808\uC774 \uC218\uC9D1\uC744 \uC2DC\uC791\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.")},teardown(){e&&(e(),e=void 0,et().log("rrweb \uB9AC\uD50C\uB808\uC774 \uC218\uC9D1 \uC885\uB8CC"))}}}const In=5e3;function yn(){let e=null,t=null,r=null;return{setup(){e=new IntersectionObserver(n=>{for(const o of n)o.isIntersecting&&o.target.id&&(r=o.target)},{threshold:.3}),document.querySelectorAll("section[id]").forEach(n=>e.observe(n)),t=setInterval(()=>{r&&ne().push({type:"ping",timestamp:Date.now(),cssSelector:Re(r),payload:{sectionId:r.id}})},In)},teardown(){e&&(e.disconnect(),e=null),t!==null&&(clearInterval(t),t=null),r=null}}}function Sn(){let e=!1,t=0;function r(){const s=document.documentElement.scrollHeight-window.innerHeight;if(s<=0)return;const a=Math.round(window.scrollY/s*100);a>t&&(t=a)}function n(){if(e)return;e=!0,r();const s=document.elementFromPoint(window.innerWidth/2,window.innerHeight-1),a=s?Ze(s):"unknown",i=ne();i.push({type:"exit",timestamp:Date.now(),cssSelector:s?Re(s):null,payload:{lastElementId:a,maxDepth:t}}),i.flushSync()}function o(){document.visibilityState==="hidden"&&n()}return{setup(){window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("beforeunload",n),document.addEventListener("visibilitychange",o)},teardown(){window.removeEventListener("scroll",r),window.removeEventListener("beforeunload",n),document.removeEventListener("visibilitychange",o),e=!1,t=0}}}let we=!1,le,ke,Me=[];function vn(e){if(we){console.warn("[LandOm] \uC774\uBBF8 \uCD08\uAE30\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");return}const t={...Ce,...e};le=_t(t.debug);const r=Zt({endpoint:t.endpoint,apiKey:t.apiKey,maxRetries:t.maxRetries,logger:le});ke=Yt({flushInterval:t.flushInterval,flushQueueSize:t.flushQueueSize,maxQueueSize:t.maxQueueSize,beforeSend:t.beforeSend,transport:r,logger:le}),Qt(ke,t,le),ke.start(),we=!0;const n=[Pt(),Xt(),$t(),er(),rr(),yn(),Sn()];t.enableReplay&&n.splice(5,0,Cn()),bn(n),le.log("SDK \uCD08\uAE30\uD654 \uC644\uB8CC",t)}function bn(e){Me=e,Me.forEach(t=>t.setup()),le.log(`\uC218\uC9D1\uAE30 ${Me.length}\uAC1C \uB4F1\uB85D`)}function An(e,t={}){if(!we){console.warn("[LandOm] \uCD08\uAE30\uD654 \uC804\uC5D0\uB294 capture\uB97C \uD638\uCD9C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return}const r={type:e,timestamp:Date.now(),cssSelector:null,payload:t};ke.push(r)}function wn(){we&&(Me.forEach(e=>e.teardown()),Me=[],ke.stop(),we=!1,le.log("SDK \uC885\uB8CC"))}se.capture=An,se.destroy=wn,se.init=vn}));
19
+ //# sourceMappingURL=landom-sdk.umd.js.map