PageSourceSearch

https://static.ranker.com/_next/static/chunks/6f80e5a4.acbd10d6aaec1146.js

js ranker.com collected 2026-09-24 08:25:45 UTC 178,423 bytes, 10 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2788],{74524:(e,t,s)=>{var i,n,r,a,o;let h;s.d(t,{tracker:()=>sD});class l{constructor(){this.lastTs=0,this.lastSuffix=1,this.backDict={},this.getKey=e=>{let t=!1,s=`__${e}`;if(!this.backDict[s]){t=!0;let e=Date.now()%1e11,i=e;i===this.lastTs?(i=1e4*i+this.lastSuffix,this.lastSuffix+=1):this.lastSuffix=1,this.backDict[s]=i,this.lastTs=e}return[this.backDict[s],t]}}}class c{constructor(e){this.sendSetAttribute=(e,t,s)=>{if(this.isDictDisabled){let i=[12,e,t,s];return this.app.send(i)}{let i=[35,e,this.applyDict(t),this.applyDict(s)];return this.app.send(i)}},this.app=e.app,this.isDictDisabled=e.isDictDisabled,this.dict=new l}applyDict(e){let[t,s]=this.dict.getKey(e);return s&&this.app.send([34,t,e]),t}clear(){this.dict=new l}}class u{constructor(e,t){this.app=e,this.startParams=t,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=e=>{let t=p(e);if(t.type)return t},this.durationInts=[]}setConditions(e){this.conditions=e}async fetchConditions(e,t){try{let s=await fetch(`${this.app.options.ingestPoint}/v1/web/conditions/${e}`,{method:"GET",headers:{Authorization:`Bearer ${t}`}}),{conditions:i}=await s.json(),n=[];i.forEach(e=>{e.filters.forEach(t=>{let s;"fetch"===t.type?(s={type:"network_request",subConditions:[],name:e.name},t.filters.forEach(e=>{let t=this.createConditionFromFilter(e);t&&s.subConditions.push(t)})):s=this.createConditionFromFilter(t),s&&("session_duration"===s.type&&this.processDuration(s.value[0],e.name),n.push({...s,name:e.name}))})}),this.conditions=n}catch(e){this.app.debug.error("Critical: cannot fetch start conditions")}}trigger(e){if(!this.hasStarted)try{this.hasStarted=!0,this.app.start(this.startParams,void 0,e)}catch(e){this.app.debug.error(e)}}processMessage(e){if(!this.hasStarted)switch(e[0]){case 78:this.jsExceptionEvent(e);break;case 27:this.customEvent(e);break;case 68:this.clickEvent(e);break;case 122:this.pageLocationEvent(e);break;case 83:this.networkRequest(e)}}processFlags(e){let t=this.conditions.filter(e=>"feature_flag"===e.type);t.length&&t.forEach(t=>{let s=d[t.operator];s&&e.find(e=>s(e.key,t.value))&&this.trigger(t.name)})}clearDurationInt(e){clearInterval(e),this.durationInts=this.durationInts.filter(t=>t!==e)}processDuration(e,t){let s=setInterval(()=>{performance.now()>e&&(this.clearDurationInt(s),this.trigger(t))},1e3);this.durationInts.push(s),this.app.attachStopCallback(()=>this.clearDurationInt(s))}networkRequest(e){let t=this.conditions.filter(e=>"network_request"===e.type);t.length&&t.forEach(t=>{let s=t.subConditions.filter(e=>"isAny"!==e.operator);s.length?s.every(t=>{let s;switch(t.key){case"url":s=e[3];break;case"status":s=e[6];break;case"method":s=e[2];break;case"duration":s=e[8]}let i=d[t.operator];if(i&&i(s,t.value))return!0})&&this.trigger(t.name):0===s.length&&t.subConditions.length&&this.trigger(t.name)})}customEvent(e){let t=this.conditions.filter(e=>"custom_event"===e.type);t.length&&t.forEach(t=>{let s=d[t.operator];s&&(s(e[1],t.value)||s(e[2],t.value))&&this.trigger(t.name)})}clickEvent(e){let t=this.conditions.filter(e=>"click"===e.type);t.length&&t.forEach(t=>{let s=d[t.operator];s&&(s(e[3],t.value)||s(e[4],t.value))&&this.trigger(t.name)})}pageLocationEvent(e){let t=this.conditions.filter(e=>"visited_url"===e.type);t&&t.forEach(t=>{let s=d[t.operator];s&&s(e[1],t.value)&&this.trigger(t.name)})}jsExceptionEvent(e){let t=[e[1],e[2],e[3]],s=this.conditions.filter(e=>"exception"===e.type);s&&s.forEach(e=>{let s=d[e.operator];s&&t.some(t=>s(t,e.value))&&this.trigger(e.name)}
1)}}let d={is:(e,t)=>t.some(t=>e.includes(t)),isAny:()=>!0,isNot:(e,t)=>!t.some(t=>e.includes(t)),contains:(e,t)=>t.some(t=>e.includes(t)),notContains:(e,t)=>!t.some(t=>e.includes(t)),startsWith:(e,t)=>t.some(t=>e.startsWith(t)),endsWith:(e,t)=>t.some(t=>e.endsWith(t)),greaterThan:(e,t)=>e>t,greaterOrEqual:(e,t)=>e>=t,lessOrEqual:(e,t)=>e<=t,lessThan:(e,t)=>e<t},p=e=>{let t={on:"is",notOn:"isNot",">":"greaterThan","<":"lessThan","=":"is","<=":"lessOrEqual",">=":"greaterOrEqual"},s=e=>{if(Object.keys(t).includes(e))return t[e]},i={type:"",operator:"",value:e.value,key:""};switch(e.type){case"click":i={type:"click",operator:s(e.operator),value:e.value,key:""};break;case"location":i={type:"visited_url",operator:e.operator,value:e.value,key:""};break;case"custom":i={type:"custom_event",operator:e.operator,value:e.value,key:""};break;case"metadata":i={type:"featureFlag"===e.source?"feature_flag":e.type,operator:e.operator,value:e.value,key:""};break;case"error":i={type:"exception",operator:e.operator,value:e.value,key:""};break;case"duration":i={type:"session_duration",value:e.value,key:"",operator:"is"};break;case"fetchUrl":i={type:"network_request",key:"url",operator:e.operator,value:e.value};break;case"fetchStatusCode":i={type:"network_request",key:"status",operator:s(e.operator),value:e.value};break;case"fetchMethod":i={type:"network_request",key:"method",operator:s(e.operator),value:e.value};break;case"fetchDuration":i={type:"network_request",key:"duration",operator:s(e.operator),value:e.value}}return i},f={htmlmasked:"hidden",masked:"obscured"},g="undefined"!=typeof window,m=g&&navigator.userAgent.match(/firefox|fxios/i),y=g?Date.now()-performance.now():0;function b(){y=Date.now()-performance.now()}let v=g&&performance.now?()=>Math.round(performance.now()+y):()=>Date.now(),S="repeat"in String.prototype?e=>"*".repeat(e.length):e=>e.replace(/./g,"*");function w(e){return e?e.trim().replace(/\s+/g," "):""}function k(e){return e.startsWith("https://")||e.startsWith("http://")}let T="https://docs.openreplay.com",I={};function _(e,t,s="/"){I[e]||(console.warn(`OpenReplay: ${e} is deprecated. ${t?`Please, use ${t} instead.`:""} Visit ${T}${s} for more information.`),I[e]=!0)}function E(e,t){if(!t||0===t.length)return"";let s=[];for(let i of t){let t=e.getAttribute(i);null!==t&&s.push(`[${i}=${t}]`)}return s.join("")}function O(e){return e.classList&&0!==e.classList.length?"."+Array.from(e.classList).join("."):""}function C(e){let t=e.getAttribute("data-openreplay-label");return null!==t||null!==(t=e.getAttribute("data-asayer-label"))&&_('"data-asayer-label" attribute','"data-openreplay-label" attribute',"/"),t}function N(e,t){let s=`data-openreplay-${t}`;return!!e.hasAttribute(s)&&(f[t]&&_(`"${s}" attribute`,`"${f[t]}" attribute`,"/en/sdk/sanitize-data"),!0)}function M(e){try{e instanceof HTMLIFrameElement?e.contentDocument:e instanceof Window?e.document:e instanceof Document?e.defaultView:"nodeType"in e?e.nodeType:"addEventListener"in e&&e.addEventListener}catch(e){if(e instanceof DOMException&&"SecurityError"===e.name)return!1}return!0}function A(e){return e.toString(16).padStart(2,"0")}function D(){try{return window.self&&window.top&&window.self!==window.top}catch(e){return!0}}function L(e){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(e):e}function x(e,t){if(t)return new MutationObserver(e);{let t=L("MutationObserver");return new window[t](e)}}function R(e,t,s,i,n){if(!M(e))return;let r="addEventListener";n||(r=L("addEventListener"));try{e[r]?e[r](t,s,i):e.addEventListener(t,s,i)}catch(i){let s=i.message;console.error(`Openreplay: ${s}; if this error is caused by an IframeObserver, ignore it`,t,e)}}function P(e,t,s,i,n){if(!M(e))return;let r="removeEventListener";n||(r=L("removeEventListener"));try{e[r]?e[r](t,s,i):e.removeEventListener(t,s,i)}catch(i){let s=i.message;console.error(`Openreplay: ${s}; if this error is caused by an IframeObserver, ignore it`,t,e)}}class B{constructor(){this.taskQueue=[],this.isRunning=!1}addTask(e){this.taskQueue.push(e),this.runTasks()}runTasks(){if(this.isRunning||0===this.taskQueue.length)return;this.isRunning=!0;let e=()=>{if(0===this.taskQueue.length){this.isRunning=!1;return}Promise.resolve(this.taskQueue.shift()()).then(()=>{requestAnimationFrame(()=>e())})};e()}}let U=new B;function $(e){U.addTask(e)}function j(e,t,s,i){return[73,e,t,s,i]}function z(e){return[117,e]}function H(e){return[118,e]}let W=g&&"performance"in window&&"memory"in performance?performance:{memory:{}},F=g?1024*(navigator.deviceMemory||0):0,q=W.memory.jsHeapSizeLimit||0;class V{constructor(){this.tags=[],this.byId=new Map,this.byDataAttr=new Map,this.byClass=new Map,this.fallback=[]}setTags(e){for(let t of(this.tags=e,this.byId.clear(),this.byDataAttr.clear(),this.byClass.clear(),this.fallback=[],e)){let e=function(e){let t=e.trim();if(!t)return null;let s=t.split(/\s*[>+~ ]\s*/);return s[s.length-1]?.trim()||null}(t.selector);if(!e){this.fallback.push(t);continue}if(e.startsWith("#"))this.byId.set(e.slice(1),t);else if(e.startsWith("[data-"))this.byDataAttr.set(e,t);else{let s=function(e){let t=e.match(/\.([a-zA-Z_-][\w-]*)/);return t?t[1]:null}(e);s?this.byClass.set(s,t):this.fallback.push(t)}}}getTags(){return this.tags}match(e){let t=this.matchExact(e);if(t)return t;if(e.parentElement){let t=this.matchExact(e.parentElement);if(t)return t}let s=e.children;for(let e=0;e<s.length;e++){let t=this.matchExact(s[e]);if(t)return t}return null}matchExact(e){if(e.id&&this.byId.has(e.id)){let t=this.byId.get(e.id);if(K(e,t.selector)&&X(t))return t}if(this.byDataAttr.size>0){let t=e.attributes;for(let s=0;s<t.length;s++){let i=t[s];if(i.name.startsWith("data-")){let t=`[${i.name}="${i.value}"]`;if(this.byDataAttr.has(t)){let s=this.byDataAttr.get(t);if(K(e,s.selector)&&X(s))return s}}}}if(this.byClass.size>0&&e.classList)for(let t=0;t<e.classList.length;t++){let s=e.classList[t];if(this.byClass.has(s)){let t=this.byClass.get(s);if(K(e,t.selector)&&X(t))return t}}for(let t of this.fallback)if(K(e,t.selector)&&X(t))return t;return null}clear(){this.tags=[],this.byId.clear(),this.byDataAttr.clear(),this.byClass.clear(),this.fallback=[]}}function K(e,t){try{return e.matches(t)}catch{return!1}}function X(e){if(!e.location)return!0;try{let t=e.location;if(t.startsWith("/"))return window.location.pathname===t;return window.location.href===t}catch{return!0}}let J="__or__watched_tags__";class Q{constructor(e){this.interval=null,this.tags=[],this.matcher=new V,this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;let t=JSON.parse(e.sessionStorage.getItem(J)??"[]");this.setTags(t),this.observer=new IntersectionObserver(e=>
1{e.forEach(e=>{if(e.isIntersecting&&e.target){let t=e.target.__or_watcher_tagname;t&&this.onTagRendered(t),this.observer.unobserve(e.target)}})})}async fetchTags(e,t){return fetch(`${e}/v1/web/tags`,{method:"GET",headers:{Authorization:`Bearer ${t}`}}).then(e=>e.json()).then(({tags:e})=>{if(e&&e.length){this.setTags(e);let t=JSON.stringify(e);this.sessionStorage.setItem(J,t||"")}}).catch(e=>this.errLog(e))}setTags(e){this.tags=e,this.matcher.setTags(e),this.interval&&(clearInterval(this.interval),this.interval=null),this.interval=setInterval(()=>{this.tags.forEach(e=>{if(!X(e))return;let t=document.querySelectorAll(e.selector);if(t.length>0){let s=t[0];s.__or_watcher_tagname=e.id,this.observer.observe(s)}})},500)}onTagRendered(e){let t=this.tags.find(t=>t.id===e);(!t||(this.tags=this.tags.filter(t=>t.id!==e),X(t)))&&this.onTag(e)}clear(){this.tags=[],this.matcher.clear(),this.interval&&(clearInterval(this.interval),this.interval=null),this.observer.disconnect()}}function G(e){return!!e&&null!=e.nodeType}function Y(e){return"http://www.w3.org/2000/svg"===e.namespaceURI||"svg"===e.localName}function Z(e){return e.nodeType===Node.ELEMENT_NODE}function ee(e){return e.nodeType===Node.TEXT_NODE}function et(e){return e.nodeType===Node.DOCUMENT_NODE}function es(e){return e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ei(e,t){return e.localName===t}class en{constructor(e,t){this.app=e,this.options=t,this.snapshots={},this.intervals=new Map,this.observers=new Map,this.uploadQueue=0,this.MAX_CONCURRENT_UPLOADS=2,this.MAX_QUEUE_SIZE=50,this.pendingBatches=[],this.isProcessingQueue=!1,this.resanitizeCanvas=(e,t)=>{if(ei(e,"canvas")){if(this.app.sanitizer.isObscured(t)||this.app.sanitizer.isHidden(t)){if(this.snapshots[t]||this.observers.has(t)){let e=this.observers.get(t);e&&(e.disconnect(),this.observers.delete(t)),this.cleanupCanvas(t)}}else this.snapshots[t]||this.observers.has(t)||this.captureCanvas(e)}},this.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=e=>{let t=this.app.nodes.getID(e);if(!t||!ei(e,"canvas")||this.app.sanitizer.isObscured(t)||this.app.sanitizer.isHidden(t)||this.snapshots[t])return;let s=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?this.snapshots[t]&&this.snapshots[t].createdAt?this.snapshots[t].paused=!1:this.recordCanvas(e.target,t):this.snapshots[t]&&(this.snapshots[t].paused=!0)})});this.observers.set(t,s),s.observe(e)},this.recordCanvas=(e,t)=>{let s=this.app.timestamp();this.snapshots[t]={images:[],createdAt:s,paused:!1,dummy:document.createElement("canvas"),isCapturing:!1,isStopped:!1};let i=[119,t.toString(),s];this.app.send(i);let n=e=>{!this.snapshots[t]||this.snapshots[t].isCapturing||this.snapshots[t].isStopped||(this.snapshots[t].isCapturing=!0,function(e,t="medium",s,i=!1,n,r){let a=`image/${n}`;if(i){let i=window.devicePixelRatio||1;s.width=e.width/i,s.height=e.height/i;let n=s.getContext("2d");if(!n)return;n.clearRect(0,0,s.width,s.height),n.drawImage(e,0,0,s.width,s.height),s.toBlob(r,a,er[t])}else e.toBlob(r,a,er[t])}(e,this.options.quality,this.snapshots[t].dummy,this.options.fixedScaling,this.fileExt,e=>{this.snapshots[t]&&(this.snapshots[t].isCapturing=!1),e&&this.snapshots[t]&&!this.snapshots[t].isStopped&&(this.snapshots[t].images.push({id:this.app.timestamp(),data:e}),this.snapshots[t].images.length>9&&(this.sendSnaps(this.snapshots[t].images,t,this.snapshots[t].createdAt),this.snapshots[t].images=[]))}))},r=setInterval(()=>{let s=this.snapshots[t];if(!s||s.isStopped){this.app.debug.log("Canvas is not present in {snapshots}"),this.cleanupCanvas(t);return}if(!document.contains(e)){this.app.debug.log("Canvas element not in sync",e,e),this.cleanupCanvas(t);return}s.paused||(this.options.useAnimationFrame?requestAnimationFrame(()=>{n(e)}):n(e))},this.interval);this.intervals.set(t,r)},this.fileExt="webp",this.interval=1e3/t.fps}startTracking(){setTimeout(()=>{this.app.nodes.scanTree(this.captureCanvas),this.app.nodes.attachNodeCallback(this.captureCanvas),this.app.attachResanitizeCallback(this.resanitizeCanvas)},125)}sendSnaps(e,t,s){if(0!==Object.keys(this.snapshots).length){if(this.pendingBatches.length>=this.MAX_QUEUE_SIZE){this.app.debug.warn("Upload queue full, dropping canvas batch");return}this.pendingBatches.push({images:e,canvasId:t,createdAt:s}),this.isProcessingQueue||this.processUploadQueue()}}async processUploadQueue(){for(this.isProcessingQueue=!0;this.pendingBatches.length>0;){if(this.uploadQueue>=this.MAX_CONCURRENT_UPLOADS){await new Promise(e=>setTimeout(e,100));continue}let e=this.pendingBatches.shift();if(!e)break;this.uploadBatch(e.images,e.canvasId,e.createdAt)}this.isProcessingQueue=!1}async uploadBatch(e,t,s){let i;if(this.options.isDebug){let i=await ea(e);if(i){let e=`${s}_${t}.${this.fileExt}.frames`,n=URL.createObjectURL(new Blob([i])),r=document.createElement("a");r.href=n,r.download=e,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}if(this.options.framesSupport){let n=[],r=0;for(let t of e){if(!t.data)continue;let e=await t.data.arrayBuffer();n.push(e),r+=12+e.byteLength}if(0===r)return;let a=new ArrayBuffer(r),o=new DataView(a),h=new Uint8Array(a),l=0;for(let t=0;t<e.length;t++){if(!e[t].data)continue;let s=n.shift(),i=e[t].id;o.setUint32(l,i%4294967296,!0),o.setUint32(l+4,Math.floor(i/4294967296),!0),l+=8,o.setUint32(l,s.byteLength,!0),l+=4,h.set(new Uint8Array(s),l),l+=s.byteLength}(i=new FormData).append("type","frames");let c=`${s}_${t}.${this.fileExt}.frames`;i.append("frames",new Blob([a]),c)}
1else i=new FormData,e.forEach(e=>{let n=e.data;if(!n)return;let r=`${s}_${t}_${e.id}.${this.fileExt}`;i.append("snapshot",n,r)});let n=()=>{this.app.debug.log("Restarting tracker; token expired"),this.app.stop(!1),setTimeout(()=>{this.app.start({},!0)},250)};this.uploadQueue++,fetch(this.app.options.ingestPoint+"/v1/web/images",{method:"POST",headers:{Authorization:`Bearer ${this.app.session.getSessionToken()??""}`},body:i}).then(e=>401!==e.status||n()).catch(e=>{this.app.debug.error("error saving canvas",e)}).finally(()=>{this.uploadQueue--})}cleanupCanvas(e){this.snapshots[e]&&(this.snapshots[e].isStopped=!0);let t=this.intervals.get(e);t&&(clearInterval(t),this.intervals.delete(e));let s=this.observers.get(e);if(s&&(s.disconnect(),this.observers.delete(e)),this.snapshots[e]?.dummy){let t=this.snapshots[e].dummy;t.width=0,t.height=0}delete this.snapshots[e]}clear(){Object.keys(this.snapshots).forEach(e=>{let t=parseInt(e,10),s=this.snapshots[t];s&&s.images.length>0&&(this.sendSnaps(s.images,t,s.createdAt),s.images=[])}),Object.keys(this.snapshots).forEach(e=>{let t=parseInt(e,10);this.cleanupCanvas(t)}),this.intervals.clear(),this.observers.clear(),this.snapshots={}}}let er={low:.35,medium:.55,high:.8};async function ea(e){let t=[],s=0;for(let i of e){if(!i.data)continue;let e=await i.data.arrayBuffer();t.push(e),s+=12+e.byteLength}if(0===s)return null;let i=new ArrayBuffer(s),n=new DataView(i),r=new Uint8Array(i),a=0;for(let s=0;s<e.length;s++){if(!e[s].data)continue;let i=t.shift(),o=e[s].id;n.setUint32(a,o%4294967296,!0),n.setUint32(a+4,Math.floor(o/4294967296),!0),a+=8,n.setUint32(a,i.byteLength,!0),a+=4,r.set(new Uint8Array(i),a),a+=i.byteLength}return i}let eo={Verbose:5,Log:4,Warnings:3,Errors:2,Silent:0};class eh{constructor(e=eo.Silent){this.shouldLog=e=>this.level>=e,this.info=(...e)=>{this.shouldLog(eo.Verbose)&&console.info(...e)},this.log=(...e)=>{this.shouldLog(eo.Log)&&console.log(...e)},this.warn=(...e)=>{this.shouldLog(eo.Warnings)&&console.warn(...e)},this.error=(...e)=>{this.shouldLog(eo.Errors)&&console.error(...e)},this.level=e}}let el={interval:3e4,batchSize:2500,enabled:!0};class ec{constructor(e,t,s){this.nodes=e,this.unregisterNode=t,this.isScanning=!1,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{this.isScanning||(this.isScanning=!0,function(e,t,s,i,n){let r=e.entries();!function e(){let a=0,o=r.next();for(;!o.done&&a<t;){let e=o.value[1];e&&s(e),a++,o=r.next()}a>0?i(setTimeout(e,50)):n()}()}(this.nodes,this.options.batchSize,e=>{(function(e){try{if(!e.isConnected)return[!1,"not connected"];let t=e.nodeType===Node.DOCUMENT_NODE,s=t?e.defaultView:e.ownerDocument?.defaultView,i=t?e:e.ownerDocument;if(!s)return[!1,"no window"];if(s.closed)return[!1,"window closed"];if(!i?.documentElement.isConnected)return[!1,"documentElement not connected"];return[!0,"ok"]}catch(e){return[!1,e]}})(e)[0]||this.unregisterNode(e)},e=>{this.batchTimeout=e},()=>{this.batchTimeout=void 0,this.isScanning=!1}))},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval),this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=void 0),this.isScanning=!1},this.options={...el,...s}}}class eu{constructor(e){this.nodes=new Map,this.totalNodeAmount=0,this.nodeCallbacks=[],this.elementListeners=new Map,this.nextNodeId=0,this.attachNodeCallback=e=>this.nodeCallbacks.push(e),this.scanTree=e=>{this.nodes.forEach(t=>t?e(t):void 0)},this.attachNodeListener=(e,t,s,i=!0)=>{let n=this.getID(e);if(void 0===n)return;R(e,t,s,i,this.forceNgOff);let r=this.elementListeners.get(n);void 0===r&&(r=[],this.elementListeners.set(n,r)),r.push([t,s,i])},this.createFrameId=(e,t)=>(function(e,t,s){if(e<0||e>3)throw RangeError("OR: nesting level overflow, max 4");if(t<0||t>127)throw RangeError("OR: frame order overflow, max 128");return((3&e)<<29|(127&t)<<22|0)>>>0})(e,t,0),this.unregisterNode=e=>{let t=e[this.node_id];if(void 0!==t){e[this.node_id]=void 0,delete e[this.node_id],this.nodes.delete(t);let s=this.elementListeners.get(t);
1void 0!==s&&(this.elementListeners.delete(t),s.forEach(t=>P(e,t[0],t[1],t[2],this.forceNgOff))),this.totalNodeAmount--}return t},this.node_id=e.node_id,this.forceNgOff=e.forceNgOff,this.maintainer=new ec(this.nodes,this.unregisterNode,e.maintainer),this.maintainer.start()}crossdomainMode(e,t){this.nextNodeId=this.createFrameId(e,t)}registerNode(e){let t=e[this.node_id],s=void 0===t||this.nodes.get(t)!==e,i=t;return s&&(i=this.nextNodeId,this.totalNodeAmount++,this.nextNodeId++,this.nodes.set(i,e),e[this.node_id]=i),[i,s]}cleanTree(){for(let[e,t]of this.nodes)t&&!document.contains(t)&&this.unregisterNode(t)}callNodeCallbacks(e,t){this.nodeCallbacks.forEach(s=>s(e,t))}getID(e){if(e)return e[this.node_id]}isBound(e){if(!e)return!1;let t=e[this.node_id];return void 0!==t&&this.nodes.get(t)===e}getNode(e){return this.nodes.get(e)}getNodeCount(){return this.totalNodeAmount}clear(){for(let[e,t]of this.nodes)t&&this.unregisterNode(t);this.nextNodeId=0,this.nodes.clear()}}let ed=99e6;function ep(e){return es(e)&&!!e.adoptedStyleSheets}let ef=15;function eg(){return ef++}let em=new Map;!function(e){e[e.Plain=0]="Plain",e[e.Obscured=1]="Obscured",e[e.Hidden=2]="Hidden"}(i||(i={}));let ey=e=>e.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*");class eb{constructor(e){this.levels=new Map,this.app=e.app,this.privateMode=e.options?.privateMode??!1,this.options=Object.assign({obscureTextEmails:!0,obscureTextNumbers:!1,privateMode:!1,domSanitizer:void 0},e.options)}computeLevel(e,t){if(this.options.privateMode&&(Z(e)&&!N(e,"unmask")||ee(e)&&!N(e.parentNode,"unmask")))return i.Obscured;let s=i.Plain;if((t>=i.Obscured||Z(e)&&(N(e,"masked")||N(e,"obscured")))&&(s=i.Obscured),(t===i.Hidden||Z(e)&&(N(e,"htmlmasked")||N(e,"hidden")))&&(s=i.Hidden),void 0!==this.options.domSanitizer&&Z(e)){let t=this.options.domSanitizer(e);t===i.Obscured&&s<i.Obscured&&(s=i.Obscured),t===i.Hidden&&(s=i.Hidden)}return s}getLevel(e){return this.levels.get(e)??i.Plain}setLevel(e,t){let s=this.getLevel(e);return t===i.Plain?this.levels.delete(e):this.levels.set(e,t),s}handleNode(e,t,s){let i=this.computeLevel(s,this.getLevel(t));i>this.getLevel(e)&&this.setLevel(e,i)}sanitize(e,t){return this.getLevel(e)>=i.Obscured?ey(t):(this.options.obscureTextNumbers&&(t=t.replace(/\d/g,"0")),this.options.obscureTextEmails&&(t=t.replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,e=>{let t=e.lastIndexOf("@"),s=e.slice(0,t),i=e.slice(t+1).split(".").map(e=>S(e)).join(".");return`${S(s)}@${i}`})),t)}isObscured(e){return this.getLevel(e)>=i.Obscured}isHidden(e){return this.getLevel(e)===i.Hidden}getInnerTextSecure(e){let t=this.app.nodes.getID(e);return t?this.sanitize(t,e.innerText):""}clear(){this.levels.clear()}}let ev={},eS={};async function ew(e,t,s){try{let i;let n=e.getAttribute("xlink:href")||e.getAttribute("href");if(!n){console.debug("Openreplay: xlink:href or href not found on <use>.");return}let[r,a]=n.split("#");if(!r&&!a){console.warn("Openreplay: Invalid xlink:href or href found on <use>.");return}let o=r?`url:${r}#${a}#${t}`:`doc:${a}#${t}`;if(ev[o])return ev[o];if(!r&&a){let e;e=n.startsWith("#")?`#${CSS.escape(n.substring(1))}`:CSS.escape(n);let t=document.querySelector(e);if(t){let e=`
2        <svg xmlns="http://www.w3.org/2000/svg" viewBox="${t.getAttribute("viewBox")||"0 0 24 24"}">
3          ${t.innerHTML}
4        </svg>
5      `;return ev[o]=e,e}console.warn("Openreplay: Sprite symbol not found in the document.");return}if(eS[r])1===eS[r]?await new Promise(e=>{let t=0,s=setInterval(()=>{t>100&&(clearInterval(s),e(!1)),1!==eS[r]?(i=eS[r],clearInterval(s),e(!0)):t++},100)}):i=eS[r]??'<svg xmlns="http://www.w3.org/2000/svg"></svg>';else{eS[r]=1;try{let e=await fetch(r),t=await e.text();i=s.parseFromString(t,"image/svg+xml"),eS[r]=i}catch(e){throw delete eS[r],e}}if(!i)return;let h=i.getElementById(a);if(!h)return console.debug("Openreplay: Symbol not found in SVG."),"";if("svgtext"===t){let e=`
6        <svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.getAttribute("viewBox")||"0 0 24 24"}">
7          ${h.innerHTML}
8        </svg>
9      `;return ev[o]=e,e}console.debug(`Openreplay: Unknown mode: ${t}. Use "inline" or "dataurl".`)}catch(e){console.error("Openreplay: Error processing <use> element:",e)}}function ek(e){if(e.nodeType===Node.COMMENT_NODE)return!0;
9if(ee(e))return!1;if(!Z(e))return!0;let t=e.tagName.toUpperCase();if("LINK"===t){let t=e.getAttribute("rel"),s=e.getAttribute("as");return!(t?.includes("stylesheet")||"style"===s||"font"===s)}return"SCRIPT"===t||"NOSCRIPT"===t||"META"===t||"TITLE"===t||"BASE"===t}function eT(e){return!!es(e)||!ek(e)}let eI=new Set(["button","reset","submit","checkbox","radio"]);!function(e){e[e.New=0]="New",e[e.Removed=1]="Removed",e[e.Changed=2]="Changed"}(n||(n={}));class e_{constructor(e,t=!1,s={}){this.app=e,this.isTopContext=t,this.commited=[],this.recents=new Map,this.indexes=[],this.attributesMap=new Map,this.textSet=new Set,this.slotMap=new Map,this.disableSprites=!1,this.inlineRemoteCss=!1,this.inlinerOptions=void 0,this.domParser=new DOMParser,this.generation=0,this.throttling=!0,this.throttledSetNodeData=function(e,t){let s=new Map,i=new Map,n=new Map,r=function(t,...r){let a=Date.now(),o=30-(a-(s.get(t)??0));if(n.set(t,r),o<=0)i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)),s.set(t,a),n.delete(t),e(t,...r);else if(!i.has(t)){let r=setTimeout(()=>{i.delete(t);let r=n.get(t);n.delete(t),s.delete(t),e(t,...r)},o);i.set(t,r)}};return r.clear=()=>{for(let e of i.values())clearTimeout(e);i.clear(),n.clear(),s.clear()},r}((e,t,s)=>this.sendNodeData(e,t,s),0),this.throttling=!s.disableThrottling,this.disableSprites=!!s.disableSprites,this.inlineRemoteCss=!!s.inlineRemoteCss,this.inlinerOptions=s.inlinerOptions,this.observer=x(this.app.safe(e=>{for(let t of e)try{let e=t.target,s=t.type;if(!eT(e))continue;if("childList"===s){for(let e=0;e<t.removedNodes.length;e++)eT(t.removedNodes[e])&&this.bindNode(t.removedNodes[e]);for(let e=0;e<t.addedNodes.length;e++)this.bindTree(t.addedNodes[e]);continue}let i=this.app.nodes.getID(e);if(void 0===i)continue;if(this.recents.has(i)||this.recents.set(i,n.Changed),"attributes"===s){let e=t.attributeName;if(null===e)continue;let s=this.attributesMap.get(i);void 0===s&&this.attributesMap.set(i,s=new Set),s.add(e);continue}if("characterData"===s){this.textSet.add(i);continue}}catch(e){t.target}this.commitNodes()}),this.app.options.forceNgOff)}clear(){this.commited.length=0,this.recents.clear(),this.indexes.length=1,this.attributesMap.clear(),this.textSet.clear()}handleIframeSrcChange(e){let t=e.contentDocument;if(t&&void 0!==this.app.nodes.getID(t)){let s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>ek(e)||void 0===this.app.nodes.getID(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),i=0,n=this.app.nodes.getNodeCount(),r=e.contentDocument,a=this.app.nodes.unregisterNode.bind(this.app.nodes);for(;s.nextNode();)r.contains(s.currentNode)||(i+=1,a(s.currentNode));let o=Math.floor(i/n*100);o>30&&this.app.send([115,o])}}sendNodeAttribute(e,t,s,i){var n;if(Y(t)){if(s.startsWith("xlink:")&&(s=s.substring(6)),null===i){this.app.send([13,e,s]);return}if("use"===t.localName&&"href"===s&&!this.disableSprites){ew(t,"svgtext",this.domParser).then(t=>{t&&this.app.send([12,e,s,`_$OPENREPLAY_SPRITE$_${t}`])}).catch(e=>{console.error("Openreplay: Error parsing <use> element:",e)});return}"href"===s?(i.length>1e5&&(i=""),this.app.send([60,e,s,i,this.app.getBaseHref()])):this.app.attributeSender.sendSetAttribute(e,s,i);return}if("open"===s&&ei(t,"dialog")){let s;if(null===i)s="closed";else{let e=!1;try{e=t.matches("dialog:modal")}catch(e){}s=e?"modal":"nonmodal"}this.app.send([12,e,"__openreplay_dialog",s])}if("src"!==s&&"srcset"!==s&&"integrity"!==s&&"crossorigin"!==s&&"autocomplete"!==s&&"on"!==s.substring(0,2)&&(!("value"===s&&ei(n=t,"input"))||eI.has(n.type))){if(null===i){this.app.send([13,e,s]);return}if("style"===s||"href"===s&&ei(t,"link")){if("rel"in t&&"stylesheet"===t.rel&&this.inlineRemoteCss){let s=this.generation;setTimeout(()=>{!function(e,t,s,i,n,r,a,o,h){let l=o?null:i();o||r(l,t);let c=e.sheet;if(c&&!a)try{let e=p(c);if(e){d(e);return}}catch(e){}function u(){let t=()=>{let t=e.sheet;if(t)try{let e=p(t);if(e){o&&h?h(e,ed++):d(e);return}}catch(e){}};e.sheet?t():e.addEventListener("load",function s(){e.removeEventListener("load",s),t()})}function d(e){let t=function(e){let t=[],s=!1,i=!1,n="",r=0,a="";for(let o=0;o<e.length;o++){let h=e[o],l=e[o+1]||"";if(!i&&"/"===h&&"*"===l){s=!0,o++;continue}if(s){"*"===h&&"/"===l&&(s=!1,o++);continue}if(!i&&('"'===h||"'"===h)){i=!0,n=h,a+=h;continue}if(i){a+=h,h===n&&"\\"!==e[o-1]&&(i=!1);continue}a+=h,"{"===h?r++:"}"===h&&0==--r&&(t.push(a.trim()),a="")}
9return a.trim()&&t.push(a.trim()),t}(e=e.replace(/\/\*[\s\S]*?\*\//g,""));for(let e=0;e<t.length;e++)n(l,t[e],e,s)}function p(e){try{var t;let s=e.rules||e.cssRules;if(!s)return null;let i=e.href;return!i&&e.ownerNode&&e.ownerNode.ownerDocument&&(i=e.ownerNode.ownerDocument.location.href),(t=Array.from(s,e=>(function(e,t){if("styleSheet"in e){let t;try{t=p(e.styleSheet)||function(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let s=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?s.push("layer"):e.layerName&&s.push(`layer(${e.layerName})`),e.supportsText&&s.push(`supports(${e.supportsText})`),e.media.length&&s.push(e.media.mediaText),s.join(" ")+";"}(e)}catch(s){t=e.cssText}return e.styleSheet.href?f(t,e.styleSheet.href):t}{let s=e.cssText;return("selectorText"in e&&e.selectorText.includes(":")&&(s=s.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t)?f(s,t):s}})(e,i)).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}}function f(e,t){if(!e)return"";let s=/^(?:[a-z+]+:)?\/\//i,i=/^www\..*/i,n=/^(data:)([^,]*),(.*)/i;return e.replace(/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,(e,r,a,o,h,l)=>{let c=a||h||l,u=r||o||"";if(!c)return e;if(s.test(c)||i.test(c)||n.test(c))return`url(${u}${c}${u})`;if("/"===c[0])return`url(${u}${(t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0]).split("?")[0]+c}${u})`;let d=t.split("/"),p=c.split("/");for(let e of(d.pop(),p))"."!==e&&(".."===e?d.pop():d.push(e));return`url(${u}${d.join("/")}${u})`})}e.href?fetch(e.href).then(e=>{if(!e.ok)throw Error(`response status ${e.status}`);return e.text()}).then(e=>{o&&h?h(e,ed++):d(e)}).catch(t=>{console.error(`OpenReplay: Failed to fetch CSS from ${e.href}:`,t),u()}):u()}(t,e,this.app.getBaseHref(),eg,(e,t,i,n)=>{this.generation===s&&this.app.send(j(e,t,i,n))},(e,t)=>{this.generation===s&&this.app.send([76,e,t])},this.inlinerOptions?.forceFetch,this.inlinerOptions?.forcePlain,(t,i)=>{this.generation===s&&(this.app.send([9,i,e,0]),this.app.send([61,i,t,this.app.getBaseHref()]))})},0);return}this.app.send([60,e,s,i,this.app.getBaseHref()]);return}("href"===s||i.length>1e5)&&(i=""),["alt","placeholder"].includes(s)&&this.app.sanitizer.privateMode&&(i=i.replaceAll(/./g,"*")),this.app.attributeSender.sendSetAttribute(e,s,i)}}sendNodeData(e,t,s){if(ei(t,"style")){this.app.send([61,e,s,this.app.getBaseHref()]);return}s=this.app.sanitizer.sanitize(e,s),this.app.send([14,e,s])}bindNode(e){let[t,s]=this.app.nodes.registerNode(e);Z(e)&&ei(e,"slot")&&this.app.nodes.attachNodeListener(e,"slotchange",()=>{e.assignedNodes({flatten:!0}).forEach(e=>{let t=this.app.nodes.getID(e);void 0!==t&&this.recents.set(t,n.Changed)})}),s?this.recents.set(t,n.New):this.recents.get(t)!==n.New&&this.recents.set(t,n.Removed)}bindTree(e){if(!eT(e))return;this.bindNode(e);let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>ek(e)||this.app.nodes.isBound(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1);for(;t.nextNode();)this.bindNode(t.currentNode)}unbindTree(e){let t=this.app.nodes.unregisterNode(e);if(void 0!==t&&this.slotMap.delete(t),void 0!==t&&this.recents.get(t)===n.Removed){this.app.send([11,t]);let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>ek(e)||void 0===this.app.nodes.getID(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),i=0,n=this.app.nodes.getNodeCount();for(;s.nextNode();)i+=1,this.app.nodes.unregisterNode(s.currentNode);let r=Math.floor(i/n*100);r>30&&this.app.send([115,r])}}_commitNode(e,t){let s;if(es(t))return!0;let i=t.assignedSlot,r=t.parentNode;if(!ei(t,"html")||!this.isTopContext){if(null===r||void 0===(s=this.app.nodes.getID(r))||!this.commitNode(s))return this.unbindTree(t),!1;if(this.app.sanitizer.handleNode(e,s,t),this.app.sanitizer.isHidden(s))return!1}let a=t.previousSibling;for(;null!==a;){let t=this.app.nodes.getID(a);if(void 0!==t){this.commitNode(t),this.indexes[e]=this.indexes[t]+1;break}a=a.previousSibling}null===a&&(this.indexes[e]=0);let o=this.recents.get(e),h=o===n.New,l=this.indexes[e];if(void 0===l)throw"commitNode: missing node index";if(h){if(Z(t)){let i=t;if(void 0!==s){if(this.app.sanitizer.isHidden(e)){let e=i.clientWidth,s=i.clientHeight;(i=t.cloneNode()).style.width=`${e}px`,i.style.height=`${s}px`}"rel"in i&&"stylesheet"===i.rel&&this.inlineRemoteCss?this.app.send([8,e,s,l,"STYLE",!1]):this.app.send([8,e,s,l,i.tagName,Y(t)])}for(let t=0;t<i.attributes.length;t++){let s=i.attributes[t];this.sendNodeAttribute(e,i,s.nodeName,s.value)}}else ee(t)&&(this.app.send([9,e,s,l]),this.throttling?this.throttledSetNodeData(e,r,t.data):this.sendNodeData(e,r,t.data));if(i){let t=this.app.nodes.getID(i);void 0!==t&&(this.slotMap.set(e,t),this.app.send([65,e,t]))}return!0}if(o===n.Removed&&void 0!==s){if(this.app.send([10,e,s,l]),i){let t=this.app.nodes.getID(i);void 0!==t&&this.slotMap.get(e)!==t&&(this.slotMap.set(e,t),this.app.send([65,e,t]))}else this.slotMap.has(e)&&(this.slotMap.delete(e),this.app.send([65,e,0]))}let c=this.attributesMap.get(e);if(void 0!==c){if(!Z(t))throw"commitNode: node is not an element";for(let s of c)this.sendNodeAttribute(e,t,s,t.getAttribute(s))}
9if(this.textSet.has(e)){if(!ee(t))throw"commitNode: node is not a text";this.throttling?this.throttledSetNodeData(e,r,t.data):this.sendNodeData(e,r,t.data)}return!0}commitNode(e){let t=this.app.nodes.getNode(e);if(!t)return!1;let s=this.commited[e];return void 0!==s?s:this.commited[e]=this._commitNode(e,t)}commitNodes(e=!1){let t;for(let[s,i]of this.recents.entries())this.commitNode(s),i===n.New&&(t=this.app.nodes.getNode(s))&&this.app.nodes.callNodeCallbacks(t,e);this.clear()}observeRoot(e,t,s=e){this.observer.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1}),this.bindTree(s),t(this.app.nodes.getID(e)),this.commitNodes(!0)}resanitizeSubtree(e){if(!eT(e))return;let t=e.parentNode,s=null!==t?this.app.nodes.getID(t):void 0,n=void 0!==s?this.app.sanitizer.getLevel(s):i.Plain;this.resanitizeNode(e,n)}resanitizeNode(e,t){if(ek(e))return;let s=this.app.nodes.getID(e);if(void 0===s)return;let n=this.app.sanitizer.computeLevel(e,t),r=this.app.sanitizer.getLevel(s),a=r===i.Hidden,o=n===i.Hidden;if(a!==o){this.recreateSubtree(e);return}if(!o){r!==n&&(this.app.sanitizer.setLevel(s,n),this.reemitNode(s,e));for(let t=e.firstChild;null!==t;t=t.nextSibling)this.resanitizeNode(t,n)}}recreateSubtree(e){let t=this.app.nodes.getID(e);void 0!==t&&(this.app.send([11,t]),this.clearSubtreeRegistration(e),this.bindTree(e),this.commitNodes())}clearSubtreeRegistration(e){let t=e=>{let t=this.app.nodes.getID(e);void 0!==t&&this.app.sanitizer.setLevel(t,i.Plain),this.app.nodes.unregisterNode(e)},s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>ek(e)||void 0===this.app.nodes.getID(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),n=[];for(;s.nextNode();)n.push(s.currentNode);t(e),n.forEach(t)}reemitNode(e,t){if(ee(t)){let s=t.parentNode;null!==s&&Z(s)&&this.sendNodeData(e,s,t.data);return}Z(t)&&this.app.callResanitizeCallbacks(t,e)}disconnect(){let e=this.observer.takeRecords();if(e.length){let t=[];for(let s of e)for(let e=0;e<s.addedNodes.length;e++){let i=s.addedNodes[e];i.tagName&&t.length<10&&t.push(i.tagName)}}this.observer.disconnect(),this.clear(),this.throttledSetNodeData.clear(),this.generation++}resetThrottledSetNodeData(){this.throttledSetNodeData.clear()}}class eE extends e_{observe(e){let t=e.contentDocument,s=this.app.nodes.getID(e);t&&void 0!==s&&this.observeRoot(t,e=>{if(void 0===e){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.docId=e,this.app.send([70,s,e])})}syntheticObserve(e,t){this.observeRoot(t,t=>{if(void 0===t){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.app.send([70,e,t])})}}class eO extends e_{observe(e){let t=e.shadowRoot,s=this.app.nodes.getID(e);t&&void 0!==s&&this.observeRoot(t,e=>{if(void 0===e){this.app.debug.error("OpenReplay: Shadow Root was not bound");return}this.app.send([70,s,e])})}}class eC{constructor(){this.states=new WeakMap}calcOffset(e){let t=0,s=0;if(e.parent&&([t,s]=this.calcOffset(e.parent)),!e.offset){let{left:t,top:s}=e.iFrame.getBoundingClientRect();e.offset=[t,s]}let[i,n]=e.offset;return[t+i,s+n]}getDocumentOffset(e){let t=this.states.get(e);return t?this.calcOffset(t):[0,0]}observe(e){let t=e.contentDocument;if(!t)return;let s=e.ownerDocument,i={offset:null,iFrame:e,parent:this.states.get(s)||null,clear:()=>{s.removeEventListener("scroll",n),s.defaultView?.removeEventListener("resize",n)}},n=()=>{i.offset=null};s.addEventListener("scroll",n),s.defaultView?.addEventListener("resize",n),this.states.set(t,i)}clear(){this.states=new WeakMap}}function eN(e,t){switch(e){case r.Inline:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!1,forcePlain:!1}};case r.InlineFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!1}};case r.PlainFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!0}};case r.Unset:if(/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/?/.test(window.location.href))return t("Enabling InlineCssMode.PlainFetched by default on localhost to preserve css styles, refer to https://docs.openreplay.com/en/troubleshooting/localhost/ for details, set InlineCssMode to 0 to skip this behavior"),{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!0}};return{inlineRemoteCss:!1,inlinerOptions:{forceFetch:!1,forcePlain:!1}};case r.Disabled:default:return{inlineRemoteCss:!1,inlinerOptions:{forceFetch:!1,forcePlain:!1}}}}!function(e){e[e.Unset=-1]="Unset",e[e.Disabled=0]="Disabled",e[e.Inline=1]="Inline",e[e.InlineFetched=2]="InlineFetched",e[e.PlainFetched=3]="PlainFetched"}(r||(r={}));let eM=g?Element.prototype.attachShadow:()=>new ShadowRoot;class eA extends e_{constructor(e){let t=Object.assign({captureIFrames:!0,disableSprites:!1,inl
9ineCss:0},e.options);super(e.app,!0,{disableSprites:t.disableSprites,disableThrottling:t.disableThrottling,...eN(t.inlineCss,console.warn)}),this.iframeOffsets=new eC,this.contextCallbacks=[],this.contextsSet=new WeakSet,this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.docObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.colorSchemeMQL=null,this.colorSchemeListener=null,this.app=e.app,this.options=t,this.app.nodes.attachNodeCallback(e=>{ei(e,"iframe")&&(this.options.captureIFrames&&!N(e,"obscured")||N(e,"capture"))&&this.handleIframe(e)}),this.app.nodes.attachNodeCallback(e=>{Z(e)&&null!==e.shadowRoot&&this.handleShadowRoot(e.shadowRoot)})}attachContextCallback(e){this.contextCallbacks.push(e)}getDocumentOffset(e){return this.iframeOffsets.getDocumentOffset(e)}handleIframe(e){let t=this.app.safe(()=>setTimeout(()=>{let t=this.app.nodes.getID(e);if(void 0===t||!function(e){try{return!!e.contentDocument}catch(e){return!1}}(e))return;let s=e.contentWindow,i=e.contentDocument;if(!i){this.app.debug.warn("no doc for iframe found",e);return}if(i&&this.docObservers.has(i)){this.app.debug.info("doc already observed for",t);return}let n=new eE(this.app,!1,{disableSprites:this.options.disableSprites,...eN(this.options.inlineCss,console.warn)});this.iframeObservers.set(e,n),this.docObservers.set(i,n),this.iframeObserversArr.push(n),n.observe(e),this.iframeOffsets.observe(e),s&&s===s.window&&!this.contextsSet.has(s)&&(this.contextsSet.add(s),this.contextCallbacks.forEach(e=>e(s)))},250));e.addEventListener("load",t),t()}handleShadowRoot(e){let t=new eO(this.app,!1,{disableSprites:this.options.disableSprites,...eN(this.options.inlineCss,console.warn)});this.shadowRootObservers.set(e,t),t.observe(e.host)}observe(){let e=this;Element.prototype.attachShadow=function(){let t=eM.apply(this,arguments);return e.handleShadowRoot(t),t},this.resetThrottledSetNodeData(),this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send([7]),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement),this.sendColorScheme(),this.app.send([12,0,"orloaded","true"]),g&&window.matchMedia&&(this.colorSchemeMQL=window.matchMedia("(prefers-color-scheme: dark)"),this.colorSchemeListener=this.app.safe(()=>this.sendColorScheme()),this.colorSchemeMQL.addEventListener?.("change",this.colorSchemeListener))}sendColorScheme(){if(!g)return;let e=getComputedStyle(document.documentElement).colorScheme;if(!e||"normal"===e){let t=document.querySelector('meta[name="color-scheme" i]'),s=t&&t.getAttribute("content");s&&(e=s)}let t="normal";if(e&&"normal"!==e){let s=!!window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;t=e.includes("dark")&&(s||!e.includes("light"))?"dark":"light"}this.app.send([12,0,"__openreplay_color_scheme",t])}crossdomainObserve(e,t,s){let i=this;Element.prototype.attachShadow=function(){let e=eM.apply(this,arguments);return i.handleShadowRoot(e),e},this.app.nodes.clear(),this.app.nodes.crossdomainMode(s,t);let n=new eE(this.app,!1,{disableSprites:this.options.disableSprites,...eN(this.options.inlineCss,console.warn)});this.iframeObservers.set(window.document,n),n.syntheticObserve(e,window.document)}disconnect(){this.colorSchemeMQL&&this.colorSchemeListener&&this.colorSchemeMQL.removeEventListener?.("change",this.colorSchemeListener),this.colorSchemeMQL=null,this.colorSchemeListener=null,this.iframeOffsets.clear(),Element.prototype.attachShadow=eM,this.iframeObserversArr.forEach(e=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}}class eD{constructor(e){this.metadata={},this.userID=null,this.callbacks=[],this.timestamp=0,this.getPageNumber=()=>{let e=this.app.sessionStorage.getItem(this.options.session_pageno_key);if(null!=e)return parseInt(e)},this.incPageNo=()=>{let e=this.getPageNumber();return void 0===e?e=0:e++,this.app.sessionStorage.setItem(this.options.session_pageno_key,e.toString()),e},this.getSessionToken=e=>{let t=this.token||this.app.sessionStorage.getItem(this.options.session_token_key);if(e&&t){let s=t.split("_$_")[1];if(!s||s!==e){this.app.sessionStorage.removeItem(this.options.session_token_key),this.token=void 0;return}}return(t?t.split("_$_")[0]:null)||void 0},this.getRawTokenWithProject=()=>this.token||this.app.sessionStorage.getItem(this.options.session_token_key),this.setSessionToken=(e,t)=>{this.token=`${e}_$_${t}`,this.app.sessionStorage.setItem(this.options.session_token_key,`${e}_$_${t}`)},this.app=e.app,this.options=e.options,this.createTabId()}attachUpdateCallback(e){this.callbacks.push(e)}handleUpdate(e){null==e.userID&&delete e.userID,null==e.sessionID&&delete e.sessionID,this.callbacks.forEach(t=>t(e))}assign(e){void 0!==e.userID&&(this.userID=e.userID),void 0!==e.metadata&&Object.entries(e.metadata).forEac
9h(([e,t])=>this.metadata[e]=t),void 0!==e.sessionID&&(this.sessionID=e.sessionID),void 0!==e.timestamp&&(this.timestamp=e.timestamp),void 0!==e.projectID&&(this.projectID=e.projectID),this.handleUpdate(e)}setMetadata(e,t){this.metadata[e]=t,this.handleUpdate({metadata:{[e]:t}})}setUserID(e){this.userID=e,this.handleUpdate({userID:e})}setUserInfo(e){this.userInfo=e}applySessionHash(e){let t=decodeURI(e).split("&"),s=e,i="100500";2==t.length&&([i,s]=t),i&&s&&(this.app.sessionStorage.setItem(this.options.session_token_key,s),this.app.sessionStorage.setItem(this.options.session_pageno_key,i))}getSessionHash(){let e=this.getPageNumber(),t=this.getRawTokenWithProject();if(void 0!==e&&void 0!==t)return encodeURI(String(e)+"&"+t)}getTabId(){return this.tabId||this.createTabId(),this.tabId}regenerateTabId(){let e=function(e){let t=new Uint8Array(6),s=window.crypto||window.msCrypto;return s?(s.getRandomValues(t),Array.from(t,A).join("")):Array.from({length:12},()=>A(Math.floor(16*Math.random()))).join("")}(0);this.app.sessionStorage.setItem(this.options.session_tabid_key,e),this.tabId=e}createTabId(){let e=this.app.sessionStorage.getItem(this.options.session_tabid_key);e?this.tabId=e:this.regenerateTabId()}getInfo(){return{sessionID:this.sessionID,metadata:this.metadata,userID:this.userID,timestamp:this.timestamp,projectID:this.projectID}}reset(){this.app.sessionStorage.removeItem(this.options.session_token_key),this.metadata={},this.userID=null,this.sessionID=void 0,this.timestamp=0}}class eL{constructor(e){this.app=e,this.timer=null,this.callbacks=[]}attach(e,t=0,s=!0,i){var n;let r;i&&(e=e.bind(i)),s&&(e=this.app.safe(e)),this.callbacks.unshift(t?(n=e,r=0,()=>{r++>=t&&(r=0,n())}):e)}start(){null===this.timer&&(this.timer=setInterval(()=>this.callbacks.forEach(e=>{e&&e()}),30))}stop(){null!==this.timer&&(clearInterval(this.timer),this.timer=null)}}let ex="canceled",eR="or_buffer_1",eP=e=>({reason:e,success:!1}),eB=e=>({...e,success:!0});function eU(){let e=-1*new Date().getTimezoneOffset();return`UTC${e>=0?"+":"-"}${String(Math.floor(Math.abs(e)/60)).padStart(2,"0")}:${String(Math.abs(e)%60).padStart(2,"0")}`}!function(e){e[e.NotActive=0]="NotActive",e[e.Starting=1]="Starting",e[e.Active=2]="Active",e[e.ColdStart=3]="ColdStart"}(a||(a={}));let e$=e=>new Promise(t=>setTimeout(t,e)),ej={ask:"never-gonna-give-you-up",resp:"never-gonna-let-you-down",reg:"never-gonna-run-around-and-desert-you",iframeSignal:"tracker inside a child iframe",iframeId:"getting node id for child iframe",iframeBatch:"batch of messages from an iframe window",parentAlive:"signal that parent is live",killIframe:"stop tracker inside frame",startIframe:"start tracker inside frame",iframeDebug:"iframe debug snapshot",polling:"hello-how-are-you-im-under-the-water-please-help-me",reset:"reset-your-session-please"},ez=Object.fromEntries(Object.entries(ej).map(([e,t])=>[t,e]));class eH{get tagMatcher(){return this.tagWatcher.matcher}constructor(e,t,s,i,n){this.signalError=i,this.insideIframe=n,this.resanitizeCallbacks=[],this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=a.NotActive,this.version="18.1.3",this.socketMode=!1,this.compressionThreshold=24e3,this.bc=null,this.canvasRecorder=null,this.conditionsManager=null,this.canStart=!1,this.rootId=null,this.pageFrames=[],this.frameOderNumber=0,this.frameLevel=0,this.emptyBatchCounter=0,this.lastHiddenAt=null,this.parentActive=!1,this.checkStatus=()=>this.parentActive,this.lastTokenReceived=null,this.lastParentMsgAt=0,this.lastSentToParentAt=0,this.iframeDebugInterval=null,this.emitIframeDebug=()=>{let e;if(!this.insideIframe||!this.options.crossdomain?.enabled)return;let t=Date.now(),s=e=>e?t-e:null,i=JSON.stringify({ctx:this.contextId,active:this.active(),state:a[this.activityState],parentActive:this.parentActive,rootId:this.rootId,frameOrder:this.frameOderNumber,token:this.lastTokenReceived?{tok:this.lastTokenReceived.tok,agoMs:t-this.lastTokenReceived.at}:null,lastParentMsgAgoMs:s(this.lastParentMsgAt),lastSentToParentAgoMs:s(this.lastSentToParentAt)});try{e=btoa(i)}catch{e=i}try{window.parent.postMessage({line:ej.iframeDebug,context:this.contextId,debug:e},this.options.crossdomain?.parentDomain??"*"),this.markSentToParent()}catch(e){this.debug.error("iframe debug post failed",e)}},this.parentCrossDomainFrameListener=e=>{let{data:t}=e;if(t&&e.source!==window){if((t.line===ej.startIframe||t.line===ej.parentAlive||t.line===ej.iframeId||t.line===ej.killIframe)&&(this.lastParentMsgAt=Date.now()),t.line===ej.startIframe){if(this.activityState===a.Starting)return;try{this.active()&&this.stop(),t.token&&(this.session.setSessionToken(t.token,this.projectKey),this.lastTokenReceived={tok:String(t.token).slice(-8),at:Date.now()}),void 0!==t.id&&(this.rootId=t.id),this.allowAppStart(),this.start()}catch(e){console.error("children frame restart failed:",e)}}t.line===ej.parentAlive&&(this.parentActive=!0),t.line===ej.iframeId&&(this.parentActive=!0,this.rootId=t.id,this.session.setSessionToken(t.token,this.projectKey),this.lastTokenReceived={tok:String(t.token).slice(-8),at:Date.now()},this.frameOderNumber=t.frameOrderNumber,this.frameLevel=t.frameLevel,this.debug.log("starting iframe tracking",t),this.allowAppStart()),t.line===ej.killIframe&&this.active()&&this.stop()}},this.trackedFrames=[],this.everTrackedFrames=new Set,this.frameLastSeen=new Map,this.frameOrigin=new Map,this.frameAnyLastSeen=new Map,this.frameBatchLastSeen=new Map,this.frameLastSent=new Map,this.xdomainDebugInterval=null,this.reAdoptCooldown=new Map,this.RE_ADOPT_COOLDOWN_MS=2e3,this.frameAlloc=new Map,this.usedOrdersByLevel=new Map,this.FRAME_STALE_MS=1500,this.XDOMAIN_DEBUG_RETENTION_MS=6e5,this.emitCrossdomainDebug=()=>{let e;if(this.insideIframe||!this.options.crossdomain?.enabled||!this.active())return;let t=Date.now(),s=e=>void 0===e?null:t-e,i=new Set(this.trackedFrames),n=new Set([...this.trackedFrames,...this.frameAnyLastSeen.keys(),...this.frameLastSent.keys()]),r=Array.from(n).map((e,n)=>{let r=this.frameLastSent.get(e),a=this.frameAlloc.get(e);return{n:a?a.order:n+1,level:a?a.level:null,id:this.frameOrigin.get(e)||e||`#${n+1}`,tracked:i.has(e),lastAnyMsgAgoMs:s(this.frameAnyLastSeen.get(e)),lastBatchAgoMs:s(this.frameBatchLastSeen.get(e)),lastSent:r?{line:r.line,agoMs:t-r.t}:null}}
9),a=t-this.XDOMAIN_DEBUG_RETENTION_MS;for(let e of n)!i.has(e)&&Math.max(this.frameAnyLastSeen.get(e)??0,this.frameLastSent.get(e)?.t??0)<a&&(this.frameOrigin.delete(e),this.frameAnyLastSeen.delete(e),this.frameBatchLastSeen.delete(e),this.frameLastSent.delete(e),this.reAdoptCooldown.delete(e),this.everTrackedFrames.delete(e),this.freeFrameOrder(e));let o=JSON.stringify({t:t,count:r.length,frames:r});try{e=btoa(o)}catch{e=o}this.send([22,"info",`[OR_XDOMAIN_DEBUG] ${e}`])},this.crossDomainIframeListener=e=>{if(e.source===window)return;let{data:t}=e;if(t&&(t.context&&(this.frameAnyLastSeen.set(t.context,Date.now()),e.origin&&!this.frameOrigin.has(t.context)&&this.frameOrigin.set(t.context,e.origin)),(t.line===ej.polling||t.line===ej.iframeSignal)&&t.context&&this.frameLastSeen.set(t.context,Date.now()),this.active())){if(t.line===ej.iframeDebug){this.send([22,"info",`[OR_XDOMAIN_IFRAME_DEBUG] ${t.debug}`]);return}if(t.line===ej.iframeSignal&&(e.source?.postMessage({ping:!0,line:ej.parentAlive},"*"),this.recordSentToFrame(t.context,ej.parentAlive),(async()=>{if(null===e.source)return console.error("Couldnt connect to event.source for child iframe tracking");let s=await this.checkNodeId(e.source);if(!s){this.debug.log("Couldnt get node id for iframe",e.source);return}try{this.trackedFrames.includes(t.context)?this.debug.log("Trying to observe already added iframe; ignore if its a restart"):this.trackedFrames.push(t.context),this.everTrackedFrames.add(t.context),await this.waitStarted();let i=this.session.getSessionToken(this.projectKey),n=this.frameLevel+1,r=this.allocateFrameOrder(t.context,n),a={line:ej.iframeId,id:s,token:i,frameOrderNumber:r,frameLevel:n};this.debug.log("Got child frame signal; nodeId",s,e.source,a),e.source?.postMessage(a,"*"),this.recordSentToFrame(t.context,ej.iframeId)}catch(e){console.error(e)}})()),t.line===ej.iframeBatch){t.context&&this.frameBatchLastSeen.set(t.context,Date.now());let s=t.messages,i=[];s.forEach(t=>{if(20===t[0]){let s=t;this.pageFrames.forEach(i=>{if(i.contentWindow===e.source){let[e,n,r]=t,{left:a,top:o}=i.getBoundingClientRect();s=[e,n+a,r+o]}}),i.push(s)}if(68===t[0]){let s=t;this.pageFrames.forEach(i=>{if(i.contentWindow===e.source){let[e,n,r,a,o,h,l]=t,{left:c,top:u,width:d,height:p}=i.getBoundingClientRect();s=[e,n,r,a,o,Math.round((h/100*d+c)/document.documentElement.scrollWidth*1e3)/10,Math.round((l/100*p+u)/document.documentElement.scrollHeight*1e3)/10]}}),i.push(s)}[28,29,30].includes(t[0])||i.push(t)}),this.messages.push(...i)}if(t.line===ej.polling){if(t.context&&this.everTrackedFrames.has(t.context)&&!this.trackedFrames.includes(t.context)){this.reAdoptOrphanFrame(e,t.context);return}if(!this.pollingQueue.order.length)return;this.pruneStaleFrames();let s=new Set(this.trackedFrames);for(;this.pollingQueue.order.length>0;){let e=this.pollingQueue.order[0];if(this.pollingQueue[e]=this.pollingQueue[e].filter(e=>s.has(e)),0===this.pollingQueue[e].length)delete this.pollingQueue[e],this.pollingQueue.order.shift();else break}if(!this.pollingQueue.order.length)return;let i=this.pollingQueue.order[0];if(this.pollingQueue[i].includes(t.context)){this.pollingQueue[i]=this.pollingQueue[i].filter(e=>e!==t.context);let s={line:i};if(i===ej.startIframe){s.token=this.session.getSessionToken(this.projectKey);let t=this.pageFrames.find(t=>t.contentWindow===e.source)||Array.from(document.querySelectorAll("iframe")).find(t=>t.contentWindow===e.source);if(t){let e=t[this.options.node_id];void 0!==e&&(s.id=e)}}e.source?.postMessage(s,"*"),this.recordSentToFrame(t.context,i),0===this.pollingQueue[i].length&&(delete this.pollingQueue[i],this.pollingQueue.order.shift())}}}},this.pollingQueue={order:[]},this.addCommand=e=>{if(this.pruneStaleFrames(),this.pollingQueue[e]){this.pollingQueue[e]=Array.from(new Set([...this.pollingQueue[e],...this.trackedFrames]));return}this.pollingQueue.order.push(e),this.pollingQueue[e]=[...this.trackedFrames]},this.bootChildrenFrames=async()=>{await this.waitStarted(),this.addCommand(ej.startIframe)},this.killChildrenFrames=()=>{this.addCommand(ej.killIframe)},this.signalIframeTracker=()=>{let e=this.session.getTabId();window.parent.postMessage({line:ej.iframeSignal,source:e,context:this.contextId},this.options.crossdomain?.parentDomain??"*"),this.markSentToParent();let t=0,s=250,i=0,n=!1,r=()=>{if(n||this.checkStatus()){n=!0;return}window.parent.postMessage({line:ej.iframeSignal,source:e,context:this.contextId},this.options.crossdomain?.parentDomain??"*"),this.markSentToParent(),this.debug.info("Trying to signal to parent, attempt:",t+1),t++};for(let e=0;e<10;e++){if(this.checkStatus()){n=!0;break}setTimeout(()=>{r()},i+=s),s*=1.5}},this.startTimeout=null,this.restart=(e=!1)=>{this.stop(!1),this.waitStatus(a.NotActive).then(()=>{this.allowAppStart();let t=e?{...this.prevOpts,forceNew:!0}:this.prevOpts;this.start(t,!0).then(t=>{e&&(this.prevOpts={...this.prevOpts,forceNew:!1}),this.debug.info("Session restart",t)}).catch(e=>{this.debug.error("Session restart failed",e)})})},this.handlePageShow=e=>{if(e&&e.persisted&&this.activityState!==a.NotActive)try{let e=null!=this.lastHiddenAt?Date.now()-this.lastHiddenAt:null;this.lastHiddenAt=null;let t=this.options.bfcacheRestartThreshold??18e5;null===e||e>=t?(this.debug.info("OpenReplay: restarting session after bfcache restore",{frozenMs:e}),this.restart(!0)):this.debug.info("OpenReplay: resuming session after bfcache restore",{frozenMs:e})}catch(e){this._debug("bfcache_restore",e)}},this.send=(e,t=!1)=>{this.activityState!==a.NotActive&&(this.activityState===a.ColdStart?(this.bufferedMessages1.push(e),this.singleBuffer||this.bufferedMessages2.push(e),this.conditionsManager?.processMessage(e)):this.messages.push(e),this.activityState===a.Active&&t&&this.commit())},this.coldStartCommitN=0,this.delay=0,this.attachStartCallback=(e,t=!1)=>{t&&(e=this.safe(e)),this.startCallbacks.push(e)},this.attachStopCallback=(e,t=!1)=>{t&&(e=this.safe(e)),this.stopCallbacks.push(e)},this.attachEventListener=(e,t,s,i=!0,n=!0)=>
9{i&&(s=this.safe(s)),this.attachStartCallback(()=>e?R(e,t,s,n,this.options.forceNgOff):null,i),this.attachStopCallback(()=>e?P(e,t,s,n,this.options.forceNgOff):null,i)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{this.canvasRecorder?.restartTracking()},this.attachResanitizeCallback=e=>{this.resanitizeCallbacks.push(e)},this.callResanitizeCallbacks=(e,t)=>{this.resanitizeCallbacks.forEach(s=>s(e,t))},this.resanitize=e=>{let t=e??(g?document.documentElement:void 0);t&&this.observer.resanitizeSubtree(t)},this.checkSanitization=e=>{let t=this.nodes.getID(e);if(void 0!==t)return this.sanitizer.getLevel(t)},this.flushBuffer=async e=>new Promise((t,s)=>{if(0===e.length){t(null);return}let i=1;for(;i<e.length&&0!==e[i][0];)i++;$(()=>{try{let s=e.splice(0,i);this.postToWorker(s.map(e=>[...e])),t(null)}catch(e){this._debug("flushBuffer",e),s(Error("flushBuffer failed"))}})}),this.contextId=Math.random().toString(36).slice(2),this.projectKey=e,this.networkOptions=s.network;let o={revID:"",node_id:"__openreplay_id",session_token_key:"__openreplay_token",session_pageno_key:"__openreplay_pageno",session_reset_key:"__openreplay_reset",session_tabid_key:"__openreplay_tabid",local_uuid_key:"__openreplay_uuid",ingestPoint:"https://api.openreplay.com/ingest",resourceBaseHref:null,__is_snippet:!1,__debug_report_edp:null,__debug__:eo.Silent,__local_debug:!1,localStorage:null,sessionStorage:null,forceSingleTab:!1,bfcacheRestartThreshold:18e5,assistSocketHost:"",captureIFrames:!0,obscureTextEmails:!1,obscureTextNumbers:!1,disableStringDict:!1,crossdomain:{parentDomain:"*"},canvas:{disableCanvas:!1,fixedCanvasScaling:!1,__save_canvas_locally:!1,useAnimationFrame:!1},forceNgOff:!1,inlineCss:r.Unset,disableSprites:!1,disableThrottling:!1};if(this.options=function e(t,s){let i={...t};for(let n in s)if(s.hasOwnProperty(n)){let r=s[n],a=t[n];"object"!=typeof r||Array.isArray(r)||null===r?i[n]=r:i[n]=e(a||{},r)}return i}(o,s),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&"BroadcastChannel"in globalThis){let e=location.hostname.split(".").slice(-2).join("_");this.bc=new BroadcastChannel(`rick_${e}`)}else this.options.forceSingleTab&&this.allowAppStart();this.revID=this.options.revID,this.localStorage=this.options.localStorage??window.localStorage,this.sessionStorage=this.options.sessionStorage??window.sessionStorage,this.sanitizer=new eb({app:this,options:s}),this.nodes=new eu({node_id:this.options.node_id,forceNgOff:!!s.forceNgOff,maintainer:this.options.nodes?.maintainer}),this.observer=new eA({app:this,options:s}),this.ticker=new eL(this),this.ticker.attach(()=>this.commit()),this.debug=new eh(this.options.__debug__),this.session=new eD({app:this,options:this.options}),this.attributeSender=new c({app:this,isDictDisabled:!!(this.options.disableStringDict||this.options.crossdomain?.enabled)}),this.tagWatcher=new Q({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:e=>this.send([120,e])}),this.session.attachUpdateCallback(({userID:e,metadata:t})=>{if(null!=e){if(!e||"string"!=typeof e||0===e.trim().length){this.debug.warn("Invalid userID (must be type string), ignoring.");return}this.send([28,e])}null!=t&&Object.entries(t).forEach(([e,t])=>this.send([30,e,t]))}),null!=t&&this.session.applySessionHash(t);let h=this.session.getTabId();this.insideIframe?(window.addEventListener("message",this.parentCrossDomainFrameListener),window.addEventListener("message",this.crossDomainIframeListener),setInterval(()=>{window.parent.postMessage({line:ej.polling,context:this.contextId},s.crossdomain?.parentDomain??"*"),this.markSentToParent()},250),this.iframeDebugInterval&&clearInterval(this.iframeDebugInterval),this.iframeDebugInterval=setInterval(this.emitIframeDebug,6e4)):(this.initWorker(),window.addEventListener("message",this.crossDomainIframeListener),this.options.crossdomain?.enabled&&(this.xdomainDebugInterval&&clearInterval(this.xdomainDebugInterval),this.xdomainDebugInterval=setInterval(this.emitCrossdomainDebug,6e4))),null!==this.bc&&(this.bc.postMessage({line:ej.ask,source:h,context:this.contextId,projectKey:this.projectKey}),this.startTimeout=setTimeout(()=>{this.allowAppStart()},250),this.bc.onmessage=e=>{if(e.data.context===this.contextId||this.projectKey!==e.data.projectKey){this.debug.log("same ctx event",e);return}if(this.debug.log(e),e.data.line===ej.resp){let t=e.data.token;this.session.setSessionToken(t,this.projectKey),this.adoptSessionVersion(e.data.version),this.allowAppStart()}if(e.data.line===ej.reg){let t=e.data.token;this.session.regenerateTabId(),this.session.setSessionToken(t,this.projectKey),this.adoptSessionVersion(e.data.version),this.allowAppStart()}if(e.data.line===ej.ask){let t=this.session.getSessionToken(this.projectKey);t&&this.bc&&this.bc.postMessage({line:e.data.source===h?ej.reg:ej.resp,token:t,version:this.getSessionVersionHash(),source:h,context:this.contextId,projectKey:this.projectKey})}if(e.data.line===ej.reset){let t=e.data.token;this.debug.log("Received reset signal from another tab"),this.session.setSessionToken(t,this.projectKey),this.restart()}})}markSentToParent(){this.lastSentToParentAt=Date.now()}allocateFrameOrder(e,t){let s=this.frameAlloc.get(e);if(void 0!==s)return s.order;let i=this.usedOrdersByLevel.get(t);i||(i=new Set,this.usedOrdersByLevel.set(t,i));let n=-1;for(let e=1;e<=127;e++)if(!i.has(e)){n=e;break}if(-1===n){let s=null,i=1/0,r=new Set(this.trackedFrames);this.frameAlloc.forEach((e,n)=>{if(e.level!==t||r.has(n))return;
9let a=this.frameAnyLastSeen.get(n)??0;a<i&&(i=a,s=n)}),null!==s?(n=this.frameAlloc.get(s).order,this.frameAlloc.delete(s),this.debug.error("OR: frame order space exhausted, evicting",s,"for",e)):(n=127,this.debug.error("OR: frame order overflow, reusing max order for",e))}return i.add(n),this.frameAlloc.set(e,{order:n,level:t}),n}freeFrameOrder(e){let t=this.frameAlloc.get(e);t&&(this.frameAlloc.delete(e),this.usedOrdersByLevel.get(t.level)?.delete(t.order))}pruneStaleFrames(){let e=Date.now()-this.FRAME_STALE_MS;this.trackedFrames=this.trackedFrames.filter(t=>{let s=this.frameLastSeen.get(t);return void 0!==s&&s>=e||(this.frameLastSeen.delete(t),!1)})}recordSentToFrame(e,t){e&&this.frameLastSent.set(e,{line:ez[t]??t,t:Date.now()})}reAdoptOrphanFrame(e,t){let s=Date.now();if(s-(this.reAdoptCooldown.get(t)??0)<this.RE_ADOPT_COOLDOWN_MS)return;this.reAdoptCooldown.set(t,s);let i={line:ej.startIframe,token:this.session.getSessionToken(this.projectKey)},n=this.pageFrames.find(t=>t.contentWindow===e.source)||Array.from(document.querySelectorAll("iframe")).find(t=>t.contentWindow===e.source);if(n){let e=n[this.options.node_id];void 0!==e&&(i.id=e)}e.source?.postMessage(i,"*"),this.recordSentToFrame(t,ej.startIframe),this.debug.log("Re-adopting orphaned crossdomain iframe",t)}allowAppStart(){this.canStart=!0,this.startTimeout&&(clearTimeout(this.startTimeout),this.startTimeout=null)}async checkNodeId(e){let t;if(this.pageFrames.length>0&&(t=this.pageFrames.find(t=>t.contentWindow===e)),!t||!this.pageFrames.length){let s=Array.from(document.querySelectorAll("iframe"));this.pageFrames=s,t=s.find(t=>t.contentWindow===e)}if(!t)return null;let s=0;for(;s<100;){let e=t[this.options.node_id];if(void 0!==e)return s=100,e;s++,await e$(100)}return null}initWorker(){try{this.worker=new Worker(URL.createObjectURL(new Blob(['!function(){"use strict";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.inflightKeepaliveBytes=0,this.ingestURL=t+"/v1/web/i",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t,s="player",i){if(this.busy||!this.token)this.queue.push({batch:t,dataType:s,split:i});else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t,s,i);else{const e=++this.lastBatchNum;this.sendBatch(t,!1,e,s,i)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t.batch,t.dataType,t.split);else{const s=++this.lastBatchNum;this.sendBatch(t.batch,!1,s,t.dataType,t.split)}else this.busy=!1}retry(t,s,i,e="player",n){if(this.attemptsCount>=this.MAX_ATTEMPTS_COUNT)return void this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`);this.attemptsCount++;const h=new Uint8Array(t);setTimeout((()=>this.sendBatch(h,s,i,e,n)),this.ATTEMPT_TIMEOUT*this.attemptsCount)}sendBatch(t,s,i,e="player",n){var h,r,a;if(0===t.length)return console.error("OpenReplay: refusing to send 0-byte batch.",{batchNum:i,dataType:e,isCompressed:s,batch:t}),this.attemptsCount=0,void this.sendNext();const u=(null!==(h=null==i?void 0:i.toString())&&void 0!==h?h:"0").match(/^([^_]+)(?:_([^_]+))?/),o=null!==(r=null==u?void 0:u[1])&&void 0!==r?r:"0",l=(null==u?void 0:u[2])?u[2]:"";this.busy=!0;const c={Authorization:`Bearer ${this.token}`,DataType:e};if(s&&(c["Content-Encoding"]="gzip"),null===this.token)return void setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:"noBatchNum"}_newToken`,e,n)}),500);const d=t.length<65536&&this.inflightKeepaliveBytes+t.length<=65536;d&&(this.inflightKeepaliveBytes+=t.length);const p=()=>{d&&(this.inflightKeepaliveBytes-=t.length)},f=t.byteLength;let g=this.ingestURL;g+=`?batch=${null!==(a=this.pageNo)&&void 0!==a?a:0}`,g+=`_${o}`,g+=`_${f}`,g+="_"+(d?"kyes":"kno"),l&&(g+=`_${l}`),void 0!==n&&(g+=`&split=${n}`),fetch(g,{body:t,method:"POST",headers:c,keepalive:d}).then((h=>{var r;if(p(),null===(r=h.body)||void 0===r||r.cancel().catch((()=>{})),401===h.status)return this.busy=!1,void this.onUnauthorised();h.status>=400?this.retry(t,s,`${null!=i?i:"noBatchNum"}_network:${h.status}`,e,n):(this.attemptsCount=0,this.sendNext())})).catch((h=>{p(),console.warn("OpenReplay:",h),this.retry(t,s,`${null!=i?i:"noBatchNum"}_reject:${h.message}`,e,n)}))}sendCompressed(t,s="player",i){const e=++this.lastBatchNum;this.sendBatch(t,!0,e,s,i)}sendUncompressed(t,s="player",i){const e=++this.lastBatchNum;this.sendBatch(t,!1,e,s,i)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s=new Set([60,61,71,73]),i=new Set([21,22,40,41,44,45,46,47,48,79,83,84,85,87,89,116,120,121,123]),e=new Set([17,23,24,27,28,29,30,42,63,64,78,112,115,124]),n="function"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}
9if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class h{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}getCurrentCheckpoint(){return this.checkpointOffset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const s=n.encode(t),i=s.byteLength;return!(!this.uint(i)||this.offset+i>this.size)&&(this.data.set(s,this.offset),this.offset+=i,!0)}reset(){this.offset=0,this.checkpointOffset=0}rewind(t,s){t>this.offset||s>this.checkpointOffset||(this.offset=t,this.checkpointOffset=s)}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class r extends h{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 65:case 70:case 75:case 76:case 77:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 36:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 85:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10])&&this.uint(t[11])&&this.uint(t[12])&&this.uint(t[13])&&this.uint(t[14])&&this.uint(t[15])&&this.uint(t[16])&&this.uint(t[17]);case 87:return this.string(t[1])&&this.int(t[2])&&this.int(t[3]);case 89:return this.string(t[1])&&this.int(t[2])&&this.int(t[3])&&this.int(t[4])&&this.int(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class a{constructor(t,s,i){this.bufferSize=t,this.version=s,this.dataType=i,this.sizeBuffer=new Uint8Array(3),this.snap=null,this.hasNonTimestamp=!1,this.lastPushedTs=0,this.encoder=new r(t)}push(t,s){const i=this.encoder,e=null===this.snap,n=i.getCurrentOffset(),h=i.getCurrentCheckpoint();if(e){const t={pageNo:s.pageNo,firstIndex:s.index,timestamp:s.timestamp,url:s.url,tabId:s.tabId};if(!this.writeHeader(t))return i.rewind(n,h),!1;this.snap=t,this.lastPushedTs=s.timestamp}return 0===t[0]||s.timestamp===this.lastPushedTs||this.writeMessageWithSize([0,s.timestamp])?this.writeMessageWithSize(t)?(this.lastPushedTs=s.timestamp,0!==t[0]&&(this.hasNonTimestamp=!0),!0):(i.rewind(n,h),e&&(this.snap=null),!1):(i.rewind(n,h),!1)}hasContent(){return null!==this.snap&&this.hasNonTimestamp}size(){return null===this.snap?0:this.encoder.getCurrentOffset()}flush(){if(!this.hasContent())return this.reset(),null;const t=this.encoder.flush();return this.snap=null,this.hasNonTimestamp=!1,this.lastPushedTs=0,t}reset(){this.encoder.reset(),this.snap=null,this.hasNonTimestamp=!1,this.lastPushedTs=0}writeHeader(t){const s=this.encoder,i=[81,this.version,t.pageNo,t.firstIndex,t.timestamp,t.url];return!!s.uint(i[0])&&(!!s.encode(i)&&(!(s.getCurrentOffset()>this.bufferSize)&&(s.checkpoint(),!!this.writeMessageWithSize([0,t.timestamp])&&!!this.writeMessageWithSize([118,t.tabId])
9)))}writeMessageWithSize(t){const s=this.encoder;if(!s.uint(t[0])||!s.skip(3))return!1;const i=s.getCurrentOffset();if(!s.encode(t))return!1;const e=s.getCurrentOffset(),n=e-i;return n>16777215?(console.warn("OpenReplay: max message size overflow."),!1):!(e>this.bufferSize)&&(this.writeSizeAt(n,i-3),s.checkpoint(),!0)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}}class u{constructor(t,s,i,e,n,h,r=!1,u){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=e,this.tabId=n,this.onOfflineEnd=h,this.localDebug=r,this.onLocalSave=u,this.nextIndex=0,this.beaconSize=2e5,this.beaconSizeLimit=1e6,this.protocolVersion=1,this.visualSent=!1,this.signalSeen=!1,this.heldOther=[],this.playerBuilder=new a(this.beaconSize,this.playerVersion(),"player"),this.assetBuilder=new a(this.beaconSize,3,"assets"),this.devtoolsBuilder=new a(this.beaconSize,4,"devtools"),this.analyticsBuilder=new a(this.beaconSize,5,"analytics")}initActive(){return 2===this.protocolVersion&&!this.visualSent}playerVersion(){return 2===this.protocolVersion?2:1}currentCtx(){return{pageNo:this.pageNo,index:this.nextIndex,timestamp:this.timestamp,url:this.url,tabId:this.tabId}}setBeaconSizeLimit(t){this.beaconSizeLimit=t}setProtocolVersion(t){if(this.protocolVersion!==t){if(this.protocolVersion=t,2===t&&!this.signalSeen)return this.playerBuilder.reset(),this.assetBuilder.reset(),this.playerBuilder=new a(this.beaconSizeLimit,this.playerVersion(),"player"),void(this.assetBuilder=new a(this.beaconSizeLimit,3,"assets"));2===t&&(this.visualSent=!0),this.playerBuilder.reset(),this.playerBuilder=new a(this.beaconSize,this.playerVersion(),"player")}}writeMessage(t){if(-1===t[0])return this.finaliseBatch(),this.onOfflineEnd();if(12===t[0]&&"orloaded"===t[2])return void(this.initActive()?this.finalizeVisual():this.signalSeen=!0);0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]);const s=this.routeMessage(t);this.pushTo(s,t)}routeMessage(t){if(2===this.protocolVersion){const n=t[0];if(s.has(n))return this.assetBuilder;if(i.has(n))return this.devtoolsBuilder;if(e.has(n))return this.analyticsBuilder}return this.playerBuilder}pushTo(t,s){const i=this.currentCtx();if(this.initActive())return void this.pushDuringInit(t,s,i);if(t.push(s,i))return void this.nextIndex++;if(t===this.assetBuilder&&this.flushBuilder(this.playerBuilder),this.flushBuilder(t),t.push(s,i))return void this.nextIndex++;const e=new a(this.beaconSizeLimit,t.version,t.dataType);if(!e.push(s,i))return void console.warn("OpenReplay: beacon size overflow. Skipping large message.",s);this.nextIndex++;const n=e.flush();n&&(t===this.assetBuilder&&this.flushBuilder(this.playerBuilder),this.emitBatch(n,t.dataType,!1))}pushDuringInit(t,s,i){const e=t===this.playerBuilder||t===this.assetBuilder;if(t.push(s,i))return this.nextIndex++,void(e&&this.playerBuilder.size()+this.assetBuilder.size()>=this.beaconSizeLimit&&this.finalizeVisual());if(e)return this.finalizeVisual(),void this.pushTo(this.routeMessage(s),s);if(this.flushBuilderToHeld(t),t.push(s,i))return void this.nextIndex++;const n=new a(this.beaconSizeLimit,t.version,t.dataType);if(!n.push(s,i))return void console.warn("OpenReplay: beacon size overflow. Skipping large message.",s);this.nextIndex++;const h=n.flush();h&&this.heldOther.push({batch:h,dataType:t.dataType})}flushBuilderToHeld(t){const s=t.flush();s&&this.heldOther.push({batch:s,dataType:t.dataType})}finalizeVisual(t=!1){const s=this.playerBuilder.flush(),i=this.assetBuilder.flush();if(this.visualSent=!0,this.playerBuilder=new a(this.beaconSize,this.playerVersion(),"player"),this.assetBuilder=new a(this.beaconSize,3,"assets"),s&&i){const e=new Uint8Array(s.length+i.length);e.set(s,0),e.set(i,s.length),this.emitBatch(e,"visual",t,s.length)}else s?this.emitBatch(s,"player",t):i&&this.emitBatch(i,"assets",t);for(const s of this.heldOther)this.emitBatch(s.batch,s.dataType,t);this.heldOther.length=0,this.flushBuilder(this.devtoolsBuilder,t),this.flushBuilder(this.analyticsBuilder,t)}flushBuilder(t,s=!1){const i=t.flush();return!!i&&(this.emitBatch(i,t.dataType,s),!0)}emitBatch(t,s,i,e){this.localDebug&&this.onLocalSave&&this.onLocalSave(`${s}-${Date.now()}`,t.slice()),this.onBatch(t,i,s,e)}finaliseBatch(t=!1){this.initActive()?this.finalizeVisual(t):(this.flushBuilder(this.playerBuilder,t),this.flushBuilder(this.assetBuilder,t),this.flushBuilder(this.devtoolsBuilder,t),this.flushBuilder(this.analyticsBuilder,t))}clean(){this.playerBuilder.reset(),this.assetBuilder.reset(),this.devtoolsBuilder.reset(),this.analyticsBuilder.reset(),this.heldOther.length=0,this.visualSent=!1,this.signalSeen=!1}}var o;
9!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active",t[t.Stopped=4]="Stopped"}(o||(o={}));let l=null,c=null,d=o.NotActive;function p(t){c&&c.finaliseBatch(t)}function f(){return new Promise((t=>{d=o.Stopping,null!==y&&(clearInterval(y),y=null),c&&(c.clean(),c=null),l&&(l.clean(),setTimeout((()=>{l=null}),20)),setTimeout((()=>{d=o.NotActive,t(null)}),100)}))}function g(){[o.Stopped,o.Stopping].includes(d)||(postMessage("a_stop"),f().then((()=>{postMessage("a_start")})))}let m,y=null;self.onmessage=({data:s})=>{var i;if("stop"===s)return p(),void f().then((()=>{d=o.Stopped}));if("forceFlushBatch"!==s)if("closing"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!l)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void g();s.batch&&l.sendCompressed(s.batch,s.dataType,s.split)}if("uncompressed"===s.type){if(!l)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void g();s.batch&&l.sendUncompressed(s.batch,s.dataType,s.split)}return"start"===s.type?(d=o.Starting,l=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),f()}(t)}),s.connAttemptCount,s.connAttemptGap,((t,s,i)=>{postMessage({type:"compress",batch:t,dataType:s,split:i},[t.buffer])}),s.pageNo),c=new u(s.pageNo,s.timestamp,s.url,((t,s,i="player",e)=>{l&&(s?l.sendUncompressed(t,i,e):l.push(t,i,e))}),s.tabId,(()=>postMessage({type:"queue_empty"})),null!==(i=s.localDebug)&&void 0!==i&&i,((t,s)=>{postMessage({type:"local_save",name:t,batch:s},[s.buffer])})),null===y&&(y=setInterval(p,3e4)),d=o.Active):"auth"===s.type?l?c?(l.authorise(s.token),s.beaconSizeLimit&&c.setBeaconSizeLimit(s.beaconSizeLimit),void(s.protocolVersion&&c.setProtocolVersion(s.protocolVersion))):(console.debug("OR WebWorker: writer not initialised. Received auth."),void g()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void g()):void 0}if(c){const t=c;s.forEach((s=>{55===s[0]&&(s[1]?m=setTimeout((()=>g()),18e5):clearTimeout(m)),t.writeMessage(s)}))}else postMessage("not_init"),g()}else p(!0);else p()}}();\n'],{type:"text/javascript"}))),this.worker.onerror=e=>{this._debug("webworker_error",e)},this.worker.onmessage=({data:e})=>{this.handleWorkerMsg(e)};let e=!1,t=()=>{!e&&(e=!0,setTimeout(()=>{e=!1},500),this.worker&&this.worker.postMessage("closing"))};this.attachEventListener(document.body,"mouseleave",t,!1,!1),this.attachEventListener(window,"pagehide",()=>{this.lastHiddenAt=Date.now(),t()},!1,!1),this.attachEventListener(window,"pageshow",this.handlePageShow,!1,!1),this.attachEventListener(document,"visibilitychange",e=>"hidden"===document.visibilityState&&t(),!1)}catch(e){this._debug("worker_start",e)}}handleWorkerMsg(e){if("a_stop"===e)this.stop(!1);else if("a_start"===e)this.waitStatus(a.NotActive).then(()=>{this.allowAppStart(),this.start(this.prevOpts,!0).then(e=>{this.debug.info("Worker restart, session too long",e)}).catch(e=>{this.debug.error("Worker restart failed",e)})});else if("not_init"===e)this.debug.warn("OR WebWorker: writer not initialised. Restarting tracker");else if("failure"===e.type)this.stop(!1),this.debug.error("worker_failed",e.reason),this._debug("worker_failed",e.reason);else if("compress"===e.type){let t=e.batch,s=e.dataType,i=e.split,n=t.byteLength,r="CompressionStream"in globalThis;n>this.compressionThreshold&&r?new Response(new Blob([t]).stream().pipeThrough(new CompressionStream("gzip"))).arrayBuffer().then(e=>{this.worker?.postMessage({type:"compressed",batch:new Uint8Array(e),dataType:s,split:i})}).catch(e=>{this.debug.error("Openreplay compression error:",e),this.worker?.postMessage({type:"uncompressed",batch:t,dataType:s,split:i})}):this.worker?.postMessage({type:"uncompressed",batch:t,dataType:s,split:i})}else if("local_save"===e.type){let t=new Blob([e.batch],{type:"application/octet-stream"}),s=URL.createObjectURL(t),i=document.createElement("a");i.href=s,i.download=e.name,i.click(),URL.revokeObjectURL(s)}else"queue_empty"===e.type&&this.onSessionSent()}_debug(e,t){null!==this.options.__debug_report_edp&&fetch(this.options.__debug_report_edp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e,error:`${t}`})}),this.debug.error("OpenReplay error: ",e,t)}_nCommit(){if(this.socketMode){this.messages.unshift([0,this.timestamp()],H(this.session.getTabId())),this.commitCallbacks.forEach(e
9=>e(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:ej.iframeBatch,messages:this.messages,context:this.contextId},this.options.crossdomain?.parentDomain??"*"),this.markSentToParent(),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0;return}if(void 0!==this.worker){if(!this.messages.length){if(this.emptyBatchCounter<1e3){this.emptyBatchCounter++;return}this.emptyBatchCounter=0;try{var e;this.worker?.postMessage([(e=this.timestamp(),[0,e]),H(this.session.getTabId())])}catch(e){this._debug("worker_keepalive",e)}return}this.emptyBatchCounter=0;try{$(()=>{if(this.messages.length){var e;this.messages.unshift((e=this.timestamp(),[0,e]),H(this.session.getTabId())),this.worker?.postMessage(this.messages),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0}})}catch(e){this._debug("worker_commit",e),this.stop(!0),setTimeout(()=>{this.start()},500)}}}_cStartCommit(){if(this.coldStartCommitN+=1,2===this.coldStartCommitN){let e=[[0,this.timestamp()],H(this.session.getTabId())];this.bufferedMessages1.push(...e),this.bufferedMessages2.push(...e),this.coldStartCommitN=0}}commit(){this.activityState===a.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){this.worker?.postMessage(e),this.commitCallbacks.forEach(t=>t(e))}timestamp(){return v()+this.delay}safe(e){let t=this;return function(...s){try{e.apply(this,s)}catch(e){t._debug("safe_fn_call",e)}}}attachCommitCallback(e){this.commitCallbacks.push(e)}checkRequiredVersion(e){let t=e.split(/[.-]/),s=this.version.split(/[.-]/);for(let e=0;e<3;e++){if(isNaN(Number(s[e]))||isNaN(Number(t[e])))return!1;if(Number(s[e])>Number(t[e]))break;if(Number(s[e])<Number(t[e]))return!1}return!0}getTrackerInfo(){return{userUUID:this.localStorage.getItem(this.options.local_uuid_key),projectKey:this.projectKey,revID:this.revID,trackerVersion:this.version,isSnippet:this.options.__is_snippet}}getSessionInfo(){return{...this.session.getInfo(),...this.getTrackerInfo()}}getSessionToken(){return this.session.getSessionToken(this.projectKey)}getSessionID(){return this.session.getInfo().sessionID||void 0}getSessionURL(e){let{projectID:t,sessionID:s,timestamp:i}=this.session.getInfo();if(!t||!s){this.debug.error("OpenReplay error: Unable to build session URL");return}let n=this.options.ingestPoint,r=(/api\.openreplay\.com/.test(n)?"https://app.openreplay.com/ingest":n).replace(/ingest$/,`${t}/session/${s}`);if(e?.withCurrentTime){let e=v()-i;return`${r}?jumpto=${e}`}return r}getHost(){return new URL(this.options.ingestPoint).host}getProjectKey(){return this.projectKey}getBaseHref(){return"string"==typeof this.options.resourceBaseHref?this.options.resourceBaseHref:(this.options.resourceBaseHref,document.baseURI)?document.baseURI:document.head?.getElementsByTagName("base")[0]?.getAttribute("href")||location.origin+location.pathname}resolveResourceURL(e){let t=new URL(this.getBaseHref());return t.pathname+="/"+new URL(e).pathname,t.pathname.replace(/\/+/g,"/"),t.toString()}isServiceURL(e){return e.startsWith(this.options.ingestPoint)}active(){return this.activityState===a.Active}resetNextPageSession(e){e?this.sessionStorage.setItem(this.options.session_reset_key,"t"):this.sessionStorage.removeItem(this.options.session_reset_key)}getSessionVersionHash(){return`2x${this.version}`}get sessionVersionKey(){return`${this.options.session_token_key}_version`}storeSessionVersion(e){this.sessionStorage.setItem(this.sessionVersionKey,e)}adoptSessionVersion(e){e&&this.storeSessionVersion(e)}checkSessionToken(e){let t=this.getSessionVersionHash(),s=null!==this.sessionStorage.getItem(this.options.session_reset_key),i=!!(e||s),n=this.session.getSessionToken(this.projectKey);if(n){let e=this.sessionStorage.getItem(this.sessionVersionKey);e&&e===t||(i=!0),this.storeSessionVersion(t)}return i||!n}async coldStart(e={},t){this.singleBuffer=!1;let s=this.checkSessionToken(e.forceNew);t&&await this.setupConditionalStart(e);let i=()=>{this.orderNumber+=1,b(),this.coldStartTs=v(),this.orderNumber%2==0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push([0,this.timestamp()]),this.bufferedMessages1.push(H(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push([0,this.timestamp()]),this.bufferedMessages2.push(H(this.session.getTabId()))),this.stop(!1),this.activityState=a.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata}),s||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(z(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{i()},3e4),i()}async setupConditionalStart(e){this.conditionsManager=new u(this,e);let t=await fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:v(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:F,jsHeapSizeLimit:q,timezone:eU(),width:window.screen.width,height:window.screen.height})}),{token:s,userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:h,projectID:l}=await t.json();this.session.assign({projectID:l}),this.session.setUserInfo({userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:h});let c={sessionToken:s,userUUID:"",sessionID:""};
9this.startCallbacks.forEach(e=>e(c)),await this.conditionsManager?.fetchConditions(l,s),await this.tagWatcher.fetchTags(this.options.ingestPoint,s)}offlineRecording(e={},t){this.onSessionSent=t,this.singleBuffer=!0;let s=this.checkSessionToken(e.forceNew);b(),this.coldStartTs=v();let i=this.localStorage.getItem(eR);if(i){let e=JSON.parse(i);this.bufferedMessages1=Array.isArray(e)?e:this.bufferedMessages1,this.localStorage.removeItem(eR)}this.bufferedMessages1.push([0,this.timestamp()]),this.bufferedMessages1.push(H(this.session.getTabId())),this.activityState=a.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});let n={sessionToken:"",userUUID:"",sessionID:""};return this.startCallbacks.forEach(e=>e(n)),s||this.send(z(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(eR,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}async uploadOfflineRecording(){this.stop(!1);let e=v();this.worker?.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:this.coldStartTs,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId(),localDebug:this.options.__local_debug});let t=await fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:e,doNotRecord:!1,bufferDiff:e-this.coldStartTs,userID:this.session.getInfo().userID,token:void 0,deviceMemory:F,jsHeapSizeLimit:q,timezone:eU()})}),{token:s,userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:h,beaconSizeLimit:l,projectID:c,protocolVersion:u}=await t.json();for(this.worker?.postMessage({type:"auth",token:s,beaconSizeLimit:l,protocolVersion:u}),this.session.assign({projectID:c}),this.session.setUserInfo({userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:h});this.bufferedMessages1.length>0;)await this.flushBuffer(this.bufferedMessages1);this.postToWorker([[-1]]),this.clearBuffers()}async _start(e={},t=!1,s){0!==Object.keys(e).length&&(this.prevOpts=e),e.startCallback&&(this.userStartCallback=e.startCallback);let i=this.activityState===a.ColdStart;if(i&&this.coldInterval&&clearInterval(this.coldInterval),!this.worker&&!this.insideIframe){let e="No worker found: perhaps, CSP is not set.";return this.signalError(e,[]),Promise.resolve(eP(e))}if(this.activityState===a.Active||this.activityState===a.Starting)return Promise.resolve(eP("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=a.Starting,i||b(),e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset();let n=e.userID?e.userID.trim():void 0;this.session.assign({userID:n||void 0,metadata:e.metadata});let r=v();this.worker?.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:i?this.coldStartTs:r,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId(),localDebug:this.options.__local_debug});let o=this.session.getSessionToken(this.projectKey),h=this.checkSessionToken(e.forceNew);this.sessionStorage.removeItem(this.options.session_reset_key),this.debug.log("OpenReplay: starting session; need new session id?",h,"session token: ",o);try{let t=await window.fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:r,doNotRecord:!1,bufferDiff:this.coldStartTs?r-this.coldStartTs:0,userID:this.session.getInfo().userID,token:h?void 0:o,deviceMemory:F,jsHeapSizeLimit:q,timezone:eU(),condition:s,assistOnly:e.assistOnly??this.socketMode,width:window.screen.width,height:window.screen.height,referrer:document.referrer})});if(200!==t.status){let e=await t.text(),s=e===ex?ex:`Server error: ${t.status}. ${e}`;return eP(s)}if(!this.worker&&!this.insideIframe){let e="no worker found after start request (this should not happen in real world)";return this.signalError(e,[]),eP(e)}let{token:n,userUUID:l,projectID:c,beaconSizeLimit:u,compressionThreshold:d,delay:p,sessionID:f,startTimestamp:g,userBrowser:m,userCity:y,userCountry:b,userDevice:v,userOS:S,userState:w,canvasEnabled:k,canvasQuality:T,canvasFPS:I,framesSupport:_,assistOnly:E,protocolVersion:O}=await t.json();if("string"!=typeof n||"string"!=typeof l||"number"!=typeof g&&void 0!==g||"string"!=typeof f||"number"!=typeof p||"number"!=typeof u&&void 0!==u){let e=`Incorrect server response: ${JSON.stringify(t)}`;return this.signalError(e,[]),eP(e)}this.delay=p,this.session.setSessionToken(n,this.projectKey),this.storeSessionVersion(this.getSessionVersionHash()),o&&o!==n&&this.bc?.postMessage({type:ej.reset,token:n}),this.session.setUserInfo({userBrowser:m,userCity:y,userCountry:b,userDevice:v,userOS:S,userState:w}),this.session.assign({sessionID:f,timestamp:g||r,projectID:c}),E?(this.socketMode=!0,this.worker?.postMessage("stop")):this.worker?.postMessage({type:"auth",token:n,beaconSizeLimit:u,protocolVersion:O}),h||n!==o||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(z(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEac
9h(([e,t])=>this.send([30,e,t])),this.localStorage.setItem(this.options.local_uuid_key,l),this.compressionThreshold=d;let C={sessionToken:n,userUUID:l,sessionID:f};if(this.startCallbacks.forEach(e=>e(C)),this.userStartCallback&&this.userStartCallback(eB(C)),this.activityState=a.Active,this.options.crossdomain?.enabled&&this.bootChildrenFrames(),k&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new en(this,{fps:I,quality:T,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame,framesSupport:!!_})),i){let e=this.bufferedMessages1.length>this.bufferedMessages2.length?this.bufferedMessages1:this.bufferedMessages2;for(;e.length>0;)await this.flushBuffer(e);this.clearBuffers(),this.commit()}return this.insideIframe&&this.rootId?this.observer.crossdomainObserve(this.rootId,this.frameOderNumber,this.frameLevel):this.observer.observe(),this.ticker.start(),this.canvasRecorder?.startTracking(),this.tagWatcher.fetchTags(this.options.ingestPoint,n),eB(C)}catch(t){if(this.stop(),this.session.reset(),!t)return console.error("Unknown error during start"),this.signalError("Unknown error",[]),eP("Unknown error");if(t===ex)return this.signalError(ex,[]),eP(ex);this._debug("session_start",t);let e=t instanceof Error?t.message:t.toString();return this.signalError(e,[]),eP(e)}}async waitStart(){return new Promise(e=>{let t=setInterval(()=>{this.canStart&&(clearInterval(t),e(!0))},100)})}async waitStarted(){return this.waitStatus(a.Active)}async waitStatus(e){return new Promise(t=>{let s=()=>{this.activityState===e?t(!0):setTimeout(s,25)};s()})}async start(...e){return this.activityState===a.Active||this.activityState===a.Starting?Promise.resolve(eP("OpenReplay: trying to call `start()` on the instance that has been started already.")):(this.insideIframe&&this.signalIframeTracker(),document.hidden)?new Promise(t=>{let s=async()=>{document.hidden||(await this.waitStart(),document.removeEventListener("visibilitychange",s),t(this._start(...e)))};document.addEventListener("visibilitychange",s)}):(await this.waitStart(),this._start(...e))}forceFlushBatch(){this.worker?.postMessage("forceFlushBatch")}getTabId(){return this.session.getTabId()}clearBuffers(){this.bufferedMessages1.length=0,this.bufferedMessages2.length=0}trackWs(e){return(t,s,i="down")=>{if("string"==typeof t&&"string"==typeof s&&!(s.length>5242880)&&!(t.length>255))this.send([84,"websocket",e,s,this.timestamp(),i,t])}}stop(e=!0){if(this.activityState!==a.NotActive)try{this.options.crossdomain?.enabled&&this.killChildrenFrames(),this.attributeSender.clear(),this.sanitizer.clear(),this.observer.disconnect(),this.nodes.clear(),this.ticker.stop(),this.stopCallbacks.forEach(e=>e()),this.tagWatcher.clear(),this.worker&&e&&this.worker.postMessage("stop"),this.canvasRecorder?.clear(),this.messages.length=0,this.parentActive=!1,this.pageFrames=[]}finally{this.activityState=a.NotActive,this.debug.log("OpenReplay tracking stopped.")}}}let eW=g&&"InstallTrigger"in window?e=>e.message+"\n"+e.stack:e=>e.stack||e.message;function eF(e){return void 0===e?"undefined":null===e?"null":e instanceof Error?eW(e):Array.isArray(e)?`Array(${e.length})`:String(e)}function eq(e){if(void 0===e)return"undefined";if(null===e)return"null";if(e instanceof Error)return eW(e);if(Array.isArray(e)){let t=e.length,s=e.slice(0,10).map(eF).join(", ");return`Array(${t})[${s}]`}if("object"==typeof e){let t=[],s=0;for(let i in e){if(10==++s)break;let n=e[i];t.push(i+": "+eF(n))}return"{"+t.join(", ")+"}"}return e.toString()}let eV=["log","info","warn","error","debug","assert"],eK=/(^|@)\S+:\d+/,eX=/^\s*at .*(\S+:\d+|\(native\))/m,eJ=/^(eval@)?(\[native code\])?$/;function eQ(e){if(!e.includes(":"))return[e,void 0,void 0];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]}function eG(e){return[{columnNumber:e.colno,lineNumber:e.lineno,fileName:e.filename,functionName:"",source:""}]}function eY(e,t,s={}){var i,n;let r=t;try{r=(function(e,t){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return!e.stacktrace||e.message.includes("\n")&&e.message.split("\n").length>e.stacktrace.split("\n").length?function(e,t){let s=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[];for(let e=2,t=i.length;e<t;e+=2){let t=s.exec(i[e]);
9t&&n.push({file:t[2],line:+t[1],raw:i[e]})}return n}(e):e.stack?e.stack.split("\n").filter(e=>!!e.match(eK)&&!e.match(/^Error created at/)).map(e=>{let t;let s=e.split("@"),i=eQ(s.pop()),n=s.shift()||"",r=n.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return/\([^)]*\)/.test(n)&&(t=n.replace(/^[^(]+\(([^)]*)\)$/,"$1")),{function:r,args:void 0===t||"[arguments not available]"===t?void 0:t.split(","),file:i[0],line:i[1]?+i[1]:void 0,col:i[2]?+i[2]:void 0,raw:e}}):function(e,t){let s=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[];for(let e=0,t=i.length;e<t;e+=2){let t=s.exec(i[e]);t&&n.push({function:t[3]||void 0,file:t[2],line:t[1]?+t[1]:void 0,raw:i[e]})}return n}(e);if(e.stack&&eX.test(e.stack))return e.stack.split("\n").filter(e=>!!e.match(eX)).map(e=>{e.includes("(eval ")&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=t.match(/ (\(.+\)$)/);t=s?t.replace(s[0],""):t;let i=eQ(s?s[1]:t);return{function:s&&t||void 0,file:["eval","<anonymous>"].includes(i[0])?void 0:i[0],line:i[1]?+i[1]:void 0,col:i[2]?+i[2]:void 0,raw:e}});if(e.stack)return e.stack.split("\n").filter(e=>!e.match(eJ)).map(e=>{if(e.includes(" > eval")&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!e.includes("@")&&!e.includes(":"))return{function:e};{let t=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,s=e.match(t),i=s&&s[1]?s[1]:void 0,n=eQ(e.replace(t,""));return{function:i,file:n[0],line:n[1]?+n[1]:void 0,col:n[2]?+n[2]:void 0,raw:e}}});throw Error("Cannot parse given Error object")})(e).map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}catch(e){}return i=e.name,n=e.message,[78,i,n,JSON.stringify(r),JSON.stringify(s)]}function eZ(e,t=window,s={}){if(e instanceof ErrorEvent){if(e.error instanceof Error)return eY(e.error,eG(e),s);{let[t,i]=e.message.split(":");return i||(t="Error",i=e.message),[78,t,i,JSON.stringify(eG(e)),JSON.stringify(s)]}}if("PromiseRejectionEvent"in t&&e instanceof t.PromiseRejectionEvent){if(e.reason instanceof Error)return eY(e.reason,[],s);{let t;try{t=JSON.stringify(e.reason)}catch(s){t=String(e.reason)}return[78,"Unhandled Promise Rejection",t,"[]",JSON.stringify(s)]}}return null}function e0(e,t=document.location){return(e=e.trim()).startsWith("//")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")?e:e.startsWith("/")?t.origin+e:t.origin+t.pathname+e}let e1=["text","password","email","search","number","range","date","tel","time"];function e2(e){return!!ei(e,"textarea")||!!ei(e,"input")&&e1.includes(e.type)}let e3=g&&"labels"in HTMLInputElement.prototype?e=>{let t=e;for(;null!==(t=t.parentNode);)if(ei(t,"label"))return t;let s=e.labels;if(null!==s&&1===s.length)return s[0]}:e=>{let t=e;for(;null!==(t=t.parentNode);)if(ei(t,"label"))return t;let s=e.id;if(s){let t=e.ownerDocument.querySelectorAll('label[for="'+s+'"]');if(null!==t&&1===t.length)return t[0]}};function e5(e,t){let s=C(e);if(null!==s)return w(s).slice(0,100);let i=E(e,t);if(i)return i;if(e.id)return`#${e.id}`;let n=O(e);if(n)return n;let r=e3(e);return w(e.name||e.placeholder||r&&r.innerText||e.type||"").slice(0,100)}let e4={Plain:0,Obscured:1,Hidden:2},e8="undefined"!=typeof CSS&&CSS.escape||(e=>e),e6=new WeakMap;function e7(e){let t=e.tagName.toUpperCase();return"BUTTON"===t||"A"===t||"LI"===t||"SELECT"===t||"TR"===t||"TH"===t||null!=e.onclick||"button"===e.getAttribute("role")}function e9(e,t){return e instanceof Element?function(e,t){let s=e;for(;null!==s&&s!==t.documentElement;){if(N(s,"masked"))return null;s=s.parentElement}if(Y(e)){let t=e.ownerSVGElement;for(;null!==t;)e=t,t=t.ownerSVGElement}for(s=e;null!==s&&s!==t.documentElement;){let e=s.tagName.toUpperCase();if("LABEL"===e)return null;if("INPUT"===e||e7(s)||null!==C(s))return s;s=s.parentElement}return e===t.documentElement?null:e}(e,t):null}function te(e){return Math.round(1e4*e)}function tt(e,t){let s=e6.get(t);if(s||(s=Object.create(null),e6.set(t,s)),e in s)return s[e];let i=1===t.querySelectorAll(`.${e8(e)}`).length;return s[e]=i,i}function ts(e){if(/^[a-z\-]{3,}$/i.test(e)){for(let t of e.split(/-|[A-Z]/))if(t.length<=2||/[^aeiou]{4,}/i.test(t))return!1;return!0}return!1}let ti=-1,tn=e=>{addEventListener("pageshow",t=>
9{t.persisted&&(ti=t.timeStamp,e(t))},!0)},tr=(e,t,s,i)=>{let n,r;return a=>{let o;t.value>=0&&(a||i)&&((r=t.value-(n??0))||void 0===n)&&(n=t.value,t.delta=r,t.rating=(o=t.value)>s[1]?"poor":o>s[0]?"needs-improvement":"good",e(t))}},ta=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},to=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},th=()=>to()?.activationStart??0,tl=(e,t=-1)=>{let s=to(),i="navigate";return ti>=0?i="back-forward-cache":s&&(document.prerendering||th()>0?i="prerender":document.wasDiscarded?i="restore":s.type&&(i=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},tc=new WeakMap;function tu(e,t){let s=tc.get(t);return s||(s=new WeakMap,tc.set(t,s)),s.get(e)||s.set(e,new t),s.get(e)}class td{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],s=this.o.at(-1);this.i&&t&&s&&e.startTime-s.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}let tp=(e,t,s={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let i=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return i.observe({type:e,buffered:!0,...s}),i}}catch{}},tf=e=>{let t=!1;return()=>{t||(e(),t=!0)}},tg=-1,tm=new Set,ty=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,tb=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of tm)e();isFinite(tg)||(tg="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",tb,!0))}},tv=()=>{if(tg<0){let e=th();tg=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime)??ty(),addEventListener("visibilitychange",tb,!0),addEventListener("prerenderingchange",tb,!0),tn(()=>{setTimeout(()=>{tg=ty()})})}return{get firstHiddenTime(){return tg},onHidden(e){tm.add(e)}}},tS=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},tw=[1800,3e3],tk=(e,t={})=>{tS(()=>{let s=tv(),i,n=tl("FCP"),r=tp("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(r.disconnect(),t.startTime<s.firstHiddenTime&&(n.value=Math.max(t.startTime-th(),0),n.entries.push(t),i(!0)))});r&&(i=tr(e,n,tw,t.reportAllChanges),tn(s=>{i=tr(e,n=tl("FCP"),tw,t.reportAllChanges),ta(()=>{n.value=performance.now()-s.timeStamp,i(!0)})}))})},tT=[.1,.25],tI=(e,t={})=>{let s=tv();tk(tf(()=>{let i,n=tl("CLS",0),r=tu(t,td),a=e=>{for(let t of e)r.h(t);r.i>n.value&&(n.value=r.i,n.entries=r.o,i())},o=tp("layout-shift",a);o&&(i=tr(e,n,tT,t.reportAllChanges),s.onHidden(()=>{a(o.takeRecords()),i(!0)}),tn(()=>{r.i=0,ta(i=tr(e,n=tl("CLS",0),tT,t.reportAllChanges))}),setTimeout(i))}))},t_=0,tE=1/0,tO=0,tC=e=>{for(let t of e)t.interactionId&&(tE=Math.min(tE,t.interactionId),t_=(tO=Math.max(tO,t.interactionId))?(tO-tE)/7+1:0)},tN=()=>h?t_:performance.interactionCount??0,tM=()=>{"interactionCount"in performance||h||(h=tp("event",tC,{durationThreshold:0}))},tA=0;class tD{l=[];u=new Map;m;p;v(){tA=tN(),this.l.length=0,this.u.clear()}T(){let e=Math.min(this.l.length-1,Math.floor((tN()-tA)/50));return this.l[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;let t=this.l.at(-1),s=this.u.get(e.interactionId);if(s||this.l.length<10||e.duration>t.L){if(s?e.duration>s.L?(s.entries=[e],s.L=e.duration):e.duration===s.L&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],L:e.duration},this.u.set(s.id,s),this.l.push(s)),this.l.sort((e,t)=>t.L-e.L),this.l.length>10)for(let e of this.l.splice(10))this.u.delete(e.id);this.p?.(s)}}}let tL=e=>{let t=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{let i=tf(e),n=-1,r=()=>{s(n),i()};addEventListener("visibilitychange",r,{once:!0,capture:!0}),n=t(()=>{removeEventListener("visibilitychange",r,{capture:!0}),i()})}},tx=[200,500],tR=(e,t={})=>
9{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let s=tv();tS(()=>{tM();let i,n=tl("INP"),r=tu(t,tD),a=e=>{tL(()=>{for(let t of e)r.h(t);let t=r.T();t&&t.L!==n.value&&(n.value=t.L,n.entries=t.entries,i())})},o=tp("event",a,{durationThreshold:t.durationThreshold??40});i=tr(e,n,tx,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),s.onHidden(()=>{a(o.takeRecords()),i(!0)}),tn(()=>{r.v(),i=tr(e,n=tl("INP"),tx,t.reportAllChanges)}))})};class tP{m;h(e){this.m?.(e)}}let tB=[2500,4e3],tU=(e,t={})=>{tS(()=>{let s=tv(),i,n=tl("LCP"),r=tu(t,tP),a=e=>{for(let a of(t.reportAllChanges||(e=e.slice(-1)),e))r.h(a),a.startTime<s.firstHiddenTime&&(n.value=Math.max(a.startTime-th(),0),n.entries=[a],i())},o=tp("largest-contentful-paint",a);if(o){i=tr(e,n,tB,t.reportAllChanges);let s=tf(()=>{a(o.takeRecords()),o.disconnect(),i(!0)}),r=e=>{e.isTrusted&&(tL(s),removeEventListener(e.type,r,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,r,{capture:!0});tn(s=>{i=tr(e,n=tl("LCP"),tB,t.reportAllChanges),ta(()=>{n.value=performance.now()-s.timeStamp,i(!0)})})}})},t$=[800,1800],tj=e=>{document.prerendering?tS(()=>tj(e)):"complete"!==document.readyState?addEventListener("load",()=>tj(e),!0):setTimeout(e)},tz=(e,t={})=>{let s=tl("TTFB"),i=tr(e,s,t$,t.reportAllChanges);tj(()=>{let n=to();n&&(s.value=Math.max(n.responseStart-th(),0),s.entries=[n],i(!0),tn(()=>{(i=tr(e,s=tl("TTFB",0),t$,t.reportAllChanges))(!0)}))})};function tH(e){let t=e.defaultView;return[t&&t.scrollX||e.documentElement&&e.documentElement.scrollLeft||e.body&&e.body.scrollLeft||0,t&&t.scrollY||e.documentElement&&e.documentElement.scrollTop||e.body&&e.body.scrollTop||0]}let tW=e=>{let t=["jwt","password","reset-password","invitation","secret","token"];try{let s=new URL(e);return s.searchParams.forEach((e,i)=>{t.includes(i.toLowerCase())&&s.searchParams.set(i,"*".repeat(e.length))}),s.toString()}catch{return e}},tF={checkCssInterval:200,scanInMemoryCSS:!1,checkLimit:void 0},tq=new Set(["password","pass","pwd","mdp","token","bearer","jwt","api_key","api-key","apiKey","secret","ssn","zip","zipcode","x-api-key","www-authenticate","x-csrf-token","x-requested-with","x-forwarded-for","x-real-ip","cookie","authorization","auth","proxy-authorization","set-cookie","account_key"]);function tV(e){return"number"==typeof e?"9".repeat((0|Math.log10((e^e>>31)-(e>>31)))+1):"string"==typeof e?e.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*"):e}function tK(e){let t={};if(Array.isArray(e))e.forEach(({name:e,value:s})=>{tq.has(e.toLowerCase())?t[e]=tV(s):t[e]=s});else for(let[s,i]of Object.entries(e))tq.has(s.toLowerCase())?t[s]=tV(i):t[s]=i;return t}function tX(e){let t;if(!e)return e;let s=!1;try{t=JSON.parse(e),s=!0}catch(e){}if(s)return tJ(t),JSON.stringify(t);if(!("string"==typeof e&&e.includes("?")&&e.includes("=")))return e;try{let t=new URLSearchParams(e);for(let e of t.keys())if(tq.has(e.toLowerCase())){let s=tV(t.get(e));t.set(e,s)}return t.toString()}catch(t){return e}}function tJ(e){if(Array.isArray(e))e.forEach(tJ);else if(e&&"object"==typeof e)for(let t in e)Object.hasOwn(e,t)&&(tq.has(t.toLowerCase())?e[t]=tV(e[t]):null!==e[t]&&"object"==typeof e[t]&&tJ(e[t]))}class tQ{constructor(e=[],t,s){this.ignoredHeaders=e,this.setSessionTokenHeader=t,this.sanitize=s,this.id="",this.name="",this.method="",this.url="",this.status=0,this.statusText="",this.cancelState=0,this.readyState=0,this.header={},this.responseType="",this.requestType="xhr",this.requestHeader={},this.responseSize=0,this.responseSizeText="",this.startTime=0,this.endTime=0,this.duration=0,this.getData={},this.requestData=null}getMessage(){var e;let{reqHs:t,resHs:s}=this.writeHeaders(),i="GET"===this.method?JSON.stringify((tJ(e=this.getData),e)):tX(this.requestData),n={headers:tK(t),body:i},r={headers:tK(s),body:tX(this.response)},a=this.sanitize({url:function(e){if(!e)return"";try{let t=new URL(e);if(t.searchParams)for(let e of t.searchParams.keys())tq.has(e.toLowerCase())&&t.searchParams.set(e,"******");return t.toString()}catch(t){return e}}(this.url),method:this.method,status:this.status,request:n,response:r});if(!a)return null;if((a.url.includes("/graphql")||Object.values(a.request.headers).some(e=>e&&"string"==typeof e&&e.includes("application/graphql-response")))&&a.response.body&&"string"==typeof a.response.body){let e=a.response.body.includes("errors");a.status=e?400:200,this.requestType="graphql"}return{requestType:this.requestType,method:a.method,url:a.url,request:JSON.stringify(a.request),response:JSON.stringify(a.response),status:a.status,startTime:this.startTime,duration:this.duration,responseSize:this.responseSize}}writeHeaders(){let e={};Object.entries(this.requestHeader).forEach(([t,s])=>{this.isHeaderIgnored(t)||(e[t]=s)}),this.setSessionTokenHeader((t,s)=>{e[t]=s});let t={};return Object.entries(this.header).forEach(([e,s])=>{this.isHeaderIgnored(e)||(t[e]=s)}),{reqHs:e,resHs:t}}isHeaderIgnored(e){return Array.isArray(this.ignoredHeaders)?this.ignoredHeaders.map(e=>e.toLowerCase()).includes(e.toLowerCase()):this.ignoredHeaders}}
9let tG=(e,t)=>{let s="";switch(e){case"":case"text":case"json":"string"==typeof t?s=t:t0(t)||Array.isArray(t)?s=JSON.stringify(t):void 0!==t&&(s=Object.prototype.toString.call(t));break;default:void 0!==t&&(s=Object.prototype.toString.call(t))}return s},tY=e=>{let t;if(!e)return null;try{if("string"==typeof e){("{"===e[0]||"["===e[0])&&(t=e);let s=e.split("&");t=1===s.length?e:s.join(",")}else if(function(e){return!(null==e||ArrayBuffer.isView(e))&&"undefined"!=typeof Symbol&&"function"==typeof e[Symbol.iterator]}(e)){let s=[];for(let[t,i]of e)s.push(`${t}=${"string"==typeof i?i:"[object Object]"}`);t=s.join(",")}else e instanceof Blob||e instanceof ReadableStream||ArrayBuffer.isView(e)||e instanceof ArrayBuffer?t="byte data":t=t0(e)?e:`can't parse body ${typeof e}`;return t}catch(e){return"can't parse body"}},tZ=(e,t={})=>{t0(t)||(t={});let s=e?e.split("?"):[];if(s.shift(),s.length>0)for(let e of s=s.join("?").split("&")){let s=e.split("=");try{t[s[0]]=decodeURIComponent(s[1])}catch(e){t[s[0]]=s[1]}}return t};function t0(e){return null!==e&&"object"==typeof e}function t1(e){return e<=0?"":e>=1e6?(e/1e3/1e3).toFixed(1)+" MB":e>=1e3?(e/1e3).toFixed(1)+" KB":`${e}B`}let t2=e=>{if(e.startsWith("//")){let t=new URL(window.location.href);e=`${t.protocol}${e}`}return e.startsWith("http")?new URL(e):new URL(e,window.location.href)},t3=e=>e instanceof Blob?e.type:e instanceof FormData?"multipart/form-data":e instanceof URLSearchParams?"application/x-www-form-urlencoded;charset=UTF-8":"text/plain;charset=UTF-8";class t5{constructor(e,t,s,i,n){this.ignoredHeaders=e,this.setSessionTokenHeader=t,this.sanitize=s,this.sendMessage=i,this.isServiceUrl=n}apply(e,t,s){let i=s[0],n=s[1],r=new tQ(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(i))return e.apply(t,s);let a=t2(i);if(r.method="POST",r.url=i,r.name=(a.pathname.split("/").pop()||"")+a.search,r.requestType="beacon",r.requestHeader={"Content-Type":t3(n)},r.status=0,r.statusText="Pending",a.search&&a.searchParams)for(let[e,t]of(r.getData={},a.searchParams))r.getData[e]=t;r.requestData=tY(n),r.startTime||(r.startTime=performance.now());let o=e.apply(t,s);o?(r.endTime=performance.now(),r.duration=r.endTime-(r.startTime||r.endTime),r.status=0,r.statusText="Sent",r.readyState=4):(r.status=500,r.statusText="Unknown");let h=r.getMessage();return h&&this.sendMessage(h),o}}class t4{static create(e,t,s,i,n,r){if(e)return new Proxy(e,new t5(t,s,i,n,r))}}class t8{constructor(e,t){this.resp=e,this.item=t}set(e,t,s){return Reflect.set(e,t,s)}get(e,t){let s=Reflect.get(e,t);if("arrayBuffer"===t||"blob"===t)return"function"==typeof s?s.bind(e):s;switch(t){case"formData":case"json":case"text":return()=>(this.item.responseType=t.toLowerCase(),s.apply(e).then(e=>(this.item.response=tG(this.item.responseType,e),e)))}return"function"==typeof s?s.bind(e):s}}class t6{constructor(e,t,s,i,n,r){this.ignoredHeaders=e,this.setSessionTokenHeader=t,this.sanitize=s,this.sendMessage=i,this.isServiceUrl=n,this.tokenUrlMatcher=r}apply(e,t,s){var i;let n=s[0],r=s[1];if(!n||"string"!=typeof n&&!(null==n?void 0:n.url)||(n instanceof URL||"string"==typeof n?this.isServiceUrl(String(n)):this.isServiceUrl(String(n.url))))return e.apply(window,s);let a=new tQ(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);this.beforeFetch(a,n,r);let o=(s[0]instanceof Request?s[0].signal:void 0)||(null===(i=s[1])||void 0===i?void 0:i.signal),h=!1,l=()=>{if(h)return;h=!0,a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),a.status=0,a.statusText="Aborted",a.readyState=0;let e=a.getMessage();e&&this.sendMessage(e)};return o&&(o.aborted?l():o.addEventListener("abort",l,{once:!0})),this.setSessionTokenHeader((e,t)=>{if(void 0===this.tokenUrlMatcher||this.tokenUrlMatcher(a.url)){if(void 0===s[1]&&s[0]instanceof Request)return s[0].headers.append(e,t);s[1]||(s[1]={}),void 0===s[1].headers&&(s[1]=Object.assign(Object.assign({},s[1]),{headers:{}})),s[1].headers instanceof Headers?s[1].headers.append(e,t):Array.isArray(s[1].headers)?s[1].headers.push([e,t]):s[1].headers[e]=t}}),e.apply(window,s).then(this.afterFetch(a,()=>{h=!0}
9)).catch(e=>{if(a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),e&&"AbortError"===e.name&&(a.status=0,a.statusText="Aborted",a.readyState=0,!h)){let e=a.getMessage();e&&this.sendMessage(e)}throw e})}beforeFetch(e,t,s){let i,n="GET",r={};if("string"==typeof t?(n=(null==s?void 0:s.method)||"GET",i=t2(t),r=(null==s?void 0:s.headers)||{}):(n=t.method||"GET",i=t2(t.url),r=t.headers),e.method=n,e.requestType="fetch",e.requestHeader=r,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,e.startTime||(e.startTime=performance.now()),"[object Headers]"===Object.prototype.toString.call(r))for(let[t,s]of(e.requestHeader={},r))e.requestHeader[t]=s;else e.requestHeader=r;if(i.search&&i.searchParams)for(let[t,s]of(e.getData={},i.searchParams))e.getData[t]=s;(null==s?void 0:s.body)&&(e.requestData=tY(s.body))}afterFetch(e,t){return s=>{t&&(null==t||t()),e.endTime=performance.now(),e.duration=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let i=!1;for(let[t,n]of(e.header={},s.headers))e.header[t]=n,i=n.toLowerCase().indexOf("chunked")>-1||i;i?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(t=>{e.responseSize="string"==typeof t?t.length:t.byteLength,e.responseSizeText=t1(e.responseSize),e.response=tG(e.responseType,t);let s=e.getMessage();s&&this.sendMessage(s)}).catch(t=>{if("AbortError"===t.name){e.status=0,e.statusText="Aborted",e.readyState=0;let t=e.getMessage();t&&this.sendMessage(t)}else throw t}));let n=(s.headers.get("content-type")||"").toLowerCase();return n.includes("application/json")||n.startsWith("text/")?new Proxy(s,new t8(s,e)):s}}handleResponseBody(e,t){let s=e.headers.get("content-type");return s&&s.includes("application/json")?(t.responseType="json",e.text()):s&&(s.includes("text/html")||s.includes("text/plain"))?(t.responseType="text",e.text()):(t.responseType="arraybuffer",e.arrayBuffer())}}class t7{static create(e,t,s,i,n,r){return new Proxy(fetch,new t6(e,t,s,i,n,r))}}!function(e){e[e.UNSENT=0]="UNSENT",e[e.OPENED=1]="OPENED",e[e.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",e[e.LOADING=3]="LOADING",e[e.DONE=4]="DONE"}(o||(o={}));class t9{constructor(e,t,s,i,n,r,a){this.ignoredHeaders=t,this.setSessionTokenHeader=s,this.sanitize=i,this.sendMessage=n,this.isServiceUrl=r,this.tokenUrlMatcher=a,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new tQ(t,s,i),this.item.requestType="xhr"}get(e,t){switch(t){case"open":return this.getOpen(e);case"send":return this.setSessionTokenHeader((t,s)=>{(void 0===this.tokenUrlMatcher||this.tokenUrlMatcher(this.item.url))&&1===e.readyState&&e.setRequestHeader(t,s)}),this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:let s=Reflect.get(e,t);if("function"==typeof s)return s.bind(e);return s}}set(e,t,s){switch(t){case"onreadystatechange":return this.setOnReadyStateChange(e,t,s);case"onabort":return this.setOnAbort(e,t,s);case"ontimeout":return this.setOnTimeout(e,t,s)}return Reflect.set(e,t,s)}onReadyStateChange(){if(this.item.url&&this.isServiceUrl(this.item.url))return;this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=performance.now(),this.item.duration=this.item.endTime-this.item.startTime,this.updateItemByReadyState();let e=this.item.responseType||"";if((""===e||"text"===e||"json"===e)&&setTimeout(()=>{this.item.response=tG(e,this.XMLReq.response)},0),this.XMLReq.readyState===o.DONE){let e=this.item.getMessage();e&&this.sendMessage(e)}}onAbort(){this.item.cancelState=1,this.item.statusText="Abort";let e=this.item.getMessage();e&&this.sendMessage(e)}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout";let e=this.item.getMessage();e&&this.sendMessage(e)}getOpen(e){let t=Reflect.get(e,"open");return(...s)=>{var i,n,r;let a=s[0],o=s[1];return this.item.method=a?a.toUpperCase():"GET",this.item.url=(null===(i=o.toString)||void 0===i?void 0:i.call(o))||"",this.item.name=null!==(r=null===(n=this.item.url)||void 0===n?void 0:n.replace(RegExp("/*$"),"").split("/").pop())&&void 0!==r?r:"",this.item.getData=tZ(this.item.url,{}),t.apply(e,s)}}getSend(e){let t=Reflect.get(e,"send");return(...s)=>{let i=s[0];return this.item.requestData=tY(i),t.apply(e,s)}}getSetRequestHeader(e){let t=Reflect.get(e,"setRequestHeader");return(...s)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[s[0]]=s[1],t.apply(e,s))}
9setOnReadyStateChange(e,t,s){return Reflect.set(e,t,(...t)=>{this.onReadyStateChange(),null==s||s.apply(e,t)})}setOnAbort(e,t,s){return Reflect.set(e,t,(...t)=>{this.onAbort(),s.apply(e,t)})}setOnTimeout(e,t,s){return Reflect.set(e,t,(...t)=>{this.onTimeout(),s.apply(e,t)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case o.UNSENT:case o.OPENED:this.item.status=o.UNSENT,this.item.statusText="Pending",this.item.startTime||(this.item.startTime=performance.now());break;case o.HEADERS_RECEIVED:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};let e=(this.XMLReq.getAllResponseHeaders()||"").split("\n");for(let t=0;t<e.length;t++){let s=e[t];if(!s)continue;let i=s.split(": "),n=i[0];this.item.header[n]=i.slice(1).join(": ")}break;case o.LOADING:this.item.status=this.XMLReq.status,this.item.statusText="Loading";let t=this.XMLReq.response;if(t){let e="string"==typeof t?t.length:t instanceof ArrayBuffer?t.byteLength:"undefined"!=typeof Blob&&t instanceof Blob?t.size:0;e&&(this.item.responseSize=e,this.item.responseSizeText=t1(this.item.responseSize))}break;case o.DONE:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime);let s=this.XMLReq.response,i=this.XMLReq.responseType||"";if((""===i||"text"===i||"json"===i)&&(this.item.response=s),s){let e="string"==typeof s?s.length:s instanceof ArrayBuffer?s.byteLength:"undefined"!=typeof Blob&&s instanceof Blob?s.size:0;e&&(this.item.responseSize=e,this.item.responseSizeText=t1(e))}break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown"}}}class se{static create(e,t,s,i,n,r){return new Proxy(XMLHttpRequest,{construct(a){let o=new a;return new Proxy(o,new t9(o,e,t,s,i,n,r))}})}}let st=e=>{console.warn(`Openreplay: Can't find ${e} in global context.`)},ss=Symbol("OpenReplayProxyOriginal"),si=e=>!!e&&void 0!==e[ss],sn=e=>si(e)?e[ss]:e,sr=(e,t)=>(e[ss]=t,e);function sa(e){return e.__or_req_data__||(e.__or_req_data__={body:void 0,headers:{}}),e.__or_req_data__}function so(e){return"string"==typeof e?e.toUpperCase():"GET"}let sh=["composite","computedOffset","easing","offset"];function sl(e){let t=null===e;return!!(e&&"object"==typeof e&&!Array.isArray(e)&&!t)}let sc="$__or__initial_ref__$",su="$__or__distinct_device_id__$",sd="$__or__utm_params__$",sp="$__or__super_properties__$",sf="$__or__user_id__$",sg="window"in globalThis?window:{navigator:{userAgent:""},screen:{},document:{cookie:""},location:{search:""}},sm="document"in globalThis?document:{referrer:""},sy=["google","bing","yahoo","baidu","yandex","duckduckgo","ecosia","ask","aol","wolframalpha","startpage","swisscows","qwant","lycos","dogpile","info","teoma","webcrawler","naver","seznam","perplexity"];class sb{constructor(e,t){this.localStorage=e,this.sessionStorage=t,this.user_id=null,this.setUserId=e=>{this.user_id=e,this.sessionStorage.setItem(sf,e??"")},this.resetUserId=e=>{this.user_id=null,e&&(this.deviceId=this.getDistinctDeviceId(!0))},this.getDistinctDeviceId=e=>{let t=this.localStorage.getItem(su);if(t&&!e)return t;{let e=`${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;return this.localStorage.setItem(su,e),e}},this.getReferrer=()=>{let e=this.sessionStorage.getItem(sc);if(e)return e;{let e=sm.referrer;return this.sessionStorage.setItem(sc,e),e}},this.parseUTM=()=>{let e=this.sessionStorage.getItem(sd);if(e){let t=JSON.parse(e);this.utmSource=t.utm_source,this.utmMedium=t.utm_medium,this.utmCampaign=t.utm_campaign}else{let e=new URLSearchParams(sg.location.search);this.utmSource=e.get("utm_source")||null,this.utmMedium=e.get("utm_medium")||null,this.utmCampaign=e.get("utm_campaign")||null;let t={utm_source:this.utmSource,utm_medium:this.utmMedium,utm_campaign:this.utmCampaign};this.sessionStorage.setItem(sd,JSON.stringify(t))}}
9,this.getSearchEngine=e=>{for(let t of sy)if(e.includes(t))return t;return null},this.getSuperProperties=()=>{let e=this.localStorage.getItem(sp);return e?JSON.parse(e):{}},this.saveSuperProperties=e=>{this.localStorage.setItem(sp,JSON.stringify(e))},this.clearSuperProperties=()=>{this.localStorage.setItem(sp,JSON.stringify({}))};let{width:s,height:i,browser:n,browserVersion:r,browserMajorVersion:a,os:o,osVersion:h,mobile:l}=function(e,t){let s,i,n;let r=0,a=0,o="";e.screen.width&&(r=e.screen.width,a=e.screen.height,o=`${r} x ${a}`);let h=e.navigator.appVersion??"0",l=e.navigator.userAgent??"unknown",c=e.navigator.appName??"unknown",u=String(parseFloat(h));-1!==(i=l.indexOf("YaBrowser"))?(c="Yandex",u=l.substring(i+10)):-1!==(i=l.indexOf("SamsungBrowser"))?(c="Samsung",u=l.substring(i+15)):-1!==(i=l.indexOf("UCBrowser"))?(c="UC Browser",u=l.substring(i+10)):-1!==(i=l.indexOf("OPR"))?(c="Opera",u=l.substring(i+4)):-1!==(i=l.indexOf("Opera"))?(c="Opera",u=l.substring(i+6),-1!==(i=l.indexOf("Version"))&&(u=l.substring(i+8))):-1!==(i=l.indexOf("Edge"))?(c="Microsoft Legacy Edge",u=l.substring(i+5)):-1!==(i=l.indexOf("Edg"))?(c="Microsoft Edge",u=l.substring(i+4)):-1!==(i=l.indexOf("MSIE"))?(c="Microsoft Internet Explorer",u=l.substring(i+5)):-1!==(i=l.indexOf("Chrome"))?(c="Chrome",u=l.substring(i+7)):-1!==(i=l.indexOf("Safari"))?(c="Safari",u=l.substring(i+7),-1!==(i=l.indexOf("Version"))&&(u=l.substring(i+8))):-1!==(i=l.indexOf("Firefox"))?(c="Firefox",u=l.substring(i+8)):-1!==l.indexOf("Trident/")?(c="Microsoft Internet Explorer",u=l.substring(l.indexOf("rv:")+3)):(s=l.lastIndexOf(" ")+1)<(i=l.lastIndexOf("/"))&&(c=l.substring(s,i),u=l.substring(i+1),c.toLowerCase()===c.toUpperCase()&&(c=e.navigator.appName)),-1!==(n=u.indexOf(";"))&&(u=u.substring(0,n)),-1!==(n=u.indexOf(" "))&&(u=u.substring(0,n)),-1!==(n=u.indexOf(")"))&&(u=u.substring(0,n));let d=parseInt(u,10);isNaN(d)&&(u=String(parseFloat(h)),d=parseInt(h,10));let p=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(h),f=e.navigator.cookieEnabled||!1;void 0!==navigator.cookieEnabled||f||(e.document.cookie="testcookie",f=-1!==e.document.cookie.indexOf("testcookie"));let g="-";for(let e of[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Chrome OS",r:/CrOS/},{s:"Linux",r:/(Linux|X11(?!.*CrOS))/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}])if(e.r.test(l)){g=e.s;break}let m="-";if(/Windows/.test(g)){let s=/Windows (.*)/.exec(g);if(s&&s[1]&&"10"===(m=s[1])&&"userAgentData"in e.navigator){let e=navigator;e.userAgentData&&e.userAgentData.getHighEntropyValues(["platformVersion"]).then(e=>{let s=13>parseInt(e.platformVersion.split(".")[0],10)?"10":"11";m=s,t?.(s)}).catch(()=>{})}g="Windows"}switch(g){case"Mac OS":case"Mac OS X":case"Android":{let e=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([\.\_\d]+)/.exec(l);m=e&&e[1]?e[1]:"-";break}case"iOS":{let e=/OS (\d+)_(\d+)_?(\d+)?/.exec(h);e&&e[1]&&(m=`${e[1]}.${e[2]}.${parseInt(e[3]||"0",10)}`)}}return{screen:o,width:r,height:a,browser:c,browserVersion:u,browserMajorVersion:d,mobile:p,os:g,osVersion:m,cookies:f}}(sg,e=>{this.osVersion=e}),c=this.sessionStorage.getItem(sf);c&&(this.user_id=c),this.os=o,this.osVersion=h,this.browser=`${n}`,this.browserVersion=`${r} (${a})`,this.platform=l?"mobile":"desktop",this.screenHeight=i,this.screenWidth=s,this.initialReferrer=this.getReferrer(),this.deviceId=this.getDistinctDeviceId(),this.searchEngine=this.getSearchEngine(this.initialReferrer),this.parseUTM()}get all(){return{os:this.os,os_version:this.osVersion,browser:this.browser,browser_version:this.browserVersion,platform:this.platform,screen_height:this.screenHeight,screen_width:this.screenWidth,initial_referrer:this.initialReferrer,utm_source:this.utmSource,utm_medium:this.utmMedium,utm_campaign:this.utmCampaign,user_id:this.user_id,distinct_id:this.deviceId,sdk_edition:"web",sdk_version:"18.1.3",timezone:function(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)).toString().padStart(2,"0"),s=Math.abs(e%60).toString().padStart(2,"0");return`UTC${e<=0?"+":"-"}${t}:${s}`}(),search_engine:this.searchEngine}}get defaultPropertyKeys(){return Object.keys(this.all)}get distinctId(){return this.deviceId}}let sv={identity:"identity",deleteUser:"delete_user",setProperty:"set_property",setPropertyOnce:"set_property_once",appendProperty:"append_property",appendUniqueProperty:"append_unique_property",incrementProperty:"increment_property"},sS={people:"user_actions",events:"events"},sw=(e,t,s,i)=>{if(e===sS.people)return{category:e,data:{type:t,user_id:i.user_id,payload:i.properties,timestamp:s}};if(!i)throw Error("Payload is required for event creation");return{category:e,data:{name:i.name,payload:i.properties,timestamp:s}}},sk=["properties","token","timestamp"];class sT{constructor(e,t,s){this.constantProperties=e,this.getTimestamp=t,this.batcher=s,this.ownProperties={},this.sendEvent=(e,t,s)=>{let i={};if(t){if(!sl(t))throw Error("Properties must be an object");Object.entries(t).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||(i[e]=t)})}let n={name:e,properties:{...this.ownProperties,...i}},r=sw(sS.events,void 0,this.getTimestamp(),n);s?.send_immediately?this.batcher.sendImmediately(r):this.batcher.addEvent(r)},this.setProperty=(e,t)=>{let s=!1;sl(e)&&Object.entries(e).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||(this.ownProperties[e]=t,s=!0)}),"string"!=typeof e||void 0===t||this.constantProperties.defaultPropertyKeys.includes(e)||(this.ownProperties[e]=t,s=!0),s&&this.constantProperties.saveSuperProperties(this.ownProperties)},this.setPropertiesOnce=(e,t)=>{let s=!1;sl(e)&&Object.entries(e).forEach(([e,t])=>{this.ownProperties[e]||sk.includes(e)||(this.ownProperties[e]=t,s=!0)}),"string"!=typeof e||void 0===t||this.ownProperties[e]||sk.includes(e)||(this.ownProperties[e]=t,s=!0),s&&this.constantProperties.saveSuperProperties(this.ownProperties)},this.unsetProperties=e=>{let t=!1;
9Array.isArray(e)?e.forEach(e=>{this.ownProperties[e]&&!sk.includes(e)&&(delete this.ownProperties[e],t=!0)}):this.ownProperties[e]&&!sk.includes(e)&&(delete this.ownProperties[e],t=!0),t&&this.constantProperties.saveSuperProperties(this.ownProperties)},this.reset=()=>{this.ownProperties={},this.constantProperties.clearSuperProperties()},this.register=this.setProperty,this.register_once=this.setPropertiesOnce,this.unregister=this.unsetProperties,this.track=this.sendEvent,this.ownProperties=this.constantProperties.getSuperProperties()}}class sI{constructor(e,t,s,i){this.constantProperties=e,this.getTimestamp=t,this.onId=s,this.batcher=i,this.ownProperties={},this.identify=(e,t)=>{if(!e||"string"!=typeof e)throw Error("OR SDK: user_id (string) is required for .identify()");this.constantProperties.user_id&&this.constantProperties.user_id!==e&&this.reset(),this.constantProperties.setUserId(e),t?.fromTracker||this.onId(e);let s=sw(sS.people,sv.identity,this.getTimestamp(),{user_id:e});this.batcher.addEvent(s)},this.reset=e=>{this.constantProperties.resetUserId(e),this.ownProperties={}},this.deleteUser=()=>{let e=this.constantProperties.user_id;if(!e)return;this.constantProperties.setUserId(null),this.ownProperties={};let t=sw(sS.people,sv.deleteUser,void 0,{user_id:e});this.batcher.addEvent(t),this.reset()},this.setProperties=(e,t)=>{if(!e)throw Error("OR SDK: no user properties provided to set");let s={};if("string"==typeof e&&e&&t)s[e]=t;else if(sl(e))Object.assign(s,e);else throw Error("OR SDK: invalid user properties provided to set");Object.entries(s).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||(this.ownProperties[e]=t)});let i=sw(sS.people,sv.setProperty,void 0,{user_id:this.user_id,properties:s});this.batcher.addEvent(i)},this.setPropertiesOnce=e=>{if(!sl(e))throw Error("Properties must be an object");Object.entries(e).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||this.ownProperties[e]||(this.ownProperties[e]=t)});let t=sw(sS.people,sv.setPropertyOnce,void 0,{user_id:this.user_id,properties:e});this.batcher.addEvent(t)},this.appendValues=(e,t)=>{!this.constantProperties.defaultPropertyKeys.includes(e)&&this.ownProperties[e]&&(Array.isArray(this.ownProperties[e])?this.ownProperties[e].push(t):this.ownProperties[e]=[this.ownProperties[e],t]);let s=sw(sS.people,sv.appendProperty,void 0,{properties:{[e]:t},user_id:this.user_id});this.batcher.addEvent(s)},this.appendUniqueValues=(e,t)=>{if(!this.ownProperties[e])return;Array.isArray(this.ownProperties[e])?this.ownProperties[e].includes(t)||this.appendValues(e,t):this.ownProperties[e]!==t&&this.appendValues(e,t);let s=sw(sS.people,sv.appendUniqueProperty,void 0,{properties:{[e]:t},user_id:this.user_id});this.batcher.addEvent(s)},this.increment=(e,t)=>{if(this.ownProperties[e]||(this.ownProperties[e]=0),this.ownProperties[e]&&"number"!=typeof this.ownProperties[e])throw Error("OR SDK: Property must be a number to increment");this.ownProperties[e]+=t;let s=sw(sS.people,sv.incrementProperty,void 0,{user_id:this.user_id,properties:{[e]:t}});this.batcher.addEvent(s)},this.union=this.appendUniqueValues,this.set=this.setProperties,this.set_once=this.setPropertiesOnce,this.append=this.appendValues,this.incrementBy=this.increment}get user_id(){return this.constantProperties.user_id}}class s_{constructor(e,t,s,i){this.backendUrl=e,this.getToken=t,this.init=s,this.standalone=i,this.autosendInterval=5e3,this.retryTimeout=3e3,this.retryLimit=3,this.apiEdp="/v1/sdk/i",this.batch={[sS.people]:[],[sS.events]:[]},this.intervalId=null,this.stopped=!1,this.paused=!1,this.onVisibilityChange=()=>{document.hidden?(this.flush(!0),this.paused=!0):this.paused=!1}}getBatches(){return this.batch[sS.people]=this.dedupePeopleEvents(),{data:{[sS.people]:[...this.batch[sS.people]],[sS.events]:[...this.batch[sS.events]]}}}addEvent(e){this.batch[e.category].push(e.data)}sendImmediately(e){this.sendBatch({[e.category]:[e.data]})}dedupePeopleEvents(){let e=this.batch[sS.people],t=[],s=[];for(let i of e)"identity"===i.type?s.length>0?(t.push(...this.squashPeopleEvents(s),i),s.length=0):t.push(i):s.push(i);return s.length>0&&t.push(...this.squashPeopleEvents(s)),t}squashPeopleEvents(e){if(!e||0===e.length)return[];let t=new Map;for(let s of e){let e=t.get(s.type);if(e){if("increment_property"===s.type){let i=Object.entries(e.payload),n=Object.entries(s.payload),r=new Set([...i.map(([e])=>e),...n.map(([e])=>e)]),a={};r.forEach(t=>{let i="number"==typeof e.payload[t]?e.payload[t]:0,n="number"==typeof s.payload[t]?s.payload[t]:0;a[t]=i+n}),t.set(s.type,{type:s.type,timestamp:s.timestamp,payload:a});continue}t.set(s.type,{type:s.type,timestamp:s.timestamp,payload:{...e.payload??{},...s.payload??{}}})}else t.set(s.type,s)}return Array.from(t.values())}
9sendBatch(e,t=!1,s){if(this.stopped){s?.();return}let i=0,n=()=>{let r=this.getToken();if(!r){s?.();return}return i++,fetch(`${this.backendUrl}${this.apiEdp}`,{method:"POST",keepalive:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify(e)}).then(async e=>{if(401===e.status){let t=await e.json().catch(()=>null);if(!this.standalone&&t?.error==="token expired"){this.stop();return}return i<this.retryLimit?this.init().then(()=>{n()}):void s?.()}if(403===e.status)return i<this.retryLimit?this.init().then(()=>{n()}):void s?.();if(!e.ok)throw Error(`HTTP error! status: ${e.status}`)}).catch(()=>{i<this.retryLimit?setTimeout(()=>void n(),this.retryTimeout):s?.()})};n()}startAutosend(){this.intervalId&&clearInterval(this.intervalId),this.paused=document.hidden,document.addEventListener("visibilitychange",this.onVisibilityChange),this.intervalId=setInterval(()=>{this.paused||this.flush()},this.autosendInterval)}flush(e=!1){let t=Object.keys(this.batch);if(t.every(e=>0===this.batch[e].length))return;let s=this.getBatches(),i={[sS.people]:[...s.data[sS.people]],[sS.events]:[...s.data[sS.events]]};t.forEach(e=>{this.batch[e]=[]}),this.sendBatch(s,e,()=>this.requeue(i))}requeue(e){this.stopped||(this.batch[sS.people]=[...e[sS.people],...this.batch[sS.people]],this.batch[sS.events]=[...e[sS.events],...this.batch[sS.events]])}stop(){this.flush(),this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),document.removeEventListener("visibilitychange",this.onVisibilityChange),this.stopped=!0}restart(){this.stopped=!1,this.startAutosend()}}let sE="__or_sdk_analytics_token";class sO{constructor(e){this.token=null,this.standalone=!1,this._getToken=()=>this.standalone?this.token:this.getToken(),this._getTimestamp=()=>this.standalone?Date.now():this.getTimestamp(),this.init=async()=>{if(this.standalone){let e=this.constantProperties.all,t={projectKey:this.projectKey,defaultFields:e},s=await fetch("/v1/sdk/start",{method:"POST",body:JSON.stringify(t)});if(!s.ok)throw Error(`HTTP error! status: ${s.status}`);let i=await s.json();if(i.token)this.token=i.token,this.sessionStorage.setItem(sE,i.token);else throw Error("No token received from server")}else{this.batcher.startAutosend();return}},this.onStart=()=>{this.standalone||this.batcher.restart()},this.onStop=()=>{this.standalone||this.batcher.stop()},this.reset=()=>{this.people.reset(!0),this.events.reset(),this.batcher.stop(),this.standalone&&(this.token=null,this.sessionStorage.setItem(sE,""))},this.identify=e=>this.people.identify(e),this.track=(e,t,s)=>this.events.track(e,t,s),this.sessionStorage=e.sessionStorage||sessionStorage,this.localStorage=e.localStorage||localStorage,this.backendUrl=e.ingestPoint,this.projectKey=e.projectKey,this.getToken=e.getToken||(()=>""),this.getTimestamp=e.getTimestamp||(()=>Date.now()),this.setUserId=e.setUserId||(()=>{}),this.standalone=!e.notStandalone,this.token=this.sessionStorage.getItem(sE),this.constantProperties=new sb(this.localStorage,this.sessionStorage),this.batcher=new s_(this.backendUrl,this._getToken,this.init,this.standalone),this.events=new sT(this.constantProperties,this._getTimestamp,this.batcher),this.people=new sI(this.constantProperties,this._getTimestamp,this.setUserId,this.batcher),e.notStandalone&&this.init()}}let sC="/en/sdk",sN=()=>{try{return!!window.top?.document}catch{return!1}};class sM{constructor(e){if(this.options=e,this.app=null,this.analytics=null,this.crossdomainMode=!1,this.checkDoNotTrack=()=>this.options.respectDoNotTrack&&("1"==navigator.doNotTrack||"1"==window.doNotTrack),this.signalStartIssue=(e,t)=>{let s=this.checkDoNotTrack();console.log("Tracker couldn't start due to:",JSON.stringify({trackerVersion:"18.1.3",projectKey:this.options.projectKey,doNotTrack:s,reason:t.length?`missing api: ${t.join(",")}`:e}))},this.restartCanvasTracking=()=>{null!==this.app&&this.app.restartCanvasTracking()},this.resanitize=e=>{null!==this.app&&this.app.resanitize(e)},this.checkSanitization=e=>{if(null!==this.app)return this.app.checkSanitization(e)},this.getSessionURL=e=>{if(null!==this.app)return this.app.getSessionURL(e)},this.setUserID=e=>{"string"==typeof e&&null!==this.app&&(this.app.session.setUserID(e),this.analytics?.people.identify(e,{fromTracker:!0}))},this.identify=this.setUserID,this.track=(e,t,s)=>this.analytics?.track(e,t,s),this.userID=e=>{_("'userID' method","'setUserID' method","/"),this.setUserID(e)},this.handleError=(e,t={})=>
9{if(null!==this.app){if(e instanceof Error){let s=eY(e,[],t);this.app.send(s)}else if(e instanceof ErrorEvent||"PromiseRejectionEvent"in window&&e instanceof PromiseRejectionEvent){let s=eZ(e,void 0,t);null!=s&&this.app.send(s)}}},this.incident=e=>{if(null!==this.app){var t;this.app.send((t=e.label??"",[87,t,e.startTime,e.endTime??e.startTime]))}},this.analyticsToken=null,this.setAnalyticsToken=e=>{this.analyticsToken=e},this.getAnalyticsToken=()=>this.analyticsToken?this.analyticsToken:this.app?.session.getSessionToken()??"",this.crossdomainMode=!!(D()&&e.crossdomain?.enabled),!g||!function(e){if(null==e)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${T}${sC}`),!1;if("string"!=typeof e.projectKey){if("number"!=typeof e.projectKey){if("number"!=typeof e.projectID)return console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${T}${sC} for more information.`),!1;e.projectKey=e.projectID.toString(),_("`projectID` option","`projectKey` option",sC)}else console.warn("OpenReplay: projectKey is expected to have a string type."),e.projectKey=e.projectKey.toString()}return null!=e.sessionToken&&_("`sessionToken` option","`sessionHash` start() option","/"),!0}(e))return;if(window.__OPENREPLAY__||!this.crossdomainMode&&D()&&sN()&&window.top.__OPENREPLAY__){console.error("OpenReplay: one tracker instance has been initialised already");return}if(!e.__DISABLE_SECURE_MODE&&"https:"!==location.protocol){console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");return}let t=this.checkDoNotTrack(),s=[];if(t)s.push("doNotTrack");else for(let e of["Map","Set","MutationObserver","performance","timing","startsWith","Blob","Worker"])if("timing"===e){if("performance"in window&&!(e in performance)){s.push(e);break}}else if("startsWith"===e){if(!(e in String.prototype)){s.push(e);break}}else if(!(e in window)){s.push(e);break}if(s.length>0){let e=s.join(",");console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${e}`),this.signalStartIssue("missing_api",s);return}let i=new eH(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);if(this.app=i,e.projectKey&&e.analytics?.active){let t=!1;e.ingestPoint||(t=!0),e.ingestPoint&&"api.openreplay.com"===new URL(e.ingestPoint).hostname&&(t=!0);let s="https://api.openreplay.com/ingest";this.analytics=new sO({localStorage:e.localStorage??localStorage,sessionStorage:e.sessionStorage??sessionStorage,getToken:()=>this.getAnalyticsToken(),getTimestamp:()=>this.app?.timestamp()??Date.now(),setUserId:e=>{this.app?.session.setUserID(e)},notStandalone:!0,ingestPoint:t?s:e.analytics?.ingestPoint??e.ingestPoint??s,projectKey:e.projectKey}),i.attachStartCallback(()=>{this.analytics?.onStart()}),i.attachStopCallback(()=>{this.analytics?.onStop()})}this.crossdomainMode||(function(e,t){let s,i,n,r;let a=document.referrer,o=t?.urlSanitizer||tW,h=t?.titleSanitizer||(e=>e),l=e.safe(()=>{let i=document.URL;if(i!==s){if(s=i,t?.replaceHashSymbol){let e=new URL(i),t=e.hash.startsWith("#/")?e.hash.slice(2):"",n=t?"/"+t.replace(/^\/+/,""):"";s=e.origin+e.pathname.replace(/\/$/,"")+n+e.search}let n=o(s),l=e.sanitizer.privateMode?ey(document.title):h(document.title),c=e.sanitizer.privateMode?ey(n):n,u=e.sanitizer.privateMode?ey(a):a;e.send([122,c,u,r,l]),r=0,a=s}}),c=e.safe(()=>{let{innerWidth:t,innerHeight:s}=window;(t!==i||s!==n)&&(i=t,n=s,e.send([5,i,n]))}),u=void 0===document.hidden?Function.prototype:e.safe(()=>e.send([55,document.hidden]));e.attachStartCallback(()=>{s=null,r=y,i=n=-1,l(),c(),u()}),void 0!==document.hidden&&e.attachEventListener(document,"visibilitychange",u,!1,!1),e.ticker.attach(l,1,!1),e.ticker.attach(c,5,!1)}(i,e.urls),function(e){let t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(void 0===t)return;let s=()=>{e.send([54,Math.round(1e3*t.downlink),t.effectiveType||"unknown"])};e.attachStartCallback(()=>{s(),t.addEventListener("change",s)}),e.attachStopCallback(()=>{t.removeEventListener("change",s)})}(i),function(e,t){if(!Object.assign({capturePerformance:!0},t).capturePerformance)return;let s=g&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,i=g&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,n=!1,r=0,a=0,o=null,h=!1,l=()=>{o=null,n&&-1!==r&&(r++,h||c())},c=()=>{s&&null===o&&(h=!0,o=s(l),h=!1)},u=()=>{null!==o&&i&&i(o),o=null};e.ticker.attach(()=>{n&&-1!==a&&a++},0,!1);let d=()=>
9{if(n)e.send([49,r,a,W.memory.totalJSHeapSize||0,W.memory.usedJSHeapSize||0]),document.hidden?r=a=-1:(r=a=0,c())};e.attachStartCallback(()=>{n=!0,r=a=-1,d()}),e.attachStopCallback(()=>{n=!1,r=a=0,u()}),e.ticker.attach(d,165,!1),void 0!==document.hidden&&e.attachEventListener(document,"visibilitychange",d,!1,!1)}(i,e),function(e){function t(){document.hidden||(e.debug.log("Openreplay: tab change to"+e.session.getTabId()),e.send(z(e.session.getTabId())))}e.attachStartCallback(()=>{t()}),e.attachEventListener(window,"focus",t,!1,!1)}(i)),function(e,t){let s;let{disableClickmaps:i=!1,customAttributes:n}=t||{},r=-1,a=-1,o=!1,h=null,l=0,c={},u=0,d=0,p=0,f=0;e.attachStartCallback(()=>{s=setInterval(()=>(function(){let t=f/225;if(!u){u=t;return}let s=(t-u)/225;p>4&&s>.008&&e.send([114,v()]),f=0,p=0,u=t})(),225)}),e.attachStopCallback(()=>{r=-1,a=-1,o=!1,h=null,c={},s&&clearInterval(s)});let g=()=>{o&&(e.send([20,r,a]),o=!1)},m=(t,s=!1)=>{let u=s?e.attachEventListener.bind(e):e.nodes.attachNodeListener.bind(e.nodes);u(t.documentElement,"mouseover",e=>{let s=e9(e.target,t);s!==h&&(h=s,l=performance.now())}),u(t,"mousemove",s=>{let[i,n]=e.observer.getDocumentOffset(t);r=s.clientX+i,a=s.clientY+n,o=!0;let h=Math.sign(s.movementX);f+=Math.abs(s.movementX)+Math.abs(s.movementY),h!==d&&(d=h,p++)},!1),u(t,"click",s=>{let r=e9(s.target,t);if(!s.clientX&&!s.clientY||null===r)return;let a=e.nodes.getID(r);if(void 0!==a){var o,u,d;let p=s.pageX,f=s.pageY,m=t.documentElement.scrollWidth,y=t.documentElement.scrollHeight,b=te(p/m),v=te(f/y);g();let S=function(t){let s=C(t);if(null!==s)return s;if(ei(t,"input"))return e5(t,n);let i=E(t,n);if(i)return i;if(t.id)return`#${t.id}`;let r=O(t);if(r)return r;if(e7(t)){let s="";return t instanceof HTMLElement&&(s=e.sanitizer.getInnerTextSecure(t)),w(s).slice(0,100)}return""}(r);e.send((o=h===r?Math.round(performance.now()-l):0,u=e.sanitizer.privateMode?S.replaceAll(/./g,"*"):S,d=e7(r)&&!i?function(t,s){if(c[t])return c[t];let i=e.tagMatcher.match(s);return i?c[t]=i.selector:c[t]=function(e){if(!e||1!==e.nodeType)return!1;if(e.id)return`#${e8(e.id)}`;let t=Array.from(e.attributes).find(e=>e.name.startsWith("data-"));if(t)return`[${t.name}="${e8(t.value)}"]`;let s=[];for(;e&&1===e.nodeType&&e!==e.ownerDocument;){if(e.id){s.unshift(`#${e8(e.id)}`);break}let t=e.tagName.toLowerCase();if(e.classList?.length){for(let i of e.classList)if(ts(i)&&tt(i,e.ownerDocument))return s.unshift(`${t}.${e8(i)}`),s.join(" > ")}let i=function(e){if(!e.classList?.length||!e.parentNode)return null;let t=e.parentNode.children;e:for(let s of e.classList)if(ts(s)&&tt(s,e.ownerDocument)){for(let i of t)if(i!==e&&i.classList?.contains(s))continue e;return s}return null}(e);if(i)s.unshift(`${t}.${e8(i)}`);else if(e===e.ownerDocument.body||e===e.ownerDocument.documentElement)s.unshift(t);else{let i=1;for(let s=e.previousElementSibling;s;s=s.previousElementSibling)s.tagName.toLowerCase()===t&&i++;s.unshift(`${t}:nth-of-type(${i})`)}e=e.parentNode}return s.join(" > ")}(s)||""}(a,r):"",[68,a,o,u,d,b,v]),!0)}h=null})};e.nodes.attachNodeCallback(e=>{et(e)&&m(e)}),m(document,!0),e.ticker.attach(g,t?.trackingOffset||7)}(i,{...e.mouse,customAttributes:e.customAttributes}),function(e,t){let s=!1,i=new Map;function n(e){G(e)&&(Z(e)&&i.set(e,[e.scrollLeft,e.scrollTop]),et(e)&&i.set(e,tH(e)))}let r=e.safe(()=>{t||e.send(function(e,t){return[6,e,t]}(...tH(document)))}),a=e.safe((t,s)=>{let i=e.nodes.getID(s);void 0!==i&&e.send([16,i,t[0],t[1]])});e.attachStartCallback(r),e.attachStopCallback(()=>{s=!1,i.clear()}),e.nodes.attachNodeCallback((t,s)=>{s&&(Z(t)&&t.scrollLeft+t.scrollTop>0?i.set(t,[t.scrollLeft,t.scrollTop]):et(t)&&i.set(t,tH(t))),es(t)&&e.nodes.attachNodeListener(t,"scroll",e=>{n(e.target)})}),e.attachEventListener(document,"scroll",e=>{let t=e.target;if(t===document){s=!0;return}n(t)}),e.ticker.attach(()=>{s&&(r(),s=!1),i.forEach(a),i.clear()},5,!1)}(i,this.crossdomainMode),function(e,t){if(null===e)return;if(!window.CSSStyleSheet){e.send([63,"no_stylesheet_prototype_in_window",""]);return}let s={...tF,...t},i=new Map,n=null,r=new Set,a=s.checkCssInterval||200,o={};function h(){if(s.scanInMemoryCSS)for(let n of r.values())try{let a=em.get(n);if(!a)continue;if(s.checkLimit&&(o[a]=(o[a]??0)+1,o[a]>s.checkLimit)){r.delete(n);continue}for(let s=0;s<n.cssRules.length;s++)try{var t;let r=n.cssRules[s],o=`${a}:${s}`,h=i.get(o),l=r.cssText;h!==l&&(void 0!==h&&e.send((t=s,[75,a,t])),e.send(j(a,l,s,e.getBaseHref())),i.set(o,l))}catch(e){}for(let e of Array.from(i.keys()).filter(e=>e.startsWith(`${a}:`)))parseInt(e.split(":")[1],10)>=n.cssRules.length&&i.delete(e)}catch(e){r.delete(n)}}let l=/{\s*}/,c=e.safe((t,s,n)=>{let a=em.get(t);a&&("string"==typeof n?(e.send(j(a,n,s,e.getBaseHref())),l.test(n)&&(i.set(`${a}:${s}`,n),r.add(t))):(e.send([75,a,s]),i.has(`${a}:${s}`)&&i.delete(`${a}:${s}`)))}),u=e.safe(t=>{let s=t;for(;s.parentRule;)s=s.parentRule;let n=s.parentStyleSheet;if(!n)return;let a=em.get(n);if(!a)return;let o=s.cssText,h=Array.from(n.cssRules).indexOf(s);h>=0&&(e.send(j(a,o,h,e.getBaseHref())),e.send([75,a,h+1]),l.test(o)&&(i.set(`${a}:${h}`,o),r.add(n)))}),d=e.safe(e=>{if(e.__css_tracking_patched__)return;e.__css_tracking_patched__=!0;let{insertRule:t,deleteRule:s}=e.CSSStyleSheet.prototype,{insertRule:i,deleteRule:n}=e.CSSGroupingRule.prototype;e.CSSStyleSheet.prototype.insertRule=function(e,s=0){let i=t.call(this,e,s);return c(this,i,e),i},e.CSSStyleSheet.prototype.deleteRule=function(e){return c(this,e),s.call(this,e)},e.CSSGroupingRule.prototype.insertRule=function(e,t=0){let s=i.call(this,e,t);return u(this),s},e.CSSGroupingRule.prototype.deleteRule=function(e){let t=n.call(this,e);return u(this),t}});d(window),e.observer.attachContextCallback(d),e.nodes.attachNodeCallback(t=>{let s;
9if(!ei(t,"style")||!t.sheet||null!==t.textContent&&t.textContent.trim().length>0)return;let i=e.nodes.getID(t);if(!i)return;let n=t.sheet;try{s=n.cssRules}catch(t){e.debug.log("Couldnt access stylesheet during initial scan",t);return}let r=eg();em.set(n,r),e.send([76,r,i]);for(let t=0;t<s.length;t++)try{c(n,t,s[t].cssText)}catch(t){e.debug.log("Couldnt access stylesheet rule during initial scan",t)}}),setTimeout(function(){!n&&s.scanInMemoryCSS&&(n=window.setInterval(h,a))},50),e.attachStopCallback(()=>{n&&(clearInterval(n),n=null),i.clear()})}(i,e.css),function(e){if(null===e||!ep(document))return;let t=new Map,s=s=>setTimeout(()=>{let i=e.nodes.getID(s);if(s===document&&(i=0),void 0===i)return;let n=t.get(i);n||(n=[]);let r=[],a=s.adoptedStyleSheets;if(a&&Symbol.iterator in a)for(let t of a){let s=em.get(t),a=!s;if(s||(s=eg(),em.set(t,s)),n.includes(s)||e.send([76,s,i]),a)try{let i=t.cssRules;for(let t=0;t<i.length;t++)e.send(j(s,i[t].cssText,t,e.getBaseHref()))}catch(t){e.debug.log("Couldnt access adopted stylesheet",t)}r.push(s)}if(Symbol.iterator in n)for(let t of n)r.includes(t)||e.send([77,t,i]);t.set(i,r)},20);function i(e){let t=Object.getOwnPropertyDescriptor(e,"adoptedStyleSheets");t&&Object.defineProperty(e,"adoptedStyleSheets",{...t,set:function(e){let i=t.set.call(this,e);return s(this),i}})}let n=t=>{if(t.__openreplay_adpss_patched__)return;t.__openreplay_adpss_patched__=!0,i(t.Document.prototype),i(t.ShadowRoot.prototype);let{replace:s,replaceSync:n}=t.CSSStyleSheet.prototype;t.CSSStyleSheet.prototype.replace=function(t){return s.call(this,t).then(s=>{let i=em.get(this);return i&&e.send([71,i,t,e.getBaseHref()]),s})},t.CSSStyleSheet.prototype.replaceSync=function(t){let s=em.get(this);return s&&e.send([71,s,t,e.getBaseHref()]),n.call(this,t)}};n(window),e.observer.attachContextCallback(e.safe(n)),e.attachStopCallback(()=>{em.clear(),t.clear()}),e.attachStartCallback(()=>{s(document)}),e.nodes.attachNodeCallback(e=>{ep(e)&&s(e)})}(i),function(e,t){let s=Object.assign({consoleMethods:eV,consoleThrottling:30},t);if(!Array.isArray(s.consoleMethods)||0===s.consoleMethods.length)return;let i=e.safe((t,s)=>{let i=("string"==typeof s[0]&&s.unshift(s.shift().replace(/%(o|s|f|d|i)/g,(e,t)=>{let i=s.shift();if(void 0===i)return e;switch(t){case"o":return eq(i);case"s":return eF(i);case"f":return"number"!=typeof i?"NaN":i.toString();case"d":case"i":return"number"!=typeof i?"NaN":Math.floor(i).toString();default:return e}})),s.map(eq).join(" "));e.sanitizer.privateMode&&(i=i.replaceAll(/./g,"*")),e.send([22,t,i])}),n=0,r=()=>{n=0};e.attachStartCallback(r),e.ticker.attach(r,33,!1);let a=[],o=(t,r)=>{let o={apply:function(e,t,a){Reflect.apply(e,r,a),(n+=1)>s.consoleThrottling||i(e.name,a)}};s.consoleMethods.forEach(s=>{if(-1===eV.indexOf(s)){e.debug.error(`OpenReplay: unsupported console method "${s}"`);return}let i=r.console[s];t[s]=new Proxy(i,o),a.push(()=>{t[s]=i})})},h=e.safe(e=>o(e.console,e)),l=!1,c=()=>{l||(l=!0,h(window))};c(),e.attachStartCallback(c),e.attachStopCallback(()=>{l=!1,a.forEach(e=>e()),a.length=0}),e.observer.attachContextCallback(h)}(i,e),function(e,t){function s(t){function s(s){let i=eZ(s,t);null!=i&&e.send(i)}try{e.attachEventListener(t,"unhandledrejection",s),e.attachEventListener(t,"error",s)}catch(e){console.error("Error while attaching to error proto contexts",e)}}Object.assign({captureExceptions:!0},t).captureExceptions&&(e.observer.attachContextCallback(s),s(window))}(i,e),function(e){function t(t,s){e.attributeSender.sendSetAttribute(t,"src","https://static.openreplay.com/tracker/placeholder.jpeg");let{width:i,height:n}=s.getBoundingClientRect();s.hasAttribute("width")||e.attributeSender.sendSetAttribute(t,"width",String(i)),s.hasAttribute("height")||e.attributeSender.sendSetAttribute(t,"height",String(n))}let s=function(t,s){let{srcset:i}=s;if(!i)return;let n=i.split(i.match(/,\s+/)?/,\s+/:",").map(e=>e0(e)).join(", ");e.attributeSender.sendSetAttribute(t,"srcset",n)},i=function(s,i){i.src.length>1e5&&t(s,i),e.send([60,s,"src",i.src,e.getBaseHref()])},n=e.safe(function(t){let s=e0(t.src||"");k(s)&&e.send([85,e.timestamp(),0,0,0,0,0,s,"img",0,!1,0,0,0,0,0,0,0])}),r=e.safe(function(r){var a;let o=e.nodes.getID(r);
9void 0!==o&&r.complete&&(0!==r.naturalHeight||0!==r.naturalWidth||(a=r.src,m&&(a.startsWith("data:image/svg+xml")||a.match(/.svg$|/i)))?e.sanitizer.isHidden(o)||e.sanitizer.isObscured(o)?t(o,r):(i(o,r),s(o,r)):n(r))}),a=x(e.safe(t=>{for(let n of t)if("attributes"===n.type){let t=n.target,r=e.nodes.getID(t);if(void 0===r)continue;"src"===n.attributeName&&i(r,t),"srcset"===n.attributeName&&s(r,t)}}),e.options.forceNgOff);e.attachStopCallback(()=>{a.disconnect()}),e.nodes.attachNodeCallback(t=>{ei(t,"img")&&(e.nodes.attachNodeListener(t,"error",()=>n(t)),e.nodes.attachNodeListener(t,"load",()=>r(t)),r(t),a.observe(t,{attributes:!0,attributeFilter:["src","srcset"]}))}),e.attachResanitizeCallback(e=>{ei(e,"img")&&r(e)})}(i),function(e,t){let s=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:e4.Obscured,obscureInputDates:!1},t),i=new Map;function n(t,i){let n=i.value,r=s.defaultInputMode;"password"===i.type||e.sanitizer.isHidden(t)?r=e4.Hidden:(e.sanitizer.isObscured(t)||r===e4.Plain&&(s.obscureInputNumbers&&"date"!==i.type&&/\d\d\d\d/.test(n)||s.obscureInputDates&&"date"===i.type||s.obscureInputEmails&&("email"===i.type||~n.indexOf("@"))))&&(r=e4.Obscured);let a=0;switch(r){case e4.Hidden:a=-1,n="";break;case e4.Obscured:a=n.length,n=""}return{value:n,mask:a}}function r(t,s){let{value:i,mask:r}=n(t,s);e.send([18,t,i,r])}let a=new Map,o=new Map,h=new Map;function l(e,t){a.get(e)!==t.value&&(a.set(e,t.value),r(e,t))}function c(t,s){o.get(t)!==s&&(o.set(t,s),e.send([19,t,s]))}function u(e,t){h.get(e)!==t.value&&(h.set(e,t.value),r(e,t))}e.attachStopCallback(()=>{a.clear(),o.clear(),h.clear(),i.clear()}),e.ticker.attach(()=>{a.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return a.delete(s);l(s,i)}),o.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return o.delete(s);c(s,i.checked)}),h.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return h.delete(s);u(s,i)})},3),e.attachResanitizeCallback((e,t)=>{(e2(e)||ei(e,"select"))&&r(t,e)}),e.nodes.attachNodeCallback(e.safe(t=>{let r=e.nodes.getID(t);if(void 0!==r){if(ei(t,"select")&&(u(r,t),e.nodes.attachNodeListener(t,"change",()=>u(r,t))),e2(t)){l(r,t);let a=0,o=0,h=0;e.nodes.attachNodeListener(t,"focus",()=>{a=v()}),e.nodes.attachNodeListener(t,"input",()=>{0===o&&0!==a&&(o=v()-a)}),e.nodes.attachNodeListener(t,"change",()=>{0!==a&&(h=v()-a),function(t,r,a,o){let{value:h,mask:l}=n(t,r),c=function(t,s){let n=i.get(t);if(void 0!==n)return n;let r=e.tagMatcher.match(s);return r?(i.set(t,r.selector),r.selector):null}(t,r)||e5(r,s.customAttributes);e.sanitizer.privateMode&&(c=c.replaceAll(/./g,"*")),e.send([112,t,h,0!==l,c,a,o])}(r,t,o,h),o=0,h=0,a=0});return}if(function(e){if(!ei(e,"input"))return!1;let t=e.type;return"checkbox"===t||"radio"===t}(t)){c(r,t.checked),e.nodes.attachNodeListener(t,"change",()=>c(r,t.checked));return}}}))}(i,e),function(e,t){let s=Object.assign({captureResourceTimings:!0,capturePageLoadTimings:!0,capturePageRenderTimings:!0,excludedResourceUrls:[]},t);if("PerformanceObserver"in window||(s.captureResourceTimings=!1),!s.captureResourceTimings)return;let i={};function n(t){var n,r,a,o,h,l,c,u,d,p,f,g,m;if(t.duration<0||!k(t.name)||e.isServiceURL(t.name))return;null!==i&&(i[t.name]=t.startTime+t.duration);let b=!1;if(s.excludedResourceUrls?.forEach(e=>{if(t.name.startsWith(e)){b=!0;return}}),b)return;let v=0;v=t.connectEnd&&t.connectEnd>t.domainLookupEnd?Math.max(0,t.requestStart-t.connectEnd):Math.max(0,t.requestStart-t.domainLookupEnd);let S={queueing:t.requestStart-t.fetchStart,dnsLookup:t.domainLookupEnd-t.domainLookupStart,initialConnection:t.connectEnd-t.connectStart,ssl:t.secureConnectionStart>0?t.connectEnd-t.secureConnectionStart:0,ttfb:t.responseStart-t.requestStart,contentDownload:t.responseEnd-t.responseStart,total:t.duration??t.responseEnd-t.startTime,stalled:v},w=s.resourceNameSanitizer?s.resourceNameSanitizer(t.name):t.name,T=t.responseStatus&&304===t.responseStatus||t.deliveryType&&"cache"===t.deliveryType||0===t.transferSize&&t.decodedBodySize>0,I=t.responseStatus&&t.responseStatus>=400?-111:t.decodedBodySize||0;e.send((n=t.startTime+y,r=t.duration,a=S.ttfb,o=t.transferSize>t.encodedBodySize?t.transferSize-t.encodedBodySize:0,h=t.encodedBodySize||0,l=e.s
9anitizer.privateMode?t.name.replaceAll(/./g,"*"):w,c=t.initiatorType,u=t.transferSize,d=S.queueing,p=S.dnsLookup,f=S.initialConnection,g=S.ssl,m=S.contentDownload,[85,n,r,a,o,h,I,l,c,u,T,d,p,f,g,m,S.total,S.stalled]))}let r=new PerformanceObserver(e=>e.getEntries().forEach(n));function a(t){if(e.active())return e.send([124,t.name,String(t.value)])}e.attachStartCallback(function({sessionID:e}){r.observe({type:"resource",buffered:!0}),tI(a),tR(a),tU(a),tz(a)}),e.attachStopCallback(function(){r.disconnect()});let o=0,h=0;if(s.capturePageLoadTimings){let t=!1;e.ticker.attach(()=>{if(!t&&((0===o||0===h)&&performance.getEntriesByType("paint").forEach(e=>{let{name:t,startTime:s}=e;switch(t){case"first-paint":o=s;break;case"first-contentful-paint":h=s}}),performance.timing.loadEventEnd||performance.now()>3e4)){t=!0;let{navigationStart:s,requestStart:i,responseStart:n,responseEnd:r,domContentLoadedEventStart:a,domContentLoadedEventEnd:l,loadEventStart:c,loadEventEnd:u}=performance.timing;e.send([23,i-s||0,n-s||0,r-s||0,a-s||0,l-s||0,c-s||0,u-s||0,o,h])}},30)}if(s.capturePageRenderTimings){let t=0,s=0,n=0,r=null,a=!1;e.ticker.attach(()=>{if(a)return;let l=performance.now();if(null!==i&&l-(t=Math.max.apply(null,Object.keys(i).map(e=>i[e])))>1e3&&(r=function(e){let t=[],s=document.getElementsByTagName("*"),i=/url\(("[^"]*"|'[^']*'|[^)]*)\)/i;for(let n=0;n<s.length;n++){let r=s[n],a="";if(ei(r,"img")&&(a=r.currentSrc||r.src),!a){let e=getComputedStyle(r).getPropertyValue("background-image");if(e){let t=i.exec(e);null!==t&&((a=t[1]).startsWith('"')||a.startsWith("'"))&&(a=a.substr(1,a.length-2))}}if(!a)continue;let o="data:image"===a.substr(0,10)?0:e[a];if(void 0===o)continue;let h=r.getBoundingClientRect(),l=Math.max(h.top,0),c=Math.max(h.left,0),u=Math.min(h.bottom,window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0),d=Math.min(h.right,window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0);if(u<=l||d<=c)continue;let p=(u-l)*(d-c);t.push({time:o,area:p})}return t}(i),i=null),null!==n&&(l-n>50&&(s=l),n=l-s>5e3?null:l),null!==r&&null===n||l>3e4){a=!0,i=null;let l=null===r?0:function(e,t){let s=Math.max(document.documentElement&&document.documentElement.clientWidth||0,window.innerWidth||0)*Math.max(document.documentElement&&document.documentElement.clientHeight||0,window.innerHeight||0)/10,i=s*e;for(let n=0;n<t.length;n++){let{time:r,area:a}=t[n];s+=a,i+=a*(r>e?r:e)}return 0===s?0:i/s}(h||o,r),{domContentLoadedEventEnd:c,navigationStart:u}=performance.timing,d=null===n?Math.max(s,h,c-u||0):0;e.send([24,l,h>t?h:t,d])}})}}(i,e),function(e,t){if(!t.longTasks||!("PerformanceObserver"in window))return;let s=t=>{var s,i,n,r;e.send((s=t.name,i=t.duration,n=t.blockingDuration,r=t.firstUIEventTimestamp,[89,s,i,n,r,t.startTime,JSON.stringify(t.scripts??[])]))},i=new PerformanceObserver(e=>{e.getEntries().forEach(e=>{"long-animation-frame"===e.entryType&&s(e)})});e.attachStartCallback(()=>{performance.getEntriesByType("long-animation-frame").forEach(e=>{s(e)}),i.observe({entryTypes:["long-animation-frame"]})}),e.attachStopCallback(()=>{i.disconnect()})}(i,e),function(e){function t(t){let s=e.nodes.getID(t);void 0!==s&&e.send([58,s])}let s=!1;e.nodes.attachNodeCallback(i=>{ei(i,"body")&&(e.nodes.attachNodeListener(i,"focus",e=>{G(e.target)&&(t(e.target),s=!1)}),e.nodes.attachNodeListener(i,"blur",t=>{null===t.relatedTarget&&(s=!0,setTimeout(()=>{s&&e.send([58,-1])},0))}))}),e.attachStartCallback(()=>{let e=document.activeElement;for(;e&&ei(e,"iframe")&&e.contentDocument;)e=e.contentDocument.activeElement;e&&e!==e.ownerDocument.body&&t(e)},!0)}(i),function(e){if(!window.FontFace)return;let t=new Map,s=s=>{class i extends s.FontFace{constructor(...i){if("string"==typeof i[1]){let n="";i[2]&&e.safe(()=>{n=JSON.stringify(i[2])});let r=[i[0],i[1],n],a=t.get(s.document)||[];a.push(r),t.set(s.document,a);let o=s===window?0:e.nodes.getID(s.document);if(void 0===o)return;e.active()&&e.send(function(e,t,s,i){return[57,e,t,s,i]}(o,...r))}super(...i)}}s.FontFace=i};e.observer.attachContextCallback(s),s(window),e.nodes.attachNodeCallback(e.safe(s=>{if(!et(s))return;let i=t.get(s);if(!i)return;let n=s.defaultView===window?0:e.nodes.getID(s);
9void 0!==n&&i.forEach(t=>{e.send(function(e,t,s,i){return[57,e,t,s,i]}(n,...t))})}))}(i),e.network?.disabled||function(e,t={}){if(t.disabled)return;let s=Object.assign({failuresOnly:!1,ignoreHeaders:["cookie","set-cookie","authorization"],capturePayload:!1,sessionTokenHeader:!1,captureInIframes:!0,axiosInstances:void 0,useProxy:!0},t);!1===s.useProxy&&e.debug.warn("Network module is migrating to proxy api, to gradually migrate and test it set useProxy to true");let i=s.ignoreHeaders,n=Array.isArray(i)?e=>i.includes(e):()=>i,r=!0===s.sessionTokenHeader?"X-OpenReplay-SessionToken":s.sessionTokenHeader;function a(t){if(r){let s=e.getSessionToken();s&&e.safe(t)(r,s)}}function o(t){if((!s.capturePayload||e.sanitizer.privateMode)&&(delete t.request.body,delete t.response.body),s.sanitizer){let e=t.response.body;if("string"==typeof e)try{t.response.body=JSON.parse(e)}catch{}return s.sanitizer(t)}return t}function h(t){if(t&&"string"!=typeof t.body)try{t.body=JSON.stringify(t.body)}catch{t.body="<unable to stringify>",e.notify.warn("Openreplay fetch couldn't stringify body:",t.body)}return JSON.stringify(t)}let l=t=>{if(s.useProxy)return function(e,t,s,i,n,r,a={xhr:!0,fetch:!0,beacon:!0},o){var h;if(e){if(a.xhr){let a=sn(e.XMLHttpRequest);a?e.XMLHttpRequest=sr(se.create(t,s,i,n,r,o),a):st("XMLHttpRequest")}if(a.fetch){let a=sn(e.fetch);a?e.fetch=sr(t7.create(t,s,i,n,r,o),a):st("fetch")}if(a.beacon&&(null===(h=e.navigator)||void 0===h?void 0:h.sendBeacon)){let a=sn(e.navigator.sendBeacon);e.navigator.sendBeacon=sr(t4.create(a,t,s,i,n,r),a)}}}(t,!!e.sanitizer.privateMode||s.ignoreHeaders,a,o,t=>{var i,n,r,a,o,h;if(s.failuresOnly&&t.status<400)return;let l=e.sanitizer.privateMode?"************":t.url;e.send((i=t.requestType,n=t.method,r=t.request,a=t.response,o=t.status,h=t.startTime+y,[83,i,n,l,r,a,o,h,t.duration,t.responseSize]))},t=>e.isServiceURL(t),{xhr:!0,fetch:!0,beacon:!0},s.tokenUrlMatcher);let r=t.fetch.bind(t);t.fetch=(t,l={})=>{if(!("string"==typeof t||t instanceof URL)||e.isServiceURL(String(t)))return r(t,l);a(function(e,t){void 0===l.headers&&(l.headers={}),l.headers instanceof Headers?l.headers.append(e,t):Array.isArray(l.headers)?l.headers.push([e,t]):l.headers[e]=t});let c=performance.now();return r(t,l).then(r=>{let a=performance.now()-c;if(s.failuresOnly&&r.status<400)return r;let u=r.clone();return u.text().then(s=>{let r={},d={};if(!0!==i){let e=([e,t])=>{n(e)||(r[e]=t)};l.headers instanceof Headers?l.headers.forEach((t,s)=>e([s,t])):Array.isArray(l.headers)?l.headers.forEach(e):"object"==typeof l.headers&&Object.entries(l.headers).forEach(e),u.headers.forEach((e,t)=>{n(t)||(d[t]=e)})}let p=so(l.method),f=o({url:String(t),method:p,status:u.status,request:{headers:r,body:l.body||null},response:{headers:d,body:s}});if(f){var g,m,b;e.send((g=String(f.url),m=h(f.request),b=h(f.response),[83,"fetch",p,g,m,b,u.status,c+y,a,0]))}}).catch(t=>e.debug.error("Could not process Fetch response:",t)),r})};let l=t.XMLHttpRequest.prototype.open,c=t.XMLHttpRequest.prototype.setRequestHeader,u=t.XMLHttpRequest.prototype.send;s.axiosInstances||(t.XMLHttpRequest.prototype.open=function(t,s){let i=this;a((e,t)=>i.setRequestHeader(e,t));let r=0;return i.addEventListener("loadstart",e=>{r=e.timeStamp}),i.addEventListener("load",e.safe(a=>{let{headers:l,body:c}=sa(i),u=r>0?a.timeStamp-r:0,d=(i.getAllResponseHeaders()||"").trim().split(/[\r\n]+/),p={};d.forEach(function(e){let t=e.split(": "),s=t.shift();n(s)||(p[s]=t.join(": "))});let f=so(t),g=o({url:String(s),method:f,status:i.status,request:{headers:l,body:c||null},response:{headers:p,body:i.response}});if(g){var m,b,v;e.send((m=String(g.url),b=h(g.request),v=h(g.response),[83,"xhr",f,m,b,v,i.status,r+y,u,0]))}})),l.apply(this,arguments)},t.XMLHttpRequest.prototype.send=function(e){return sa(this).body=e,u.apply(this,arguments)},t.XMLHttpRequest.prototype.setRequestHeader=function(e,t){return n(e)||(sa(this).headers[e]=t),c.apply(this,arguments)})};l(window),s.axiosInstances&&s.axiosInstances.forEach(t=>{!function(e,t,s,i,n){function r(t){var r,a,o,h;e.debug.log("Openreplay: capturing axios response data",t);let{headers:l,data:c,method:u,url:d,baseURL:p}=t.config,{data:f,headers:g,status:m,response:b}=t,{data:v,headers:S,status:w}=b||{},k=s.ignoreHeaders,T=Array.isArray(k)?e=>k.includes(e):()=>k;function I(e,t){T(t[0])||(e[t[0]]=t[1])}let _={},E={};l.toJSON?_=l.toJSON():l instanceof Headers?l.forEach((e,t)=>
9I(_,[t,e])):Array.isArray(l)?l.forEach(e=>I(_,e)):"object"==typeof l&&Object.entries(l).forEach(e=>I(_,e));let O=S||g;O.toJSON?E=O.toJSON():O instanceof Headers?O.forEach((e,t)=>I(E,[t,e])):Array.isArray(O)?O.forEach(e=>I(E,e)):"object"==typeof O&&Object.entries(O).forEach(([e,t])=>{T(e)||(E[e]=t)});let C=i({url:d,method:u||"",status:m||w||0,request:{headers:_,body:c},response:{headers:E,body:v||f}});if(!C){e.debug.log("Openreplay: empty request/response info, skipping");return}let N=t.config.__openreplay_timing,M=performance.now()-N;e.debug.log("Openreplay: final req object",C),e.send((r=String(u),a=String(C.url),o=n(C.request),h=n(C.response),[83,"xhr",r,a,o,h,C.status,N+y,M,0]))}e.debug.log("Openreplay: attaching axios spy to instance",t);let a=t.interceptors.request.use(function(t){if(e.debug.log("Openreplay: capturing API request",t),t.__openreplay_timing=performance.now(),s.sessionTokenHeader){let i="string"==typeof s.sessionTokenHeader?s.sessionTokenHeader:"X-OpenReplay-Session-Token",n=e.getSessionToken();n&&t.headers.set(i,n)}return t},function(t){e.debug.log("Openreplay: failed API request, skipping",t)},{synchronous:!0}),o=t.interceptors.response.use(function(e){return s.failuresOnly||r(e),e},function(t){return e.debug.log("Openreplay: capturing API request error",t),null!==t&&"object"==typeof t&&!0===t.isAxiosError&&t.response?r(t.response):t instanceof Error&&e.send(eY(t,[])),Promise.reject(t)},{synchronous:!0});e.attachStopCallback(()=>{t.interceptors.request.eject?.(a),t.interceptors.response.eject?.(o)})}(e,t,s,o,h)}),s.captureInIframes&&e.observer.attachContextCallback(e.safe(l))}(i,e.network),function(e){e.attachEventListener(document,"selectionchange",()=>{let t=document.getSelection();if(null===t||t.isCollapsed)e.send([113,-1,-1,""]);else{let s=e.nodes.getID(t.anchorNode),i=e.nodes.getID(t.focusNode),n=t.toString().replace(/\s+/g," ");s&&i&&e.send([113,s,i,n])}})}(i),function(e,t={}){let{allElements:s=!1}=t,i=new WeakSet,n=new WeakSet;function r(t,s,i){n.has(t)||(n.add(t),t.addEventListener("finish",()=>{let n=t.effect.getKeyframes().at(-1);if(!n||!s||!(s instanceof Element)||!s.isConnected)return;let r=getComputedStyle(s),a=Object.keys(n).filter(e=>!sh.includes(e)),o={};a.forEach(e=>{o[e]=r[e]}),e.send([36,i,JSON.stringify(o)])},{once:!0}))}function a(e,t){e.getAnimations({subtree:!1}).forEach(s=>r(s,e,t))}e.nodes.attachNodeCallback(t=>{if((s||t.nodeName.includes("-"))&&"getAnimations"in t){let s=t.getAnimations({subtree:!1}),n=e.nodes.getID(t);s.length>0&&!i.has(t)&&n&&(i.add(t),a(t,n),t.addEventListener("animationstart",()=>a(t,n)))}});let o=Element.prototype.animate;Element.prototype.animate=function(...t){let s=o.apply(this,t),i=e.nodes.getID(this);return i&&r(s,this,i),s},e.attachStopCallback(()=>{Element.prototype.animate=o,i=new WeakSet,n=new WeakSet})}(i,e.webAnimations),window.__OPENREPLAY__=this;let n=window.open;(e.autoResetOnWindowOpen||e.resetTabOnWindowOpen)&&(i.attachStartCallback(()=>{let t=i.getTabId(),s=i.sessionStorage??window.sessionStorage;window.open=function(...r){return e.autoResetOnWindowOpen&&i.resetNextPageSession(!0),e.resetTabOnWindowOpen&&s.removeItem(e.session_tabid_key||"__openreplay_tabid"),i.resetNextPageSession(!1),s.setItem(e.session_tabid_key||"__openreplay_tabid",t),n.call(window,...r)}}),i.attachStopCallback(()=>{window.open=n}))}use(e){return e(this.app,this.options)}isActive(){return null!==this.app&&this.app.active()}trackWs(e){if(null!==this.app)return this.app.trackWs(e)}start(e){return this.browserEnvCheck()?null===this.app?Promise.reject("Browser doesn't support required api, or doNotTrack is active."):(e?.userID&&(this.app.session.setUserID(e.userID),this.analytics?.people.identify(e.userID,{fromTracker:!0})),this.app.start(e)):Promise.reject("Trying to start not in browser.")}browserEnvCheck(){return!!g||(console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${T}${sC}`),!1)}coldStart(e,t){return this.browserEnvCheck()?null===this.app?Promise.reject("Tracker not initialized"):void this.app.coldStart(e,t):Promise.reject("Trying to start not in browser.")}startOfflineRecording(e,t){return this.browserEnvCheck()?null===this.app?Promise.reject("Tracker not initialized"):this.app.offlineRecording(e,t):Promise.reject("Trying to start not in browser.")}uploadOfflineRecording(){if(null!==this.app)return this.app.uploadOfflineRecording()}stop(){if(null!==this.app)return this.app.stop(),this.app.session.getSessionHash()}forceFlushBatch(){null!==this.app&&this.app.forceFlushBatch()}getSessionToken(){return null===this.app?null:this.app.getSessionToken()}getSessionInfo(){return null===this.app?null:this.app.session.getInfo()}getSessionID(){return null===this.app?null:this.app.getSessionID()}getTabId(){return null===this.app?null:this.app.getTabId()}sessionID(){return _("'sessionID' method","'getSessionID' method","/"),this.get
9SessionID()}setUserAnonymousID(e){"string"==typeof e&&null!==this.app&&this.app.send([29,e])}userAnonymousID(e){_("'userAnonymousID' method","'setUserAnonymousID' method","/"),this.setUserAnonymousID(e)}setMetadata(e,t){"string"==typeof e&&"string"==typeof t&&null!==this.app&&this.app.session.setMetadata(e,t)}metadata(e,t){_("'metadata' method","'setMetadata' method","/"),this.setMetadata(e,t)}event(e,t=null,s=!1){if("string"==typeof e&&null!==this.app){if(s)return this.issue(e,t);if(!t||"string"==typeof t)return this.app.send([27,e,t]);try{if("or_timestamp"in t){let s=this.getSessionInfo()?.timestamp??0;t.or_timestamp-s<0&&console.error(`OpenReplay: event ${e} has or_timestamp (${t.or_timestamp}) before session start (${s}). It will be ignored.`)}t=JSON.stringify(t)}catch(e){}this.app.send([27,e,t])}}issue(e,t=null){if("string"==typeof e&&null!==this.app){try{t=JSON.stringify(t)}catch(e){return}this.app.send([64,e,t])}}}class sA{constructor(){this.instance=null,this.isConfigured=!1,this.setUserID=e=>{g&&this.ensureConfigured()&&this.instance&&this.instance.setUserID(e)},this.identify=this.setUserID,this.track=(e,t,s)=>{g&&this.ensureConfigured()&&this.instance&&this.instance.analytics?.track(e,t,s)}}configure(e){if(g){if(this.isConfigured){console.warn("OpenReplay: Tracker is already configured. You should only call configure once.");return}if(!e.projectKey){console.error("OpenReplay: Missing required projectKey option");return}this.instance=new sM(e),this.isConfigured=!0}}get options(){return this.instance?.options||null}start(e){return g?this.ensureConfigured()&&this.instance?this.instance.start(e).catch(e=>({success:!1,reason:"string"==typeof e?e:String(e)})):Promise.resolve({success:!1,reason:"Tracker not configured"}):Promise.resolve({success:!1,reason:"Not in browser environment"})}stop(){if(g&&this.ensureConfigured()&&this.instance)return this.instance.stop()}get analytics(){return this.instance?.analytics??null}setMetadata(e,t){g&&this.ensureConfigured()&&this.instance&&this.instance.setMetadata(e,t)}getSessionURL(e){if(g&&this.ensureConfigured()&&this.instance)return this.instance.getSessionURL(e)}getSessionID(){return g&&this.ensureConfigured()&&this.instance?this.instance.getSessionID():null}getSessionToken(){return g&&this.ensureConfigured()&&this.instance?this.instance.getSessionToken():null}event(e,t=null,s=!1){g&&this.ensureConfigured()&&this.instance&&this.instance.event(e,t,s)}issue(e,t=null){g&&this.ensureConfigured()&&this.instance&&this.instance.issue(e,t)}handleError(e,t={}){g&&this.ensureConfigured()&&this.instance&&this.instance.handleError(e,t)}restartCanvasTracking(){g&&this.ensureConfigured()&&this.instance&&this.instance.restartCanvasTracking()}setUserAnonymousID(e){g&&this.ensureConfigured()&&this.instance&&this.instance.setUserAnonymousID(e)}isActive(){return!!(g&&this.ensureConfigured())&&!!this.instance&&this.instance.isActive()}getInstance(){return this.ensureConfigured()&&g?this.instance:null}coldStart(e,t){if(g&&this.ensureConfigured()&&this.instance)return this.instance.coldStart(e,t)}trackWs(e){return g&&this.ensureConfigured()&&this.instance?this.instance.trackWs(e):()=>{}}ensureConfigured(){return!!this.isConfigured||!g||(console.warn('OpenReplay: Tracker must be configured before use. Call tracker.configure({projectKey: "your-project-key"}) first.'),!1)}use(e){return g&&this.ensureConfigured()&&this.instance?this.instance.use(e):e(null)}startOfflineRecording(...e){if(g&&this.ensureConfigured()&&this.instance)return this.instance.startOfflineRecording(...e)}uploadOfflineRecording(){if(g&&this.ensureConfigured()&&this.instance)return this.instance.uploadOfflineRecording()}forceFlushBatch(){if(g&&this.ensureConfigured()&&this.instance)return this.instance.forceFlushBatch()}getSessionInfo(){return g&&this.ensureConfigured()&&this.instance?this.instance.getSessionInfo():null}getTabId(){return g&&this.ensureConfigured()&&this.instance?this.instance.getTabId():null}resanitize(e){if(g&&this.ensureConfigured()&&this.instance)return this.instance.resanitize(e)}checkSanitization(e){if(g&&this.ensureConfigured()&&this.instance)return this.instance.checkSanitization(e)}incident(e){g&&this.ensureConfigured()&&this.instance&&this.instance.incident(e)}setAnalyticsToken(e){g&&this.ensureConfigured()&&this.instance&&this.instance.setAnalyticsToken(e)}getAnalyticsToken(){if(g&&this.ensureConfigured()&&this.instance)return this.instance.getAnalyticsToken()}}let sD=new sA}}]);
10//# sourceMappingURL=6f80e5a4.acbd10d6aaec1146.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.