PageSourceSearch

https://fabric.so/_next/static/chunks/fadd51d2.920f9333e99bbaaa.js

js fabric.so collected 2026-10-01 15:12:24 UTC 159,127 bytes, 9 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb8de497-3055-448f-a281-801a989a89d5",e._sentryDebugIdIdentifier="sentry-dbid-bb8de497-3055-448f-a281-801a989a89d5")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3256],{46576:(e,t,s)=>{s.r(t),s.d(t,{Analytics:()=>iE,App:()=>tx,Messages:()=>iC,SanitizeLevel:()=>t7,default:()=>iO,openReplay:()=>iR,tracker:()=>iR});class i{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 n{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 i}applyDict(e){let[t,s]=this.dict.getKey(e);return s&&this.app.send([34,t,e]),t}clear(){this.dict=new i}}
1class r{constructor(e,t){this.app=e,this.startParams=t,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=e=>{let t=a(e);if(t.type)return t},this.durationInt=null}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=o[t.operator];s&&e.find(e=>s(e.key,t.value))&&this.trigger(t.name)})}processDuration(e,t){this.durationInt=setInterval(()=>{performance.now()>e&&this.trigger(t)},1e3),this.app.attachStopCallback(()=>{this.durationInt&&clearInterval(this.durationInt)})}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=o[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=o[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=o[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=o[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=o[e.operator];s&&t.some(t=>s(t,e.value))&&this.trigger(e.name)}
1)}}let o={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},a=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},h={htmlmasked:"hidden",masked:"obscured"},l="u">typeof window,c=l&&navigator.userAgent.match(/firefox|fxios/i),u=l?Date.now()-performance.now():0;function d(){u=Date.now()-performance.now()}let p=l&&performance.now?()=>Math.round(performance.now()+u):()=>Date.now(),f="repeat"in String.prototype?e=>"*".repeat(e.length):e=>e.replace(/./g,"*");function g(e){return e?e.trim().replace(/\s+/g," "):""}function m(e){return e.startsWith("https://")||e.startsWith("http://")}let y="https://docs.openreplay.com",b={};function v(e,t,s="/"){b[e]||(console.warn(`OpenReplay: ${e} is deprecated. ${t?`Please, use ${t} instead.`:""} Visit ${y}${s} for more information.`),b[e]=!0)}function w(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 S(e){return e.classList&&0!==e.classList.length?"."+Array.from(e.classList).join("."):""}function k(e){let t=e.getAttribute("data-openreplay-label");return null!==t||null!==(t=e.getAttribute("data-asayer-label"))&&v('"data-asayer-label" attribute','"data-openreplay-label" attribute',"/"),t}function T(e,t){let s=`data-openreplay-${t}`;return!!e.hasAttribute(s)&&(h[t]&&v(`"${s}" attribute`,`"${h[t]}" attribute`,"/en/sdk/sanitize-data"),!0)}function I(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 _(e){return e.toString(16).padStart(2,"0")}function E(){try{return window.self&&window.top&&window.self!==window.top}catch(e){return!0}}function C(e){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(e):e}function N(e,t){if(t)return new MutationObserver(e);{let t=C("MutationObserver");return new window[t](e)}}function O(e,t,s,i,n){if(!I(e))return;let r="addEventListener";n||(r=C("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 M(e,t,s,i,n){if(!I(e))return;let r="removeEventListener";n||(r=C("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 R{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 D=new R;function x(e){D.addTask(e)}function P(e){return[0,e]}function A(e,t){return[5,e,t]}function L(e,t){return[6,e,t]}function U(){return[7]}function $(e,t,s,i,n){return[8,e,t,s,i,n]}function j(e,t,s){return[9,e,t,s]}function B(e,t,s){return[10,e,t,s]}function W(e){return[11,e]}function H(e,t,s){return[12,e,t,s]}function q(e,t){return[13,e,t]}function z(e,t){return[14,e,t]}function F(e,t,s){return[16,e,t,s]}function K(e,t,s){return[18,e,t,s]}function X(e,t){return[19,e,t]}function V(e,t){return[20,e,t]}function J(e,t){return[22,e,t]}function Q(e,t,s,i,n,r,o,a,h){return[23,e,t,s,i,n,r,o,a,h]}function G(e,t,s){return[24,e,t,s]}function Y(e,t){return[27,e,t]}function Z(e){return[28,e]}function ee(e){return[29,e]}function et(e,t){return[30,e,t]}function es(e,t){return[36,e,t]}function ei(e,t,s,i){return[49,e,t,s,i]}function en(e,t){return[54,e,t]}function er(e){return[55,e]}function eo(e,t,s,i){return[57,e,t,s,i]}function ea(e){return[58,e]}function eh(e,t,s,i){return[60,e,t,s,i]}
1function el(e,t,s){return[61,e,t,s]}function ec(e,t){return[63,e,t]}function eu(e,t){return[64,e,t]}function ed(e,t){return[65,e,t]}function ep(e,t,s,i,n,r){return[68,e,t,s,i,n,r]}function ef(e,t){return[70,e,t]}function eg(e,t,s){return[71,e,t,s]}function em(e,t,s,i){return[73,e,t,s,i]}function ey(e,t){return[75,e,t]}function eb(e,t){return[76,e,t]}function ev(e,t){return[77,e,t]}function ew(e,t,s,i){return[78,e,t,s,i]}function eS(e,t,s,i,n,r,o,a,h){return[83,e,t,s,i,n,r,o,a,h]}function ek(e,t,s,i,n,r){return[84,e,t,s,i,n,r]}function eT(e,t,s,i,n,r,o,a,h,l,c,u,d,p,f,g,m){return[85,e,t,s,i,n,r,o,a,h,l,c,u,d,p,f,g,m]}function eI(e,t,s){return[87,e,t,s]}function e_(e,t,s,i,n,r){return[89,e,t,s,i,n,r]}function eE(e,t,s,i,n,r){return[112,e,t,s,i,n,r]}function eC(e,t,s){return[113,e,t,s]}function eN(e){return[114,e]}function eO(e){return[115,e]}function eM(e){return[117,e]}function eR(e){return[118,e]}function eD(e,t){return[119,e,t]}function ex(e){return[120,e]}function eP(e,t,s,i){return[122,e,t,s,i]}function eA(e,t){return[124,e,t]}var eL,eU,e$=Object.freeze({__proto__:null,AdoptedSSAddOwner:eb,AdoptedSSDeleteRule:ey,AdoptedSSInsertRuleURLBased:em,AdoptedSSRemoveOwner:ev,AdoptedSSReplaceURLBased:eg,BatchMetadata:function(e,t,s,i,n){return[81,e,t,s,i,n]},CanvasNode:eD,ConnectionInformation:en,ConsoleLog:J,CreateDocument:U,CreateElementNode:$,CreateIFrameDocument:ef,CreateTextNode:j,CustomEvent:Y,CustomIssue:eu,GraphQL:function(e,t,s,i,n){return[123,e,t,s,i,n]},GraphQLDeprecated:function(e,t,s,i,n){return[48,e,t,s,i,n]},Incident:eI,InputChange:eE,JSException:ew,LoadFontFace:eo,LongAnimationTask:e_,Metadata:et,MobX:function(e,t){return[46,e,t]},MouseClick:ep,MouseClickDeprecated:function(e,t,s,i){return[69,e,t,s,i]},MouseMove:V,MouseThrashing:eN,MoveNode:B,NetworkRequest:eS,NetworkRequestDeprecated:function(e,t,s,i,n,r,o,a){return[21,e,t,s,i,n,r,o,a]},NgRx:function(e,t,s){return[47,e,t,s]},NodeAnimationResult:es,OTable:function(e,t){return[41,e,t]},PageLoadTiming:Q,PageRenderTiming:G,PartitionedMessage:function(e,t){return[82,e,t]},PerformanceTrack:ei,Profiler:function(e,t,s,i){return[40,e,t,s,i]},Redux:function(e,t,s,i){return[121,e,t,s,i]},ReduxDeprecated:function(e,t,s){return[44,e,t,s]},RemoveNode:W,RemoveNodeAttribute:q,ResourceTiming:eT,ResourceTimingDeprecated:function(e,t,s,i,n,r,o,a,h,l){return[116,e,t,s,i,n,r,o,a,h,l]},ResourceTimingDeprecatedDeprecated:function(e,t,s,i,n,r,o,a){return[53,e,t,s,i,n,r,o,a]},SelectionChange:eC,SetCSSDataURLBased:el,SetInputChecked:X,SetInputTarget:function(e,t){return[17,e,t]},SetInputValue:K,SetNodeAttribute:H,SetNodeAttributeDict:function(e,t,s){return[52,e,t,s]},SetNodeAttributeDictDeprecated:function(e,t,s){return[51,e,t,s]},SetNodeAttributeDictGlobal:function(e,t,s){return[35,e,t,s]},SetNodeAttributeURLBased:eh,SetNodeData:z,SetNodeFocus:ea,SetNodeScroll:F,SetNodeSlot:ed,SetPageLocation:eP,SetPageLocationDeprecated:function(e,t,s){return[4,e,t,s]},SetPageVisibility:er,SetViewportScroll:L,SetViewportSize:A,StateAction:function(e){return[42,e]},StringDict:function(e,t){return[43,e,t]},StringDictDeprecated:function(e,t){return[50,e,t]},StringDictGlobal:function(e,t){return[34,e,t]},TabChange:eM,TabData:eR,TagTrigger:ex,TechnicalInfo:ec,Timestamp:P,UnbindNodes:eO,UserAnonymousID:ee,UserID:Z,Vuex:function(e,t){return[45,e,t]},WSChannel:ek,WebVitals:eA,Zustand:function(e,t){return[79,e,t]}});let ej=l&&"performance"in window&&"memory"in performance?performance:{memory:{}},eB=l?1024*(navigator.deviceMemory||0):0,eW=ej.memory.jsHeapSizeLimit||0,eH="__or__watched_tags__";class eq{constructor(e){this.interval=null,this.tags=[],this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;const t=JSON.parse(e.sessionStorage.getItem(eH)??"[]");this.setTags(t),this.observer=new IntersectionObserver(e=>{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})=>
1{if(e&&e.length){this.setTags(e);let t=JSON.stringify(e);this.sessionStorage.setItem(eH,t||"")}}).catch(e=>this.errLog(e))}setTags(e){this.tags=e,this.interval&&(clearInterval(this.interval),this.interval=null),this.interval=setInterval(()=>{this.tags.forEach(e=>{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){this.tags.findIndex(t=>t.id===e)&&(this.tags=this.tags.filter(t=>t.id!==e)),this.onTag(e)}clear(){this.tags=[],this.interval&&(clearInterval(this.interval),this.interval=null),this.observer.disconnect()}}function ez(e){return!!e&&null!=e.nodeType}function eF(e){return"http://www.w3.org/2000/svg"===e.namespaceURI||"svg"===e.localName}function eK(e){return e.nodeType===Node.ELEMENT_NODE}function eX(e){return e.nodeType===Node.TEXT_NODE}function eV(e){return e.nodeType===Node.DOCUMENT_NODE}function eJ(e){return e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function eQ(e,t){return e.localName===t}class eG{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.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=e=>{let t=this.app.nodes.getID(e);if(!t||!eQ(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=eD(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 o=`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,o,eY[t])}else e.toBlob(r,o,eY[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)},250)}sendSnaps(e,t,s){if(0!==Object.keys(this.snapshots).length){if(this.pendingBatches.length>=this.MAX_QUEUE_SIZE)return void this.app.debug.warn("Upload queue full, dropping canvas batch");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=[];e.forEach(e=>{e.data&&i.push({data:e.data,name:`${s}_${t}_${e.id}.${this.fileExt}`})}),eZ(i,`canvas_${t}_${s}`);return}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 o=new ArrayBuffer(r),a=new DataView(o),h=new Uint8Array(o),l=0;for(let t=0;t<e.length;t++){if(!e[t].data)continue;let s=n.shift(),i=e[t].id;a.setUint32(l,i%0x100000000,!0),a.setUint32(l+4,Math.floor(i/0x100000000),!0),l+=8,a.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([o]),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 eY={low:.35,medium:.55,high:.8};async function eZ(e,t){let s=await e0(e),i=URL.createObjectURL(s),n=document.createElement("a");n.href=i,n.download=`${t}.zip`,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(i)}async function e0(e){let t=[],s=[],i=0;for(let n of e){let e=new TextEncoder().encode(n.name),r=new Uint8Array(await n.data.arrayBuffer()),o=function(e){let t=0xffffffff;for(let s=0;s<e.length;s++){t^=e[s];for(let e=0;e<8;e++)t=t>>>1^(1&t?0xedb88320:0)}return(0xffffffff^t)>>>0}(r),a=new Uint8Array(30+e.length),h=new DataView(a.buffer);h.setUint32(0,0x4034b50,!0),h.setUint16(4,20,!0),h.setUint16(8,0,!0),h.setUint32(14,o,!0),h.setUint32(18,r.length,!0),h.setUint32(22,r.length,!0),h.setUint16(26,e.length,!0),a.set(e,30);let l=new Uint8Array(46+e.length),c=new DataView(l.buffer);c.setUint32(0,0x2014b50,!0),c.setUint16(4,20,!0),c.setUint16(6,20,!0),c.setUint32(16,o,!0),c.setUint32(20,r.length,!0),c.setUint32(24,r.length,!0),c.setUint16(28,e.length,!0),c.setUint32(42,i,!0),l.set(e,46),t.push(a),t.push(r),s.push(l),i+=a.length+r.length}let n=i,r=0;for(let e of s)t.push(e),r+=e.length;let o=new Uint8Array(22),a=new DataView(o.buffer);return a.setUint32(0,0x6054b50,!0),a.setUint16(8,e.length,!0),a.setUint16(10,e.length,!0),a.setUint32(12,r,!0),a.setUint32(16,n,!0),t.push(o),new Blob(t,{type:"application/zip"})}class e1{constructor(e=0){this.shouldLog=e=>this.level>=e,this.info=(...e)=>{this.shouldLog(5)&&console.info(...e)},this.log=(...e)=>{this.shouldLog(4)&&console.log(...e)},this.warn=(...e)=>{this.shouldLog(3)&&console.warn(...e)},this.error=(...e)=>{this.shouldLog(2)&&console.error(...e)},this.level=e}}let e2={interval:3e4,batchSize:2500,enabled:!0};class e3{constructor(e,t,s){this.nodes=e,this.unregisterNode=t,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{var e,t,s;let i;e=this.nodes,t=this.options.batchSize,s=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)},i=e.entries(),function e(){let n=[],r=i.next();for(;!r.done&&n.length<t;)n.push(r.value),r=i.next();n.length>0&&(n.forEach(([e,t])=>{t&&s(t)}),setTimeout(e,50))}()},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval)},this.options={...e2,...s}}}class e5{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;O(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){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})(e,t),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=>M(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 e3(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;return s&&(t=this.nextNodeId,this.totalNodeAmount++,this.nextNodeId++,this.nodes.set(t,e),e[this.node_id]=t),[t,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]}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 e4=99e6;function e8(e){return eJ(e)&&!!e.adoptedStyleSheets}let e6=15;function e7(){return e6++}let e9=new Map,te={},tt={};async function ts(e,t,s){try{let i,n=e.getAttribute("xlink:href")||e.getAttribute("href");if(!n)return void console.debug("Openreplay: xlink:href or href not found on <use>.");let[r,o]=n.split("#");if(!r&&!o)return void console.warn("Openreplay: Invalid xlink:href or href found on <use>.");if(te[o])return te[o];if(!r&&o){let e;e=n.startsWith("#")?`#${CSS.escape(n.substring(1))}`:CSS.escape(n);let t=document.querySelector(e);if(!t)return void console.warn("Openreplay: Sprite symbol not found in the document.");{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 te[o]=e,e}}if(tt[r])1===tt[r]?await new Promise(e=>{let t=0,s=setInterval(()=>{t>100&&(clearInterval(s),e(!1)),1!==tt[r]?(i=tt[r],clearInterval(s),e(!0)):t++},100)}):i=tt[r]??'<svg xmlns="http://www.w3.org/2000/svg"></svg>';else{tt[r]=1;let e=await fetch(r),t=await e.text();i=s.parseFromString(t,"image/svg+xml"),tt[r]=i}let a=i.getElementById(o);if(!a)return console.debug("Openreplay: Symbol not found in SVG."),"";if("svgtext"===t){let e=`
6        <svg xmlns="http://www.w3.org/2000/svg" viewBox="${a.getAttribute("viewBox")||"0 0 24 24"}">
7          ${a.innerHTML}
8        </svg>
9      `;return te[o]=e,e}console.debug(`Openreplay: Unknown mode: ${t}. Use "inline" or "dataurl".`)}catch(e){console.error("Openreplay: Error processing <use> element:",e)}}function ti(e){if(e.nodeType===Node.COMMENT_NODE)return!0;if(eX(e))return!1;if(!eK(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 tn(e){return!!eJ(e)||!ti(e)}(t2=t8||(t8={}))[t2.New=0]="New",t2[t2.Removed=1]="Removed",t2[t2.Changed=2]="Changed";class tr{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.throttling=!0,this.throttledSetNodeData=function(e){let t=new Map,s=new Map,i=new Map,n=function(n,...r){let o=Date.now(),a=30-(o-(t.get(n)??0));if(i.set(n,r),a<=0)s.has(n)&&(clearTimeout(s.get(n)),s.delete(n)),t.set(n,o),e(n,...r);else if(!s.has(n)){let r=setTimeout(()=>{t.set(n,Date.now()),s.delete(n);let r=i.get(n);e(n,...r)},a);s.set(n,r)}};return n.clear=()=>{for(let e of s.values())clearTimeout(e);s.clear(),i.clear(),t.clear()},n}((e,t,s)=>this.sendNodeData(e,t,s)),this.throttling=!s.disableThrottling,this.disableSprites=!!s.disableSprites,this.inlineRemoteCss=!!s.inlineRemoteCss,this.inlinerOptions=s.inlinerOptions,this.observer=N(this.app.safe(e=>{for(let t of e){let e=t.target,s=t.type;if(!tn(e))continue;if("childList"===s){for(let e=0;e<t.removedNodes.length;e++)tn(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){if(this.recents.has(i)||this.recents.set(i,t8.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}}}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=>ti(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,o=this.app.nodes.unregisterNode.bind(this.app.nodes);for(;s.nextNode();)r.contains(s.currentNode)||(i+=1,o(s.currentNode));let a=Math.floor(i/n*100);a>30&&this.app.send(eO(a))}}sendNodeAttribute(e,t,s,i){if(eF(t))return(s.startsWith("xlink:")&&(s=s.substring(6)),null===i&&this.app.send(q(e,s)),"use"!==t.localName||"href"!==s||this.disableSprites)?void("href"===s?(i.length>1e5&&(i=""),this.app.send(eh(e,s,i,this.app.getBaseHref()))):this.app.attributeSender.sendSetAttribute(e,s,i)):void ts(t,"svgtext",this.domParser).then(t=>{t&&this.app.send(H(e,s,`_$OPENREPLAY_SPRITE$_${t}`))}).catch(e=>{console.error("Openreplay: Error parsing <use> element:",e)});
9if("src"!==s&&"srcset"!==s&&"integrity"!==s&&"crossorigin"!==s&&"autocomplete"!==s&&"on"!==s.substring(0,2)&&(!("value"===s&&eQ(t,"input"))||"button"===t.type||"reset"===t.type||"submit"===t.type)){if(null===i)return void this.app.send(q(e,s));if("style"===s||"href"===s&&eQ(t,"link"))return"rel"in t&&"stylesheet"===t.rel&&this.inlineRemoteCss?void setTimeout(()=>{!function(e,t,s,i,n,r,o,a,h){let l=a?null:i();a||r(l,t);let c=e.sheet;if(c&&!o)try{let e=function e(t){try{var s;let i=t.rules||t.cssRules;if(!i)return null;let n=t.href;return!n&&t.ownerNode&&t.ownerNode.ownerDocument&&(n=t.ownerNode.ownerDocument.location.href),(s=Array.from(i,t=>(function(t,s){var i,n;if(i=t,"styleSheet"in i){let s;try{s=e(t.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(" ")+";"}(t)}catch(e){s=t.cssText}return t.styleSheet.href?d(s,t.styleSheet.href):s}{let e=t.cssText;return(n=t,"selectorText"in n&&t.selectorText.includes(":")&&(e=e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),s)?d(e,s):e}})(t,n)).join("")).includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}catch(e){return null}}(c);if(e)return void u(e)}catch(e){}function u(e){let t=function(e){let t=[],s=!1,i=!1,n="",r=0,o="";for(let a=0;a<e.length;a++){let h=e[a],l=e[a+1]||"";if(!i&&"/"===h&&"*"===l){s=!0,a++;continue}if(s){"*"===h&&"/"===l&&(s=!1,a++);continue}if(!i&&('"'===h||"'"===h)){i=!0,n=h,o+=h;continue}if(i){o+=h,h===n&&"\\"!==e[a-1]&&(i=!1);continue}o+=h,"{"===h?r++:"}"===h&&0==--r&&(t.push(o.trim()),o="")}return o.trim()&&t.push(o.trim()),t}(e=e.replace(/\/\*[\s\S]*?\*\//g,""));for(let e=0;e<t.length;e++)n(l,t[e],e,s)}e.href&&fetch(e.href).then(e=>{if(!e.ok)throw Error(`response status ${e.status}`);return e.text()}).then(e=>{a&&h?h(e,e4++):u(e)}).catch(t=>{console.error(`OpenReplay: Failed to fetch CSS from ${e.href}:`,t)});function d(e,t){if(!e)return"";let s=/^(?:[a-z+]+:)?\/\//i,i=/^www\..*/i,n=/^(data:)([^,]*),(.*)/i;return e.replace(/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,(e,r,o,a,h,l)=>{let c=o||h||l,u=r||a||"";if(!c)return e;if(s.test(c)||i.test(c)||n.test(c))return`url(${u}${c}${u})`;if("/"===c[0]){var d;return`url(${u}${((d=t).indexOf("//")>-1?d.split("/").slice(0,3).join("/"):d.split("/")[0]).split("?")[0]+c}${u})`}let p=t.split("/"),f=c.split("/");for(let e of(p.pop(),f))if("."===e)continue;else".."===e?p.pop():p.push(e);return`url(${u}${p.join("/")}${u})`})}}(t,e,this.app.getBaseHref(),e7,(e,t,s,i)=>{this.app.send(em(e,t,s,i))},(e,t)=>{this.app.send(eb(e,t))},this.inlinerOptions?.forceFetch,this.inlinerOptions?.forcePlain,(t,s)=>{this.app.send(j(s,e,0)),setTimeout(()=>{this.app.send(el(s,t,this.app.getBaseHref()))},10)})},0):void this.app.send(eh(e,s,i,this.app.getBaseHref()));("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){eQ(t,"style")?this.app.send(el(e,s,this.app.getBaseHref())):(s=this.app.sanitizer.sanitize(e,s),this.app.send(z(e,s)))}bindNode(e){let[t,s]=this.app.nodes.registerNode(e);eK(e)&&eQ(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,t8.Changed)})}),s?this.recents.set(t,t8.New):this.recents.get(t)!==t8.New&&this.recents.set(t,t8.Removed)}bindTree(e){if(!tn(e))return;this.bindNode(e);let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>(void 0!==this.app.nodes.getID(e)&&this.app.debug.info("! Node is already bound",e),ti(e)||void 0!==this.app.nodes.getID(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)===t8.Removed){this.app.send(W(t));let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>ti(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(eO(r))}}_commitNode(e,t){let s;if(eJ(t))return!0;let i=t.assignedSlot,n=t.parentNode;if(!eQ(t,"html")||!this.isTopContext){if(null===n||void 0===(s=this.app.nodes.getID(n))||!this.commitNode(s))return this.unbindTree(t),!1;if(this.app.sanitizer.handleNode(e,s,t),this.app.sanitizer.isHidden(s))return!1}let r=t.previousSibling;for(;null!==r;){let t=this.app.nodes.getID(r);if(void 0!==t){this.commitNode(t),this.indexes[e]=this.indexes[t]+1;break}r=r.previousSibling}null===r&&(this.indexes[e]=0);let o=this.recents.get(e),a=o===t8.New,h=this.indexes[e];if(void 0===h)throw"commitNode: missing node index";if(a){if(eK(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($(e,s,h,"STYLE",!1)):this.app.send($(e,s,h,i.tagName,eF(t)))}for(let t=0;t<i.attributes.length;t++){let s=i.attributes[t];this.sendNodeAttribute(e,i,s.nodeName,s.value)}}else eX(t)&&(this.app.send(j(e,s,h)),this.throttling?this.throttledSetNodeData(e,n,t.data):this.sendNodeData(e,n,t.data));if(i){let t=this.app.nodes.getID(i);void 0!==t&&(this.slotMap.set(e,t),this.app.send(ed(e,t)))}return!0}if(o===t8.Removed&&void 0!==s)if(this.app.send(B(e,s,h)),i){let t=this.app.nodes.getID(i);void 0!==t&&this.slotMap.get(e)!==t&&(this.slotMap.set(e,t),this.app.send(ed(e,t)))}else this.slotMap.has(e)&&(this.slotMap.delete(e),this.app.send(ed(e,0)));let l=this.attributesMap.get(e);if(void 0!==l){if(!eK(t))throw"commitNode: node is not an element";for(let s of l)this.sendNodeAttribute(e,t,s,t.getAttribute(s))}
9if(this.textSet.has(e)){if(!eX(t))throw"commitNode: node is not a text";this.throttling?this.throttledSetNodeData(e,n,t.data):this.sendNodeData(e,n,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===t8.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)}disconnect(){this.observer.disconnect(),this.clear(),this.throttledSetNodeData.clear()}}class to extends tr{observe(e){let t=e.contentDocument,s=this.app.nodes.getID(e);t&&void 0!==s&&this.observeRoot(t,e=>{void 0===e?this.app.debug.log("OpenReplay: Iframe document not bound"):(this.docId=e,this.app.send(ef(s,e)))})}syntheticObserve(e,t){this.observeRoot(t,t=>{void 0===t?this.app.debug.log("OpenReplay: Iframe document not bound"):this.app.send(ef(e,t))})}}class ta extends tr{observe(e){let t=e.shadowRoot,s=this.app.nodes.getID(e);t&&void 0!==s&&this.observeRoot(t,e=>{void 0===e?this.app.debug.error("OpenReplay: Shadow Root was not bound"):this.app.send(ef(s,e))})}}class th{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 tl(e,t){switch(e){case t6.Inline:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!1,forcePlain:!1}};case t6.InlineFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!1}};case t6.PlainFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!0}};case t6.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 t6.Disabled:default:return{inlineRemoteCss:!1,inlinerOptions:{forceFetch:!1,forcePlain:!1}}}}(t3=t6||(t6={}))[t3.Unset=-1]="Unset",t3[t3.Disabled=0]="Disabled",t3[t3.Inline=1]="Inline",t3[t3.InlineFetched=2]="InlineFetched",t3[t3.PlainFetched=3]="PlainFetched";let tc=l?Element.prototype.attachShadow:()=>new ShadowRoot;class tu extends tr{constructor(e){const t=Object.assign({captureIFrames:!0,disableSprites:!1,inlineCss:0},e.options),s={disableSprites:t.disableSprites,disableThrottling:t.disableThrottling,...tl(t.inlineCss,console.warn)};super(e.app,!0,s),this.iframeOffsets=new th,this.contextCallbacks=[],this.contextsSet=new WeakSet,this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.docObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.app=e.app,this.options=t,this.app.nodes.attachNodeCallback(e=>{eQ(e,"iframe")&&(this.options.captureIFrames&&!T(e,"obscured")||T(e,"capture"))&&this.handleIframe(e)}),this.app.nodes.attachNodeCallback(e=>{eK(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)return void this.app.debug.warn("no doc for iframe found",e);if(i&&this.docObservers.has(i))return void this.app.debug.info("doc already observed for",t);let n=new to(this.app,!1,{disableSprites:this.options.disableSprites,...tl(this.options.inlineCss,console.warn)});this.iframeObservers.set(e,n),this.docObservers.set(i,n),this.iframeObserversArr.pu
9sh(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 ta(this.app,!1,{disableSprites:this.options.disableSprites,...tl(this.options.inlineCss,console.warn)});this.shadowRootObservers.set(e,t),t.observe(e.host)}observe(){let e=this;Element.prototype.attachShadow=function(){let t=tc.apply(this,arguments);return e.handleShadowRoot(t),t},this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send(U()),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement)}crossdomainObserve(e,t,s){let i=this;Element.prototype.attachShadow=function(){let e=tc.apply(this,arguments);return i.handleShadowRoot(e),e},this.app.nodes.clear(),this.app.nodes.crossdomainMode(s,t);let n=new to(this.app,!1,{disableSprites:this.options.disableSprites,...tl(this.options.inlineCss,console.warn)});this.iframeObservers.set(window.document,n),n.syntheticObserve(e,window.document)}disconnect(){this.iframeOffsets.clear(),Element.prototype.attachShadow=tc,this.iframeObserversArr.forEach(e=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}}(t5=t7||(t7={}))[t5.Plain=0]="Plain",t5[t5.Obscured=1]="Obscured",t5[t5.Hidden=2]="Hidden";let td=e=>e.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*");class tp{constructor(e){this.obscured=new Set,this.hidden=new Set,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)}handleNode(e,t,s){if(this.options.privateMode&&(eK(s)&&!T(s,"unmask")||eX(s)&&!T(s.parentNode,"unmask")))return this.obscured.add(e);if((this.obscured.has(t)||eK(s)&&(T(s,"masked")||T(s,"obscured")))&&this.obscured.add(e),(this.hidden.has(t)||eK(s)&&(T(s,"htmlmasked")||T(s,"hidden")))&&this.hidden.add(e),void 0!==this.options.domSanitizer&&eK(s)){let t=this.options.domSanitizer(s);t===t7.Obscured&&this.obscured.add(e),t===t7.Hidden&&this.hidden.add(e)}}sanitize(e,t){return this.obscured.has(e)?td(t):(this.options.obscureTextNumbers&&(t=t.replace(/\d/g,"0")),this.options.obscureTextEmails&&(t=t.replace(/^\w+([+.-]\w+)*@\w+([.-]\w+)*\.\w{2,3}$/g,e=>{let[t,s]=e.split("@"),[i,n]=s.split(".");return`${f(t)}@${f(i)}.${f(n)}`})),t)}isObscured(e){return this.obscured.has(e)}isHidden(e){return this.hidden.has(e)}getInnerTextSecure(e){let t=this.app.nodes.getID(e);return t?this.sanitize(t,e.innerText):""}clear(){this.obscured.clear(),this.hidden.clear()}}class tf{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).forEach(([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,t,s=(e=new Uint8Array(6),(t=window.crypto||window.msCrypto)?(t.getRandomValues(e),Array.from(e,_).join("")):Array.from({length:12},()=>_(Math.floor(16*Math.random()))).join(""));this.app.sessionStorage.setItem(this.options.session_tabid_key,s),this.tabId=s}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 tg{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++>
9=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 tm="canceled",ty="or_buffer_1",tb=e=>({reason:e,success:!1}),tv=e=>({...e,success:!0});function tw(){let e=-1*new Date().getTimezoneOffset(),t=Math.floor(Math.abs(e)/60),s=Math.abs(e)%60;return`UTC${e>=0?"+":"-"}${String(t).padStart(2,"0")}:${String(s).padStart(2,"0")}`}(t4=t9||(t9={}))[t4.NotActive=0]="NotActive",t4[t4.Starting=1]="Starting",t4[t4.Active=2]="Active",t4[t4.ColdStart=3]="ColdStart";let tS=e=>new Promise(t=>setTimeout(t,e)),tk="never-gonna-give-you-up",tT="never-gonna-let-you-down",tI="never-gonna-run-around-and-desert-you",t_="tracker inside a child iframe",tE="getting node id for child iframe",tC="batch of messages from an iframe window",tN="signal that parent is live",tO="stop tracker inside frame",tM="start tracker inside frame",tR="hello-how-are-you-im-under-the-water-please-help-me",tD="reset-your-session-please";class tx{constructor(e,t,s,i,r){this.signalError=i,this.insideIframe=r,this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=t9.NotActive,this.version="17.2.4",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.parentActive=!1,this.checkStatus=()=>this.parentActive,this.parentCrossDomainFrameListener=e=>{let{data:t}=e;if(t&&e.source!==window){if(t.line===tM){if(this.active())return;try{this.allowAppStart(),this.start()}catch(e){console.error("children frame restart failed:",e)}}t.line===tN&&(this.parentActive=!0),t.line===tE&&(this.parentActive=!0,this.rootId=t.id,this.session.setSessionToken(t.token,this.projectKey),this.frameOderNumber=t.frameOrderNumber,this.frameLevel=t.frameLevel,this.debug.log("starting iframe tracking",t),this.allowAppStart()),t.line===tO&&this.active()&&this.stop()}},this.trackedFrames=[],this.crossDomainIframeListener=e=>{if(!this.active()||e.source===window)return;let{data:t}=e;if(t){if(t.line===t_&&(e.source?.postMessage({ping:!0,line:tN},"*"),(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)return this.debug.log("Couldnt get node id for iframe",e.source);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),await this.waitStarted();let i=this.session.getSessionToken(this.projectKey),n=this.trackedFrames.findIndex(e=>e===t.context)+1;0===n&&this.debug.error("Couldnt get order number for iframe",t.context,this.trackedFrames);let r={line:tE,id:s,token:i,frameOrderNumber:n,frameLevel:this.frameLevel+1};this.debug.log("Got child frame signal; nodeId",s,e.source,r),e.source?.postMessage(r,"*")}catch(e){console.error(e)}})()),t.line===tC){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:o,top:a}=i.getBoundingClientRect();s=[e,n+o,r+a]}}),i.push(s)}if(68===t[0]){let s=t;this.pageFrames.forEach(i=>{if(i.contentWindow===e.source){let[e,n,r,o,a,h,l]=t,{left:c,top:u,width:d,height:p}=i.getBoundingClientRect();s=[e,n,r,o,a,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===tR){if(!this.pollingQueue.order.length)return;let s=this.pollingQueue.order[0];if(s&&0===this.pollingQueue[s].length){this.pollingQueue.order=this.pollingQueue.order.filter(e=>e!==s);return}this.pollingQueue[s].includes(t.context)&&(this.pollingQueue[s]=this.pollingQueue[s].filter(e=>e!==t.context),e.source?.postMessage({line:s},"*"),0===this.pollingQueue[s].length&&this.pollingQueue.order.shift())}}},this.pollingQueue={order:[]},this.addCommand=e=>{this.pollingQueue.order.push(e),this.pollingQueue[e]=[...this.trackedFrames]},this.bootChildrenFrames=async()=>{await this.waitStarted(),this.addCommand(tM)},this.killChildrenFrames=()=>{this.addCommand(tO)},this.signalIframeTracker=()=>{let e=this.session.getTabId();window.parent.postMessage({line:t_,source:e,context:this.contextId},this.options.crossdomain?.parentDomain??"*");let t=0,s=250,i=0,n=!1,r=()=>{if(n||this.checkStatus()){n=!0;return}window.parent.postMessage({line:t_,source:e,context:this.contextId},this.options.crossdomain?.parentDomain??"*"),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=()=>{this.stop(!1),this.waitStatus(t9.NotActive).then(()=>{this.allowAppStart(),this.start(this.prevOpts,!0).then(e=>{this.debug.info("Session restart",e)}).catch(e=>{this.debug.error("Session restart failed",e)})})},this.send=(e,t=!1)=>{this.activityState!==t9.NotActive&&(this.activityState===t9.ColdStart?(this.bufferedMessages1.push(e),this.singleBuffer||this.bufferedMessages2.push(e),this.conditionsManager?.processMessage(e)):this.messages.push(e),this.activityState===t9.A
9ctive&&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)=>{i&&(s=this.safe(s));let r=()=>e?O(e,t,s,n,this.options.forceNgOff):null,o=()=>e?M(e,t,s,n,this.options.forceNgOff):null;this.attachStartCallback(r,i),this.attachStopCallback(o,i)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{this.canvasRecorder?.restartTracking()},this.flushBuffer=async e=>new Promise((t,s)=>{if(0===e.length)return void t(null);let i=1;for(;i<e.length&&0!==e[i][0];)i++;x(()=>{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;const 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__:0,localStorage:null,sessionStorage:null,forceSingleTab:!1,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:t6.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],o=t[n];"object"!=typeof r||Array.isArray(r)||null===r?i[n]=r:i[n]=e(o||{},r)}return i}(o,s),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&"BroadcastChannel"in globalThis){const 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 tp({app:this,options:s}),this.nodes=new e5({node_id:this.options.node_id,forceNgOff:!!s.forceNgOff,maintainer:this.options.nodes?.maintainer}),this.observer=new tu({app:this,options:s}),this.ticker=new tg(this),this.ticker.attach(()=>this.commit()),this.debug=new e1(this.options.__debug__),this.session=new tf({app:this,options:this.options}),this.attributeSender=new n({app:this,isDictDisabled:!!(this.options.disableStringDict||this.options.crossdomain?.enabled)}),this.tagWatcher=new eq({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:e=>this.send(ex(e))}),this.session.attachUpdateCallback(({userID:e,metadata:t})=>{if(null!=e){if(!e||"string"!=typeof e||0===e.trim().length)return void this.debug.warn("Invalid userID (must be type string), ignoring.");this.send(Z(e))}null!=t&&Object.entries(t).forEach(([e,t])=>this.send(et(e,t)))}),null!=t&&this.session.applySessionHash(t);const a=this.session.getTabId();this.insideIframe?(window.addEventListener("message",this.parentCrossDomainFrameListener),window.addEventListener("message",this.crossDomainIframeListener),setInterval(()=>{window.parent.postMessage({line:tR,context:this.contextId},s.crossdomain?.parentDomain??"*")},250)):(this.initWorker(),window.addEventListener("message",this.crossDomainIframeListener)),null!==this.bc&&(this.bc.postMessage({line:tk,source:a,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)return void this.debug.log("same ctx event",e);if(this.debug.log(e),e.data.line===tT){let t=e.data.token;this.session.setSessionToken(t,this.projectKey),this.allowAppStart()}if(e.data.line===tI){let t=e.data.token;this.session.regenerateTabId(),this.session.setSessionToken(t,this.projectKey),this.allowAppStart()}if(e.data.line===tk){let t=this.session.getSessionToken(this.projectKey);t&&this.bc&&this.bc.postMessage({line:e.data.source===a?tI:tT,token:t,source:a,context:this.contextId,projectKey:this.projectKey})}if(e.data.line===tD){let t=e.data.token;this.debug.log("Received reset signal from another tab"),this.session.setSessionToken(t,this.projectKey),this.restart()}})}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 tS(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.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){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,"$1_$2_$3");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h["Content-Encoding"]="gzip"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:"noPageNum"}_${null!=n?n:"noBatchNum"}`,{body:t,method:"POST",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:"noBatchNum"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn("OpenReplay:",e),this.retry(t,s,`${null!=i?i:"noBatchNum"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:"noBatchNum"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s="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 i{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}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 i=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class e extends i{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:case 82: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 n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.checkpoints=[],this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;this.checkpoints.length=0;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[0,this.timestamp],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn("OpenReplay: max message size overflow."),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.checkpoints.push(s.getCurrentOffset()),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(-1===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn("OpenReplay: beacon size overflow. Skipping large message.",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(t=!1){if(this.isEmpty)return;const s=this.encoder.flush();this.onBatch(s,t),this.prepare()}clean(){this.encoder.reset(),this.checkpoints.length=0}}var h;
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"}(h||(h={}));let r=null,u=null,a=h.NotActive;function o(t){u&&u.finaliseBatch(t)}function c(){return new Promise((t=>{a=h.Stopping,null!==p&&(clearInterval(p),p=null),u&&(u.clean(),u=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{a=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(a)||(postMessage("a_stop"),c().then((()=>{postMessage("a_start")})))}let l,p=null;self.onmessage=({data:s})=>{if("stop"===s)return o(),void c().then((()=>{a=h.Stopped}));if("forceFlushBatch"!==s)if("closing"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void g();s.batch&&r.sendCompressed(s.batch)}if("uncompressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void g();s.batch&&r.sendUncompressed(s.batch)}return"start"===s.type?(a=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:"compress",batch:t},[t.buffer])}),s.pageNo),u=new n(s.pageNo,s.timestamp,s.url,((t,s)=>{r&&(s?r.sendUncompressed(t):r.push(t))}),s.tabId,(()=>postMessage({type:"queue_empty"}))),null===p&&(p=setInterval(o,3e4)),a=h.Active):"auth"===s.type?r?u?(r.authorise(s.token),void(s.beaconSizeLimit&&u.setBeaconSizeLimit(s.beaconSizeLimit))):(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(u){const t=u;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage("not_init"),g()}else o(!0);else o()}}();\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",t,!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(t9.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=t.byteLength,i="CompressionStream"in globalThis;s>this.compressionThreshold&&i?new Response(new Blob([t]).stream().pipeThrough(new CompressionStream("gzip"))).arrayBuffer().then(e=>{this.worker?.postMessage({type:"compressed",batch:new Uint8Array(e)})}).catch(e=>{this.debug.error("Openreplay compression error:",e),this.worker?.postMessage({type:"uncompressed",batch:t})}):this.worker?.postMessage({type:"uncompressed",batch:t})}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(P(this.timestamp()),eR(this.session.getTabId())),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:tC,messages:this.messages},this.options.crossdomain?.parentDomain??"*"),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0;return}if(void 0!==this.worker&&this.messages.length){if(!this.messages.length&&this.emptyBat
9chCounter<1e3)return void this.emptyBatchCounter++;this.emptyBatchCounter=0;try{x(()=>{this.messages.unshift(P(this.timestamp()),eR(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=[P(this.timestamp()),eR(this.session.getTabId())];this.bufferedMessages1.push(...e),this.bufferedMessages2.push(...e),this.coldStartCommitN=0}}commit(){this.activityState===t9.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){this.worker?.postMessage(e),this.commitCallbacks.forEach(t=>t(e))}timestamp(){return p()+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)return void this.debug.error("OpenReplay error: Unable to build session URL");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=p()-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===t9.Active}resetNextPageSession(e){e?this.sessionStorage.setItem(this.options.session_reset_key,"t"):this.sessionStorage.removeItem(this.options.session_reset_key)}checkSessionToken(e){let t=null!==this.sessionStorage.getItem(this.options.session_reset_key),s=this.session.getSessionToken(this.projectKey);return e||t||!s}async coldStart(e={},t){this.singleBuffer=!1;let s=this.checkSessionToken(e.forceNew);t&&await this.setupConditionalStart(e);let i=()=>{this.orderNumber+=1,d(),this.coldStartTs=p(),this.orderNumber%2==0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push(P(this.timestamp())),this.bufferedMessages1.push(eR(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push(P(this.timestamp())),this.bufferedMessages2.push(eR(this.session.getTabId()))),this.stop(!1),this.activityState=t9.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(eM(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{i()},3e4),i()}async setupConditionalStart(e){this.conditionsManager=new r(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:p(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:eB,jsHeapSizeLimit:eW,timezone:tw(),width:window.screen.width,height:window.screen.height})}),{token:s,userBrowser:i,userCity:n,userCountry:o,userDevice:a,userOS:h,userState:l,projectID:c}=await t.json();this.session.assign({projectID:c}),this.session.setUserInfo({userBrowser:i,userCity:n,userCountry:o,userDevice:a,userOS:h,userState:l});let u={sessionToken:s,userUUID:"",sessionID:""};
9this.startCallbacks.forEach(e=>e(u)),await this.conditionsManager?.fetchConditions(c,s),await this.tagWatcher.fetchTags(this.options.ingestPoint,s)}offlineRecording(e={},t){this.onSessionSent=t,this.singleBuffer=!0;let s=this.checkSessionToken(e.forceNew);d(),this.coldStartTs=p();let i=this.localStorage.getItem(ty);if(i){let e=JSON.parse(i);this.bufferedMessages1=Array.isArray(e)?e:this.bufferedMessages1,this.localStorage.removeItem(ty)}this.bufferedMessages1.push(P(this.timestamp())),this.bufferedMessages1.push(eR(this.session.getTabId())),this.activityState=t9.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(eM(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(ty,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}async uploadOfflineRecording(){this.stop(!1);let e=p();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()});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:eB,jsHeapSizeLimit:eW,timezone:tw()})}),{token:s,userBrowser:i,userCity:n,userCountry:r,userDevice:o,userOS:a,userState:h,beaconSizeLimit:l,projectID:c}=await t.json();for(this.worker?.postMessage({type:"auth",token:s,beaconSizeLimit:l}),this.session.assign({projectID:c}),this.session.setUserInfo({userBrowser:i,userCity:n,userCountry:r,userDevice:o,userOS:a,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);let i=this.activityState===t9.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(tb(e))}if(this.activityState===t9.Active||this.activityState===t9.Starting)return Promise.resolve(tb("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=t9.Starting,i||d(),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=p();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()});let o=this.session.getSessionToken(this.projectKey),a=this.checkSessionToken(e.forceNew);this.sessionStorage.removeItem(this.options.session_reset_key),this.debug.log("OpenReplay: starting session; need new session id?",a,"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:r-this.coldStartTs,userID:this.session.getInfo().userID,token:a?void 0:o,deviceMemory:eB,jsHeapSizeLimit:eW,timezone:tw(),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===tm?tm:`Server error: ${t.status}. ${e}`;return tb(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,[]),tb(e)}let{token:n,userUUID:h,projectID:l,beaconSizeLimit:c,compressionThreshold:u,delay:d,sessionID:p,startTimestamp:f,userBrowser:g,userCity:m,userCountry:y,userDevice:b,userO
9S:v,userState:w,canvasEnabled:S,canvasQuality:k,canvasFPS:T,framesSupport:I,assistOnly:_}=await t.json();if("string"!=typeof n||"string"!=typeof h||"number"!=typeof f&&void 0!==f||"string"!=typeof p||"number"!=typeof d||"number"!=typeof c&&void 0!==c){let e=`Incorrect server response: ${JSON.stringify(t)}`;return this.signalError(e,[]),tb(e)}this.delay=d,this.session.setSessionToken(n,this.projectKey),o&&o!==n&&this.bc?.postMessage({type:tD,token:n}),this.session.setUserInfo({userBrowser:g,userCity:m,userCountry:y,userDevice:b,userOS:v,userState:w}),this.session.assign({sessionID:p,timestamp:f||r,projectID:l}),_?(this.socketMode=!0,this.worker?.postMessage("stop")):this.worker?.postMessage({type:"auth",token:n,beaconSizeLimit:c}),a||n!==o||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(eM(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEach(([e,t])=>this.send(et(e,t))),this.localStorage.setItem(this.options.local_uuid_key,h),this.compressionThreshold=u;let E={sessionToken:n,userUUID:h,sessionID:p};if(this.startCallbacks.forEach(e=>e(E)),e.startCallback&&e.startCallback(tv(E)),await this.tagWatcher.fetchTags(this.options.ingestPoint,n),this.activityState=t9.Active,this.options.crossdomain?.enabled&&this.bootChildrenFrames(),S&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new eG(this,{fps:T,quality:k,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame,framesSupport:!!I})),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(),tv(E)}catch(t){if(this.stop(),this.session.reset(),!t)return console.error("Unknown error during start"),this.signalError("Unknown error",[]),tb("Unknown error");if(t===tm)return this.signalError(tm,[]),tb(tm);this._debug("session_start",t);let e=t instanceof Error?t.message:t.toString();return this.signalError(e,[]),tb(e)}}async waitStart(){return new Promise(e=>{let t=setInterval(()=>{this.canStart&&(clearInterval(t),e(!0))},100)})}async waitStarted(){return this.waitStatus(t9.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===t9.Active||this.activityState===t9.Starting?Promise.resolve(tb("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")=>{"string"!=typeof t||"string"!=typeof s||s.length>5242880||t.length>255||this.send(ek("websocket",e,s,this.timestamp(),i,t))}}stop(e=!0){if(this.activityState!==t9.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}finally{this.activityState=t9.NotActive,this.debug.log("OpenReplay tracking stopped.")}}}let tP=l&&"InstallTrigger"in window?e=>e.message+"\n"+e.stack:e=>e.stack||e.message;function tA(e){return void 0===e?"undefined":null===e?"null":e instanceof Error?tP(e):Array.isArray(e)?`Array(${e.length})`:String(e)}function tL(e){if(void 0===e)return"undefined";if(null===e)return"null";if(e instanceof Error)return tP(e);if(Array.isArray(e)){let t=e.length,s=e.slice(0,10).map(tA).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+": "+tA(n))}return"{"+t.join(", ")+"}"}return e.toString()}
9let tU=["log","info","warn","error","debug","assert"],t$=/(^|@)\S+:\d+/,tj=/^\s*at .*(\S+:\d+|\(native\))/m,tB=/^(eval@)?(\[native code\])?$/;function tW(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 tH(e){return[{columnNumber:e.colno,lineNumber:e.lineno,fileName:e.filename,functionName:"",source:""}]}function tq(e,t,s={}){let i=t;try{var n;n=e,i=(function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]){var t;return!(t=e).stacktrace||t.message.includes("\n")&&t.message.split("\n").length>t.stacktrace.split("\n").length?function(e){let t=/Line (\d+).*script (?:in )?(\S+)/i,s=e.message.split("\n"),i=[];for(let e=2,n=s.length;e<n;e+=2){let n=t.exec(s[e]);n&&i.push({file:n[2],line:+n[1],raw:s[e]})}return i}(t):t.stack?t.stack.split("\n").filter(e=>!!e.match(t$)&&!e.match(/^Error created at/)).map(e=>{let t,s=e.split("@"),i=tW(s.pop()),n=s.shift()||"",r=n.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return n.match(/\(([^)]*)\)/)&&(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){let t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,s=e.stacktrace.split("\n"),i=[];for(let e=0,n=s.length;e<n;e+=2){let n=t.exec(s[e]);n&&i.push({function:n[3]||void 0,file:n[2],line:n[1]?+n[1]:void 0,raw:s[e]})}return i}(t)}if(e.stack&&e.stack.match(tj))return e.stack.split("\n").filter(e=>!!e.match(tj)).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=tW(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(tB)).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=tW(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")})(n).map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}catch(e){}return ew(e.name,e.message,JSON.stringify(i),JSON.stringify(s))}function tz(e,t=window,s={}){if(e instanceof ErrorEvent)if(e.error instanceof Error)return tq(e.error,tH(e),s);else{let[t,i]=e.message.split(":");return i||(t="Error",i=e.message),ew(t,i,JSON.stringify(tH(e)),JSON.stringify(s))}if("PromiseRejectionEvent"in t&&e instanceof t.PromiseRejectionEvent)if(e.reason instanceof Error)return tq(e.reason,[],s);else{let t;try{t=JSON.stringify(e.reason)}catch(s){t=String(e.reason)}return ew("Unhandled Promise Rejection",t,"[]",JSON.stringify(s))}return null}function tF(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 tK=["text","password","email","search","number","range","date","tel","time"],tX=l&&"labels"in HTMLInputElement.prototype?e=>{let t=e;for(;null!==(t=t.parentNode);)if(eQ(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(eQ(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 tV(e,t){let s=k(e);if(null!==s)return g(s).slice(0,100);let i=w(e,t);if(i)return i;if(e.id)return`#${e.id}`;let n=S(e);if(n)return n;let r=tX(e);return g(e.name||e.placeholder||r&&r.innerText||e.type||"").slice(0,100)}let tJ="u">typeof CSS&&CSS.escape||(e=>e),tQ=new WeakMap;function tG(e){let t=e.tagName.toUpperCase();return"BUTTON"===t||"A"===t||"LI"===t||"SELECT"===t||"TR"===t||"TH"===t||null!=e.oncl
9ick||"button"===e.getAttribute("role")}function tY(e,t){return e instanceof Element?function(e,t){let s=e;for(;null!==s&&s!==t.documentElement;){if(T(s,"masked"))return null;s=s.parentElement}if(eF(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||tG(s)||null!==k(s))return s;s=s.parentElement}return e===t.documentElement?null:e}(e,t):null}function tZ(e){return Math.round(1e4*e)}function t0(e,t){let s=tQ.get(t);if(s||(s=Object.create(null),tQ.set(t,s)),e in s)return s[e];let i=1===t.querySelectorAll(`.${tJ(e)}`).length;return s[e]=i,i}function t1(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}var t2,t3,t5,t4,t8,t6,t7,t9,se,st=-1,ss=function(e){addEventListener("pageshow",function(t){t.persisted&&(st=t.timeStamp,e(t))},!0)},si=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},sn=function(){var e=si();return e&&e.activationStart||0},sr=function(e,t){var s=si(),i="navigate";return st>=0?i="back-forward-cache":s&&(document.prerendering||sn()>0?i="prerender":document.wasDiscarded?i="restore":s.type&&(i=s.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(0x82f79cd8fff*Math.random())+1e12),navigationType:i}},so=function(e,t,s){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return i.observe(Object.assign({type:e,buffered:!0},s||{})),i}}catch(e){}},sa=function(e,t,s,i){var n,r;return function(o){var a;t.value>=0&&(o||i)&&((r=t.value-(n||0))||void 0===n)&&(n=t.value,t.delta=r,a=t.value,t.rating=a>s[1]?"poor":a>s[0]?"needs-improvement":"good",e(t))}},sh=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},sl=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},sc=function(e){var t=!1;return function(){t||(e(),t=!0)}},su=-1,sd=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},sp=function(e){"hidden"===document.visibilityState&&su>-1&&(su="visibilitychange"===e.type?e.timeStamp:0,sg())},sf=function(){addEventListener("visibilitychange",sp,!0),addEventListener("prerenderingchange",sp,!0)},sg=function(){removeEventListener("visibilitychange",sp,!0),removeEventListener("prerenderingchange",sp,!0)},sm=function(){return su<0&&(su=sd(),sf(),ss(function(){setTimeout(function(){su=sd(),sf()},0)})),{get firstHiddenTime(){return su}}},sy=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},sb=[1800,3e3],sv=function(e,t){t=t||{},sy(function(){var s,i=sm(),n=sr("FCP"),r=so("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(r.disconnect(),e.startTime<i.firstHiddenTime&&(n.value=Math.max(e.startTime-sn(),0),n.entries.push(e),s(!0)))})});r&&(s=sa(e,n,sb,t.reportAllChanges),ss(function(i){s=sa(e,n=sr("FCP"),sb,t.reportAllChanges),sh(function(){n.value=performance.now()-i.timeStamp,s(!0)})}))})},sw=[.1,.25],sS=function(e,t){t=t||{},sv(sc(function(){var s,i=sr("CLS",0),n=0,r=[],o=function(e){e.forEach(function(e){if(!e.hadRecentInput){var t=r[0],s=r[r.length-1];n&&e.startTime-s.startTime<1e3&&e.startTime-t.startTime<5e3?(n+=e.value,r.push(e)):(n=e.value,r=[e])}}),n>i.value&&(i.value=n,i.entries=r,s())},a=so("layout-shift",o);a&&(s=sa(e,i,sw,t.reportAllChanges),sl(function(){o(a.takeRecords()),s(!0)}),ss(function(){n=0,s=sa(e,i=sr("CLS",0),sw,t.reportAllChanges),sh(function(){return s()})}),setTimeout(s,0))}))},sk=0,sT=1/0,sI=0,s_=function(e){e.forEach(function(e){e.interactionId&&(sT=Math.min(sT,e.interactionId),sk=(sI=Math.max(sI,e.interactionId))?(sI-sT)/7+1:0)})},sE=function(){return se?sk:performance.interactionCount||0},sC=function(){"interactionCount"in performance||se||(se=so("event",s_,{type:"event",buffered:!0,durationThreshold:0}))},sN=[],sO=new Map,sM=0,sR=function(){var e=Math.min(sN.length-1,Math.floor((sE()-sM)/50));return sN[e]}
9,sD=[],sx=function(e){if(sD.forEach(function(t){return t(e)}),e.interactionId||"first-input"===e.entryType){var t=sN[sN.length-1],s=sO.get(e.interactionId);if(s||sN.length<10||e.duration>t.latency){if(s)e.duration>s.latency?(s.entries=[e],s.latency=e.duration):e.duration===s.latency&&e.startTime===s.entries[0].startTime&&s.entries.push(e);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};sO.set(i.id,i),sN.push(i)}sN.sort(function(e,t){return t.latency-e.latency}),sN.length>10&&sN.splice(10).forEach(function(e){return sO.delete(e.id)})}}},sP=function(e){var t=self.requestIdleCallback||self.setTimeout,s=-1;return e=sc(e),"hidden"===document.visibilityState?e():(s=t(e),sl(e)),s},sA=[200,500],sL=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},sy(function(){sC();var s,i,n=sr("INP"),r=function(e){sP(function(){e.forEach(sx);var t=sR();t&&t.latency!==n.value&&(n.value=t.latency,n.entries=t.entries,i())})},o=so("event",r,{durationThreshold:null!=(s=t.durationThreshold)?s:40});i=sa(e,n,sA,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),sl(function(){r(o.takeRecords()),i(!0)}),ss(function(){sM=sE(),sN.length=0,sO.clear(),i=sa(e,n=sr("INP"),sA,t.reportAllChanges)}))}))},sU=[2500,4e3],s$={},sj=function(e,t){t=t||{},sy(function(){var s,i=sm(),n=sr("LCP"),r=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTime<i.firstHiddenTime&&(n.value=Math.max(e.startTime-sn(),0),n.entries=[e],s())})},o=so("largest-contentful-paint",r);if(o){s=sa(e,n,sU,t.reportAllChanges);var a=sc(function(){s$[n.id]||(r(o.takeRecords()),o.disconnect(),s$[n.id]=!0,s(!0))});["keydown","click"].forEach(function(e){addEventListener(e,function(){return sP(a)},{once:!0,capture:!0})}),sl(a),ss(function(i){s=sa(e,n=sr("LCP"),sU,t.reportAllChanges),sh(function(){n.value=performance.now()-i.timeStamp,s$[n.id]=!0,s(!0)})})}})},sB=[800,1800],sW=function e(t){document.prerendering?sy(function(){return e(t)}):"complete"!==document.readyState?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},sH=function(e,t){t=t||{};var s=sr("TTFB"),i=sa(e,s,sB,t.reportAllChanges);sW(function(){var n=si();n&&(s.value=Math.max(n.responseStart-sn(),0),s.entries=[n],i(!0),ss(function(){(i=sa(e,s=sr("TTFB",0),sB,t.reportAllChanges))(!0)}))})};function sq(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 sz={checkCssInterval:200,scanInMemoryCSS:!1,checkLimit:void 0},sF=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 sK(e){if("number"==typeof e){let t=(0|Math.log10((e^e>>31)-(e>>31)))+1;return"9".repeat(t)}return"string"==typeof e?e.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*"):e}function sX(e){let t={};if(Array.isArray(e))e.forEach(({name:e,value:s})=>{sF.has(e.toLowerCase())?t[e]=sK(s):t[e]=s});else for(let[s,i]of Object.entries(e))sF.has(s.toLowerCase())?t[s]=sK(i):t[s]=i;return t}function sV(e){let t;if(!e)return e;let s=!1;try{t=JSON.parse(e),s=!0}catch(e){}if(s)return sJ(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(sF.has(e.toLowerCase())){let s=sK(t.get(e));t.set(e,s)}return t.toString()}catch(t){return e}}function sJ(e){if(Array.isArray(e))e.forEach(sJ);else if(e&&"object"==typeof e)for(let t in e)Object.hasOwn(e,t)&&(sF.has(t.toLowerCase())?e[t]=sK(e[t]):null!==e[t]&&"object"==typeof e[t]&&sJ(e[t]))}class sQ{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((sJ(e=this.getData),e)):sV(this.requestData),n={headers:sX(t),body:i},r={headers:sX(s),body:sV(this.response)},o=this.sanitize({url:function(e){if(!e)return"";try{let t=new URL(e);if(t.searchParams)for(let e of t.searchParams.keys())sF.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(!o)return null;if(o.url.includes("/graphql")&&o.response.body&&"string"==typeof o.response.body){let e=o.response.body.includes("errors");o.status=e?400:200,this.requestType="graphql"}return{requestType:this.requestType,method:o.method,url:o.url,request:JSON.stringify(o.request),response:JSON.stringify(o.response),status:o.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}}let sG=(e,t)=>
9{let s="";switch(e){case"":case"text":case"json":"string"==typeof t?s=t:sZ(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},sY=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{var s;if(s=e,!(null==s||ArrayBuffer.isView(s))&&"u">typeof Symbol&&"function"==typeof s[Symbol.iterator]){let s=[];for(let[t,i]of e)s.push(`${t}=${"string"==typeof i?i:"[object Object]"}`);t=s.join(",")}else t=e instanceof Blob||e instanceof ReadableStream||e instanceof ArrayBuffer?"byte data":sZ(e)?e:`can't parse body ${typeof e}`}return t}catch(e){return"can't parse body"}};function sZ(e){return null!==e&&"object"==typeof e}function s0(e){return e<=0?"":e>=1e6?(e/1e3/1e3).toFixed(1)+" MB":e>=1e3?(e/1e3).toFixed(1)+" KB":`${e}B`}let s1=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)};class s2{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 sQ(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(i))return e.apply(t,s);let o=s1(i);if(r.method="POST",r.url=i,r.name=(o.pathname.split("/").pop()||"")+o.search,r.requestType="beacon",r.requestHeader={"Content-Type":n instanceof Blob?n.type:n instanceof FormData?"multipart/form-data":n instanceof URLSearchParams?"application/x-www-form-urlencoded;charset=UTF-8":"text/plain;charset=UTF-8"},r.status=0,r.statusText="Pending",o.search&&o.searchParams)for(let[e,t]of(r.getData={},o.searchParams))r.getData[e]=t;r.requestData=sY(n),r.startTime||(r.startTime=performance.now());let a=e.apply(t,s);a?(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),a}}class s3{static create(e,t,s,i,n,r){if(e)return new Proxy(e,new s2(t,s,i,n,r))}}class s5{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=sG(this.item.responseType,e),e)))}return"function"==typeof s?s.bind(e):s}}class s4{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){let i=s[0],n=s[1];if(!i||"string"!=typeof i&&!(null==i?void 0:i.url)||(i instanceof URL||"string"==typeof i?this.isServiceUrl(String(i)):this.isServiceUrl(String(i.url))))return e.apply(window,s);let r=new sQ(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);return this.beforeFetch(r,i,n),this.setSessionTokenHeader((e,t)=>{if(void 0===this.tokenUrlMatcher||this.tokenUrlMatcher(r.url))if(void 0===s[1]&&s[0]instanceof Request)return s[0].headers.append(e,t);else 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(r)).catch(e=>{throw r.endTime=performance.now(),r.duration=r.endTime-(r.startTime||r.endTime),e})}beforeFetch(e,t,s){let i,n="GET",r={};if("string"==typeof t?(n=(null==s?void 0:s.method)||"GET",i=s1(t),r=(null==s?void 0:s.headers)||{}):(n=t.method||"GET",i=s1(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=sY(s.body))}afterFetch(e){return t=>{e.endTime=performance.now(),e.duration=e.endTime-(e.startTime||e.endTime),e.status=t.status,e.statusText=String(t.status);let s=!1;for(let[i,n]of(e.header={},t.headers))e.header[i]=n,s=n.toLowerCase().indexOf("chunked")>-1||s;s?e.readyState=3:(e.readyState=4,this.handleResponseBody(t.clone(),e).then(t=>{e.responseSize="string"==typeof t?t.length:t.byteLength,e.responseSizeText=s0(e.responseSize),e.response=sG(e.responseType,t);let s=e.getMessage();s&&this.sendMessage(s)}).catch(e=>{if("AbortError"!==e.name)throw e}));let i=(t.headers.get("content-type")||"").toLowerCase();return i.includes("application/json")||i.startsWith("text/")?new Proxy(t,new s5(t,e)):t}}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 s8{static create(e,t,s,i,n,r){return new Proxy(fetch,new s4(e,t,s,i,n,r))}}(eL=eU||(eU={}))[eL.UNSENT=0]="UNSENT",eL[eL.OPENED=1]="OPENED",eL[eL.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",eL[eL.LOADING=3]="LOADING",eL[eL.DONE=4]="DONE";class s6{constructor(e,t,s,i,n,r,o){this.ignoredHeaders=t,this.setSessionTokenHeader=s,this.sanitize=i,this.sendMessage=n,this.isServiceUrl=r,this.tokenUrlMatcher=o,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new sQ(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)}
9),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=sG(e,this.XMLReq.response)},0),this.XMLReq.readyState===eU.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 o=s[0],a=s[1];return this.item.method=o?o.toUpperCase():"GET",this.item.url=(null==(i=a.toString)?void 0:i.call(a))||"",this.item.name=null!=(r=null==(n=this.item.url)?void 0:n.replace(RegExp("/*$"),"").split("/").pop())?r:"",this.item.getData=((e,t={})=>{sZ(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})(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=sY(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))}setOnReadyStateChange(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 eU.UNSENT:case eU.OPENED:this.item.status=eU.UNSENT,this.item.statusText="Pending",this.item.startTime||(this.item.startTime=performance.now());break;case eU.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 eU.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:"u">typeof Blob&&t instanceof Blob?t.size:0;e&&(this.item.responseSize=e,this.item.responseSizeText=s0(this.item.responseSize))}break;case eU.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:"u">typeof Blob&&s instanceof Blob?s.size:0;e&&(this.item.responseSize=e,this.item.responseSizeText=s0(e))}break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown"}}}class s7{static create(e,t,s,i,n,r){return new Proxy(XMLHttpRequest,{construct(o){let a=new o;return new Proxy(a,new s6(a,e,t,s,i,n,r))}})}}let s9=e=>{console.warn(`Openreplay: Can't find ${e} in global context.`)},ie=Symbol("OpenReplayProxyOriginal"),it=e=>e&&void 0!==e[ie]?e[ie]:e,is=(e,t)=>(e[ie]=t,e);function ii(e){return e.__or_req_data__||(e.__or_req_data__={body:void 0,headers:{}}),e.__or_req_data__}function ir(e){return"string"==typeof e?e.toUpperCase():"GET"}let io=["composite","computedOffset","easing","offset"];function ia(e){let t=null===e;return!!(e&&"object"==typeof e&&!Array.isArray(e)&&!t)}let ih="$__or__initial_ref__$",il="$__or__distinct_device_id__$",ic="$__or__utm_params__$",iu="$__or__super_properties__$",id="$__or__user_id__$",ip="window"in globalThis?window:{navigator:{userAgent:""},screen:{},document:{cookie:""},location:{search:""}},ig="document"in globalThis?document:{referrer:""},im=["google","bing","yahoo","baidu","yandex","duckduckgo","ecosia","ask","aol","wolframalpha","startpage","swisscows","qwant","lycos","dogpile","info","teoma","webcrawler","naver","seznam","perplexity"];class iy{constructor(e,t){this.localStorage=e,this.sessionStorage=t,this.user_id=null,this.setUserId=e=>{this.user_id=e,this.sessionStorage.setItem(id,e??"")},this.resetUserId=e=>{this.user_id=null,e&&(this.deviceId=this.getDistinctDeviceId(!0))},this.getDistinctDeviceId=e=>{let t=this.localStorage.getItem(il);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(il,e),e}},this.getReferrer=()=>{let e=this.sessionStorage.getItem(ih);if(e)return e;{let e=ig.referrer;return this.sessionStorage.setItem(ih,e),e}},this.parseUTM=()=>{let e=this.sessionStorage.getItem(ic);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(ip.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(ic,JSON.stringify(t))}}
9,this.getSearchEngine=e=>{for(let t of im)if(e.includes(t))return t;return null},this.getSuperProperties=()=>{let e=this.localStorage.getItem(iu);return e?JSON.parse(e):{}},this.saveSuperProperties=e=>{this.localStorage.setItem(iu,JSON.stringify(e))},this.clearSuperProperties=()=>{this.localStorage.setItem(iu,JSON.stringify({}))};const{width:s,height:i,browser:n,browserVersion:r,browserMajorVersion:o,os:a,osVersion:h,mobile:l}=function(e){let t,s,i,n=0,r=0,o="";e.screen.width&&(n=e.screen.width,r=e.screen.height,o=`${n} x ${r}`);let a=e.navigator.appVersion??"0",h=e.navigator.userAgent??"unknown",l=e.navigator.appName??"unknown",c=String(parseFloat(a));-1!==(s=h.indexOf("YaBrowser"))?(l="Yandex",c=h.substring(s+10)):-1!==(s=h.indexOf("SamsungBrowser"))?(l="Samsung",c=h.substring(s+15)):-1!==(s=h.indexOf("UCBrowser"))?(l="UC Browser",c=h.substring(s+10)):-1!==(s=h.indexOf("OPR"))?(l="Opera",c=h.substring(s+4)):-1!==(s=h.indexOf("Opera"))?(l="Opera",c=h.substring(s+6),-1!==(s=h.indexOf("Version"))&&(c=h.substring(s+8))):-1!==(s=h.indexOf("Edge"))?(l="Microsoft Legacy Edge",c=h.substring(s+5)):-1!==(s=h.indexOf("Edg"))?(l="Microsoft Edge",c=h.substring(s+4)):-1!==(s=h.indexOf("MSIE"))?(l="Microsoft Internet Explorer",c=h.substring(s+5)):-1!==(s=h.indexOf("Chrome"))?(l="Chrome",c=h.substring(s+7)):-1!==(s=h.indexOf("Safari"))?(l="Safari",c=h.substring(s+7),-1!==(s=h.indexOf("Version"))&&(c=h.substring(s+8))):-1!==(s=h.indexOf("Firefox"))?(l="Firefox",c=h.substring(s+8)):-1!==h.indexOf("Trident/")?(l="Microsoft Internet Explorer",c=h.substring(h.indexOf("rv:")+3)):(t=h.lastIndexOf(" ")+1)<(s=h.lastIndexOf("/"))&&(l=h.substring(t,s),c=h.substring(s+1),l.toLowerCase()===l.toUpperCase()&&(l=e.navigator.appName)),-1!==(i=c.indexOf(";"))&&(c=c.substring(0,i)),-1!==(i=c.indexOf(" "))&&(c=c.substring(0,i)),-1!==(i=c.indexOf(")"))&&(c=c.substring(0,i));let u=parseInt(c,10);isNaN(u)&&(c=String(parseFloat(a)),u=parseInt(a,10));let d=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(a),p=e.navigator.cookieEnabled||!1;void 0!==navigator.cookieEnabled||p||(e.document.cookie="testcookie",p=-1!==e.document.cookie.indexOf("testcookie"));let f="-";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(h)){f=e.s;break}let g="-";if(/Windows/.test(f)){let t=/Windows (.*)/.exec(f);if(t&&t[1]&&"10"===(g=t[1])&&"userAgentData"in e.navigator){let e=navigator;e.userAgentData&&e.userAgentData.getHighEntropyValues(["platformVersion"]).then(e=>{g=13>parseInt(e.platformVersion.split(".")[0],10)?"10":"11"}).catch(()=>{})}f="Windows"}switch(f){case"Mac OS":case"Mac OS X":case"Android":{let e=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([\.\_\d]+)/.exec(h);g=e&&e[1]?e[1]:"-";break}case"iOS":{let e=/OS (\d+)_(\d+)_?(\d+)?/.exec(a);e&&e[1]&&(g=`${e[1]}.${e[2]}.${parseInt(e[3]||"0",10)}`)}}return{screen:o,width:n,height:r,browser:l,browserVersion:c,browserMajorVersion:u,mobile:d,os:f,osVersion:g,cookies:p}}(ip),c=this.sessionStorage.getItem(id);c&&(this.user_id=c),this.os=a,this.osVersion=h,this.browser=`${n}`,this.browserVersion=`${r} (${o})`,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(){let e,t,s,i,n;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:"17.2.4",timezone:(t=Math.abs(Math.floor((e=new Date().getTimezoneOffset())/60)),s=Math.abs(e%60),i=t.toString().padStart(2,"0"),n=s.toString().padStart(2,"0"),`UTC${e<=0?"+":"-"}${i}:${n}`),search_engine:this.searchEngine}}get defaultPropertyKeys(){return Object.keys(this.all)}get distinctId(){return this.deviceId}}let ib="user_actions",iv="events",iw=(e,t,s,i)=>{if(e===ib)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}}},iS=["properties","token","timestamp"];class ik{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(!ia(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=iw(iv,void 0,this.getTimestamp(),n);s?.send_immediately?this.batcher.sendImmediately(r):this.batcher.addEvent(r)},this.setProperty=(e,t)=>{let s=!1;ia(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;ia(e)&&Object.entries(e).forEach(([e,t])=>{this.ownProperties[e]||iS.includes(e)||(this.ownProperties[e]=t,s=!0)}),"string"!=typeof e||void 0===t||this.ownProperties[e]||iS.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]&&!iS.includes(e)&&(delete this.ownProperties[e],t=!0)}):this.ownProperties[e]&&!iS.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 iT{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=iw(ib,"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=iw(ib,"delete_user",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(ia(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=iw(ib,"set_property",void 0,{user_id:this.user_id,properties:s});this.batcher.addEvent(i)},this.setPropertiesOnce=e=>{if(!ia(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=iw(ib,"set_property_once",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=iw(ib,"append_property",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=iw(ib,"append_unique_property",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=iw(ib,"increment_property",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 iI{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={[ib]:[],[iv]:[]},this.intervalId=null,this.stopped=!1,this.paused=!1,this.onVisibilityChange=()=>{this.paused=document.hidden}}getBatches(){return this.batch[ib]=this.dedupePeopleEvents(),{data:{[ib]:[...this.batch[ib]],[iv]:[...this.batch[iv]]}}}addEvent(e){this.batch[e.category].push(e.data)}sendImmediately(e){this.sendBatch({[e.category]:[e.data]})}dedupePeopleEvents(){let e=this.batch[ib],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)]),o={};r.forEach(t=>{let i="number"==typeof e.payload[t]?e.payload[t]:0,n="number"==typeof s.payload[t]?s.payload[t]:0;o[t]=i+n}),t.set(s.type,{type:s.type,timestamp:s.timestamp,payload:o});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())}sendBatch(e){if(this.stopped)return;let t=0,s=()=>{let i=this.getToken();if(i)return t++,fetch(`${this.backendUrl}${this.apiEdp}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(e)}).then(async e=>{if(401===e.status){let i=await e.json().catch(()=>null);return this.standalone||i?.error!=="token expired"?t<this.retryLimit?this.init().then(()=>{s()}):void 0:void this.stop()}if(403===e.status)return t<this.retryLimit?this.init().then(()=>{s()}):void 0;if(!e.ok)throw Error(`HTTP error! status: ${e.status}`)}).catch(()=>{t<this.retryLimit&&setTimeout(()=>void s(),this.retryTimeout)})};s()}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(){let e=Object.keys(this.batch);e.every(e=>0===this.batch[e].length)||(this.sendBatch(this.getBatches()),e.forEach(e
9=>{this.batch[e]=[]}))}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 i_="__or_sdk_analytics_token";class iE{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)return void this.batcher.startAutosend();{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(i_,i.token);else throw Error("No token received from server")}},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(i_,""))},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(i_),this.constantProperties=new iy(this.localStorage,this.sessionStorage),this.batcher=new iI(this.backendUrl,this._getToken,this.init,this.standalone),this.events=new ik(this.constantProperties,this._getTimestamp,this.batcher),this.people=new iT(this.constantProperties,this._getTimestamp,this.setUserId,this.batcher),e.notStandalone&&this.init()}}let iC=e$,iN="/en/sdk";class iO{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:"17.2.4",projectKey:this.options.projectKey,doNotTrack:s,reason:t.length?`missing api: ${t.join(",")}`:e}))},this.restartCanvasTracking=()=>{null!==this.app&&this.app.restartCanvasTracking()},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=this.analytics?.track,this.userID=e=>{v("'userID' method","'setUserID' method","/"),this.setUserID(e)},this.handleError=(e,t={})=>{if(null!==this.app){if(e instanceof Error){let s=tq(e,[],t);this.app.send(s)}else if(e instanceof ErrorEvent||"PromiseRejectionEvent"in window&&e instanceof PromiseRejectionEvent){let s=tz(e,void 0,t);null!=s&&this.app.send(s)}}},this.incident=e=>{null!==this.app&&this.app.send(eI(e.label??"",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=!!(E()&&e.crossdomain?.enabled),!l||!function(e){if(null==e)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${y}${iN}`),!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 ${y}${iN} for more information.`),!1;else e.projectKey=e.projectID.toString(),v("`projectID` option","`projectKey` option",iN);else console.warn("OpenReplay: projectKey is expected to have a string type."),e.projectKey=e.projectKey.toString();return null!=e.sessionToken&&v("`sessionToken` option","`sessionHash` start() option","/"),!0}(e))return;if(window.__OPENREPLAY__||!this.crossdomainMode&&E()&&(()=>{try{return!!window.top?.document}catch{return!1}})()&&window.top.__OPENREPLAY__)return void console.error("OpenReplay: one tracker instance has been initialised already");if(!e.__DISABLE_SECURE_MODE&&"https:"!==location.protocol)return void 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.");const t=this.checkDoNotTrack(),s=[];if(t)s.push("doNotTrack");else for(const 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){const 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}const i=new tx(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);
9if(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);const s="https://api.openreplay.com/ingest";this.analytics=new iE({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,o=document.referrer,a=t?.urlSanitizer||(e=>e),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=a(s),l=e.sanitizer.privateMode?td(document.title):h(document.title),c=e.sanitizer.privateMode?td(n):n,u=e.sanitizer.privateMode?td(o):o;e.send(eP(c,u,r,l)),r=0,o=s}}),c=e.safe(()=>{let{innerWidth:t,innerHeight:s}=window;(t!==i||s!==n)&&(i=t,n=s,e.send(A(i,n)))}),d=void 0===document.hidden?Function.prototype:e.safe(()=>e.send(er(document.hidden)));e.attachStartCallback(()=>{s=null,r=u,i=n=-1,l(),c(),d()}),void 0!==document.hidden&&e.attachEventListener(document,"visibilitychange",d,!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(en(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){let s,i;if(!Object.assign({capturePerformance:!0},t).capturePerformance)return;let n=()=>{void 0!==s&&-1!==s&&(s++,requestAnimationFrame(n))};e.ticker.attach(()=>{void 0!==i&&-1!==i&&i++},0,!1);let r=()=>{void 0!==s&&void 0!==i&&(e.send(ei(s,i,ej.memory.totalJSHeapSize||0,ej.memory.usedJSHeapSize||0)),i=s=document.hidden?-1:0)};e.attachStartCallback(()=>{i=s=-1,r(),n()}),e.attachStopCallback(()=>{i=s=void 0}),e.ticker.attach(r,165,!1),void 0!==document.hidden&&e.attachEventListener(document,"visibilitychange",r,!1,!1)}(i,e),function(e){function t(){document.hidden||(e.debug.log("Openreplay: tab change to"+e.session.getTabId()),e.send(eM(e.session.getTabId())))}e.attachStartCallback(()=>{t()}),e.attachEventListener(window,"focus",t,!1,!1)}(i)),function(e,t){let s,{disableClickmaps:i=!1,customAttributes:n}=t||{},r=-1,o=-1,a=!1,h=null,l=0,c={},u=0,d=0,f=0,m=0;e.attachStartCallback(()=>{s=setInterval(()=>(function(){let t=m/225;if(!u){u=t;return}let s=(t-u)/225;f>4&&s>.008&&e.send(eN(p())),m=0,f=0,u=t})(),225)}),e.attachStopCallback(()=>{r=-1,o=-1,a=!1,h=null,c={},s&&clearInterval(s)});let y=()=>{a&&(e.send(V(r,o)),a=!1)},b=(t,s=!1)=>{let u=s?e.attachEventListener.bind(e):e.nodes.attachNodeListener.bind(e.nodes);u(t.documentElement,"mouseover",e=>{let s=tY(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,o=s.clientY+n,a=!0;let h=Math.sign(s.movementX);m+=Math.abs(s.movementX)+Math.abs(s.movementY),h!==d&&(d=h,f++)},!1),u(t,"click",s=>{let r=tY(s.target,t);if(!s.clientX&&!s.clientY||null===r)return;let o=e.nodes.getID(r);if(void 0!==o){var a,u;let d=s.pageX,p=s.pageY,f=t.documentElement.scrollWidth,m=t.documentElement.scrollHeight,b=tZ(d/f),v=tZ(p/m);y();let T=function(t){let s=k(t);if(null!==s)return s;if(eQ(t,"input"))return tV(t,n);let i=w(t,n);if(i)return i;if(t.id)return`#${t.id}`;let r=S(t);if(r)return r;if(tG(t)){let s="";return t instanceof HTMLElement&&(s=e.sanitizer.getInnerTextSecure(t)),g(s).slice(0,100)}return""}(r);e.send(ep(o,h===r?Math.round(performance.now()-l):0,e.sanitizer.privateMode?T.replaceAll(/./g,"*"):T,tG(r)&&!i?(a=o,u=r,c[a]=c[a]||function(e){if(!e||1!==e.nodeType)return!1;if(e.id)return`#${tJ(e.id)}`;let t=Array.from(e.attributes).find(e=>e.name.startsWith("data-"));if(t)return`[${t.name}="${tJ(t.value)}"]`;let s=[];for(;e&&1===e.nodeType&&e!==e.ownerDocument;
9){if(e.id){s.unshift(`#${tJ(e.id)}`);break}let t=e.tagName.toLowerCase();if(e.classList?.length){for(let i of e.classList)if(t1(i)&&t0(i,e.ownerDocument))return s.unshift(`${t}.${tJ(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(t1(s)&&t0(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}.${tJ(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(" > ")}(u)||""):"",b,v),!0)}h=null})};e.nodes.attachNodeCallback(e=>{eV(e)&&b(e)}),b(document,!0),e.ticker.attach(y,t?.trackingOffset||7)}(i,{...e.mouse,customAttributes:e.customAttributes}),function(e,t){let s=!1,i=new Map;function n(e){ez(e)&&(eK(e)&&i.set(e,[e.scrollLeft,e.scrollTop]),eV(e)&&i.set(e,sq(e)))}let r=e.safe(()=>{t||e.send(L(...sq(document)))}),o=e.safe((t,s)=>{let i=e.nodes.getID(s);void 0!==i&&e.send(F(i,t[0],t[1]))});e.attachStartCallback(r),e.attachStopCallback(()=>{s=!1,i.clear()}),e.nodes.attachNodeCallback((t,s)=>{s&&(eK(t)&&t.scrollLeft+t.scrollTop>0?i.set(t,[t.scrollLeft,t.scrollTop]):eV(t)&&i.set(t,sq(t))),eJ(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(o),i.clear()},5,!1)}(i,this.crossdomainMode),function(e,t){if(null===e)return;if(!window.CSSStyleSheet)return e.send(ec("no_stylesheet_prototype_in_window",""));let s={...sz,...t},i=new Map,n=null,r=new Set,o=s.checkCssInterval||200,a={};function h(){if(s.scanInMemoryCSS)for(let t of r.values())try{let n=e9.get(t);if(!n)continue;if(s.checkLimit&&(a[n]?a[n]++:a[n]=0,a[n]>s.checkLimit))return void r.delete(t);for(let s=0;s<t.cssRules.length;s++)try{let r=t.cssRules[s],o=`${n}:${s}`,a=i.get(o),h=r.cssText;a!==h&&(void 0!==a&&e.send(ey(n,s)),e.send(em(n,h,s,e.getBaseHref())),i.set(o,h))}catch(e){}for(let e of Array.from(i.keys()).filter(e=>e.startsWith(`${n}:`)))parseInt(e.split(":")[1],10)>=t.cssRules.length&&i.delete(e)}catch(e){r.delete(t)}}let l=/{\s*}/,c=e.safe((t,s,n)=>{let o=e9.get(t);if(o)if("string"==typeof n)e.send(em(o,n,s,e.getBaseHref())),l.test(n)&&(i.set(`${o}:${s}`,n),r.add(t));else e.send(ey(o,s)),i.has(`${o}:${s}`)&&i.delete(`${o}:${s}`)}),u=e.safe(t=>{let s=t;for(;s.parentRule;)s=s.parentRule;let n=s.parentStyleSheet;if(!n)return;let o=e9.get(n);if(!o)return;let a=s.cssText,h=Array.from(n.cssRules).indexOf(s);h>=0&&(e.send(em(o,a,h,e.getBaseHref())),e.send(ey(o,h+1)),l.test(a)&&(i.set(`${o}:${h}`,a),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=>{if(!eQ(t,"style")||!t.sheet||null!==t.textContent&&t.textContent.trim().length>0)return;let s=e.nodes.getID(t);if(!s)return;let i=t.sheet,n=e7();e9.set(i,n),e.send(eb(n,s));for(let e=0;e<i.cssRules.length;e++)try{c(i,e,i.cssRules[e].cssText)}catch(e){}}),setTimeout(function(){!n&&s.scanInMemoryCSS&&(n=window.setInterval(h,o))},50),e.attachStopCallback(()=>{n&&(clearInterval(n),n=null),i.clear()})}(i,e.css),function(e){if(null===e||!e8(document))return;let t=new Map,s=new Map,i=i=>setTimeout(()=>{let n=e.nodes.getID(i);if(i===document&&(n=0),void 0===n)return;let r=s.get(n);r||(r=[]);let o=[],a=i.adoptedStyleSheets;if(a&&Symbol.iterator in a)for(let s of a){let i=t.get(s),a=!i;if(i||(i=e7(),t.set(s,i)),r.includes(i)||e.send(eb(i,n)),a){let t=s.cssRules;for(let s=0;s<t.length;s++)e.send(em(i,t[s].cssText,s,e.getBaseHref()))}o.push(i)}if(Symbol.iterator in r)for(let t of r)o.includes(t)||e.send(ev(t,n));s.set(n,o)},20);function n(e){let t=Object.getOwnPropertyDescriptor(e,"adoptedStyleSheets");t&&Object.defineProperty(e,"adoptedStyleSheets",{...t,set:function(e){let s=t.set.call(this,e);return i(this),s}})}let r=s=>{if(s.__openreplay_adpss_patched__)return;s.__openreplay_adpss_patched__=!0,n(s.Document.prototype),n(s.ShadowRoot.prototype);let{replace:i,replaceSync:r}=s.CSSStyleSheet.prototype;s.CSSStyleSheet.prototype.replace=function(s){return i.call(this,s).then(i=>{let n=t.get(this);return n&&e.send(eg(n,s,e.getBaseHref())),i})},s.CSSStyleSheet.prototype.replaceSync=function(s){let i=t.get(this);return i&&e.send(eg(i,s,e.getBaseHref())),r.call(this,s)}};r(window),e.observer.attachContextCallback(e.safe(r)),e.attachStopCallback(()=>{t.clear(),s.clear()}),e.attachStartCallback(()=>{i(document)}),e.nodes.attachNodeCallback(e=>{e8(e)&&i(e)})}(i),function(e,t){let s=Object.assign({consoleMethods:tU,consoleThrottling:30},t);
9if(!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 tL(i);case"s":return tA(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(tL).join(" "));e.sanitizer.privateMode&&(i=i.replaceAll(/./g,"*")),e.send(J(t,i))}),n=0,r=()=>{n=0};e.attachStartCallback(r),e.ticker.attach(r,33,!1);let o=e.safe(t=>{var r;let o;return r=t.console,o={apply:function(e,r,o){Reflect.apply(e,t,o),(n+=1)>s.consoleThrottling||i(e.name,o)}},void s.consoleMethods.forEach(s=>{if(-1===tU.indexOf(s))return void e.debug.error(`OpenReplay: unsupported console method "${s}"`);let i=t.console[s];r[s]=new Proxy(i,o)})});o(window),e.observer.attachContextCallback(o)}(i,e),function(e,t){function s(t){function s(s){let i=tz(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=>tF(e)).join(", ");e.attributeSender.sendSetAttribute(t,"srcset",n)},i=function(s,i){i.src.length>1e5&&t(s,i),e.send(eh(s,"src",i.src,e.getBaseHref()))},n=e.safe(function(t){let s=tF(t.src||"");m(s)&&e.send(eT(e.timestamp(),0,0,0,0,0,s,"img",0,!1,0,0,0,0,0,0,0))}),r=e.safe(function(r){let o=e.nodes.getID(r);if(void 0!==o&&r.complete){var a;0!==r.naturalHeight||0!==r.naturalWidth||(a=r.src,c&&(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)}}),o=N(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)return;"src"===n.attributeName&&i(r,t),"srcset"===n.attributeName&&s(r,t)}}),e.options.forceNgOff);e.attachStopCallback(()=>{o.disconnect()}),e.nodes.attachNodeCallback(t=>{eQ(t,"img")&&(e.nodes.attachNodeListener(t,"error",()=>n(t)),e.nodes.attachNodeListener(t,"load",()=>r(t)),r(t),o.observe(t,{attributes:!0,attributeFilter:["src","srcset"]}))})}(i),function(e,t){let s=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:1,obscureInputDates:!1},t);function i(t,i){let n=i.value,r=s.defaultInputMode;"password"===i.type||e.sanitizer.isHidden(t)?r=2:(e.sanitizer.isObscured(t)||0===r&&(s.obscureInputNumbers&&"date"!==i.type&&/\d\d\d\d/.test(n)||s.obscureInputDates&&"date"===i.type||s.obscureInputEmails&&("email"===i.type||~n.indexOf("@"))))&&(r=1);let o=0;switch(r){case 2:o=-1,n="";break;case 1:o=n.length,n=""}return{value:n,mask:o}}function n(t,s){let{value:n,mask:r}=i(t,s);e.send(K(t,n,r))}let r=new Map,o=new Map;function a(e,t){r.get(e)!==t.value&&(r.set(e,t.value),n(e,t))}function h(t,s){o.get(t)!==s&&(o.set(t,s),e.send(X(t,s)))}e.attachStopCallback(()=>{r.clear(),o.clear()}),e.ticker.attach(()=>{r.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return r.delete(s);a(s,i)}),o.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return o.delete(s);h(s,i.checked)})},3),e.nodes.attachNodeCallback(e.safe(t=>{let r=e.nodes.getID(t);if(void 0!==r){if(eQ(t,"select")&&(n(r,t),e.nodes.attachNodeListener(t,"change",()=>n(r,t))),eQ(t,"textarea")||eQ(t,"input")&&tK.includes(t.type)){a(r,t);let n=0,o=0,h=0;e.nodes.attachNodeListener(t,"focus",()=>{n=p()}),e.nodes.attachNodeListener(t,"input",()=>{0===o&&0!==n&&(o=p()-n)}),e.nodes.attachNodeListener(t,"change",()=>{0!==n&&(h=p()-n),function(t,n,r,o){let{value:a,mask:h}=i(t,n),l=tV(n,s.customAttributes);e.sanitizer.privateMode&&(l=l.replaceAll(/./g,"*")),e.send(eE(t,a,0!==h,l,r,o))}(r,t,o,h),o=0,h=0,n=0});return}if(function(e){if(!eQ(e,"input"))return!1;let t=e.type;return"checkbox"===t||"radio"===t}(t)){h(r,t.checked),e.nodes.attachNodeListener(t,"change",()=>h(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){if(t.duration<0||!m(t.name)||e.isServiceURL(t.name))return;null!==i&&(i[t.name]=t.startTime+t.duration);let n=!1;
9if(s.excludedResourceUrls?.forEach(e=>{if(t.name.startsWith(e)){n=!0;return}}),n)return;let r=0;r=t.connectEnd&&t.connectEnd>t.domainLookupEnd?Math.max(0,t.requestStart-t.connectEnd):Math.max(0,t.requestStart-t.domainLookupEnd);let o={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:r},a=s.resourceNameSanitizer?s.resourceNameSanitizer(t.name):t.name,h=t.responseStatus&&304===t.responseStatus||t.deliveryType&&"cache"===t.deliveryType||0===t.transferSize&&t.decodedBodySize>0,l=t.responseStatus&&t.responseStatus>=400?-111:t.decodedBodySize||0;e.send(eT(t.startTime+u,t.duration,o.ttfb,t.transferSize>t.encodedBodySize?t.transferSize-t.encodedBodySize:0,t.encodedBodySize||0,l,e.sanitizer.privateMode?t.name.replaceAll(/./g,"*"):a,t.initiatorType,t.transferSize,h,o.queueing,o.dnsLookup,o.initialConnection,o.ssl,o.contentDownload,o.total,o.stalled))}let r=new PerformanceObserver(e=>e.getEntries().forEach(n));function o(t){if(e.active())return e.send(eA(t.name,String(t.value)))}e.attachStartCallback(function({sessionID:e}){r.observe({type:"resource",buffered:!0}),sS(o),sL(o),sj(o),sH(o)}),e.attachStopCallback(function(){r.disconnect()});let a=0,h=0;if(s.capturePageLoadTimings){let t=!1;e.ticker.attach(()=>{if(!t&&((0===a||0===h)&&performance.getEntriesByType("paint").forEach(e=>{let{name:t,startTime:s}=e;switch(t){case"first-paint":a=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:o,domContentLoadedEventEnd:l,loadEventStart:c,loadEventEnd:u}=performance.timing;e.send(Q(i-s||0,n-s||0,r-s||0,o-s||0,l-s||0,c-s||0,u-s||0,a,h))}},30)}if(s.capturePageRenderTimings){let t=0,s=0,n=0,r=null,o=!1;e.ticker.attach(()=>{if(o)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],o="";if(eQ(r,"img")&&(o=r.currentSrc||r.src),!o){let e=getComputedStyle(r).getPropertyValue("background-image");if(e){let t=i.exec(e);null!==t&&((o=t[1]).startsWith('"')||o.startsWith("'"))&&(o=o.substr(1,o.length-2))}}if(!o)continue;let a="data:image"===o.substr(0,10)?0:e[o];if(void 0===a)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:a,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){o=!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:o}=t[n];s+=o,i+=o*(r>e?r:e)}return 0===s?0:i/s}(h||a,r),{domContentLoadedEventEnd:c,navigationStart:u}=performance.timing,d=null===n?Math.max(s,h,c-u||0):0;e.send(G(l,h>t?h:t,d))}})}}(i,e),function(e,t){if(!t.longTasks||!("PerformanceObserver"in window))return;let s=t=>{e.send(e_(t.name,t.duration,t.blockingDuration,t.firstUIEventTimestamp,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(ea(s))}let s=!1;e.nodes.attachNodeCallback(i=>
9{eQ(i,"body")&&(e.nodes.attachNodeListener(i,"focus",e=>{ez(e.target)&&(t(e.target),s=!1)}),e.nodes.attachNodeListener(i,"blur",t=>{null===t.relatedTarget&&(s=!0,setTimeout(()=>{s&&e.send(ea(-1))},0))}))}),e.attachStartCallback(()=>{let e=document.activeElement;for(;e&&eQ(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])});const r=[i[0],i[1],n],o=t.get(s.document)||[];o.push(r),t.set(s.document,o);const a=s===window?0:e.nodes.getID(s.document);if(void 0===a)return;e.active()&&e.send(eo(a,...r))}super(...i)}}s.FontFace=i};e.observer.attachContextCallback(s),s(window),e.nodes.attachNodeCallback(e.safe(s=>{if(!eV(s))return;let i=t.get(s);if(!i)return;let n=s.defaultView===window?0:e.nodes.getID(s);void 0!==n&&i.forEach(t=>{e.send(eo(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 o(t){if(r){let s=e.getSessionToken();s&&e.safe(t)(r,s)}}function a(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,o={xhr:!0,fetch:!0,beacon:!0},a){var h;if(e){if(o.xhr){let o=it(e.XMLHttpRequest);o?e.XMLHttpRequest=is(s7.create(t,s,i,n,r,a),o):s9("XMLHttpRequest")}if(o.fetch){let o=it(e.fetch);o?e.fetch=is(s8.create(t,s,i,n,r,a),o):s9("fetch")}if(o.beacon&&(null==(h=e.navigator)?void 0:h.sendBeacon)){let o=it(e.navigator.sendBeacon);e.navigator.sendBeacon=is(s3.create(o,t,s,i,n,r),o)}}}(t,!!e.sanitizer.privateMode||s.ignoreHeaders,o,a,t=>{if(s.failuresOnly&&t.status<400)return;let i=e.sanitizer.privateMode?"************":t.url;e.send(eS(t.requestType,t.method,i,t.request,t.response,t.status,t.startTime+u,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);o(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 o=performance.now()-c;if(s.failuresOnly&&r.status<400)return r;let d=r.clone();return d.text().then(s=>{let r={},p={};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),d.headers.forEach((e,t)=>{n(t)||(p[t]=e)})}let f=ir(l.method),g=a({url:String(t),method:f,status:d.status,request:{headers:r,body:l.body||null},response:{headers:p,body:s}});g&&e.send(eS("fetch",f,String(g.url),h(g.request),h(g.response),d.status,c+u,o,0))}).catch(t=>e.debug.error("Could not process Fetch response:",t)),r})};let l=t.XMLHttpRequest.prototype.open,c=t.XMLHttpRequest.prototype.setRequestHeader,d=t.XMLHttpRequest.prototype.send;s.axiosInstances||(t.XMLHttpRequest.prototype.open=function(t,s){let i=this;o((e,t)=>i.setRequestHeader(e,t));let r=0;return i.addEventListener("loadstart",e=>{r=e.timeStamp}),i.addEventListener("load",e.safe(o=>{let{headers:l,body:c}=ii(i),d=r>0?o.timeStamp-r:0,p=(i.getAllResponseHeaders()||"").trim().split(/[\r\n]+/),f={};p.forEach(function(e){let t=e.split(": "),s=t.shift();n(s)||(f[s]=t.join(": "))});let g=ir(t),m=a({url:String(s),method:g,status:i.status,request:{headers:l,body:c||null},response:{headers:f,body:i.response}});m&&e.send(eS("xhr",g,String(m.url),h(m.request),h(m.response),i.status,r+u,d,0))})),l.apply(this,arguments)},t.XMLHttpRequest.prototype.send=function(e){return ii(this).body=e,d.apply(this,arguments)},t.XMLHttpRequest.prototype.setRequestHeader=function(e,t){return n(e)||(ii(this).headers[e]=t),c.apply(this,arguments)})};
9l(window),s.axiosInstances&&s.axiosInstances.forEach(t=>{function i(t){e.debug.log("Openreplay: capturing axios response data",t);let{headers:i,data:n,method:r,url:o,baseURL:l}=t.config,{data:c,headers:d,status:p,response:f}=t,{data:g,headers:m,status:y}=f||{},b=s.ignoreHeaders,v=Array.isArray(b)?e=>b.includes(e):()=>b;function w(e,t){v(t[0])||(e[t[0]]=t[1])}let S={},k={};i.toJSON?S=i.toJSON():i instanceof Headers?i.forEach((e,t)=>w(S,[t,e])):Array.isArray(i)?i.forEach(e=>w(S,e)):"object"==typeof i&&Object.entries(i).forEach(e=>w(S,e));let T=m||d;T.toJSON?k=T.toJSON():T instanceof Headers?T.forEach((e,t)=>w(k,[t,e])):Array.isArray(T)?T.forEach(e=>w(k,e)):"object"==typeof T&&Object.entries(T).forEach(([e,t])=>{v(e)||(k[e]=t)});let I=a({url:o,method:r||"",status:p||y||0,request:{headers:S,body:n},response:{headers:k,body:g||c}});if(!I)return void e.debug.log("Openreplay: empty request/response info, skipping");let _=t.config.__openreplay_timing,E=performance.now()-_;e.debug.log("Openreplay: final req object",I),e.send(eS("xhr",String(r),String(I.url),h(I.request),h(I.response),I.status,_+u,E,0))}e.debug.log("Openreplay: attaching axios spy to instance",t);let n=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}),r=t.interceptors.response.use(function(e){return s.failuresOnly||i(e),e},function(t){var s,n;return e.debug.log("Openreplay: capturing API request error",t),null!==(n=s=t)&&"object"==typeof n&&!0===s.isAxiosError&&t.response?i(t.response):t instanceof Error&&e.send(tq(t,[])),Promise.reject(t)},{synchronous:!0});e.attachStopCallback(()=>{t.interceptors.request.eject?.(n),t.interceptors.response.eject?.(r)})}),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(eC(-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(eC(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)return;let r=getComputedStyle(s),o=Object.keys(n).filter(e=>!io.includes(e)),a={};o.forEach(e=>{a[e]=r[e]}),e.send(es(i,JSON.stringify(a)))},{once:!0}))}function o(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),o(t,n),t.addEventListener("animationstart",()=>o(t,n)))}});let a=Element.prototype.animate;Element.prototype.animate=function(...t){let s=a.apply(this,t),i=e.nodes.getID(this);return i&&r(s,this,i),s},e.attachStopCallback(()=>{Element.prototype.animate=a,i=new WeakSet,n=new WeakSet})}(i,e.webAnimations),window.__OPENREPLAY__=this;const 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!!l||(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 ${y}${iN}`),!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 v("'sessionID' method","'getSessionID' method","/"),this.get
9SessionID()}setUserAnonymousID(e){"string"==typeof e&&null!==this.app&&this.app.send(ee(e))}userAnonymousID(e){v("'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){v("'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);else{if(!t||"string"==typeof t)return this.app.send(Y(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(Y(e,t))}}issue(e,t=null){if("string"==typeof e&&null!==this.app){try{t=JSON.stringify(t)}catch(e){return}this.app.send(eu(e,t))}}}class iM{constructor(){this.instance=null,this.isConfigured=!1,this.identify=this.setUserID,this.track=(e,t,s)=>{l&&this.ensureConfigured()&&this.instance&&this.instance.track?.(e,t)}}configure(e){if(l){if(this.isConfigured)return void console.warn("OpenReplay: Tracker is already configured. You should only call configure once.");if(!e.projectKey)return void console.error("OpenReplay: Missing required projectKey option");this.instance=new iO(e),this.isConfigured=!0}}get options(){return this.instance?.options||null}start(e){return l?this.ensureConfigured()?this.instance?.start(e)||Promise.resolve({success:!1,reason:"Tracker not initialized"}):Promise.resolve({success:!1,reason:"Tracker not configured"}):Promise.resolve({success:!1,reason:"Not in browser environment"})}stop(){if(l&&this.ensureConfigured()&&this.instance)return this.instance.stop()}setUserID(e){l&&this.ensureConfigured()&&this.instance&&this.instance.setUserID(e)}get analytics(){return this.instance?.analytics?this.instance.analytics:null}setMetadata(e,t){l&&this.ensureConfigured()&&this.instance&&this.instance.setMetadata(e,t)}getSessionURL(e){if(l&&this.ensureConfigured()&&this.instance)return this.instance.getSessionURL(e)}getSessionID(){return l&&this.ensureConfigured()&&this.instance?this.instance.getSessionID():null}getSessionToken(){return l&&this.ensureConfigured()&&this.instance?this.instance.getSessionToken():null}event(e,t=null,s=!1){l&&this.ensureConfigured()&&this.instance&&this.instance.event(e,t,s)}issue(e,t=null){l&&this.ensureConfigured()&&this.instance&&this.instance.issue(e,t)}handleError(e,t={}){l&&this.ensureConfigured()&&this.instance&&this.instance.handleError(e,t)}restartCanvasTracking(){l&&this.ensureConfigured()&&this.instance&&this.instance.restartCanvasTracking()}setUserAnonymousID(e){l&&this.ensureConfigured()&&this.instance&&this.instance.setUserAnonymousID(e)}isActive(){return!!l&&!!this.ensureConfigured()&&!!this.instance&&this.instance.isActive()}getInstance(){return this.ensureConfigured()&&l?this.instance:null}coldStart(e,t){if(l&&this.ensureConfigured()&&this.instance)return this.instance.coldStart(e,t)}trackWs(e){return l&&this.ensureConfigured()&&this.instance?this.instance.trackWs(e):()=>{}}ensureConfigured(){return!!this.isConfigured||!l||(console.warn('OpenReplay: Tracker must be configured before use. Call tracker.configure({projectKey: "your-project-key"}) first.'),!1)}use(e){return l&&this.ensureConfigured()&&this.instance?this.instance.use(e):e(null)}startOfflineRecording(...e){if(l&&this.ensureConfigured()&&this.instance)return this.instance.startOfflineRecording(...e)}uploadOfflineRecording(){if(l&&this.ensureConfigured()&&this.instance)return this.instance.uploadOfflineRecording()}forceFlushBatch(){if(l&&this.ensureConfigured()&&this.instance)return this.instance.forceFlushBatch()}getSessionInfo(){return l&&this.ensureConfigured()&&this.instance?this.instance.getSessionInfo():null}getTabId(){return l&&this.ensureConfigured()&&this.instance?this.instance.getTabId():null}}let iR=new iM}}]);

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.