"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1348],{71711:(e,t,s)=>{var i,n={},r=function(e,t,s,i,r){var a=new Worker(n[t]||(n[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(e){var t=e.data,s=t.$e$;if(s){var i=Error(s[0]);i.code=s[1],i.stack=s[2],r(i,null)}else r(null,t)},a.postMessage(s,i),a},a=Uint8Array,o=Uint16Array,l=Int32Array,h=new a([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),c=new a([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),u=new a([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(e,t){for(var s=new o(31),i=0;i<31;++i)s[i]=t+=1<>1|(21845&y)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,b[y]=((65280&v)>>8|(255&v)<<8)>>1}for(var S=function(e,t,s){for(var i,n=e.length,r=0,a=new o(t);r>h]=c}else for(r=0,i=new o(n);r>15-e[r]);return i},w=new a(288),y=0;y<144;++y)w[y]=8;for(var y=144;y<256;++y)w[y]=9;for(var y=256;y<280;++y)w[y]=7;for(var y=280;y<288;++y)w[y]=8;for(var k=new a(32),y=0;y<32;++y)k[y]=5;var T=S(w,9,0),I=S(k,5,0),x=function(e){return(e+7)/8|0},E=function(e,t,s){return(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length),new a(e.subarray(t,s))},C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],_=function(e,t,s){var i=Error(t||C[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,_),!s)throw i;return i},N=function(e,t,s){s<<=7&t;var i=t/8|0;e[i]|=s,e[i+1]|=s>>8},O=function(e,t,s){s<<=7&t;var i=t/8|0;e[i]|=s,e[i+1]|=s>>8,e[i+2]|=s>>16},M=function(e,t){for(var s=[],i=0;if&&(f=r[i].s);var g=new o(f+1),m=R(s[d-1],g,0);if(m>t){var i=0,b=0,y=m-t,v=1<t)b+=v-(1<>=y;b>0;){var w=r[i].s;g[w]=0&&b;--i){var k=r[i].s;g[k]==t&&(--g[k],++b)}m=t}return{t:new a(g),l:m}},R=function(e,t,s){return -1==e.s?Math.max(R(e.l,t,s+1),R(e.r,t,s+1)):t[e.s]=s},D=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new o(++t),i=0,n=e[0],r=1,a=function(e){s[i++]=e},l=1;l<=t;++l)if(e[l]==n&&l!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)a(32754);r>2&&(a(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(a(n),--r;r>6;r-=6)a(8304);r>2&&(a(r-3<<5|8208),r=0)}for(;r--;)a(n);r=1,n=e[l]}return{c:s.subarray(0,i),n:t}},A=function(e,t){for(var s=0,i=0;i>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;r4&&!W[u[X-1]];--X);var K=p+5<<3,J=A(n,w)+A(r,k)+a,G=A(n,x)+A(r,_)+a+14+3*X+A(z,W)+2*z[16]+3*z[17]+7*z[18];if(d>=0&&K<=J&&K<=G)return L(t,f,e.subarray(d,d+p));if(N(t,f,1+(G15&&(N(t,f,ee[q]>>5&127),f+=ee[q]>>12)}}else g=T,m=w,b=I,y=k;for(var q=0;q255){var et=es>>18&31;O(t,f,g[et+257]),f+=m[et+257],et>7&&(N(t,f,es>>23&31),f+=h[et]);var ei=31&es;O(t,f,b[ei]),f+=y[ei],ei>3&&(O(t,f,es>>5&8191),f+=c[ei])}else O(t,f,g[es]),f+=m[es]}return O(t,f,g[256]),f+m[256]},j=new l([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),P=new a(0),B=function(e,t,s,i,n,r){var u=r.z||e.length,d=new a(i+u+5*(1+Math.ceil(u/7e3))+n),p=d.subarray(i,d.length-n),f=r.l,b=7&(r.r||0);if(t){b&&(p[0]=r.r>>3);for(var y=j[t-1],v=y>>13,S=8191&y,w=(1<7e3||P>24576)&&($>423||!f)){b=F(e,p,0,N,O,M,D,P,U,A-U,b),P=R=D=0,U=A;for(var W=0;W<286;++W)O[W]=0;for(var W=0;W<30;++W)M[W]=0}var V=2,X=0,K=S,J=z-q&32767;if($>2&&H==_(A-J))for(var G=Math.min(v,$)-1,Q=Math.min(32767,A),Y=Math.min(258,$);J<=Q&&--K&&z!=q;){if(e[A+V]==e[A+V-J]){for(var Z=0;ZV){if(V=Z,X=J,Z>G)break;for(var ee=Math.min(J,Z-2),et=0,W=0;Wet&&(et=en,q=es)}}}q=k[z=q],J+=z-q&32767}if(X){N[P++]=0x10000000|g[V]<<18|m[X];var er=31&g[V],ea=31&m[X];D+=h[er]+c[ea],++O[257+er],++M[ea],B=A+V,++R}else N[P++]=e[A],++O[e[A]]}}for(A=Math.max(A,B);A=u&&(p[b/8|0]=f,eo=u),b=L(p,b+1,e.subarray(A,eo))}r.i=u}return E(d,0,i+x(b)+n)},U=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var s=t,i=9;--i;)s=(1&s&&-0x12477ce0)^s>>>1;e[t]=s}return e}(),H=function(){var e=-1;return{p:function(t){for(var s=e,i=0;i>>8;e=s},d:function(){return~e}}},z=function(e,t,s,i,n){if(!n&&(n={l:1},t.dictionary)){var r=t.dictionary.subarray(-32768),o=new a(r.length+e.length);o.set(r),o.set(e,r.length),e=o,n.w=r.length}return B(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,s,i,n)},q=function(e,t){var s={};for(var i in e)s[i]=e[i];for(var i in t)s[i]=t[i];return s},$=function(e,t,s){for(var i=e(),n=e.toString(),r=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a>>=8},Z=function(e,t){var s=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&Y(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),s){e[3]=8;for(var i=0;i<=s.length;++i)e[i+10]=s.charCodeAt(i)}},ee=function(e){return 10+(e.filename?e.filename.length+1:0)};function et(e,t){return z(e,t||{},0,0)}function es(e,t){t||(t={});var s=H(),i=e.length;s.p(e);var n=z(e,t,ee(t),8),r=n.length;return Z(n,t),Y(n,r-8,s.d()),Y(n,r-4,i),n}var ei="undefined"!=typeof TextDecoder&&new TextDecoder;try{ei.decode(P,{stream:!0})}catch(e){}class en{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 er{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 en}applyDict(e){let[t,s]=this.dict.getKey(e);return s&&this.app.send([34,t,e]),t}clear(){this.dict=new en}}class ea{constructor(e,t){this.app=e,this.startParams=t,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=e=>{let t=el(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=eo[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=eo[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=eo[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=eo[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=eo[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=eo[e.operator];s&&t.some(t=>s(t,e.value))&&this.trigger(e.name)})}}let eo={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{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};class eh{constructor(e){this.app=e,this.flags=[],this.storageKey="__openreplay_flags";let t=this.app.sessionStorage.getItem(this.storageKey);if(t){let e=t.split(";").filter(Boolean);this.flags=e.map(e=>JSON.parse(e))}}getFeatureFlag(e){return this.flags.find(t=>t.key===e)}isFlagEnabled(e){return -1!==this.flags.findIndex(t=>t.key===e)}onFlagsLoad(e){this.onFlagsCb=e}async reloadFlags(e){let t=this.app.sessionStorage.getItem(this.storageKey),s={};t&&t.split(";").filter(Boolean).forEach(e=>{let t=JSON.parse(e);s[t.key]={key:t.key,value:t.value}});let i=this.app.session.getInfo(),n=this.app.session.userInfo,r={projectID:i.projectID,userID:i.userID,metadata:i.metadata,referrer:document.referrer,os:n.userOS,device:n.userDevice,country:n.userCountry,state:n.userState,city:n.userCity,browser:n.userBrowser,persistFlags:s},a=e??this.app.session.getSessionToken(),o=await fetch(this.app.options.ingestPoint+"/v1/web/feature-flags",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(r)});if(200===o.status){let e=await o.json();return this.handleFlags(e.flags)}}handleFlags(e){let t=[];e.forEach(e=>{e.is_persist&&t.push(e)});let s="";return this.diffPersist(t).forEach(e=>{s+=`${JSON.stringify(e)};`}),this.app.sessionStorage.setItem(this.storageKey,s),this.flags=e,this.onFlagsCb?.(e)}clearPersistFlags(){this.app.sessionStorage.removeItem(this.storageKey)}diffPersist(e){let t=this.app.sessionStorage.getItem(this.storageKey);if(!t)return e;let s=t.split(";").filter(Boolean).map(e=>JSON.parse(e));return e.filter(e=>-1===s.findIndex(t=>t.key===e.key))}}let ec={htmlmasked:"hidden",masked:"obscured"},eu="undefined"!=typeof window,ed=eu&&navigator.userAgent.match(/firefox|fxios/i),ep=eu?Date.now()-performance.now():0;function ef(){ep=Date.now()-performance.now()}let eg=eu&&performance.now?()=>Math.round(performance.now()+ep):()=>Date.now(),em="repeat"in String.prototype?e=>"*".repeat(e.length):e=>e.replace(/./g,"*");function eb(e){return e.trim().replace(/\s+/g," ")}function ey(e){return e.startsWith("https://")||e.startsWith("http://")}let ev="https://docs.openreplay.com",eS={};function ew(e,t,s="/"){!eS[e]&&(console.warn(`OpenReplay: ${e} is deprecated. ${t?`Please, use ${t} instead.`:""} Visit ${ev}${s} for more information.`),eS[e]=!0)}function ek(e){let t=e.getAttribute("data-openreplay-label");return null!==t||null!==(t=e.getAttribute("data-asayer-label"))&&ew('"data-asayer-label" attribute','"data-openreplay-label" attribute',"/"),t}function eT(e,t){let s=`data-openreplay-${t}`;return!!e.hasAttribute(s)&&(ec[t]&&ew(`"${s}" attribute`,`"${ec[t]}" attribute`,"/en/sdk/sanitize-data"),!0)}function eI(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 ex(e){return e.toString(16).padStart(2,"0")}function eE(){try{return window.self&&window.top&&window.self!==window.top}catch(e){return!0}}function eC(e){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(e):e}function e_(e,t){if(t)return new MutationObserver(e);{let t=eC("MutationObserver");return new window[t](e)}}function eN(e,t,s,i,n){if(!eI(e))return;let r="addEventListener";n||(r=eC("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 eO(e,t,s,i,n){if(!eI(e))return;let r="removeEventListener";n||(r=eC("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 eM{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 eR=new eM;function eD(e){eR.addTask(e)}function eA(e){return[0,e]}function eL(e,t){return[13,e,t]}function eF(e,t){return[30,e,t]}function ej(e,t,s,i){return[57,e,t,s,i]}function eP(e){return[58,e]}function eB(e,t,s,i){return[60,e,t,s,i]}function eU(e,t){return[70,e,t]}function eH(e,t,s){return[71,e,t,s]}function ez(e,t,s,i){return[73,e,t,s,i]}function eq(e,t){return[75,e,t]}function e$(e,t){return[76,e,t]}function eW(e,t,s,i){return[78,e,t,s,i]}function eV(e,t,s,i,n,r,a,o,l){return[83,e,t,s,i,n,r,a,o,l]}function eX(e,t,s){return[113,e,t,s]}function eK(e){return[115,e]}function eJ(e,t,s,i,n,r,a,o,l,h){return[116,e,t,s,i,n,r,a,o,l,h]}function eG(e){return[117,e]}function eQ(e){return[118,e]}let eY=eu&&"performance"in window&&"memory"in performance?performance:{memory:{}},eZ=eu?1024*(navigator.deviceMemory||0):0,e0=eY.memory.jsHeapSizeLimit||0,e1="__or__watched_tags__";class e2{constructor(e){this.intervals={},this.tags=[],this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;let t=JSON.parse(e.sessionStorage.getItem(e1)??"[]");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})=>{if(e&&e.length){this.setTags(e);let t=JSON.stringify(e);this.sessionStorage.setItem(e1,t||"")}}).catch(e=>this.errLog(e))}setTags(e){this.tags=e,this.intervals={},e.forEach(e=>{this.intervals[e.id]=setInterval(()=>{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.intervals[e]&&clearInterval(this.intervals[e]),this.onTag(e)}clear(){this.tags.forEach(e=>{clearInterval(this.intervals[e.id])}),this.tags=[],this.intervals={},this.observer.disconnect()}}let e5={position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.40)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},e3={display:"flex",flexDirection:"column",gap:"2rem",alignItems:"center",padding:"1.5rem",borderRadius:"2px",border:"1px solid rgb(255 255 255 / var(--tw-bg-opacity, 1))",background:"#FFF",width:"22rem"},e8={display:"flex","flex-direction":"column",gap:"unset","align-items":"center",padding:"unset",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',"border-radius":"2px",border:"1px solid rgb(255 255 255 / var(--tw-bg-opacity, 1))",background:"rgba(255, 255, 255, 0.75)",width:"22rem"},e4={fontFamily:"Verdana, sans-serif",fontSize:"1.25rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.75rem",color:"rgba(0, 0, 0, 0.85)"},e6={borderTop:"1px solid rgba(0, 0, 0, 0.06)",borderBottom:"1px solid rgba(0, 0, 0, 0.06)",padding:"1.25rem 0rem",color:"rgba(0, 0, 0, 0.85)",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"400",lineHeight:"auto",whiteSpace:"pre-wrap"},e7={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",cursor:"pointer"},e9={fontFamily:"Verdana, sans-serif",fontSize:"13px",fontWeight:"500",lineHeight:"auto",display:"flex",justifyContent:"space-between",width:"100%",cursor:"pointer"},te={display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"0.625rem",fontSize:"13px",lineHeight:"auto"},tt={padding:"0.5rem",gap:"0.5rem",fontFamily:"Verdana, sans-serif",fontSize:"16px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto",color:"white",display:"flex",alignItems:"center",width:"100%",borderRadius:"2px",background:"rgba(0, 0, 0, 0.75)",boxSizing:"border-box"},ts={boxSizing:"border-box",display:"block",width:"100%",borderBottom:"1px solid rgb(255 255 255 / var(--tw-bg-opacity, 1))",background:"#FFF",padding:"0.65rem",alignSelf:"stretch",color:"#000",fontFamily:"Verdana, sans-serif",fontStyle:"normal",fontWeight:"400"},ti={...ts,display:"flex",flexDirection:"column",alignItems:"center",gap:"0.625rem"},tn={fontSize:"1.25rem",fontWeight:"500",cursor:"pointer",color:"#394EFF"},tr={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",width:"100%",boxSizing:"border-box",cursor:"pointer"},ta={marginTop:"1rem",marginBottom:"1rem",cursor:"pointer",display:"block",fontWeight:"500",fontSize:"13px!important",lineHeight:"auto"},to={display:"flex",justifyContent:"space-between",alignItems:"center",gap:"1rem",padding:"0.5rem",width:"100%",boxSizing:"border-box"},tl={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #394EFF",fontSize:"13px",height:"24px",width:"24px"},th={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #D2DFFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",background:"#D2DFFF",fontSize:"13px",height:"24px",width:"24px"},tc={borderRadius:"0.375rem",border:"1px solid rgba(0, 0, 0, 0.06)",background:"#F5F7FF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",padding:"0.625rem 0.9375rem",gap:"0.5rem",alignSelf:"stretch"},tu={fontWeight:"bold"},td={fontSize:"13px",lineHeight:"auto"},tp={marginRight:"0.5rem",cursor:"pointer",color:"#394EFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto"},tf={...tp,display:"flex",padding:"0.25rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.5rem",borderRadius:"0.25rem",border:"1px solid #394EFF"},tg={display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",boxSizing:"border-box"},tm={border:"4px solid rgba(255, 255, 255, 0.4)",width:"16px",height:"16px",borderRadius:"50%",borderLeftColor:"#fff",animation:"spin 0.5s linear infinite"},tb={Standard:{width:1280,height:720}};class ty{constructor(e){this.app=e,this.mediaRecorder=null,this.recordedChunks=[],this.stream=null,this.recStartTs=null}async startRecording(e,t,s,i){this.recStartTs=this.app.timestamp();try{this.stream=await navigator.mediaDevices.getUserMedia({video:!!i&&{...t,frameRate:{ideal:e}},audio:s}),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:"video/webm;codecs=vp9"}),this.recordedChunks=[],this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.recordedChunks.push(e.data)},this.mediaRecorder.start()}catch(e){console.error(e)}}async stopRecording(){return new Promise(e=>{this.mediaRecorder&&(this.mediaRecorder.onstop=()=>{e(new Blob(this.recordedChunks,{type:"video/webm"}))},this.mediaRecorder.stop())})}async sendToAPI(){let e=await this.stopRecording();return fetch(`${this.app.options.ingestPoint}/v1/web/uxt/upload-url`,{headers:{Authorization:`Bearer ${this.app.session.getSessionToken()}`}}).then(e=>{if(e.ok)return e.json();throw Error("Failed to get upload url")}).then(({url:t})=>fetch(t,{method:"PUT",headers:{"Content-Type":"video/webm"},body:e})).catch(console.error).finally(()=>{this.discard()})}async saveToFile(e="recorded-video.webm"){let t=await this.stopRecording(),s=URL.createObjectURL(t),i=document.createElement("a");i.style.display="none",i.href=s,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(s),document.body.removeChild(i)}discard(){this.mediaRecorder?.stop(),this.stream?.getTracks().forEach(e=>e.stop())}}function tv(e,t,s,i,n){let r=document.createElement(e);return r.className=t,Object.assign(r.style,s),i&&(r.textContent=i),n&&(r.id=n),r}let tS="or_uxt_test_start",tw="or_uxt_task_index",tk="or_uxt_session_id";class tT{constructor(e,t,s,i,n,r,a,o,l){this.ingestPoint=e,this.getTimestamp=t,this.token=s,this.testId=i,this.storageKey=n,this.setStorageKey=r,this.removeStorageKey=a,this.getStorageKey=o,this.getSessionId=l,this.durations={testStart:0,tasks:[]},this.getDurations=()=>this.durations,this.setDurations=e=>{this.durations.testStart=e.testStart,this.durations.tasks=e.tasks},this.signalTask=(e,t,s)=>{if(!e)return console.error("User Testing: No Task ID Given");let i=this.durations.tasks.find(t=>t.taskId===e),n=this.getTimestamp(),r=i?n-i.started:0;return fetch(`${this.ingestPoint}/v1/web/uxt/signals/task`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:JSON.stringify({testId:this.testId,taskId:e,status:t,duration:r,timestamp:n,taskAnswer:s})})},this.signalTest=e=>{let t=this.getTimestamp();if("begin"===e&&this.testId){let e=this.getSessionId();this.setStorageKey(tk,e),this.setStorageKey(this.storageKey,this.testId.toString()),this.setStorageKey(tS,t.toString())}else this.removeStorageKey(this.storageKey),this.removeStorageKey(tw),this.removeStorageKey(tS);let s=this.durations.testStart||t,i=t-s;return fetch(`${this.ingestPoint}/v1/web/uxt/signals/test`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:JSON.stringify({testId:this.testId,status:e,duration:i,timestamp:t})})};let h=this.getStorageKey(tS);h&&(this.durations.testStart=parseInt(h,10))}}class tI{constructor(e,t){this.app=e,this.storageKey=t,this.bg=tv("div","bg",e5,void 0,"__or_ut_bg"),this.container=tv("div","container",e3,void 0,"__or_ut_ct"),this.widgetGuidelinesVisible=!0,this.widgetTasksVisible=!1,this.widgetVisible=!0,this.isActive=!1,this.descriptionSection=null,this.taskSection=null,this.endSection=null,this.stopButton=null,this.stopButtonContainer=null,this.test=null,this.testId=null,this.signalManager=null,this.getTest=(e,t,s)=>{this.testId=e;let i=this.app.options.ingestPoint;return fetch(`${i}/v1/web/uxt/test/${e}`,{headers:{Authorization:`Bearer ${t}`}}).then(e=>e.json()).then(({test:i})=>{this.isActive=!0,this.test=i,this.signalManager=new tT(this.app.options.ingestPoint,()=>this.app.timestamp(),t,e,this.storageKey,(e,t)=>this.app.localStorage.setItem(e,t),e=>this.app.localStorage.removeItem(e),e=>this.app.localStorage.getItem(e),()=>this.app.getSessionID()),this.createGreeting(i.title,i.reqMic,i.reqCamera),s&&((i.reqMic||i.reqCamera)&&this.userRecorder.startRecording(30,tb.Standard,i.reqMic,i.reqCamera),this.showWidget(i.description,i.tasks,!0),this.showTaskSection())}).then(()=>e).catch(e=>{console.log("OR: Error fetching test",e)})},this.hideTaskSection=()=>!1,this.showTaskSection=()=>!0,this.collapseWidget=()=>!1,this.removeGreeting=()=>!1,this.toggleDescriptionVisibility=()=>{},this.currentTaskIndex=0,this.userRecorder=new ty(e),this.app.getSessionID()!==this.app.localStorage.getItem(tk)&&(this.app.localStorage.removeItem(this.storageKey),this.app.localStorage.removeItem(tk),this.app.localStorage.removeItem("or_uxt_test_id"),this.app.localStorage.removeItem(tw),this.app.localStorage.removeItem(tS));let s=this.app.localStorage.getItem(tw);s&&(this.currentTaskIndex=parseInt(s,10))}getTestId(){return this.testId}createGreeting(e,t,s){let i=tv("div","title",e4,e),n=tv("div","description",e6,`Welcome, you're here to help us improve, not to be judged. Your insights matter! 📹 We're recording this browser tab to learn from your experience. 🎤 Please enable mic and camera if asked, to give us a complete picture.`),r=tv("div","button",e7,"Read guidelines to begin");this.removeGreeting=()=>((t||s)&&this.userRecorder.startRecording(30,tb.Standard,t,s),this.container.removeChild(r),this.container.removeChild(n),this.container.removeChild(i),!1),r.onclick=()=>{this.removeGreeting();let e=this.signalManager?.getDurations();e&&this.signalManager&&(e.testStart=this.app.timestamp(),this.signalManager.setDurations(e)),this.signalManager?.signalTest("begin"),this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,e8),this.showWidget(this.test?.guidelines||"",this.test?.tasks||[])},this.container.append(i,n,r),this.bg.appendChild(this.container),document.body.appendChild(this.bg)}showWidget(e,t,s){this.container.innerHTML="",Object.assign(this.bg.style,{position:"fixed",zIndex:0x5af3107a3fff,right:"8px",left:"unset",width:"fit-content",top:"8px",height:"fit-content",background:"unset",display:"unset",alignItems:"unset",justifyContent:"unset"});let i=this.createTitleSection();this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,e8);let n=this.createDescriptionSection(e),r=this.createTasksSection(t),a=tv("div","stop_bn_or",ta,"Abort Session"),o=tv("div","stop_ct_or",{fontSize:"13px!important"});o.style.fontSize="13px",o.append(a),this.container.append(i,n,r,o),this.taskSection=r,this.descriptionSection=n,this.stopButton=a,this.stopButtonContainer=o,a.onclick=()=>{this.userRecorder.discard(),this.signalManager?.signalTest("skipped"),document.body.removeChild(this.bg),window.close()},s?this.toggleDescriptionVisibility():this.hideTaskSection()}createTitleSection(){var e;let t=tv("div","title",tt),s=function(){let e=document.createElement("div");e.className="grid";for(let t=0;t<16;t++){let t=document.createElement("div");Object.assign(t.style,{width:"2px",height:"2px",borderRadius:"10px",background:"white"}),t.className="cell",e.appendChild(t)}return Object.assign(e.style,{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(4, 1fr)",gap:"2px",cursor:"grab"}),e}(),i=tv("div","title_text",{maxWidth:"19rem",overflow:"hidden",textOverflow:"ellipsis",width:"100%",fontSize:16,lineHeight:"auto",cursor:"pointer"},this.test?.title),n=function(){let e=document.createElement("div");Object.assign(e.style,{width:"0",height:"0",borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:"7px solid white"});let t=document.createElement("div");return t.appendChild(e),Object.assign(t.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",cursor:"pointer",marginLeft:"auto",transform:"rotate(180deg)"}),t}();t.append(s,i,n);let r=e=>(this.widgetVisible=e,this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,this.widgetVisible?e8:{border:"none",background:"none",padding:0}),this.taskSection&&Object.assign(this.taskSection.style,this.widgetVisible?ts:{display:"none"}),this.descriptionSection&&Object.assign(this.descriptionSection.style,this.widgetVisible?ts:{display:"none"}),this.endSection&&Object.assign(this.endSection.style,this.widgetVisible?ts:{display:"none"}),this.stopButton&&Object.assign(this.stopButton.style,this.widgetVisible?ta:{display:"none"}),e),a=()=>{Object.assign(n.style,{transform:this.widgetVisible?"rotate(0deg)":"rotate(180deg)"}),r(!this.widgetVisible)};return i.onclick=a,n.onclick=a,e=this.bg,s.onmousedown=function(t){let s=e.getBoundingClientRect(),i=t.clientX-s.left,n=t.clientY-s.top;function r(t,r){let a=t-i,o=r-n;a<=5&&(a=5),o<=5&&(o=5),a>=window.innerWidth-s.width&&(a=window.innerWidth-s.width),o>=window.innerHeight-s.height&&(o=window.innerHeight-s.height),e.style.left=`${a}px`,e.style.top=`${o}px`}function a(e){r(e.pageX,e.pageY)}e.style.position="fixed",e.style.zIndex=0x5af3107a3fff,r(t.pageX,t.pageY),document.addEventListener("mousemove",a);let o=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o)};document.addEventListener("mouseup",o)},s.ondragstart=function(){return!1},this.collapseWidget=()=>r(!1),t}createDescriptionSection(e){let t=tv("div","description_section_or",ts),s=tv("div","description_s_title_or",e9),i=tv("div","title",{fontSize:13,fontWeight:500,lineHeight:"auto"},"Introduction & Guidelines"),n=tv("div","icon",tn,"-"),r=tv("div","content",te),a=tv("div","text_description",{maxHeight:"250px",overflowY:"auto",whiteSpace:"pre-wrap",fontSize:13,color:"#454545",lineHeight:"auto"});a.innerHTML=e;let o=tv("div","button_begin_or",tr,"Begin Test");s.append(i,n),r.append(a,o),t.append(s,r);let l=()=>{this.widgetGuidelinesVisible=!this.widgetGuidelinesVisible,n.textContent=this.widgetGuidelinesVisible?"-":"+",Object.assign(r.style,this.widgetGuidelinesVisible?te:{display:"none"})};return s.onclick=l,this.toggleDescriptionVisibility=()=>{this.widgetGuidelinesVisible=!1,n.textContent=this.widgetGuidelinesVisible?"-":"+",Object.assign(r.style,this.widgetGuidelinesVisible?te:{display:"none"}),r.removeChild(o)},o.onclick=()=>{if(l(),this.test){let e=this.signalManager?.getDurations(),t=e?e.tasks.findIndex(e=>this.test&&e.taskId===this.test.tasks[0].task_id):null;e&&-1===t&&(e.tasks.push({taskId:this.test.tasks[0].task_id,started:this.app.timestamp()}),this.signalManager?.setDurations(e)),this.signalManager?.signalTask(this.test.tasks[0].task_id,"begin")}this.showTaskSection(),r.removeChild(o)},t}createTasksSection(e){this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,e8);let t=tv("div","task_section_or",ts),s=tv("div","description_t_title_or",e9),i=tv("div","title",{fontSize:"13px",fontWeight:"500",lineHeight:"auto"},"Tasks"),n=tv("div","icon",tn,"-"),r=tv("div","content",te),a=tv("div","pagination",to),o=tv("div","taskCard",tc),l=tv("div","taskText",tu),h=tv("div","taskDescription",td),c=tv("div","taskButtons",tg),u=tv("div","taskText",tu);u.textContent="Your answer";let d=tv("textarea","taskDescription",{resize:"vertical"}),p=tv("div","inputArea",tc);p.append(u,d);let f=tv("div","closePanelButton",tp,"Collapse Panel"),g=tv("div","nextButton",tf,"Done, Next");s.append(i,n),o.append(l,h),c.append(f,g),r.append(a,o,p,c),t.append(s,r);let m=()=>{let t=e[this.currentTaskIndex];l.textContent=t.title,h.textContent=t.description,t.allow_typing?p.style.display="flex":p.style.display="none"};e.forEach((e,t)=>{let s=tv("span",`or_task_${t}`,{outline:"1px solid #efefef",fontSize:"13px",height:"24px",width:"24px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em"},(t+1).toString());s.id=`or_task_${t}`,a.append(s)}),this.hideTaskSection=()=>(n.textContent="+",Object.assign(r.style,{display:"none"}),this.widgetTasksVisible=!1,!1),this.showTaskSection=()=>(n.textContent="-",Object.assign(r.style,te),this.widgetTasksVisible=!0,!0);let b=()=>{let e=document.getElementById(`or_task_${this.currentTaskIndex}`);e&&Object.assign(e.style,tl);for(let e=0;e{this.widgetTasksVisible=!this.widgetTasksVisible,n.textContent=this.widgetTasksVisible?"-":"+",Object.assign(r.style,this.widgetTasksVisible?te:{display:"none"})},f.onclick=this.collapseWidget,g.onclick=()=>{let t=e[this.currentTaskIndex].allow_typing?d.value:void 0;if(d.value="",this.signalManager?.signalTask(e[this.currentTaskIndex].task_id,"done",t),this.currentTaskIndext.taskId===e[this.currentTaskIndex].task_id)&&(t.tasks.push({taskId:e[this.currentTaskIndex].task_id,started:this.app.timestamp()}),this.signalManager?.setDurations(t)),this.signalManager?.signalTask(e[this.currentTaskIndex].task_id,"begin"),b()}else this.showEndSection();this.app.localStorage.setItem("or_uxt_task_index",this.currentTaskIndex.toString())},setTimeout(()=>{let e=document.getElementById("or_task_0");e&&Object.assign(e.style,tl),m(),b()},1),t}showEndSection(){let e=!0;this.signalManager?.signalTest("done");let t=tv("div","end_section_or",ti),s=tv("div","end_title_or",{fontSize:"1.25rem",fontWeight:"500"},"Thank you! \uD83D\uDC4D"),i=tv("div","end_description_or",{},this.test?.conclusion??"Thank you for participating in our usability test. Your feedback has been captured and will be used to enhance our website. \n\nWe appreciate your time and valuable input."),n=tv("div","end_button_or",tr,"Submitting Feedback"),r=function(){!function(){let e=document.createElement("style");e.type="text/css",e.innerText=`@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }`,document.head.appendChild(e)}();let e=document.createElement("div");return e.classList.add("spinner"),Object.assign(e.style,tm),e}();n.appendChild(r),this.test?.reqMic||this.test?.reqCamera?this.userRecorder.sendToAPI().then(()=>{n.removeChild(r),n.textContent="End Session",e=!1}).catch(t=>{console.error(t),n.removeChild(r),n.textContent="End Session",e=!1}):(n.removeChild(r),n.textContent="End Session",e=!1),this.taskSection&&this.container.removeChild(this.taskSection),this.descriptionSection&&this.container.removeChild(this.descriptionSection),this.stopButton&&this.stopButtonContainer&&this.container.removeChild(this.stopButtonContainer),n.onclick=()=>{e||(window.close(),document.body.removeChild(this.bg))},t.append(s,i,n),this.endSection=t,this.container.append(t)}}function tx(e){return!!e&&null!=e.nodeType}function tE(e){return"http://www.w3.org/2000/svg"===e.namespaceURI||"svg"===e.localName}function tC(e){return e.nodeType===Node.ELEMENT_NODE}function t_(e){return e.nodeType===Node.TEXT_NODE}function tN(e){return e.nodeType===Node.DOCUMENT_NODE}function tO(e){return e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function tM(e,t){return e.localName===t}class tR{constructor(e,t){this.app=e,this.options=t,this.snapshots={},this.intervals=[],this.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=e=>{let t=this.app.nodes.getID(e);!(!t||!tM(e,"canvas")||this.app.sanitizer.isObscured(t)||this.app.sanitizer.isHidden(t)||!tM(e,"canvas")||this.snapshots[t])&&new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(e.target?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))})}).observe(e)},this.recordCanvas=(e,t)=>{var s;let i=this.app.timestamp();this.snapshots[t]={images:[],createdAt:i,paused:!1,dummy:document.createElement("canvas")};let n=(s=t.toString(),[119,s,i]);this.app.send(n);let r=e=>{(function(e,t="medium",s,i=!1,n,r){let a=`image/${n}`;if(i){let i=window.devicePixelRatio||1;s.width=e.width/i,s.height=e.height/i;let n=s.getContext("2d");if(!n)return;n.clearRect(0,0,s.width,s.height),n.drawImage(e,0,0,s.width,s.height),s.toBlob(r,a,tD[t])}else e.toBlob(r,a,tD[t])})(e,this.options.quality,this.snapshots[t].dummy,this.options.fixedScaling,this.fileExt,e=>{if(e){if(!this.snapshots[t])return this.app.debug.warn("Canvas not present in snapshots after capture:",this.snapshots,t);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=[])}})},a=setInterval(()=>{let s=this.app.nodes.getID(e),i=s?this.app.nodes.getNode(s):void 0;if(!this.snapshots[t]){this.app.debug.log("Canvas is not present in {snapshots}"),clearInterval(a);return}if(i&&tM(i,"canvas")&&i===e)this.snapshots[t].paused||(this.options.useAnimationFrame?requestAnimationFrame(()=>{r(i)}):r(i));else{this.app.debug.log("Canvas element not in sync",i,e),clearInterval(a);return}},this.interval);this.intervals.push(a)},this.fileExt=t.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)return;let i=new FormData;e.forEach(e=>{let n=e.data;n&&(i.append("snapshot",n,`${s}_${t}_${e.id}.${this.fileExt}`),this.options.isDebug&&function(e,t){let s=URL.createObjectURL(e),i=document.createElement("a");i.href=s,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}(n,`${s}_${t}_${e.id}.${this.fileExt}`))});let n=()=>{this.app.debug.log("Restarting tracker; token expired"),this.app.stop(!1),setTimeout(()=>{this.app.start({},!0)},250)};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)})}clear(){this.intervals.forEach(e=>clearInterval(e)),this.snapshots={}}}let tD={low:.35,medium:.55,high:.8},tA={Verbose:5,Log:4,Warnings:3,Errors:2,Silent:0};class tL{constructor(e=tA.Silent){this.shouldLog=e=>this.level>=e,this.info=(...e)=>{this.shouldLog(tA.Verbose)&&console.info(...e)},this.log=(...e)=>{this.shouldLog(tA.Log)&&console.log(...e)},this.warn=(...e)=>{this.shouldLog(tA.Warnings)&&console.warn(...e)},this.error=(...e)=>{this.shouldLog(tA.Errors)&&console.error(...e)},this.level=e}}let tF={interval:3e4,batchSize:2500,enabled:!0};class tj{constructor(e,t,s){this.nodes=e,this.unregisterNode=t,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{!function(e,t,s){let i=e.entries();!function e(){let n=[],r=i.next();for(;!r.done&&n.length0&&(n.forEach(([e,t])=>{t&&s(t)}),setTimeout(e,50))}()}(this.nodes,this.options.batchSize,e=>{(function(e){try{if(!e.isConnected)return[!1,"not connected"];let t=e.nodeType===Node.DOCUMENT_NODE,s=t?e.defaultView:e.ownerDocument?.defaultView,i=t?e:e.ownerDocument;if(!s)return[!1,"no window"];if(s.closed)return[!1,"window closed"];if(!i?.documentElement.isConnected)return[!1,"documentElement not connected"];return[!0,"ok"]}catch(e){return[!1,e]}})(e)[0]||this.unregisterNode(e)})},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval)},this.options={...tF,...s}}}class tP{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;eN(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.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);void 0!==s&&(this.elementListeners.delete(t),s.forEach(t=>eO(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 tj(this.nodes,this.unregisterNode,e.maintainer),this.maintainer.start()}syntheticMode(e){let t=0x5f5e0ff*e;if(t>Number.MAX_SAFE_INTEGER)throw Error("Placeholder id overflow");this.nextNodeId=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 tB={},tU={};async function tH(e,t,s){try{let i;let n=e.getAttribute("xlink:href")||e.getAttribute("href");if(!n){console.debug("Openreplay: xlink:href or href not found on .");return}let[r,a]=n.split("#");if(!r&&a){let e=document.querySelector(n);if(e){let t=` ${e.innerHTML} `.trim();return tB[a]=t,t}console.warn("Openreplay: Sprite symbol not found in the document.");return}if(!r&&!a){console.warn("Openreplay: Invalid xlink:href or href found on .");return}if(tB[a])return tB[a];if(tU[r])1===tU[r]?await new Promise(e=>{let t=0,s=setInterval(()=>{t>100&&(clearInterval(s),e(!1)),1!==tU[r]?(i=tU[r],clearInterval(s),e(!0)):t++},100)}):i=tU[r]??'';else{tU[r]=1;let e=await fetch(r),t=await e.text();i=s.parseFromString(t,"image/svg+xml"),tU[r]=i}let o=i.getElementById(a);if(!o)return console.debug("Openreplay: Symbol not found in SVG."),"";if("svgtext"===t){let e=` ${o.innerHTML} `.trim();return tB[a]=e,e}console.debug(`Openreplay: Unknown mode: ${t}. Use "inline" or "dataurl".`)}catch(e){console.error("Openreplay: Error processing element:",e)}}function tz(e){if(e.nodeType===Node.COMMENT_NODE)return!0;if(t_(e))return!1;if(!tC(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 tq(e){return!!tO(e)||!tz(e)}!function(e){e[e.New=0]="New",e[e.Removed=1]="Removed",e[e.Changed=2]="Changed"}(sO||(sO={}));class t${constructor(e,t=!1,s={disableSprites:!1}){this.app=e,this.isTopContext=t,this.commited=[],this.recents=new Map,this.indexes=[],this.attributesMap=new Map,this.textSet=new Set,this.disableSprites=!1,this.domParser=new DOMParser,this.disableSprites=s.disableSprites,this.observer=e_(this.app.safe(e=>{for(let t of e){let e=t.target,s=t.type;if(!tq(e))continue;if("childList"===s){for(let e=0;etz(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();)e.contentDocument.contains(s.currentNode)||(i+=1,this.app.nodes.unregisterNode(s.currentNode));let r=Math.floor(i/n*100);r>30&&this.app.send([115,r])}}sendNodeAttribute(e,t,s,i){if(tE(t)){if("xlink:"===s.substring(0,6)&&(s=s.substring(6)),null===i&&this.app.send([13,e,s]),"use"===t.localName&&"href"===s&&!this.disableSprites){tH(t,"svgtext",this.domParser).then(t=>{t&&this.app.send([12,e,s,`_$OPENREPLAY_SPRITE$_${t}`])}).catch(e=>{console.error("Openreplay: Error parsing element:",e)});return}"href"===s?(i.length>1e5&&(i=""),this.app.send([60,e,s,i,this.app.getBaseHref()])):this.app.attributeSender.sendSetAttribute(e,s,i);return}if(!("src"===s||"srcset"===s||"integrity"===s||"crossorigin"===s||"autocomplete"===s||"on"===s.substring(0,2)||"value"===s&&tM(t,"input")&&"button"!==t.type&&"reset"!==t.type&&"submit"!==t.type)){if(null===i){this.app.send([13,e,s]);return}if("style"===s||"href"===s&&tM(t,"link")){this.app.send([60,e,s,i,this.app.getBaseHref()]);return}("href"===s||i.length>1e5)&&(i=""),["alt","placeholder"].includes(s)&&this.app.sanitizer.privateMode&&(i=i.replaceAll(/./g,"*")),this.app.attributeSender.sendSetAttribute(e,s,i)}}sendNodeData(e,t,s){if(tM(t,"style")){this.app.send([61,e,s,this.app.getBaseHref()]);return}s=this.app.sanitizer.sanitize(e,s),this.app.send([14,e,s])}bindNode(e){let[t,s]=this.app.nodes.registerNode(e);s?this.recents.set(t,sO.New):this.recents.get(t)!==sO.New&&this.recents.set(t,sO.Removed)}bindTree(e){if(!tq(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),tz(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.recents.get(t)===sO.Removed){this.app.send([11,t]);let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>tz(e)||void 0===this.app.nodes.getID(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),i=0,n=this.app.nodes.getNodeCount();for(;s.nextNode();)i+=1,this.app.nodes.unregisterNode(s.currentNode);let r=Math.floor(i/n*100);r>30&&this.app.send([115,r])}}_commitNode(e,t){let s;if(tO(t))return!0;let i=t.parentNode;if(!tM(t,"html")||!this.isTopContext){if(null===i||void 0===(s=this.app.nodes.getID(i))||!this.commitNode(s))return this.unbindTree(t),!1;if(this.app.sanitizer.handleNode(e,s,t),this.app.sanitizer.isHidden(s))return!1}let n=t.previousSibling;for(;null!==n;){let t=this.app.nodes.getID(n);if(void 0!==t){this.commitNode(t),this.indexes[e]=this.indexes[t]+1;break}n=n.previousSibling}null===n&&(this.indexes[e]=0);let r=this.recents.get(e),a=r===sO.New,o=this.indexes[e];if(void 0===o)throw"commitNode: missing node index";if(a){if(tC(t)){let i=t;if(void 0!==s){var l,h,c,u;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`}this.app.send((l=e,h=s,c=o,u=i.tagName,[8,l,h,c,u,tE(t)]))}for(let t=0;t{this.commitNode(i),s===sO.New&&(t=this.app.nodes.getNode(i))&&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()}}class tW extends t${observe(e){let t=e.contentDocument,s=this.app.nodes.getID(e);t&&void 0!==s&&this.observeRoot(t,e=>{if(void 0===e){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.docId=e,this.app.send([70,s,e])})}syntheticObserve(e,t){this.observeRoot(t,t=>{if(void 0===t){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.app.send([70,e,t])})}}class tV extends t${observe(e){let t=e.shadowRoot,s=this.app.nodes.getID(e);t&&void 0!==s&&this.observeRoot(t,e=>{if(void 0===e){this.app.debug.error("OpenReplay: Shadow Root was not bound");return}this.app.send([70,s,e])})}}class tX{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}}let tK=eu?Element.prototype.attachShadow:()=>new ShadowRoot;class tJ extends t${constructor(e){let t=Object.assign({captureIFrames:!0,disableSprites:!1},e.options);super(e.app,!0,t),this.iframeOffsets=new tX,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=>{tM(e,"iframe")&&(this.options.captureIFrames&&!eT(e,"obscured")||eT(e,"capture"))&&this.handleIframe(e)}),this.app.nodes.attachNodeCallback(e=>{tC(e)&&null!==e.shadowRoot&&this.handleShadowRoot(e.shadowRoot)})}attachContextCallback(e){this.contextCallbacks.push(e)}getDocumentOffset(e){return this.iframeOffsets.getDocumentOffset(e)}handleIframe(e){let t=this.app.safe(()=>setTimeout(()=>{let t=this.app.nodes.getID(e);if(void 0===t||!function(e){try{return!!e.contentDocument}catch(e){return!1}}(e))return;let s=e.contentWindow,i=e.contentDocument;if(!i){this.app.debug.warn("no doc for iframe found",e);return}if(i&&this.docObservers.has(i)){this.app.debug.info("doc already observed for",t);return}let n=new tW(this.app);this.iframeObservers.set(e,n),this.docObservers.set(i,n),this.iframeObserversArr.push(n),n.observe(e),this.iframeOffsets.observe(e),s&&s===s.window&&!this.contextsSet.has(s)&&(this.contextsSet.add(s),this.contextCallbacks.forEach(e=>e(s)))},250));e.addEventListener("load",t),t()}handleShadowRoot(e){let t=new tV(this.app);this.shadowRootObservers.set(e,t),t.observe(e.host)}observe(){let e=this;Element.prototype.attachShadow=function(){let t=tK.apply(this,arguments);return e.handleShadowRoot(t),t},this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send([7]),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement)}crossdomainObserve(e,t){let s=this;Element.prototype.attachShadow=function(){let e=tK.apply(this,arguments);return s.handleShadowRoot(e),e},this.app.nodes.clear(),this.app.nodes.syntheticMode(t);let i=new tW(this.app);this.iframeObservers.set(window.document,i),i.syntheticObserve(e,window.document)}disconnect(){this.iframeOffsets.clear(),Element.prototype.attachShadow=tK,this.iframeObserversArr.forEach(e=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}}!function(e){e[e.Plain=0]="Plain",e[e.Obscured=1]="Obscured",e[e.Hidden=2]="Hidden"}(sM||(sM={}));let tG=e=>e.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*");class tQ{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&&(tC(s)&&!eT(s,"unmask")||t_(s)&&!eT(s.parentNode,"unmask")))return this.obscured.add(e);if((this.obscured.has(t)||tC(s)&&(eT(s,"masked")||eT(s,"obscured")))&&this.obscured.add(e),(this.hidden.has(t)||tC(s)&&(eT(s,"htmlmasked")||eT(s,"hidden")))&&this.hidden.add(e),void 0!==this.options.domSanitizer&&tC(s)){let t=this.options.domSanitizer(s);t===sM.Obscured&&this.obscured.add(e),t===sM.Hidden&&this.hidden.add(e)}}sanitize(e,t){return this.obscured.has(e)?tG(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`${em(t)}@${em(i)}.${em(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 tY{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.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}getSessionToken(){return this.token||this.app.sessionStorage.getItem(this.options.session_token_key)||void 0}setSessionToken(e){this.token=e,this.app.sessionStorage.setItem(this.options.session_token_key,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.getSessionToken();if(void 0!==e&&void 0!==t)return encodeURI(String(e)+"&"+t)}getTabId(){return this.tabId||this.createTabId(),this.tabId}regenerateTabId(){let e=function(e){let t=new Uint8Array(6),s=window.crypto||window.msCrypto;return s?(s.getRandomValues(t),Array.from(t,ex).join("")):Array.from({length:12},()=>ex(Math.floor(16*Math.random()))).join("")}(12);this.app.sessionStorage.setItem(this.options.session_tabid_key,e),this.tabId=e}createTabId(){let e=this.app.sessionStorage.getItem(this.options.session_tabid_key);e?this.tabId=e:this.regenerateTabId()}getInfo(){return{sessionID:this.sessionID,metadata:this.metadata,userID:this.userID,timestamp:this.timestamp,projectID:this.projectID}}reset(){this.app.sessionStorage.removeItem(this.options.session_token_key),this.metadata={},this.userID=null,this.sessionID=void 0,this.timestamp=0}}class tZ{constructor(e){this.app=e,this.timer=null,this.callbacks=[]}attach(e,t=0,s=!0,i){var n;let r;i&&(e=e.bind(i)),s&&(e=this.app.safe(e)),this.callbacks.unshift(t?(n=e,r=0,()=>{r++>=t&&(r=0,n())}):e)}start(){null===this.timer&&(this.timer=setInterval(()=>this.callbacks.forEach(e=>{e&&e()}),30))}stop(){null!==this.timer&&(clearInterval(this.timer),this.timer=null)}}let t0="canceled",t1="or_uxt_active",t2="or_buffer_1",t5=e=>({reason:e,success:!1}),t3=e=>({...e,success:!0});function t8(){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")}`}!function(e){e[e.NotActive=0]="NotActive",e[e.Starting=1]="Starting",e[e.Active=2]="Active",e[e.ColdStart=3]="ColdStart"}(sR||(sR={}));let t4=e=>new Promise(t=>setTimeout(t,e)),t6={ask:"never-gonna-give-you-up",resp:"never-gonna-let-you-down",reg:"never-gonna-run-around-and-desert-you",iframeSignal:"tracker inside a child iframe",iframeId:"getting node id for child iframe",iframeBatch:"batch of messages from an iframe window",parentAlive:"signal that parent is live",killIframe:"stop tracker inside frame",startIframe:"start tracker inside frame",polling:"hello-how-are-you-im-under-the-water-please-help-me"};class t7{constructor(e,t,s,i,n){this.signalError=i,this.insideIframe=n,this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=sR.NotActive,this.version="16.1.1",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.features={"feature-flags":!0,"usability-test":!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===t6.startIframe){if(this.active())return;try{this.allowAppStart(),this.start()}catch(e){console.error("children frame restart failed:",e)}}t.line===t6.parentAlive&&(this.parentActive=!0),t.line===t6.iframeId&&(this.parentActive=!0,this.rootId=t.id,this.session.setSessionToken(t.token),this.frameOderNumber=t.frameOrderNumber,this.debug.log("starting iframe tracking",t),this.allowAppStart()),t.line===t6.killIframe&&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===t6.iframeSignal&&(e.source?.postMessage({ping:!0,line:t6.parentAlive},"*"),(async()=>{if(null===e.source)return console.error("Couldnt connect to event.source for child iframe tracking");let s=await this.checkNodeId(e.source);if(!s){this.debug.log("Couldnt get node id for iframe",e.source);return}try{this.trackedFrames.includes(t.context)?this.debug.log("Trying to observe already added iframe; ignore if its a restart"):this.trackedFrames.push(t.context),await this.waitStarted();let i=this.session.getSessionToken(),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:t6.iframeId,id:s,token:i,frameOrderNumber:n};this.debug.log("Got child frame signal; nodeId",s,e.source,r),e.source?.postMessage(r,"*")}catch(e){console.error(e)}})()),t.line===t6.iframeBatch){let s=t.messages.map(t=>{if(20===t[0]){let s=t;return this.pageFrames.forEach(i=>{if(i.contentWindow===e.source){let[e,n,r]=t,{left:a,top:o}=i.getBoundingClientRect();s=[e,n+a,r+o]}}),s}if(68===t[0]){let s=t;return this.pageFrames.forEach(i=>{if(i.contentWindow===e.source){let[e,n,r,a,o,l,h]=t,{left:c,top:u,width:d,height:p}=i.getBoundingClientRect(),f=document.documentElement.scrollWidth;s=[e,n,r,a,o,Math.round((l/100*d+c)/f*1e3)/10,Math.round((h/100*p+u)/document.documentElement.scrollHeight*1e3)/10]}}),s}return t});this.messages.push(...s)}if(t.line===t6.polling){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(t6.startIframe)},this.killChildrenFrames=()=>{this.addCommand(t6.killIframe)},this.signalIframeTracker=()=>{let e=this.session.getTabId();window.parent.postMessage({line:t6.iframeSignal,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:t6.iframeSignal,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.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)),this.attachStartCallback(()=>e?eN(e,t,s,n,this.options.forceNgOff):null,i),this.attachStopCallback(()=>e?eO(e,t,s,n,this.options.forceNgOff):null,i)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{this.canvasRecorder?.restartTracking()},this.flushBuffer=async e=>new Promise((t,s)=>{if(0===e.length){t(null);return}let i=1;for(;i{try{let s=e.splice(0,i);this.postToWorker(s.map(e=>[...e])),t(null)}catch(e){this._debug("flushBuffer",e),s(Error("flushBuffer failed"))}})}),this.onUxtCb=[],this.contextId=Math.random().toString(36).slice(2),this.projectKey=e,-1!==Object.keys(s).findIndex(e=>["fixedCanvasScaling","disableCanvas"].includes(e))&&(console.warn('Openreplay: canvas options are moving to separate key "canvas" in next update. Please update your configuration.'),s={...s,canvas:{__save_canvas_locally:s.__save_canvas_locally,fixedCanvasScaling:s.fixedCanvasScaling,disableCanvas:s.disableCanvas}}),this.networkOptions=s.network;let r={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__:tA.Silent,__save_canvas_locally:!1,localStorage:null,sessionStorage:null,disableStringDict:!1,forceSingleTab:!1,assistSocketHost:"",fixedCanvasScaling:!1,disableCanvas:!1,captureIFrames:!0,disableSprites:!1,obscureTextEmails:!0,obscureTextNumbers:!1,crossdomain:{parentDomain:"*"},canvas:{disableCanvas:!1,fixedCanvasScaling:!1,__save_canvas_locally:!1,useAnimationFrame:!1},forceNgOff:!1};if(this.options=function e(t,s){let i={...t};for(let n in s)if(s.hasOwnProperty(n)){let r=s[n],a=t[n];"object"!=typeof r||Array.isArray(r)||null===r?i[n]=r:i[n]=e(a||{},r)}return i}(r,s),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&"BroadcastChannel"in globalThis){let e=location.hostname.split(".").slice(-2).join("_");this.bc=new BroadcastChannel(`rick_${e}`)}else this.options.forceSingleTab&&this.allowAppStart();this.revID=this.options.revID,this.localStorage=this.options.localStorage??window.localStorage,this.sessionStorage=this.options.sessionStorage??window.sessionStorage,this.sanitizer=new tQ({app:this,options:s}),this.nodes=new tP({node_id:this.options.node_id,forceNgOff:!!s.forceNgOff,maintainer:this.options.nodes?.maintainer}),this.observer=new tJ({app:this,options:s}),this.ticker=new tZ(this),this.ticker.attach(()=>this.commit()),this.debug=new tL(this.options.__debug__),this.session=new tY({app:this,options:this.options}),this.attributeSender=new er({app:this,isDictDisabled:!!(this.options.disableStringDict||this.options.crossdomain?.enabled)}),this.featureFlags=new eh(this),this.tagWatcher=new e2({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:e=>this.send([120,e])}),this.session.attachUpdateCallback(({userID:e,metadata:t})=>{null!=e&&this.send([28,e]),null!=t&&Object.entries(t).forEach(([e,t])=>this.send([30,e,t]))}),null!=t&&this.session.applySessionHash(t);let a=this.session.getTabId();this.insideIframe?(window.addEventListener("message",this.parentCrossDomainFrameListener),setInterval(()=>{!document.hidden&&window.parent.postMessage({line:t6.polling,context:this.contextId},s.crossdomain?.parentDomain??"*")},250)):(this.initWorker(),window.addEventListener("message",this.crossDomainIframeListener)),null!==this.bc&&(this.bc.postMessage({line:t6.ask,source:a,context:this.contextId}),this.startTimeout=setTimeout(()=>{this.allowAppStart()},250),this.bc.onmessage=e=>{if(e.data.context!==this.contextId){if(e.data.line===t6.resp){let t=e.data.token;this.session.setSessionToken(t),this.allowAppStart()}if(e.data.line===t6.reg){let t=e.data.token;this.session.regenerateTabId(),this.session.setSessionToken(t),this.allowAppStart()}if(e.data.line===t6.ask){let t=this.session.getSessionToken();t&&this.bc&&this.bc.postMessage({line:e.data.source===a?t6.reg:t6.resp,token:t,source:a,context:this.contextId})}}})}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 t4(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}if(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 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 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 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.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;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.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if("q_end"===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(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var h;!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,a=null,u=h.NotActive;function o(){a&&a.finaliseBatch()}function c(){return new Promise((t=>{u=h.Stopping,null!==p&&(clearInterval(p),p=null),a&&(a.clean(),a=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{u=h.NotActive,t(null)}),100)}))}function l(){[h.Stopped,h.Stopping].includes(u)||(postMessage("a_stop"),c().then((()=>{postMessage("a_start")})))}let g,p=null;self.onmessage=({data:s})=>{if(null!=s){if("stop"===s)return o(),void c().then((()=>{u=h.Stopped}));if("forceFlushBatch"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void l();s.batch&&r.sendCompressed(s.batch)}if("uncompressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void l();s.batch&&r.sendUncompressed(s.batch)}return"start"===s.type?(u=h.Starting,r=new t(s.ingestPoint,(()=>{l()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:"compress",batch:t},[t.buffer])}),s.pageNo),a=new n(s.pageNo,s.timestamp,s.url,(t=>{r&&r.push(t)}),s.tabId,(()=>postMessage({type:"queue_empty"}))),null===p&&(p=setInterval(o,1e4)),u=h.Active):"auth"===s.type?r?a?(r.authorise(s.token),void(s.beaconSizeLimit&&a.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug("OR WebWorker: writer not initialised. Received auth."),void l()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void l()):void 0}if(a){const t=a;s.forEach((s=>{55===s[0]&&(s[1]?g=setTimeout((()=>l()),18e5):clearTimeout(g)),t.writeMessage(s)}))}else postMessage("not_init"),l()}else o()}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=()=>{this.worker&&this.worker.postMessage(null)};this.attachEventListener(window,"beforeunload",e,!1),this.attachEventListener(document.body,"mouseleave",e,!1,!1),this.attachEventListener(document,"visibilitychange",e,!1)}catch(e){this._debug("worker_start",e)}}handleWorkerMsg(e){if("a_stop"===e)this.stop(!1);else if("a_start"===e)this.waitStatus(sR.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 n=e.batch;if(n.byteLength>this.compressionThreshold){var t,s,i;t=e.batch,s={mtime:0},(i=(e,t)=>{e?(this.debug.error("Openreplay compression error:",e),this.worker?.postMessage({type:"uncompressed",batch:n})):this.worker?.postMessage({type:"compressed",batch:t})})||(i=s,s={}),"function"!=typeof i&&_(7),Q(t,s,[K,J,function(){return[es]}],function(e){return G(es(e.data[0],e.data[1]))},2,i)}else this.worker?.postMessage({type:"uncompressed",batch:n})}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)}send(e,t=!1){this.activityState!==sR.NotActive&&(this.activityState===sR.ColdStart?(this.bufferedMessages1.push(e),this.singleBuffer||this.bufferedMessages2.push(e),this.conditionsManager?.processMessage(e)):this.messages.push(e),this.activityState===sR.Active&&t&&this.commit())}_nCommit(){if(this.socketMode){this.messages.unshift([0,this.timestamp()],eQ(this.session.getTabId())),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:t6.iframeBatch,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.emptyBatchCounter<1e3){this.emptyBatchCounter++;return}this.emptyBatchCounter=0;try{eD(()=>{var e;this.messages.unshift((e=this.timestamp(),[0,e]),eQ(this.session.getTabId())),this.worker?.postMessage(this.messages),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0})}catch(e){this._debug("worker_commit",e),this.stop(!0),setTimeout(()=>{this.start()},500)}}}_cStartCommit(){if(this.coldStartCommitN+=1,2===this.coldStartCommitN){let e=[[0,this.timestamp()],eQ(this.session.getTabId())];this.bufferedMessages1.push(...e),this.bufferedMessages2.push(...e),this.coldStartCommitN=0}}commit(){this.activityState===sR.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){this.worker?.postMessage(e),this.commitCallbacks.forEach(t=>t(e))}timestamp(){return eg()+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]){this.orderNumber+=1,ef(),this.coldStartTs=eg(),this.orderNumber%2==0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push([0,this.timestamp()]),this.bufferedMessages1.push(eQ(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push([0,this.timestamp()]),this.bufferedMessages2.push(eQ(this.session.getTabId()))),this.stop(!1),this.activityState=sR.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(eG(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{i()},3e4),i()}async setupConditionalStart(e){this.conditionsManager=new ea(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:eg(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:eZ,jsHeapSizeLimit:e0,timezone:t8(),width:window.screen.width,height:window.screen.height})}),{token:s,userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:l,projectID:h,features:c}=await t.json();this.features=c||this.features,this.session.assign({projectID:h}),this.session.setUserInfo({userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:l});let u={sessionToken:s,userUUID:"",sessionID:""};this.startCallbacks.forEach(e=>e(u)),await this.conditionsManager?.fetchConditions(h,s),this.features["feature-flags"]&&(await this.featureFlags.reloadFlags(s),this.conditionsManager?.processFlags(this.featureFlags.flags)),await this.tagWatcher.fetchTags(this.options.ingestPoint,s)}offlineRecording(e={},t){this.onSessionSent=t,this.singleBuffer=!0;let s=this.checkSessionToken(e.forceNew);ef(),this.coldStartTs=eg();let i=this.localStorage.getItem(t2);if(i){let e=JSON.parse(i);this.bufferedMessages1=Array.isArray(e)?e:this.bufferedMessages1,this.localStorage.removeItem(t2)}this.bufferedMessages1.push([0,this.timestamp()]),this.bufferedMessages1.push(eQ(this.session.getTabId())),this.activityState=sR.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(eG(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(t2,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}async uploadOfflineRecording(){this.stop(!1);let e=eg();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:eZ,jsHeapSizeLimit:e0,timezone:t8()})}),{token:s,userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:l,beaconSizeLimit:h,projectID:c}=await t.json();for(this.worker?.postMessage({type:"auth",token:s,beaconSizeLimit:h}),this.session.assign({projectID:c}),this.session.setUserInfo({userBrowser:i,userCity:n,userCountry:r,userDevice:a,userOS:o,userState:l});this.bufferedMessages1.length>0;)await this.flushBuffer(this.bufferedMessages1);this.postToWorker([["q_end"]]),this.clearBuffers()}async _start(e={},t=!1,s){0!==Object.keys(e).length&&(this.prevOpts=e);let i=this.activityState===sR.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(t5(e))}if(this.activityState===sR.Active||this.activityState===sR.Starting)return Promise.resolve(t5("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=sR.Starting,i||ef(),e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});let n=eg();this.worker?.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:i?this.coldStartTs:n,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});let r=this.session.getSessionToken(),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: ",r);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:n,doNotRecord:!1,bufferDiff:n-this.coldStartTs,userID:this.session.getInfo().userID,token:a?void 0:r,deviceMemory:eZ,jsHeapSizeLimit:e0,timezone:t8(),condition:s,assistOnly:e.assistOnly??this.socketMode,width:window.screen.width,height:window.screen.height})});if(200!==t.status){let e=await t.text(),s=e===t0?t0:`Server error: ${t.status}. ${e}`;return t5(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,[]),t5(e)}let{token:o,userUUID:l,projectID:h,beaconSizeLimit:c,compressionThreshold:u,delay:d,sessionID:p,startTimestamp:f,userBrowser:g,userCity:m,userCountry:b,userDevice:y,userOS:v,userState:S,canvasEnabled:w,canvasQuality:k,canvasFPS:T,assistOnly:I,features:x}=await t.json();if(this.features=x||this.features,"string"!=typeof o||"string"!=typeof l||"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,[]),t5(e)}this.delay=d,this.session.setSessionToken(o),this.session.setUserInfo({userBrowser:g,userCity:m,userCountry:b,userDevice:y,userOS:v,userState:S}),this.session.assign({sessionID:p,timestamp:f||n,projectID:h}),I?(this.socketMode=!0,this.worker?.postMessage("stop")):this.worker?.postMessage({type:"auth",token:o,beaconSizeLimit:c}),a||o!==r||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(eG(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEach(([e,t])=>{var s,i;return this.send((s=e,i=t,[30,s,i]))}),this.localStorage.setItem(this.options.local_uuid_key,l),this.compressionThreshold=u;let E={sessionToken:o,userUUID:l,sessionID:p};if(this.startCallbacks.forEach(e=>e(E)),e.startCallback&&e.startCallback(t3(E)),this.features["feature-flags"]&&this.featureFlags.reloadFlags(),await this.tagWatcher.fetchTags(this.options.ingestPoint,o),this.activityState=sR.Active,this.options.crossdomain?.enabled&&!this.insideIframe&&this.bootChildrenFrames(),w&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new tR(this,{fps:T,quality:k,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame})),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()}else this.insideIframe&&this.rootId?this.observer.crossdomainObserve(this.rootId,this.frameOderNumber):this.observer.observe(),this.ticker.start();if(this.canvasRecorder?.startTracking(),this.features["usability-test"]&&!this.insideIframe){let e;this.uxtManager=this.uxtManager?this.uxtManager:new tI(this,t1);let t=this.localStorage.getItem(t1);if(t&&(e=parseInt(t,10)),location?.search){let t=new URLSearchParams(location.search);if(t.has("oruxt")){let s=t.get("oruxt");e=s?parseInt(s,10):void 0}}e&&(this.uxtManager.isActive?this.onUxtCb.forEach(t=>t(e)):this.uxtManager.getTest(e,o,!!t).then(e=>{e&&this.onUxtCb.forEach(t=>t(e))}))}return t3(E)}catch(t){if(this.stop(),this.session.reset(),!t)return console.error("Unknown error during start"),this.signalError("Unknown error",[]),t5("Unknown error");if(t===t0)return this.signalError(t0,[]),t5(t0);this._debug("session_start",t);let e=t instanceof Error?t.message:t.toString();return this.signalError(e,[]),t5(e)}}addOnUxtCb(e){this.onUxtCb.push(e)}getUxtId(){return this.uxtManager?.getTestId()}async waitStart(){return new Promise(e=>{let t=setInterval(()=>{this.canStart&&(clearInterval(t),e(!0))},100)})}async waitStarted(){return this.waitStatus(sR.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===sR.Active||this.activityState===sR.Starting?Promise.resolve(t5("OpenReplay: trying to call `start()` on the instance that has been started already.")):(this.insideIframe&&this.signalIframeTracker(),document.hidden)?new Promise(t=>{let s=async()=>{document.hidden||(await this.waitStart(),document.removeEventListener("visibilitychange",s),t(this._start(...e)))};document.addEventListener("visibilitychange",s)}):(await this.waitStart(),this._start(...e))}forceFlushBatch(){this.worker?.postMessage("forceFlushBatch")}getTabId(){return this.session.getTabId()}clearBuffers(){this.bufferedMessages1.length=0,this.bufferedMessages2.length=0}trackWs(e){return(t,s,i="down")=>{if("string"==typeof t&&"string"==typeof s&&!(s.length>5242880)&&!(t.length>255)){var n,r,a;this.send((n=e,r=s,a=this.timestamp(),[84,"websocket",n,r,a,i,t]))}}}stop(e=!0){if(this.activityState!==sR.NotActive)try{!this.insideIframe&&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=sR.NotActive,this.debug.log("OpenReplay tracking stopped.")}}}let t9=eu&&"InstallTrigger"in window?e=>e.message+"\n"+e.stack:e=>e.stack||e.message;function se(e){return void 0===e?"undefined":null===e?"null":e instanceof Error?t9(e):Array.isArray(e)?`Array(${e.length})`:String(e)}function st(e){if(void 0===e)return"undefined";if(null===e)return"null";if(e instanceof Error)return t9(e);if(Array.isArray(e)){let t=e.length,s=e.slice(0,10).map(se).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+": "+se(n))}return"{"+t.join(", ")+"}"}return e.toString()}let ss=["log","info","warn","error","debug","assert"],si=/(^|@)\S+:\d+/,sn=/^\s*at .*(\S+:\d+|\(native\))/m,sr=/^(eval@)?(\[native code\])?$/;function sa(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 so(e){return[{columnNumber:e.colno,lineNumber:e.lineno,fileName:e.filename,functionName:"",source:""}]}function sl(e,t,s={}){var i,n,r,a,o;let l=t;try{i=e,l=(function(e,t){var s,i,n,r,a,o,l;if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]){return!(s=e).stacktrace||s.message.includes("\n")&&s.message.split("\n").length>s.stacktrace.split("\n").length?function(e,t){let s=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[];for(let e=2,t=i.length;e!!e.match(si)&&!e.match(/^Error created at/)).map(e=>{let t;let s=e.split("@"),i=sa(s.pop()),n=s.shift()||"",r=n.replace(//,"$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,t){let s=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[];for(let e=0,t=i.length;e!!e.match(sn)).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=sa(s?s[1]:t);return{function:s&&t||void 0,file:["eval",""].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(sr)).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=sa(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")})(i).map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}catch(e){}return r=e.name,a=e.message,o=JSON.stringify(l),[78,r,a,o,JSON.stringify(s)]}function sh(e,t=window,s={}){if(e instanceof ErrorEvent){if(e.error instanceof Error)return sl(e.error,so(e),s);{let[t,i]=e.message.split(":");return i||(t="Error",i=e.message),[78,t,i,JSON.stringify(so(e)),JSON.stringify(s)]}}if("PromiseRejectionEvent"in t&&e instanceof t.PromiseRejectionEvent){if(e.reason instanceof Error)return sl(e.reason,[],s);{let t;try{t=JSON.stringify(e.reason)}catch(s){t=String(e.reason)}return[78,"Unhandled Promise Rejection",t,"[]",JSON.stringify(s)]}}return null}function sc(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 su=["text","password","email","search","number","range","date","tel","time"],sd=eu&&"labels"in HTMLInputElement.prototype?e=>{let t=e;for(;null!==(t=t.parentNode);)if(tM(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(tM(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 sp(e){let t=ek(e);if(null===t){let s=sd(e);t=s&&s.innerText||e.placeholder||e.name||e.id||e.className||e.type}return eb(t).slice(0,100)}let sf={Plain:0,Obscured:1,Hidden:2},sg=new Set(["role","name","aria-label","rel","href"]);function sm(e,t){let s=sg.has(e);s||=e.startsWith("data-")&&sS(e);let i=sS(t)&&t.length<100;return i||=t.startsWith("#")&&sS(t.slice(1)),s&&i}function sb(e){return sS(e)}function sy(e){return sS(e)}function sv(e){return!0}function sS(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}function sw(e){let t=e[0],s=t.name;for(let i=1;i ${s}`:`${e[i].name} ${s}`,t=e[i]}return s}function sk(e){return e.map(e=>e.penalty).reduce((e,t)=>e+t,0)}function sT(e,t){return sk(e)-sk(t)}function sI(e,t){let s=e.parentNode;if(!s)return;let i=s.firstChild;if(!i)return;let n=0;for(;i&&(i.nodeType===Node.ELEMENT_NODE&&(void 0===t||i.tagName.toLowerCase()===t)&&n++,i!==e);)i=i.nextSibling;return n}function sx(e,t){return"html"===e?"html":`${e}:nth-of-type(${t})`}function sE(e,t){let s=sw(e);switch(t.querySelectorAll(s).length){case 0:throw Error(`Can't select any node with this selector: ${s}`);case 1:return!0;default:return!1}}function sC(e){let t=e.tagName.toUpperCase();return"BUTTON"===t||"A"===t||"LI"===t||"SELECT"===t||"TR"===t||"TH"===t||null!=e.onclick||"button"===e.getAttribute("role")}function s_(e,t){return e instanceof Element?function(e,t){let s=e;for(;null!==s&&s!==t.documentElement;){if(eT(s,"masked"))return null;s=s.parentElement}if(tE(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||sC(s)||null!==ek(s))return s;s=s.parentElement}return e===t.documentElement?null:e}(e,t):null}function sN(e){return Math.round(1e4*e)}var sO,sM,sR,sD,sA=-1,sL=function(e){addEventListener("pageshow",function(t){t.persisted&&(sA=t.timeStamp,e(t))},!0)},sF=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart=0?i="back-forward-cache":s&&(document.prerendering||sj()>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}},sB=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){}},sU=function(e,t,s,i){var n,r;return function(a){var o;t.value>=0&&(a||i)&&((r=t.value-(n||0))||void 0===n)&&(n=t.value,t.delta=r,t.rating=(o=t.value)>s[1]?"poor":o>s[0]?"needs-improvement":"good",e(t))}},sH=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},sz=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},sq=function(e){var t=!1;return function(){t||(e(),t=!0)}},s$=-1,sW=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},sV=function(e){"hidden"===document.visibilityState&&s$>-1&&(s$="visibilitychange"===e.type?e.timeStamp:0,sK())},sX=function(){addEventListener("visibilitychange",sV,!0),addEventListener("prerenderingchange",sV,!0)},sK=function(){removeEventListener("visibilitychange",sV,!0),removeEventListener("prerenderingchange",sV,!0)},sJ=function(){return s$<0&&(s$=sW(),sX(),sL(function(){setTimeout(function(){s$=sW(),sX()},0)})),{get firstHiddenTime(){return s$}}},sG=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},sQ=[1800,3e3],sY=function(e,t){t=t||{},sG(function(){var s,i=sJ(),n=sP("FCP"),r=sB("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(r.disconnect(),e.startTimei.value&&(i.value=n,i.entries=r,s())},o=sB("layout-shift",a);o&&(s=sU(e,i,sZ,t.reportAllChanges),sz(function(){a(o.takeRecords()),s(!0)}),sL(function(){n=0,s=sU(e,i=sP("CLS",0),sZ,t.reportAllChanges),sH(function(){return s()})}),setTimeout(s,0))}))},s1=0,s2=1/0,s5=0,s3=function(e){e.forEach(function(e){e.interactionId&&(s2=Math.min(s2,e.interactionId),s1=(s5=Math.max(s5,e.interactionId))?(s5-s2)/7+1:0)})},s8=function(){return sD?s1:performance.interactionCount||0},s4=function(){"interactionCount"in performance||sD||(sD=sB("event",s3,{type:"event",buffered:!0,durationThreshold:0}))},s6=[],s7=new Map,s9=0,ie=function(){var e=Math.min(s6.length-1,Math.floor((s8()-s9)/50));return s6[e]},it=[],is=function(e){if(it.forEach(function(t){return t(e)}),e.interactionId||"first-input"===e.entryType){var t=s6[s6.length-1],s=s7.get(e.interactionId);if(s||s6.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]};s7.set(i.id,i),s6.push(i)}s6.sort(function(e,t){return t.latency-e.latency}),s6.length>10&&s6.splice(10).forEach(function(e){return s7.delete(e.id)})}}},ii=function(e){var t=self.requestIdleCallback||self.setTimeout,s=-1;return e=sq(e),"hidden"===document.visibilityState?e():(s=t(e),sz(e)),s},ir=[200,500],ia=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},sG(function(){s4();var s,i,n=sP("INP"),r=function(e){ii(function(){e.forEach(is);var t=ie();t&&t.latency!==n.value&&(n.value=t.latency,n.entries=t.entries,i())})},a=sB("event",r,{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40});i=sU(e,n,ir,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),sz(function(){r(a.takeRecords()),i(!0)}),sL(function(){s9=s8(),s6.length=0,s7.clear(),i=sU(e,n=sP("INP"),ir,t.reportAllChanges)}))}))},io=[2500,4e3],il={},ih=function(e,t){t=t||{},sG(function(){var s,i=sJ(),n=sP("LCP"),r=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTime>31)-(e>>31)))+1;return"9".repeat(t)}return e.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*")}function iS(e){let t={};if(Array.isArray(e))e.forEach(({name:e,value:s})=>{iy.has(e.toLowerCase())?t[e]=iv(s):t[e]=s});else for(let[s,i]of Object.entries(e))iy.has(s.toLowerCase())?t[s]=iv(i):t[s]=i;return t}function iw(e){let t;if(!e)return e;let s=!1;try{t=JSON.parse(e),s=!0}catch(e){}if(s)return ik(t),JSON.stringify(t);{let t=new URLSearchParams(e);for(let e of t.keys())if(iy.has(e.toLowerCase())){let s=iv(t.get(e));t.set(e,s)}return t.toString()}}function ik(e){if(Array.isArray(e))e.forEach(ik);else if(e&&"object"==typeof e)for(let t in e)Object.hasOwn(e,t)&&(iy.has(t.toLowerCase())?e[t]=iv(e[t]):null!==e[t]&&"object"==typeof e[t]&&ik(e[t]))}class iT{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((ik(e=this.getData),e)):iw(this.requestData),n={headers:iS(t),body:i},r={headers:iS(s),body:iw(this.response)},a=this.sanitize({url:function(e){if(!e)return"";try{let t=new URL(e);if(t.searchParams)for(let e of t.searchParams.keys())iy.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});return a?(a.url.includes("/graphql")&&a.response.body&&"string"==typeof a.response.body&&(a.status=a.response.body.includes("errors")?400:200,this.requestType="graphql"),{requestType:this.requestType,method:a.method,url:a.url,request:JSON.stringify(a.request),response:JSON.stringify(a.response),status:a.status,startTime:this.startTime,duration:this.duration,responseSize:this.responseSize}):null}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 iI=(e,t)=>{let s="";switch(e){case"":case"text":case"json":"string"==typeof t?s=t:iC(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},ix=e=>{let t;if(!e)return null;if("string"==typeof e){("{"===e[0]||"["===e[0])&&(t=e);let s=e.split("&");t=1===s.length?e:s.join(",")}else if(function(e){return!(null==e||ArrayBuffer.isView(e))&&"undefined"!=typeof Symbol&&"function"==typeof e[Symbol.iterator]}(e)){let s=[];for(let[t,i]of e)s.push(`${t}=${"string"==typeof i?i:"[object Object]"}`);t=s.join(",")}else t=e instanceof Blob||e instanceof ReadableStream||e instanceof ArrayBuffer?"byte data":iC(e)?e:`can't parse body ${typeof e}`;return t},iE=(e,t={})=>{iC(t)||(t={});let s=e?e.split("?"):[];if(s.shift(),s.length>0)for(let e of s=s.join("?").split("&")){let s=e.split("=");try{t[s[0]]=decodeURIComponent(s[1])}catch(e){t[s[0]]=s[1]}}return t};function iC(e){return null!==e&&"object"==typeof e}function i_(e){return e<=0?"":e>=1e6?(e/1e3/1e3).toFixed(1)+" MB":e>=1e3?(e/1e3).toFixed(1)+" KB":`${e}B`}let iN=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)},iO=e=>e instanceof Blob?e.type:e instanceof FormData?"multipart/form-data":e instanceof URLSearchParams?"application/x-www-form-urlencoded;charset=UTF-8":"text/plain;charset=UTF-8";class iM{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 iT(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(i))return e.apply(t,s);let a=iN(i);if(r.method="POST",r.url=i,r.name=(a.pathname.split("/").pop()||"")+a.search,r.requestType="beacon",r.requestHeader={"Content-Type":iO(n)},r.status=0,r.statusText="Pending",a.search&&a.searchParams)for(let[e,t]of(r.getData={},a.searchParams))r.getData[e]=t;r.requestData=ix(n),r.startTime||(r.startTime=performance.now());let o=e.apply(t,s);o?(r.endTime=performance.now(),r.duration=r.endTime-(r.startTime||r.endTime),r.status=0,r.statusText="Sent",r.readyState=4):(r.status=500,r.statusText="Unknown");let l=r.getMessage();return l&&this.sendMessage(l),o}}class iR{static create(e,t,s,i,n,r){if(e)return new Proxy(e,new iM(t,s,i,n,r))}}!function(e){e[e.UNSENT=0]="UNSENT",e[e.OPENED=1]="OPENED",e[e.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",e[e.LOADING=3]="LOADING",e[e.DONE=4]="DONE"}(i||(i={}));class iD{constructor(e,t){this.resp=e,this.item=t,this.mockReader()}set(e,t,s){return Reflect.set(e,t,s)}get(e,t){let s=Reflect.get(e,t);switch(t){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=t.toLowerCase(),s.apply(e).then(e=>(this.item.response=iI(this.item.responseType,e),e)))}return"function"==typeof s?s.bind(e):s}mockReader(){let e;if(!this.resp.body||"function"!=typeof this.resp.body.getReader)return;let t=this.resp.body.getReader;this.resp.body.getReader=()=>{let s=t.apply(this.resp.body);if(this.item.readyState===i.DONE)return s;let n=s.read,r=s.cancel;return this.item.responseType="arraybuffer",s.read=()=>n.apply(s).then(t=>{if(e){let s=new Uint8Array(e.length+t.value.length);s.set(e),s.set(t.value,e.length),e=s}else e=new Uint8Array(t.value);return this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=t.done?4:3,this.item.statusText=t.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=i_(this.item.responseSize),t.done&&(this.item.response=iI(this.item.responseType,e)),t}),s.cancel=(...t)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=iI(this.item.responseType,e),r.apply(s,t)),s}}}class iA{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 iT(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);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=iN(t),r=(null==s?void 0:s.headers)||{}):(n=t.method||"GET",i=iN(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=ix(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;return 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=i_(e.responseSize),e.response=iI(e.responseType,t);let s=e.getMessage();s&&this.sendMessage(s)}).catch(e=>{if("AbortError"!==e.name)throw e})),new Proxy(t,new iD(t,e))}}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 iL{static create(e,t,s,i,n,r){return new Proxy(fetch,new iA(e,t,s,i,n,r))}}class iF{constructor(e,t,s,i,n,r,a){this.ignoredHeaders=t,this.setSessionTokenHeader=s,this.sanitize=i,this.sendMessage=n,this.isServiceUrl=r,this.tokenUrlMatcher=a,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new iT(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))&&e.setRequestHeader(t,s)}),this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:let s=Reflect.get(e,t);if("function"==typeof s)return s.bind(e);return s}}set(e,t,s){switch(t){case"onreadystatechange":return this.setOnReadyStateChange(e,t,s);case"onabort":return this.setOnAbort(e,t,s);case"ontimeout":return this.setOnTimeout(e,t,s)}return Reflect.set(e,t,s)}onReadyStateChange(){if(!(this.item.url&&this.isServiceUrl(this.item.url))&&(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(),setTimeout(()=>{this.item.response=iI(this.item.responseType,this.item.response)},0),this.XMLReq.readyState===i.DONE)){let e=this.item.getMessage();e&&this.sendMessage(e)}}onAbort(){this.item.cancelState=1,this.item.statusText="Abort";let e=this.item.getMessage();e&&this.sendMessage(e)}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout";let e=this.item.getMessage();e&&this.sendMessage(e)}getOpen(e){let t=Reflect.get(e,"open");return(...s)=>{var i,n,r;let a=s[0],o=s[1];return this.item.method=a?a.toUpperCase():"GET",this.item.url=(null===(i=o.toString)||void 0===i?void 0:i.call(o))||"",this.item.name=null!==(r=null===(n=this.item.url)||void 0===n?void 0:n.replace(RegExp("/*$"),"").split("/").pop())&&void 0!==r?r:"",this.item.getData=iE(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=ix(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 i.UNSENT:case i.OPENED:this.item.status=i.UNSENT,this.item.statusText="Pending",this.item.startTime||(this.item.startTime=performance.now());break;case i.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{console.warn(`Openreplay: Can't find ${e} in global context.`)};function iB(e){return e.__or_req_data__||(e.__or_req_data__={body:void 0,headers:{}}),e.__or_req_data__}function iU(e){return"string"==typeof e?e.toUpperCase():"GET"}let iH="/en/sdk",iz=()=>{try{return!!window.top?.document}catch{return!1}};class iq{constructor(e){if(this.options=e,this.app=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:"16.1.1",projectKey:this.options.projectKey,doNotTrack:s,reason:t.length?`missing api: ${t.join(",")}`:e}))},this.restartCanvasTracking=()=>{null!==this.app&&this.app.restartCanvasTracking()},this.handleError=(e,t={})=>{if(null!==this.app){if(e instanceof Error){let s=sl(e,[],t);this.app.send(s)}else if(e instanceof ErrorEvent||"PromiseRejectionEvent"in window&&e instanceof PromiseRejectionEvent){let s=sh(e,void 0,t);null!=s&&this.app.send(s)}}},this.crossdomainMode=!!(eE()&&e.crossdomain?.enabled),!eu||!function(e){if(null==e)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${ev}${iH}`),!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 ${ev}${iH} for more information.`),!1;e.projectKey=e.projectID.toString(),ew("`projectID` option","`projectKey` option",iH)}else console.warn("OpenReplay: projectKey is expected to have a string type."),e.projectKey=e.projectKey.toString()}return null!=e.sessionToken&&ew("`sessionToken` option","`sessionHash` start() option","/"),!0}(e))return;if(window.__OPENREPLAY__||!this.crossdomainMode&&eE()&&iz()&&window.top.__OPENREPLAY__){console.error("OpenReplay: one tracker instance has been initialised already");return}if(!e.__DISABLE_SECURE_MODE&&"https:"!==location.protocol){console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");return}let t=this.checkDoNotTrack(),s=[];if(t)s.push("doNotTrack");else for(let e of["Map","Set","MutationObserver","performance","timing","startsWith","Blob","Worker"])if("timing"===e){if("performance"in window&&!(e in performance)){s.push(e);break}}else if("startsWith"===e){if(!(e in String.prototype)){s.push(e);break}}else if(!(e in window)){s.push(e);break}if(s.length>0){let e=s.join(",");console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${e}`),this.signalStartIssue("missing_api",s);return}let i=new t7(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);this.app=i,this.crossdomainMode||(function(e){let t,s,i,n;let r=document.referrer,a=e.safe(()=>{let{URL:s}=document;if(s!==t){t=s;let i=e.sanitizer.privateMode?tG(document.title):document.title,a=e.sanitizer.privateMode?tG(t):t,o=e.sanitizer.privateMode?tG(r):r;e.send([122,a,o,n,i]),n=0,r=t}}),o=e.safe(()=>{let{innerWidth:t,innerHeight:n}=window;(t!==s||n!==i)&&(s=t,i=n,e.send([5,s,i]))}),l=void 0===document.hidden?Function.prototype:e.safe(()=>e.send([55,document.hidden]));e.attachStartCallback(()=>{t=null,n=ep,s=i=-1,a(),o(),l()}),void 0!==document.hidden&&e.attachEventListener(document,"visibilitychange",l,!1,!1),e.ticker.attach(a,1,!1),e.ticker.attach(o,5,!1)}(i),function(e){let t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(void 0===t)return;let s=()=>{var s;return e.send((s=Math.round(1e3*t.downlink),[54,s,t.type||"unknown"]))};s(),t.addEventListener("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=()=>{if(void 0!==s&&void 0!==i){var t,n,r;e.send((t=s,n=i,r=eY.memory.totalJSHeapSize||0,[49,t,n,r,eY.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){e.attachEventListener(window,"focus",function(){document.hidden||(e.debug.log("Openreplay: tab change to"+e.session.getTabId()),e.send(eG(e.session.getTabId())))},!1,!1)}(i)),function(e,t){let s;let{disableClickmaps:i=!1}=t||{},n=-1,r=-1,a=!1,o=null,l=0,h={},c=0,u=0,d=0,p=0;e.attachStartCallback(()=>{s=setInterval(()=>(function(){let t=p/225;if(!c){c=t;return}let s=(t-c)/225;d>4&&s>.008&&e.send([114,eg()]),p=0,d=0,c=t})(),225)}),e.attachStopCallback(()=>{n=-1,r=-1,a=!1,o=null,h={},s&&clearInterval(s)});let f=()=>{a&&(e.send([20,n,r]),a=!1)},g=(s,c=!1)=>{let g=c?e.attachEventListener.bind(e):e.nodes.attachNodeListener.bind(e.nodes);g(s.documentElement,"mouseover",e=>{let t=s_(e.target,s);t!==o&&(o=t,l=performance.now())}),g(s,"mousemove",t=>{let[i,o]=e.observer.getDocumentOffset(s);n=t.clientX+i,r=t.clientY+o,a=!0;let l=Math.sign(t.movementX);p+=Math.abs(t.movementX)+Math.abs(t.movementY),l!==u&&(u=l,d++)},!1),g(s,"click",n=>{let r=s_(n.target,s);if(!n.clientX&&!n.clientY||null===r)return;let a=e.nodes.getID(r);if(void 0!==a){var c,u,d,p;let g=n.pageX,m=n.pageY,b=s.documentElement.scrollWidth,y=s.documentElement.scrollHeight,v=sN(g/b),S=sN(m/y);f();let w=function(t){let s=ek(t);if(null!==s)return s;if(tM(t,"input"))return sp(t);if(sC(t)){let s="";return t instanceof HTMLElement&&(s=e.sanitizer.getInnerTextSecure(t)),eb(s=s||t.id||t.className).slice(0,100)}return""}(r);e.send((c=a,u=o===r?Math.round(performance.now()-l):0,d=e.sanitizer.privateMode?w.replaceAll(/./g,"*"):w,p=sC(r)&&!i?h[a]=h[a]||function(e,t){var s,i;let n;if(e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";let r={root:document.body,idName:sb,className:sy,tagName:sv,attr:sm,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},a=new Date,o={...r,...t},l=(s=o.root,i=r,s.nodeType===Node.DOCUMENT_NODE?s:s===i.root?s.ownerDocument:s),h=0;for(let t of function*(e,t,s){let i=[],n=[],r=e,a=0;for(;r&&r!==s;){let e=function(e,t){var s,i;let n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s0)for(let i of t[0])yield*e(t.slice(1,t.length),s.concat(i));else yield s}(i)),a>=t.seedMinLength){for(let e of(n.sort(sT),n))yield e;n=[]}}for(let e of(n.sort(sT),n))yield e}(e,o,l)){if(new Date().getTime()-a.getTime()>o.timeoutMs||h>=o.maxNumberOfPathChecks){let t=function(e,t){let s=0,i=e,n=[];for(;i&&i!==t;){let e=i.tagName.toLowerCase(),t=sI(i,e);if(void 0===t)return;n.push({name:sx(e,t),penalty:NaN,level:s}),i=i.parentElement,s++}if(sE(n,t))return n}(e,l);if(!t)throw Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return sw(t)}if(h++,sE(t,l)){n=t;break}}if(!n)throw Error("Selector was not found.");let c=[...function* e(t,s,i,n,r){if(t.length>2&&t.length>i.optimizedMinLength)for(let a=1;ai.timeoutMs)return;let o=[...t];o.splice(a,1),sE(o,n)&&n.querySelector(sw(o))===s&&(yield o,yield*e(o,s,i,n,r))}}(n,e,o,l,a)];return(c.sort(sT),c.length>0)?sw(c[0]):sw(n)}(r,{root:s.body,seedMinLength:3,optimizedMinLength:t?.minSelectorDepth||2,maxNumberOfPathChecks:t?.maxOptimiseTries||1e4}):"",[68,c,u,d,p,v,S]),!0)}o=null})};e.nodes.attachNodeCallback(e=>{tN(e)&&g(e)}),g(document,!0),e.ticker.attach(f,t?.trackingOffset||7)}(i,e.mouse),function(e,t){let s=!1,i=new Map;function n(e){tx(e)&&(tC(e)&&i.set(e,[e.scrollLeft,e.scrollTop]),tN(e)&&i.set(e,ip(e)))}let r=e.safe(()=>{!t&&e.send(function(e,t){return[6,e,t]}(...ip(document)))}),a=e.safe((t,s)=>{var i,n;let r=e.nodes.getID(s);void 0!==r&&e.send((i=r,n=t[0],[16,i,n,t[1]]))});e.attachStartCallback(r),e.attachStopCallback(()=>{s=!1,i.clear()}),e.nodes.attachNodeCallback((t,s)=>{s&&(tC(t)&&t.scrollLeft+t.scrollTop>0?i.set(t,[t.scrollLeft,t.scrollTop]):tN(t)&&i.set(t,ip(t))),tO(t)&&e.nodes.attachNodeListener(t,"scroll",e=>{n(e.target)})}),e.attachEventListener(document,"scroll",e=>{let t=e.target;if(t===document){s=!0;return}n(t)}),e.ticker.attach(()=>{s&&(r(),s=!1),i.forEach(a),i.clear()},5,!1)}(i,this.crossdomainMode),function(e){if(null===e)return;if(!window.CSSStyleSheet){e.send([63,"no_stylesheet_prototype_in_window",""]);return}let t=e.safe((t,s,i)=>{let n=ib.get(t);if(n)"string"==typeof i?e.send([73,n,i,s,e.getBaseHref()]):e.send([75,n,s])}),s=e.safe(t=>{let s=t;for(;s.parentRule;)s=s.parentRule;let i=s.parentStyleSheet;if(!i){e.debug.warn("No parent StyleSheet found for",s,t);return}let n=ib.get(i);if(!n){e.debug.warn("No sheedID found for",i,ib);return}let r=s.cssText,a=Array.from(i.cssRules).indexOf(s);a>=0?(e.send([73,n,r,a,e.getBaseHref()]),e.send([75,n,a+1])):e.debug.warn("Rule index not found in",i,s)}),i=e.safe(e=>{let{insertRule:i,deleteRule:n}=e.CSSStyleSheet.prototype,{insertRule:r,deleteRule:a}=e.CSSGroupingRule.prototype;e.CSSStyleSheet.prototype.insertRule=function(e,s=0){return t(this,s,e),i.call(this,e,s)},e.CSSStyleSheet.prototype.deleteRule=function(e){return t(this,e),n.call(this,e)},e.CSSGroupingRule.prototype.insertRule=function(e,t=0){let i=r.call(this,e,t);return s(this),i},e.CSSGroupingRule.prototype.deleteRule=function(e=0){let t=a.call(this,e);return s(this),t}});i(window),e.observer.attachContextCallback(i),e.nodes.attachNodeCallback(s=>{if(!tM(s,"style")||!s.sheet||null!==s.textContent&&s.textContent.trim().length>0)return;let i=e.nodes.getID(s);if(!i)return;let n=s.sheet,r=im++;ib.set(n,r),e.send([76,r,i]);let a=n.cssRules;for(let e=0;esetTimeout(()=>{let n=e.nodes.getID(i);if(i===document&&(n=0),void 0===n)return;let r=s.get(n);r||(r=[]);let a=[],o=i.adoptedStyleSheets;if(o&&Symbol.iterator in o)for(let s of o){let i=t.get(s),o=!i;if(i||(i=im++,t.set(s,i)),r.includes(i)||e.send([76,i,n]),o){let t=s.cssRules;for(let s=0;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([71,n,s,e.getBaseHref()]),i})},s.CSSStyleSheet.prototype.replaceSync=function(s){let i=t.get(this);return i&&e.send([71,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=>{ig(e)&&i(e)})}(i),function(e,t){let s=Object.assign({consoleMethods:ss,consoleThrottling:30},t);if(!Array.isArray(s.consoleMethods)||0===s.consoleMethods.length)return;let i=e.safe((t,s)=>{let i=("string"==typeof s[0]&&s.unshift(s.shift().replace(/%(o|s|f|d|i)/g,(e,t)=>{let i=s.shift();if(void 0===i)return e;switch(t){case"o":return st(i);case"s":return se(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(st).join(" "));e.sanitizer.privateMode&&(i=i.replaceAll(/./g,"*")),e.send([22,t,i])}),n=0,r=()=>{n=0};e.attachStartCallback(r),e.ticker.attach(r,33,!1);let a=(t,r)=>{let a={apply:function(e,t,a){Reflect.apply(e,r,a),!((n+=1)>s.consoleThrottling)&&i(e.name,a)}};s.consoleMethods.forEach(s=>{if(-1===ss.indexOf(s)){e.debug.error(`OpenReplay: unsupported console method "${s}"`);return}let i=r.console[s];t[s]=new Proxy(i,a)})},o=e.safe(e=>a(e.console,e));o(window),e.observer.attachContextCallback(o)}(i,e),function(e,t){function s(t){function s(s){let i=sh(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=>sc(e)).join(", ");e.attributeSender.sendSetAttribute(t,"srcset",n)},i=function(s,i){var n,r;i.src.length>1e5&&t(s,i),e.send((n=s,r=i.src,[60,n,"src",r,e.getBaseHref()]))},n=e.safe(function(t){var s;let i=sc(t.src||"");ey(i)&&e.send((s=e.timestamp(),[116,s,0,0,0,0,0,i,"img",0,!1]))}),r=e.safe(function(r){var a;let o=e.nodes.getID(r);void 0!==o&&r.complete&&(0!==r.naturalHeight||0!==r.naturalWidth||(a=r.src,ed&&(a.startsWith("data:image/svg+xml")||a.match(/.svg$|/i)))?e.sanitizer.isHidden(o)||e.sanitizer.isObscured(o)?t(o,r):(i(o,r),s(o,r)):n(r))}),a=e_(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(()=>{a.disconnect()}),e.nodes.attachNodeCallback(t=>{tM(t,"img")&&(e.nodes.attachNodeListener(t,"error",()=>n(t)),e.nodes.attachNodeListener(t,"load",()=>r(t)),r(t),a.observe(t,{attributes:!0,attributeFilter:["src","srcset"]}))})}(i),function(e,t){let s=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:sf.Obscured,obscureInputDates:!1},t);function i(t,i){let n=i.value,r=s.defaultInputMode;"password"===i.type||e.sanitizer.isHidden(t)?r=sf.Hidden:(e.sanitizer.isObscured(t)||r===sf.Plain&&(s.obscureInputNumbers&&"date"!==i.type&&/\d\d\d\d/.test(n)||s.obscureInputDates&&"date"===i.type||s.obscureInputEmails&&("email"===i.type||~n.indexOf("@"))))&&(r=sf.Obscured);let a=0;switch(r){case sf.Hidden:a=-1,n="";break;case sf.Obscured:a=n.length,n=""}return{value:n,mask:a}}function n(t,s){let{value:n,mask:r}=i(t,s);e.send([18,t,n,r])}let r=new Map,a=new Map;function o(e,t){r.get(e)!==t.value&&(r.set(e,t.value),n(e,t))}function l(t,s){if(a.get(t)!==s)a.set(t,s),e.send([19,t,s])}e.attachStopCallback(()=>{r.clear(),a.clear()}),e.ticker.attach(()=>{r.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return r.delete(s);o(s,i)}),a.forEach((t,s)=>{let i=e.nodes.getNode(s);if(!i)return a.delete(s);l(s,i.checked)})},3),e.nodes.attachNodeCallback(e.safe(t=>{let s=e.nodes.getID(t);if(void 0!==s){if(tM(t,"select")&&(n(s,t),e.nodes.attachNodeListener(t,"change",()=>n(s,t))),tM(t,"textarea")||tM(t,"input")&&su.includes(t.type)){o(s,t);let n=0,r=0,a=0;e.nodes.attachNodeListener(t,"focus",()=>{n=eg()}),e.nodes.attachNodeListener(t,"input",()=>{0===r&&0!==n&&(r=eg()-n)}),e.nodes.attachNodeListener(t,"change",()=>{0!==n&&(a=eg()-n),function(t,s,n,r){let{value:a,mask:o}=i(t,s),l=sp(s);e.sanitizer.privateMode&&(l=l.replaceAll(/./g,"*")),e.send([112,t,a,0!==o,l,n,r])}(s,t,r,a),r=0,a=0,n=0});return}if(function(e){if(!tM(e,"input"))return!1;let t=e.type;return"checkbox"===t||"radio"===t}(t)){l(s,t.checked),e.nodes.attachNodeListener(t,"change",()=>l(s,t.checked));return}}}))}(i,e),function(e,t){let s;let i=Object.assign({captureResourceTimings:!0,capturePageLoadTimings:!0,capturePageRenderTimings:!0,excludedResourceUrls:[]},t);if("PerformanceObserver"in window||(i.captureResourceTimings=!1),!i.captureResourceTimings)return;let n={};function r(t){if(t.duration<0||!ey(t.name)||e.isServiceURL(t.name))return;null!==n&&(n[t.name]=t.startTime+t.duration);let s=!1;if(i.excludedResourceUrls?.forEach(e=>{if(t.name.startsWith(e)){s=!0;return}}),!s){var r,a,o,l,h,c,u,d,p,f,g,m;(0===t.responseEnd||0===t.transferSize&&0===t.decodedBodySize)&&e.send((r=t.startTime+ep,a=t.name,o=t.initiatorType,[116,r,0,0,0,0,0,a,o,0,!0])),e.send((l=t.startTime+ep,h=t.duration,c=t.responseStart&&t.startTime?t.responseStart-t.startTime:0,u=t.transferSize>t.encodedBodySize?t.transferSize-t.encodedBodySize:0,d=t.encodedBodySize||0,p=t.decodedBodySize||0,f=e.sanitizer.privateMode?t.name.replaceAll(/./g,"*"):t.name,g=t.initiatorType,m=t.transferSize,[116,l,h,c,u,d,p,f,g,m,t.responseStatus&&304===t.responseStatus||0===t.transferSize]))}}let a=new PerformanceObserver(e=>e.getEntries().forEach(r));function o(t){if(e.active()){var s;return e.send((s=t.name,[124,s,String(t.value)]))}}e.attachStartCallback(function({sessionID:e}){e!==s&&(performance.getEntriesByType("resource").forEach(r),s=e),a.observe({entryTypes:["resource"]}),s0(o),ia(o),ih(o),id(o)}),e.attachStopCallback(function(){a.disconnect()});let l=0,h=0;if(i.capturePageLoadTimings){let t=!1;e.ticker.attach(()=>{if(!t&&((0===l||0===h)&&performance.getEntriesByType("paint").forEach(e=>{let{name:t,startTime:s}=e;switch(t){case"first-paint":l=s;break;case"first-contentful-paint":h=s}}),performance.timing.loadEventEnd||performance.now()>3e4)){t=!0;let{navigationStart:s,requestStart:i,responseStart:n,responseEnd:r,domContentLoadedEventStart:a,domContentLoadedEventEnd:o,loadEventStart:c,loadEventEnd:u}=performance.timing;e.send([23,i-s||0,n-s||0,r-s||0,a-s||0,o-s||0,c-s||0,u-s||0,l,h])}},30)}if(i.capturePageRenderTimings){let t=0,s=0,i=0,r=null,a=!1;e.ticker.attach(()=>{if(a)return;let o=performance.now();if(null!==n&&o-(t=Math.max.apply(null,Object.keys(n).map(e=>n[e])))>1e3&&(r=function(e){let t=[],s=document.getElementsByTagName("*"),i=/url\(("[^"]*"|'[^']*'|[^)]*)\)/i;for(let n=0;n50&&(s=o),i=o-s>5e3?null:o),null!==r&&null===i||o>3e4){a=!0,n=null;let o=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;ne?r:e)}return 0===s?0:i/s}(h||l,r),{domContentLoadedEventEnd:c,navigationStart:u}=performance.timing,d=null===i?Math.max(s,h,c-u||0):0;e.send([24,o,h>t?h:t,d])}})}}(i,e),function(e){function t(t){let s=e.nodes.getID(t);void 0!==s&&e.send([58,s])}let s=!1;e.nodes.attachNodeCallback(i=>{tM(i,"body")&&(e.nodes.attachNodeListener(i,"focus",e=>{tx(e.target)&&(t(e.target),s=!1)}),e.nodes.attachNodeListener(i,"blur",t=>{null===t.relatedTarget&&(s=!0,setTimeout(()=>{s&&e.send([58,-1])},0))}))}),e.attachStartCallback(()=>{let e=document.activeElement;for(;e&&tM(e,"iframe")&&e.contentDocument;)e=e.contentDocument.activeElement;e&&e!==e.ownerDocument.body&&t(e)},!0)}(i),function(e){if(!window.FontFace)return;let t=new Map,s=s=>{class i extends s.FontFace{constructor(...i){if("string"==typeof i[1]){let n="";i[2]&&e.safe(()=>{n=JSON.stringify(i[2])});let r=[i[0],i[1],n],a=t.get(s.document)||[];a.push(r),t.set(s.document,a);let o=s===window?0:e.nodes.getID(s.document);if(void 0===o)return;e.active()&&e.send(function(e,t,s,i){return[57,e,t,s,i]}(o,...r))}super(...i)}}s.FontFace=i};e.observer.attachContextCallback(s),s(window),e.nodes.attachNodeCallback(e.safe(s=>{if(!tN(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(function(e,t,s,i){return[57,e,t,s,i]}(n,...t))})}))}(i),e.network?.disabled||function(e,t={}){if(t.disabled)return;let s=Object.assign({failuresOnly:!1,ignoreHeaders:["cookie","set-cookie","authorization"],capturePayload:!1,sessionTokenHeader:!1,captureInIframes:!0,axiosInstances:void 0,useProxy:!0},t);!1===s.useProxy&&e.debug.warn("Network module is migrating to proxy api, to gradually migrate and test it set useProxy to true");let i=s.ignoreHeaders,n=Array.isArray(i)?e=>i.includes(e):()=>i,r=!0===s.sessionTokenHeader?"X-OpenReplay-SessionToken":s.sessionTokenHeader;function a(t){if(r){let s=e.getSessionToken();s&&e.safe(t)(r,s)}}function o(t){if((!s.capturePayload||e.sanitizer.privateMode)&&(delete t.request.body,delete t.response.body),s.sanitizer){let e=t.response.body;if("string"==typeof e)try{t.response.body=JSON.parse(e)}catch{}return s.sanitizer(t)}return t}function l(t){if(t&&"string"!=typeof t.body)try{t.body=JSON.stringify(t.body)}catch{t.body="",e.notify.warn("Openreplay fetch couldn't stringify body:",t.body)}return JSON.stringify(t)}let h=t=>{if(s.useProxy)return function(e,t,s,i,n,r,a={xhr:!0,fetch:!0,beacon:!0},o){var l;if(e&&(a.xhr&&(e.XMLHttpRequest?e.XMLHttpRequest=ij.create(t,s,i,n,r,o):iP("XMLHttpRequest")),a.fetch&&(e.fetch?e.fetch=iL.create(t,s,i,n,r,o):iP("fetch")),a.beacon&&(null===(l=e.navigator)||void 0===l?void 0:l.sendBeacon))){let a=e.navigator.sendBeacon;e.navigator.sendBeacon=iR.create(a,t,s,i,n,r)}}(t,!!e.sanitizer.privateMode||s.ignoreHeaders,a,o,t=>{var i,n,r,a,o,l,h,c;if(s.failuresOnly&&t.status<400)return;let u=e.sanitizer.privateMode?"************":t.url;e.send((i=t.requestType,n=t.method,r=u,a=t.request,o=t.response,l=t.status,h=t.startTime+ep,c=t.duration,[83,i,n,r,a,o,l,h,c,t.responseSize]))},t=>e.isServiceURL(t),{xhr:!0,fetch:!0,beacon:!0},s.tokenUrlMatcher);let r=t.fetch.bind(t);t.fetch=(t,h={})=>{if(!("string"==typeof t||t instanceof URL)||e.isServiceURL(String(t)))return r(t,h);a(function(e,t){void 0===h.headers&&(h.headers={}),h.headers instanceof Headers?h.headers.append(e,t):Array.isArray(h.headers)?h.headers.push([e,t]):h.headers[e]=t});let c=performance.now();return r(t,h).then(r=>{let a=performance.now()-c;if(s.failuresOnly&&r.status<400)return r;let u=r.clone();return u.text().then(s=>{let r={},d={};if(!0!==i){let e=([e,t])=>{n(e)||(r[e]=t)};h.headers instanceof Headers?h.headers.forEach((t,s)=>e([s,t])):Array.isArray(h.headers)?h.headers.forEach(e):"object"==typeof h.headers&&Object.entries(h.headers).forEach(e),u.headers.forEach((e,t)=>{n(t)||(d[t]=e)})}let p=iU(h.method),f=o({url:String(t),method:p,status:u.status,request:{headers:r,body:h.body||null},response:{headers:d,body:s}});if(f){var g,m,b,y,v;e.send((g=p,m=String(f.url),b=l(f.request),y=l(f.response),v=u.status,[83,"fetch",g,m,b,y,v,c+ep,a,0]))}}).catch(t=>e.debug.error("Could not process Fetch response:",t)),r})};let h=t.XMLHttpRequest.prototype.open,c=t.XMLHttpRequest.prototype.setRequestHeader,u=t.XMLHttpRequest.prototype.send;s.axiosInstances||(t.XMLHttpRequest.prototype.open=function(t,s){let i=this;a((e,t)=>i.setRequestHeader(e,t));let r=0;return i.addEventListener("loadstart",e=>{r=e.timeStamp}),i.addEventListener("load",e.safe(a=>{let{headers:h,body:c}=iB(i),u=r>0?a.timeStamp-r:0,d=(i.getAllResponseHeaders()||"").trim().split(/[\r\n]+/),p={};d.forEach(function(e){let t=e.split(": "),s=t.shift();n(s)||(p[s]=t.join(": "))});let f=iU(t),g=o({url:String(s),method:f,status:i.status,request:{headers:h,body:c||null},response:{headers:p,body:i.response}});if(g){var m,b,y,v,S;e.send((m=f,b=String(g.url),y=l(g.request),v=l(g.response),S=i.status,[83,"xhr",m,b,y,v,S,r+ep,u,0]))}})),h.apply(this,arguments)},t.XMLHttpRequest.prototype.send=function(e){return iB(this).body=e,u.apply(this,arguments)},t.XMLHttpRequest.prototype.setRequestHeader=function(e,t){return n(e)||(iB(this).headers[e]=t),c.apply(this,arguments)})};h(window),s.axiosInstances&&s.axiosInstances.forEach(t=>{!function(e,t,s,i,n){function r(t){var r,a,o,l,h;e.debug.log("Openreplay: capturing axios response data",t);let{headers:c,data:u,method:d,url:p,baseURL:f}=t.config,{data:g,headers:m,status:b,response:y}=t,{data:v,headers:S,status:w}=y||{},k=s.ignoreHeaders,T=Array.isArray(k)?e=>k.includes(e):()=>k;function I(e,t){T(t[0])||(e[t[0]]=t[1])}let x={},E={};c.toJSON?x=c.toJSON():c instanceof Headers?c.forEach((e,t)=>I(x,[t,e])):Array.isArray(c)?c.forEach(e=>I(x,e)):"object"==typeof c&&Object.entries(c).forEach(e=>I(x,e));let C=S||m;C.toJSON?E=C.toJSON():C instanceof Headers?C.forEach((e,t)=>I(E,[t,e])):Array.isArray(C)?C.forEach(e=>I(E,e)):"object"==typeof C&&Object.entries(C).forEach(([e,t])=>{T(e)||(E[e]=t)});let _=i({url:p,method:d||"",status:b||w||0,request:{headers:x,body:u},response:{headers:E,body:v||g}});if(!_){e.debug.log("Openreplay: empty request/response info, skipping");return}let N=t.config.__openreplay_timing,O=performance.now()-N;e.debug.log("Openreplay: final req object",_),e.send((r=String(d),a=String(_.url),o=n(_.request),l=n(_.response),h=_.status,[83,"xhr",r,a,o,l,h,N+ep,O,0]))}e.debug.log("Openreplay: attaching axios spy to instance",t);let a=t.interceptors.request.use(function(t){if(e.debug.log("Openreplay: capturing API request",t),t.__openreplay_timing=performance.now(),s.sessionTokenHeader){let i="string"==typeof s.sessionTokenHeader?s.sessionTokenHeader:"X-OpenReplay-Session-Token",n=e.getSessionToken();n&&t.headers.set(i,n)}return t},function(t){e.debug.log("Openreplay: failed API request, skipping",t)},{synchronous:!0}),o=t.interceptors.response.use(function(e){return s.failuresOnly||r(e),e},function(t){var s,i;return e.debug.log("Openreplay: capturing API request error",t),null!==(i=s=t)&&"object"==typeof i&&!0===s.isAxiosError&&t.response?r(t.response):t instanceof Error&&e.send(sl(t,[])),Promise.reject(t)},{synchronous:!0});e.attachStopCallback(()=>{t.interceptors.request.eject?.(a),t.interceptors.response.eject?.(o)})}(e,t,s,o,l)}),s.captureInIframes&&e.observer.attachContextCallback(e.safe(h))}(i,e.network),function(e){e.attachEventListener(document,"selectionchange",()=>{let t=document.getSelection();if(null===t||t.isCollapsed)e.send([113,-1,-1,""]);else{let s=e.nodes.getID(t.anchorNode),i=e.nodes.getID(t.focusNode),n=t.toString().replace(/\s+/g," ");s&&i&&e.send([113,s,i,n])}})}(i),window.__OPENREPLAY__=this,e.flags&&e.flags.onFlagsLoad&&this.onFlagsLoad(e.flags.onFlagsLoad);let n=window.open;(e.autoResetOnWindowOpen||e.resetTabOnWindowOpen)&&(i.attachStartCallback(()=>{let t=i.getTabId(),s=i.sessionStorage??window.sessionStorage;window.open=function(...r){return e.autoResetOnWindowOpen&&i.resetNextPageSession(!0),e.resetTabOnWindowOpen&&s.removeItem(e.session_tabid_key||"__openreplay_tabid"),i.resetNextPageSession(!1),s.setItem(e.session_tabid_key||"__openreplay_tabid",t),n.call(window,...r)}}),i.attachStopCallback(()=>{window.open=n}))}isFlagEnabled(e){return this.featureFlags.isFlagEnabled(e)}onFlagsLoad(e){this.app?.featureFlags.onFlagsLoad(e)}clearPersistFlags(){this.app?.featureFlags.clearPersistFlags()}reloadFlags(){return this.app?.featureFlags.reloadFlags()}getFeatureFlag(e){return this.app?.featureFlags.getFeatureFlag(e)}getAllFeatureFlags(){return this.app?.featureFlags.flags}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."):this.app.start(e):Promise.reject("Trying to start not in browser.")}browserEnvCheck(){return!!eu||(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 ${ev}${iH}`),!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()}getUxId(){return null===this.app?null:this.app.getUxtId()}sessionID(){return ew("'sessionID' method","'getSessionID' method","/"),this.getSessionID()}getSessionURL(e){if(null!==this.app)return this.app.getSessionURL(e)}setUserID(e){"string"==typeof e&&null!==this.app&&this.app.session.setUserID(e)}userID(e){ew("'userID' method","'setUserID' method","/"),this.setUserID(e)}setUserAnonymousID(e){"string"==typeof e&&null!==this.app&&this.app.send([29,e])}userAnonymousID(e){ew("'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){ew("'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);try{t=JSON.stringify(t)}catch(e){return}this.app.send([27,e,t])}}issue(e,t=null){if("string"==typeof e&&null!==this.app){try{t=JSON.stringify(t)}catch(e){return}this.app.send([64,e,t])}}}class i${constructor(){this.instance=null,this.isConfigured=!1}configure(e){if(eu){if(this.isConfigured){console.warn("OpenReplay: Tracker is already configured. You should only call configure once.");return}if(!e.projectKey){console.error("OpenReplay: Missing required projectKey option");return}this.instance=new iq(e),this.isConfigured=!0}}get options(){return this.instance?.options||null}start(e){return eu?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(eu&&this.ensureConfigured()&&this.instance)return this.instance.stop()}setUserID(e){eu&&this.ensureConfigured()&&this.instance&&this.instance.setUserID(e)}setMetadata(e,t){eu&&this.ensureConfigured()&&this.instance&&this.instance.setMetadata(e,t)}getSessionURL(e){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.getSessionURL(e)}getSessionID(){return eu&&this.ensureConfigured()&&this.instance?this.instance.getSessionID():null}getSessionToken(){return eu&&this.ensureConfigured()&&this.instance?this.instance.getSessionToken():null}event(e,t=null,s=!1){eu&&this.ensureConfigured()&&this.instance&&this.instance.event(e,t,s)}issue(e,t=null){eu&&this.ensureConfigured()&&this.instance&&this.instance.issue(e,t)}handleError(e,t={}){eu&&this.ensureConfigured()&&this.instance&&this.instance.handleError(e,t)}isFlagEnabled(e){return!!(eu&&this.ensureConfigured())&&!!this.instance&&this.instance.isFlagEnabled(e)}onFlagsLoad(...e){eu&&this.ensureConfigured()&&this.instance&&this.instance.onFlagsLoad(...e)}clearPersistFlags(){eu&&this.ensureConfigured()&&this.instance&&this.instance.clearPersistFlags()}reloadFlags(){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.reloadFlags()}getFeatureFlag(e){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.getFeatureFlag(e)}getAllFeatureFlags(){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.getAllFeatureFlags()}restartCanvasTracking(){eu&&this.ensureConfigured()&&this.instance&&this.instance.restartCanvasTracking()}setUserAnonymousID(e){eu&&this.ensureConfigured()&&this.instance&&this.instance.setUserAnonymousID(e)}isActive(){return!!(eu&&this.ensureConfigured())&&!!this.instance&&this.instance.isActive()}getInstance(){return this.ensureConfigured()&&eu?this.instance:null}coldStart(e,t){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.coldStart(e,t)}trackWs(e){return eu&&this.ensureConfigured()&&this.instance?this.instance.trackWs(e):()=>{}}ensureConfigured(){return!!this.isConfigured||!eu||(console.warn('OpenReplay: Tracker must be configured before use. Call tracker.configure({projectKey: "your-project-key"}) first.'),!1)}use(e){return eu&&this.ensureConfigured()&&this.instance?this.instance.use(e):e(null)}startOfflineRecording(...e){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.startOfflineRecording(...e)}uploadOfflineRecording(){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.uploadOfflineRecording()}forceFlushBatch(){if(eu&&this.ensureConfigured()&&this.instance)return this.instance.forceFlushBatch()}getSessionInfo(){return eu&&this.ensureConfigured()&&this.instance?this.instance.getSessionInfo():null}getTabId(){return eu&&this.ensureConfigured()&&this.instance?this.instance.getTabId():null}getUxId(){return eu&&this.ensureConfigured()&&this.instance?this.instance.getUxId():null}}new i$}}]);