alphana-sdk 1.8.0 → 2.0.2

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.
@@ -1,8 +1,72 @@
1
- "use strict";var AlphanaSDK=(()=>{var pt=Object.defineProperty;var Wr=Object.getOwnPropertyDescriptor;var Ur=Object.getOwnPropertyNames;var Gr=Object.prototype.hasOwnProperty;var ft=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Vr=(t,e)=>{for(var r in e)pt(t,r,{get:e[r],enumerable:!0})},Hr=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ur(e))!Gr.call(t,n)&&n!==r&&pt(t,n,{get:()=>e[n],enumerable:!(i=Wr(e,n))||i.enumerable});return t};var Zr=t=>Hr(pt({},"__esModule",{value:!0}),t);var rn={};Vr(rn,{ALPHANA_SDK_VERSION:()=>Ge,DEFAULT_ENDPOINT:()=>Bt,LogCapture:()=>we,UserTracker:()=>_e,command:()=>Ut,getTracker:()=>$i,init:()=>Wt,renderHeatmap:()=>Qt});function We(t){return t.replace(/\/events\/?$/,"")}function Ue(t){return`${We(t)}/collect`}function mt(t,e){return{...e.appId?{appId:e.appId}:{},visitorId:e.visitorId,events:t.map(r=>({sessionId:e.sessionId,type:r.type,data:r.data}))}}function gt(t){return{...t.appId?{appId:t.appId}:{},visitorId:t.visitorId,heartbeat:{sessionId:t.sessionId,visitorId:t.visitorId,path:t.path,active:t.active,...t.appId?{appId:t.appId}:{}}}}function Gt(t){return{...t.appId?{appId:t.appId}:{},log:t}}var yt="application/x-alphana-gzip";function Kr(){return typeof CompressionStream!="undefined"}async function Vt(t){if(!Kr())return null;try{let e=new TextEncoder().encode(t),r=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(r).arrayBuffer())}catch(e){return null}}var Kt=1024;async function Ht(t,e,r=!1){var s;let i=(s=e.compressionThresholdBytes)!=null?s:Kt;if(!r&&e.compressPayloads!==!1&&t.length>=i){let a=await Vt(t);if(a)return{codec:"gzip",body:a,contentType:yt}}return{codec:"json",body:t,contentType:"application/json"}}async function Zt(t,e,r){var n,s;let i={"Content-Type":e.contentType,...e.codec==="gzip"?{Accept:yt}:{},...(n=r.authHeaders)!=null?n:{}};return fetch(t,{method:"POST",headers:i,body:e.body,keepalive:(s=r.keepalive)!=null?s:!1})}async function fe(t,e,r={}){try{let i=await Ht(e,r),n=await Zt(t,i,r);if(i.codec==="gzip"&&(n.status===415||n.status===400)){let s=await Ht(e,r,!0);n=await Zt(t,s,r)}}catch(i){}}function vt(t,e,r={}){var s,a;let i=(s=r.compressionThresholdBytes)!=null?s:Kt;if(r.compressPayloads!==!1&&e.length>=i||Object.keys((a=r.authHeaders)!=null?a:{}).length>0){fe(t,e,{...r,keepalive:!0});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let o=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,o))return}fe(t,e,{...r,keepalive:!0})}var we=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=!1;var r,i,n;this.collectUrl=(r=e.collectEndpoint)!=null?r:Ue(e.endpoint),this.sessionId=e.sessionId,this.appId=e.appId,this.authHeaders=e.secretKey?{Authorization:`Bearer ${e.secretKey}`}:{},this.compressPayloads=(i=e.compressPayloads)!=null?i:!0,this.compressionThresholdBytes=(n=e.compressionThresholdBytes)!=null?n:1024}init(){typeof window=="undefined"||this.initialized||(this.origInfo=console.info.bind(console),this.origWarn=console.warn.bind(console),this.origError=console.error.bind(console),console.info=(...e)=>{this.origInfo(...e),this.send("info",this.format(e))},console.warn=(...e)=>{this.origWarn(...e),this.send("warn",this.format(e))},console.error=(...e)=>{this.origError(...e);let[r]=e,i=r instanceof Error?r.stack:void 0;this.send("error",this.format(e),{stack:i})},this.prevOnError=window.onerror,window.onerror=(e,r,i,n,s)=>(this.send("error",String(e),{stack:s==null?void 0:s.stack,meta:{src:r,line:i,col:n}}),typeof this.prevOnError=="function"?this.prevOnError(e,r,i,n,s):!1),this.prevOnUnhandledRejection=e=>{let r=e.reason,i=r instanceof Error?r.message:String(r!=null?r:"Unhandled promise rejection");this.send("error",i,{stack:r instanceof Error?r.stack:void 0})},window.addEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!0)}destroy(){this.initialized&&(console.info=this.origInfo,console.warn=this.origWarn,console.error=this.origError,window.onerror=this.prevOnError,this.prevOnUnhandledRejection&&window.removeEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!1)}capture(e,r,i){this.send(e,r,i)}format(e){return e.map(r=>{if(r instanceof Error)return r.message;if(typeof r=="object")try{return JSON.stringify(r)}catch(i){return String(r)}return String(r)}).join(" ")}send(e,r,i){let n={sessionId:this.sessionId,...this.appId?{appId:this.appId}:{},level:e,message:r,url:typeof window!="undefined"?window.location.href:void 0,stack:i==null?void 0:i.stack,meta:i==null?void 0:i.meta,timestamp:Date.now()},s=JSON.stringify(Gt(n));fe(this.collectUrl,s,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:!0}).catch(a=>{this.origError&&this.origError("[user-tracker] Failed to send log:",a)})}};var Ge="1.0.2";function zt(t){var r,i;let e=t.toLowerCase();return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|android|iphone|ipod|windows phone/i.test(e)?"mobile":typeof navigator!="undefined"&&navigator.maxTouchPoints>0&&typeof window!="undefined"&&((i=(r=window.matchMedia)==null?void 0:r.call(window,"(pointer: coarse)"))==null?void 0:i.matches)&&/macintosh|mac os x/i.test(e)?"tablet":"desktop"}function zr(t){return/windows/i.test(t)?"Windows":/android/i.test(t)?"Android":/iphone|ipad|ipod/i.test(t)?"iOS":/mac os x|macintosh/i.test(t)?"macOS":/linux/i.test(t)?"Linux":"Other"}function Yr(t){return/edg\//i.test(t)?"Edge":/opr\/|opera/i.test(t)?"Opera":/chrome\/[0-9]/i.test(t)&&!/chromium/i.test(t)?"Chrome":/firefox\/[0-9]/i.test(t)?"Firefox":/safari\/[0-9]/i.test(t)&&!/chrome/i.test(t)?"Safari":"Other"}function Jr(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function Qr(t,e){var i;let r=((i=e.platform)!=null?i:"").toLowerCase();return r==="ios"||r==="ipados"||r==="android"?e.mobile?"mobile":"tablet":e.mobile===!0?"mobile":zt(t)}function Yt(t){var o,c,l,d,u,p,m,h,y,I,v,f;if(typeof window=="undefined"||typeof navigator=="undefined")return{sessionId:t,timestamp:Date.now(),device:"desktop",os:"Other",browser:"Other",language:"",languages:[],colorScheme:"",screenWidth:0,screenHeight:0,viewportWidth:0,viewportHeight:0,devicePixelRatio:1,timeZone:"",sdkVersion:Ge};let e=navigator.userAgent||"",r=Jr(),i=r.mobile!==void 0||r.platform?Qr(e,r):zt(e),n="";(c=(o=window.matchMedia)==null?void 0:o.call(window,"(prefers-color-scheme: dark)"))!=null&&c.matches?n="dark":(d=(l=window.matchMedia)==null?void 0:l.call(window,"(prefers-color-scheme: light)"))!=null&&d.matches&&(n="light");let s="";try{s=(u=Intl.DateTimeFormat().resolvedOptions().timeZone)!=null?u:""}catch(g){s=""}let a=typeof navigator.languages!="undefined"&&navigator.languages.length?[...navigator.languages]:navigator.language?[navigator.language]:[];return{sessionId:t,timestamp:Date.now(),device:i,os:zr(e),browser:Yr(e),language:navigator.language||"",languages:a,colorScheme:n,screenWidth:(m=(p=window.screen)==null?void 0:p.width)!=null?m:0,screenHeight:(y=(h=window.screen)==null?void 0:h.height)!=null?y:0,viewportWidth:(I=window.innerWidth)!=null?I:0,viewportHeight:(v=window.innerHeight)!=null?v:0,devicePixelRatio:(f=window.devicePixelRatio)!=null?f:1,timeZone:s,sdkVersion:Ge}}function jr(){let t=[[0,0,255],[0,255,255],[0,255,0],[255,255,0],[255,128,0],[255,0,0]],e=[],r=51;for(let i=0;i<t.length-1;i++){let[n,s,a]=t[i],[o,c,l]=t[i+1];for(let d=0;d<r;d++){let u=d/r;e.push([Math.round(n+(o-n)*u),Math.round(s+(c-s)*u),Math.round(a+(l-a)*u)])}}return e}var Jt=jr();function Qt(t,e,r={}){let{radius:i=25,maxOpacity:n=.85,minOpacity:s=0}=r,a=t.getContext("2d");if(!a)return;let{width:o,height:c}=t;if(a.clearRect(0,0,o,c),e.length===0)return;let l=document.createElement("canvas");l.width=o,l.height=c;let d=l.getContext("2d");if(!d)return;for(let I of e){let v=I.xPct/100*o,f=I.yPct/100*c,g=I.type==="click"?i*1.6:i,S=d.createRadialGradient(v,f,0,v,f,g);S.addColorStop(0,"rgba(0,0,0,0.15)"),S.addColorStop(1,"rgba(0,0,0,0)"),d.fillStyle=S,d.beginPath(),d.arc(v,f,g,0,Math.PI*2),d.fill()}let u=d.getImageData(0,0,o,c),p=a.createImageData(o,c),m=u.data,h=p.data,y=Jt.length-1;for(let I=0;I<m.length;I+=4){let v=m[I+3];if(v===0)continue;let f=v/255,g=Math.min(Math.floor(f*y),y),[S,_,L]=Jt[g],P=s+f*(n-s);h[I]=S,h[I+1]=_,h[I+2]=L,h[I+3]=Math.round(P*255)}a.putImageData(p,0,0)}var jt="__ut_vid__";function xe(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function qt(){if(typeof localStorage=="undefined")return xe();try{let t=localStorage.getItem(jt);if(t)return t;let e=xe();return localStorage.setItem(jt,e),e}catch(t){return xe()}}function R(t){if(!t)return t;let e=t.indexOf("?"),r=e>=0?t.slice(0,e):t,i=e>=0?t.slice(e):"",n=r;for(let a=0;a<5;a++)try{let o=decodeURIComponent(n);if(o===n)break;n=o}catch(o){break}let s=i;for(let a=0;a<5;a++)try{let o=decodeURIComponent(s);if(o===s)break;s=o}catch(o){break}return n+s}var er="__ut_last_pv_path__",tr="__ut_last_pv_entry_ms__";function Xt(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function $t(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e)}catch(r){}}function qr(t,e){$t(er,t),$t(tr,String(e))}function Xr(){if(typeof performance=="undefined")return;let e=performance.getEntriesByType("navigation")[0];if(e!=null&&e.type)return e.type;let r=performance.navigation;if((r==null?void 0:r.type)===2)return"back_forward"}var Ne=class Ne{constructor({emit:e,sessionId:r}){this.previousPath="";this.originalPushState=null;this.originalReplaceState=null;this.pageEntryTime=0;this.handlePopState=()=>{this.handleNavigation()};this.emit=e,this.sessionId=r}init(){let e=R(window.location.pathname+window.location.search);Xr()==="back_forward"&&this.tryEmitMpaHistoryTraversalUturn(e),this.recordPageView(e),window.addEventListener("popstate",this.handlePopState),this.originalPushState=history.pushState.bind(history);let r=this.originalPushState;history.pushState=(n,s,a)=>{r(n,s,a),this.handleNavigation()},this.originalReplaceState=history.replaceState.bind(history);let i=this.originalReplaceState;history.replaceState=(n,s,a)=>{i(n,s,a),this.handleNavigation()}}destroy(){window.removeEventListener("popstate",this.handlePopState),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState)}tryEmitMpaHistoryTraversalUturn(e){let r=Xt(er),i=Xt(tr),n=i?Number(i):0;if(!r||!Number.isFinite(n)||n<=0||R(r)===e)return;let s=Date.now()-n;s<0||s>Ne.UTURN_THRESHOLD_MS||this.emitUturn(R(r),e,s)}handleNavigation(){let e=R(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=Ne.UTURN_THRESHOLD_MS&&this.emitUturn(this.previousPath,e,r)}this.recordPageView(e)}}emitUturn(e,r,i){this.emit({type:"uturn",data:{fromPath:e,toPath:r,timeOnPageMs:i,timestamp:Date.now(),sessionId:this.sessionId}})}recordPageView(e){let r=R(e);this.previousPath=r,this.pageEntryTime=Date.now(),qr(r,this.pageEntryTime),this.emit({type:"pageview",data:{path:r,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer||void 0}}),window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:r,title:document.title}}))}};Ne.UTURN_THRESHOLD_MS=5e3;var Ve=Ne;var He=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=!1;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=R(e.detail.path),this.startTracking()};this.handleVisibilityChange=()=>{document.hidden?this.stopTracking():this.startTracking()};this.handleUnload=()=>{this.stopTracking()};this.emit=e,this.sessionId=r}init(){this.currentPath=R(window.location.pathname+window.location.search),this.startTracking(),window.addEventListener("tracker:navigate",this.handleNavigate),document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleUnload),window.addEventListener("pagehide",this.handleUnload)}destroy(){this.stopTracking(),window.removeEventListener("tracker:navigate",this.handleNavigate),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleUnload),window.removeEventListener("pagehide",this.handleUnload)}startTracking(){this.startTime=Date.now(),this.tracking=!0}stopTracking(){if(!this.tracking||!this.currentPath)return;let e=Date.now()-this.startTime;if(e<100){this.tracking=!1;return}this.emit({type:"timespent",data:{path:this.currentPath,duration:e,sessionId:this.sessionId,timestamp:Date.now()}}),this.tracking=!1}};function It(t,e){let r=0;return(...i)=>{let n=Date.now();n-r>=e&&(r=n,t(...i))}}var ue=class ue{constructor({emit:e,sessionId:r,sampleRate:i=.3,maxPoints:n=2e3,allowedPaths:s}){this.currentPath="";this.pointCounts={};this.recentClicks=[];this.handleMouseMove=e=>{if(Math.random()>this.sampleRate)return;let r=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight,n=e.clientY+window.scrollY;this.recordPoint({x:e.clientX,y:n,xPct:r>0?e.clientX/r*100:0,yPct:i>0?n/i*100:0,pw:r,ph:i,type:"move"})};this.handleClick=e=>{if(Date.now()-this.lastTouchTime<500)return;let r=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight,n=e.clientY+window.scrollY,s=this.getClickTarget(e);this.recordPoint({x:e.clientX,y:n,xPct:r>0?e.clientX/r*100:0,yPct:i>0?n/i*100:0,pw:r,ph:i,type:"click",...s?{target:s}:{}}),this.checkRageClick(e.clientX,n,this.currentPath)};this.lastTouchTime=0;this.handleTouchEnd=e=>{let r=e.changedTouches[0];if(!r)return;let i=document.documentElement.scrollWidth,n=document.documentElement.scrollHeight,s=r.clientY+window.scrollY;this.lastTouchTime=Date.now(),this.recordPoint({x:r.clientX,y:s,xPct:i>0?r.clientX/i*100:0,yPct:n>0?s/n*100:0,pw:i,ph:n,type:"click"}),this.checkRageClick(r.clientX,s,this.currentPath)};this.handleScroll=()=>{if(Math.random()>this.sampleRate)return;let e=document.documentElement.scrollWidth,r=document.documentElement.scrollHeight,i=window.innerWidth,n=window.scrollX,s=window.scrollY,a=n+i/2;this.recordPoint({x:i/2,y:s,xPct:e>0?a/e*100:50,yPct:r>0?s/r*100:0,pw:e,ph:r,type:"scroll"})};this.handleNavigate=e=>{this.currentPath=R(e.detail.path)};this.emit=e,this.sessionId=r,this.sampleRate=i,this.maxPoints=n,this.allowedPaths=s&&s.length>0?new Set(s.map(a=>R(a))):null,this.throttledMouseMove=It(this.handleMouseMove,50),this.throttledScroll=It(this.handleScroll,100)}init(){this.currentPath=R(window.location.pathname+window.location.search),document.addEventListener("mousemove",this.throttledMouseMove),document.addEventListener("click",this.handleClick),document.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),window.addEventListener("scroll",this.throttledScroll,{passive:!0}),window.addEventListener("tracker:navigate",this.handleNavigate)}destroy(){document.removeEventListener("mousemove",this.throttledMouseMove),document.removeEventListener("click",this.handleClick),document.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("scroll",this.throttledScroll),window.removeEventListener("tracker:navigate",this.handleNavigate)}canRecord(){var e;return this.allowedPaths!==null&&!this.allowedPaths.has(this.currentPath)?!1:((e=this.pointCounts[this.currentPath])!=null?e:0)<this.maxPoints}recordPoint(e){var r;this.canRecord()&&(this.pointCounts[this.currentPath]=((r=this.pointCounts[this.currentPath])!=null?r:0)+1,this.emit({type:"heatmap",data:{...e,path:this.currentPath,timestamp:Date.now()}}))}getClickTarget(e){var n,s,a,o;let r=e.target;return r&&(r.getAttribute("aria-label")||((n=r.closest("[aria-label]"))==null?void 0:n.getAttribute("aria-label"))||r.getAttribute("data-track-label")||r.getAttribute("id")||(r instanceof HTMLButtonElement||r instanceof HTMLAnchorElement?(s=r.innerText)==null?void 0:s.trim().slice(0,60):(o=(a=r.closest("button, a"))==null?void 0:a.textContent)==null?void 0:o.trim().slice(0,60)))||void 0}checkRageClick(e,r,i){let n=Date.now();this.recentClicks=this.recentClicks.filter(a=>n-a.t<ue.RAGE_WINDOW_MS),this.recentClicks.push({x:e,y:r,t:n});let s=this.recentClicks.filter(a=>Math.hypot(a.x-e,a.y-r)<=ue.RAGE_RADIUS_PX);s.length>=ue.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:i,x:e,y:r,count:s.length,timestamp:n,sessionId:this.sessionId}}),this.recentClicks=[])}};ue.RAGE_THRESHOLD=3,ue.RAGE_WINDOW_MS=1e3,ue.RAGE_RADIUS_PX=50;var Ze=ue;var B;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(B||(B={}));function $r(t){return t.nodeType===t.ELEMENT_NODE}function ve(t){var e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function ge(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function ei(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function Ct(t){try{var e=t.rules||t.cssRules;return e?ei(Array.from(e).map(bt).join("")):null}catch(r){return null}}function bt(t){var e=t.cssText;if(ti(t))try{e=Ct(t.styleSheet)||e}catch(r){}return e}function ti(t){return"styleSheet"in t}var nr=(function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var r;if(!e)return-1;var i=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return i!=null?i:-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(function(n){return r.removeNodeFromMap(n)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var i=r.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,r)},t.prototype.replace=function(e,r){var i=this.getNode(e);if(i){var n=this.nodeMetaMap.get(i);n&&this.nodeMetaMap.set(r,n)}this.idNodeMap.set(e,r)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t})();function sr(){return new nr}function Le(t){var e=t.maskInputOptions,r=t.tagName,i=t.type,n=t.value,s=t.maskInputFn,a=n||"";return(e[r.toLowerCase()]||e[i])&&(s?a=s(a):a="*".repeat(a.length)),a}var rr="__rrweb_original__";function ri(t){var e=t.getContext("2d");if(!e)return!0;for(var r=50,i=0;i<t.width;i+=r)for(var n=0;n<t.height;n+=r){var s=e.getImageData,a=rr in s?s[rr]:s,o=new Uint32Array(a.call(e,i,n,Math.min(r,t.width-i),Math.min(r,t.height-n)).data.buffer);if(o.some(function(c){return c!==0}))return!1}return!0}var ii=1,ni=new RegExp("[^a-z0-9-_:]"),ye=-2;function St(){return ii++}function si(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return ni.test(e)?"div":e}function oi(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function ai(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ae,ir,ci=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,li=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,di=/^(data:)([^,]*),(.*)/i;function Ke(t,e){return(t||"").replace(ci,function(r,i,n,s,a,o){var c=n||a||o,l=i||s||"";if(!c)return r;if(!li.test(c)||di.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(ai(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var p=0,m=u;p<m.length;p++){var h=m[p];h!=="."&&(h===".."?d.pop():d.push(h))}return"url(".concat(l).concat(d.join("/")).concat(l,")")})}var ui=/^[^ \t\n\r\u000c]+/,hi=/^[, \t\n\r\u000c]+/;function pi(t,e){if(e.trim()==="")return e;var r=0;function i(l){var d,u=l.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var n=[];i(hi),!(r>=e.length);){var s=i(ui);if(s.slice(-1)===",")s=ke(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=ke(t,s);for(var o=!1;;){var c=e.charAt(r);if(c===""){n.push((s+a).trim());break}else if(o)c===")"&&(o=!1);else if(c===","){r+=1,n.push((s+a).trim());break}else c==="("&&(o=!0);a+=c,r+=1}}}return n.join(", ")}function ke(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function fi(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function wt(){var t=document.createElement("a");return t.href="",t.href}function At(t,e,r,i){return r==="src"||r==="href"&&i&&!(e==="use"&&i[0]==="#")||r==="xlink:href"&&i&&i[0]!=="#"||r==="background"&&i&&(e==="table"||e==="td"||e==="th")?ke(t,i):r==="srcset"&&i?pi(t,i):r==="style"&&i?Ke(i,wt()):e==="object"&&r==="data"&&i?ke(t,i):i}function mi(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;){var n=t.classList[i];if(e.test(n))return!0}return r?t.matches(r):!1}function Oe(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?Oe(t.parentNode,e,r):!1;for(var i=t.classList.length;i--;){var n=t.classList[i];if(e.test(n))return!0}return r?Oe(t.parentNode,e,r):!1}function kt(t,e,r){var i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(i===null)return!1;if(typeof e=="string"){if(i.classList.contains(e)||i.closest(".".concat(e)))return!0}else if(Oe(i,e,!0))return!0;return!!(r&&(i.matches(r)||i.closest(r)))}function gi(t,e,r){var i=t.contentWindow;if(i){var n=!1,s;try{s=i.document.readyState}catch(c){return}if(s!=="complete"){var a=setTimeout(function(){n||(e(),n=!0)},r);t.addEventListener("load",function(){clearTimeout(a),n=!0,e()});return}var o="about:blank";if(i.location.href!==o||t.src===o||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function yi(t,e,r){var i=!1,n;try{n=t.sheet}catch(a){return}if(!n){var s=setTimeout(function(){i||(e(),i=!0)},r);t.addEventListener("load",function(){clearTimeout(s),i=!0,e()})}}function vi(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,p=e.maskInputFn,m=e.dataURLOptions,h=m===void 0?{}:m,y=e.inlineImages,I=e.recordCanvas,v=e.keepIframeSrcFn,f=e.newlyAddedElement,g=f===void 0?!1:f,S=Ii(r,i);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:B.Document,childNodes:[],compatMode:t.compatMode}:{type:B.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:B.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:S};case t.ELEMENT_NODE:return bi(t,{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:c,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:y,recordCanvas:I,keepIframeSrcFn:v,newlyAddedElement:g,rootId:S});case t.TEXT_NODE:return Ci(t,{maskTextClass:a,maskTextSelector:o,maskTextFn:u,rootId:S});case t.CDATA_SECTION_NODE:return{type:B.CDATA,textContent:"",rootId:S};case t.COMMENT_NODE:return{type:B.Comment,textContent:t.textContent||"",rootId:S};default:return!1}}function Ii(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function Ci(t,e){var r,i=e.maskTextClass,n=e.maskTextSelector,s=e.maskTextFn,a=e.rootId,o=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=o==="STYLE"?!0:void 0,d=o==="SCRIPT"?!0:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=oi(t.parentNode.sheet))}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t)}c=Ke(c,wt())}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&kt(t,i,n)&&(c=s?s(c):c.replace(/[\S]/g,"*")),{type:B.Text,textContent:c||"",isStyle:l,rootId:a}}function bi(t,e){for(var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.inlineStylesheet,a=e.maskInputOptions,o=a===void 0?{}:a,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,p=e.recordCanvas,m=e.keepIframeSrcFn,h=e.newlyAddedElement,y=h===void 0?!1:h,I=e.rootId,v=mi(t,i,n),f=si(t),g={},S=t.attributes.length,_=0;_<S;_++){var L=t.attributes[_];g[L.name]=At(r,f,L.name,L.value)}if(f==="link"&&s){var P=Array.from(r.styleSheets).find(function(j){return j.href===t.href}),T=null;P&&(T=Ct(P)),T&&(delete g.rel,delete g.href,g._cssText=Ke(T,P.href))}if(f==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=Ct(t.sheet);T&&(g._cssText=Ke(T,wt()))}if(f==="input"||f==="textarea"||f==="select"){var Y=t.value,J=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&Y?g.value=Le({type:g.type,tagName:f,value:Y,maskInputOptions:o,maskInputFn:c}):J&&(g.checked=J)}if(f==="option"&&(t.selected&&!o.select?g.selected=!0:delete g.selected),f==="canvas"&&p){if(t.__context==="2d")ri(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var X=t.toDataURL(d.type,d.quality),$=document.createElement("canvas");$.width=t.width,$.height=t.height;var ee=$.toDataURL(d.type,d.quality);X!==ee&&(g.rr_dataURL=X)}}if(f==="img"&&u){Ae||(Ae=r.createElement("canvas"),ir=Ae.getContext("2d"));var F=t,Q=F.crossOrigin;F.crossOrigin="anonymous";var re=function(){try{Ae.width=F.naturalWidth,Ae.height=F.naturalHeight,ir.drawImage(F,0,0),g.rr_dataURL=Ae.toDataURL(d.type,d.quality)}catch(j){console.warn("Cannot inline img src=".concat(F.currentSrc,"! Error: ").concat(j))}Q?g.crossOrigin=Q:F.removeAttribute("crossorigin")};F.complete&&F.naturalWidth!==0?re():F.onload=re}if((f==="audio"||f==="video")&&(g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime),y||(t.scrollLeft&&(g.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(g.rr_scrollTop=t.scrollTop)),v){var oe=t.getBoundingClientRect(),ce=oe.width,H=oe.height;g={class:g.class,rr_width:"".concat(ce,"px"),rr_height:"".concat(H,"px")}}return f==="iframe"&&!m(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:B.Element,tagName:f,attributes:g,childNodes:[],isSVG:fi(t)||void 0,needBlock:v,rootId:I}}function E(t){return t===void 0?"":t.toLowerCase()}function Si(t,e){if(e.comment&&t.type===B.Comment)return!0;if(t.type===B.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||E(t.attributes.name)==="application-name"||E(t.attributes.rel)==="icon"||E(t.attributes.rel)==="apple-touch-icon"||E(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||E(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(E(t.attributes.name)==="robots"||E(t.attributes.name)==="googlebot"||E(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(E(t.attributes.name)==="author"||E(t.attributes.name)==="generator"||E(t.attributes.name)==="framework"||E(t.attributes.name)==="publisher"||E(t.attributes.name)==="progid"||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(E(t.attributes.name)==="google-site-verification"||E(t.attributes.name)==="yandex-verification"||E(t.attributes.name)==="csrf-token"||E(t.attributes.name)==="p:domain_verify"||E(t.attributes.name)==="verify-v1"||E(t.attributes.name)==="verification"||E(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function me(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,c=e.skipChild,l=c===void 0?!1:c,d=e.inlineStylesheet,u=d===void 0?!0:d,p=e.maskInputOptions,m=p===void 0?{}:p,h=e.maskTextFn,y=e.maskInputFn,I=e.slimDOMOptions,v=e.dataURLOptions,f=v===void 0?{}:v,g=e.inlineImages,S=g===void 0?!1:g,_=e.recordCanvas,L=_===void 0?!1:_,P=e.onSerialize,T=e.onIframeLoad,Y=e.iframeLoadTimeout,J=Y===void 0?5e3:Y,X=e.onStylesheetLoad,$=e.stylesheetLoadTimeout,ee=$===void 0?5e3:$,F=e.keepIframeSrcFn,Q=F===void 0?function(){return!1}:F,re=e.newlyAddedElement,oe=re===void 0?!1:re,ce=e.preserveWhiteSpace,H=ce===void 0?!0:ce,j=vi(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:o,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:y,dataURLOptions:f,inlineImages:S,recordCanvas:L,keepIframeSrcFn:Q,newlyAddedElement:oe});if(!j)return console.warn(t,"not serialized"),null;var de;i.hasNode(t)?de=i.getId(t):Si(j,I)||!H&&j.type===B.Text&&!j.isStyle&&!j.textContent.replace(/^\s+|\s+$/gm,"").length?de=ye:de=St();var O=Object.assign(j,{id:de});if(i.add(t,O),de===ye)return null;P&&P(t);var ie=!l;if(O.type===B.Element){ie=ie&&!O.needBlock,delete O.needBlock;var ae=t.shadowRoot;ae&&ge(ae)&&(O.isShadowHost=!0)}if((O.type===B.Document||O.type===B.Element)&&ie){I.headWhitespace&&O.type===B.Element&&O.tagName==="head"&&(H=!1);for(var Se={doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:y,slimDOMOptions:I,dataURLOptions:f,inlineImages:S,recordCanvas:L,preserveWhiteSpace:H,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:Q},C=0,U=Array.from(t.childNodes);C<U.length;C++){var Z=U[C],M=me(Z,Se);M&&O.childNodes.push(M)}if($r(t)&&t.shadowRoot)for(var q=0,A=Array.from(t.shadowRoot.childNodes);q<A.length;q++){var Z=A[q],M=me(Z,Se);M&&(ge(t.shadowRoot)&&(M.isShadow=!0),O.childNodes.push(M))}}return t.parentNode&&ve(t.parentNode)&&ge(t.parentNode)&&(O.isShadow=!0),O.type===B.Element&&O.tagName==="iframe"&&gi(t,function(){var K=t.contentDocument;if(K&&T){var Me=me(K,{doc:K,mirror:i,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:y,slimDOMOptions:I,dataURLOptions:f,inlineImages:S,recordCanvas:L,preserveWhiteSpace:H,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:Q});Me&&T(t,Me)}},J),O.type===B.Element&&O.tagName==="link"&&O.attributes.rel==="stylesheet"&&yi(t,function(){if(X){var K=me(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:y,slimDOMOptions:I,dataURLOptions:f,inlineImages:S,recordCanvas:L,preserveWhiteSpace:H,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:Q});K&&X(t,K)}},ee),O}function or(t,e){var r=e||{},i=r.mirror,n=i===void 0?new nr:i,s=r.blockClass,a=s===void 0?"rr-block":s,o=r.blockSelector,c=o===void 0?null:o,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,p=u===void 0?null:u,m=r.inlineStylesheet,h=m===void 0?!0:m,y=r.inlineImages,I=y===void 0?!1:y,v=r.recordCanvas,f=v===void 0?!1:v,g=r.maskAllInputs,S=g===void 0?!1:g,_=r.maskTextFn,L=r.maskInputFn,P=r.slimDOM,T=P===void 0?!1:P,Y=r.dataURLOptions,J=r.preserveWhiteSpace,X=r.onSerialize,$=r.onIframeLoad,ee=r.iframeLoadTimeout,F=r.onStylesheetLoad,Q=r.stylesheetLoadTimeout,re=r.keepIframeSrcFn,oe=re===void 0?function(){return!1}:re,ce=S===!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}:S===!1?{password:!0}:S,H=T===!0||T==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:T==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:T===!1?{}:T;return me(t,{doc:t,mirror:n,blockClass:a,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:ce,maskTextFn:_,maskInputFn:L,slimDOMOptions:H,dataURLOptions:Y,inlineImages:I,recordCanvas:f,preserveWhiteSpace:J,onSerialize:X,onIframeLoad:$,iframeLoadTimeout:ee,onStylesheetLoad:F,stylesheetLoadTimeout:Q,keepIframeSrcFn:oe,newlyAddedElement:!1})}var wi=/([^\\]):hover/,Tn=new RegExp(wi.source,"g");function W(t,e,r=document){let i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>r.removeEventListener(t,e,i)}var Te=`Please stop import mirror directly. Instead of that,\r
1
+ "use strict";var AlphanaSDK=(()=>{var ft=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var jr=Object.getOwnPropertyNames;var Qr=Object.prototype.hasOwnProperty;var mt=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var qr=(t,e)=>{for(var r in e)ft(t,r,{get:e[r],enumerable:!0})},Xr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jr(e))!Qr.call(t,i)&&i!==r&&ft(t,i,{get:()=>e[i],enumerable:!(n=Jr(e,i))||n.enumerable});return t};var $r=t=>Xr(ft({},"__esModule",{value:!0}),t);var bi={};qr(bi,{ALPHANA_SDK_VERSION:()=>Ge,DEFAULT_ENDPOINT:()=>Ut,LogCapture:()=>we,UserTracker:()=>We,command:()=>Ht,getTracker:()=>vi,init:()=>Vt,renderHeatmap:()=>Xt});function Ne(t){return t.replace(/\/events\/?$/,"")}function Ue(t){return`${Ne(t)}/collect`}function gt(t,e){return{...e.appId?{appId:e.appId}:{},visitorId:e.visitorId,events:t.map(r=>({sessionId:e.sessionId,type:r.type,data:r.data}))}}function yt(t){return{...t.appId?{appId:t.appId}:{},visitorId:t.visitorId,heartbeat:{sessionId:t.sessionId,visitorId:t.visitorId,path:t.path,active:t.active,...t.appId?{appId:t.appId}:{}}}}function Zt(t){return{...t.appId?{appId:t.appId}:{},log:t}}var vt="application/x-alphana-gzip";function en(){return typeof CompressionStream!="undefined"}async function Kt(t){if(!en())return null;try{let e=new TextEncoder().encode(t),r=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(r).arrayBuffer())}catch(e){return null}}var Jt=1024;async function zt(t,e,r=!1){var o;let n=(o=e.compressionThresholdBytes)!=null?o:Jt;if(!r&&e.compressPayloads!==!1&&t.length>=n){let a=await Kt(t);if(a)return{codec:"gzip",body:a,contentType:vt}}return{codec:"json",body:t,contentType:"application/json"}}async function Yt(t,e,r){var i,o;let n={"Content-Type":e.contentType,...e.codec==="gzip"?{Accept:vt}:{},...(i=r.authHeaders)!=null?i:{}};return fetch(t,{method:"POST",headers:n,body:e.body,keepalive:(o=r.keepalive)!=null?o:!1})}async function fe(t,e,r={}){try{let n=await zt(e,r),i=await Yt(t,n,r);if(n.codec==="gzip"&&(i.status===415||i.status===400)){let o=await zt(e,r,!0);i=await Yt(t,o,r)}}catch(n){}}function It(t,e,r={}){var o,a;let n=(o=r.compressionThresholdBytes)!=null?o:Jt;if(r.compressPayloads!==!1&&e.length>=n||Object.keys((a=r.authHeaders)!=null?a:{}).length>0){fe(t,e,{...r,keepalive:!0});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let s=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,s))return}fe(t,e,{...r,keepalive:!0})}var we=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=!1;var r,n,i;this.collectUrl=(r=e.collectEndpoint)!=null?r:Ue(e.endpoint),this.sessionId=e.sessionId,this.appId=e.appId,this.authHeaders=e.secretKey?{Authorization:`Bearer ${e.secretKey}`}:{},this.compressPayloads=(n=e.compressPayloads)!=null?n:!0,this.compressionThresholdBytes=(i=e.compressionThresholdBytes)!=null?i:1024}init(){typeof window=="undefined"||this.initialized||(this.origInfo=console.info.bind(console),this.origWarn=console.warn.bind(console),this.origError=console.error.bind(console),console.info=(...e)=>{this.origInfo(...e),this.send("info",this.format(e))},console.warn=(...e)=>{this.origWarn(...e),this.send("warn",this.format(e))},console.error=(...e)=>{this.origError(...e);let[r]=e,n=r instanceof Error?r.stack:void 0;this.send("error",this.format(e),{stack:n})},this.prevOnError=window.onerror,window.onerror=(e,r,n,i,o)=>(this.send("error",String(e),{stack:o==null?void 0:o.stack,meta:{src:r,line:n,col:i}}),typeof this.prevOnError=="function"?this.prevOnError(e,r,n,i,o):!1),this.prevOnUnhandledRejection=e=>{let r=e.reason,n=r instanceof Error?r.message:String(r!=null?r:"Unhandled promise rejection");this.send("error",n,{stack:r instanceof Error?r.stack:void 0})},window.addEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!0)}destroy(){this.initialized&&(console.info=this.origInfo,console.warn=this.origWarn,console.error=this.origError,window.onerror=this.prevOnError,this.prevOnUnhandledRejection&&window.removeEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!1)}capture(e,r,n){this.send(e,r,n)}format(e){return e.map(r=>{if(r instanceof Error)return r.message;if(typeof r=="object")try{return JSON.stringify(r)}catch(n){return String(r)}return String(r)}).join(" ")}send(e,r,n){let i={sessionId:this.sessionId,...this.appId?{appId:this.appId}:{},level:e,message:r,url:typeof window!="undefined"?window.location.href:void 0,stack:n==null?void 0:n.stack,meta:n==null?void 0:n.meta,timestamp:Date.now()},o=JSON.stringify(Zt(i));fe(this.collectUrl,o,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:!0}).catch(a=>{this.origError&&this.origError("[user-tracker] Failed to send log:",a)})}};var Ge="2.0.2";function jt(t){var r,n;let e=t.toLowerCase();return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|android|iphone|ipod|windows phone/i.test(e)?"mobile":typeof navigator!="undefined"&&navigator.maxTouchPoints>0&&typeof window!="undefined"&&((n=(r=window.matchMedia)==null?void 0:r.call(window,"(pointer: coarse)"))==null?void 0:n.matches)&&/macintosh|mac os x/i.test(e)?"tablet":"desktop"}function tn(t){return/windows/i.test(t)?"Windows":/android/i.test(t)?"Android":/iphone|ipad|ipod/i.test(t)?"iOS":/mac os x|macintosh/i.test(t)?"macOS":/linux/i.test(t)?"Linux":"Other"}function rn(t){return/edg\//i.test(t)?"Edge":/opr\/|opera/i.test(t)?"Opera":/chrome\/[0-9]/i.test(t)&&!/chromium/i.test(t)?"Chrome":/firefox\/[0-9]/i.test(t)?"Firefox":/safari\/[0-9]/i.test(t)&&!/chrome/i.test(t)?"Safari":"Other"}function nn(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function on(t,e){var n;let r=((n=e.platform)!=null?n:"").toLowerCase();return r==="ios"||r==="ipados"||r==="android"?e.mobile?"mobile":"tablet":e.mobile===!0?"mobile":jt(t)}function Qt(t){var s,c,l,d,u,p,f,h,y,I,v,m;if(typeof window=="undefined"||typeof navigator=="undefined")return{sessionId:t,timestamp:Date.now(),device:"desktop",os:"Other",browser:"Other",language:"",languages:[],colorScheme:"",screenWidth:0,screenHeight:0,viewportWidth:0,viewportHeight:0,devicePixelRatio:1,timeZone:"",sdkVersion:Ge};let e=navigator.userAgent||"",r=nn(),n=r.mobile!==void 0||r.platform?on(e,r):jt(e),i="";(c=(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: dark)"))!=null&&c.matches?i="dark":(d=(l=window.matchMedia)==null?void 0:l.call(window,"(prefers-color-scheme: light)"))!=null&&d.matches&&(i="light");let o="";try{o=(u=Intl.DateTimeFormat().resolvedOptions().timeZone)!=null?u:""}catch(g){o=""}let a=typeof navigator.languages!="undefined"&&navigator.languages.length?[...navigator.languages]:navigator.language?[navigator.language]:[];return{sessionId:t,timestamp:Date.now(),device:n,os:tn(e),browser:rn(e),language:navigator.language||"",languages:a,colorScheme:i,screenWidth:(f=(p=window.screen)==null?void 0:p.width)!=null?f:0,screenHeight:(y=(h=window.screen)==null?void 0:h.height)!=null?y:0,viewportWidth:(I=window.innerWidth)!=null?I:0,viewportHeight:(v=window.innerHeight)!=null?v:0,devicePixelRatio:(m=window.devicePixelRatio)!=null?m:1,timeZone:o,sdkVersion:Ge}}function sn(){let t=[[0,0,255],[0,255,255],[0,255,0],[255,255,0],[255,128,0],[255,0,0]],e=[],r=51;for(let n=0;n<t.length-1;n++){let[i,o,a]=t[n],[s,c,l]=t[n+1];for(let d=0;d<r;d++){let u=d/r;e.push([Math.round(i+(s-i)*u),Math.round(o+(c-o)*u),Math.round(a+(l-a)*u)])}}return e}var qt=sn();function Xt(t,e,r={}){let{radius:n=25,maxOpacity:i=.85,minOpacity:o=0}=r,a=t.getContext("2d");if(!a)return;let{width:s,height:c}=t;if(a.clearRect(0,0,s,c),e.length===0)return;let l=document.createElement("canvas");l.width=s,l.height=c;let d=l.getContext("2d");if(!d)return;for(let I of e){let v=I.xPct/100*s,m=I.yPct/100*c,g=I.type==="click"?n*1.6:n,S=d.createRadialGradient(v,m,0,v,m,g);S.addColorStop(0,"rgba(0,0,0,0.15)"),S.addColorStop(1,"rgba(0,0,0,0)"),d.fillStyle=S,d.beginPath(),d.arc(v,m,g,0,Math.PI*2),d.fill()}let u=d.getImageData(0,0,s,c),p=a.createImageData(s,c),f=u.data,h=p.data,y=qt.length-1;for(let I=0;I<f.length;I+=4){let v=f[I+3];if(v===0)continue;let m=v/255,g=Math.min(Math.floor(m*y),y),[S,_,L]=qt[g],P=o+m*(i-o);h[I]=S,h[I+1]=_,h[I+2]=L,h[I+3]=Math.round(P*255)}a.putImageData(p,0,0)}var $t="__ut_vid__";function Ct(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function er(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem($t)}catch(t){return null}}function tr(t){if(typeof localStorage!="undefined")try{localStorage.setItem($t,t)}catch(e){}}function E(t){if(!t)return t;let e=t.indexOf("?"),r=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e):"",i=r;for(let a=0;a<5;a++)try{let s=decodeURIComponent(i);if(s===i)break;i=s}catch(s){break}let o=n;for(let a=0;a<5;a++)try{let s=decodeURIComponent(o);if(s===o)break;o=s}catch(s){break}return i+o}var ir="__ut_last_pv_path__",or="__ut_last_pv_entry_ms__";function rr(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function nr(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e)}catch(r){}}function an(t,e){nr(ir,t),nr(or,String(e))}function cn(){if(typeof performance=="undefined")return;let e=performance.getEntriesByType("navigation")[0];if(e!=null&&e.type)return e.type;let r=performance.navigation;if((r==null?void 0:r.type)===2)return"back_forward"}var Oe=class Oe{constructor({emit:e,sessionId:r}){this.previousPath="";this.originalPushState=null;this.originalReplaceState=null;this.pageEntryTime=0;this.handlePopState=()=>{this.handleNavigation()};this.emit=e,this.sessionId=r}init(){let e=E(window.location.pathname+window.location.search);cn()==="back_forward"&&this.tryEmitMpaHistoryTraversalUturn(e),this.recordPageView(e),window.addEventListener("popstate",this.handlePopState),this.originalPushState=history.pushState.bind(history);let r=this.originalPushState;history.pushState=(i,o,a)=>{r(i,o,a),this.handleNavigation()},this.originalReplaceState=history.replaceState.bind(history);let n=this.originalReplaceState;history.replaceState=(i,o,a)=>{n(i,o,a),this.handleNavigation()}}destroy(){window.removeEventListener("popstate",this.handlePopState),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState)}tryEmitMpaHistoryTraversalUturn(e){let r=rr(ir),n=rr(or),i=n?Number(n):0;if(!r||!Number.isFinite(i)||i<=0||E(r)===e)return;let o=Date.now()-i;o<0||o>Oe.UTURN_THRESHOLD_MS||this.emitUturn(E(r),e,o)}handleNavigation(){let e=E(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=Oe.UTURN_THRESHOLD_MS&&this.emitUturn(this.previousPath,e,r)}this.recordPageView(e)}}emitUturn(e,r,n){this.emit({type:"uturn",data:{fromPath:e,toPath:r,timeOnPageMs:n,timestamp:Date.now(),sessionId:this.sessionId}})}recordPageView(e){let r=E(e);this.previousPath=r,this.pageEntryTime=Date.now(),an(r,this.pageEntryTime),this.emit({type:"pageview",data:{path:r,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer||void 0}}),window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:r,title:document.title}}))}};Oe.UTURN_THRESHOLD_MS=5e3;var Ve=Oe;var He=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=!1;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=E(e.detail.path),this.startTracking()};this.handleVisibilityChange=()=>{document.hidden?this.stopTracking():this.startTracking()};this.handleUnload=()=>{this.stopTracking()};this.emit=e,this.sessionId=r}init(){this.currentPath=E(window.location.pathname+window.location.search),this.startTracking(),window.addEventListener("tracker:navigate",this.handleNavigate),document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleUnload),window.addEventListener("pagehide",this.handleUnload)}destroy(){this.stopTracking(),window.removeEventListener("tracker:navigate",this.handleNavigate),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleUnload),window.removeEventListener("pagehide",this.handleUnload)}startTracking(){this.startTime=Date.now(),this.tracking=!0}stopTracking(){if(!this.tracking||!this.currentPath)return;let e=Date.now()-this.startTime;if(e<100){this.tracking=!1;return}this.emit({type:"timespent",data:{path:this.currentPath,duration:e,sessionId:this.sessionId,timestamp:Date.now()}}),this.tracking=!1}};function bt(t,e){let r=0;return(...n)=>{let i=Date.now();i-r>=e&&(r=i,t(...n))}}var ln="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",sr=/^[A-Za-z][\w-]*$/;function dn(t){if(!t||t.nodeType!==1)return"";let e=t.id;if(e&&sr.test(e))return"#"+e;let r=[],n=t,i=0;for(;n&&n.nodeType===1&&n!==document.body&&i<5;){let o=n.id;if(o&&sr.test(o)){r.unshift("#"+o);break}let a=n.tagName.toLowerCase(),s=1,c=n.previousElementSibling;for(;c;)c.tagName===n.tagName&&s++,c=c.previousElementSibling;r.unshift(a+":nth-of-type("+s+")"),n=n.parentElement,i++}return r.join(">")}function ar(t,e,r){let n=t instanceof Element?t:null;if(!n)return{};let i=n.closest(ln);if(!i)return{};let o=dn(i);if(!o)return{};let a=i.getBoundingClientRect();if(a.width<=0||a.height<=0)return{selector:o};let s=Math.min(1,Math.max(0,(e-a.left)/a.width)),c=Math.min(1,Math.max(0,(r-a.top)/a.height));return{selector:o,relX:Math.round(s*1e3)/1e3,relY:Math.round(c*1e3)/1e3}}var ue=class ue{constructor({emit:e,sessionId:r,sampleRate:n=.3,maxPoints:i=2e3,allowedPaths:o}){this.currentPath="";this.pointCounts={};this.maxScrollDepth={};this.recentClicks=[];this.handleMouseMove=e=>{if(Math.random()>this.sampleRate)return;let r=document.documentElement.scrollWidth,n=document.documentElement.scrollHeight,i=e.clientY+window.scrollY;this.recordPoint({x:e.clientX,y:i,xPct:r>0?e.clientX/r*100:0,yPct:n>0?i/n*100:0,pw:r,ph:n,vw:window.innerWidth,type:"move"})};this.handleClick=e=>{if(Date.now()-this.lastTouchTime<500)return;let r=document.documentElement.scrollWidth,n=document.documentElement.scrollHeight,i=e.clientY+window.scrollY,o=this.getClickTarget(e),a=ar(e.target,e.clientX,e.clientY);this.recordPoint({x:e.clientX,y:i,xPct:r>0?e.clientX/r*100:0,yPct:n>0?i/n*100:0,pw:r,ph:n,vw:window.innerWidth,type:"click",...o?{target:o}:{},...a}),this.checkRageClick(e.clientX,i,this.currentPath)};this.lastTouchTime=0;this.handleTouchEnd=e=>{let r=e.changedTouches[0];if(!r)return;let n=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight,o=r.clientY+window.scrollY;this.lastTouchTime=Date.now();let a=ar(e.target,r.clientX,r.clientY);this.recordPoint({x:r.clientX,y:o,xPct:n>0?r.clientX/n*100:0,yPct:i>0?o/i*100:0,pw:n,ph:i,vw:window.innerWidth,type:"click",...a}),this.checkRageClick(r.clientX,o,this.currentPath)};this.handleScroll=()=>{var p;let e=document.documentElement.scrollWidth,r=document.documentElement.scrollHeight,n=window.innerWidth,i=window.innerHeight,o=window.scrollX,a=window.scrollY,s=Math.min(r,a+i),c=r>0?s/r*100:0,l=(p=this.maxScrollDepth[this.currentPath])!=null?p:0,d=c>l+1;if(d&&(this.maxScrollDepth[this.currentPath]=c),!d&&Math.random()>this.sampleRate)return;let u=o+n/2;this.recordPoint({x:n/2,y:s,xPct:e>0?u/e*100:50,yPct:c,pw:e,ph:r,vw:n,type:"scroll"})};this.handleNavigate=e=>{this.currentPath=E(e.detail.path)};this.emit=e,this.sessionId=r,this.sampleRate=n,this.maxPoints=i,this.allowedPaths=o&&o.length>0?new Set(o.map(a=>E(a))):null,this.throttledMouseMove=bt(this.handleMouseMove,50),this.throttledScroll=bt(this.handleScroll,100)}init(){this.currentPath=E(window.location.pathname+window.location.search),document.addEventListener("mousemove",this.throttledMouseMove),document.addEventListener("click",this.handleClick),document.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),window.addEventListener("scroll",this.throttledScroll,{passive:!0}),window.addEventListener("tracker:navigate",this.handleNavigate)}destroy(){document.removeEventListener("mousemove",this.throttledMouseMove),document.removeEventListener("click",this.handleClick),document.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("scroll",this.throttledScroll),window.removeEventListener("tracker:navigate",this.handleNavigate)}canRecord(){var e;return this.allowedPaths!==null&&!this.allowedPaths.has(this.currentPath)?!1:((e=this.pointCounts[this.currentPath])!=null?e:0)<this.maxPoints}recordPoint(e){var r;this.canRecord()&&(this.pointCounts[this.currentPath]=((r=this.pointCounts[this.currentPath])!=null?r:0)+1,this.emit({type:"heatmap",data:{...e,path:this.currentPath,timestamp:Date.now()}}))}getClickTarget(e){var i,o,a,s;let r=e.target;return r&&(r.getAttribute("aria-label")||((i=r.closest("[aria-label]"))==null?void 0:i.getAttribute("aria-label"))||r.getAttribute("data-track-label")||r.getAttribute("id")||(r instanceof HTMLButtonElement||r instanceof HTMLAnchorElement?(o=r.innerText)==null?void 0:o.trim().slice(0,60):(s=(a=r.closest("button, a"))==null?void 0:a.textContent)==null?void 0:s.trim().slice(0,60)))||void 0}checkRageClick(e,r,n){let i=Date.now();this.recentClicks=this.recentClicks.filter(a=>i-a.t<ue.RAGE_WINDOW_MS),this.recentClicks.push({x:e,y:r,t:i});let o=this.recentClicks.filter(a=>Math.hypot(a.x-e,a.y-r)<=ue.RAGE_RADIUS_PX);o.length>=ue.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:n,x:e,y:r,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[])}};ue.RAGE_THRESHOLD=3,ue.RAGE_WINDOW_MS=1e3,ue.RAGE_RADIUS_PX=50;var Ze=ue;var D;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(D||(D={}));function un(t){return t.nodeType===t.ELEMENT_NODE}function ve(t){var e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function ge(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function hn(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function St(t){try{var e=t.rules||t.cssRules;return e?hn(Array.from(e).map(wt).join("")):null}catch(r){return null}}function wt(t){var e=t.cssText;if(pn(t))try{e=St(t.styleSheet)||e}catch(r){}return e}function pn(t){return"styleSheet"in t}var dr=(function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var r;if(!e)return-1;var n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n!=null?n:-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(i){return r.removeNodeFromMap(i)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r)},t.prototype.replace=function(e,r){var n=this.getNode(e);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(e,r)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t})();function ur(){return new dr}function Pe(t){var e=t.maskInputOptions,r=t.tagName,n=t.type,i=t.value,o=t.maskInputFn,a=i||"";return(e[r.toLowerCase()]||e[n])&&(o?a=o(a):a="*".repeat(a.length)),a}var cr="__rrweb_original__";function fn(t){var e=t.getContext("2d");if(!e)return!0;for(var r=50,n=0;n<t.width;n+=r)for(var i=0;i<t.height;i+=r){var o=e.getImageData,a=cr in o?o[cr]:o,s=new Uint32Array(a.call(e,n,i,Math.min(r,t.width-n),Math.min(r,t.height-i)).data.buffer);if(s.some(function(c){return c!==0}))return!1}return!0}var mn=1,gn=new RegExp("[^a-z0-9-_:]"),ye=-2;function kt(){return mn++}function yn(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return gn.test(e)?"div":e}function vn(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function In(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var ke,lr,Cn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,bn=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Sn=/^(data:)([^,]*),(.*)/i;function Ke(t,e){return(t||"").replace(Cn,function(r,n,i,o,a,s){var c=i||a||s,l=n||o||"";if(!c)return r;if(!bn.test(c)||Sn.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(In(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var p=0,f=u;p<f.length;p++){var h=f[p];h!=="."&&(h===".."?d.pop():d.push(h))}return"url(".concat(l).concat(d.join("/")).concat(l,")")})}var wn=/^[^ \t\n\r\u000c]+/,kn=/^[, \t\n\r\u000c]+/;function An(t,e){if(e.trim()==="")return e;var r=0;function n(l){var d,u=l.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var i=[];n(kn),!(r>=e.length);){var o=n(wn);if(o.slice(-1)===",")o=Ae(t,o.substring(0,o.length-1)),i.push(o);else{var a="";o=Ae(t,o);for(var s=!1;;){var c=e.charAt(r);if(c===""){i.push((o+a).trim());break}else if(s)c===")"&&(s=!1);else if(c===","){r+=1,i.push((o+a).trim());break}else c==="("&&(s=!0);a+=c,r+=1}}}return i.join(", ")}function Ae(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function Tn(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function At(){var t=document.createElement("a");return t.href="",t.href}function Tt(t,e,r,n){return r==="src"||r==="href"&&n&&!(e==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(e==="table"||e==="td"||e==="th")?Ae(t,n):r==="srcset"&&n?An(t,n):r==="style"&&n?Ke(n,At()):e==="object"&&r==="data"&&n?Ae(t,n):n}function En(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return!0}return r?t.matches(r):!1}function Le(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?Le(t.parentNode,e,r):!1;for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return!0}return r?Le(t.parentNode,e,r):!1}function Et(t,e,r){var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return!1;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return!0}else if(Le(n,e,!0))return!0;return!!(r&&(n.matches(r)||n.closest(r)))}function Rn(t,e,r){var n=t.contentWindow;if(n){var i=!1,o;try{o=n.document.readyState}catch(c){return}if(o!=="complete"){var a=setTimeout(function(){i||(e(),i=!0)},r);t.addEventListener("load",function(){clearTimeout(a),i=!0,e()});return}var s="about:blank";if(n.location.href!==s||t.src===s||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function xn(t,e,r){var n=!1,i;try{i=t.sheet}catch(a){return}if(!i){var o=setTimeout(function(){n||(e(),n=!0)},r);t.addEventListener("load",function(){clearTimeout(o),n=!0,e()})}}function Mn(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,p=e.maskInputFn,f=e.dataURLOptions,h=f===void 0?{}:f,y=e.inlineImages,I=e.recordCanvas,v=e.keepIframeSrcFn,m=e.newlyAddedElement,g=m===void 0?!1:m,S=Nn(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:t.compatMode}:{type:D.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:D.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:S};case t.ELEMENT_NODE:return Ln(t,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:c,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:y,recordCanvas:I,keepIframeSrcFn:v,newlyAddedElement:g,rootId:S});case t.TEXT_NODE:return On(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:S});case t.CDATA_SECTION_NODE:return{type:D.CDATA,textContent:"",rootId:S};case t.COMMENT_NODE:return{type:D.Comment,textContent:t.textContent||"",rootId:S};default:return!1}}function Nn(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function On(t,e){var r,n=e.maskTextClass,i=e.maskTextSelector,o=e.maskTextFn,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=s==="STYLE"?!0:void 0,d=s==="SCRIPT"?!0:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=vn(t.parentNode.sheet))}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t)}c=Ke(c,At())}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&Et(t,n,i)&&(c=o?o(c):c.replace(/[\S]/g,"*")),{type:D.Text,textContent:c||"",isStyle:l,rootId:a}}function Ln(t,e){for(var r=e.doc,n=e.blockClass,i=e.blockSelector,o=e.inlineStylesheet,a=e.maskInputOptions,s=a===void 0?{}:a,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,p=e.recordCanvas,f=e.keepIframeSrcFn,h=e.newlyAddedElement,y=h===void 0?!1:h,I=e.rootId,v=En(t,n,i),m=yn(t),g={},S=t.attributes.length,_=0;_<S;_++){var L=t.attributes[_];g[L.name]=Tt(r,m,L.name,L.value)}if(m==="link"&&o){var P=Array.from(r.styleSheets).find(function(Q){return Q.href===t.href}),T=null;P&&(T=St(P)),T&&(delete g.rel,delete g.href,g._cssText=Ke(T,P.href))}if(m==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=St(t.sheet);T&&(g._cssText=Ke(T,At()))}if(m==="input"||m==="textarea"||m==="select"){var Y=t.value,J=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&Y?g.value=Pe({type:g.type,tagName:m,value:Y,maskInputOptions:s,maskInputFn:c}):J&&(g.checked=J)}if(m==="option"&&(t.selected&&!s.select?g.selected=!0:delete g.selected),m==="canvas"&&p){if(t.__context==="2d")fn(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var X=t.toDataURL(d.type,d.quality),$=document.createElement("canvas");$.width=t.width,$.height=t.height;var ee=$.toDataURL(d.type,d.quality);X!==ee&&(g.rr_dataURL=X)}}if(m==="img"&&u){ke||(ke=r.createElement("canvas"),lr=ke.getContext("2d"));var B=t,j=B.crossOrigin;B.crossOrigin="anonymous";var re=function(){try{ke.width=B.naturalWidth,ke.height=B.naturalHeight,lr.drawImage(B,0,0),g.rr_dataURL=ke.toDataURL(d.type,d.quality)}catch(Q){console.warn("Cannot inline img src=".concat(B.currentSrc,"! Error: ").concat(Q))}j?g.crossOrigin=j:B.removeAttribute("crossorigin")};B.complete&&B.naturalWidth!==0?re():B.onload=re}if((m==="audio"||m==="video")&&(g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime),y||(t.scrollLeft&&(g.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(g.rr_scrollTop=t.scrollTop)),v){var se=t.getBoundingClientRect(),ce=se.width,V=se.height;g={class:g.class,rr_width:"".concat(ce,"px"),rr_height:"".concat(V,"px")}}return m==="iframe"&&!f(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:D.Element,tagName:m,attributes:g,childNodes:[],isSVG:Tn(t)||void 0,needBlock:v,rootId:I}}function R(t){return t===void 0?"":t.toLowerCase()}function Pn(t,e){if(e.comment&&t.type===D.Comment)return!0;if(t.type===D.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(R(t.attributes.name).match(/^msapplication-tile(image|color)$/)||R(t.attributes.name)==="application-name"||R(t.attributes.rel)==="icon"||R(t.attributes.rel)==="apple-touch-icon"||R(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&R(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(R(t.attributes.property).match(/^(og|twitter|fb):/)||R(t.attributes.name).match(/^(og|twitter):/)||R(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(R(t.attributes.name)==="robots"||R(t.attributes.name)==="googlebot"||R(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(R(t.attributes.name)==="author"||R(t.attributes.name)==="generator"||R(t.attributes.name)==="framework"||R(t.attributes.name)==="publisher"||R(t.attributes.name)==="progid"||R(t.attributes.property).match(/^article:/)||R(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(R(t.attributes.name)==="google-site-verification"||R(t.attributes.name)==="yandex-verification"||R(t.attributes.name)==="csrf-token"||R(t.attributes.name)==="p:domain_verify"||R(t.attributes.name)==="verify-v1"||R(t.attributes.name)==="verification"||R(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function me(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,c=e.skipChild,l=c===void 0?!1:c,d=e.inlineStylesheet,u=d===void 0?!0:d,p=e.maskInputOptions,f=p===void 0?{}:p,h=e.maskTextFn,y=e.maskInputFn,I=e.slimDOMOptions,v=e.dataURLOptions,m=v===void 0?{}:v,g=e.inlineImages,S=g===void 0?!1:g,_=e.recordCanvas,L=_===void 0?!1:_,P=e.onSerialize,T=e.onIframeLoad,Y=e.iframeLoadTimeout,J=Y===void 0?5e3:Y,X=e.onStylesheetLoad,$=e.stylesheetLoadTimeout,ee=$===void 0?5e3:$,B=e.keepIframeSrcFn,j=B===void 0?function(){return!1}:B,re=e.newlyAddedElement,se=re===void 0?!1:re,ce=e.preserveWhiteSpace,V=ce===void 0?!0:ce,Q=Mn(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:y,dataURLOptions:m,inlineImages:S,recordCanvas:L,keepIframeSrcFn:j,newlyAddedElement:se});if(!Q)return console.warn(t,"not serialized"),null;var de;n.hasNode(t)?de=n.getId(t):Pn(Q,I)||!V&&Q.type===D.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?de=ye:de=kt();var O=Object.assign(Q,{id:de});if(n.add(t,O),de===ye)return null;P&&P(t);var ne=!l;if(O.type===D.Element){ne=ne&&!O.needBlock,delete O.needBlock;var ae=t.shadowRoot;ae&&ge(ae)&&(O.isShadowHost=!0)}if((O.type===D.Document||O.type===D.Element)&&ne){I.headWhitespace&&O.type===D.Element&&O.tagName==="head"&&(V=!1);for(var Se={doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:y,slimDOMOptions:I,dataURLOptions:m,inlineImages:S,recordCanvas:L,preserveWhiteSpace:V,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:j},C=0,U=Array.from(t.childNodes);C<U.length;C++){var H=U[C],x=me(H,Se);x&&O.childNodes.push(x)}if(un(t)&&t.shadowRoot)for(var q=0,k=Array.from(t.shadowRoot.childNodes);q<k.length;q++){var H=k[q],x=me(H,Se);x&&(ge(t.shadowRoot)&&(x.isShadow=!0),O.childNodes.push(x))}}return t.parentNode&&ve(t.parentNode)&&ge(t.parentNode)&&(O.isShadow=!0),O.type===D.Element&&O.tagName==="iframe"&&Rn(t,function(){var Z=t.contentDocument;if(Z&&T){var Me=me(Z,{doc:Z,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:y,slimDOMOptions:I,dataURLOptions:m,inlineImages:S,recordCanvas:L,preserveWhiteSpace:V,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:j});Me&&T(t,Me)}},J),O.type===D.Element&&O.tagName==="link"&&O.attributes.rel==="stylesheet"&&xn(t,function(){if(X){var Z=me(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:y,slimDOMOptions:I,dataURLOptions:m,inlineImages:S,recordCanvas:L,preserveWhiteSpace:V,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:j});Z&&X(t,Z)}},ee),O}function hr(t,e){var r=e||{},n=r.mirror,i=n===void 0?new dr:n,o=r.blockClass,a=o===void 0?"rr-block":o,s=r.blockSelector,c=s===void 0?null:s,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,p=u===void 0?null:u,f=r.inlineStylesheet,h=f===void 0?!0:f,y=r.inlineImages,I=y===void 0?!1:y,v=r.recordCanvas,m=v===void 0?!1:v,g=r.maskAllInputs,S=g===void 0?!1:g,_=r.maskTextFn,L=r.maskInputFn,P=r.slimDOM,T=P===void 0?!1:P,Y=r.dataURLOptions,J=r.preserveWhiteSpace,X=r.onSerialize,$=r.onIframeLoad,ee=r.iframeLoadTimeout,B=r.onStylesheetLoad,j=r.stylesheetLoadTimeout,re=r.keepIframeSrcFn,se=re===void 0?function(){return!1}:re,ce=S===!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}:S===!1?{password:!0}:S,V=T===!0||T==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:T==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:T===!1?{}:T;return me(t,{doc:t,mirror:i,blockClass:a,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:ce,maskTextFn:_,maskInputFn:L,slimDOMOptions:V,dataURLOptions:Y,inlineImages:I,recordCanvas:m,preserveWhiteSpace:J,onSerialize:X,onIframeLoad:$,iframeLoadTimeout:ee,onStylesheetLoad:B,stylesheetLoadTimeout:j,keepIframeSrcFn:se,newlyAddedElement:!1})}var Bn=/([^\\]):hover/,Zi=new RegExp(Bn.source,"g");function W(t,e,r=document){let n={capture:!0,passive:!0};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Te=`Please stop import mirror directly. Instead of that,\r
2
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.`,ar={map:{},getId(){return console.error(Te),-1},getNode(){return console.error(Te),null},removeNodeFromMap(){console.error(Te)},has(){return console.error(Te),!1},reset(){console.error(Te)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(ar=new Proxy(ar,{get(t,e,r){return e==="map"&&console.error(Te),Reflect.get(t,e,r)}}));function Re(t,e,r={}){let i=null,n=0;return function(...s){let a=Date.now();!n&&r.leading===!1&&(n=a);let o=e-(a-n),c=this;o<=0||o>e?(i&&(clearTimeout(i),i=null),n=a,t.apply(c,s)):!i&&r.trailing!==!1&&(i=setTimeout(()=>{n=r.leading===!1?0:Date.now(),i=null,t.apply(c,s)},o))}}function Ie(t,e,r,i,n=window){let s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>Ie(t,e,s||{},!0)}function ne(t,e,r){try{if(!(e in t))return()=>{};let i=t[e],n=r(i);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i}})),t[e]=n,()=>{t[e]=i}}catch(i){return()=>{}}}function Ye(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Je(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function x(t,e,r,i){if(!t)return!1;let n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!n)return!1;if(typeof e=="string"){if(n.classList.contains(e)||i&&n.closest("."+e)!==null)return!0}else if(Oe(n,e,i))return!0;return!!(r&&(t.matches(r)||i&&n.closest(r)!==null))}function cr(t,e){return e.getId(t)!==-1}function Qe(t,e){return e.getId(t)===ye}function Tt(t,e){if(ve(t))return!1;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?Tt(t.parentNode,e):!0:!0}function Rt(t){return!!t.changedTouches}function lr(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function je(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function qe(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Xe(t){return!!(t!=null&&t.shadowRoot)}var ze=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var r;return(r=this.styleIDMap.get(e))!==null&&r!==void 0?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let i;return r===void 0?i=this.id++:i=r,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};var w=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(w||{}),b=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(b||{}),$e=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))($e||{}),le=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(le||{});function dr(t){return"__ln"in t}var Et=class{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let i=0;i<e;i++)r=(r==null?void 0:r.next)||null;return r}addNode(e){let r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&dr(e.previousSibling)){let i=e.previousSibling.__ln.next;r.next=i,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,i&&(i.previous=r)}else if(e.nextSibling&&dr(e.nextSibling)&&e.nextSibling.__ln.previous){let i=e.nextSibling.__ln.previous;r.previous=i,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,i&&(i.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++}removeNode(e){let r=e.__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)),e.__ln&&delete e.__ln,this.length--)}},ur=(t,e)=>`${t}@${e}`,et=class{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=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],r=new Et,i=o=>{let c=o,l=ye;for(;l===ye;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},n=o=>{var c,l,d,u;let p=null;((l=(c=o.getRootNode)===null||c===void 0?void 0:c.call(o))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&o.getRootNode().host&&(p=o.getRootNode().host);let m=p;for(;((u=(d=m==null?void 0:m.getRootNode)===null||d===void 0?void 0:d.call(m))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&m.getRootNode().host;)m=m.getRootNode().host;let h=!this.doc.contains(o)&&(!m||!this.doc.contains(m));if(!o.parentNode||h)return;let y=ve(o.parentNode)?this.mirror.getId(p):this.mirror.getId(o.parentNode),I=i(o);if(y===-1||I===-1)return r.addNode(o);let v=me(o,{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=>{je(f,this.mirror)&&this.iframeManager.addIframe(f),qe(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Xe(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(f,g)=>{this.iframeManager.attachIframe(f,g),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,g)=>{this.stylesheetManager.attachLinkElement(f,g)}});v&&e.push({parentId:y,nextId:I,node:v})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let o of Array.from(this.movedSet.values()))hr(this.removes,o,this.mirror)&&!this.movedSet.has(o.parentNode)||n(o);for(let o of Array.from(this.addedSet.values()))!pr(this.droppedSet,o)&&!hr(this.removes,o,this.mirror)||pr(this.movedSet,o)?n(o):this.droppedSet.add(o);let s=null;for(;r.length;){let o=null;if(s){let c=this.mirror.getId(s.value.parentNode),l=i(s.value);c!==-1&&l!==-1&&(o=s)}if(!o)for(let c=r.length-1;c>=0;c--){let l=r.get(c);if(l){let d=this.mirror.getId(l.value.parentNode);if(i(l.value)===-1)continue;if(d!==-1){o=l;break}else{let p=l.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=p.parentNode.host;if(this.mirror.getId(m)!==-1){o=l;break}}}}}if(!o){for(;r.head;)r.removeNode(r.head.value);break}s=o.previous,r.removeNode(o.value),n(o.value)}let a={texts:this.texts.map(o=>({id:this.mirror.getId(o.node),value:o.value})).filter(o=>this.mirror.has(o.id)),attributes:this.attributes.map(o=>({id:this.mirror.getId(o.node),attributes:o.attributes})).filter(o=>this.mirror.has(o.id)),removes:this.removes,adds:e};!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=e=>{if(!Qe(e.target,this.mirror))switch(e.type){case"characterData":{let r=e.target.textContent;!x(e.target,this.blockClass,this.blockSelector,!1)&&r!==e.oldValue&&this.texts.push({value:kt(e.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:e.target});break}case"attributes":{let r=e.target,i=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(i=Le({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:i,maskInputFn:this.maskInputFn})),x(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributes.find(s=>s.node===e.target);if(r.tagName==="IFRAME"&&e.attributeName==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)e.attributeName="rr_src";else return;if(n||(n={node:e.target,attributes:{}},this.attributes.push(n)),e.attributeName==="style"){let s=this.doc.createElement("span");e.oldValue&&s.setAttribute("style",e.oldValue),(n.attributes.style===void 0||n.attributes.style===null)&&(n.attributes.style={});let a=n.attributes.style;for(let o of Array.from(r.style)){let c=r.style.getPropertyValue(o),l=r.style.getPropertyPriority(o);(c!==s.style.getPropertyValue(o)||l!==s.style.getPropertyPriority(o))&&(l===""?a[o]=c:a[o]=[c,l])}for(let o of Array.from(s.style))r.style.getPropertyValue(o)===""&&(a[o]=!1)}else n.attributes[e.attributeName]=At(this.doc,r.tagName,e.attributeName,i);break}case"childList":{if(x(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let i=this.mirror.getId(r),n=ve(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);x(e.target,this.blockClass,this.blockSelector,!1)||Qe(r,this.mirror)||!cr(r,this.mirror)||(this.addedSet.has(r)?(Mt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&i===-1||Tt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ur(i,n)]?Mt(this.movedSet,r):this.removes.push({parentId:n,id:i,isShadow:ve(e.target)&&ge(e.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(Qe(e,this.mirror))return;this.movedSet.add(e);let i=null;r&&this.mirror.hasNode(r)&&(i=this.mirror.getId(r)),i&&i!==-1&&(this.movedMap[ur(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);x(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(i=>this.genAdds(i))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=e[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 Mt(t,e){t.delete(e),e.childNodes.forEach(r=>Mt(t,r))}function hr(t,e,r){return t.length===0?!1:fr(t,e,r)}function fr(t,e,r){let{parentNode:i}=e;if(!i)return!1;let n=r.getId(i);return t.some(s=>s.id===n)?!0:fr(t,i,r)}function pr(t,e){return t.size===0?!1:mr(t,e)}function mr(t,e){let{parentNode:r}=e;return r?t.has(r)?!0:mr(t,r):!1}var pe=[],vr=typeof CSSGroupingRule!="undefined",Ir=typeof CSSMediaRule!="undefined",Cr=typeof CSSSupportsRule!="undefined",br=typeof CSSConditionRule!="undefined";function Pe(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch(e){return t.target}}function xt(t,e){var r,i;let n=new et;pe.push(n),n.init(t);let s=window.MutationObserver||window.__rrMutationObserver,a=(i=(r=window==null?void 0:window.Zone)===null||r===void 0?void 0:r.__symbol__)===null||i===void 0?void 0:i.call(r,"MutationObserver");a&&window[a]&&(s=window[a]);let o=new s(n.processMutations.bind(n));return o.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),o}function Ai({mousemoveCb:t,sampling:e,doc:r,mirror:i}){if(e.mousemove===!1)return()=>{};let n=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,a=[],o,c=Re(u=>{let p=Date.now()-o;t(a.map(m=>(m.timeOffset-=p,m)),u),a=[],o=null},s),l=Re(u=>{let p=Pe(u),{clientX:m,clientY:h}=Rt(u)?u.changedTouches[0]:u;o||(o=Date.now()),a.push({x:m,y:h,id:i.getId(p),timeOffset:Date.now()-o}),c(typeof DragEvent!="undefined"&&u instanceof DragEvent?b.Drag:u instanceof MouseEvent?b.MouseMove:b.TouchMove)},n,{trailing:!1}),d=[W("mousemove",l,r),W("touchmove",l,r),W("drag",l,r)];return()=>{d.forEach(u=>u())}}function ki({mouseInteractionCb:t,doc:e,mirror:r,blockClass:i,blockSelector:n,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,o=[],c=l=>d=>{let u=Pe(d);if(x(u,i,n,!0))return;let p=Rt(d)?d.changedTouches[0]:d;if(!p)return;let m=r.getId(u),{clientX:h,clientY:y}=p;t({type:$e[l],id:m,x:h,y})};return Object.keys($e).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let d=l.toLowerCase(),u=c(l);o.push(W(d,u,e))}),()=>{o.forEach(l=>l())}}function Nt({scrollCb:t,doc:e,mirror:r,blockClass:i,blockSelector:n,sampling:s}){let a=Re(o=>{let c=Pe(o);if(!c||x(c,i,n,!0))return;let l=r.getId(c);if(c===e){let d=e.scrollingElement||e.documentElement;t({id:l,x:d.scrollLeft,y:d.scrollTop})}else t({id:l,x:c.scrollLeft,y:c.scrollTop})},s.scroll||100);return W("scroll",a,e)}function Ti({viewportResizeCb:t}){let e=-1,r=-1,i=Re(()=>{let n=Ye(),s=Je();(e!==n||r!==s)&&(t({width:Number(s),height:Number(n)}),e=n,r=s)},200);return W("resize",i,window)}function gr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Ri=["INPUT","TEXTAREA","SELECT"],yr=new WeakMap;function Ei({inputCb:t,doc:e,mirror:r,blockClass:i,blockSelector:n,ignoreClass:s,maskInputOptions:a,maskInputFn:o,sampling:c,userTriggeredOnInput:l}){function d(v){let f=Pe(v),g=v.isTrusted;if(f&&f.tagName==="OPTION"&&(f=f.parentElement),!f||!f.tagName||Ri.indexOf(f.tagName)<0||x(f,i,n,!0))return;let S=f.type;if(f.classList.contains(s))return;let _=f.value,L=!1;S==="radio"||S==="checkbox"?L=f.checked:(a[f.tagName.toLowerCase()]||a[S])&&(_=Le({maskInputOptions:a,tagName:f.tagName,type:S,value:_,maskInputFn:o})),u(f,gr({text:_,isChecked:L,userTriggered:g},l));let P=f.name;S==="radio"&&P&&L&&e.querySelectorAll(`input[type="radio"][name="${P}"]`).forEach(T=>{T!==f&&u(T,gr({text:T.value,isChecked:!L,userTriggered:!1},l))})}function u(v,f){let g=yr.get(v);if(!g||g.text!==f.text||g.isChecked!==f.isChecked){yr.set(v,f);let S=r.getId(v);t(Object.assign(Object.assign({},f),{id:S}))}}let m=(c.input==="last"?["change"]:["input","change"]).map(v=>W(v,d,e)),h=e.defaultView;if(!h)return()=>{m.forEach(v=>v())};let y=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),I=[[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 y&&y.set&&m.push(...I.map(v=>Ie(v[0],v[1],{set(){d({target:this})}},!1,h))),()=>{m.forEach(v=>v())}}function tt(t){let e=[];function r(i,n){if(vr&&i.parentRule instanceof CSSGroupingRule||Ir&&i.parentRule instanceof CSSMediaRule||Cr&&i.parentRule instanceof CSSSupportsRule||br&&i.parentRule instanceof CSSConditionRule){let a=Array.from(i.parentRule.cssRules).indexOf(i);n.unshift(a)}else if(i.parentStyleSheet){let a=Array.from(i.parentStyleSheet.cssRules).indexOf(i);n.unshift(a)}return n}return r(t,e)}function he(t,e,r){let i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function Mi({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:i}){let n=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:p,styleId:m}=he(this,e,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&t({id:p,styleId:m,adds:[{rule:d,index:u}]}),n.apply(this,[d,u])};let s=i.CSSStyleSheet.prototype.deleteRule;i.CSSStyleSheet.prototype.deleteRule=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,removes:[{index:d}]}),s.apply(this,[d])};let a;i.CSSStyleSheet.prototype.replace&&(a=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replace:d}),a.apply(this,[d])});let o;i.CSSStyleSheet.prototype.replaceSync&&(o=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),o.apply(this,[d])});let c={};vr?c.CSSGroupingRule=i.CSSGroupingRule:(Ir&&(c.CSSMediaRule=i.CSSMediaRule),br&&(c.CSSConditionRule=i.CSSConditionRule),Cr&&(c.CSSSupportsRule=i.CSSSupportsRule));let l={};return Object.entries(c).forEach(([d,u])=>{l[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(p,m){let{id:h,styleId:y}=he(this.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||y&&y!==-1)&&t({id:h,styleId:y,adds:[{rule:p,index:[...tt(this),m||0]}]}),l[d].insertRule.apply(this,[p,m])},u.prototype.deleteRule=function(p){let{id:m,styleId:h}=he(this.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&t({id:m,styleId:h,removes:[{index:[...tt(this),p]}]}),l[d].deleteRule.apply(this,[p])}}),()=>{i.CSSStyleSheet.prototype.insertRule=n,i.CSSStyleSheet.prototype.deleteRule=s,a&&(i.CSSStyleSheet.prototype.replace=a),o&&(i.CSSStyleSheet.prototype.replaceSync=o),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule})}}function Ot({mirror:t,stylesheetManager:e},r){var i,n,s;let a=null;r.nodeName==="#document"?a=t.getId(r):a=t.getId(r.host);let o=r.nodeName==="#document"?(i=r.defaultView)===null||i===void 0?void 0:i.Document:(s=(n=r.ownerDocument)===null||n===void 0?void 0:n.defaultView)===null||s===void 0?void 0:s.ShadowRoot,c=Object.getOwnPropertyDescriptor(o==null?void 0:o.prototype,"adoptedStyleSheets");return a===null||a===-1||!o||!c?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return(l=c.get)===null||l===void 0?void 0:l.call(this)},set(l){var d;let u=(d=c.set)===null||d===void 0?void 0:d.call(this,l);if(a!==null&&a!==-1)try{e.adoptStyleSheets(l,a)}catch(p){}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})}function xi({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:i},{win:n}){let s=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=function(o,c,l){var d;if(r.has(o))return s.apply(this,[o,c,l]);let{id:u,styleId:p}=he((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,i.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,set:{property:o,value:c,priority:l},index:tt(this.parentRule)}),s.apply(this,[o,c,l])};let a=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=function(o){var c;if(r.has(o))return a.apply(this,[o]);let{id:l,styleId:d}=he((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,e,i.styleMirror);return(l&&l!==-1||d&&d!==-1)&&t({id:l,styleId:d,remove:{property:o},index:tt(this.parentRule)}),a.apply(this,[o])},()=>{n.CSSStyleDeclaration.prototype.setProperty=s,n.CSSStyleDeclaration.prototype.removeProperty=a}}function Ni({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:i,sampling:n}){let s=o=>Re(c=>{let l=Pe(c);if(!l||x(l,e,r,!0))return;let{currentTime:d,volume:u,muted:p,playbackRate:m}=l;t({type:o,id:i.getId(l),currentTime:d,volume:u,muted:p,playbackRate:m})},n.media||500),a=[W("play",s(0)),W("pause",s(1)),W("seeked",s(2)),W("volumechange",s(3)),W("ratechange",s(4))];return()=>{a.forEach(o=>o())}}function Oi({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return()=>{};let i=[],n=new WeakMap,s=r.FontFace;r.FontFace=function(c,l,d){let u=new s(c,l,d);return n.set(u,{family:c,buffer:typeof l!="string",descriptors:d,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),u};let a=ne(e.fonts,"add",function(o){return function(c){return setTimeout(()=>{let l=n.get(c);l&&(t(l),n.delete(c))},0),o.apply(this,[c])}});return i.push(()=>{r.FontFace=s}),i.push(a),()=>{i.forEach(o=>o())}}function Li(t){let{doc:e,mirror:r,blockClass:i,blockSelector:n,selectionCb:s}=t,a=!0,o=()=>{let c=e.getSelection();if(!c||a&&(c!=null&&c.isCollapsed))return;a=c.isCollapsed||!1;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let p=c.getRangeAt(u),{startContainer:m,startOffset:h,endContainer:y,endOffset:I}=p;x(m,i,n,!0)||x(y,i,n,!0)||l.push({start:r.getId(m),startOffset:h,end:r.getId(y),endOffset:I})}s({ranges:l})};return o(),W("selectionchange",o)}function Pi(t,e){let{mutationCb:r,mousemoveCb:i,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:a,inputCb:o,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:m}=t;t.mutationCb=(...h)=>{e.mutation&&e.mutation(...h),r(...h)},t.mousemoveCb=(...h)=>{e.mousemove&&e.mousemove(...h),i(...h)},t.mouseInteractionCb=(...h)=>{e.mouseInteraction&&e.mouseInteraction(...h),n(...h)},t.scrollCb=(...h)=>{e.scroll&&e.scroll(...h),s(...h)},t.viewportResizeCb=(...h)=>{e.viewportResize&&e.viewportResize(...h),a(...h)},t.inputCb=(...h)=>{e.input&&e.input(...h),o(...h)},t.mediaInteractionCb=(...h)=>{e.mediaInteaction&&e.mediaInteaction(...h),c(...h)},t.styleSheetRuleCb=(...h)=>{e.styleSheetRule&&e.styleSheetRule(...h),l(...h)},t.styleDeclarationCb=(...h)=>{e.styleDeclaration&&e.styleDeclaration(...h),d(...h)},t.canvasMutationCb=(...h)=>{e.canvasMutation&&e.canvasMutation(...h),u(...h)},t.fontCb=(...h)=>{e.font&&e.font(...h),p(...h)},t.selectionCb=(...h)=>{e.selection&&e.selection(...h),m(...h)}}function Sr(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};Pi(t,e);let i=xt(t,t.doc),n=Ai(t),s=ki(t),a=Nt(t),o=Ti(t),c=Ei(t),l=Ni(t),d=Mi(t,{win:r}),u=Ot(t,t.doc),p=xi(t,{win:r}),m=t.collectFonts?Oi(t):()=>{},h=Li(t),y=[];for(let I of t.plugins)y.push(I.observer(I.callback,r,I.options));return()=>{pe.forEach(I=>I.reset()),i.disconnect(),n(),s(),a(),o(),c(),l(),d(),u(),p(),m(),h(),y.forEach(I=>I())}}var Fe=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,r,i,n){let s=i||this.getIdToRemoteIdMap(e),a=n||this.getRemoteIdToIdMap(e),o=s.get(r);return o||(o=this.generateIdFn(),s.set(r,o),a.set(o,r)),o}getIds(e,r){let i=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return r.map(s=>this.getId(e,s,i,n))}getRemoteId(e,r,i){let n=i||this.getRemoteIdToIdMap(e);if(typeof r!="number")return r;let s=n.get(r);return s||-1}getRemoteIds(e,r){let i=this.getRemoteIdToIdMap(e);return r.map(n=>this.getRemoteId(e,n,i))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}};var rt=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Fe(St),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Fe(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,r){var i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(i=this.loadListener)===null||i===void 0||i.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){if(e.data.type==="rrweb"){if(!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,r){var i;switch(r.type){case w.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:w.IncrementalSnapshot,data:{source:b.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case w.Meta:case w.Load:case w.DomContentLoaded:return!1;case w.Plugin:return r;case w.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case w.IncrementalSnapshot:switch(r.data.source){case b.Mutation:return r.data.adds.forEach(n=>{this.replaceIds(n,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,e)}),r.data.removes.forEach(n=>{this.replaceIds(n,e,["parentId","id"])}),r.data.attributes.forEach(n=>{this.replaceIds(n,e,["id"])}),r.data.texts.forEach(n=>{this.replaceIds(n,e,["id"])}),r;case b.Drag:case b.TouchMove:case b.MouseMove:return r.data.positions.forEach(n=>{this.replaceIds(n,e,["id"])}),r;case b.ViewportResize:return!1;case b.MediaInteraction:case b.MouseInteraction:case b.Scroll:case b.CanvasMutation:case b.Input:return this.replaceIds(r.data,e,["id"]),r;case b.StyleSheetRule:case b.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case b.Font:return r;case b.Selection:return r.data.ranges.forEach(n=>{this.replaceIds(n,e,["start","end"])}),r;case b.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(i=r.data.styles)===null||i===void 0||i.forEach(n=>{this.replaceStyleIds(n,e,["styleId"])}),r}}}replace(e,r,i,n){for(let s of n)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=e.getIds(i,r[s]):r[s]=e.getId(i,r[s]));return r}replaceIds(e,r,i){return this.replace(this.crossOriginIframeMirror,e,r,i)}replaceStyleIds(e,r,i){return this.replace(this.crossOriginIframeStyleMirror,e,r,i)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id"]),"childNodes"in e&&e.childNodes.forEach(i=>{this.replaceIdOnNode(i,r)})}};var it=class{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;let r=this;this.restorePatches.push(ne(Element.prototype,"attachShadow",function(i){return function(n){let s=i.call(this,n);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),s}}))}addShadowRoot(e,r){ge(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),xt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Nt(Object.assign(Object.assign({},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(e.host)),Ot({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ne(e.contentWindow.HTMLElement.prototype,"attachShadow",function(i){return function(n){let s=i.call(this,n);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,e.contentDocument),s}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}};function wr(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function Ar(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(d){try{l(i.next(d))}catch(u){a(u)}}function c(d){try{l(i.throw(d))}catch(u){a(u)}}function l(d){d.done?s(d.value):n(d.value).then(o,c)}l((i=i.apply(t,e||[])).next())})}var Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fi=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(De=0;De<Ee.length;De++)Fi[Ee.charCodeAt(De)]=De;var De,kr=function(t){var e=new Uint8Array(t),r,i=e.length,n="";for(r=0;r<i;r+=3)n+=Ee[e[r]>>2],n+=Ee[(e[r]&3)<<4|e[r+1]>>4],n+=Ee[(e[r+1]&15)<<2|e[r+2]>>6],n+=Ee[e[r+2]&63];return i%3===2?n=n.substring(0,n.length-1)+"=":i%3===1&&(n=n.substring(0,n.length-2)+"=="),n};var Tr=new Map;function Di(t,e){let r=Tr.get(t);return r||(r=new Map,Tr.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Lt=(t,e,r)=>{if(!t||!(Rr(t,e)||typeof t=="object"))return;let i=t.constructor.name,n=Di(r,i),s=n.indexOf(t);return s===-1&&(s=n.length,n.push(t)),s};function nt(t,e,r){if(t instanceof Array)return t.map(i=>nt(i,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let i=t.constructor.name,n=kr(t);return{rr_type:i,base64:n}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[nt(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let i=t.constructor.name,{src:n}=t;return{rr_type:i,src:n}}else if(t instanceof HTMLCanvasElement){let i="HTMLImageElement",n=t.toDataURL();return{rr_type:i,src:n}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[nt(t.data,e,r),t.width,t.height]};if(Rr(t,e)||typeof t=="object"){let i=t.constructor.name,n=Lt(t,e,r);return{rr_type:i,index:n}}}}return t}var st=(t,e,r)=>[...t].map(i=>nt(i,e,r)),Rr=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof e[n]=="function").find(n=>t instanceof e[n]);function Er(t,e,r,i){let n=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let a of s)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;let o=ne(e.CanvasRenderingContext2D.prototype,a,function(c){return function(...l){return x(this.canvas,r,i,!0)||setTimeout(()=>{let d=st([...l],e,this);t(this.canvas,{type:le["2D"],property:a,args:d})},0),c.apply(this,l)}});n.push(o)}catch(o){let c=Ie(e.CanvasRenderingContext2D.prototype,a,{set(l){t(this.canvas,{type:le["2D"],property:a,args:[l],setter:!0})}});n.push(c)}return()=>{n.forEach(a=>a())}}function Pt(t,e,r){let i=[];try{let n=ne(t.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...o){return x(this,e,r,!0)||"__context"in this||(this.__context=a),s.apply(this,[a,...o])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Mr(t,e,r,i,n,s,a){let o=[],c=Object.getOwnPropertyNames(t);for(let l of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof t[l]!="function")continue;let d=ne(t,l,function(u){return function(...p){let m=u.apply(this,p);if(Lt(m,a,this),!x(this.canvas,i,n,!0)){let h=st([...p],a,this),y={type:e,property:l,args:h};r(this.canvas,y)}return m}});o.push(d)}catch(d){let u=Ie(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:!0})}});o.push(u)}return o}function xr(t,e,r,i,n){let s=[];return s.push(...Mr(e.WebGLRenderingContext.prototype,le.WebGL,t,r,i,n,e)),typeof e.WebGL2RenderingContext!="undefined"&&s.push(...Mr(e.WebGL2RenderingContext.prototype,le.WebGL2,t,r,i,n,e)),()=>{s.forEach(a=>a())}}var Ft=null;try{Nr=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ft=="function"&&ft("worker_threads"),Ft=Nr.Worker}catch(t){}var Nr;function Bi(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}function Or(t,e,r){var i=e===void 0?null:e,n=r===void 0?!1:r,s=Bi(t,n),a=s.indexOf(`
4
- `,10)+1,o=s.substring(a)+(i?"//# sourceMappingURL="+i:"");return function(l){return new Ft(o,Object.assign({},l,{eval:!0}))}}function _i(t,e){var r=atob(t);if(e){for(var i=new Uint8Array(r.length),n=0,s=r.length;n<s;++n)i[n]=r.charCodeAt(n);return String.fromCharCode.apply(null,new Uint16Array(i.buffer))}return r}function Wi(t,e,r){var i=e===void 0?null:e,n=r===void 0?!1:r,s=_i(t,n),a=s.indexOf(`
5
- `,10)+1,o=s.substring(a)+(i?"//# sourceMappingURL="+i:""),c=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(c)}function Lr(t,e,r){var i;return function(s){return i=i||Wi(t,e,r),new Worker(i,s)}}var Ui=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Pr(){return Ui}function Fr(t,e,r){return Pr()?Or(t,e,r):Lr(t,e,r)}var Dr=Fr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);var ot=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(l)};let{sampling:r="all",win:i,blockClass:n,blockSelector:s,recordCanvas:a,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&r==="all"&&this.initCanvasMutationObserver(i,n,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:o})}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,r,i,n,s){let a=Pt(r,i,n),o=new Map,c=new Dr;c.onmessage=h=>{let{id:y}=h.data;if(o.set(y,!1),!("base64"in h.data))return;let{base64:I,type:v,width:f,height:g}=h.data;this.mutationCb({id:y,type:le["2D"],commands:[{property:"clearRect",args:[0,0,f,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:I}],type:v}]},0,0]}]})};let l=1e3/e,d=0,u,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(y=>{x(y,i,n,!0)||h.push(y)}),h},m=h=>{if(d&&h-d<l){u=requestAnimationFrame(m);return}d=h,p().forEach(y=>Ar(this,void 0,void 0,function*(){var I;let v=this.mirror.getId(y);if(o.get(v))return;if(o.set(v,!0),["webgl","webgl2"].includes(y.__context)){let g=y.getContext(y.__context);((I=g==null?void 0:g.getContextAttributes())===null||I===void 0?void 0:I.preserveDrawingBuffer)===!1&&(g==null||g.clear(g.COLOR_BUFFER_BIT))}let f=yield createImageBitmap(y);c.postMessage({id:v,bitmap:f,width:y.width,height:y.height,dataURLOptions:s.dataURLOptions},[f])})),u=requestAnimationFrame(m)};u=requestAnimationFrame(m),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=Pt(e,r,i),s=Er(this.processMutation.bind(this),e,r,i),a=xr(this.processMutation.bind(this),e,r,i,this.mirror);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{let i=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,i)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;let i=this.pendingCanvasMutations.get(e);if(!i||r===-1)return;let n=i.map(a=>wr(a,["type"])),{type:s}=i[0];this.mutationCb({id:r,type:s,commands:n}),this.pendingCanvasMutations.delete(e)}};var at=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ze,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,r){if(e.length===0)return;let i={id:r,styleIds:[]},n=[];for(let s of e){let a;if(this.styleMirror.has(s))a=this.styleMirror.getId(s);else{a=this.styleMirror.add(s);let o=Array.from(s.rules||CSSRule);n.push({styleId:a,rules:o.map((c,l)=>({rule:bt(c),index:l}))})}i.styleIds.push(a)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}};function D(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var N,ct,Dt,lt=!1,se=sr();function Ce(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:i,blockClass:n="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",maskTextClass:o="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:p,maskInputFn:m,maskTextFn:h,hooks:y,packFn:I,sampling:v={},dataURLOptions:f={},mousemoveWait:g,recordCanvas:S=!1,recordCrossOriginIframes:_=!1,userTriggeredOnInput:L=!1,collectFonts:P=!1,inlineImages:T=!1,plugins:Y,keepIframeSrcFn:J=()=>!1,ignoreCSSAttributes:X=new Set([])}=t,$=_?window.parent===window:!0,ee=!1;if(!$)try{window.parent.document,ee=!1}catch(C){ee=!0}if($&&!e)throw new Error("emit function is required");g!==void 0&&v.mousemove===void 0&&(v.mousemove=g),se.reset();let F=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}:u!==void 0?u:{password:!0},Q=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||{};lr();let re,oe=0,ce=C=>{for(let U of Y||[])U.eventProcessor&&(C=U.eventProcessor(C));return I&&(C=I(C)),C};N=(C,U)=>{var Z;if(!((Z=pe[0])===null||Z===void 0)&&Z.isFrozen()&&C.type!==w.FullSnapshot&&!(C.type===w.IncrementalSnapshot&&C.data.source===b.Mutation)&&pe.forEach(M=>M.unfreeze()),$)e==null||e(ce(C),U);else if(ee){let M={type:"rrweb",event:ce(C),isCheckout:U};window.parent.postMessage(M,"*")}if(C.type===w.FullSnapshot)re=C,oe=0;else if(C.type===w.IncrementalSnapshot){if(C.data.source===b.Mutation&&C.data.isAttachIframe)return;oe++;let M=i&&oe>=i,q=r&&C.timestamp-re.timestamp>r;(M||q)&&ct(!0)}};let H=C=>{N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.Mutation},C)}))},j=C=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.Scroll},C)})),de=C=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},C)})),O=C=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},C)})),ie=new at({mutationCb:H,adoptedStyleSheetCb:O}),ae=new rt({mirror:se,mutationCb:H,stylesheetManager:ie,recordCrossOriginIframes:_,wrappedEmit:N});for(let C of Y||[])C.getMirror&&C.getMirror({nodeMirror:se,crossOriginIframeMirror:ae.crossOriginIframeMirror,crossOriginIframeStyleMirror:ae.crossOriginIframeStyleMirror});Dt=new ot({recordCanvas:S,mutationCb:de,win:window,blockClass:n,blockSelector:s,mirror:se,sampling:v.canvas,dataURLOptions:f});let Se=new it({mutationCb:H,scrollCb:j,bypassOptions:{blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:F,dataURLOptions:f,maskTextFn:h,maskInputFn:m,recordCanvas:S,inlineImages:T,sampling:v,slimDOMOptions:Q,iframeManager:ae,stylesheetManager:ie,canvasManager:Dt,keepIframeSrcFn:J},mirror:se});ct=(C=!1)=>{var U,Z,M,q,A,K;N(D({type:w.Meta,data:{href:window.location.href,width:Je(),height:Ye()}}),C),ie.reset(),pe.forEach(G=>G.lock());let Me=or(document,{mirror:se,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:F,maskTextFn:h,slimDOM:Q,dataURLOptions:f,recordCanvas:S,inlineImages:T,onSerialize:G=>{je(G,se)&&ae.addIframe(G),qe(G,se)&&ie.trackLinkElement(G),Xe(G)&&Se.addShadowRoot(G.shadowRoot,document)},onIframeLoad:(G,ht)=>{ae.attachIframe(G,ht),Se.observeAttachShadow(G)},onStylesheetLoad:(G,ht)=>{ie.attachLinkElement(G,ht)},keepIframeSrcFn:J});if(!Me)return console.warn("Failed to snapshot the document");N(D({type:w.FullSnapshot,data:{node:Me,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((Z=(U=document==null?void 0:document.body)===null||U===void 0?void 0:U.parentElement)===null||Z===void 0?void 0:Z.scrollLeft)||((M=document==null?void 0:document.body)===null||M===void 0?void 0:M.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((A=(q=document==null?void 0:document.body)===null||q===void 0?void 0:q.parentElement)===null||A===void 0?void 0:A.scrollTop)||((K=document==null?void 0:document.body)===null||K===void 0?void 0:K.scrollTop)||0}}})),pe.forEach(G=>G.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ie.adoptStyleSheets(document.adoptedStyleSheets,se.getId(document))};try{let C=[];C.push(W("DOMContentLoaded",()=>{N(D({type:w.DomContentLoaded,data:{}}))}));let U=M=>{var q;return Sr({mutationCb:H,mousemoveCb:(A,K)=>N(D({type:w.IncrementalSnapshot,data:{source:K,positions:A}})),mouseInteractionCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},A)})),scrollCb:j,viewportResizeCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},A)})),inputCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.Input},A)})),mediaInteractionCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},A)})),styleSheetRuleCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},A)})),styleDeclarationCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},A)})),canvasMutationCb:de,fontCb:A=>N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.Font},A)})),selectionCb:A=>{N(D({type:w.IncrementalSnapshot,data:Object.assign({source:b.Selection},A)}))},blockClass:n,ignoreClass:a,maskTextClass:o,maskTextSelector:c,maskInputOptions:F,inlineStylesheet:l,sampling:v,recordCanvas:S,inlineImages:T,userTriggeredOnInput:L,collectFonts:P,doc:M,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:J,blockSelector:s,slimDOMOptions:Q,dataURLOptions:f,mirror:se,iframeManager:ae,stylesheetManager:ie,shadowDomManager:Se,canvasManager:Dt,ignoreCSSAttributes:X,plugins:((q=Y==null?void 0:Y.filter(A=>A.observer))===null||q===void 0?void 0:q.map(A=>({observer:A.observer,options:A.options,callback:K=>N(D({type:w.Plugin,data:{plugin:A.name,payload:K}}))})))||[]},y)};ae.addLoadListener(M=>{C.push(U(M.contentDocument))});let Z=()=>{ct(),C.push(U(document)),lt=!0};return document.readyState==="interactive"||document.readyState==="complete"?Z():C.push(W("load",()=>{N(D({type:w.Load,data:{}})),Z()},window)),()=>{C.forEach(M=>M()),lt=!1}}catch(C){console.warn(C)}}Ce.addCustomEvent=(t,e)=>{if(!lt)throw new Error("please add custom event after start recording");N(D({type:w.Custom,data:{tag:t,payload:e}}))};Ce.freezePage=()=>{pe.forEach(t=>t.freeze())};Ce.takeFullSnapshot=t=>{if(!lt)throw new Error("please take full snapshot after start recording");ct(t)};Ce.mirror=se;var dt=class{constructor(e){this.opts=e;this.seq=0;this.buffer=[];this.stopRecording=null;this.flushTimer=null}start(){var r,i,n;if(typeof document=="undefined"||this.stopRecording)return;let e={emit:s=>{this.buffer.push(s),this.buffer.length>=this.opts.maxEventsPerBatch&&this.flush()},checkoutEveryNms:(r=this.opts.checkoutEveryNms)!=null?r:6e5,inlineStylesheet:(i=this.opts.inlineStylesheet)!=null?i:!1,maskAllInputs:this.opts.maskAllInputs,maskTextClass:this.opts.maskTextClass,blockClass:this.opts.blockClass};this.stopRecording=(n=Ce(e))!=null?n:null,this.flushTimer=setInterval(()=>{this.buffer.length>0&&this.flush()},this.opts.flushIntervalMs)}flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);this.opts.emit({type:"session_replay",data:{seq:this.seq++,events:e}})}destroy(){var e;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush(),(e=this.stopRecording)==null||e.call(this),this.stopRecording=null}};var Bt="https://api.alphana.ir/api/events",Gi={endpoint:Bt,trackNavigation:!0,trackTime:!0,trackHeatmap:!0,trackLogs:!0,mouseSampleRate:.1,maxHeatmapPoints:2e3,batchSize:20,flushInterval:5e3,compressPayloads:!0,compressionThresholdBytes:1024,sessionReplay:!0,sessionReplayCheckoutEveryNms:6e5,sessionReplayInlineStylesheet:!1,sessionReplayMaxEventsPerBatch:48,sessionReplayFlushIntervalMs:4e3,sessionReplayMaskAllInputs:!0,sessionReplayMaskTextClass:"alphana-mask",sessionReplayBlockClass:"alphana-block"},Be="__alphana_first_touch__",ut="__alphana_last_touch__",Vi={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},Hi=["gclid","fbclid","ttclid","msclkid"];function Zi(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Ki(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function be(t){let e=Zi(t);if(e)try{let r=JSON.parse(e);return typeof r.landingPage=="string"&&typeof r.capturedAt=="number"?r:void 0}catch(r){return}}function Br(t,e){Ki(t,JSON.stringify(e))}function zi(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function Yi(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function Ji(t){var r;let e={};for(let[i,n]of Object.entries(Vi)){let s=(r=t.get(i))==null?void 0:r.trim();s&&(e[n]=s)}return Object.keys(e).length>0?e:void 0}function Qi(t){var r;let e={};for(let i of Hi){let n=(r=t.get(i))==null?void 0:r.trim();n&&(e[i]=n)}return Object.keys(e).length>0?e:void 0}function ji(t){switch(t.type){case"pageview":return{type:"pageview",data:{...t.data,path:R(t.data.path)}};case"timespent":return{type:"timespent",data:{...t.data,path:R(t.data.path)}};case"heatmap":return{type:"heatmap",data:{...t.data,path:R(t.data.path)}};case"rageclik":return{type:"rageclik",data:{...t.data,path:R(t.data.path)}};case"uturn":return{type:"uturn",data:{...t.data,fromPath:R(t.data.fromPath),toPath:R(t.data.toPath)}};case"identify":return t;case"revenue":return t;case"goal":return{type:"goal",data:{...t.data,path:R(t.data.path)}};case"journey_step":return{type:"journey_step",data:{...t.data,path:R(t.data.path)}};case"client_context":return t;case"session_replay":return t;default:return t}}var _e=class{constructor(e={}){this.initialized=!1;this.subscribers=new Set;this.queue=[];this.flushTimer=null;this.heartbeatTimer=null;this.userProperties={};this.flags={};this.flagSubscribers=new Set;this.abVariants={};this.abTestSubscribers=new Set;this.handleVisibilityChange=()=>{var e;document.visibilityState==="hidden"&&((e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate())};this.handlePageHide=()=>{var e;(e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate()};this.handleNavigate=e=>{};var r;this.cfg={...Gi,...e};try{new URL(this.cfg.endpoint)}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}this.session={id:(r=e.sessionId)!=null?r:xe(),visitorId:qt(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:be(Be),lastTouch:be(ut)}}}updateAttributionForPageView(e,r){let i=Yi(),n=Ji(i),s=Qi(i),a=be(Be),c=!!(n||s||r)?{landingPage:e,referrer:r,referrerHost:zi(r),utm:n,clickIds:s,capturedAt:Date.now()}:void 0;!a&&c&&Br(Be,c),c&&Br(ut,c);let l={firstTouch:be(Be),lastTouch:be(ut)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:be(Be),lastTouch:be(ut)};return this.session.attribution=e,e}init(){if(typeof window=="undefined"||this.initialized)return this;let e=this.emit.bind(this),{id:r}=this.session;return e({type:"client_context",data:Yt(r)}),this.cfg.trackNavigation&&(this.navigation=new Ve({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new He({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new Ze({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints,allowedPaths:this.cfg.heatmapPages}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new dt({emit:e,checkoutEveryNms:this.cfg.sessionReplayCheckoutEveryNms,inlineStylesheet:this.cfg.sessionReplayInlineStylesheet,maxEventsPerBatch:this.cfg.sessionReplayMaxEventsPerBatch,flushIntervalMs:this.cfg.sessionReplayFlushIntervalMs,maskAllInputs:this.cfg.sessionReplayMaskAllInputs,maskTextClass:this.cfg.sessionReplayMaskTextClass,blockClass:this.cfg.sessionReplayBlockClass}),this.sessionReplay.start()),this.cfg.endpoint&&(this.flushTimer=setInterval(()=>{this.queue.length>0&&this.flushQueue()},this.cfg.flushInterval),window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("pagehide",this.handlePageHide),this.heartbeatTimer=setInterval(()=>{document.visibilityState!=="hidden"&&this.sendHeartbeat()},3e4),this.cfg.trackLogs&&(this.logCapture=new we({endpoint:this.cfg.endpoint,collectEndpoint:this.collectUrl,sessionId:this.session.id,secretKey:this.cfg.secretKey,appId:this.cfg.appId,compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes}),this.logCapture.init())),this.initialized=!0,this.fetchFlags(),this.fetchAbTests(),this}destroy(){var e,r,i,n,s;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),typeof window!="undefined"&&(window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("pagehide",this.handlePageHide)),(e=this.navigation)==null||e.destroy(),(r=this.time)==null||r.destroy(),(i=this.heatmap)==null||i.destroy(),(n=this.sessionReplay)==null||n.destroy(),this.sessionReplay=void 0,(s=this.logCapture)==null||s.destroy(),typeof window!="undefined"&&window.removeEventListener("tracker:navigate",this.handleNavigate),this.queue.length>0&&this.cfg.endpoint&&this.flushBeacon(),this.initialized=!1}async sendHeartbeat(){if(!this.cfg.endpoint)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(gt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!0,appId:this.cfg.appId}));try{await fe(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e,keepalive:!0})}catch(i){}}sendDeactivate(){if(!this.cfg.endpoint)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(gt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!1,appId:this.cfg.appId}));vt(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e})}emit(e){var r,i,n,s;if(e=ji(e),e.type==="pageview"){let a=this.updateAttributionForPageView(e.data.path,e.data.referrer);e={type:"pageview",data:{...e.data,utm:(r=a.lastTouch)==null?void 0:r.utm,attribution:a}}}switch(e.type){case"pageview":this.session.pageViews.push(e.data);break;case"timespent":{let a=(i=this.session.timeSpent[e.data.path])!=null?i:0;this.session.timeSpent[e.data.path]=a+e.data.duration;break}case"heatmap":{let a=e.data.path;this.session.heatmap[a]||(this.session.heatmap[a]=[]);let o=this.session.heatmap[a];o.length<this.cfg.maxHeatmapPoints&&o.push(e.data);break}case"rageclik":case"uturn":case"identify":case"revenue":case"goal":case"journey_step":case"client_context":case"session_replay":break}this.subscribers.forEach(a=>a(e)),(s=(n=this.cfg).onEvent)==null||s.call(n,e),this.cfg.endpoint&&(this.queue.push(e),this.queue.length>=this.cfg.batchSize&&this.flushQueue())}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}trackPageView(e){let r=R(e!=null?e:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"pageview",data:{path:r,title:typeof document!="undefined"?document.title:"",timestamp:Date.now(),sessionId:this.session.id,referrer:typeof document!="undefined"&&document.referrer||void 0}}),typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:r,title:document.title}}))}trackRevenue(e){var r,i;this.emit({type:"revenue",data:{...e,eventName:(r=e.eventName)!=null?r:"purchase",status:(i=e.status)!=null?i:"paid",sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now(),attribution:this.currentAttribution()}})}trackGoal(e){let r=R(typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"goal",data:{...e,sessionId:this.session.id,visitorId:this.session.visitorId,path:r,timestamp:Date.now()}})}trackJourneyStep(e){var i;let r=R((i=e.path)!=null?i:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"journey_step",data:{...e,path:r,sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now()}})}identify(e){this.userProperties={...this.userProperties,...e},this.session.userProperties={...this.userProperties},this.emit({type:"identify",data:{properties:{...this.userProperties},visitorId:this.session.visitorId,timestamp:Date.now()}}),this.fetchFlags()}getFlags(){return{...this.flags}}isFeatureEnabled(e){return this.flags[e]===!0}onFlagsChange(e){return this.flagSubscribers.add(e),()=>this.flagSubscribers.delete(e)}async fetchFlags(){if(!this.cfg.endpoint||!this.cfg.secretKey)return;let e=We(this.cfg.endpoint)+"/feature-flags/evaluate";try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({userProperties:this.userProperties})});if(!r.ok)return;let i=await r.json();this.flags=i,this.flagSubscribers.forEach(n=>n({...this.flags}))}catch(r){}}getAbVariants(){return{...this.abVariants}}getAbVariant(e){let r=this.abVariants[e];return r!=null?r:null}isAbVariant(e,r){return this.abVariants[e]===r}onAbTestsChange(e){return this.abTestSubscribers.add(e),()=>this.abTestSubscribers.delete(e)}async fetchAbTests(e){if(!this.cfg.endpoint||!this.cfg.secretKey)return;let r=We(this.cfg.endpoint)+"/ab-tests/evaluate";try{let i={visitorId:this.session.visitorId};e!=null&&e.length&&(i.keys=e);let n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify(i)});if(!n.ok)return;let s=await n.json();this.abVariants=e!=null&&e.length?{...this.abVariants,...s}:{...s},this.abTestSubscribers.forEach(a=>a({...this.abVariants}))}catch(i){}}getSession(){return this.session}getPageViews(){return[...this.session.pageViews]}getTimeSpent(){return{...this.session.timeSpent}}getHeatmapData(e){var r;return e!==void 0?[...(r=this.session.heatmap[e])!=null?r:[]]:Object.entries(this.session.heatmap).reduce((i,[n,s])=>(i[n]=[...s],i),{})}get collectUrl(){var e;return(e=this.cfg.collectEndpoint)!=null?e:Ue(this.cfg.endpoint)}currentPath(){return R(typeof window!="undefined"?window.location.pathname+window.location.search:"/")}flush(){this.flushQueue()}async flushQueue(){if(this.queue.length===0)return;let e=this.queue.splice(0);await this.sendBatch(e)}flushBeacon(){if(this.queue.length===0)return;let e=this.queue.splice(0),r=JSON.stringify(mt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),i=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};vt(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:i})}async sendBatch(e){let r=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},i=JSON.stringify(mt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await fe(this.collectUrl,i,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r})}};var k;function _t(){typeof window=="undefined"||!window.AlphanaSDK||(k?window.AlphanaSDK.tracker=k:delete window.AlphanaSDK.tracker)}function V(t,e){var i;let r=(i=t.dataset[e])==null?void 0:i.trim();return r||void 0}function te(t,e){let r=V(t,e);if(r!==void 0){if(["1","true","yes","on"].includes(r.toLowerCase()))return!0;if(["0","false","no","off"].includes(r.toLowerCase()))return!1}}function z(t,e){let r=V(t,e);if(r===void 0)return;let i=Number(r);return Number.isFinite(i)?i:void 0}function _r(t,e){let r=V(t,e);if(r===void 0)return;let i=r.split(",").map(n=>n.trim()).filter(Boolean);return i.length>0?i:void 0}function qi(){if(typeof document=="undefined")return{};let t=document.currentScript;return t instanceof HTMLScriptElement?{...V(t,"endpoint")?{endpoint:V(t,"endpoint")}:{},...V(t,"appId")?{appId:V(t,"appId")}:{},...V(t,"secretKey")?{secretKey:V(t,"secretKey")}:{},...V(t,"sessionId")?{sessionId:V(t,"sessionId")}:{},...te(t,"trackNavigation")!==void 0?{trackNavigation:te(t,"trackNavigation")}:{},...te(t,"trackTime")!==void 0?{trackTime:te(t,"trackTime")}:{},...te(t,"trackHeatmap")!==void 0?{trackHeatmap:te(t,"trackHeatmap")}:{},...te(t,"trackLogs")!==void 0?{trackLogs:te(t,"trackLogs")}:{},...te(t,"sessionReplay")!==void 0?{sessionReplay:te(t,"sessionReplay")}:{},...z(t,"sessionReplayCheckoutEveryNms")!==void 0?{sessionReplayCheckoutEveryNms:z(t,"sessionReplayCheckoutEveryNms")}:{},...z(t,"sessionReplayMaxEventsPerBatch")!==void 0?{sessionReplayMaxEventsPerBatch:z(t,"sessionReplayMaxEventsPerBatch")}:{},...z(t,"sessionReplayFlushIntervalMs")!==void 0?{sessionReplayFlushIntervalMs:z(t,"sessionReplayFlushIntervalMs")}:{},...te(t,"sessionReplayMaskAllInputs")!==void 0?{sessionReplayMaskAllInputs:te(t,"sessionReplayMaskAllInputs")}:{},...V(t,"sessionReplayMaskTextClass")?{sessionReplayMaskTextClass:V(t,"sessionReplayMaskTextClass")}:{},...V(t,"sessionReplayBlockClass")?{sessionReplayBlockClass:V(t,"sessionReplayBlockClass")}:{},...z(t,"mouseSampleRate")!==void 0?{mouseSampleRate:z(t,"mouseSampleRate")}:{},...z(t,"maxHeatmapPoints")!==void 0?{maxHeatmapPoints:z(t,"maxHeatmapPoints")}:{},...z(t,"batchSize")!==void 0?{batchSize:z(t,"batchSize")}:{},...z(t,"flushInterval")!==void 0?{flushInterval:z(t,"flushInterval")}:{},..._r(t,"heatmapPages")?{heatmapPages:_r(t,"heatmapPages")}:{}}:{}}function Xi(t){return Object.keys(t).length>0}function Wt(t={}){return k||(k=new _e(t).init(),_t(),k)}function $i(){return k}function Ut(t,...e){var r,i;switch(t){case"init":return Wt((r=e[0])!=null?r:{});case"identify":k==null||k.identify((i=e[0])!=null?i:{});return;case"trackPageView":k==null||k.trackPageView(e[0]);return;case"trackRevenue":k==null||k.trackRevenue(e[0]);return;case"trackGoal":k==null||k.trackGoal(e[0]);return;case"trackJourneyStep":k==null||k.trackJourneyStep(e[0]);return;case"flush":k==null||k.flush();return;case"destroy":k==null||k.destroy(),k=void 0,_t();return;default:return t}}function en(){var i;if(typeof window=="undefined")return[];let t=window.alphana,e=(i=t==null?void 0:t.q)!=null?i:[],r=((n,...s)=>Ut(n,...s));return r.q=[],window.alphana=r,e}function tn(){var i;if(typeof window=="undefined")return;let t=en(),e=t.some(([n])=>n==="init"),r={...qi(),...(i=window.AlphanaSDKConfig)!=null?i:{}};!e&&Xi(r)&&Wt(r);for(let[n,...s]of t)Ut(n,...s);setTimeout(_t,0)}tn();return Zr(rn);})();
3
+ or you can use record.mirror to access the mirror instance during recording.`,pr={map:{},getId(){return console.error(Te),-1},getNode(){return console.error(Te),null},removeNodeFromMap(){console.error(Te)},has(){return console.error(Te),!1},reset(){console.error(Te)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(pr=new Proxy(pr,{get(t,e,r){return e==="map"&&console.error(Te),Reflect.get(t,e,r)}}));function Ee(t,e,r={}){let n=null,i=0;return function(...o){let a=Date.now();!i&&r.leading===!1&&(i=a);let s=e-(a-i),c=this;s<=0||s>e?(n&&(clearTimeout(n),n=null),i=a,t.apply(c,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,t.apply(c,o)},s))}}function Ie(t,e,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>Ie(t,e,o||{},!0)}function ie(t,e,r){try{if(!(e in t))return()=>{};let n=t[e],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=i,()=>{t[e]=n}}catch(n){return()=>{}}}function Ye(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Je(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function M(t,e,r,n){if(!t)return!1;let i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!i)return!1;if(typeof e=="string"){if(i.classList.contains(e)||n&&i.closest("."+e)!==null)return!0}else if(Le(i,e,n))return!0;return!!(r&&(t.matches(r)||n&&i.closest(r)!==null))}function fr(t,e){return e.getId(t)!==-1}function je(t,e){return e.getId(t)===ye}function Rt(t,e){if(ve(t))return!1;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?Rt(t.parentNode,e):!0:!0}function xt(t){return!!t.changedTouches}function mr(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function Qe(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function qe(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Xe(t){return!!(t!=null&&t.shadowRoot)}var ze=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var r;return(r=this.styleIDMap.get(e))!==null&&r!==void 0?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};var w=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(w||{}),b=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(b||{}),$e=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))($e||{}),le=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(le||{});function gr(t){return"__ln"in t}var Mt=class{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<e;n++)r=(r==null?void 0:r.next)||null;return r}addNode(e){let r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&gr(e.previousSibling)){let n=e.previousSibling.__ln.next;r.next=n,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(e.nextSibling&&gr(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;r.previous=n,r.next=e.nextSibling.__ln,e.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(e){let r=e.__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)),e.__ln&&delete e.__ln,this.length--)}},yr=(t,e)=>`${t}@${e}`,et=class{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=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],r=new Mt,n=s=>{let c=s,l=ye;for(;l===ye;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},i=s=>{var c,l,d,u;let p=null;((l=(c=s.getRootNode)===null||c===void 0?void 0:c.call(s))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(p=s.getRootNode().host);let f=p;for(;((u=(d=f==null?void 0:f.getRootNode)===null||d===void 0?void 0:d.call(f))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&f.getRootNode().host;)f=f.getRootNode().host;let h=!this.doc.contains(s)&&(!f||!this.doc.contains(f));if(!s.parentNode||h)return;let y=ve(s.parentNode)?this.mirror.getId(p):this.mirror.getId(s.parentNode),I=n(s);if(y===-1||I===-1)return r.addNode(s);let v=me(s,{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:m=>{Qe(m,this.mirror)&&this.iframeManager.addIframe(m),qe(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),Xe(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(m,g)=>{this.iframeManager.attachIframe(m,g),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,g)=>{this.stylesheetManager.attachLinkElement(m,g)}});v&&e.push({parentId:y,nextId:I,node:v})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))vr(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||i(s);for(let s of Array.from(this.addedSet.values()))!Ir(this.droppedSet,s)&&!vr(this.removes,s,this.mirror)||Ir(this.movedSet,s)?i(s):this.droppedSet.add(s);let o=null;for(;r.length;){let s=null;if(o){let c=this.mirror.getId(o.value.parentNode),l=n(o.value);c!==-1&&l!==-1&&(s=o)}if(!s)for(let c=r.length-1;c>=0;c--){let l=r.get(c);if(l){let d=this.mirror.getId(l.value.parentNode);if(n(l.value)===-1)continue;if(d!==-1){s=l;break}else{let p=l.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=p.parentNode.host;if(this.mirror.getId(f)!==-1){s=l;break}}}}}if(!s){for(;r.head;)r.removeNode(r.head.value);break}o=s.previous,r.removeNode(s.value),i(s.value)}let a={texts:this.texts.map(s=>({id:this.mirror.getId(s.node),value:s.value})).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>({id:this.mirror.getId(s.node),attributes:s.attributes})).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:e};!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=e=>{if(!je(e.target,this.mirror))switch(e.type){case"characterData":{let r=e.target.textContent;!M(e.target,this.blockClass,this.blockSelector,!1)&&r!==e.oldValue&&this.texts.push({value:Et(e.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:e.target});break}case"attributes":{let r=e.target,n=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(n=Pe({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),M(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let i=this.attributes.find(o=>o.node===e.target);if(r.tagName==="IFRAME"&&e.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)e.attributeName="rr_src";else return;if(i||(i={node:e.target,attributes:{}},this.attributes.push(i)),e.attributeName==="style"){let o=this.doc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue),(i.attributes.style===void 0||i.attributes.style===null)&&(i.attributes.style={});let a=i.attributes.style;for(let s of Array.from(r.style)){let c=r.style.getPropertyValue(s),l=r.style.getPropertyPriority(s);(c!==o.style.getPropertyValue(s)||l!==o.style.getPropertyPriority(s))&&(l===""?a[s]=c:a[s]=[c,l])}for(let s of Array.from(o.style))r.style.getPropertyValue(s)===""&&(a[s]=!1)}else i.attributes[e.attributeName]=Tt(this.doc,r.tagName,e.attributeName,n);break}case"childList":{if(M(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=ve(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);M(e.target,this.blockClass,this.blockSelector,!1)||je(r,this.mirror)||!fr(r,this.mirror)||(this.addedSet.has(r)?(Nt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||Rt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[yr(n,i)]?Nt(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:ve(e.target)&&ge(e.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(je(e,this.mirror))return;this.movedSet.add(e);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[yr(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);M(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(n=>this.genAdds(n))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=e[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 Nt(t,e){t.delete(e),e.childNodes.forEach(r=>Nt(t,r))}function vr(t,e,r){return t.length===0?!1:Cr(t,e,r)}function Cr(t,e,r){let{parentNode:n}=e;if(!n)return!1;let i=r.getId(n);return t.some(o=>o.id===i)?!0:Cr(t,n,r)}function Ir(t,e){return t.size===0?!1:br(t,e)}function br(t,e){let{parentNode:r}=e;return r?t.has(r)?!0:br(t,r):!1}var pe=[],kr=typeof CSSGroupingRule!="undefined",Ar=typeof CSSMediaRule!="undefined",Tr=typeof CSSSupportsRule!="undefined",Er=typeof CSSConditionRule!="undefined";function Be(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch(e){return t.target}}function Ot(t,e){var r,n;let i=new et;pe.push(i),i.init(t);let o=window.MutationObserver||window.__rrMutationObserver,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]&&(o=window[a]);let s=new o(i.processMutations.bind(i));return s.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Fn({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,a=[],s,c=Ee(u=>{let p=Date.now()-s;t(a.map(f=>(f.timeOffset-=p,f)),u),a=[],s=null},o),l=Ee(u=>{let p=Be(u),{clientX:f,clientY:h}=xt(u)?u.changedTouches[0]:u;s||(s=Date.now()),a.push({x:f,y:h,id:n.getId(p),timeOffset:Date.now()-s}),c(typeof DragEvent!="undefined"&&u instanceof DragEvent?b.Drag:u instanceof MouseEvent?b.MouseMove:b.TouchMove)},i,{trailing:!1}),d=[W("mousemove",l,r),W("touchmove",l,r),W("drag",l,r)];return()=>{d.forEach(u=>u())}}function Dn({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,s=[],c=l=>d=>{let u=Be(d);if(M(u,n,i,!0))return;let p=xt(d)?d.changedTouches[0]:d;if(!p)return;let f=r.getId(u),{clientX:h,clientY:y}=p;t({type:$e[l],id:f,x:h,y})};return Object.keys($e).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let d=l.toLowerCase(),u=c(l);s.push(W(d,u,e))}),()=>{s.forEach(l=>l())}}function Lt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let a=Ee(s=>{let c=Be(s);if(!c||M(c,n,i,!0))return;let l=r.getId(c);if(c===e){let d=e.scrollingElement||e.documentElement;t({id:l,x:d.scrollLeft,y:d.scrollTop})}else t({id:l,x:c.scrollLeft,y:c.scrollTop})},o.scroll||100);return W("scroll",a,e)}function _n({viewportResizeCb:t}){let e=-1,r=-1,n=Ee(()=>{let i=Ye(),o=Je();(e!==i||r!==o)&&(t({width:Number(o),height:Number(i)}),e=i,r=o)},200);return W("resize",n,window)}function Sr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Wn=["INPUT","TEXTAREA","SELECT"],wr=new WeakMap;function Un({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,maskInputOptions:a,maskInputFn:s,sampling:c,userTriggeredOnInput:l}){function d(v){let m=Be(v),g=v.isTrusted;if(m&&m.tagName==="OPTION"&&(m=m.parentElement),!m||!m.tagName||Wn.indexOf(m.tagName)<0||M(m,n,i,!0))return;let S=m.type;if(m.classList.contains(o))return;let _=m.value,L=!1;S==="radio"||S==="checkbox"?L=m.checked:(a[m.tagName.toLowerCase()]||a[S])&&(_=Pe({maskInputOptions:a,tagName:m.tagName,type:S,value:_,maskInputFn:s})),u(m,Sr({text:_,isChecked:L,userTriggered:g},l));let P=m.name;S==="radio"&&P&&L&&e.querySelectorAll(`input[type="radio"][name="${P}"]`).forEach(T=>{T!==m&&u(T,Sr({text:T.value,isChecked:!L,userTriggered:!1},l))})}function u(v,m){let g=wr.get(v);if(!g||g.text!==m.text||g.isChecked!==m.isChecked){wr.set(v,m);let S=r.getId(v);t(Object.assign(Object.assign({},m),{id:S}))}}let f=(c.input==="last"?["change"]:["input","change"]).map(v=>W(v,d,e)),h=e.defaultView;if(!h)return()=>{f.forEach(v=>v())};let y=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),I=[[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 y&&y.set&&f.push(...I.map(v=>Ie(v[0],v[1],{set(){d({target:this})}},!1,h))),()=>{f.forEach(v=>v())}}function tt(t){let e=[];function r(n,i){if(kr&&n.parentRule instanceof CSSGroupingRule||Ar&&n.parentRule instanceof CSSMediaRule||Tr&&n.parentRule instanceof CSSSupportsRule||Er&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(a)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(a)}return i}return r(t,e)}function he(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function Gn({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:p,styleId:f}=he(this,e,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&t({id:p,styleId:f,adds:[{rule:d,index:u}]}),i.apply(this,[d,u])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,removes:[{index:d}]}),o.apply(this,[d])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replace:d}),a.apply(this,[d])});let s;n.CSSStyleSheet.prototype.replaceSync&&(s=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),s.apply(this,[d])});let c={};kr?c.CSSGroupingRule=n.CSSGroupingRule:(Ar&&(c.CSSMediaRule=n.CSSMediaRule),Er&&(c.CSSConditionRule=n.CSSConditionRule),Tr&&(c.CSSSupportsRule=n.CSSSupportsRule));let l={};return Object.entries(c).forEach(([d,u])=>{l[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(p,f){let{id:h,styleId:y}=he(this.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||y&&y!==-1)&&t({id:h,styleId:y,adds:[{rule:p,index:[...tt(this),f||0]}]}),l[d].insertRule.apply(this,[p,f])},u.prototype.deleteRule=function(p){let{id:f,styleId:h}=he(this.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||h&&h!==-1)&&t({id:f,styleId:h,removes:[{index:[...tt(this),p]}]}),l[d].deleteRule.apply(this,[p])}}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule})}}function Pt({mirror:t,stylesheetManager:e},r){var n,i,o;let a=null;r.nodeName==="#document"?a=t.getId(r):a=t.getId(r.host);let s=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(o=(i=r.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,c=Object.getOwnPropertyDescriptor(s==null?void 0:s.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!c?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return(l=c.get)===null||l===void 0?void 0:l.call(this)},set(l){var d;let u=(d=c.set)===null||d===void 0?void 0:d.call(this,l);if(a!==null&&a!==-1)try{e.adoptStyleSheets(l,a)}catch(p){}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})}function Vn({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(s,c,l){var d;if(r.has(s))return o.apply(this,[s,c,l]);let{id:u,styleId:p}=he((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,n.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,set:{property:s,value:c,priority:l},index:tt(this.parentRule)}),o.apply(this,[s,c,l])};let a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(s){var c;if(r.has(s))return a.apply(this,[s]);let{id:l,styleId:d}=he((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,e,n.styleMirror);return(l&&l!==-1||d&&d!==-1)&&t({id:l,styleId:d,remove:{property:s},index:tt(this.parentRule)}),a.apply(this,[s])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}}function Hn({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i}){let o=s=>Ee(c=>{let l=Be(c);if(!l||M(l,e,r,!0))return;let{currentTime:d,volume:u,muted:p,playbackRate:f}=l;t({type:s,id:n.getId(l),currentTime:d,volume:u,muted:p,playbackRate:f})},i.media||500),a=[W("play",o(0)),W("pause",o(1)),W("seeked",o(2)),W("volumechange",o(3)),W("ratechange",o(4))];return()=>{a.forEach(s=>s())}}function Zn({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(c,l,d){let u=new o(c,l,d);return i.set(u,{family:c,buffer:typeof l!="string",descriptors:d,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),u};let a=ie(e.fonts,"add",function(s){return function(c){return setTimeout(()=>{let l=i.get(c);l&&(t(l),i.delete(c))},0),s.apply(this,[c])}});return n.push(()=>{r.FontFace=o}),n.push(a),()=>{n.forEach(s=>s())}}function Kn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=t,a=!0,s=()=>{let c=e.getSelection();if(!c||a&&(c!=null&&c.isCollapsed))return;a=c.isCollapsed||!1;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let p=c.getRangeAt(u),{startContainer:f,startOffset:h,endContainer:y,endOffset:I}=p;M(f,n,i,!0)||M(y,n,i,!0)||l.push({start:r.getId(f),startOffset:h,end:r.getId(y),endOffset:I})}o({ranges:l})};return s(),W("selectionchange",s)}function zn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:f}=t;t.mutationCb=(...h)=>{e.mutation&&e.mutation(...h),r(...h)},t.mousemoveCb=(...h)=>{e.mousemove&&e.mousemove(...h),n(...h)},t.mouseInteractionCb=(...h)=>{e.mouseInteraction&&e.mouseInteraction(...h),i(...h)},t.scrollCb=(...h)=>{e.scroll&&e.scroll(...h),o(...h)},t.viewportResizeCb=(...h)=>{e.viewportResize&&e.viewportResize(...h),a(...h)},t.inputCb=(...h)=>{e.input&&e.input(...h),s(...h)},t.mediaInteractionCb=(...h)=>{e.mediaInteaction&&e.mediaInteaction(...h),c(...h)},t.styleSheetRuleCb=(...h)=>{e.styleSheetRule&&e.styleSheetRule(...h),l(...h)},t.styleDeclarationCb=(...h)=>{e.styleDeclaration&&e.styleDeclaration(...h),d(...h)},t.canvasMutationCb=(...h)=>{e.canvasMutation&&e.canvasMutation(...h),u(...h)},t.fontCb=(...h)=>{e.font&&e.font(...h),p(...h)},t.selectionCb=(...h)=>{e.selection&&e.selection(...h),f(...h)}}function Rr(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};zn(t,e);let n=Ot(t,t.doc),i=Fn(t),o=Dn(t),a=Lt(t),s=_n(t),c=Un(t),l=Hn(t),d=Gn(t,{win:r}),u=Pt(t,t.doc),p=Vn(t,{win:r}),f=t.collectFonts?Zn(t):()=>{},h=Kn(t),y=[];for(let I of t.plugins)y.push(I.observer(I.callback,r,I.options));return()=>{pe.forEach(I=>I.reset()),n.disconnect(),i(),o(),a(),s(),c(),l(),d(),u(),p(),f(),h(),y.forEach(I=>I())}}var Fe=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,r,n,i){let o=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e),s=o.get(r);return s||(s=this.generateIdFn(),o.set(r,s),a.set(s,r)),s}getIds(e,r){let n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return r.map(o=>this.getId(e,o,n,i))}getRemoteId(e,r,n){let i=n||this.getRemoteIdToIdMap(e);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(e,r){let n=this.getRemoteIdToIdMap(e);return r.map(i=>this.getRemoteId(e,i,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}};var rt=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Fe(kt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Fe(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,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)===null||n===void 0||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){if(e.data.type==="rrweb"){if(!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let i=this.transformCrossOriginEvent(n,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}transformCrossOriginEvent(e,r){var n;switch(r.type){case w.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:w.IncrementalSnapshot,data:{source:b.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case w.Meta:case w.Load:case w.DomContentLoaded:return!1;case w.Plugin:return r;case w.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case w.IncrementalSnapshot:switch(r.data.source){case b.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e)}),r.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),r;case b.Drag:case b.TouchMove:case b.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),r;case b.ViewportResize:return!1;case b.MediaInteraction:case b.MouseInteraction:case b.Scroll:case b.CanvasMutation:case b.Input:return this.replaceIds(r.data,e,["id"]),r;case b.StyleSheetRule:case b.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case b.Font:return r;case b.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),r;case b.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),r}}}replace(e,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=e.getIds(n,r[o]):r[o]=e.getId(n,r[o]));return r}replaceIds(e,r,n){return this.replace(this.crossOriginIframeMirror,e,r,n)}replaceStyleIds(e,r,n){return this.replace(this.crossOriginIframeStyleMirror,e,r,n)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id"]),"childNodes"in e&&e.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}};var nt=class{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;let r=this;this.restorePatches.push(ie(Element.prototype,"attachShadow",function(n){return function(i){let o=n.call(this,i);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),o}}))}addShadowRoot(e,r){ge(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),Ot(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Lt(Object.assign(Object.assign({},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(e.host)),Pt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ie(e.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(i){let o=n.call(this,i);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,e.contentDocument),o}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}};function xr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Mr(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(u){a(u)}}function c(d){try{l(n.throw(d))}catch(u){a(u)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})}var Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yn=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(De=0;De<Re.length;De++)Yn[Re.charCodeAt(De)]=De;var De,Nr=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=Re[e[r]>>2],i+=Re[(e[r]&3)<<4|e[r+1]>>4],i+=Re[(e[r+1]&15)<<2|e[r+2]>>6],i+=Re[e[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Or=new Map;function Jn(t,e){let r=Or.get(t);return r||(r=new Map,Or.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Bt=(t,e,r)=>{if(!t||!(Lr(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=Jn(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function it(t,e,r){if(t instanceof Array)return t.map(n=>it(n,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let n=t.constructor.name,i=Nr(t);return{rr_type:n,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[it(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let n=t.constructor.name,{src:i}=t;return{rr_type:n,src:i}}else if(t instanceof HTMLCanvasElement){let n="HTMLImageElement",i=t.toDataURL();return{rr_type:n,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[it(t.data,e,r),t.width,t.height]};if(Lr(t,e)||typeof t=="object"){let n=t.constructor.name,i=Bt(t,e,r);return{rr_type:n,index:i}}}}return t}var ot=(t,e,r)=>[...t].map(n=>it(n,e,r)),Lr=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>t instanceof e[i]);function Pr(t,e,r,n){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;let s=ie(e.CanvasRenderingContext2D.prototype,a,function(c){return function(...l){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=ot([...l],e,this);t(this.canvas,{type:le["2D"],property:a,args:d})},0),c.apply(this,l)}});i.push(s)}catch(s){let c=Ie(e.CanvasRenderingContext2D.prototype,a,{set(l){t(this.canvas,{type:le["2D"],property:a,args:[l],setter:!0})}});i.push(c)}return()=>{i.forEach(a=>a())}}function Ft(t,e,r){let n=[];try{let i=ie(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(a,...s){return M(this,e,r,!0)||"__context"in this||(this.__context=a),o.apply(this,[a,...s])}});n.push(i)}catch(i){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(i=>i())}}function Br(t,e,r,n,i,o,a){let s=[],c=Object.getOwnPropertyNames(t);for(let l of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof t[l]!="function")continue;let d=ie(t,l,function(u){return function(...p){let f=u.apply(this,p);if(Bt(f,a,this),!M(this.canvas,n,i,!0)){let h=ot([...p],a,this),y={type:e,property:l,args:h};r(this.canvas,y)}return f}});s.push(d)}catch(d){let u=Ie(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:!0})}});s.push(u)}return s}function Fr(t,e,r,n,i){let o=[];return o.push(...Br(e.WebGLRenderingContext.prototype,le.WebGL,t,r,n,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Br(e.WebGL2RenderingContext.prototype,le.WebGL2,t,r,n,i,e)),()=>{o.forEach(a=>a())}}var Dt=null;try{Dr=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof mt=="function"&&mt("worker_threads"),Dt=Dr.Worker}catch(t){}var Dr;function jn(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}function _r(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=jn(t,i),a=o.indexOf(`
4
+ `,10)+1,s=o.substring(a)+(n?"//# sourceMappingURL="+n:"");return function(l){return new Dt(s,Object.assign({},l,{eval:!0}))}}function Qn(t,e){var r=atob(t);if(e){for(var n=new Uint8Array(r.length),i=0,o=r.length;i<o;++i)n[i]=r.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(n.buffer))}return r}function qn(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=Qn(t,i),a=o.indexOf(`
5
+ `,10)+1,s=o.substring(a)+(n?"//# sourceMappingURL="+n:""),c=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(c)}function Wr(t,e,r){var n;return function(o){return n=n||qn(t,e,r),new Worker(n,o)}}var Xn=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Ur(){return Xn}function Gr(t,e,r){return Ur()?_r(t,e,r):Wr(t,e,r)}var Vr=Gr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);var st=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(l)};let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,i,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:s})}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,r,n,i,o){let a=Ft(r,n,i),s=new Map,c=new Vr;c.onmessage=h=>{let{id:y}=h.data;if(s.set(y,!1),!("base64"in h.data))return;let{base64:I,type:v,width:m,height:g}=h.data;this.mutationCb({id:y,type:le["2D"],commands:[{property:"clearRect",args:[0,0,m,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:I}],type:v}]},0,0]}]})};let l=1e3/e,d=0,u,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(y=>{M(y,n,i,!0)||h.push(y)}),h},f=h=>{if(d&&h-d<l){u=requestAnimationFrame(f);return}d=h,p().forEach(y=>Mr(this,void 0,void 0,function*(){var I;let v=this.mirror.getId(y);if(s.get(v))return;if(s.set(v,!0),["webgl","webgl2"].includes(y.__context)){let g=y.getContext(y.__context);((I=g==null?void 0:g.getContextAttributes())===null||I===void 0?void 0:I.preserveDrawingBuffer)===!1&&(g==null||g.clear(g.COLOR_BUFFER_BIT))}let m=yield createImageBitmap(y);c.postMessage({id:v,bitmap:m,width:y.width,height:y.height,dataURLOptions:o.dataURLOptions},[m])})),u=requestAnimationFrame(f)};u=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Ft(e,r,n),o=Pr(this.processMutation.bind(this),e,r,n),a=Fr(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||r===-1)return;let i=n.map(a=>xr(a,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e)}};var at=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ze,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,r){if(e.length===0)return;let n={id:r,styleIds:[]},i=[];for(let o of e){let a;if(this.styleMirror.has(o))a=this.styleMirror.getId(o);else{a=this.styleMirror.add(o);let s=Array.from(o.rules||CSSRule);i.push({styleId:a,rules:s.map((c,l)=>({rule:wt(c),index:l}))})}n.styleIds.push(a)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}};function F(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var N,ct,_t,lt=!1,oe=ur();function Ce(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:p,maskInputFn:f,maskTextFn:h,hooks:y,packFn:I,sampling:v={},dataURLOptions:m={},mousemoveWait:g,recordCanvas:S=!1,recordCrossOriginIframes:_=!1,userTriggeredOnInput:L=!1,collectFonts:P=!1,inlineImages:T=!1,plugins:Y,keepIframeSrcFn:J=()=>!1,ignoreCSSAttributes:X=new Set([])}=t,$=_?window.parent===window:!0,ee=!1;if(!$)try{window.parent.document,ee=!1}catch(C){ee=!0}if($&&!e)throw new Error("emit function is required");g!==void 0&&v.mousemove===void 0&&(v.mousemove=g),oe.reset();let B=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}:u!==void 0?u:{password:!0},j=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||{};mr();let re,se=0,ce=C=>{for(let U of Y||[])U.eventProcessor&&(C=U.eventProcessor(C));return I&&(C=I(C)),C};N=(C,U)=>{var H;if(!((H=pe[0])===null||H===void 0)&&H.isFrozen()&&C.type!==w.FullSnapshot&&!(C.type===w.IncrementalSnapshot&&C.data.source===b.Mutation)&&pe.forEach(x=>x.unfreeze()),$)e==null||e(ce(C),U);else if(ee){let x={type:"rrweb",event:ce(C),isCheckout:U};window.parent.postMessage(x,"*")}if(C.type===w.FullSnapshot)re=C,se=0;else if(C.type===w.IncrementalSnapshot){if(C.data.source===b.Mutation&&C.data.isAttachIframe)return;se++;let x=n&&se>=n,q=r&&C.timestamp-re.timestamp>r;(x||q)&&ct(!0)}};let V=C=>{N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.Mutation},C)}))},Q=C=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.Scroll},C)})),de=C=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},C)})),O=C=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},C)})),ne=new at({mutationCb:V,adoptedStyleSheetCb:O}),ae=new rt({mirror:oe,mutationCb:V,stylesheetManager:ne,recordCrossOriginIframes:_,wrappedEmit:N});for(let C of Y||[])C.getMirror&&C.getMirror({nodeMirror:oe,crossOriginIframeMirror:ae.crossOriginIframeMirror,crossOriginIframeStyleMirror:ae.crossOriginIframeStyleMirror});_t=new st({recordCanvas:S,mutationCb:de,win:window,blockClass:i,blockSelector:o,mirror:oe,sampling:v.canvas,dataURLOptions:m});let Se=new nt({mutationCb:V,scrollCb:Q,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:B,dataURLOptions:m,maskTextFn:h,maskInputFn:f,recordCanvas:S,inlineImages:T,sampling:v,slimDOMOptions:j,iframeManager:ae,stylesheetManager:ne,canvasManager:_t,keepIframeSrcFn:J},mirror:oe});ct=(C=!1)=>{var U,H,x,q,k,Z;N(F({type:w.Meta,data:{href:window.location.href,width:Je(),height:Ye()}}),C),ne.reset(),pe.forEach(G=>G.lock());let Me=hr(document,{mirror:oe,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:B,maskTextFn:h,slimDOM:j,dataURLOptions:m,recordCanvas:S,inlineImages:T,onSerialize:G=>{Qe(G,oe)&&ae.addIframe(G),qe(G,oe)&&ne.trackLinkElement(G),Xe(G)&&Se.addShadowRoot(G.shadowRoot,document)},onIframeLoad:(G,pt)=>{ae.attachIframe(G,pt),Se.observeAttachShadow(G)},onStylesheetLoad:(G,pt)=>{ne.attachLinkElement(G,pt)},keepIframeSrcFn:J});if(!Me)return console.warn("Failed to snapshot the document");N(F({type:w.FullSnapshot,data:{node:Me,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((H=(U=document==null?void 0:document.body)===null||U===void 0?void 0:U.parentElement)===null||H===void 0?void 0:H.scrollLeft)||((x=document==null?void 0:document.body)===null||x===void 0?void 0:x.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((k=(q=document==null?void 0:document.body)===null||q===void 0?void 0:q.parentElement)===null||k===void 0?void 0:k.scrollTop)||((Z=document==null?void 0:document.body)===null||Z===void 0?void 0:Z.scrollTop)||0}}})),pe.forEach(G=>G.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ne.adoptStyleSheets(document.adoptedStyleSheets,oe.getId(document))};try{let C=[];C.push(W("DOMContentLoaded",()=>{N(F({type:w.DomContentLoaded,data:{}}))}));let U=x=>{var q;return Rr({mutationCb:V,mousemoveCb:(k,Z)=>N(F({type:w.IncrementalSnapshot,data:{source:Z,positions:k}})),mouseInteractionCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},k)})),scrollCb:Q,viewportResizeCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},k)})),inputCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.Input},k)})),mediaInteractionCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},k)})),styleSheetRuleCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},k)})),styleDeclarationCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},k)})),canvasMutationCb:de,fontCb:k=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.Font},k)})),selectionCb:k=>{N(F({type:w.IncrementalSnapshot,data:Object.assign({source:b.Selection},k)}))},blockClass:i,ignoreClass:a,maskTextClass:s,maskTextSelector:c,maskInputOptions:B,inlineStylesheet:l,sampling:v,recordCanvas:S,inlineImages:T,userTriggeredOnInput:L,collectFonts:P,doc:x,maskInputFn:f,maskTextFn:h,keepIframeSrcFn:J,blockSelector:o,slimDOMOptions:j,dataURLOptions:m,mirror:oe,iframeManager:ae,stylesheetManager:ne,shadowDomManager:Se,canvasManager:_t,ignoreCSSAttributes:X,plugins:((q=Y==null?void 0:Y.filter(k=>k.observer))===null||q===void 0?void 0:q.map(k=>({observer:k.observer,options:k.options,callback:Z=>N(F({type:w.Plugin,data:{plugin:k.name,payload:Z}}))})))||[]},y)};ae.addLoadListener(x=>{C.push(U(x.contentDocument))});let H=()=>{ct(),C.push(U(document)),lt=!0};return document.readyState==="interactive"||document.readyState==="complete"?H():C.push(W("load",()=>{N(F({type:w.Load,data:{}})),H()},window)),()=>{C.forEach(x=>x()),lt=!1}}catch(C){console.warn(C)}}Ce.addCustomEvent=(t,e)=>{if(!lt)throw new Error("please add custom event after start recording");N(F({type:w.Custom,data:{tag:t,payload:e}}))};Ce.freezePage=()=>{pe.forEach(t=>t.freeze())};Ce.takeFullSnapshot=t=>{if(!lt)throw new Error("please take full snapshot after start recording");ct(t)};Ce.mirror=oe;var dt=class{constructor(e){this.opts=e;this.seq=0;this.buffer=[];this.stopRecording=null;this.flushTimer=null}start(){var r,n,i;if(typeof document=="undefined"||this.stopRecording)return;let e={emit:o=>{this.buffer.push(o),this.buffer.length>=this.opts.maxEventsPerBatch&&this.flush()},checkoutEveryNms:(r=this.opts.checkoutEveryNms)!=null?r:6e5,inlineStylesheet:(n=this.opts.inlineStylesheet)!=null?n:!1,maskAllInputs:this.opts.maskAllInputs,maskTextClass:this.opts.maskTextClass,blockClass:this.opts.blockClass};this.stopRecording=(i=Ce(e))!=null?i:null,this.flushTimer=setInterval(()=>{this.buffer.length>0&&this.flush()},this.opts.flushIntervalMs)}flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);this.opts.emit({type:"session_replay",data:{seq:this.seq++,events:e}})}destroy(){var e;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush(),(e=this.stopRecording)==null||e.call(this),this.stopRecording=null}};function $n(t){var n;let e=(n=t.getAttribute("data-alphana-amount"))==null?void 0:n.trim();if(!e)return;let r=Number(e);return Number.isFinite(r)?r:void 0}function ei(t){var r;return((r=t.getAttribute("data-alphana-currency"))==null?void 0:r.trim())||void 0}function ti(t){var r;return((r=t.getAttribute("data-alphana-event-name"))==null?void 0:r.trim())||void 0}function ri(t,e){var n;if(!t||typeof t.getAttribute!="function"||typeof t.id!="string")return null;let r=t;for(;r;){let i=(n=r.id)==null?void 0:n.trim();if(i){let o=e.get(i);if(o)return{binding:o,matchedEl:r}}r=r.parentElement}return null}function ni(t,e){var o,a,s;let r=(o=$n(t))!=null?o:e.value,n=(a=ei(t))!=null?a:e.currency;if(r==null||!n)return null;let i=(s=ti(t))!=null?s:e.eventName;return{amount:r,currency:n,eventName:i}}var ut=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=!1;this.onClick=e=>{let r=ri(e.target,this.bindingsById);if(!r)return;let{binding:n,matchedEl:i}=r;if(n.eventKind==="goal"){this.handlers.onGoal(n);return}let o=ni(i,n);if(!o){typeof console!="undefined"&&console.debug("[alphana-sdk] revenue element click skipped: missing amount/currency",n.elementId);return}this.handlers.onRevenue(n,o.amount,o.currency,o.eventName)}}setBindings(e){this.bindingsById=new Map(e.filter(r=>typeof r.elementId=="string"&&r.elementId.trim()).map(r=>[r.elementId.trim(),r]))}start(){typeof document=="undefined"||this.attached||(document.addEventListener("click",this.onClick,!0),this.attached=!0)}destroy(){!this.attached||typeof document=="undefined"||(document.removeEventListener("click",this.onClick,!0),this.attached=!1)}};var Hr="alphana-cookie-consent";function xe(){var t;typeof document!="undefined"&&((t=document.getElementById(Hr))==null||t.remove())}function Zr(t,e){if(typeof document=="undefined")return;xe();let r=document.createElement("div");r.id=Hr,r.setAttribute("data-alphana-widget","cookie-consent"),Object.assign(r.style,{all:"initial",position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483646",pointerEvents:"none"});let n=r.attachShadow({mode:"open"}),i=document.documentElement.getAttribute("dir")==="rtl"||/^(fa|ar|he|ur)/i.test(document.documentElement.lang)?"rtl":"ltr",o=t.theme,a=document.createElement("style");a.textContent=`
6
+ :host { all: initial; }
7
+ .sheet {
8
+ pointer-events: auto;
9
+ margin: 12px;
10
+ padding: 16px 18px;
11
+ border-radius: ${o.borderRadius};
12
+ background: ${o.background};
13
+ color: ${o.text};
14
+ box-shadow: 0 12px 40px rgba(0,0,0,.28);
15
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
16
+ max-width: 720px;
17
+ margin-inline: auto;
18
+ }
19
+ .title {
20
+ font-size: 15px;
21
+ font-weight: 650;
22
+ margin: 0 0 8px;
23
+ line-height: 1.35;
24
+ }
25
+ .message {
26
+ font-size: 13px;
27
+ line-height: 1.55;
28
+ margin: 0 0 14px;
29
+ opacity: .92;
30
+ }
31
+ .actions {
32
+ display: flex;
33
+ flex-wrap: wrap;
34
+ gap: 8px;
35
+ justify-content: flex-end;
36
+ }
37
+ button {
38
+ appearance: none;
39
+ border: 0;
40
+ cursor: pointer;
41
+ border-radius: 10px;
42
+ padding: 9px 14px;
43
+ font-size: 13px;
44
+ font-weight: 600;
45
+ line-height: 1.2;
46
+ }
47
+ .accept {
48
+ background: ${o.primary};
49
+ color: ${o.primaryText};
50
+ }
51
+ .reject {
52
+ background: transparent;
53
+ color: ${o.text};
54
+ border: 1px solid color-mix(in srgb, ${o.text} 35%, transparent);
55
+ }
56
+ a.policy {
57
+ color: inherit;
58
+ opacity: .85;
59
+ font-size: 12px;
60
+ text-decoration: underline;
61
+ display: inline-block;
62
+ margin-bottom: 12px;
63
+ }
64
+ @media (max-width: 480px) {
65
+ .sheet { margin: 8px; padding: 14px; }
66
+ .actions { flex-direction: column-reverse; }
67
+ button { width: 100%; }
68
+ }
69
+ `;let s=document.createElement("div");s.className="sheet",s.setAttribute("dir",i),s.setAttribute("role","dialog"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-label",t.title);let c=document.createElement("p");c.className="title",c.textContent=t.title;let l=document.createElement("p");if(l.className="message",l.textContent=t.message,s.append(c,l),t.policyUrl){let f=document.createElement("a");f.className="policy",f.href=t.policyUrl,f.target="_blank",f.rel="noopener noreferrer",f.textContent=i==="rtl"?"\u0633\u06CC\u0627\u0633\u062A \u062D\u0631\u06CC\u0645 \u062E\u0635\u0648\u0635\u06CC":"Privacy policy",s.append(f)}let d=document.createElement("div");d.className="actions";let u=document.createElement("button");u.type="button",u.className="reject",u.textContent=t.rejectLabel,u.addEventListener("click",()=>{xe(),e.onReject()});let p=document.createElement("button");p.type="button",p.className="accept",p.textContent=t.acceptLabel,p.addEventListener("click",()=>{xe(),e.onAccept()}),d.append(u,p),s.append(d),n.append(a,s),document.documentElement.appendChild(r)}var Kr="__alphana_consent__";function ii(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function oi(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function zr(){let t=ii(Kr);if(!t)return null;try{let e=JSON.parse(t);return(e.status==="granted"||e.status==="rejected")&&typeof e.version=="number"&&typeof e.decidedAt=="number"?e:null}catch(e){return null}}function Wt(t,e){let r={status:t,version:e,decidedAt:Date.now()};oi(Kr,JSON.stringify(r))}var Ut="https://api.alphana.ir/api/events",si={endpoint:Ut,trackNavigation:!0,trackTime:!0,trackHeatmap:!0,trackLogs:!0,mouseSampleRate:.1,maxHeatmapPoints:2e3,batchSize:20,flushInterval:5e3,compressPayloads:!0,compressionThresholdBytes:1024,sessionReplay:!0,sessionReplayCheckoutEveryNms:6e5,sessionReplayInlineStylesheet:!1,sessionReplayMaxEventsPerBatch:48,sessionReplayFlushIntervalMs:4e3,sessionReplayMaskAllInputs:!0,sessionReplayMaskTextClass:"alphana-mask",sessionReplayBlockClass:"alphana-block"},_e="__alphana_first_touch__",ht="__alphana_last_touch__",ai={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},ci=["gclid","fbclid","ttclid","msclkid"];function li(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function di(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function be(t){let e=li(t);if(e)try{let r=JSON.parse(e);return typeof r.landingPage=="string"&&typeof r.capturedAt=="number"?r:void 0}catch(r){return}}function Yr(t,e){di(t,JSON.stringify(e))}function ui(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function hi(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function pi(t){var r;let e={};for(let[n,i]of Object.entries(ai)){let o=(r=t.get(n))==null?void 0:r.trim();o&&(e[i]=o)}return Object.keys(e).length>0?e:void 0}function fi(t){var r;let e={};for(let n of ci){let i=(r=t.get(n))==null?void 0:r.trim();i&&(e[n]=i)}return Object.keys(e).length>0?e:void 0}function mi(t){switch(t.type){case"pageview":return{type:"pageview",data:{...t.data,path:E(t.data.path)}};case"timespent":return{type:"timespent",data:{...t.data,path:E(t.data.path)}};case"heatmap":return{type:"heatmap",data:{...t.data,path:E(t.data.path)}};case"rageclik":return{type:"rageclik",data:{...t.data,path:E(t.data.path)}};case"uturn":return{type:"uturn",data:{...t.data,fromPath:E(t.data.fromPath),toPath:E(t.data.toPath)}};case"identify":return t;case"revenue":return t;case"goal":return{type:"goal",data:{...t.data,path:E(t.data.path)}};case"journey_step":return{type:"journey_step",data:{...t.data,path:E(t.data.path)}};case"client_context":return t;case"session_replay":return t;default:return t}}var We=class{constructor(e={}){this.initialized=!1;this.trackingAllowed=!1;this.trackingBlocked=!1;this.visitorPersisted=!1;this.subscribers=new Set;this.queue=[];this.flushTimer=null;this.heartbeatTimer=null;this.userProperties={};this.flags={};this.flagSubscribers=new Set;this.abVariants={};this.abTestSubscribers=new Set;this.handleVisibilityChange=()=>{var e;document.visibilityState==="hidden"&&((e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate())};this.handlePageHide=()=>{var e;(e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate()};this.handleNavigate=e=>{};var n;this.cfg={...si,...e};try{new URL(this.cfg.endpoint)}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let r=er();this.visitorPersisted=!!r,this.session={id:(n=e.sessionId)!=null?n:Ct(),visitorId:r!=null?r:Ct(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:be(_e),lastTouch:be(ht)}}}updateAttributionForPageView(e,r){let n=hi(),i=pi(n),o=fi(n),a=be(_e),c=!!(i||o||r)?{landingPage:e,referrer:r,referrerHost:ui(r),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!a&&c&&Yr(_e,c),c&&Yr(ht,c);let l={firstTouch:be(_e),lastTouch:be(ht)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:be(_e),lastTouch:be(ht)};return this.session.attribution=e,e}init(){return typeof window=="undefined"||this.initialized?this:(this.initialized=!0,this.bootstrapRuntime(),this)}async bootstrapRuntime(){var i,o;let e=await this.fetchRuntimeConfig();if(this.applyElementBindings((i=e==null?void 0:e.elementBindings)!=null?i:[]),this.cfg.consentMode==="disabled"){this.startTracking();return}let r=(o=e==null?void 0:e.widgets)==null?void 0:o.cookieConsent;if(!(r!=null&&r.enabled)){this.startTracking();return}let n=zr();if(n&&n.version===r.version){n.status==="granted"?this.startTracking():this.blockTracking();return}Zr(r,{onAccept:()=>{Wt("granted",r.version),this.startTracking()},onReject:()=>{Wt("rejected",r.version),this.blockTracking()}})}applyElementBindings(e){this.elementBindings||(this.elementBindings=new ut({onGoal:r=>{this.trackGoal({key:r.key,name:r.name,value:r.value,currency:r.currency,metadata:{source:"element_click",elementId:r.elementId}})},onRevenue:(r,n,i,o)=>{this.trackRevenue({eventName:o!=null?o:"purchase",amount:n,currency:i,metadata:{source:"element_click",elementId:r.elementId,triggerKey:r.key}})}})),this.elementBindings.setBindings(e)}persistVisitorIfNeeded(){this.visitorPersisted||(tr(this.session.visitorId),this.visitorPersisted=!0)}startTracking(){var n;if(this.trackingAllowed||this.trackingBlocked)return;this.trackingAllowed=!0,this.persistVisitorIfNeeded();let e=this.emit.bind(this),{id:r}=this.session;e({type:"client_context",data:Qt(r)}),this.cfg.trackNavigation&&(this.navigation=new Ve({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new He({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new Ze({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new dt({emit:e,checkoutEveryNms:this.cfg.sessionReplayCheckoutEveryNms,inlineStylesheet:this.cfg.sessionReplayInlineStylesheet,maxEventsPerBatch:this.cfg.sessionReplayMaxEventsPerBatch,flushIntervalMs:this.cfg.sessionReplayFlushIntervalMs,maskAllInputs:this.cfg.sessionReplayMaskAllInputs,maskTextClass:this.cfg.sessionReplayMaskTextClass,blockClass:this.cfg.sessionReplayBlockClass}),this.sessionReplay.start()),this.cfg.endpoint&&(this.flushTimer=setInterval(()=>{this.queue.length>0&&this.flushQueue()},this.cfg.flushInterval),window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("pagehide",this.handlePageHide),this.heartbeatTimer=setInterval(()=>{document.visibilityState!=="hidden"&&this.sendHeartbeat()},3e4),this.cfg.trackLogs&&(this.logCapture=new we({endpoint:this.cfg.endpoint,collectEndpoint:this.collectUrl,sessionId:this.session.id,secretKey:this.cfg.secretKey,appId:this.cfg.appId,compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes}),this.logCapture.init())),(n=this.elementBindings)==null||n.start(),this.fetchFlags(),this.fetchAbTests()}blockTracking(){var e;this.trackingBlocked=!0,this.trackingAllowed=!1,this.queue=[],xe(),(e=this.elementBindings)==null||e.destroy()}destroy(){var e,r,n,i,o,a;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),typeof window!="undefined"&&(window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("pagehide",this.handlePageHide)),(e=this.navigation)==null||e.destroy(),(r=this.time)==null||r.destroy(),(n=this.heatmap)==null||n.destroy(),(i=this.sessionReplay)==null||i.destroy(),this.sessionReplay=void 0,(o=this.logCapture)==null||o.destroy(),(a=this.elementBindings)==null||a.destroy(),xe(),typeof window!="undefined"&&window.removeEventListener("tracker:navigate",this.handleNavigate),this.queue.length>0&&this.cfg.endpoint&&this.trackingAllowed&&this.flushBeacon(),this.initialized=!1,this.trackingAllowed=!1,this.trackingBlocked=!1}async sendHeartbeat(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(yt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!0,appId:this.cfg.appId}));try{await fe(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e,keepalive:!0})}catch(n){}}sendDeactivate(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(yt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!1,appId:this.cfg.appId}));It(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e})}emit(e){var r,n,i,o;if(!(!this.trackingAllowed||this.trackingBlocked)){if(e=mi(e),e.type==="pageview"){let a=this.updateAttributionForPageView(e.data.path,e.data.referrer);e={type:"pageview",data:{...e.data,utm:(r=a.lastTouch)==null?void 0:r.utm,attribution:a}}}switch(e.type){case"pageview":this.session.pageViews.push(e.data);break;case"timespent":{let a=(n=this.session.timeSpent[e.data.path])!=null?n:0;this.session.timeSpent[e.data.path]=a+e.data.duration;break}case"heatmap":{let a=e.data.path;this.session.heatmap[a]||(this.session.heatmap[a]=[]);let s=this.session.heatmap[a];s.length<this.cfg.maxHeatmapPoints&&s.push(e.data);break}case"rageclik":case"uturn":case"identify":case"revenue":case"goal":case"journey_step":case"client_context":case"session_replay":break}this.subscribers.forEach(a=>a(e)),(o=(i=this.cfg).onEvent)==null||o.call(i,e),this.cfg.endpoint&&(this.queue.push(e),this.queue.length>=this.cfg.batchSize&&this.flushQueue())}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}trackPageView(e){let r=E(e!=null?e:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"pageview",data:{path:r,title:typeof document!="undefined"?document.title:"",timestamp:Date.now(),sessionId:this.session.id,referrer:typeof document!="undefined"&&document.referrer||void 0}}),typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:r,title:document.title}}))}trackRevenue(e){var r,n;this.emit({type:"revenue",data:{...e,eventName:(r=e.eventName)!=null?r:"purchase",status:(n=e.status)!=null?n:"paid",sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now(),attribution:this.currentAttribution()}})}trackGoal(e){let r=E(typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"goal",data:{...e,sessionId:this.session.id,visitorId:this.session.visitorId,path:r,timestamp:Date.now()}})}trackJourneyStep(e){var n;let r=E((n=e.path)!=null?n:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"journey_step",data:{...e,path:r,sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now()}})}identify(e){this.userProperties={...this.userProperties,...e},this.session.userProperties={...this.userProperties},this.emit({type:"identify",data:{properties:{...this.userProperties},visitorId:this.session.visitorId,timestamp:Date.now()}}),this.fetchFlags()}getFlags(){return{...this.flags}}isFeatureEnabled(e){return this.flags[e]===!0}onFlagsChange(e){return this.flagSubscribers.add(e),()=>this.flagSubscribers.delete(e)}async fetchFlags(){if(!this.cfg.endpoint||!this.cfg.secretKey||!this.trackingAllowed)return;let e=Ne(this.cfg.endpoint)+"/feature-flags/evaluate";try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({userProperties:this.userProperties})});if(!r.ok)return;let n=await r.json();this.flags=n,this.flagSubscribers.forEach(i=>i({...this.flags}))}catch(r){}}getAbVariants(){return{...this.abVariants}}getAbVariant(e){let r=this.abVariants[e];return r!=null?r:null}isAbVariant(e,r){return this.abVariants[e]===r}onAbTestsChange(e){return this.abTestSubscribers.add(e),()=>this.abTestSubscribers.delete(e)}async fetchAbTests(e){if(!this.cfg.endpoint||!this.cfg.secretKey||!this.trackingAllowed)return;let r=Ne(this.cfg.endpoint)+"/ab-tests/evaluate";try{let n={visitorId:this.session.visitorId};e!=null&&e.length&&(n.keys=e);let i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify(n)});if(!i.ok)return;let o=await i.json();this.abVariants=e!=null&&e.length?{...this.abVariants,...o}:{...o},this.abTestSubscribers.forEach(a=>a({...this.abVariants}))}catch(n){}}getSession(){return this.session}getPageViews(){return[...this.session.pageViews]}getTimeSpent(){return{...this.session.timeSpent}}getHeatmapData(e){var r;return e!==void 0?[...(r=this.session.heatmap[e])!=null?r:[]]:Object.entries(this.session.heatmap).reduce((n,[i,o])=>(n[i]=[...o],n),{})}get collectUrl(){var e;return(e=this.cfg.collectEndpoint)!=null?e:Ue(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=Ne(this.cfg.endpoint)+"/sdk/runtime-config";try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({...this.cfg.appId?{appId:this.cfg.appId}:{}})});return r.ok?await r.json():null}catch(r){return null}}currentPath(){return E(typeof window!="undefined"?window.location.pathname+window.location.search:"/")}flush(){this.flushQueue()}async flushQueue(){if(this.queue.length===0)return;let e=this.queue.splice(0);await this.sendBatch(e)}flushBeacon(){if(this.queue.length===0)return;let e=this.queue.splice(0),r=JSON.stringify(gt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};It(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:n})}async sendBatch(e){let r=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},n=JSON.stringify(gt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await fe(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r})}};var A;function Gt(){typeof window=="undefined"||!window.AlphanaSDK||(A?window.AlphanaSDK.tracker=A:delete window.AlphanaSDK.tracker)}function z(t,e){var n;let r=(n=t.dataset[e])==null?void 0:n.trim();return r||void 0}function te(t,e){let r=z(t,e);if(r!==void 0){if(["1","true","yes","on"].includes(r.toLowerCase()))return!0;if(["0","false","no","off"].includes(r.toLowerCase()))return!1}}function K(t,e){let r=z(t,e);if(r===void 0)return;let n=Number(r);return Number.isFinite(n)?n:void 0}function gi(){if(typeof document=="undefined")return{};let t=document.currentScript;return t instanceof HTMLScriptElement?{...z(t,"endpoint")?{endpoint:z(t,"endpoint")}:{},...z(t,"appId")?{appId:z(t,"appId")}:{},...z(t,"secretKey")?{secretKey:z(t,"secretKey")}:{},...z(t,"sessionId")?{sessionId:z(t,"sessionId")}:{},...te(t,"trackNavigation")!==void 0?{trackNavigation:te(t,"trackNavigation")}:{},...te(t,"trackTime")!==void 0?{trackTime:te(t,"trackTime")}:{},...te(t,"trackHeatmap")!==void 0?{trackHeatmap:te(t,"trackHeatmap")}:{},...te(t,"trackLogs")!==void 0?{trackLogs:te(t,"trackLogs")}:{},...te(t,"sessionReplay")!==void 0?{sessionReplay:te(t,"sessionReplay")}:{},...K(t,"sessionReplayCheckoutEveryNms")!==void 0?{sessionReplayCheckoutEveryNms:K(t,"sessionReplayCheckoutEveryNms")}:{},...K(t,"sessionReplayMaxEventsPerBatch")!==void 0?{sessionReplayMaxEventsPerBatch:K(t,"sessionReplayMaxEventsPerBatch")}:{},...K(t,"sessionReplayFlushIntervalMs")!==void 0?{sessionReplayFlushIntervalMs:K(t,"sessionReplayFlushIntervalMs")}:{},...te(t,"sessionReplayMaskAllInputs")!==void 0?{sessionReplayMaskAllInputs:te(t,"sessionReplayMaskAllInputs")}:{},...z(t,"sessionReplayMaskTextClass")?{sessionReplayMaskTextClass:z(t,"sessionReplayMaskTextClass")}:{},...z(t,"sessionReplayBlockClass")?{sessionReplayBlockClass:z(t,"sessionReplayBlockClass")}:{},...K(t,"mouseSampleRate")!==void 0?{mouseSampleRate:K(t,"mouseSampleRate")}:{},...K(t,"maxHeatmapPoints")!==void 0?{maxHeatmapPoints:K(t,"maxHeatmapPoints")}:{},...K(t,"batchSize")!==void 0?{batchSize:K(t,"batchSize")}:{},...K(t,"flushInterval")!==void 0?{flushInterval:K(t,"flushInterval")}:{}}:{}}function yi(t){return Object.keys(t).length>0}function Vt(t={}){return A||(A=new We(t).init(),Gt(),A)}function vi(){return A}function Ht(t,...e){var r,n;switch(t){case"init":return Vt((r=e[0])!=null?r:{});case"identify":A==null||A.identify((n=e[0])!=null?n:{});return;case"trackPageView":A==null||A.trackPageView(e[0]);return;case"trackRevenue":A==null||A.trackRevenue(e[0]);return;case"trackGoal":A==null||A.trackGoal(e[0]);return;case"trackJourneyStep":A==null||A.trackJourneyStep(e[0]);return;case"flush":A==null||A.flush();return;case"destroy":A==null||A.destroy(),A=void 0,Gt();return;default:return t}}function Ii(){var n;if(typeof window=="undefined")return[];let t=window.alphana,e=(n=t==null?void 0:t.q)!=null?n:[],r=((i,...o)=>Ht(i,...o));return r.q=[],window.alphana=r,e}function Ci(){var n;if(typeof window=="undefined")return;let t=Ii(),e=t.some(([i])=>i==="init"),r={...gi(),...(n=window.AlphanaSDKConfig)!=null?n:{}};!e&&yi(r)&&Vt(r);for(let[i,...o]of t)Ht(i,...o);setTimeout(Gt,0)}Ci();return $r(bi);})();
6
70
  /*! Bundled license information:
7
71
 
8
72
  rrweb/es/rrweb/ext/tslib/tslib.es6.js: