alphana-sdk 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alphana-sdk.global.js +57 -14
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -15
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +57 -14
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +57 -14
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var ht=(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')});import{useEffect as ai,useRef as ci}from"react";function Re(t){return t.replace(/\/events\/?$/,"")}function De(t){return`${Re(t)}/collect`}function pt(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 ft(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 Wt(t){return{...t.appId?{appId:t.appId}:{},log:t}}var Ut="__ut_vid__";function gt(){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 Vt(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(Ut)}catch(t){return null}}function Gt(t){if(typeof localStorage!="undefined")try{localStorage.setItem(Ut,t)}catch(e){}}function A(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 Kt="__ut_last_pv_path__",zt="__ut_last_pv_entry_ms__";function Ht(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function Zt(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e)}catch(r){}}function Hr(t,e){Zt(Kt,t),Zt(zt,String(e))}function Zr(){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 xe=class xe{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=A(window.location.pathname+window.location.search);Zr()==="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=Ht(Kt),n=Ht(zt),i=n?Number(n):0;if(!r||!Number.isFinite(i)||i<=0||A(r)===e)return;let o=Date.now()-i;o<0||o>xe.UTURN_THRESHOLD_MS||this.emitUturn(A(r),e,o)}handleNavigation(){let e=A(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=xe.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=A(e);this.previousPath=r,this.pageEntryTime=Date.now(),Hr(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}}))}};xe.UTURN_THRESHOLD_MS=5e3;var _e=xe;var We=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=!1;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=A(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=A(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 mt(t,e){let r=0;return(...n)=>{let i=Date.now();i-r>=e&&(r=i,t(...n))}}var Kr="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",Yt=/^[A-Za-z][\w-]*$/;function zr(t){if(!t||t.nodeType!==1)return"";let e=t.id;if(e&&Yt.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&&Yt.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 Jt(t,e,r){let n=t instanceof Element?t:null;if(!n)return{};let i=n.closest(Kr);if(!i)return{};let o=zr(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 ce=class ce{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=Jt(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=Jt(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=A(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=>A(a))):null,this.throttledMouseMove=mt(this.handleMouseMove,50),this.throttledScroll=mt(this.handleScroll,100)}init(){this.currentPath=A(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<ce.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)<=ce.RAGE_RADIUS_PX);o.length>=ce.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:n,x:e,y:r,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[])}};ce.RAGE_THRESHOLD=3,ce.RAGE_WINDOW_MS=1e3,ce.RAGE_RADIUS_PX=50;var Ue=ce;var vt="application/x-alphana-gzip";function Yr(){return typeof CompressionStream!="undefined"}async function jt(t){if(!Yr())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 qt=1024;async function Qt(t,e,r=!1){var o;let n=(o=e.compressionThresholdBytes)!=null?o:qt;if(!r&&e.compressPayloads!==!1&&t.length>=n){let a=await jt(t);if(a)return{codec:"gzip",body:a,contentType:vt}}return{codec:"json",body:t,contentType:"application/json"}}async function Xt(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 ue(t,e,r={}){try{let n=await Qt(e,r),i=await Xt(t,n,r);if(n.codec==="gzip"&&(i.status===415||i.status===400)){let o=await Qt(e,r,!0);i=await Xt(t,o,r)}}catch(n){}}function yt(t,e,r={}){var o,a;let n=(o=r.compressionThresholdBytes)!=null?o:qt;if(r.compressPayloads!==!1&&e.length>=n||Object.keys((a=r.authHeaders)!=null?a:{}).length>0){ue(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}ue(t,e,{...r,keepalive:!0})}var Ve=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=!1;var r,n,i;this.collectUrl=(r=e.collectEndpoint)!=null?r:De(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(Wt(i));ue(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 L;(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"})(L||(L={}));function Jr(t){return t.nodeType===t.ELEMENT_NODE}function ge(t){var e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function pe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function jr(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 It(t){try{var e=t.rules||t.cssRules;return e?jr(Array.from(e).map(Ct).join("")):null}catch(r){return null}}function Ct(t){var e=t.cssText;if(Qr(t))try{e=It(t.styleSheet)||e}catch(r){}return e}function Qr(t){return"styleSheet"in t}var tr=(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 rr(){return new tr}function Ne(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 $t="__rrweb_original__";function Xr(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=$t in o?o[$t]: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 qr=1,$r=new RegExp("[^a-z0-9-_:]"),fe=-2;function bt(){return qr++}function en(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return $r.test(e)?"div":e}function tn(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function rn(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ce,er,nn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,on=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,sn=/^(data:)([^,]*),(.*)/i;function Ge(t,e){return(t||"").replace(nn,function(r,n,i,o,a,s){var c=i||a||s,l=n||o||"";if(!c)return r;if(!on.test(c)||sn.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(rn(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 an=/^[^ \t\n\r\u000c]+/,cn=/^[, \t\n\r\u000c]+/;function ln(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(cn),!(r>=e.length);){var o=n(an);if(o.slice(-1)===",")o=be(t,o.substring(0,o.length-1)),i.push(o);else{var a="";o=be(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 be(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function dn(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function St(){var t=document.createElement("a");return t.href="",t.href}function wt(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")?be(t,n):r==="srcset"&&n?ln(t,n):r==="style"&&n?Ge(n,St()):e==="object"&&r==="data"&&n?be(t,n):n}function un(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 Me(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?Me(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?Me(t.parentNode,e,r):!1}function kt(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(Me(n,e,!0))return!0;return!!(r&&(n.matches(r)||n.closest(r)))}function hn(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 pn(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 fn(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,v=e.inlineImages,C=e.recordCanvas,y=e.keepIframeSrcFn,g=e.newlyAddedElement,m=g===void 0?!1:g,k=gn(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:L.Document,childNodes:[],compatMode:t.compatMode}:{type:L.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:L.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:k};case t.ELEMENT_NODE:return vn(t,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:c,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:v,recordCanvas:C,keepIframeSrcFn:y,newlyAddedElement:m,rootId:k});case t.TEXT_NODE:return mn(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:k});case t.CDATA_SECTION_NODE:return{type:L.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return{type:L.Comment,textContent:t.textContent||"",rootId:k};default:return!1}}function gn(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function mn(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=tn(t.parentNode.sheet))}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t)}c=Ge(c,St())}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&kt(t,n,i)&&(c=o?o(c):c.replace(/[\S]/g,"*")),{type:L.Text,textContent:c||"",isStyle:l,rootId:a}}function vn(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,v=h===void 0?!1:h,C=e.rootId,y=un(t,n,i),g=en(t),m={},k=t.attributes.length,_=0;_<k;_++){var F=t.attributes[_];m[F.name]=wt(r,g,F.name,F.value)}if(g==="link"&&o){var B=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),T=null;B&&(T=It(B)),T&&(delete m.rel,delete m.href,m._cssText=Ge(T,B.href))}if(g==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=It(t.sheet);T&&(m._cssText=Ge(T,St()))}if(g==="input"||g==="textarea"||g==="select"){var Z=t.value,K=t.checked;m.type!=="radio"&&m.type!=="checkbox"&&m.type!=="submit"&&m.type!=="button"&&Z?m.value=Ne({type:m.type,tagName:g,value:Z,maskInputOptions:s,maskInputFn:c}):K&&(m.checked=K)}if(g==="option"&&(t.selected&&!s.select?m.selected=!0:delete m.selected),g==="canvas"&&p){if(t.__context==="2d")Xr(t)||(m.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var j=t.toDataURL(d.type,d.quality),Q=document.createElement("canvas");Q.width=t.width,Q.height=t.height;var X=Q.toDataURL(d.type,d.quality);j!==X&&(m.rr_dataURL=j)}}if(g==="img"&&u){Ce||(Ce=r.createElement("canvas"),er=Ce.getContext("2d"));var O=t,z=O.crossOrigin;O.crossOrigin="anonymous";var q=function(){try{Ce.width=O.naturalWidth,Ce.height=O.naturalHeight,er.drawImage(O,0,0),m.rr_dataURL=Ce.toDataURL(d.type,d.quality)}catch(Y){console.warn("Cannot inline img src=".concat(O.currentSrc,"! Error: ").concat(Y))}z?m.crossOrigin=z:O.removeAttribute("crossorigin")};O.complete&&O.naturalWidth!==0?q():O.onload=q}if((g==="audio"||g==="video")&&(m.rr_mediaState=t.paused?"paused":"played",m.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(m.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(m.rr_scrollTop=t.scrollTop)),y){var ne=t.getBoundingClientRect(),oe=ne.width,V=ne.height;m={class:m.class,rr_width:"".concat(oe,"px"),rr_height:"".concat(V,"px")}}return g==="iframe"&&!f(m.src)&&(t.contentDocument||(m.rr_src=m.src),delete m.src),{type:L.Element,tagName:g,attributes:m,childNodes:[],isSVG:dn(t)||void 0,needBlock:y,rootId:C}}function E(t){return t===void 0?"":t.toLowerCase()}function yn(t,e){if(e.comment&&t.type===L.Comment)return!0;if(t.type===L.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 he(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,v=e.maskInputFn,C=e.slimDOMOptions,y=e.dataURLOptions,g=y===void 0?{}:y,m=e.inlineImages,k=m===void 0?!1:m,_=e.recordCanvas,F=_===void 0?!1:_,B=e.onSerialize,T=e.onIframeLoad,Z=e.iframeLoadTimeout,K=Z===void 0?5e3:Z,j=e.onStylesheetLoad,Q=e.stylesheetLoadTimeout,X=Q===void 0?5e3:Q,O=e.keepIframeSrcFn,z=O===void 0?function(){return!1}:O,q=e.newlyAddedElement,ne=q===void 0?!1:q,oe=e.preserveWhiteSpace,V=oe===void 0?!0:oe,Y=fn(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,dataURLOptions:g,inlineImages:k,recordCanvas:F,keepIframeSrcFn:z,newlyAddedElement:ne});if(!Y)return console.warn(t,"not serialized"),null;var ae;n.hasNode(t)?ae=n.getId(t):yn(Y,C)||!V&&Y.type===L.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?ae=fe:ae=bt();var N=Object.assign(Y,{id:ae});if(n.add(t,N),ae===fe)return null;B&&B(t);var $=!l;if(N.type===L.Element){$=$&&!N.needBlock,delete N.needBlock;var ie=t.shadowRoot;ie&&pe(ie)&&(N.isShadowHost=!0)}if((N.type===L.Document||N.type===L.Element)&&$){C.headWhitespace&&N.type===L.Element&&N.tagName==="head"&&(V=!1);for(var Ie={doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,slimDOMOptions:C,dataURLOptions:g,inlineImages:k,recordCanvas:F,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z},I=0,W=Array.from(t.childNodes);I<W.length;I++){var G=W[I],R=he(G,Ie);R&&N.childNodes.push(R)}if(Jr(t)&&t.shadowRoot)for(var J=0,w=Array.from(t.shadowRoot.childNodes);J<w.length;J++){var G=w[J],R=he(G,Ie);R&&(pe(t.shadowRoot)&&(R.isShadow=!0),N.childNodes.push(R))}}return t.parentNode&&ge(t.parentNode)&&pe(t.parentNode)&&(N.isShadow=!0),N.type===L.Element&&N.tagName==="iframe"&&hn(t,function(){var H=t.contentDocument;if(H&&T){var Ee=he(H,{doc:H,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,slimDOMOptions:C,dataURLOptions:g,inlineImages:k,recordCanvas:F,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z});Ee&&T(t,Ee)}},K),N.type===L.Element&&N.tagName==="link"&&N.attributes.rel==="stylesheet"&&pn(t,function(){if(j){var H=he(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,slimDOMOptions:C,dataURLOptions:g,inlineImages:k,recordCanvas:F,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z});H&&j(t,H)}},X),N}function nr(t,e){var r=e||{},n=r.mirror,i=n===void 0?new tr: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,v=r.inlineImages,C=v===void 0?!1:v,y=r.recordCanvas,g=y===void 0?!1:y,m=r.maskAllInputs,k=m===void 0?!1:m,_=r.maskTextFn,F=r.maskInputFn,B=r.slimDOM,T=B===void 0?!1:B,Z=r.dataURLOptions,K=r.preserveWhiteSpace,j=r.onSerialize,Q=r.onIframeLoad,X=r.iframeLoadTimeout,O=r.onStylesheetLoad,z=r.stylesheetLoadTimeout,q=r.keepIframeSrcFn,ne=q===void 0?function(){return!1}:q,oe=k===!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}:k===!1?{password:!0}:k,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 he(t,{doc:t,mirror:i,blockClass:a,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:oe,maskTextFn:_,maskInputFn:F,slimDOMOptions:V,dataURLOptions:Z,inlineImages:C,recordCanvas:g,preserveWhiteSpace:K,onSerialize:j,onIframeLoad:Q,iframeLoadTimeout:X,onStylesheetLoad:O,stylesheetLoadTimeout:z,keepIframeSrcFn:ne,newlyAddedElement:!1})}var In=/([^\\]):hover/,Hi=new RegExp(In.source,"g");function D(t,e,r=document){let n={capture:!0,passive:!0};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Se=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
var ht=(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')});import{useEffect as li,useRef as di}from"react";function xe(t){return t.replace(/\/events\/?$/,"")}function De(t){return`${xe(t)}/collect`}function pt(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 ft(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 Wt(t){return{...t.appId?{appId:t.appId}:{},log:t}}var Ut="__ut_vid__";function gt(){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 Vt(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(Ut)}catch(t){return null}}function Gt(t){if(typeof localStorage!="undefined")try{localStorage.setItem(Ut,t)}catch(e){}}function A(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 s=0;s<5;s++)try{let a=decodeURIComponent(i);if(a===i)break;i=a}catch(a){break}let o=n;for(let s=0;s<5;s++)try{let a=decodeURIComponent(o);if(a===o)break;o=a}catch(a){break}return i+o}var Kt="__ut_last_pv_path__",zt="__ut_last_pv_entry_ms__";function Ht(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function Zt(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e)}catch(r){}}function Hr(t,e){Zt(Kt,t),Zt(zt,String(e))}function Zr(){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 Re=class Re{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=A(window.location.pathname+window.location.search);Zr()==="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,s)=>{r(i,o,s),this.handleNavigation()},this.originalReplaceState=history.replaceState.bind(history);let n=this.originalReplaceState;history.replaceState=(i,o,s)=>{n(i,o,s),this.handleNavigation()}}destroy(){window.removeEventListener("popstate",this.handlePopState),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState)}tryEmitMpaHistoryTraversalUturn(e){let r=Ht(Kt),n=Ht(zt),i=n?Number(n):0;if(!r||!Number.isFinite(i)||i<=0||A(r)===e)return;let o=Date.now()-i;o<0||o>Re.UTURN_THRESHOLD_MS||this.emitUturn(A(r),e,o)}handleNavigation(){let e=A(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=Re.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=A(e);this.previousPath=r,this.pageEntryTime=Date.now(),Hr(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}}))}};Re.UTURN_THRESHOLD_MS=5e3;var _e=Re;var We=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=!1;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=A(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=A(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 mt(t,e){let r=0;return(...n)=>{let i=Date.now();i-r>=e&&(r=i,t(...n))}}var Kr="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",Yt=/^[A-Za-z][\w-]*$/;function zr(t){if(!t||t.nodeType!==1)return"";let e=t.id;if(e&&Yt.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&&Yt.test(o)){r.unshift("#"+o);break}let s=n.tagName.toLowerCase(),a=1,c=n.previousElementSibling;for(;c;)c.tagName===n.tagName&&a++,c=c.previousElementSibling;r.unshift(s+":nth-of-type("+a+")"),n=n.parentElement,i++}return r.join(">")}function Jt(t,e,r){let n=t instanceof Element?t:null;if(!n)return{};let i=n.closest(Kr);if(!i)return{};let o=zr(i);if(!o)return{};let s=i.getBoundingClientRect();if(s.width<=0||s.height<=0)return{selector:o};let a=Math.min(1,Math.max(0,(e-s.left)/s.width)),c=Math.min(1,Math.max(0,(r-s.top)/s.height));return{selector:o,relX:Math.round(a*1e3)/1e3,relY:Math.round(c*1e3)/1e3}}var ce=class ce{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),s=Jt(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}:{},...s}),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 s=Jt(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",...s}),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,s=window.scrollY,a=Math.min(r,s+i),c=r>0?a/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:a,xPct:e>0?u/e*100:50,yPct:c,pw:e,ph:r,vw:n,type:"scroll"})};this.handleNavigate=e=>{this.currentPath=A(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(s=>A(s))):null,this.throttledMouseMove=mt(this.handleMouseMove,50),this.throttledScroll=mt(this.handleScroll,100)}init(){this.currentPath=A(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,s,a;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):(a=(s=r.closest("button, a"))==null?void 0:s.textContent)==null?void 0:a.trim().slice(0,60)))||void 0}checkRageClick(e,r,n){let i=Date.now();this.recentClicks=this.recentClicks.filter(s=>i-s.t<ce.RAGE_WINDOW_MS),this.recentClicks.push({x:e,y:r,t:i});let o=this.recentClicks.filter(s=>Math.hypot(s.x-e,s.y-r)<=ce.RAGE_RADIUS_PX);o.length>=ce.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:n,x:e,y:r,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[])}};ce.RAGE_THRESHOLD=3,ce.RAGE_WINDOW_MS=1e3,ce.RAGE_RADIUS_PX=50;var Ue=ce;var vt="application/x-alphana-gzip";function Yr(){return typeof CompressionStream!="undefined"}async function jt(t){if(!Yr())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 qt=1024;async function Qt(t,e,r=!1){var o;let n=(o=e.compressionThresholdBytes)!=null?o:qt;if(!r&&e.compressPayloads!==!1&&t.length>=n){let s=await jt(t);if(s)return{codec:"gzip",body:s,contentType:vt}}return{codec:"json",body:t,contentType:"application/json"}}async function Xt(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 ue(t,e,r={}){try{let n=await Qt(e,r),i=await Xt(t,n,r);if(n.codec==="gzip"&&(i.status===415||i.status===400)){let o=await Qt(e,r,!0);i=await Xt(t,o,r)}}catch(n){}}function yt(t,e,r={}){var o,s;let n=(o=r.compressionThresholdBytes)!=null?o:qt;if(r.compressPayloads!==!1&&e.length>=n||Object.keys((s=r.authHeaders)!=null?s:{}).length>0){ue(t,e,{...r,keepalive:!0});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let a=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,a))return}ue(t,e,{...r,keepalive:!0})}var Ve=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=!1;var r,n,i;this.collectUrl=(r=e.collectEndpoint)!=null?r:De(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(Wt(i));ue(this.collectUrl,o,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:!0}).catch(s=>{this.origError&&this.origError("[user-tracker] Failed to send log:",s)})}};var F;(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"})(F||(F={}));function Jr(t){return t.nodeType===t.ELEMENT_NODE}function ge(t){var e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function pe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function jr(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 It(t){try{var e=t.rules||t.cssRules;return e?jr(Array.from(e).map(Ct).join("")):null}catch(r){return null}}function Ct(t){var e=t.cssText;if(Qr(t))try{e=It(t.styleSheet)||e}catch(r){}return e}function Qr(t){return"styleSheet"in t}var tr=(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 rr(){return new tr}function Ne(t){var e=t.maskInputOptions,r=t.tagName,n=t.type,i=t.value,o=t.maskInputFn,s=i||"";return(e[r.toLowerCase()]||e[n])&&(o?s=o(s):s="*".repeat(s.length)),s}var $t="__rrweb_original__";function Xr(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,s=$t in o?o[$t]:o,a=new Uint32Array(s.call(e,n,i,Math.min(r,t.width-n),Math.min(r,t.height-i)).data.buffer);if(a.some(function(c){return c!==0}))return!1}return!0}var qr=1,$r=new RegExp("[^a-z0-9-_:]"),fe=-2;function bt(){return qr++}function en(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return $r.test(e)?"div":e}function tn(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function rn(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ce,er,nn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,on=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,sn=/^(data:)([^,]*),(.*)/i;function Ge(t,e){return(t||"").replace(nn,function(r,n,i,o,s,a){var c=i||s||a,l=n||o||"";if(!c)return r;if(!on.test(c)||sn.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(rn(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var p=0,g=u;p<g.length;p++){var h=g[p];h!=="."&&(h===".."?d.pop():d.push(h))}return"url(".concat(l).concat(d.join("/")).concat(l,")")})}var an=/^[^ \t\n\r\u000c]+/,cn=/^[, \t\n\r\u000c]+/;function ln(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(cn),!(r>=e.length);){var o=n(an);if(o.slice(-1)===",")o=be(t,o.substring(0,o.length-1)),i.push(o);else{var s="";o=be(t,o);for(var a=!1;;){var c=e.charAt(r);if(c===""){i.push((o+s).trim());break}else if(a)c===")"&&(a=!1);else if(c===","){r+=1,i.push((o+s).trim());break}else c==="("&&(a=!0);s+=c,r+=1}}}return i.join(", ")}function be(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function dn(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function St(){var t=document.createElement("a");return t.href="",t.href}function wt(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")?be(t,n):r==="srcset"&&n?ln(t,n):r==="style"&&n?Ge(n,St()):e==="object"&&r==="data"&&n?be(t,n):n}function un(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 Me(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?Me(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?Me(t.parentNode,e,r):!1}function kt(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(Me(n,e,!0))return!0;return!!(r&&(n.matches(r)||n.closest(r)))}function hn(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 s=setTimeout(function(){i||(e(),i=!0)},r);t.addEventListener("load",function(){clearTimeout(s),i=!0,e()});return}var a="about:blank";if(n.location.href!==a||t.src===a||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function pn(t,e,r){var n=!1,i;try{i=t.sheet}catch(s){return}if(!i){var o=setTimeout(function(){n||(e(),n=!0)},r);t.addEventListener("load",function(){clearTimeout(o),n=!0,e()})}}function fn(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,p=e.maskInputFn,g=e.dataURLOptions,h=g===void 0?{}:g,v=e.inlineImages,C=e.recordCanvas,y=e.keepIframeSrcFn,f=e.newlyAddedElement,m=f===void 0?!1:f,w=gn(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:F.Document,childNodes:[],compatMode:t.compatMode}:{type:F.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:F.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return vn(t,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:c,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:v,recordCanvas:C,keepIframeSrcFn:y,newlyAddedElement:m,rootId:w});case t.TEXT_NODE:return mn(t,{maskTextClass:s,maskTextSelector:a,maskTextFn:u,rootId:w});case t.CDATA_SECTION_NODE:return{type:F.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:F.Comment,textContent:t.textContent||"",rootId:w};default:return!1}}function gn(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function mn(t,e){var r,n=e.maskTextClass,i=e.maskTextSelector,o=e.maskTextFn,s=e.rootId,a=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=a==="STYLE"?!0:void 0,d=a==="SCRIPT"?!0:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=tn(t.parentNode.sheet))}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t)}c=Ge(c,St())}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&kt(t,n,i)&&(c=o?o(c):c.replace(/[\S]/g,"*")),{type:F.Text,textContent:c||"",isStyle:l,rootId:s}}function vn(t,e){for(var r=e.doc,n=e.blockClass,i=e.blockSelector,o=e.inlineStylesheet,s=e.maskInputOptions,a=s===void 0?{}:s,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,p=e.recordCanvas,g=e.keepIframeSrcFn,h=e.newlyAddedElement,v=h===void 0?!1:h,C=e.rootId,y=un(t,n,i),f=en(t),m={},w=t.attributes.length,x=0;x<w;x++){var B=t.attributes[x];m[B.name]=wt(r,f,B.name,B.value)}if(f==="link"&&o){var D=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),T=null;D&&(T=It(D)),T&&(delete m.rel,delete m.href,m._cssText=Ge(T,D.href))}if(f==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=It(t.sheet);T&&(m._cssText=Ge(T,St()))}if(f==="input"||f==="textarea"||f==="select"){var Z=t.value,K=t.checked;m.type!=="radio"&&m.type!=="checkbox"&&m.type!=="submit"&&m.type!=="button"&&Z?m.value=Ne({type:m.type,tagName:f,value:Z,maskInputOptions:a,maskInputFn:c}):K&&(m.checked=K)}if(f==="option"&&(t.selected&&!a.select?m.selected=!0:delete m.selected),f==="canvas"&&p){if(t.__context==="2d")Xr(t)||(m.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var j=t.toDataURL(d.type,d.quality),Q=document.createElement("canvas");Q.width=t.width,Q.height=t.height;var X=Q.toDataURL(d.type,d.quality);j!==X&&(m.rr_dataURL=j)}}if(f==="img"&&u){Ce||(Ce=r.createElement("canvas"),er=Ce.getContext("2d"));var P=t,z=P.crossOrigin;P.crossOrigin="anonymous";var q=function(){try{Ce.width=P.naturalWidth,Ce.height=P.naturalHeight,er.drawImage(P,0,0),m.rr_dataURL=Ce.toDataURL(d.type,d.quality)}catch(Y){console.warn("Cannot inline img src=".concat(P.currentSrc,"! Error: ").concat(Y))}z?m.crossOrigin=z:P.removeAttribute("crossorigin")};P.complete&&P.naturalWidth!==0?q():P.onload=q}if((f==="audio"||f==="video")&&(m.rr_mediaState=t.paused?"paused":"played",m.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(m.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(m.rr_scrollTop=t.scrollTop)),y){var ne=t.getBoundingClientRect(),oe=ne.width,V=ne.height;m={class:m.class,rr_width:"".concat(oe,"px"),rr_height:"".concat(V,"px")}}return f==="iframe"&&!g(m.src)&&(t.contentDocument||(m.rr_src=m.src),delete m.src),{type:F.Element,tagName:f,attributes:m,childNodes:[],isSVG:dn(t)||void 0,needBlock:y,rootId:C}}function E(t){return t===void 0?"":t.toLowerCase()}function yn(t,e){if(e.comment&&t.type===F.Comment)return!0;if(t.type===F.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 he(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,c=e.skipChild,l=c===void 0?!1:c,d=e.inlineStylesheet,u=d===void 0?!0:d,p=e.maskInputOptions,g=p===void 0?{}:p,h=e.maskTextFn,v=e.maskInputFn,C=e.slimDOMOptions,y=e.dataURLOptions,f=y===void 0?{}:y,m=e.inlineImages,w=m===void 0?!1:m,x=e.recordCanvas,B=x===void 0?!1:x,D=e.onSerialize,T=e.onIframeLoad,Z=e.iframeLoadTimeout,K=Z===void 0?5e3:Z,j=e.onStylesheetLoad,Q=e.stylesheetLoadTimeout,X=Q===void 0?5e3:Q,P=e.keepIframeSrcFn,z=P===void 0?function(){return!1}:P,q=e.newlyAddedElement,ne=q===void 0?!1:q,oe=e.preserveWhiteSpace,V=oe===void 0?!0:oe,Y=fn(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,inlineStylesheet:u,maskInputOptions:g,maskTextFn:h,maskInputFn:v,dataURLOptions:f,inlineImages:w,recordCanvas:B,keepIframeSrcFn:z,newlyAddedElement:ne});if(!Y)return console.warn(t,"not serialized"),null;var ae;n.hasNode(t)?ae=n.getId(t):yn(Y,C)||!V&&Y.type===F.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?ae=fe:ae=bt();var O=Object.assign(Y,{id:ae});if(n.add(t,O),ae===fe)return null;D&&D(t);var $=!l;if(O.type===F.Element){$=$&&!O.needBlock,delete O.needBlock;var ie=t.shadowRoot;ie&&pe(ie)&&(O.isShadowHost=!0)}if((O.type===F.Document||O.type===F.Element)&&$){C.headWhitespace&&O.type===F.Element&&O.tagName==="head"&&(V=!1);for(var Ie={doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:g,maskTextFn:h,maskInputFn:v,slimDOMOptions:C,dataURLOptions:f,inlineImages:w,recordCanvas:B,preserveWhiteSpace:V,onSerialize:D,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z},I=0,W=Array.from(t.childNodes);I<W.length;I++){var G=W[I],R=he(G,Ie);R&&O.childNodes.push(R)}if(Jr(t)&&t.shadowRoot)for(var J=0,k=Array.from(t.shadowRoot.childNodes);J<k.length;J++){var G=k[J],R=he(G,Ie);R&&(pe(t.shadowRoot)&&(R.isShadow=!0),O.childNodes.push(R))}}return t.parentNode&&ge(t.parentNode)&&pe(t.parentNode)&&(O.isShadow=!0),O.type===F.Element&&O.tagName==="iframe"&&hn(t,function(){var H=t.contentDocument;if(H&&T){var Ee=he(H,{doc:H,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:g,maskTextFn:h,maskInputFn:v,slimDOMOptions:C,dataURLOptions:f,inlineImages:w,recordCanvas:B,preserveWhiteSpace:V,onSerialize:D,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z});Ee&&T(t,Ee)}},K),O.type===F.Element&&O.tagName==="link"&&O.attributes.rel==="stylesheet"&&pn(t,function(){if(j){var H=he(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:g,maskTextFn:h,maskInputFn:v,slimDOMOptions:C,dataURLOptions:f,inlineImages:w,recordCanvas:B,preserveWhiteSpace:V,onSerialize:D,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z});H&&j(t,H)}},X),O}function nr(t,e){var r=e||{},n=r.mirror,i=n===void 0?new tr:n,o=r.blockClass,s=o===void 0?"rr-block":o,a=r.blockSelector,c=a===void 0?null:a,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,p=u===void 0?null:u,g=r.inlineStylesheet,h=g===void 0?!0:g,v=r.inlineImages,C=v===void 0?!1:v,y=r.recordCanvas,f=y===void 0?!1:y,m=r.maskAllInputs,w=m===void 0?!1:m,x=r.maskTextFn,B=r.maskInputFn,D=r.slimDOM,T=D===void 0?!1:D,Z=r.dataURLOptions,K=r.preserveWhiteSpace,j=r.onSerialize,Q=r.onIframeLoad,X=r.iframeLoadTimeout,P=r.onStylesheetLoad,z=r.stylesheetLoadTimeout,q=r.keepIframeSrcFn,ne=q===void 0?function(){return!1}:q,oe=w===!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}:w===!1?{password:!0}:w,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 he(t,{doc:t,mirror:i,blockClass:s,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:oe,maskTextFn:x,maskInputFn:B,slimDOMOptions:V,dataURLOptions:Z,inlineImages:C,recordCanvas:f,preserveWhiteSpace:K,onSerialize:j,onIframeLoad:Q,iframeLoadTimeout:X,onStylesheetLoad:P,stylesheetLoadTimeout:z,keepIframeSrcFn:ne,newlyAddedElement:!1})}var In=/([^\\]):hover/,Ki=new RegExp(In.source,"g");function _(t,e,r=document){let n={capture:!0,passive:!0};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Se=`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.`,ir={map:{},getId(){return console.error(Se),-1},getNode(){return console.error(Se),null},removeNodeFromMap(){console.error(Se)},has(){return console.error(Se),!1},reset(){console.error(Se)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(ir=new Proxy(ir,{get(t,e,r){return e==="map"&&console.error(Se),Reflect.get(t,e,r)}}));function we(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 me(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)}}),()=>me(t,e,o||{},!0)}function ee(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 Ze(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ke(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function x(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(Me(i,e,n))return!0;return!!(r&&(t.matches(r)||n&&i.closest(r)!==null))}function or(t,e){return e.getId(t)!==-1}function ze(t,e){return e.getId(t)===fe}function At(t,e){if(ge(t))return!1;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?At(t.parentNode,e):!0:!0}function Tt(t){return!!t.changedTouches}function sr(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 Ye(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Je(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function je(t){return!!(t!=null&&t.shadowRoot)}var He=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 S=(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))(S||{}),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||{}),Qe=(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))(Qe||{}),se=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(se||{});function ar(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 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&&ar(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&&ar(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--)}},cr=(t,e)=>`${t}@${e}`,Xe=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,n=s=>{let c=s,l=fe;for(;l===fe;)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 v=ge(s.parentNode)?this.mirror.getId(p):this.mirror.getId(s.parentNode),C=n(s);if(v===-1||C===-1)return r.addNode(s);let y=he(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:g=>{Ye(g,this.mirror)&&this.iframeManager.addIframe(g),Je(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),je(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(g,m)=>{this.iframeManager.attachIframe(g,m),this.shadowDomManager.observeAttachShadow(g)},onStylesheetLoad:(g,m)=>{this.stylesheetManager.attachLinkElement(g,m)}});y&&e.push({parentId:v,nextId:C,node:y})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))lr(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||i(s);for(let s of Array.from(this.addedSet.values()))!dr(this.droppedSet,s)&&!lr(this.removes,s,this.mirror)||dr(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(!ze(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,n=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(n=Ne({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),x(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]=wt(this.doc,r.tagName,e.attributeName,n);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 n=this.mirror.getId(r),i=ge(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);x(e.target,this.blockClass,this.blockSelector,!1)||ze(r,this.mirror)||!or(r,this.mirror)||(this.addedSet.has(r)?(Rt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||At(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[cr(n,i)]?Rt(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:ge(e.target)&&pe(e.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(ze(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[cr(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);x(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 Rt(t,e){t.delete(e),e.childNodes.forEach(r=>Rt(t,r))}function lr(t,e,r){return t.length===0?!1:ur(t,e,r)}function ur(t,e,r){let{parentNode:n}=e;if(!n)return!1;let i=r.getId(n);return t.some(o=>o.id===i)?!0:ur(t,n,r)}function dr(t,e){return t.size===0?!1:hr(t,e)}function hr(t,e){let{parentNode:r}=e;return r?t.has(r)?!0:hr(t,r):!1}var de=[],gr=typeof CSSGroupingRule!="undefined",mr=typeof CSSMediaRule!="undefined",vr=typeof CSSSupportsRule!="undefined",yr=typeof CSSConditionRule!="undefined";function Oe(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,n;let i=new Xe;de.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 Cn({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=we(u=>{let p=Date.now()-s;t(a.map(f=>(f.timeOffset-=p,f)),u),a=[],s=null},o),l=we(u=>{let p=Oe(u),{clientX:f,clientY:h}=Tt(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=[D("mousemove",l,r),D("touchmove",l,r),D("drag",l,r)];return()=>{d.forEach(u=>u())}}function bn({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=Oe(d);if(x(u,n,i,!0))return;let p=Tt(d)?d.changedTouches[0]:d;if(!p)return;let f=r.getId(u),{clientX:h,clientY:v}=p;t({type:Qe[l],id:f,x:h,y:v})};return Object.keys(Qe).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let d=l.toLowerCase(),u=c(l);s.push(D(d,u,e))}),()=>{s.forEach(l=>l())}}function Mt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let a=we(s=>{let c=Oe(s);if(!c||x(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 D("scroll",a,e)}function Sn({viewportResizeCb:t}){let e=-1,r=-1,n=we(()=>{let i=Ze(),o=Ke();(e!==i||r!==o)&&(t({width:Number(o),height:Number(i)}),e=i,r=o)},200);return D("resize",n,window)}function pr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var wn=["INPUT","TEXTAREA","SELECT"],fr=new WeakMap;function kn({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,maskInputOptions:a,maskInputFn:s,sampling:c,userTriggeredOnInput:l}){function d(y){let g=Oe(y),m=y.isTrusted;if(g&&g.tagName==="OPTION"&&(g=g.parentElement),!g||!g.tagName||wn.indexOf(g.tagName)<0||x(g,n,i,!0))return;let k=g.type;if(g.classList.contains(o))return;let _=g.value,F=!1;k==="radio"||k==="checkbox"?F=g.checked:(a[g.tagName.toLowerCase()]||a[k])&&(_=Ne({maskInputOptions:a,tagName:g.tagName,type:k,value:_,maskInputFn:s})),u(g,pr({text:_,isChecked:F,userTriggered:m},l));let B=g.name;k==="radio"&&B&&F&&e.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(T=>{T!==g&&u(T,pr({text:T.value,isChecked:!F,userTriggered:!1},l))})}function u(y,g){let m=fr.get(y);if(!m||m.text!==g.text||m.isChecked!==g.isChecked){fr.set(y,g);let k=r.getId(y);t(Object.assign(Object.assign({},g),{id:k}))}}let f=(c.input==="last"?["change"]:["input","change"]).map(y=>D(y,d,e)),h=e.defaultView;if(!h)return()=>{f.forEach(y=>y())};let v=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),C=[[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 v&&v.set&&f.push(...C.map(y=>me(y[0],y[1],{set(){d({target:this})}},!1,h))),()=>{f.forEach(y=>y())}}function qe(t){let e=[];function r(n,i){if(gr&&n.parentRule instanceof CSSGroupingRule||mr&&n.parentRule instanceof CSSMediaRule||vr&&n.parentRule instanceof CSSSupportsRule||yr&&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 le(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function An({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}=le(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}=le(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}=le(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}=le(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),s.apply(this,[d])});let c={};gr?c.CSSGroupingRule=n.CSSGroupingRule:(mr&&(c.CSSMediaRule=n.CSSMediaRule),yr&&(c.CSSConditionRule=n.CSSConditionRule),vr&&(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:v}=le(this.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||v&&v!==-1)&&t({id:h,styleId:v,adds:[{rule:p,index:[...qe(this),f||0]}]}),l[d].insertRule.apply(this,[p,f])},u.prototype.deleteRule=function(p){let{id:f,styleId:h}=le(this.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||h&&h!==-1)&&t({id:f,styleId:h,removes:[{index:[...qe(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 Nt({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 Tn({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}=le((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:qe(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}=le((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:qe(this.parentRule)}),a.apply(this,[s])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}}function En({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i}){let o=s=>we(c=>{let l=Oe(c);if(!l||x(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=[D("play",o(0)),D("pause",o(1)),D("seeked",o(2)),D("volumechange",o(3)),D("ratechange",o(4))];return()=>{a.forEach(s=>s())}}function Rn({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=ee(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 xn(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:v,endOffset:C}=p;x(f,n,i,!0)||x(v,n,i,!0)||l.push({start:r.getId(f),startOffset:h,end:r.getId(v),endOffset:C})}o({ranges:l})};return s(),D("selectionchange",s)}function Mn(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 Ir(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};Mn(t,e);let n=xt(t,t.doc),i=Cn(t),o=bn(t),a=Mt(t),s=Sn(t),c=kn(t),l=En(t),d=An(t,{win:r}),u=Nt(t,t.doc),p=Tn(t,{win:r}),f=t.collectFonts?Rn(t):()=>{},h=xn(t),v=[];for(let C of t.plugins)v.push(C.observer(C.callback,r,C.options));return()=>{de.forEach(C=>C.reset()),n.disconnect(),i(),o(),a(),s(),c(),l(),d(),u(),p(),f(),h(),v.forEach(C=>C())}}var Pe=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 $e=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Pe(bt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pe(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 S.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:S.IncrementalSnapshot,data:{source:b.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case S.Meta:case S.Load:case S.DomContentLoaded:return!1;case S.Plugin:return r;case S.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case S.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 et=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(ee(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){pe(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),Mt(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)),Nt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ee(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 Cr(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 br(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 ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nn=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(Le=0;Le<ke.length;Le++)Nn[ke.charCodeAt(Le)]=Le;var Le,Sr=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=ke[e[r]>>2],i+=ke[(e[r]&3)<<4|e[r+1]>>4],i+=ke[(e[r+1]&15)<<2|e[r+2]>>6],i+=ke[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 wr=new Map;function On(t,e){let r=wr.get(t);return r||(r=new Map,wr.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Ot=(t,e,r)=>{if(!t||!(kr(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=On(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function tt(t,e,r){if(t instanceof Array)return t.map(n=>tt(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=Sr(t);return{rr_type:n,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[tt(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:[tt(t.data,e,r),t.width,t.height]};if(kr(t,e)||typeof t=="object"){let n=t.constructor.name,i=Ot(t,e,r);return{rr_type:n,index:i}}}}return t}var rt=(t,e,r)=>[...t].map(n=>tt(n,e,r)),kr=(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 Ar(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=ee(e.CanvasRenderingContext2D.prototype,a,function(c){return function(...l){return x(this.canvas,r,n,!0)||setTimeout(()=>{let d=rt([...l],e,this);t(this.canvas,{type:se["2D"],property:a,args:d})},0),c.apply(this,l)}});i.push(s)}catch(s){let c=me(e.CanvasRenderingContext2D.prototype,a,{set(l){t(this.canvas,{type:se["2D"],property:a,args:[l],setter:!0})}});i.push(c)}return()=>{i.forEach(a=>a())}}function Pt(t,e,r){let n=[];try{let i=ee(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(a,...s){return x(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 Tr(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=ee(t,l,function(u){return function(...p){let f=u.apply(this,p);if(Ot(f,a,this),!x(this.canvas,n,i,!0)){let h=rt([...p],a,this),v={type:e,property:l,args:h};r(this.canvas,v)}return f}});s.push(d)}catch(d){let u=me(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:!0})}});s.push(u)}return s}function Er(t,e,r,n,i){let o=[];return o.push(...Tr(e.WebGLRenderingContext.prototype,se.WebGL,t,r,n,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Tr(e.WebGL2RenderingContext.prototype,se.WebGL2,t,r,n,i,e)),()=>{o.forEach(a=>a())}}var Lt=null;try{Rr=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ht=="function"&&ht("worker_threads"),Lt=Rr.Worker}catch(t){}var Rr;function Pn(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}function xr(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=Pn(t,i),a=o.indexOf(`
|
|
4
|
-
`,10)+1,
|
|
5
|
-
`,10)+1,s=o.substring(a)+(n?"//# sourceMappingURL="+n:""),c=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(c)}function Mr(t,e,r){var n;return function(o){return n=n||Fn(t,e,r),new Worker(n,o)}}var Bn=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Nr(){return Bn}function Or(t,e,r){return Nr()?xr(t,e,r):Mr(t,e,r)}var Pr=Or("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);var nt=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=Pt(r,n,i),s=new Map,c=new Pr;c.onmessage=h=>{let{id:v}=h.data;if(s.set(v,!1),!("base64"in h.data))return;let{base64:C,type:y,width:g,height:m}=h.data;this.mutationCb({id:v,type:se["2D"],commands:[{property:"clearRect",args:[0,0,g,m]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:C}],type:y}]},0,0]}]})};let l=1e3/e,d=0,u,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(v=>{x(v,n,i,!0)||h.push(v)}),h},f=h=>{if(d&&h-d<l){u=requestAnimationFrame(f);return}d=h,p().forEach(v=>br(this,void 0,void 0,function*(){var C;let y=this.mirror.getId(v);if(s.get(y))return;if(s.set(y,!0),["webgl","webgl2"].includes(v.__context)){let m=v.getContext(v.__context);((C=m==null?void 0:m.getContextAttributes())===null||C===void 0?void 0:C.preserveDrawingBuffer)===!1&&(m==null||m.clear(m.COLOR_BUFFER_BIT))}let g=yield createImageBitmap(v);c.postMessage({id:y,bitmap:g,width:v.width,height:v.height,dataURLOptions:o.dataURLOptions},[g])})),u=requestAnimationFrame(f)};u=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Pt(e,r,n),o=Ar(this.processMutation.bind(this),e,r,n),a=Er(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=>Cr(a,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e)}};var it=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new He,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:Ct(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 P(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var M,ot,Ft,st=!1,te=rr();function ve(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:v,packFn:C,sampling:y={},dataURLOptions:g={},mousemoveWait:m,recordCanvas:k=!1,recordCrossOriginIframes:_=!1,userTriggeredOnInput:F=!1,collectFonts:B=!1,inlineImages:T=!1,plugins:Z,keepIframeSrcFn:K=()=>!1,ignoreCSSAttributes:j=new Set([])}=t,Q=_?window.parent===window:!0,X=!1;if(!Q)try{window.parent.document,X=!1}catch(I){X=!0}if(Q&&!e)throw new Error("emit function is required");m!==void 0&&y.mousemove===void 0&&(y.mousemove=m),te.reset();let O=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u!==void 0?u:{password:!0},z=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||{};sr();let q,ne=0,oe=I=>{for(let W of Z||[])W.eventProcessor&&(I=W.eventProcessor(I));return C&&(I=C(I)),I};M=(I,W)=>{var G;if(!((G=de[0])===null||G===void 0)&&G.isFrozen()&&I.type!==S.FullSnapshot&&!(I.type===S.IncrementalSnapshot&&I.data.source===b.Mutation)&&de.forEach(R=>R.unfreeze()),Q)e==null||e(oe(I),W);else if(X){let R={type:"rrweb",event:oe(I),isCheckout:W};window.parent.postMessage(R,"*")}if(I.type===S.FullSnapshot)q=I,ne=0;else if(I.type===S.IncrementalSnapshot){if(I.data.source===b.Mutation&&I.data.isAttachIframe)return;ne++;let R=n&&ne>=n,J=r&&I.timestamp-q.timestamp>r;(R||J)&&ot(!0)}};let V=I=>{M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.Mutation},I)}))},Y=I=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.Scroll},I)})),ae=I=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},I)})),N=I=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},I)})),$=new it({mutationCb:V,adoptedStyleSheetCb:N}),ie=new $e({mirror:te,mutationCb:V,stylesheetManager:$,recordCrossOriginIframes:_,wrappedEmit:M});for(let I of Z||[])I.getMirror&&I.getMirror({nodeMirror:te,crossOriginIframeMirror:ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:ie.crossOriginIframeStyleMirror});Ft=new nt({recordCanvas:k,mutationCb:ae,win:window,blockClass:i,blockSelector:o,mirror:te,sampling:y.canvas,dataURLOptions:g});let Ie=new et({mutationCb:V,scrollCb:Y,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:O,dataURLOptions:g,maskTextFn:h,maskInputFn:f,recordCanvas:k,inlineImages:T,sampling:y,slimDOMOptions:z,iframeManager:ie,stylesheetManager:$,canvasManager:Ft,keepIframeSrcFn:K},mirror:te});ot=(I=!1)=>{var W,G,R,J,w,H;M(P({type:S.Meta,data:{href:window.location.href,width:Ke(),height:Ze()}}),I),$.reset(),de.forEach(U=>U.lock());let Ee=nr(document,{mirror:te,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:O,maskTextFn:h,slimDOM:z,dataURLOptions:g,recordCanvas:k,inlineImages:T,onSerialize:U=>{Ye(U,te)&&ie.addIframe(U),Je(U,te)&&$.trackLinkElement(U),je(U)&&Ie.addShadowRoot(U.shadowRoot,document)},onIframeLoad:(U,ut)=>{ie.attachIframe(U,ut),Ie.observeAttachShadow(U)},onStylesheetLoad:(U,ut)=>{$.attachLinkElement(U,ut)},keepIframeSrcFn:K});if(!Ee)return console.warn("Failed to snapshot the document");M(P({type:S.FullSnapshot,data:{node:Ee,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((G=(W=document==null?void 0:document.body)===null||W===void 0?void 0:W.parentElement)===null||G===void 0?void 0:G.scrollLeft)||((R=document==null?void 0:document.body)===null||R===void 0?void 0:R.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((w=(J=document==null?void 0:document.body)===null||J===void 0?void 0:J.parentElement)===null||w===void 0?void 0:w.scrollTop)||((H=document==null?void 0:document.body)===null||H===void 0?void 0:H.scrollTop)||0}}})),de.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document))};try{let I=[];I.push(D("DOMContentLoaded",()=>{M(P({type:S.DomContentLoaded,data:{}}))}));let W=R=>{var J;return Ir({mutationCb:V,mousemoveCb:(w,H)=>M(P({type:S.IncrementalSnapshot,data:{source:H,positions:w}})),mouseInteractionCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},w)})),scrollCb:Y,viewportResizeCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},w)})),inputCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.Input},w)})),mediaInteractionCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},w)})),styleSheetRuleCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},w)})),styleDeclarationCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},w)})),canvasMutationCb:ae,fontCb:w=>M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.Font},w)})),selectionCb:w=>{M(P({type:S.IncrementalSnapshot,data:Object.assign({source:b.Selection},w)}))},blockClass:i,ignoreClass:a,maskTextClass:s,maskTextSelector:c,maskInputOptions:O,inlineStylesheet:l,sampling:y,recordCanvas:k,inlineImages:T,userTriggeredOnInput:F,collectFonts:B,doc:R,maskInputFn:f,maskTextFn:h,keepIframeSrcFn:K,blockSelector:o,slimDOMOptions:z,dataURLOptions:g,mirror:te,iframeManager:ie,stylesheetManager:$,shadowDomManager:Ie,canvasManager:Ft,ignoreCSSAttributes:j,plugins:((J=Z==null?void 0:Z.filter(w=>w.observer))===null||J===void 0?void 0:J.map(w=>({observer:w.observer,options:w.options,callback:H=>M(P({type:S.Plugin,data:{plugin:w.name,payload:H}}))})))||[]},v)};ie.addLoadListener(R=>{I.push(W(R.contentDocument))});let G=()=>{ot(),I.push(W(document)),st=!0};return document.readyState==="interactive"||document.readyState==="complete"?G():I.push(D("load",()=>{M(P({type:S.Load,data:{}})),G()},window)),()=>{I.forEach(R=>R()),st=!1}}catch(I){console.warn(I)}}ve.addCustomEvent=(t,e)=>{if(!st)throw new Error("please add custom event after start recording");M(P({type:S.Custom,data:{tag:t,payload:e}}))};ve.freezePage=()=>{de.forEach(t=>t.freeze())};ve.takeFullSnapshot=t=>{if(!st)throw new Error("please take full snapshot after start recording");ot(t)};ve.mirror=te;var at=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=ve(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}};var Lr="2.0.2";function Fr(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 Dn(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 _n(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 Wn(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function Un(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":Fr(t)}function Br(t){var s,c,l,d,u,p,f,h,v,C,y,g;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:Lr};let e=navigator.userAgent||"",r=Wn(),n=r.mobile!==void 0||r.platform?Un(e,r):Fr(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(m){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:Dn(e),browser:_n(e),language:navigator.language||"",languages:a,colorScheme:i,screenWidth:(f=(p=window.screen)==null?void 0:p.width)!=null?f:0,screenHeight:(v=(h=window.screen)==null?void 0:h.height)!=null?v:0,viewportWidth:(C=window.innerWidth)!=null?C:0,viewportHeight:(y=window.innerHeight)!=null?y:0,devicePixelRatio:(g=window.devicePixelRatio)!=null?g:1,timeZone:o,sdkVersion:Lr}}function Vn(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 Gn(t){var r;return((r=t.getAttribute("data-alphana-currency"))==null?void 0:r.trim())||void 0}function Hn(t){var r;return((r=t.getAttribute("data-alphana-event-name"))==null?void 0:r.trim())||void 0}function Zn(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 Kn(t,e){var o,a,s;let r=(o=Vn(t))!=null?o:e.value,n=(a=Gn(t))!=null?a:e.currency;if(r==null||!n)return null;let i=(s=Hn(t))!=null?s:e.eventName;return{amount:r,currency:n,eventName:i}}var ct=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=!1;this.onClick=e=>{let r=Zn(e.target,this.bindingsById);if(!r)return;let{binding:n,matchedEl:i}=r;if(n.eventKind==="goal"){this.handlers.onGoal(n);return}let o=Kn(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 Dr="alphana-cookie-consent";function Ae(){var t;typeof document!="undefined"&&((t=document.getElementById(Dr))==null||t.remove())}function _r(t,e){if(typeof document=="undefined")return;Ae();let r=document.createElement("div");r.id=Dr,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=`
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,ir={map:{},getId(){return console.error(Se),-1},getNode(){return console.error(Se),null},removeNodeFromMap(){console.error(Se)},has(){return console.error(Se),!1},reset(){console.error(Se)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(ir=new Proxy(ir,{get(t,e,r){return e==="map"&&console.error(Se),Reflect.get(t,e,r)}}));function we(t,e,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=e-(s-i),c=this;a<=0||a>e?(n&&(clearTimeout(n),n=null),i=s,t.apply(c,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,t.apply(c,o)},a))}}function me(t,e,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>me(t,e,o||{},!0)}function ee(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 Ze(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ke(){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(Me(i,e,n))return!0;return!!(r&&(t.matches(r)||n&&i.closest(r)!==null))}function or(t,e){return e.getId(t)!==-1}function ze(t,e){return e.getId(t)===fe}function At(t,e){if(ge(t))return!1;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?At(t.parentNode,e):!0:!0}function Tt(t){return!!t.changedTouches}function sr(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 Ye(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Je(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function je(t){return!!(t!=null&&t.shadowRoot)}var He=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 S=(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))(S||{}),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||{}),Qe=(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))(Qe||{}),se=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(se||{});function ar(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 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&&ar(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&&ar(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--)}},cr=(t,e)=>`${t}@${e}`,Xe=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,n=a=>{let c=a,l=fe;for(;l===fe;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},i=a=>{var c,l,d,u;let p=null;((l=(c=a.getRootNode)===null||c===void 0?void 0:c.call(a))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&a.getRootNode().host&&(p=a.getRootNode().host);let g=p;for(;((u=(d=g==null?void 0:g.getRootNode)===null||d===void 0?void 0:d.call(g))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&g.getRootNode().host;)g=g.getRootNode().host;let h=!this.doc.contains(a)&&(!g||!this.doc.contains(g));if(!a.parentNode||h)return;let v=ge(a.parentNode)?this.mirror.getId(p):this.mirror.getId(a.parentNode),C=n(a);if(v===-1||C===-1)return r.addNode(a);let y=he(a,{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=>{Ye(f,this.mirror)&&this.iframeManager.addIframe(f),Je(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),je(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(f,m)=>{this.iframeManager.attachIframe(f,m),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,m)=>{this.stylesheetManager.attachLinkElement(f,m)}});y&&e.push({parentId:v,nextId:C,node:y})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of Array.from(this.movedSet.values()))lr(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||i(a);for(let a of Array.from(this.addedSet.values()))!dr(this.droppedSet,a)&&!lr(this.removes,a,this.mirror)||dr(this.movedSet,a)?i(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let c=this.mirror.getId(o.value.parentNode),l=n(o.value);c!==-1&&l!==-1&&(a=o)}if(!a)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){a=l;break}else{let p=l.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let g=p.parentNode.host;if(this.mirror.getId(g)!==-1){a=l;break}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),i(a.value)}let s={texts:this.texts.map(a=>({id:this.mirror.getId(a.node),value:a.value})).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>({id:this.mirror.getId(a.node),attributes:a.attributes})).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!ze(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: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,n=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(n=Ne({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 s=i.attributes.style;for(let a of Array.from(r.style)){let c=r.style.getPropertyValue(a),l=r.style.getPropertyPriority(a);(c!==o.style.getPropertyValue(a)||l!==o.style.getPropertyPriority(a))&&(l===""?s[a]=c:s[a]=[c,l])}for(let a of Array.from(o.style))r.style.getPropertyValue(a)===""&&(s[a]=!1)}else i.attributes[e.attributeName]=wt(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=ge(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);M(e.target,this.blockClass,this.blockSelector,!1)||ze(r,this.mirror)||!or(r,this.mirror)||(this.addedSet.has(r)?(xt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||At(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[cr(n,i)]?xt(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:ge(e.target)&&pe(e.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(ze(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[cr(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 xt(t,e){t.delete(e),e.childNodes.forEach(r=>xt(t,r))}function lr(t,e,r){return t.length===0?!1:ur(t,e,r)}function ur(t,e,r){let{parentNode:n}=e;if(!n)return!1;let i=r.getId(n);return t.some(o=>o.id===i)?!0:ur(t,n,r)}function dr(t,e){return t.size===0?!1:hr(t,e)}function hr(t,e){let{parentNode:r}=e;return r?t.has(r)?!0:hr(t,r):!1}var de=[],gr=typeof CSSGroupingRule!="undefined",mr=typeof CSSMediaRule!="undefined",vr=typeof CSSSupportsRule!="undefined",yr=typeof CSSConditionRule!="undefined";function Oe(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 Rt(t,e){var r,n;let i=new Xe;de.push(i),i.init(t);let o=window.MutationObserver||window.__rrMutationObserver,s=(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");s&&window[s]&&(o=window[s]);let a=new o(i.processMutations.bind(i));return a.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Cn({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,s=[],a,c=we(u=>{let p=Date.now()-a;t(s.map(g=>(g.timeOffset-=p,g)),u),s=[],a=null},o),l=we(u=>{let p=Oe(u),{clientX:g,clientY:h}=Tt(u)?u.changedTouches[0]:u;a||(a=Date.now()),s.push({x:g,y:h,id:n.getId(p),timeOffset:Date.now()-a}),c(typeof DragEvent!="undefined"&&u instanceof DragEvent?b.Drag:u instanceof MouseEvent?b.MouseMove:b.TouchMove)},i,{trailing:!1}),d=[_("mousemove",l,r),_("touchmove",l,r),_("drag",l,r)];return()=>{d.forEach(u=>u())}}function bn({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],c=l=>d=>{let u=Oe(d);if(M(u,n,i,!0))return;let p=Tt(d)?d.changedTouches[0]:d;if(!p)return;let g=r.getId(u),{clientX:h,clientY:v}=p;t({type:Qe[l],id:g,x:h,y:v})};return Object.keys(Qe).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&s[l]!==!1).forEach(l=>{let d=l.toLowerCase(),u=c(l);a.push(_(d,u,e))}),()=>{a.forEach(l=>l())}}function Mt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=we(a=>{let c=Oe(a);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 _("scroll",s,e)}function Sn({viewportResizeCb:t}){let e=-1,r=-1,n=we(()=>{let i=Ze(),o=Ke();(e!==i||r!==o)&&(t({width:Number(o),height:Number(i)}),e=i,r=o)},200);return _("resize",n,window)}function pr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var wn=["INPUT","TEXTAREA","SELECT"],fr=new WeakMap;function kn({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,maskInputOptions:s,maskInputFn:a,sampling:c,userTriggeredOnInput:l}){function d(y){let f=Oe(y),m=y.isTrusted;if(f&&f.tagName==="OPTION"&&(f=f.parentElement),!f||!f.tagName||wn.indexOf(f.tagName)<0||M(f,n,i,!0))return;let w=f.type;if(f.classList.contains(o))return;let x=f.value,B=!1;w==="radio"||w==="checkbox"?B=f.checked:(s[f.tagName.toLowerCase()]||s[w])&&(x=Ne({maskInputOptions:s,tagName:f.tagName,type:w,value:x,maskInputFn:a})),u(f,pr({text:x,isChecked:B,userTriggered:m},l));let D=f.name;w==="radio"&&D&&B&&e.querySelectorAll(`input[type="radio"][name="${D}"]`).forEach(T=>{T!==f&&u(T,pr({text:T.value,isChecked:!B,userTriggered:!1},l))})}function u(y,f){let m=fr.get(y);if(!m||m.text!==f.text||m.isChecked!==f.isChecked){fr.set(y,f);let w=r.getId(y);t(Object.assign(Object.assign({},f),{id:w}))}}let g=(c.input==="last"?["change"]:["input","change"]).map(y=>_(y,d,e)),h=e.defaultView;if(!h)return()=>{g.forEach(y=>y())};let v=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),C=[[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 v&&v.set&&g.push(...C.map(y=>me(y[0],y[1],{set(){d({target:this})}},!1,h))),()=>{g.forEach(y=>y())}}function qe(t){let e=[];function r(n,i){if(gr&&n.parentRule instanceof CSSGroupingRule||mr&&n.parentRule instanceof CSSMediaRule||vr&&n.parentRule instanceof CSSSupportsRule||yr&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(t,e)}function le(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function An({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:g}=le(this,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&t({id:p,styleId:g,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}=le(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,removes:[{index:d}]}),o.apply(this,[d])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:p}=le(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replace:d}),s.apply(this,[d])});let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:p}=le(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),a.apply(this,[d])});let c={};gr?c.CSSGroupingRule=n.CSSGroupingRule:(mr&&(c.CSSMediaRule=n.CSSMediaRule),yr&&(c.CSSConditionRule=n.CSSConditionRule),vr&&(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,g){let{id:h,styleId:v}=le(this.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||v&&v!==-1)&&t({id:h,styleId:v,adds:[{rule:p,index:[...qe(this),g||0]}]}),l[d].insertRule.apply(this,[p,g])},u.prototype.deleteRule=function(p){let{id:g,styleId:h}=le(this.parentStyleSheet,e,r.styleMirror);return(g&&g!==-1||h&&h!==-1)&&t({id:g,styleId:h,removes:[{index:[...qe(this),p]}]}),l[d].deleteRule.apply(this,[p])}}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule})}}function Nt({mirror:t,stylesheetManager:e},r){var n,i,o;let s=null;r.nodeName==="#document"?s=t.getId(r):s=t.getId(r.host);let a=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(a==null?void 0:a.prototype,"adoptedStyleSheets");return s===null||s===-1||!a||!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(s!==null&&s!==-1)try{e.adoptStyleSheets(l,s)}catch(p){}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})}function Tn({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(a,c,l){var d;if(r.has(a))return o.apply(this,[a,c,l]);let{id:u,styleId:p}=le((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:a,value:c,priority:l},index:qe(this.parentRule)}),o.apply(this,[a,c,l])};let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(a){var c;if(r.has(a))return s.apply(this,[a]);let{id:l,styleId:d}=le((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:a},index:qe(this.parentRule)}),s.apply(this,[a])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s}}function En({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i}){let o=a=>we(c=>{let l=Oe(c);if(!l||M(l,e,r,!0))return;let{currentTime:d,volume:u,muted:p,playbackRate:g}=l;t({type:a,id:n.getId(l),currentTime:d,volume:u,muted:p,playbackRate:g})},i.media||500),s=[_("play",o(0)),_("pause",o(1)),_("seeked",o(2)),_("volumechange",o(3)),_("ratechange",o(4))];return()=>{s.forEach(a=>a())}}function xn({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 s=ee(e.fonts,"add",function(a){return function(c){return setTimeout(()=>{let l=i.get(c);l&&(t(l),i.delete(c))},0),a.apply(this,[c])}});return n.push(()=>{r.FontFace=o}),n.push(s),()=>{n.forEach(a=>a())}}function Rn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=t,s=!0,a=()=>{let c=e.getSelection();if(!c||s&&(c!=null&&c.isCollapsed))return;s=c.isCollapsed||!1;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let p=c.getRangeAt(u),{startContainer:g,startOffset:h,endContainer:v,endOffset:C}=p;M(g,n,i,!0)||M(v,n,i,!0)||l.push({start:r.getId(g),startOffset:h,end:r.getId(v),endOffset:C})}o({ranges:l})};return a(),_("selectionchange",a)}function Mn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:g}=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),s(...h)},t.inputCb=(...h)=>{e.input&&e.input(...h),a(...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),g(...h)}}function Ir(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};Mn(t,e);let n=Rt(t,t.doc),i=Cn(t),o=bn(t),s=Mt(t),a=Sn(t),c=kn(t),l=En(t),d=An(t,{win:r}),u=Nt(t,t.doc),p=Tn(t,{win:r}),g=t.collectFonts?xn(t):()=>{},h=Rn(t),v=[];for(let C of t.plugins)v.push(C.observer(C.callback,r,C.options));return()=>{de.forEach(C=>C.reset()),n.disconnect(),i(),o(),s(),a(),c(),l(),d(),u(),p(),g(),h(),v.forEach(C=>C())}}var Pe=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),s=i||this.getRemoteIdToIdMap(e),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}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 $e=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Pe(bt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pe(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 S.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:S.IncrementalSnapshot,data:{source:b.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case S.Meta:case S.Load:case S.DomContentLoaded:return!1;case S.Plugin:return r;case S.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case S.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 et=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(ee(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){pe(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),Rt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Mt(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)),Nt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ee(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 Cr(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 br(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{l(n.next(d))}catch(u){s(u)}}function c(d){try{l(n.throw(d))}catch(u){s(u)}}function l(d){d.done?o(d.value):i(d.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}var ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nn=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(Le=0;Le<ke.length;Le++)Nn[ke.charCodeAt(Le)]=Le;var Le,Sr=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=ke[e[r]>>2],i+=ke[(e[r]&3)<<4|e[r+1]>>4],i+=ke[(e[r+1]&15)<<2|e[r+2]>>6],i+=ke[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 wr=new Map;function On(t,e){let r=wr.get(t);return r||(r=new Map,wr.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Ot=(t,e,r)=>{if(!t||!(kr(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=On(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function tt(t,e,r){if(t instanceof Array)return t.map(n=>tt(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=Sr(t);return{rr_type:n,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[tt(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:[tt(t.data,e,r),t.width,t.height]};if(kr(t,e)||typeof t=="object"){let n=t.constructor.name,i=Ot(t,e,r);return{rr_type:n,index:i}}}}return t}var rt=(t,e,r)=>[...t].map(n=>tt(n,e,r)),kr=(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 Ar(t,e,r,n){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof e.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=ee(e.CanvasRenderingContext2D.prototype,s,function(c){return function(...l){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=rt([...l],e,this);t(this.canvas,{type:se["2D"],property:s,args:d})},0),c.apply(this,l)}});i.push(a)}catch(a){let c=me(e.CanvasRenderingContext2D.prototype,s,{set(l){t(this.canvas,{type:se["2D"],property:s,args:[l],setter:!0})}});i.push(c)}return()=>{i.forEach(s=>s())}}function Pt(t,e,r){let n=[];try{let i=ee(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(s,...a){return M(this,e,r,!0)||"__context"in this||(this.__context=s),o.apply(this,[s,...a])}});n.push(i)}catch(i){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(i=>i())}}function Tr(t,e,r,n,i,o,s){let a=[],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=ee(t,l,function(u){return function(...p){let g=u.apply(this,p);if(Ot(g,s,this),!M(this.canvas,n,i,!0)){let h=rt([...p],s,this),v={type:e,property:l,args:h};r(this.canvas,v)}return g}});a.push(d)}catch(d){let u=me(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:!0})}});a.push(u)}return a}function Er(t,e,r,n,i){let o=[];return o.push(...Tr(e.WebGLRenderingContext.prototype,se.WebGL,t,r,n,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Tr(e.WebGL2RenderingContext.prototype,se.WebGL2,t,r,n,i,e)),()=>{o.forEach(s=>s())}}var Lt=null;try{xr=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ht=="function"&&ht("worker_threads"),Lt=xr.Worker}catch(t){}var xr;function Pn(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}function Rr(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=Pn(t,i),s=o.indexOf(`
|
|
4
|
+
`,10)+1,a=o.substring(s)+(n?"//# sourceMappingURL="+n:"");return function(l){return new Lt(a,Object.assign({},l,{eval:!0}))}}function Ln(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 Fn(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=Ln(t,i),s=o.indexOf(`
|
|
5
|
+
`,10)+1,a=o.substring(s)+(n?"//# sourceMappingURL="+n:""),c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function Mr(t,e,r){var n;return function(o){return n=n||Fn(t,e,r),new Worker(n,o)}}var Bn=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Nr(){return Bn}function Or(t,e,r){return Nr()?Rr(t,e,r):Mr(t,e,r)}var Pr=Or("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);var nt=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:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:a})}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 s=Pt(r,n,i),a=new Map,c=new Pr;c.onmessage=h=>{let{id:v}=h.data;if(a.set(v,!1),!("base64"in h.data))return;let{base64:C,type:y,width:f,height:m}=h.data;this.mutationCb({id:v,type:se["2D"],commands:[{property:"clearRect",args:[0,0,f,m]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:C}],type:y}]},0,0]}]})};let l=1e3/e,d=0,u,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(v=>{M(v,n,i,!0)||h.push(v)}),h},g=h=>{if(d&&h-d<l){u=requestAnimationFrame(g);return}d=h,p().forEach(v=>br(this,void 0,void 0,function*(){var C;let y=this.mirror.getId(v);if(a.get(y))return;if(a.set(y,!0),["webgl","webgl2"].includes(v.__context)){let m=v.getContext(v.__context);((C=m==null?void 0:m.getContextAttributes())===null||C===void 0?void 0:C.preserveDrawingBuffer)===!1&&(m==null||m.clear(m.COLOR_BUFFER_BIT))}let f=yield createImageBitmap(v);c.postMessage({id:y,bitmap:f,width:v.width,height:v.height,dataURLOptions:o.dataURLOptions},[f])})),u=requestAnimationFrame(g)};u=requestAnimationFrame(g),this.resetObservers=()=>{s(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Pt(e,r,n),o=Ar(this.processMutation.bind(this),e,r,n),s=Er(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{i(),o(),s()}}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(s=>Cr(s,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e)}};var it=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new He,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 s;if(this.styleMirror.has(o))s=this.styleMirror.getId(o);else{s=this.styleMirror.add(o);let a=Array.from(o.rules||CSSRule);i.push({styleId:s,rules:a.map((c,l)=>({rule:Ct(c),index:l}))})}n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}};function L(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var N,ot,Ft,st=!1,te=rr();function ve(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:p,maskInputFn:g,maskTextFn:h,hooks:v,packFn:C,sampling:y={},dataURLOptions:f={},mousemoveWait:m,recordCanvas:w=!1,recordCrossOriginIframes:x=!1,userTriggeredOnInput:B=!1,collectFonts:D=!1,inlineImages:T=!1,plugins:Z,keepIframeSrcFn:K=()=>!1,ignoreCSSAttributes:j=new Set([])}=t,Q=x?window.parent===window:!0,X=!1;if(!Q)try{window.parent.document,X=!1}catch(I){X=!0}if(Q&&!e)throw new Error("emit function is required");m!==void 0&&y.mousemove===void 0&&(y.mousemove=m),te.reset();let P=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},z=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||{};sr();let q,ne=0,oe=I=>{for(let W of Z||[])W.eventProcessor&&(I=W.eventProcessor(I));return C&&(I=C(I)),I};N=(I,W)=>{var G;if(!((G=de[0])===null||G===void 0)&&G.isFrozen()&&I.type!==S.FullSnapshot&&!(I.type===S.IncrementalSnapshot&&I.data.source===b.Mutation)&&de.forEach(R=>R.unfreeze()),Q)e==null||e(oe(I),W);else if(X){let R={type:"rrweb",event:oe(I),isCheckout:W};window.parent.postMessage(R,"*")}if(I.type===S.FullSnapshot)q=I,ne=0;else if(I.type===S.IncrementalSnapshot){if(I.data.source===b.Mutation&&I.data.isAttachIframe)return;ne++;let R=n&&ne>=n,J=r&&I.timestamp-q.timestamp>r;(R||J)&&ot(!0)}};let V=I=>{N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.Mutation},I)}))},Y=I=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.Scroll},I)})),ae=I=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},I)})),O=I=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},I)})),$=new it({mutationCb:V,adoptedStyleSheetCb:O}),ie=new $e({mirror:te,mutationCb:V,stylesheetManager:$,recordCrossOriginIframes:x,wrappedEmit:N});for(let I of Z||[])I.getMirror&&I.getMirror({nodeMirror:te,crossOriginIframeMirror:ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:ie.crossOriginIframeStyleMirror});Ft=new nt({recordCanvas:w,mutationCb:ae,win:window,blockClass:i,blockSelector:o,mirror:te,sampling:y.canvas,dataURLOptions:f});let Ie=new et({mutationCb:V,scrollCb:Y,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:P,dataURLOptions:f,maskTextFn:h,maskInputFn:g,recordCanvas:w,inlineImages:T,sampling:y,slimDOMOptions:z,iframeManager:ie,stylesheetManager:$,canvasManager:Ft,keepIframeSrcFn:K},mirror:te});ot=(I=!1)=>{var W,G,R,J,k,H;N(L({type:S.Meta,data:{href:window.location.href,width:Ke(),height:Ze()}}),I),$.reset(),de.forEach(U=>U.lock());let Ee=nr(document,{mirror:te,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:P,maskTextFn:h,slimDOM:z,dataURLOptions:f,recordCanvas:w,inlineImages:T,onSerialize:U=>{Ye(U,te)&&ie.addIframe(U),Je(U,te)&&$.trackLinkElement(U),je(U)&&Ie.addShadowRoot(U.shadowRoot,document)},onIframeLoad:(U,ut)=>{ie.attachIframe(U,ut),Ie.observeAttachShadow(U)},onStylesheetLoad:(U,ut)=>{$.attachLinkElement(U,ut)},keepIframeSrcFn:K});if(!Ee)return console.warn("Failed to snapshot the document");N(L({type:S.FullSnapshot,data:{node:Ee,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((G=(W=document==null?void 0:document.body)===null||W===void 0?void 0:W.parentElement)===null||G===void 0?void 0:G.scrollLeft)||((R=document==null?void 0:document.body)===null||R===void 0?void 0:R.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((k=(J=document==null?void 0:document.body)===null||J===void 0?void 0:J.parentElement)===null||k===void 0?void 0:k.scrollTop)||((H=document==null?void 0:document.body)===null||H===void 0?void 0:H.scrollTop)||0}}})),de.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document))};try{let I=[];I.push(_("DOMContentLoaded",()=>{N(L({type:S.DomContentLoaded,data:{}}))}));let W=R=>{var J;return Ir({mutationCb:V,mousemoveCb:(k,H)=>N(L({type:S.IncrementalSnapshot,data:{source:H,positions:k}})),mouseInteractionCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},k)})),scrollCb:Y,viewportResizeCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},k)})),inputCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.Input},k)})),mediaInteractionCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},k)})),styleSheetRuleCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},k)})),styleDeclarationCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},k)})),canvasMutationCb:ae,fontCb:k=>N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.Font},k)})),selectionCb:k=>{N(L({type:S.IncrementalSnapshot,data:Object.assign({source:b.Selection},k)}))},blockClass:i,ignoreClass:s,maskTextClass:a,maskTextSelector:c,maskInputOptions:P,inlineStylesheet:l,sampling:y,recordCanvas:w,inlineImages:T,userTriggeredOnInput:B,collectFonts:D,doc:R,maskInputFn:g,maskTextFn:h,keepIframeSrcFn:K,blockSelector:o,slimDOMOptions:z,dataURLOptions:f,mirror:te,iframeManager:ie,stylesheetManager:$,shadowDomManager:Ie,canvasManager:Ft,ignoreCSSAttributes:j,plugins:((J=Z==null?void 0:Z.filter(k=>k.observer))===null||J===void 0?void 0:J.map(k=>({observer:k.observer,options:k.options,callback:H=>N(L({type:S.Plugin,data:{plugin:k.name,payload:H}}))})))||[]},v)};ie.addLoadListener(R=>{I.push(W(R.contentDocument))});let G=()=>{ot(),I.push(W(document)),st=!0};return document.readyState==="interactive"||document.readyState==="complete"?G():I.push(_("load",()=>{N(L({type:S.Load,data:{}})),G()},window)),()=>{I.forEach(R=>R()),st=!1}}catch(I){console.warn(I)}}ve.addCustomEvent=(t,e)=>{if(!st)throw new Error("please add custom event after start recording");N(L({type:S.Custom,data:{tag:t,payload:e}}))};ve.freezePage=()=>{de.forEach(t=>t.freeze())};ve.takeFullSnapshot=t=>{if(!st)throw new Error("please take full snapshot after start recording");ot(t)};ve.mirror=te;var at=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=ve(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}};var Lr="2.0.2";function Fr(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 Dn(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 _n(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 Wn(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function Un(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":Fr(t)}function Br(t){var a,c,l,d,u,p,g,h,v,C,y,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:Lr};let e=navigator.userAgent||"",r=Wn(),n=r.mobile!==void 0||r.platform?Un(e,r):Fr(e),i="";(c=(a=window.matchMedia)==null?void 0:a.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(m){o=""}let s=typeof navigator.languages!="undefined"&&navigator.languages.length?[...navigator.languages]:navigator.language?[navigator.language]:[];return{sessionId:t,timestamp:Date.now(),device:n,os:Dn(e),browser:_n(e),language:navigator.language||"",languages:s,colorScheme:i,screenWidth:(g=(p=window.screen)==null?void 0:p.width)!=null?g:0,screenHeight:(v=(h=window.screen)==null?void 0:h.height)!=null?v:0,viewportWidth:(C=window.innerWidth)!=null?C:0,viewportHeight:(y=window.innerHeight)!=null?y:0,devicePixelRatio:(f=window.devicePixelRatio)!=null?f:1,timeZone:o,sdkVersion:Lr}}function Vn(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 Gn(t){var r;return((r=t.getAttribute("data-alphana-currency"))==null?void 0:r.trim())||void 0}function Hn(t){var r;return((r=t.getAttribute("data-alphana-event-name"))==null?void 0:r.trim())||void 0}function Zn(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 Kn(t,e){var o,s,a;let r=(o=Vn(t))!=null?o:e.value,n=(s=Gn(t))!=null?s:e.currency;if(r==null||!n)return null;let i=(a=Hn(t))!=null?a:e.eventName;return{amount:r,currency:n,eventName:i}}var ct=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=!1;this.onClick=e=>{let r=Zn(e.target,this.bindingsById);if(!r)return;let{binding:n,matchedEl:i}=r;if(n.eventKind==="goal"){this.handlers.onGoal(n);return}let o=Kn(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 Dr="alphana-cookie-consent",zn="https://alphana.ir",Yn="https://storage.alphana.ir/cdn/logos/Fav-Alphana.png";function Ae(){var t;typeof document!="undefined"&&((t=document.getElementById(Dr))==null||t.remove())}function _r(t,e){var w;if(typeof document=="undefined")return;Ae();let r=document.createElement("div");r.id=Dr,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,s=i==="rtl"?"\u0633\u06CC\u0627\u0633\u062A \u062D\u0631\u06CC\u0645 \u062E\u0635\u0648\u0635\u06CC":"Privacy policy",a=i==="rtl"?"\u0642\u062F\u0631\u062A\u200C\u06AF\u0631\u0641\u062A\u0647 \u0627\u0632 Alphana":"Powered by Alphana",c=document.createElement("style");c.textContent=`
|
|
6
6
|
:host { all: initial; }
|
|
7
7
|
.sheet {
|
|
8
8
|
pointer-events: auto;
|
|
9
9
|
margin: 12px;
|
|
10
|
-
padding: 16px 18px;
|
|
10
|
+
padding: 16px 18px 12px;
|
|
11
11
|
border-radius: ${o.borderRadius};
|
|
12
12
|
background: ${o.background};
|
|
13
13
|
color: ${o.text};
|
|
@@ -21,12 +21,28 @@ or you can use record.mirror to access the mirror instance during recording.`,ir
|
|
|
21
21
|
font-weight: 650;
|
|
22
22
|
margin: 0 0 8px;
|
|
23
23
|
line-height: 1.35;
|
|
24
|
+
color: ${o.text};
|
|
24
25
|
}
|
|
25
26
|
.message {
|
|
26
27
|
font-size: 13px;
|
|
27
28
|
line-height: 1.55;
|
|
28
|
-
margin: 0 0
|
|
29
|
+
margin: 0 0 10px;
|
|
29
30
|
opacity: .92;
|
|
31
|
+
color: ${o.text};
|
|
32
|
+
}
|
|
33
|
+
a.policy {
|
|
34
|
+
color: ${o.primary};
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 1.3;
|
|
38
|
+
text-decoration: underline;
|
|
39
|
+
text-underline-offset: 2px;
|
|
40
|
+
display: inline-block;
|
|
41
|
+
margin: 0 0 14px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
a.policy:hover {
|
|
45
|
+
opacity: .85;
|
|
30
46
|
}
|
|
31
47
|
.actions {
|
|
32
48
|
display: flex;
|
|
@@ -43,6 +59,7 @@ or you can use record.mirror to access the mirror instance during recording.`,ir
|
|
|
43
59
|
font-size: 13px;
|
|
44
60
|
font-weight: 600;
|
|
45
61
|
line-height: 1.2;
|
|
62
|
+
font-family: inherit;
|
|
46
63
|
}
|
|
47
64
|
.accept {
|
|
48
65
|
background: ${o.primary};
|
|
@@ -53,20 +70,46 @@ or you can use record.mirror to access the mirror instance during recording.`,ir
|
|
|
53
70
|
color: ${o.text};
|
|
54
71
|
border: 1px solid color-mix(in srgb, ${o.text} 35%, transparent);
|
|
55
72
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
.footer {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
margin-top: 14px;
|
|
78
|
+
padding-top: 12px;
|
|
79
|
+
border-top: 1px solid color-mix(in srgb, ${o.text} 18%, transparent);
|
|
80
|
+
text-align: center;
|
|
81
|
+
}
|
|
82
|
+
a.brand {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
gap: 6px;
|
|
87
|
+
color: ${o.text};
|
|
88
|
+
opacity: .72;
|
|
89
|
+
font-size: 11px;
|
|
90
|
+
font-weight: 500;
|
|
91
|
+
line-height: 1.2;
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
a.brand:hover {
|
|
96
|
+
opacity: 1;
|
|
60
97
|
text-decoration: underline;
|
|
61
|
-
|
|
62
|
-
|
|
98
|
+
text-underline-offset: 2px;
|
|
99
|
+
}
|
|
100
|
+
a.brand img {
|
|
101
|
+
display: block;
|
|
102
|
+
width: 14px;
|
|
103
|
+
height: 14px;
|
|
104
|
+
object-fit: contain;
|
|
105
|
+
flex-shrink: 0;
|
|
63
106
|
}
|
|
64
107
|
@media (max-width: 480px) {
|
|
65
|
-
.sheet { margin: 8px; padding: 14px; }
|
|
108
|
+
.sheet { margin: 8px; padding: 14px 14px 10px; }
|
|
66
109
|
.actions { flex-direction: column-reverse; }
|
|
67
110
|
button { width: 100%; }
|
|
68
111
|
}
|
|
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",()=>{Ae(),e.onReject()});let p=document.createElement("button");p.type="button",p.className="accept",p.textContent=t.acceptLabel,p.addEventListener("click",()=>{Ae(),e.onAccept()}),d.append(u,p),s.append(d),n.append(a,s),document.documentElement.appendChild(r)}var Wr="__alphana_consent__";function zn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Yn(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function Ur(){let t=zn(Wr);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 Bt(t,e){let r={status:t,version:e,decidedAt:Date.now()};Yn(Wr,JSON.stringify(r))}var Jn="https://api.alphana.ir/api/events",jn={endpoint:Jn,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"},Fe="__alphana_first_touch__",lt="__alphana_last_touch__",Qn={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},Xn=["gclid","fbclid","ttclid","msclkid"];function qn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function $n(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function ye(t){let e=qn(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 Vr(t,e){$n(t,JSON.stringify(e))}function ei(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function ti(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function ri(t){var r;let e={};for(let[n,i]of Object.entries(Qn)){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 ni(t){var r;let e={};for(let n of Xn){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 ii(t){switch(t.type){case"pageview":return{type:"pageview",data:{...t.data,path:A(t.data.path)}};case"timespent":return{type:"timespent",data:{...t.data,path:A(t.data.path)}};case"heatmap":return{type:"heatmap",data:{...t.data,path:A(t.data.path)}};case"rageclik":return{type:"rageclik",data:{...t.data,path:A(t.data.path)}};case"uturn":return{type:"uturn",data:{...t.data,fromPath:A(t.data.fromPath),toPath:A(t.data.toPath)}};case"identify":return t;case"revenue":return t;case"goal":return{type:"goal",data:{...t.data,path:A(t.data.path)}};case"journey_step":return{type:"journey_step",data:{...t.data,path:A(t.data.path)}};case"client_context":return t;case"session_replay":return t;default:return t}}var dt=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={...jn,...e};try{new URL(this.cfg.endpoint)}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let r=Vt();this.visitorPersisted=!!r,this.session={id:(n=e.sessionId)!=null?n:gt(),visitorId:r!=null?r:gt(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:ye(Fe),lastTouch:ye(lt)}}}updateAttributionForPageView(e,r){let n=ti(),i=ri(n),o=ni(n),a=ye(Fe),c=!!(i||o||r)?{landingPage:e,referrer:r,referrerHost:ei(r),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!a&&c&&Vr(Fe,c),c&&Vr(lt,c);let l={firstTouch:ye(Fe),lastTouch:ye(lt)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:ye(Fe),lastTouch:ye(lt)};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=Ur();if(n&&n.version===r.version){n.status==="granted"?this.startTracking():this.blockTracking();return}_r(r,{onAccept:()=>{Bt("granted",r.version),this.startTracking()},onReject:()=>{Bt("rejected",r.version),this.blockTracking()}})}applyElementBindings(e){this.elementBindings||(this.elementBindings=new ct({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||(Gt(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:Br(r)}),this.cfg.trackNavigation&&(this.navigation=new _e({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new We({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new Ue({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new at({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 Ve({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=[],Ae(),(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(),Ae(),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(ft({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!0,appId:this.cfg.appId}));try{await ue(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(ft({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!1,appId:this.cfg.appId}));yt(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=ii(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=A(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=A(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=A((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=Re(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=Re(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:De(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=Re(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 A(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(pt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};yt(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(pt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await ue(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r})}};import{createContext as oi,useContext as si}from"react";var Dt=oi(null);function re(){return si(Dt)}import{jsx as di}from"react/jsx-runtime";function li({config:t={},children:e}){let r=ci(null);return r.current===null&&(r.current=new dt(t)),ai(()=>{let n=r.current;return n.init(),()=>n.destroy()},[]),di(Dt.Provider,{value:r.current,children:e})}import{useEffect as Te,useRef as ui,useState as Be}from"react";function hi(){return re()}function pi(t){let e=re();Te(()=>{e&&t!==void 0&&e.trackPageView(t)},[t])}function fi(t,e=500){let r=re(),[n,i]=Be([]),o=ui(!1);return Te(()=>{if(!r)return;let a=A(t!=null?t:typeof window!="undefined"?window.location.pathname+window.location.search:"/"),s=()=>{i(r.getHeatmapData(a)),o.current=!1};return s(),r.subscribe(l=>{l.type==="heatmap"&&A(l.data.path)===a&&(o.current||(o.current=!0,setTimeout(s,e)))})},[r,t]),n}function gi(){let t=re(),[e,r]=Be([]);return Te(()=>t?(r(t.getPageViews()),t.subscribe(i=>{i.type==="pageview"&&r(t.getPageViews())})):void 0,[t]),e}function mi(){let t=re();return e=>{t==null||t.trackRevenue(e)}}function vi(){let t=re();return e=>{t==null||t.trackGoal(e)}}function yi(){let t=re();return e=>{t==null||t.trackJourneyStep(e)}}function Ii(){let t=re(),[e,r]=Be({});return Te(()=>t?(r(t.getTimeSpent()),t.subscribe(i=>{i.type==="timespent"&&r(t.getTimeSpent())})):void 0,[t]),e}function Gr(){let t=re(),[e,r]=Be(()=>{var n;return(n=t==null?void 0:t.getFlags())!=null?n:{}});return Te(()=>{if(!t)return;r(t.getFlags());let n=t.onFlagsChange(r);return t.fetchFlags(),n},[t]),e}function Ci(t){return Gr()[t]===!0}function _t(){let t=re(),[e,r]=Be(()=>{var n;return(n=t==null?void 0:t.getAbVariants())!=null?n:{}});return Te(()=>{if(!t)return;r(t.getAbVariants());let n=t.onAbTestsChange(r);return t.fetchAbTests(),n},[t]),e}function bi(t){let r=_t()[t];return r!=null?r:null}function Si(t,e){return _t()[t]===e}export{li as UserTrackerProvider,_t as useAbTests,bi as useAbVariant,Ci as useFeatureFlagEnabled,Gr as useFeatureFlags,fi as useHeatmapData,Si as useIsAbVariant,pi as usePageView,gi as usePageViews,Ii as useTimeSpent,vi as useTrackGoal,yi as useTrackJourneyStep,mi as useTrackRevenue,hi as useTracker};
|
|
112
|
+
`;let l=document.createElement("div");l.className="sheet",l.setAttribute("dir",i),l.setAttribute("role","dialog"),l.setAttribute("aria-live","polite"),l.setAttribute("aria-label",t.title);let d=document.createElement("p");d.className="title",d.textContent=t.title;let u=document.createElement("p");u.className="message",u.textContent=t.message,l.append(d,u);let p=(w=t.policyUrl)==null?void 0:w.trim();if(p){let x=document.createElement("a");x.className="policy",x.href=p,x.target="_blank",x.rel="noopener noreferrer",x.textContent=s,l.append(x)}else u.style.marginBottom="14px";let g=document.createElement("div");g.className="actions";let h=document.createElement("button");h.type="button",h.className="reject",h.textContent=t.rejectLabel,h.addEventListener("click",()=>{Ae(),e.onReject()});let v=document.createElement("button");v.type="button",v.className="accept",v.textContent=t.acceptLabel,v.addEventListener("click",()=>{Ae(),e.onAccept()}),g.append(h,v);let C=document.createElement("div");C.className="footer";let y=document.createElement("a");y.className="brand",y.href=zn,y.target="_blank",y.rel="noopener noreferrer",y.setAttribute("aria-label",a);let f=document.createElement("img");f.src=Yn,f.alt="",f.width=14,f.height=14,f.decoding="async";let m=document.createElement("span");m.textContent=a,y.append(f,m),C.append(y),l.append(g,C),n.append(c,l),document.documentElement.appendChild(r)}var Wr="__alphana_consent__";function Jn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function jn(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function Ur(){let t=Jn(Wr);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 Bt(t,e){let r={status:t,version:e,decidedAt:Date.now()};jn(Wr,JSON.stringify(r))}var Qn="https://api.alphana.ir/api/events",Xn={endpoint:Qn,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"},Fe="__alphana_first_touch__",lt="__alphana_last_touch__",qn={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},$n=["gclid","fbclid","ttclid","msclkid"];function ei(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function ti(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function ye(t){let e=ei(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 Vr(t,e){ti(t,JSON.stringify(e))}function ri(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function ni(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function ii(t){var r;let e={};for(let[n,i]of Object.entries(qn)){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 oi(t){var r;let e={};for(let n of $n){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 si(t){switch(t.type){case"pageview":return{type:"pageview",data:{...t.data,path:A(t.data.path)}};case"timespent":return{type:"timespent",data:{...t.data,path:A(t.data.path)}};case"heatmap":return{type:"heatmap",data:{...t.data,path:A(t.data.path)}};case"rageclik":return{type:"rageclik",data:{...t.data,path:A(t.data.path)}};case"uturn":return{type:"uturn",data:{...t.data,fromPath:A(t.data.fromPath),toPath:A(t.data.toPath)}};case"identify":return t;case"revenue":return t;case"goal":return{type:"goal",data:{...t.data,path:A(t.data.path)}};case"journey_step":return{type:"journey_step",data:{...t.data,path:A(t.data.path)}};case"client_context":return t;case"session_replay":return t;default:return t}}var dt=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={...Xn,...e};try{new URL(this.cfg.endpoint)}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let r=Vt();this.visitorPersisted=!!r,this.session={id:(n=e.sessionId)!=null?n:gt(),visitorId:r!=null?r:gt(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:ye(Fe),lastTouch:ye(lt)}}}updateAttributionForPageView(e,r){let n=ni(),i=ii(n),o=oi(n),s=ye(Fe),c=!!(i||o||r)?{landingPage:e,referrer:r,referrerHost:ri(r),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!s&&c&&Vr(Fe,c),c&&Vr(lt,c);let l={firstTouch:ye(Fe),lastTouch:ye(lt)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:ye(Fe),lastTouch:ye(lt)};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=Ur();if(n&&n.version===r.version){n.status==="granted"?this.startTracking():this.blockTracking();return}_r(r,{onAccept:()=>{Bt("granted",r.version),this.startTracking()},onReject:()=>{Bt("rejected",r.version),this.blockTracking()}})}applyElementBindings(e){this.elementBindings||(this.elementBindings=new ct({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||(Gt(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:Br(r)}),this.cfg.trackNavigation&&(this.navigation=new _e({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new We({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new Ue({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new at({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 Ve({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=[],Ae(),(e=this.elementBindings)==null||e.destroy()}destroy(){var e,r,n,i,o,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(),(n=this.heatmap)==null||n.destroy(),(i=this.sessionReplay)==null||i.destroy(),this.sessionReplay=void 0,(o=this.logCapture)==null||o.destroy(),(s=this.elementBindings)==null||s.destroy(),Ae(),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(ft({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!0,appId:this.cfg.appId}));try{await ue(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(ft({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!1,appId:this.cfg.appId}));yt(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=si(e),e.type==="pageview"){let s=this.updateAttributionForPageView(e.data.path,e.data.referrer);e={type:"pageview",data:{...e.data,utm:(r=s.lastTouch)==null?void 0:r.utm,attribution:s}}}switch(e.type){case"pageview":this.session.pageViews.push(e.data);break;case"timespent":{let s=(n=this.session.timeSpent[e.data.path])!=null?n:0;this.session.timeSpent[e.data.path]=s+e.data.duration;break}case"heatmap":{let s=e.data.path;this.session.heatmap[s]||(this.session.heatmap[s]=[]);let a=this.session.heatmap[s];a.length<this.cfg.maxHeatmapPoints&&a.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(s=>s(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=A(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=A(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=A((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=xe(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=xe(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(s=>s({...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:De(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=xe(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 A(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(pt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};yt(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(pt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await ue(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r})}};import{createContext as ai,useContext as ci}from"react";var Dt=ai(null);function re(){return ci(Dt)}import{jsx as hi}from"react/jsx-runtime";function ui({config:t={},children:e}){let r=di(null);return r.current===null&&(r.current=new dt(t)),li(()=>{let n=r.current;return n.init(),()=>n.destroy()},[]),hi(Dt.Provider,{value:r.current,children:e})}import{useEffect as Te,useRef as pi,useState as Be}from"react";function fi(){return re()}function gi(t){let e=re();Te(()=>{e&&t!==void 0&&e.trackPageView(t)},[t])}function mi(t,e=500){let r=re(),[n,i]=Be([]),o=pi(!1);return Te(()=>{if(!r)return;let s=A(t!=null?t:typeof window!="undefined"?window.location.pathname+window.location.search:"/"),a=()=>{i(r.getHeatmapData(s)),o.current=!1};return a(),r.subscribe(l=>{l.type==="heatmap"&&A(l.data.path)===s&&(o.current||(o.current=!0,setTimeout(a,e)))})},[r,t]),n}function vi(){let t=re(),[e,r]=Be([]);return Te(()=>t?(r(t.getPageViews()),t.subscribe(i=>{i.type==="pageview"&&r(t.getPageViews())})):void 0,[t]),e}function yi(){let t=re();return e=>{t==null||t.trackRevenue(e)}}function Ii(){let t=re();return e=>{t==null||t.trackGoal(e)}}function Ci(){let t=re();return e=>{t==null||t.trackJourneyStep(e)}}function bi(){let t=re(),[e,r]=Be({});return Te(()=>t?(r(t.getTimeSpent()),t.subscribe(i=>{i.type==="timespent"&&r(t.getTimeSpent())})):void 0,[t]),e}function Gr(){let t=re(),[e,r]=Be(()=>{var n;return(n=t==null?void 0:t.getFlags())!=null?n:{}});return Te(()=>{if(!t)return;r(t.getFlags());let n=t.onFlagsChange(r);return t.fetchFlags(),n},[t]),e}function Si(t){return Gr()[t]===!0}function _t(){let t=re(),[e,r]=Be(()=>{var n;return(n=t==null?void 0:t.getAbVariants())!=null?n:{}});return Te(()=>{if(!t)return;r(t.getAbVariants());let n=t.onAbTestsChange(r);return t.fetchAbTests(),n},[t]),e}function wi(t){let r=_t()[t];return r!=null?r:null}function ki(t,e){return _t()[t]===e}export{ui as UserTrackerProvider,_t as useAbTests,wi as useAbVariant,Si as useFeatureFlagEnabled,Gr as useFeatureFlags,mi as useHeatmapData,ki as useIsAbVariant,gi as usePageView,vi as usePageViews,bi as useTimeSpent,Ii as useTrackGoal,Ci as useTrackJourneyStep,yi as useTrackRevenue,fi as useTracker};
|
|
70
113
|
/*! Bundled license information:
|
|
71
114
|
|
|
72
115
|
rrweb/es/rrweb/ext/tslib/tslib.es6.js:
|