window.NOIBUJS_CONFIG={"scriptID":"1.0.46"};(()=>{var e={327:e=>{for(var t=[],n=0;n<256;++n)t[n]=(n+256).toString(16).substr(1);e.exports=function(e,n){var r=n||0,s=t;return[s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},171:(e,t,n)=>{var r=n(217),s=n(327);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;++a)t[i+a]=o[a];return t||s(o)}}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=["metroplexSocketBase","metroplexHTTPBase"],t=["authorization","from","proxy-authorization","content-md5","cookie","x-forwarded-for","x-real-ip","x-device-id","x-request-id","x-auth-token","x-user-id","x-forwarded-for","x-uidh","set-cookie","forwarded"],r=[/\b4\d{12}(?:\d{3})?\b/,/\b(?:5[1-5]\d{2}|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}\b/,/\b3[47]\d{13}\b/,/\b3(?:0[0-5]|[68]\d)\d{11}\b/,/\b6(?:011|5\d{2})\d{12}\b/,/\b(?:2131|1800|35\d{3})\d{11}\b/,/\b[a-z0-9!#$%&'*+/=?^_‘{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_‘{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\b/,/\b(?!000|666)[0-8]\d{2}[-.● ]?(?!00)\d{2}[-.● ]?(?!0000)\d{4}\b/,/\b(\d{3}[-.● ]?\d{3}[-.● ]?\d{3})\b/,/\+(?:\d●?){6,14}\d\b/,/(\b|\+)?(1[-.● ]?)?\(?(\d{3})\)?[-.● ]?(\d{3})[-.● ]?(\d{4})\b/],s=/^www\d{0,2}$/,i=["Image","EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];function o(){return window.NOIBUJS_CONFIG?window.NOIBUJS_CONFIG:{}}const a=["i.noibu","i.staging.noibu","input.staging.noibu","input.b.noibu","input.noibu","vf.staging.noibu","vf.noibu"],c=["error","warn","log"],l=["pagehide","pageshow","focus","blur","popstate","online","offline","messageerror","languagechange","hashchange","beforeprint","afterprint","load","resize"],u=["visibilitychange","resume","freeze","readystatechange","cut","copy","paste"],d=new Set(["--quantum-metric-background-image","--quantum-metric-background-position-x","--quantum-metric-background-position-y","--quantum-metric-background-size","--quantum-metric-background-attachment","--quantum-metric-background-origin","--quantum-metric-background-clip","--quantum-metric-background-color","--quantum-metric-border-image-source","--quantum-metric-border-image-slice","--quantum-metric-border-image-width","--quantum-metric-border-image-outset","--quantum-metric-border-image-repeat","--quantum-metric-border-top-style","--quantum-metric-border-right-style","--quantum-metric-border-bottom-style","--quantum-metric-border-left-style","--quantum-metric-border-top-color","--quantum-metric-border-right-color","--quantum-metric-border-bottom-color","--quantum-metric-border-left-color","--quantum-metric-border-top-width","--quantum-metric-border-right-width","--quantum-metric-border-bottom-width","--quantum-metric-border-left-width","--quantum-metric-flex-wrap","--quantum-metric-list-style-image","--quantum-metric-list-style-position","--quantum-metric-max-width","--quantum-metric-outline-color","--quantum-metric-outline-style","--quantum-metric-outline-width"]);function h(){const e=o();return e.scriptID?e.scriptID:"default"}function p(){const e=o();return!!e.njs_version&&"beta"===e.njs_version}function g(){try{const e=p()?"wss://input.b.noibu.com":"wss://input.noibu.com";return e.endsWith("/")?e.slice(0,-1):e}catch(e){return"ws://localhost:3000"}}function m(){try{const e=p()?"https://input.b.noibu.com":"https://input.noibu.com";return e.endsWith("/")?e.slice(0,-1):e}catch(e){return"http://localhost:3000"}}function f(){return m()+"/pv"}function I(){try{return"prod"}catch(e){return"test"}}const y=/("href":["']([^"]*\.css[^"]*)["'])/gi;var C=n(171),v=n.n(C);const b=(e,t,n)=>{if(!(t in e))return;const r=e[t],s=n(r);if("function"==typeof s)try{s.prototype=s.prototype||{},Object.defineProperties(s,{__noibu__:{enumerable:!1,value:!0},__noibu_original__:{enumerable:!1,value:r},__noibu_wrapped__:{enumerable:!1,value:s}})}catch(e){}e[t]=s},S=(e,t)=>{if(!e||!e.hasOwnProperty||!Object.prototype.hasOwnProperty.call(e,t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(!n.writable){if(!n.configurable)return!1;Object.defineProperty(e,t,{writable:!0})}return!0},w=e=>{if(!e||!e[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");const t={};for(const[n,r]of e)t[n]=r;return t};function A(e){return e.split("\n").reduce((function(e,t){var n=function(e){var t=k.exec(e);if(!t)return null;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),s=E.exec(t[2]);r&&null!=s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3]);return{file:n?null:t[2],methodName:t[1]||"<unknown>",arguments:n?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}(t)||function(e){var t=R.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||"<unknown>",arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=T.exec(e);if(!t)return null;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=_.exec(t[3]);n&&null!=r&&(t[3]=r[1],t[4]=r[2],t[5]=null);return{file:t[3],methodName:t[1]||"<unknown>",arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}(t)||function(e){var t=N.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||"<unknown>",arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=M.exec(e);if(!t)return null;return{file:t[3],methodName:t[1]||"<unknown>",arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}}(t);return n&&e.push(n),e}),[])}var k=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,E=/\((\S*)(?::(\d+))(?::(\d+))\)/;var R=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var T=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var M=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var N=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function D(e,t=1024){return e?e.length<t?e:e.substring(0,t):e}function O(){let e=window.location.href;return window.location.href.startsWith("http")?e=window.location.href:window.parent&&window.parent.location&&window.parent.location.href.startsWith("http")&&(e=window.parent.location.href),D(e)}function L(e){let t=[{line:"_",mname:"_",file:"_"}];if("object"!=typeof e||!e)return{frames:t,msg:""};e.stack?t=A(e.stack).map(e=>{const t={line:"_",mname:"_",file:"_"};return e.lineNumber&&"<unknown>"!==e.lineNumber&&(t.line=String(e.lineNumber)),e.methodName&&"<unknown>"!==e.methodName&&(t.mname=String(e.methodName)),e.file&&"<unknown>"!==e.file&&(t.file=String(e.file)),e.column&&"number"==typeof e.column&&(t.column=e.column),t}):(e.fileName&&"string"==typeof e.fileName&&(t[0].file=e.fileName),e.lineNumber&&(t[0].line=String(e.lineNumber)),e.columnNumber&&Number.isInteger(e.columnNumber)&&(t[0].column=e.columnNumber)),t.length>=50&&(t=t.slice(0,50));return{frames:t,msg:e.message?D(e.message):""}}function x(e){if(Array.prototype.toJSON){const t=Array.prototype.toJSON;delete Array.prototype.toJSON;const n=JSON.stringify(e);return Array.prototype.toJSON=t,n}return JSON.stringify(e)}function P(e,t,n,r,s,i){if(i){const e=x(n),s=new Blob([e]).size;return!window.fetch||s>59e3?new Promise(e=>{e()}):fetch(t,{method:"POST",headers:r,body:x(n),keepalive:!0})}return new Promise((i,o)=>{const a=new XMLHttpRequest;a.open(e,t),a.timeout=s,Object.keys(r).forEach(e=>{a.setRequestHeader(e,r[e])}),a.onload=()=>{a.status>=200&&a.status<300?i(a.response):o(new Error("Custom Request failed: "+a.statusText))},a.onerror=()=>{o(new Error("Custom Request failed: "+a.statusText))},n?a.send(x(n)):a.send()})}function V(){const e=o();return e.sel&&Array.isArray(e.sel)}function F(){const e=o();return!!function(){const e=o();return"undefined"!==e.nid_cookie&&null!=e.nid_cookie}()&&e.nid_cookie}function U(){const e=o(),t=[".noibu-blocked",".creditCard"];return V()&&t.push(...e.sel),""+t.join(",")}function B(){const e="1"===window.navigator.doNotTrack,t=function(e){let t=e;return t||(t=window.navigator.userAgent),t=t.toLowerCase(),new RegExp("(bot|crawl(er)?|sp(i|y)der|search|worm|fetch|nutch|headless|baidu|teoma|yandex|woorankreview|pingdom|synthetic|dataprovider|qaautomation|morningscore|wappalyzer|foregenix|StatusCake|SpeedCurve|Outlook-iOS|bitdiscovery|testing|webflow|bingpreview|(r|R)igor|facebookexternalhit/\\d+\\.\\d+)","i").test(t)}(null);return e||t}function G(e){return e?"object"==typeof e?x(e):String(e):""}function W(e){let t=D(window.location.href);return e&&""!==e.trim()&&"undefined"!==e&&(t=G(D(e))),t}const q={"input.noibu.com":!0,"input.staging.noibu.com":!0,"vf.noibu.com":!0,"vf.staging.noibu.com":!0,"cdn.noibu.com":!0};function H(e){return window&&window.localStorage&&navigator.cookieEnabled?window.localStorage.getItem(e):null}function Z(e,t){if(!window||!window.localStorage)throw new Error(`window or window.localStorage do not exist. indexedDB available: ${!!window.indexedDB}.`);if(!navigator.cookieEnabled)throw new Error("cookies disabled");return window.localStorage.setItem(e,t)}function z(e){window&&window.localStorage&&navigator.cookieEnabled&&window.localStorage.removeItem(e)}class K{constructor(e){this.pageVisitId=v()(),this.isClientDisabled=null,this.browserId=null,this.pageVisitSeq=null,this.lastActiveTime=new Date,this.noibuErrorURL=e,this._setupLocalStorageVars(),this.cltErrorPostCounter=0,this.maxSocketInactiveTime=2100}static configureInstance(e){this.instance||(this.noibuErrorURL=e,this.instance=new K(e),this.instance.noibuErrorURL=e)}static getInstance(){if(!this.instance)throw new Error("ClientConfig was not configured");return this.instance}setupBrowserIDCookie(){F()&&(document.cookie="noibuID="+this.browserId)}lockClient(e,t){const n=new Date;n.setMinutes(n.getMinutes()+e);const r=this._getClientState();r.DisabledStatus=!0,r.ClientUnlockTime=n,this._storeBrowserData(r),this.postNoibuErrorAndOptionallyDisableClient(t,!0,"warn")}lockClientUntilNextPage(e){this.postNoibuErrorAndOptionallyDisableClient(e,!0,"warn")}updateLastActiveTime(e){this.lastActiveTime=e;const t=this._getLsObject();t.LastActive=e,this._storeBrowserData(t)}getPageVisitSeq(){if(this._pageVisitSeqNeedsReset()){this.pageVisitSeq=0;const e=this._getLsObject();e.CurrentPageVisitCount=this.pageVisitSeq+1,e.LastActive=new Date,this._storeBrowserData(e)}return this.pageVisitSeq}_getLsObject(){const e=H("n_browser_data");if(!e)return this._generateAndStoreData();let t={};try{t=JSON.parse(e)}catch(e){return this._generateAndStoreData()}return null==t.BrowserId||null==t.DisabledStatus||null==t.CurrentPageVisitCount||null==t.LastActive?this._generateAndStoreData():t}_pageVisitSeqNeedsReset(){const e=this._getClientState(),t=new Date;return t.setMinutes(t.getMinutes()-45),new Date(e.LastActive)<t}_setupLocalStorageVars(){const e=this._getClientState();if(this._pageVisitSeqNeedsReset()&&(e.CurrentPageVisitCount=0),this.browserId=e.BrowserId,this.pageVisitSeq=e.CurrentPageVisitCount,this.isClientDisabled=e.DisabledStatus,this.isClientDisabled||(e.CurrentPageVisitCount+=1,e.LastActive=new Date),I().includes("video")&&(e.pvId=this.pageVisitId),e.CurrentPageVisitCount>=300){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Hit max page visits, disabling client",!0,"error");const t=new Date;t.setMinutes(t.getMinutes()+45),e.ClientUnlockTime=t}null===this._storeBrowserData(e).BrowserId&&(K.getInstance().postNoibuErrorAndOptionallyDisableClient("Null browser in local storage, disabling client",!0,"error"),this.browserId=null)}_getClientState(){const e=this._getLsObject();return e.ClientUnlockTime&&new Date(e.ClientUnlockTime)<=new Date&&(e.ClientUnlockTime=null,e.DisabledStatus=!1,this._storeBrowserData(e)),e}_generateAndStoreData(){return this._storeBrowserData(this._generateNewBrowserData())}_generateNewBrowserData(){const e={DisabledStatus:!1,BrowserId:v()(),CurrentPageVisitCount:0,ClientUnlockTime:null,LastActive:new Date};return I().includes("video")&&(e.pvId=this.pageVisitId),e}_storeBrowserData(e){try{return Z("n_browser_data",x(e)),e}catch(e){this.postNoibuErrorAndOptionallyDisableClient("Error writing browser data to local storage, disabling client: "+e.message,!0,"error");return{DisabledStatus:!0,BrowserId:null,CurrentPageVisitCount:0}}}postNoibuErrorAndOptionallyDisableClient(e,t,n,r=!1){if(this.isClientDisabled)return;if(t&&(this.isClientDisabled=!0),"warn"===n)return;let s=`Noibu Browser ID(${this.browserId?this.browserId:""}), PV ID ${this.pageVisitId}, Script ID ${h()}, and User Agent ${window.navigator.userAgent} error: ${G(e)}`;if(this.cltErrorPostCounter>=50){const e=new Date;e.setMinutes(e.getMinutes()+10);const t=this._getClientState();t.DisabledStatus=!0,t.ClientUnlockTime=e,this._storeBrowserData(t),this.isClientDisabled=!0,s="Shutting collect off, we reached the maximum limit of collect errors sent."}const i={url:window.location.href,err_msg:s,sev:n},o={"content-type":"application/json"};r?fetch(this.noibuErrorURL,{method:"POST",headers:o,body:x(i),keepalive:!0}):P("POST",this.noibuErrorURL,i,o,2e3,!1).catch(()=>{}),"error"===n&&(this.cltErrorPostCounter+=1)}isInactive(){const e=new Date;return e.setSeconds(e.getSeconds()-this.maxSocketInactiveTime),this.lastActiveTime<e}}function j(e,t,n,r){if(!e||!t||!n)return;const s=e=>{try{n(e)}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("addEventListener callback error: "+e.message,!1,"error")}};try{e.addEventListener(t,s,r)}catch(n){if(n instanceof TypeError&&(()=>{if(!Reflect)return!1;try{Reflect.get(e,"addEventListener")(t,s,r)}catch(e){return!1}return!0})())return;K.getInstance().postNoibuErrorAndOptionallyDisableClient("addEventListener error: "+n.message,!1,"error")}}class Y{constructor(){this.expectedVideoLength=0,this.expectedVfSeq=0,this.httpSequenceNumber=0,this.httpOverLimitCount=0,this.httpDroppedPayloadByTypeCount=0,this.httpDroppedPayloadByLengthCount=0,this.httpPayloadCount=0,this.expectedPvPart=0,this.videoClicks=0,this.pvClicks=0,this.errCount=0,this.httpCount=0,this.didCutPv=!1,this.didCutVideo=!1,this.writeTimeout=null,this.didStartVideo=!1,this._setupListeners()}static getInstance(){return this.instance||(this.instance=new Y),this.instance}addVideoFragData(e,t){this.expectedVfSeq=e,this.expectedVideoLength=t}setPvPart(e){this.expectedPvPart=e}addVideoClick(){this.videoClicks+=1}addPvClick(){this.pvClicks+=1}addError(){this.errCount+=1}addHttpEvent(){this.httpCount+=1}addHttpData(){this.httpSequenceNumber+=1}addHttpDataOverLimit(){this.httpOverLimitCount+=1}addHttpDataDropByType(){this.httpDroppedPayloadByTypeCount+=1}addHttpDataDropByLength(){this.httpDroppedPayloadByLengthCount+=1}addHttpDataPayloadCount(){this.httpPayloadCount+=1}setDidCutVideo(){this.didCutVideo=!0}setDidStartVideo(){this.didStartVideo=!0}setDidCutPv(){this.didCutPv=!0}_setupListeners(){j(window,"pagehide",()=>{this._postMetricsIfActive("pagehide")})}_postMetricsIfActive(e){K.getInstance().isClientDisabled||K.getInstance().isInactive()||this.postMetrics(e)}postMetrics(e){const t={br_id:K.getInstance().browserId,pv_id:K.getInstance().pageVisitId,cv:2,v:1,exp_vid_len:this.expectedVideoLength,exp_vf_seq:this.expectedVfSeq,exp_pc_seq:this.expectedPvPart,exp_http_seq:this.httpSequenceNumber,http_payloads:this.httpPayloadCount,http_drop_oversize:this.httpDroppedPayloadByLengthCount,http_drop_type:this.httpDroppedPayloadByTypeCount,http_over_limit:this.httpOverLimitCount,vid_clicks:this.videoClicks,pv_clicks:this.pvClicks,did_cut_pv:this.didCutPv,did_cut_vid:this.didCutVideo,did_start_vid:this.didStartVideo,exp_http:this.httpCount,exp_err:this.errCount,on_url:document.location.href};window.dispatchEvent(new CustomEvent("noibuPostMetrics",{detail:e})),window.fetch&&window.fetch(m()+"/metrics",{method:"POST",headers:{"content-type":"application/json"},body:x(t),keepalive:!0})}}class J{constructor(){this.isLocalStorageSupported=this._testLocalStorageSupported(),this.latestPageVisitFrag=null,this.writeTimeout=null,this.flushedLocalStorage=!1,this.isLocalStorageSupported&&this._postPreviousPageVisit()}static getInstance(){return this.instance||(this.instance=new J),this.instance}checkAndStoreRetryQueue(e,t){const{type:n,payload:r}=e[e.length-1];if("p"!==n||!r.pvp)return;(r.pvp.events?r.pvp.events:[]).filter(e=>"userstep"===e.type||"err"===e.type||"loc"===e.type).length>0&&this.writePageVisitsFromRetryQueue(e,t)}writePageVisitsFromRetryQueue(e,t){const n=[];for(let t=0;t<e.length;t+=1){const{type:r,payload:s}=e[t];if("p"===r){const e=s.pvp;n.push(e)}}this._writePageVisitFrags(n,t)}_writePageVisitFrags(e,t){const n=x({pageVisitFrags:e,pageVisitInfo:t,timestamp:new Date});if(!(n.length>5242880))try{Z("n_stored_page_visit",n)}catch(e){z("n_stored_page_visit");const t=function(){if(!window||!window.localStorage||!window.localStorage.key)return 0;if(!navigator.cookieEnabled)return 0;let e=0;for(let t=0;t<window.localStorage.length;t+=1){const n=window.localStorage.key(t);if(n){const t=H(n);t&&(e+=t.length)}}return e}();K.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error writing pv to local storage: ${e}, json size: ${n.length}, LS size: ${t}, `,!1,"error")}}_getPostData(){const e=H("n_stored_page_visit");if(!e)return null;let t={};try{t=JSON.parse(e)}catch(t){return z("n_stored_page_visit"),K.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error parsing page visit string '${e}': ${t}`,!1,"error"),null}if(t.timestamp){const e=new Date;if(e.setSeconds(e.getSeconds()-2100),e>=Date.parse(t.timestamp))return null}const n={pvi:t.pageVisitInfo,pvp:[],pvvf:[]};n.pvi.last=!0;for(let e=0;e<t.pageVisitFrags.length;e+=1)n.pvp.push(t.pageVisitFrags[e]);return n}_testLocalStorageSupported(){try{Z("n_key","N".repeat(512))}catch(e){return!1}return z("n_key"),!0}_postPreviousPageVisit(){this._getPostPageVisitPromise().then(()=>{this._updateLocalStorageFlushed()}).catch(()=>{this._updateLocalStorageFlushed()})}_updateLocalStorageFlushed(){this.flushedLocalStorage=!0,z("n_stored_page_visit")}_getPostPageVisitPromise(){return new Promise((e,t)=>{const n=this._getPostData();if(!n)return void e();P("POST",f(),n,{"content-type":"application/json"},2e3,!0).then(()=>{e()}).catch(e=>{t(new Error("Page visit post request rejected due to: ",e))})})}}function Q(){return!("now"in Date)||("number"!=typeof Date.now()||(!("toISOString"in new Date)||"string"!=typeof(new Date).toISOString()))}function $(e){if("number"!=typeof e&&Q()){if(Date.prototype.hasOwnProperty("valueOf")&&"function"==typeof e.valueOf&&"number"==typeof e.valueOf())return e.valueOf();K.getInstance().postNoibuErrorAndOptionallyDisableClient("The date object has been overwritten and can't be processed properly.\n      Client has been disabled.",!0,"error",!0)}return e}function X(){return window.performance&&window.performance.now?window.performance.now():$(Date.now())}class ee{constructor(e){const t=g();this.forceClosed=!1,this.socket=null,this.socketInstanceId=null,this.previousMessageType="",this.currentConnectionAttempts=0,this.connectionCount=0,this.sessionStartTime=X(),this.connectionPromise=null,this.pageVisitInfoSent=!1,this.connectionURL=t+"/pv_part",this.postURL=f(),this.messageSequenceNum=0,this.latestReceivedSeqNumber=-1,this.isRetryLoopDisabled=!1,this.retryMessageQueue=[],this.metroplexTypeLock={},this.initialURL=O(),this.initialReferingURL=window.document.referrer?D(window.document.referrer):"",this.sessionTimestamp=new Date,this.latestReceivedSeqNumStoredTime=new Date,this.instanceId=v()(),this.scriptInstanceId=e,this.sessionLength=0,this.socketCloseCodes=[],this.socketOpens=[],this.ackedOnce=!1,this.metroRetryFrequencyMS=3e4}static getInstance(e){return this.instance||(this.instance=new ee(e),this.instance.start()),this.instance}start(){this.connectSocket().finally(new Promise(e=>{this._setupOffloadEvents(),e()}))}_addSeqNumToPayload(e,t){switch(e){case"p":this._setSeqNumInPayloadAndIncrementSeqNum("pvp",t);break;case"v":this._setSeqNumInPayloadAndIncrementSeqNum("pvvf",t);break;case"h":this._setSeqNumInPayloadAndIncrementSeqNum("pvh",t);break;case"m":this._setSeqNumInPayloadAndIncrementSeqNum("pvm",t)}}_setSeqNumInPayloadAndIncrementSeqNum(e,t){t[e].seq_num=this.messageSequenceNum,this.messageSequenceNum+=1}sendMessage(e,t){if(e in this.metroplexTypeLock||K.getInstance().isClientDisabled)return;const n=t;if(this._addSeqNumToPayload(e,n),this.retryMessageQueue.push({payload:n,type:e}),J.getInstance().checkAndStoreRetryQueue(this.retryMessageQueue,this.getPageInformation()),this.isConnected()&&this.pageVisitInfoSent&&this._sendSocketMessage(n),this.previousMessageType=e,"p"===e&&t.pvp){const e=t.pvp.events?t.pvp.events:[];this._updateLatestPvTimestamp(e)}}_updateLatestPvTimestamp(e){e.filter(e=>"userstep"===e.type).length>0&&K.getInstance().updateLastActiveTime(new Date)}isConnected(){return null!==this.socket&&1===this.socket.readyState}isConnecting(){return null!==this.socket&&0===this.socket.readyState}close(){this.forceClosed=!0,(this.isConnected()||this.isConnecting())&&this.socket.close(1e3)}handleConnect(e,t){(t||!this.isConnected()&&!this.isConnecting())&&(this.currentConnectionAttempts+=1,this.socket=new WebSocket(this.connectionURL),this.socketInstanceId=v()(),this.socket.onerror=()=>{},this.socket.onclose=t=>{this.pageVisitInfoSent=!1,this.forceClosed||(this.socketCloseCodes.push(`${Q()?"":(new Date).toISOString()}:${t.code}`),this.isConnecting()||(clearInterval(this.retryMetroplexInterval),this.currentConnectionAttempts>=function(){try{return 20}catch(e){return 2}}()?K.getInstance().lockClientUntilNextPage("Too many reconnection attempts, locking until next page"):this.connectionCount>=100?K.getInstance().lockClientUntilNextPage("Too many connections, locking until next page"):setTimeout(()=>{this.handleConnect(e,!1)},this.currentConnectionAttempts**2*function(){try{return METROPLEX_CONSECUTIVE_CONNECTION_DELAY}catch(e){return 1e3}}())))},this.socket.onmessage=t=>{this._onSocketMessage(t,e)},this.socket.onopen=()=>{this.socketOpens.push(""+(Q()?"":(new Date).toISOString())),this._onSocketOpen()})}connectSocket(){return this.isConnected()||this.isConnecting()||(this.connectionPromise=new Promise(e=>{this.handleConnect(e,!1),j(window,"visibilitychange",()=>{if(K.getInstance().isClientDisabled)return;const t="visible"===document.visibilityState;t&&(this.forceClosed=!1,(this.isConnected()||this.isConnecting())&&(this.socket.onclose=()=>{},this.socket.close(1e3)),this.handleConnect(e,t))})})),this.connectionPromise}addEndTimeToPayload(e,t){const n=Math.ceil(X()-this.sessionStartTime);t&&(this.sessionLength=n);const r=new Date(this.sessionTimestamp.getTime()+n).toISOString();e.end_at=r}_onSocketOpen(){this.isConnected()&&!K.getInstance().isClientDisabled&&(this._sendSocketMessage(this.getPageInformation()),this.pageVisitInfoSent=!0,this.currentConnectionAttempts=0,this.previousMessageType="",this._sendUnconfirmedMessages(!1),this.setupRetryMechanism(),this.connectionCount+=1)}_onSocketMessage(e,t){switch(e.data){case"vid_block":this.metroplexTypeLock.v=!0,Y.getInstance().setDidCutVideo();break;case"pv_block":this.metroplexTypeLock.p=!0,Y.getInstance().setDidCutPv();break;case"full_block":K.getInstance().lockClient(1440,"Metroplex blocked script"),this.close();break;case"close_conn":this.close();break;case"ok":break;default:if(e.data.includes("seq_num")){const n=e.data.split("seq_num:");if(n.length<2){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Invalid message received from metroplex while clearing retry queue "+e.data,!1,"error");break}const r=parseInt(n[1],10);if(-1===r)break;r<=this.latestReceivedSeqNumber?this.isRetryLoopDisabled=!0:(this.isRetryLoopDisabled=!1,this.latestReceivedSeqNumber=r,this._clearRetryQueue(r)),!this.ackedOnce&&t&&(this.ackedOnce=!0,t())}}}_messagePayloadHasLargerSeqNum(e,t,n){return e.payload[t]&&e.payload[t].seq_num&&e.payload[t].seq_num>n}_clearRetryQueue(e){this.latestReceivedSeqNumStoredTime=new Date,this.retryMessageQueue=this.retryMessageQueue.filter(t=>this._messagePayloadHasLargerSeqNum(t,"pvp",e)||this._messagePayloadHasLargerSeqNum(t,"pvvf",e))}_sendUnconfirmedMessages(e){if(this.isConnected()&&!K.getInstance().isClientDisabled){if(e){const e=new Date;if(e.setMilliseconds(e.getMilliseconds()-this.metroRetryFrequencyMS),e<this.latestReceivedSeqNumStoredTime)return;if(this.isRetryLoopDisabled)return}this.retryMessageQueue=this.retryMessageQueue.filter(e=>!(e.type in this.metroplexTypeLock));for(let e=0;e<this.retryMessageQueue.length;e+=1){const{type:t,payload:n}=this.retryMessageQueue[e];if(!this._sendSocketMessage(n))break;this.previousMessageType=t}}}setupRetryMechanism(){this.retryMetroplexInterval=setInterval(()=>{this._sendUnconfirmedMessages(!0)},3e4)}_setupOffloadEvents(){j(window,"pagehide",()=>{this._handleUnload()})}_handleUnload(){this.close(),K.getInstance().isClientDisabled||K.getInstance().isInactive()||this.postFullPageVisit(59e3)}postFullPageVisit(e){if(0===this.retryMessageQueue.length)return;const t=[],n={v:0,p:0};let r=0,s={pvi:this.getPageInformation(),pvp:[],pvvf:[],pvh:[],vpnum:this.connectionCount};if(s.pvi.last=!0,this.retryMessageQueue.forEach(i=>{let{type:o,payload:a}=i;const c=new Blob([x(a)]).size;if(c>e)n[o]+=1;else{if(r+=c,r>=e){this.postMessage(s);let e="Vid: "+s.pvvf.length;e+=" PV: "+s.pvp.length,e+=` HTTP: ${s.pvh.length},`,t.push(e),s={pvi:this.getPageInformation(),pvp:[],pvvf:[],pvh:[],vpnum:s.vpnum},s.pvi.last=!0,r=c}switch(o){case"v":s.pvvf.push(a.pvvf);break;case"p":s.pvp.push(a.pvp);break;case"h":s.pvh.push(a.pvh)}}}),this.postMessage(s),this.retryMessageQueue.length>100){let e="Vid: "+s.pvvf.length;e+=" PV: "+s.pvp.length,e+=` HTTP: ${s.pvh.length},`,t.push(e);let r="POST Full PV complete";r+=", POSTs count: "+t.length,r+=", POSTs info: "+x(t),r+=", Retry message queue size: "+this.retryMessageQueue.length,n.v>0&&(r+=", Video parts dropped: "+n.v),n.p>0&&(r+=", Page visit parts dropped: "+n.p),n.h>0&&(r+=", HTTP data parts dropped: "+n.h),r+=", Sequence Info: Latest "+this.messageSequenceNum,r+=` Ack'd ${this.latestReceivedSeqNumStoredTime} ${this.latestReceivedSeqNumber}`;const i=K.getInstance().isClientDisabled;K.getInstance().isClientDisabled=!1,K.getInstance().postNoibuErrorAndOptionallyDisableClient(r,i,"warn")}}postMessage(e){const t=e;t.vpnum+=1,"test"===I()?navigator.sendBeacon(this.postURL,x(t)):window.fetch&&fetch(this.postURL,{method:"POST",headers:{"content-type":"application/json"},body:x(t),keepalive:!0})}_sendSocketMessage(e){return!this.closeIfInactive()&&(this.socket.send(x(e)),!0)}closeIfInactive(){const e=K.getInstance().isInactive();return e&&!K.getInstance().isClientDisabled&&(K.getInstance().lockClientUntilNextPage("Session is inactive, locking until next page"),this.close(),Y.getInstance().postMetrics("inactive"),this.postFullPageVisit(59e3)),e}getPageInformation(){const e={br_id:K.getInstance().browserId,pv_id:K.getInstance().pageVisitId,v:5,seq:K.getInstance().getPageVisitSeq(),on_url:this.initialURL,ref_url:this.initialReferingURL,start_at:this.sessionTimestamp.toISOString(),conc:this.connectionCount,cv:2,last:!1,script_id:h(),script_inst_id:this.scriptInstanceId,mp_sock_inst_id:this.instanceId,sock_inst_id:this.socketInstanceId},t=function(){const e=window.navigator.userLanguage||window.navigator.language;return""!==e&&e?e.toLowerCase():null}();return t&&(e.lang=t),e}}class te{constructor(){this.partCounter=0,this.pvMap={},this.partCounter=0,this.pvEventLength=0,this.visibilityChangedCounter=0,this.totalPvEventLength=0,this.inDebounceHandle=0,this.isInAcceleratedPvPostMode=!1}static configureInstance(){this.instance||(this.instance=new te)}static getInstance(){if(!this.instance)throw new Error("Pagevisit was never configured");return this.instance}addPageVisitEvents(e,t){e.forEach(e=>{this._addPageVisitEvent(e,t)}),this._sendPageVisitMessage()}addPageVisitEvent(e,t){const n=this._addPageVisitEvent(e,t);return this._sendPageVisitMessage(),n}_addPageVisitEvent(e,t){if(!("occurredAt"in e)||!("event"in e))throw new Error("missing attributes in the eventObj");const n={type:t,occ_at:e.occurredAt,[t]:e.event};this.pvEventLength>=200&&this._sendPageVisitMessage();const r=v()();return this.pvMap[r]=n,this.pvEventLength+=1,this.totalPvEventLength+=1,r}static makePageVisitFrag(e,t){const n={};return n.events=e,n.pc=t,ee.getInstance().addEndTimeToPayload(n,!0),n}_sendPageVisitMessage(){const e=Object.keys(this.pvMap).map(e=>this.pvMap[e]);if(0===e.length)return;if(this.partCounter>=1e4)return void K.getInstance().lockClientUntilNextPage(`NoibuJS will stop processing parts because we reached max parts: 10000. Variables: \n      total Pv Event Length: ${this.totalPvEventLength}\n      visibility Changed Counter: ${this.visibilityChangedCounter}\n      `);const t=te.makePageVisitFrag(e,this.partCounter);Y.getInstance().setPvPart(this.partCounter);const n={pvp:t};ee.getInstance().sendMessage("p",n),this.pvMap={},this.pvEventLength=0,this.partCounter+=1}}class ne{constructor(){this.eventsToDebounce={},this.registerInputType("loc",0),this.registerInputType("page",500),this.registerInputType("err",500),this.registerInputType("http",500),this.registerInputType("kbd",500,"userstep"),this._setupUnloadHandler()}static getInstance(){return this.instance||(this.instance=new ne),this.instance}registerInputType(e,t,n=e){e in this.eventsToDebounce||(this.eventsToDebounce[e]={timeout:null,events:[],debouncePeriod:t,eventName:n})}addEvent(e,t){if(!(t in this.eventsToDebounce))throw new Error(`Type: ${t} is not in eventsToDebounce`);this.eventsToDebounce[t].events.push({event:e,occurredAt:new Date($(Date.now())).toISOString()}),this._debouncePvEvents(t)}_debouncePvEvents(e){clearTimeout(this.eventsToDebounce[e].timeout),this.eventsToDebounce[e].timeout=setTimeout(()=>{this.eventsToDebounce[e].timeout=null,te.getInstance().addPageVisitEvents(this.eventsToDebounce[e].events,this.eventsToDebounce[e].eventName),this.eventsToDebounce[e].events=[]},this.eventsToDebounce[e].debouncePeriod)}_setupUnloadHandler(){j(window,"pagehide",()=>{Object.values(this.eventsToDebounce).forEach(e=>{te.getInstance().addPageVisitEvents(e.events,e.eventName)})})}}function re(e){return{url:W(e.filename),type:"js",j_err:L(e.error)}}function se(e,t,n){let r=t;t.error&&t.error.originalError&&(r=t.error.originalError);let s={};switch(e){case"XMLHttpRequest":s=function(e,t){const n={url:W(e.responseURL),type:"http",h_code:e.status};return(t||0===t)&&(n.seq=t),n}(r,n);break;case"ErrorEvent":s=re(r);break;case"Response":s=function(e,t){const n={url:W(e.url),type:"http",h_code:e.status};return(t||0===t)&&(n.seq=t),n}(r,n);break;case"WrappedException":case"FetchException":s=re(r);break;case"ErrorLogEvent":s=function(e){return{url:W(window.location.href),type:"js",j_err:L(e)}}(r);break;case"UnhandledRejectionError":case"CustomError":s=re(r);break;default:try{s=re(r),r instanceof Event&&(!function(e,t,n){let r=null;if(n.detail)try{r=x(n.detail)}catch(e){r="non-serializable"}let s=`Fire error event of type ${e}.`;null!=r&&(s+=` Detail: ${r}.`),t.j_err.msg=D(s)}(e,s,r),e="ErrorEvent")}catch(e){return null}}return s.err_src=e,s}function ie(e,t,n){if("Event"===e)return;const r=se(e,t,n);if(!r||!r.url)return;const s=r.url;if(function(e){try{return URL(e),!0}catch(e){return!1}}(s)){const e=new URL(s);if(e.hostname in q||!e.protocol.startsWith("http"))return}(function(e){if("js"===e.type){if(e.j_err){const t=e.j_err.frames;if(t&&t.length>0){const n=t[0].file.toLowerCase(),r=t[0].mname.toLowerCase();if(n.includes("noibu")&&!r.includes("nbuwrapper"))return K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error"),!0}}if(e.msg){const t=e.msg.toLowerCase();if(t.includes("input.noibu")||t.includes("input.b.noibu"))return K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error"),!0}}else if("http"===e.type&&e.url){const t=e.url;if("string"==typeof t)for(let n=0;n<a.length;n+=1){const r=a[n];if(t.includes(r))return K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error"),!0}}return!1})(r)||(Y.getInstance().addError(),ne.getInstance().addEvent(r,"err"))}let oe=0;function ae(e){if("function"!=typeof e)return e;try{if(e.__noibu__)return e;if(e.__noibu_wrapped__)return e.__noibu_wrapped__}catch(t){return e}const nbuWrapper=function(...t){try{const n=Array.prototype.slice.call(t).map(e=>ae(e));return e.handleEvent?e.handleEvent.apply(this,n):e.apply(this,n)}catch(e){throw ie("WrappedException",{error:e}),oe+=1,setTimeout(()=>{oe-=1}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(nbuWrapper[t]=e[t])}catch(e){}nbuWrapper.prototype=e.prototype||{},Object.defineProperty(e,"__noibu_wrapped__",{enumerable:!1,value:nbuWrapper}),Object.defineProperties(nbuWrapper,{__noibu__:{enumerable:!1,value:!0},__noibu_original__:{enumerable:!1,value:e}});try{Object.getOwnPropertyDescriptor(nbuWrapper,"name").configurable&&Object.defineProperty(nbuWrapper,"name",{get:()=>e.name})}catch(t){return e}return nbuWrapper}function ce(e){if(!e)return;const{message:t,stack:n}=e;n&&t&&ie("ErrorLogEvent",{message:t,stack:n})}function le(e){e.forEach(e=>{e&&(Array.isArray(e)?e.forEach(e=>{ce(e)}):ce(e))})}function ue(e){e&&e.constructor&&e.constructor.name&&"undefined"!==e.constructor.name&&!(oe>0)&&ie(e.constructor.name,e)}function de(e){if(!e.reason)return;if(!e.reason.message||!e.reason.stack)return;const t=new Error;t.message=e.reason.message,t.stack=e.reason.stack;ie("UnhandledRejectionError",{error:t})}function he(){j(window,"error",ue,!0),j(window,"unhandledrejection",de,!0),i.forEach(e=>{const t=window[e],n=t&&t.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(b(n,"addEventListener",(function(e){return function nbuWrapper(t,n,r){if(!n)return e.call(this,t,n,r);let s;if(n.handleEvent){const e=ae(n.handleEvent.bind(n));s=n,s.handleEvent=e}else s=ae(n);return e.call(this,t,s,r)}})),b(n,"removeEventListener",(function(e){return function nbuWrapper(t,n,r){let s=n;try{s=s&&(s.__noibu_wrapped__||s)}catch(e){}return e.call(this,t,s,r)}})))}),c.forEach(e=>{window.console&&window.console[e]&&b(window.console,e,(function(e){return function nbuWrapper(){e.call(window.console,...arguments),le(Array.from(arguments))}}))})}class pe{constructor(e,t){const n=e;(!n.resp_time||n.resp_time<0)&&(n.resp_time=0),n.mtd=e.mtd.toUpperCase(),n.url=D(G(n.url)),this.httpEvent=n,this.httpData=t}saveHTTPEvent(){if(this.httpEvent&&this.httpEvent.url&&""!==this.httpEvent.url.trim()){if(Y.getInstance().addHttpEvent(),this.httpData){const e=Y.getInstance().httpSequenceNumber;if(e<100){this.httpData.seq=e,this.httpEvent.seq=e,Y.getInstance().addHttpData();const t={};t.pvh=this.httpData,ee.getInstance().sendMessage("h",t)}else Y.getInstance().addHttpDataOverLimit()}ne.getInstance().addEvent(this.httpEvent,"http")}}}class ge{constructor(){this.contentTypeReadableRegex=new RegExp("text|json|xml|html|graphql|x-www-form-urlencoded|form-data","i");const e=O();if(this.initialURLPartsReversed=[],e&&e.length>0)try{const t=new URL(e).hostname;this.initialURLPartsReversed=t.split("."),s.test(this.initialURLPartsReversed[0])&&this.initialURLPartsReversed.shift(),this.initialURLPartsReversed.reverse()}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to determine hostname for initial URL: "+e,!1,"warn")}this.httpDataCollectionEnabled=!!o().http_data_collection,this.httpPayloadCollectionEnabled=!!o().http_payload_collection}static getInstance(){return this.instance||(this.instance=new ge),this.instance}static headersMapFromIterable(e){const t=new Map;for(const n of e)"string"!=typeof n[0]&&(n[0]=String(n[0])),"string"!=typeof n[1]&&(n[1]=String(n[1])),t.set(n[0].toLowerCase(),n[1]);return t}static headersMapFromString(e){const t=new Map;if(!e||"string"!=typeof e)return t;return e.split("\r\n").filter(Boolean).forEach((function(e){const n=e.split(": ");2===n.length&&n[0].length>0&&n[1].length>0&&t.set(n[0].toLowerCase(),n[1])})),t}static responseStringFromXHRResponseType(e){if(null==e)return null;if(e.response&&null===e.response)return"null";if(""===e.responseType||"text"===e.responseType)return e.responseText;if("document"===e.responseType&&e.response&&e.response.documentElement&&e.response.documentElement.innerHTML)return e.response.documentElement.innerHTML;if("json"===e.responseType)try{return JSON.stringify(e.response)}catch(e){return K.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to stringify JSON response: "+e,!1,"warn"),null}return null}isURLSameDomain(e){if("string"!=typeof e||!this.initialURLPartsReversed||this.initialURLPartsReversed.length<1)return!1;let t;try{t=new URL(e).hostname}catch(e){return K.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to determine hostname for request URL: "+e,!1,"warn"),!1}const n=t.split(".");return!(n.length<1)&&(s.test(n[0])&&n.shift(),!(n.length<this.initialURLPartsReversed.length)&&(n.reverse(),this.initialURLPartsReversed.every((e,t)=>e===n[t])))}bundleHTTPData(e,t,n,r,s,i,o){if(!this.isValidRequest(e,i,o))return null;let a="";this.httpPayloadCollectionEnabled&&(a=this.dropPayloadIfNecessaryFromHeaders(t)||this.stringFromRequestBody(n));const c=t||new Map,l=a||"",u=r||new Map,d=s||"";if(0===c.size&&0===l.length&&0===u.size&&0===d.length)return null;const h=this.restrictPayload(a),p=this.restrictPayload(s),g=this.removePIIHeaders(t),m=this.removePIIHeaders(r);return{rqh:g?w(g):{},rqp:h,rsh:m?w(m):{},rsp:p}}isValidRequest(e,t,n){return!!this.httpDataCollectionEnabled&&(!(!t||"string"!=typeof t)&&!!n)}shouldContinueForURL(e){return!!this.httpDataCollectionEnabled&&(!(!e||"string"!=typeof e||!this.initialURLPartsReversed)&&!((e.indexOf("://")>0||0===e.indexOf("//"))&&!this.isURLSameDomain(e)))}restrictPayload(e){return e&&this.httpPayloadCollectionEnabled?"null"===e||e.startsWith("Dropped due to length.")||e.startsWith("Dropped due to unsupported type.")?e:e.length>5e4?(Y.getInstance().addHttpDataDropByLength(),"Dropped due to length. Payload length: "+e.length):(Y.getInstance().addHttpDataPayloadCount(),this.removePIIBody(e)):"null"}contentLengthAcceptable(e){const t=this.contentLength(e);return t<0||(!(t>5e4)||(Y.getInstance().addHttpDataDropByLength(),!1))}contentTypeAcceptable(e){if(!e||!e.get)return!0;const t=e.get("content-type");return!(t&&!this.contentTypeReadableRegex.test(t.toLowerCase()))||(Y.getInstance().addHttpDataDropByType(),!1)}dropPayloadIfNecessaryFromHeaders(e){let t="";return ge.getInstance().contentTypeAcceptable(e)?ge.getInstance().contentLengthAcceptable(e)||(t="Dropped due to length. Payload length: "+ge.getInstance().contentLength(e)):(t="Dropped due to unsupported type.",e&&e.get&&(t+=" Payload type: "+e.get("content-type"))),t}contentLength(e){if(!e||!e.get)return 0;let t=0;const n=e.get("content-length");if(!n)return-1;try{if(t=parseInt(n,10),Number.isNaN(t))return-1}catch(e){return-1}return t}stringFromRequestBody(e){if(null==e)return null;try{const t=e.toString();if(!t.includes("[object"))return t}catch(e){}try{return e.documentElement.innerHTML}catch(e){}try{return e instanceof FormData&&(e=Array.from(e.entries()).reduce((e,[t,n])=>(e[t]="string"==typeof n?n:"non-string value.",e),{})),JSON.stringify(e)}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to stringify request body: "+e,!1,"warn")}return null}removePIIHeaders(e){if(!(e instanceof Map))return null;if(e.size<1)return e;const n=new Map(e);return n.forEach((e,n,r)=>{t.includes(n.toLowerCase())?r.set(n,"******"):r.set(n,this.removePIIBody(e))}),n}removePIIBody(e){if("string"!=typeof e)return null;if(e.length<1)return e;let t=e;return r.forEach(e=>{t=t.replace(e,"******")}),t}}function me(e){return"number"!=typeof e||(e>=400||e<=0)}function fe(e,t,n,r,s=null){const i={mtd:t,code:e.status,url:n,r_time:r};let o=null;const a=me(e.status);if(a&&ge.getInstance().shouldContinueForURL(n)){const r=ge.headersMapFromString(e.getAllResponseHeaders()),c=ge.getInstance().contentLength(r);c>0&&(i.resp_len=c);let l="";if(ge.getInstance().httpPayloadCollectionEnabled){l=ge.getInstance().dropPayloadIfNecessaryFromHeaders(r)||ge.responseStringFromXHRResponseType(e)}o=ge.getInstance().bundleHTTPData(n,e.noibuRequestHeaders,s,r,l,t,a)}return[i,o]}async function Ie(e,t,n,r,s,i,o){const a={mtd:n,code:t.status,url:r,r_time:i};let c=null;if(me(t.status)&&ge.getInstance().shouldContinueForURL(r)){if(t&&t.headers){const e=ge.getInstance().contentLength(t.headers);e>0&&(a.resp_len=e)}let i="";if(ge.getInstance().httpPayloadCollectionEnabled&&t&&t instanceof Response){i=ge.getInstance().dropPayloadIfNecessaryFromHeaders(t.headers)||t.clone().text()}const l=[Promise.resolve(i),...o?[o]:[]];await Promise.all(l).then(i=>function(e,t,n,r,s,i){let o,a=new Map,c=new Map;return r[1]&&([,o]=r,e.headers&&(a=ge.headersMapFromIterable(e.headers.entries()))),null==o&&n&&n.body&&(o=n.body),a.size<1&&n&&n.headers&&(a=n.headers instanceof Headers?ge.headersMapFromIterable(n.headers.entries()):ge.headersMapFromIterable(Object.entries(n.headers))),t&&t.headers&&(c=ge.headersMapFromIterable(t.headers.entries())),ge.getInstance().bundleHTTPData(s,a,o,c,r[0],i,me(t.status))}(e,t,s,i,r,n)).then(e=>{c=e})}return[a,c]}function ye(){const e=window;S(e,"fetch")&&b(e,"fetch",(function(e){return function nbuWrapper(t,n){let r,s,i,o;try{t?(ge.getInstance().httpPayloadCollectionEnabled&&t instanceof Request&&(i=t.clone(),o=i.text()),t.method?(r=t.method,s=t.url):(r=n&&n.method?n.method:"GET",s=t.toString()?t.toString():"")):K.getInstance().postNoibuErrorAndOptionallyDisableClient(`fetch() called with undefined or missing resource parameter. Parameters passed: ${t}, ${n}`,!1,"warn")}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in fetch() wrapper: "+e,!1,"error")}const a=e.call(this,t,n),c=new Date;return a.then(async e=>{try{const t=new Date,a=Math.abs(t-c),[l,u]=await Ie(i,e,r,s,n,a,o);let d=new pe(l,u);d.saveHTTPEvent(),me(e.status)&&ie("Response",e,d.httpData&&d.httpData.seq),d=null}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in custom fetch() callback: "+e,!1,"error")}}).catch(e=>{!function(e,t){if(!e)return;if(!e.message||!e.stack)return;const n=t||"",r=new Error;r.stack=e.stack;const s=""===n.trim()?"":" on url "+n;r.message=`${e.message}${s}`,ie("FetchException",{error:r})}(e,s)}),a}}))}function Ce(){const e=window.XMLHttpRequest,t=e&&e.prototype,n=S(t,"open"),r=S(t,"send"),s=S(t,"setRequestHeader");n&&function(e,t){b(e,"open",(function(e){return function nbuWrapper(n,r,s=!0,i=null,o=null){try{try{this.noibuHttpMethod=n,this.noibuHttpUrl=r}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to set custom properties on XHR object: "+e,!1,"warn")}if(t){const e=new Date;j(this,"loadend",()=>{const t=new Date,s=Math.abs(t-e),[i,o]=fe(this,n,r,s);let a=new pe(i,o);a.saveHTTPEvent(),me(this.status)&&ie("XMLHttpRequest",this,a.httpData&&a.httpData.seq),a=null})}}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in XHR.open() wrapper: "+e,!1,"error")}return e.call(this,n,r,s,i,o)}}))}(t,!r),r&&function(e){b(e,"send",(function(e){return function nbuWrapper(t){try{let e;e=this.noibuHttpMethod?this.noibuHttpMethod:t?"POST":"GET";const n=new Date;j(this,"loadend",()=>{const r=new Date,s=Math.abs(r-n),i=this.noibuHttpUrl||this.responseURL,[o,a]=fe(this,e,i,s,t);let c=new pe(o,a);c.saveHTTPEvent(),me(this.status)&&ie("XMLHttpRequest",this,c.httpData&&c.httpData.seq),c=null})}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in XHR.send() wrapper: "+e,!1,"error")}return e.call(this,t)}}))}(t),s&&function(e){b(e,"setRequestHeader",(function(e){return function nbuWrapper(t,n){try{this.noibuRequestHeaders&&this.noibuRequestHeaders instanceof Map||(this.noibuRequestHeaders=new Map);const e="string"==typeof n?n:String(n);this.noibuRequestHeaders.set(t.toLowerCase(),e)}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in XHR.setRequestHeader() wrapper: "+e,!1,"error")}return e.call(this,t,n)}}))}(t)}function ve(e){const t=e;return t.class=G(t.class),t}const be=["\\b(view|add|my)\\b.*\\b(cart|bag|basket|bucket|box)\\b","\\b(buy now)\\b","^backorder$","\\b(acquista ora)\\b","\\b(buy this)\\b","\\b(ajouter|mon)\\b.*\\b(panier)\\b","\\b(aggiungi)\\b.*\\b(cart|borsa|carrello)\\b","^ajouter à la shopping bag$","^aggiungi$","^aggiungi alla shopping bag$","\\b(warenkorb)\\b","(^kaufen$)","^купить$","\\b(agregar)\\b.*\\b(carrito)\\b","\\b(adicionar)\\b.*\\b(carrinho)\\b","^carrinho$","^añadir al carrito de compras$","(^añadir al carrito$)","(add another)","(in winkelmand)","(sepete ekle)","(Lagg I Varukorgen)","(ΠΡΟΣΘΗΚΗ ΣΤΟ ΚΑΛΑΘΙ)","(Lägg i varukorgen)","(Köp)","(カートに追加)","^添加至购物袋$","^购买$","^購入する$","(أضف الى السلة)"],Se=["(paypal)","(checkout|payment|check out)","(l.?achat|règlement|paiement|la commande)","(passer).*(commande)","valider mon panier","(acheter maintenant)","^caisse$","(gå vidare till kassan)","(cassa|acquisto)","^vai alla cassa$","^procedi all.?acquisto$","^procedi al checkout$","^siguiente$","(kasse)","^zur kasse gehen$","^bezahlen$","^weiter zum checkout$","(comprar ahora)","^comprar$","(prosseguir com a compra)","^pasar por la caja$","^afrekenen$","^compre$","(continue to pay)","(naar de kassa)","Перейти к оформлению заказа","^купить сейчас$","^bestellen$","(Alışverişi Tamamla)","^Till kassan$","(チェックアウトに進む)","^去结算$","^付款。$","^お支払い$","(تاكيد الطلب)"],we=["(checkout|continue) (with paypal)","^continue to paypal$","^weiter zu paypal$","^continue to afterpay$","^braintree_paypal$","^pay and place order$","^mit paypal bezahlen$","^continue to payment securely$","(continua su paypal)","(apple pay|applepay)","(amazon pay|amazonpay|continue with amazon)","(sezzlepay)","(place order)","(place your order)","(order confirmation)","(complete purchase)","submit.*order","(pay now)","(^pay it now$)","(make payment)","(^make payment$)","(complete order)","^complete your order$","(fazer pedido)","^encomendar$","((realizar) (pedido|pago))","^finalizar compra$","^pagar$","^jetzt kaufen$","^bestellung aufgeben$","^bestellung prüfen$","^auftragsbestätigung$","^bestelling plaatsen$","^passer la commande$","(je confirme et je paye)","(accéder au paiement)","^passer au paiement$","(Valider et continuer)","^valider la commande$","(^passez la commande$)","^invia ordine$","(effettua ordine)","^effettua l.?ordine$","(conferma acquisto)","^conferma l.?acquisto$","^confirmation de commande$","^confirma l.?ordine$","^conferma l.?ordine$","^conferma ordine$","(SİPARİŞİ TAMAMLA)","^Разместить заказ$","(Slutför köp)","(注文する)","(إنشاء الطلب)","(注文を確定)","^お支払いへ進む$","^确认下单$"];class Ae{constructor(){this.textCapturedWhiteListRegex=new RegExp(be.concat(Se).concat(we).join("|"),"i"),this.htmlIDWhiteListRegex=new RegExp("method|finance|sagepay|cart|bag|coupon|affirm|karna|sezzle|button","i")}static getInstance(){return this.instance||(this.instance=new Ae),this.instance}monitorClicks(){j(window,"click",this._onClickHandle.bind(this),!0)}_onClickHandle(e){const t=function(){const e=o(),t=["noibu-blocked"];return V()&&e.sel.forEach(e=>{e.startsWith(".")&&e.length>0&&t.push(e.substring(1))}),t}();if(e.srcElement){const n=e.srcElement;let r="";r="IMG"===n.tagName?n.alt?n.alt:"":this._getTextualContentFromEl(n,!0,t);let s=this._trimText(r),i="";if(n.className){const e=typeof n.className;"string"===e?i=n.className:"object"===e&&"baseVal"in n.className&&(i=n.className.baseVal)}let o="";n.tagName&&(o=n.tagName.toLowerCase());let a=n.id?n.id:"";"string"!=typeof a&&(a=""),this.textCapturedWhiteListRegex.test(s)||this.htmlIDWhiteListRegex.test(a)||("input"===o?(!n.type||"button"!==n.type&&"submit"!==n.type)&&(s="*"):"textarea"===o&&(s="*")),s=function(e){return e.replace(/[0-9]/g,"*")}(s);const c={src:n.src?n.src:"",txt:s,tag:o,hid:a,type:"click",class:i};Y.getInstance().addPvClick(),te.getInstance().addPageVisitEvents([{event:ve(c),occurredAt:new Date($(Date.now())).toISOString()}],"userstep")}}_parseTextFromParentElement(e,t){let n=e;const r=[];let s=0;for(;n&&!(s>=5)&&n.parentNode;)n=n.parentNode,r.push(n),s+=1;for(let e=0;e<r.length;e+=1){const n=r[e];if(n&&"BUTTON"===n.tagName)return this._getTextualContentFromEl(n,!1,t)}return""}_getTextualContentFromEl(e,t,n){let r=this._parseInnerContent(e,"",100,{value:0,limit:100},n);if(t){const t=e.tagName?e.tagName.toLowerCase():"";if(""===r)r=this._parseTextFromParentElement(e,n);else if("select"===t){const t=r;r=this._parseTextFromParentElement(e,n),r=r.replace(t,"")}}return r}_trimText(e){let t=e.trim().replace(/\s+/g," ");if(t.length>100){const e=t.lastIndexOf(" ",97);t=e>0?t.substring(0,e)+"...":"..."}return t}_parseInnerContent(e,t,n,r,s){if(t.length>=n)return t;if(r.value>=r.limit)return t;if(r.value+=1,e.classList)for(const n of e.classList)if(s.includes(n))return t+(t?" ":"")+"*";if(e.nodeType===Node.TEXT_NODE&&(t=this._parseAndAppendText(t,[e.textContent])).length>=n)return t;let i=!0;if(e.nodeType===Node.ELEMENT_NODE){if(0===e.childNodes.length&&(t=this._parseAndAppendText(t,[e.value,e.title])).length>=n)return t;if(1===e.childNodes.length&&e.childNodes[0].nodeType===Node.TEXT_NODE&&(i=!1,(t=this._parseAndAppendText(t,[e.textContent,e.value,e.title])).length>=n))return t}if(i)for(const i of e.childNodes)t=this._parseInnerContent(i,t,n,r,s);return t}_parseAndAppendText(e,t){for(let n of t)if(n=(n||"").trim().replace(/\s+/g," "),n.length>0)return e+(e?" ":"")+n;return e}}class ke{monitor(){j(window,"input",this._handle)}_handle(e){const{target:t}=e;if("INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName)return;const n=t.placeholder||t.name||t.id;n&&ne.getInstance().addEvent(ve({src:"",txt:n,tag:t.tagName.toLowerCase(),hid:t.id,type:"kbd",class:t.className}),"kbd")}}let Ee=window.location.href;class Re{static getInstance(){return this.instance||(this.instance=new Re),this.instance}monitor(){l.forEach(e=>{j(window,e,this._onPageEventHandle.bind(this),!0)}),u.forEach(e=>{j(document,e,this._onPageEventHandle.bind(this),!0)})}_onPageEventHandle(e){if(!e||!e.type)return;const t={type:e.type};switch(e.type){case"visibilitychange":t.data="state: "+this.getDocumentState();break;case"readystatechange":t.data="state: "+document.readyState;break;case"pagehide":case"pageshow":case"load":e.persisted&&(t.data="persisted: "+e.persisted);break;case"storage":e.key&&(t.data="key: "+e.key);break;case"message":case"messageerror":e.data&&e.origin&&(t.data=`origin: ${e.origin} size: ${this.getSizeInBytes(e.data)}`);break;case"hashchange":e.newURL&&(t.data="newURL: "+e.newURL)}ne.getInstance().addEvent(t,"page")}getDocumentState(){return"hidden"===document.visibilityState?"hidden":document.hasFocus()?"active":"passive"}getSizeInBytes(e){let t=e;return"string"!=typeof e&&(t=JSON.stringify(e)),2*t.length}}var Te;function _e(e){return e.nodeType===e.ELEMENT_NODE}function Me(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function Ne(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function De(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(Oe).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function Oe(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=De(e.styleSheet)||t}catch(e){}return t}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Te||(Te={}));var Le=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function xe(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,s=e.value,i=e.maskInputFn,o=s||"";return(t[n.toLowerCase()]||t[r])&&(o=i?i(o):"*".repeat(o.length)),o}var Pe,Ve,Fe=1,Ue=new RegExp("[^a-z0-9-_:]");function Be(){return Fe++}var Ge=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,We=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,qe=/^(data:)([^,]*),(.*)/i;function He(e,t){return(e||"").replace(Ge,(function(e,n,r,s,i,o){var a,c=r||i||o,l=n||s||"";if(!c)return e;if(!We.test(c))return"url(".concat(l).concat(c).concat(l,")");if(qe.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var h=0,p=d;h<p.length;h++){var g=p[h];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var Ze=/^[^ \t\n\r\u000c]+/,ze=/^[, \t\n\r\u000c]+/;function Ke(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function je(){var e=document.createElement("a");return e.href="",e.href}function Ye(e,t,n,r){return"src"===n||"href"===n&&r&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&r&&"#"!==r[0]?Ke(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,s=e.exec(t.substring(n));return s?(r=s[0],n+=r.length,r):""}for(var s=[];r(ze),!(n>=t.length);){var i=r(Ze);if(","===i.slice(-1))i=Ke(e,i.substring(0,i.length-1)),s.push(i);else{var o="";i=Ke(e,i);for(var a=!1;;){var c=t.charAt(n);if(""===c){s.push((i+o).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,s.push((i+o).trim());break}"("===c&&(a=!0)}o+=c,n+=1}}}return s.join(", ")}(e,r):"style"===n&&r?He(r,je()):"object"===t&&"data"===n&&r?Ke(e,r):r:Ke(e,r)}function Je(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Je(e.parentNode,t,n);for(var r=e.classList.length;r--;){var s=e.classList[r];if(t.test(s))return!0}return!!n&&Je(e.parentNode,t,n)}function Qe(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(Je(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}return!1}function $e(e,t){var n=t.doc,r=t.mirror,s=t.blockClass,i=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,d=t.maskTextFn,h=t.maskInputFn,p=t.dataURLOptions,g=void 0===p?{}:p,m=t.inlineImages,f=t.recordCanvas,I=t.keepIframeSrcFn,y=t.newlyAddedElement,C=void 0!==y&&y,v=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Te.Document,childNodes:[],compatMode:e.compatMode}:{type:Te.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Te.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,s=t.blockSelector,i=t.inlineStylesheet,o=t.maskInputOptions,a=void 0===o?{}:o,c=t.maskInputFn,l=t.dataURLOptions,u=void 0===l?{}:l,d=t.inlineImages,h=t.recordCanvas,p=t.keepIframeSrcFn,g=t.newlyAddedElement,m=void 0!==g&&g,f=t.rootId,I=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var s=e.classList[r];if(t.test(s))return!0}return!!n&&e.matches(n)}(e,r,s),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return Ue.test(t)?"div":t}(e),C={},v=e.attributes.length,b=0;b<v;b++){var S=e.attributes[b];C[S.name]=Ye(n,y,S.name,S.value)}if("link"===y&&i){var w=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),A=null;w&&(A=De(w)),A&&(delete C.rel,delete C.href,C._cssText=He(A,w.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(A=De(e.sheet))&&(C._cssText=He(A,je()))}if("input"===y||"textarea"===y||"select"===y){var k=e.value,E=e.checked;"radio"!==C.type&&"checkbox"!==C.type&&"submit"!==C.type&&"button"!==C.type&&k?C.value=xe({type:C.type,tagName:y,value:k,maskInputOptions:a,maskInputFn:c}):E&&(C.checked=E)}"option"===y&&(e.selected&&!a.select?C.selected=!0:delete C.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var s=t.getImageData,i="__rrweb_original__"in s?s.__rrweb_original__:s;if(new Uint32Array(i.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(C.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var R=e.toDataURL(u.type,u.quality),T=document.createElement("canvas");T.width=e.width,T.height=e.height;var _=T.toDataURL(u.type,u.quality);R!==_&&(C.rr_dataURL=R)}if("img"===y&&d){Pe||(Pe=n.createElement("canvas"),Ve=Pe.getContext("2d"));var M=e,N=M.crossOrigin;M.crossOrigin="anonymous";var D=function(){try{Pe.width=M.naturalWidth,Pe.height=M.naturalHeight,Ve.drawImage(M,0,0),C.rr_dataURL=Pe.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(M.currentSrc,"! Error: ").concat(e))}N?C.crossOrigin=N:M.removeAttribute("crossorigin")};M.complete&&0!==M.naturalWidth?D():M.onload=D}"audio"!==y&&"video"!==y||(C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(C.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(C.rr_scrollTop=e.scrollTop));if(I){var O=e.getBoundingClientRect(),L=O.width,x=O.height;C={class:C.class,rr_width:"".concat(L,"px"),rr_height:"".concat(x,"px")}}"iframe"!==y||p(C.src)||(e.contentDocument||(C.rr_src=C.src),delete C.src);return{type:Te.Element,tagName:y,attributes:C,childNodes:[],isSVG:(P=e,Boolean("svg"===P.tagName||P.ownerSVGElement)||void 0),needBlock:I,rootId:f};var P}(e,{doc:n,blockClass:s,blockSelector:i,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:g,inlineImages:m,recordCanvas:f,keepIframeSrcFn:I,newlyAddedElement:C,rootId:v});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,s=t.maskTextSelector,i=t.maskTextFn,o=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(l&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(d=e.parentNode.sheet,c=d.cssRules?Array.from(d.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=He(c,je())}var d;u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&Qe(e,r,s)&&(c=i?i(c):c.replace(/[\S]/g,"*"));return{type:Te.Text,textContent:c||"",isStyle:l,rootId:o}}(e,{maskTextClass:o,maskTextSelector:a,maskTextFn:d,rootId:v});case e.CDATA_SECTION_NODE:return{type:Te.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:Te.Comment,textContent:e.textContent||"",rootId:v};default:return!1}}function Xe(e){return void 0===e?"":e.toLowerCase()}function et(e,t){var n,r=t.doc,s=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,h=void 0===d||d,p=t.maskInputOptions,g=void 0===p?{}:p,m=t.maskTextFn,f=t.maskInputFn,I=t.slimDOMOptions,y=t.dataURLOptions,C=void 0===y?{}:y,v=t.inlineImages,b=void 0!==v&&v,S=t.recordCanvas,w=void 0!==S&&S,A=t.onSerialize,k=t.onIframeLoad,E=t.iframeLoadTimeout,R=void 0===E?5e3:E,T=t.onStylesheetLoad,_=t.stylesheetLoadTimeout,M=void 0===_?5e3:_,N=t.keepIframeSrcFn,D=void 0===N?function(){return!1}:N,O=t.newlyAddedElement,L=void 0!==O&&O,x=t.preserveWhiteSpace,P=void 0===x||x,V=$e(e,{doc:r,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,dataURLOptions:C,inlineImages:b,recordCanvas:w,keepIframeSrcFn:D,newlyAddedElement:L});if(!V)return console.warn(e,"not serialized"),null;n=s.hasNode(e)?s.getId(e):!function(e,t){if(t.comment&&e.type===Te.Comment)return!0;if(e.type===Te.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Xe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Xe(e.attributes.name)||"icon"===Xe(e.attributes.rel)||"apple-touch-icon"===Xe(e.attributes.rel)||"shortcut icon"===Xe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Xe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Xe(e.attributes.property).match(/^(og|twitter|fb):/)||Xe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Xe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Xe(e.attributes.name)||"googlebot"===Xe(e.attributes.name)||"bingbot"===Xe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Xe(e.attributes.name)||"generator"===Xe(e.attributes.name)||"framework"===Xe(e.attributes.name)||"publisher"===Xe(e.attributes.name)||"progid"===Xe(e.attributes.name)||Xe(e.attributes.property).match(/^article:/)||Xe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Xe(e.attributes.name)||"yandex-verification"===Xe(e.attributes.name)||"csrf-token"===Xe(e.attributes.name)||"p:domain_verify"===Xe(e.attributes.name)||"verify-v1"===Xe(e.attributes.name)||"verification"===Xe(e.attributes.name)||"shopify-checkout-api-token"===Xe(e.attributes.name)))return!0}}return!1}(V,I)&&(P||V.type!==Te.Text||V.isStyle||V.textContent.replace(/^\s+|\s+$/gm,"").length)?Be():-2;var F=Object.assign(V,{id:n});if(s.add(e,F),-2===n)return null;A&&A(e);var U=!u;if(F.type===Te.Element){U=U&&!F.needBlock,delete F.needBlock;var B=e.shadowRoot;B&&Ne(B)&&(F.isShadowHost=!0)}if((F.type===Te.Document||F.type===Te.Element)&&U){I.headWhitespace&&F.type===Te.Element&&"head"===F.tagName&&(P=!1);for(var G={doc:r,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,slimDOMOptions:I,dataURLOptions:C,inlineImages:b,recordCanvas:w,preserveWhiteSpace:P,onSerialize:A,onIframeLoad:k,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:M,keepIframeSrcFn:D},W=0,q=Array.from(e.childNodes);W<q.length;W++){(z=et(q[W],G))&&F.childNodes.push(z)}if(_e(e)&&e.shadowRoot)for(var H=0,Z=Array.from(e.shadowRoot.childNodes);H<Z.length;H++){var z;(z=et(Z[H],G))&&(Ne(e.shadowRoot)&&(z.isShadow=!0),F.childNodes.push(z))}}return e.parentNode&&Me(e.parentNode)&&Ne(e.parentNode)&&(F.isShadow=!0),F.type===Te.Element&&"iframe"===F.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var s,i=!1;try{s=r.document.readyState}catch(e){return}if("complete"===s){if("about:blank"!==r.location.href||"about:blank"===e.src||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var o=setTimeout((function(){i||(t(),i=!0)}),n);e.addEventListener("load",(function(){clearTimeout(o),i=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&k){var n=et(t,{doc:t,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,slimDOMOptions:I,dataURLOptions:C,inlineImages:b,recordCanvas:w,preserveWhiteSpace:P,onSerialize:A,onIframeLoad:k,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:M,keepIframeSrcFn:D});n&&k(e,n)}}),R),F.type===Te.Element&&"link"===F.tagName&&"stylesheet"===F.attributes.rel&&function(e,t,n){var r,s=!1;try{r=e.sheet}catch(e){return}if(!r){var i=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(i),s=!0,t()}))}}(e,(function(){if(T){var t=et(e,{doc:r,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,slimDOMOptions:I,dataURLOptions:C,inlineImages:b,recordCanvas:w,preserveWhiteSpace:P,onSerialize:A,onIframeLoad:k,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:M,keepIframeSrcFn:D});t&&T(e,t)}}),M),F}var tt=/([^\\]):hover/;new RegExp(tt.source,"g");function nt(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const rt="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let st={map:{},getId:()=>(console.error(rt),-1),getNode:()=>(console.error(rt),null),removeNodeFromMap(){console.error(rt)},has:()=>(console.error(rt),!1),reset(){console.error(rt)}};function it(e,t,n={}){let r=null,s=0;return function(...i){const o=Date.now();s||!1!==n.leading||(s=o);const a=t-(o-s),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),s=o,e.apply(c,i)):r||!1===n.trailing||(r=setTimeout(()=>{s=!1===n.leading?0:Date.now(),r=null,e.apply(c,i)},a))}}function ot(e,t,n,r,s=window){const i=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>ot(e,t,i||{},!0)}function at(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],s=n(r);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}function ct(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function lt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ut(e,t,n,r){if(!e)return!1;const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!s)return!1;if("string"==typeof t){if(s.classList.contains(t))return!0;if(r&&null!==s.closest("."+t))return!0}else if(Je(s,t,r))return!0;if(n){if(s.matches(n))return!0;if(r&&null!==s.closest(n))return!0}return!1}function dt(e,t){return-2===t.getId(e)}function ht(e){return Boolean(e.changedTouches)}function pt(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function gt(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function mt(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(st=new Proxy(st,{get:(e,t,n)=>("map"===t&&console.error(rt),Reflect.get(e,t,n))}));class ft{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var It=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(It||{}),yt=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(yt||{}),Ct=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Ct||{}),vt=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(vt||{});function bt(e){return"__ln"in e}class St{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&bt(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n?n.previous=t:this.tail=t}else if(e.nextSibling&&bt(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head?this.head.previous=t:this.tail=t,t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const wt=(e,t)=>`${e}@${t}`;class At{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new St,n=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},r=r=>{var s,i,o,a;let c=null;(null===(i=null===(s=r.getRootNode)||void 0===s?void 0:s.call(r))||void 0===i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&r.getRootNode().host&&(c=r.getRootNode().host);let l=c;for(;(null===(a=null===(o=null==l?void 0:l.getRootNode)||void 0===o?void 0:o.call(l))||void 0===a?void 0:a.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&l.getRootNode().host;)l=l.getRootNode().host;const u=!(this.doc.contains(r)||l&&this.doc.contains(l));if(!r.parentNode||u)return;const d=Me(r.parentNode)?this.mirror.getId(c):this.mirror.getId(r.parentNode),h=n(r);if(-1===d||-1===h)return t.addNode(r);const p=et(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{pt(e,this.mirror)&&this.iframeManager.addIframe(e),gt(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),mt(r)&&this.shadowDomManager.addShadowRoot(r.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});p&&e.push({parentId:d,nextId:h,node:p})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))Et(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||r(e);for(const e of Array.from(this.addedSet.values()))Rt(this.droppedSet,e)||Et(this.removes,e,this.mirror)?Rt(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let s=null;for(;t.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),r=n(s.value);-1!==t&&-1!==r&&(e=s)}if(!e){let r=t.tail;for(;r;){const t=this.mirror.getId(r.value.parentNode);if(-1!==n(r.value)){if(-1!==t){e=r;break}{const t=r.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=t.parentNode.host;if(-1!==this.mirror.getId(n)){e=r;break}}}r=r.previous}else r=r.previous}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}s=e.previous,t.removeNode(e.value),r(e.value)}const i={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!dt(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;ut(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Qe(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(n=xe({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),ut(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let r=this.attributes.find(t=>t.node===e.target);if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;try{e.attributeName="rr_src"}catch(e){return}}if(r||(r={node:e.target,attributes:{}},this.attributes.push(r)),"style"===e.attributeName){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),void 0!==r.attributes.style&&null!==r.attributes.style||(r.attributes.style={});const s=r.attributes.style;for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),i=t.style.getPropertyPriority(e);r===n.style.getPropertyValue(e)&&i===n.style.getPropertyPriority(e)||(s[e]=""===i?r:[r,i])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(s[e]=!1)}else r.attributes[e.attributeName]=Ye(this.doc,t.tagName,e.attributeName,n);break}case"childList":if(ut(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=Me(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ut(e.target,this.blockClass,this.blockSelector,!1)||dt(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(kt(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||function e(t,n){if(Me(t))return!1;const r=n.getId(t);return!n.has(r)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode,n))}(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[wt(n,r)]?kt(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!Me(e.target)||!Ne(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(dt(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[wt(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ut(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(e=>this.genAdds(e))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function kt(e,t){e.delete(t),t.childNodes.forEach(t=>kt(e,t))}function Et(e,t,n){return 0!==e.length&&function e(t,n,r){const{parentNode:s}=n;if(!s)return!1;const i=r.getId(s);if(t.some(e=>e.id===i))return!0;return e(t,s,r)}(e,t,n)}function Rt(e,t){return 0!==e.size&&function e(t,n){const{parentNode:r}=n;if(!r)return!1;if(t.has(r))return!0;return e(t,r)}(e,t)}const Tt=[],_t="undefined"!=typeof CSSGroupingRule,Mt="undefined"!=typeof CSSMediaRule,Nt="undefined"!=typeof CSSSupportsRule,Dt="undefined"!=typeof CSSConditionRule;function Ot(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function Lt(e,t){var n,r;const s=new At;Tt.push(s),s.init(e);let i=window.MutationObserver||window.__rrMutationObserver;const o=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");o&&window[o]&&(i=window[o]);const a=new i(s.processMutations.bind(s));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function xt({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:s,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const o=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];return Object.keys(Ct).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(i=>{const o=i.toLowerCase(),c=(t=>i=>{const o=Ot(i);if(ut(o,r,s,!0))return;const a=ht(i)?i.changedTouches[0]:i;if(!a)return;const c=n.getId(o),{clientX:l,clientY:u}=a;e({type:Ct[t],id:c,x:l,y:u})})(i);a.push(nt(o,c,t))}),()=>{a.forEach(e=>e())}}function Pt({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:s,sampling:i}){return nt("scroll",it(i=>{const o=Ot(i);if(!o||ut(o,r,s,!0))return;const a=n.getId(o);if(o===t){const n=t.scrollingElement||t.documentElement;e({id:a,x:n.scrollLeft,y:n.scrollTop})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})},i.scroll||100),t)}function Vt(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Ft=["INPUT","TEXTAREA","SELECT"],Ut=new WeakMap;function Bt(e){return function(e,t){if(_t&&e.parentRule instanceof CSSGroupingRule||Mt&&e.parentRule instanceof CSSMediaRule||Nt&&e.parentRule instanceof CSSSupportsRule||Dt&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Gt(e,t,n){let r,s;return e?(e.ownerNode?r=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:r}):{}}function Wt({mirror:e,stylesheetManager:t},n){var r,s,i;let o=null;o="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(i=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===i?void 0:i.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==o&&-1!==o&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return r}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function qt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:s,scrollCb:i,viewportResizeCb:o,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t);const r=Lt(e,e.doc),s=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const c=it(t=>{const n=Date.now()-o;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],o=null},i),l=it(e=>{const t=Ot(e),{clientX:n,clientY:s}=ht(e)?e.changedTouches[0]:e;o||(o=Date.now()),a.push({x:n,y:s,id:r.getId(t),timeOffset:Date.now()-o}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?yt.Drag:e instanceof MouseEvent?yt.MouseMove:yt.TouchMove)},s,{trailing:!1}),u=[nt("mousemove",l,n),nt("touchmove",l,n),nt("drag",l,n)];return()=>{u.forEach(e=>e())}}(e),i=xt(e),o=Pt(e),a=function({viewportResizeCb:e}){let t=-1,n=-1;return nt("resize",it(()=>{const r=ct(),s=lt();t===r&&n===s||(e({width:Number(s),height:Number(r)}),t=r,n=s)},200),window)}(e),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:s,ignoreClass:i,maskInputOptions:o,maskInputFn:a,sampling:c,userTriggeredOnInput:l}){function u(e){let n=Ot(e);const c=e.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||Ft.indexOf(n.tagName)<0||ut(n,r,s,!0))return;const u=n.type;if(n.classList.contains(i))return;let h=n.value,p=!1;"radio"===u||"checkbox"===u?p=n.checked:(o[n.tagName.toLowerCase()]||o[u])&&(h=xe({maskInputOptions:o,tagName:n.tagName,type:u,value:h,maskInputFn:a})),d(n,Vt({text:h,isChecked:p,userTriggered:c},l));const g=n.name;"radio"===u&&g&&p&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{e!==n&&d(e,Vt({text:e.value,isChecked:!p,userTriggered:!1},l))})}function d(t,r){const s=Ut.get(t);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Ut.set(t,r);const s=n.getId(t);e(Object.assign(Object.assign({},r),{id:s}))}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>nt(e,u,t)),p=t.defaultView;if(!p)return()=>{h.forEach(e=>e())};const g=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),m=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&h.push(...m.map(e=>ot(e[0],e[1],{set(){u({target:this})}},!1,p))),()=>{h.forEach(e=>e())}}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:s}){const i=i=>it(s=>{const o=Ot(s);if(!o||ut(o,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=o;e({type:i,id:r.getId(o),currentTime:a,volume:c,muted:l,playbackRate:u})},s.media||500),o=[nt("play",i(0)),nt("pause",i(1)),nt("seeked",i(2)),nt("volumechange",i(3)),nt("ratechange",i(4))];return()=>{o.forEach(e=>e())}}(e),u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){const s=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=function(r,i){const{id:o,styleId:a}=Gt(this,t,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:r,index:i}]}),s.apply(this,[r,i])};const i=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=function(r){const{id:s,styleId:o}=Gt(this,t,n.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,removes:[{index:r}]}),i.apply(this,[r])},r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=function(r){const{id:s,styleId:i}=Gt(this,t,n.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,replace:r}),o.apply(this,[r])}),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=function(r){const{id:s,styleId:i}=Gt(this,t,n.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,replaceSync:r}),a.apply(this,[r])});const c={};_t?c.CSSGroupingRule=r.CSSGroupingRule:(Mt&&(c.CSSMediaRule=r.CSSMediaRule),Dt&&(c.CSSConditionRule=r.CSSConditionRule),Nt&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach(([r,s])=>{l[r]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=function(s,i){const{id:o,styleId:a}=Gt(this.parentStyleSheet,t,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:s,index:[...Bt(this),i||0]}]}),l[r].insertRule.apply(this,[s,i])},s.prototype.deleteRule=function(s){const{id:i,styleId:o}=Gt(this.parentStyleSheet,t,n.styleMirror);return(i&&-1!==i||o&&-1!==o)&&e({id:i,styleId:o,removes:[{index:[...Bt(this),s]}]}),l[r].deleteRule.apply(this,[s])}}),()=>{r.CSSStyleSheet.prototype.insertRule=s,r.CSSStyleSheet.prototype.deleteRule=i,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})}}(e,{win:n}),d=Wt(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:s}){const i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=function(s,o,a){var c;if(n.has(s))return i.apply(this,[s,o,a]);const{id:l,styleId:u}=Gt(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,set:{property:s,value:o,priority:a},index:Bt(this.parentRule)}),i.apply(this,[s,o,a])};const o=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=function(s){var i;if(n.has(s))return o.apply(this,[s]);const{id:a,styleId:c}=Gt(null===(i=this.parentRule)||void 0===i?void 0:i.parentStyleSheet,t,r.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:s},index:Bt(this.parentRule)}),o.apply(this,[s])},()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=o}}(e,{win:n}),p=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],s=new WeakMap,i=n.FontFace;n.FontFace=function(e,t,n){const r=new i(e,t,n);return s.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const o=at(t.fonts,"add",(function(t){return function(n){return setTimeout(()=>{const t=s.get(n);t&&(e(t),s.delete(n))},0),t.apply(this,[n])}}));return r.push(()=>{n.FontFace=i}),r.push(o),()=>{r.forEach(e=>e())}}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:s,selectionCb:i}=e;let o=!0;const a=()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const i=e.getRangeAt(t),{startContainer:o,startOffset:c,endContainer:l,endOffset:u}=i;ut(o,r,s,!0)||ut(l,r,s,!0)||a.push({start:n.getId(o),startOffset:c,end:n.getId(l),endOffset:u})}i({ranges:a})};return a(),nt("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return()=>{Tt.forEach(e=>e.reset()),r.disconnect(),s(),i(),o(),a(),c(),l(),u(),d(),h(),p(),g(),m.forEach(e=>e())}}class Ht{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const s=n||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let o=s.get(t);return o||(o=this.generateIdFn(),s.set(t,o),i.set(o,t)),o}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=r.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Zt{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ht(Be),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ht(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var n;switch(t.type){case It.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:It.IncrementalSnapshot,data:{source:yt.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case It.Meta:case It.Load:case It.DomContentLoaded:return!1;case It.Plugin:return t;case It.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case It.IncrementalSnapshot:switch(t.data.source){case yt.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case yt.Drag:case yt.TouchMove:case yt.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case yt.ViewportResize:return!1;case yt.MediaInteraction:case yt.MouseInteraction:case yt.Scroll:case yt.CanvasMutation:case yt.Input:return this.replaceIds(t.data,e,["id"]),t;case yt.StyleSheetRule:case yt.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case yt.Font:return t;case yt.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case yt.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,n,r){for(const s of r)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}}class zt{constructor(e){this.shadowDoms=new WeakSet,this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.active=!0;const t=this;at(Element.prototype,"attachShadow",(function(e){return function(n){const r=e.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),r}}))}addShadowRoot(e,t){this.active&&Ne(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),Lt(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Pt(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Wt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;at(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(n){return function(r){const s=n.call(this,r);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),s}}))}}reset(){this.active=!1,this.shadowDoms=new WeakSet}}function Kt(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}for(var jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Jt=0;Jt<jt.length;Jt++)Yt[jt.charCodeAt(Jt)]=Jt;const Qt=new Map;const $t=(e,t,n)=>{if(!e||!tn(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Qt.get(e);return n||(n=new Map,Qt.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let s=r.indexOf(e);return-1===s&&(s=r.length,r.push(e)),s};function Xt(e,t,n){if(e instanceof Array)return e.map(e=>Xt(e,t,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,n=new Uint8Array(e),r=n.length,s="";for(t=0;t<r;t+=3)s+=jt[n[t]>>2],s+=jt[(3&n[t])<<4|n[t+1]>>4],s+=jt[(15&n[t+1])<<2|n[t+2]>>6],s+=jt[63&n[t+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Xt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Xt(e.data,t,n),e.width,e.height]}}if(tn(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:$t(e,t,n)}}return e}const en=(e,t,n)=>[...e].map(e=>Xt(e,t,n)),tn=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function nn(e,t,n){const r=[];try{const s=at(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(r,...s){return ut(this,t,n,!0)||"__context"in this||(this.__context=r),e.apply(this,[r,...s])}}));r.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach(e=>e())}}function rn(e,t,n,r,s,i,o){const a=[],c=Object.getOwnPropertyNames(e);for(const i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if("function"!=typeof e[i])continue;const c=at(e,i,(function(e){return function(...a){const c=e.apply(this,a);if($t(c,o,this),!ut(this.canvas,r,s,!0)){const e=en([...a],o,this),r={type:t,property:i,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const s=ot(e,i,{set(e){n(this.canvas,{type:t,property:i,args:[e],setter:!0})}});a.push(s)}return a}var sn=null;try{var on="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");sn=on.Worker}catch(e){}function an(e,t,n){var r=void 0===t?null:t,s=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==n&&n),i=s.indexOf("\n",10)+1,o=s.substring(i)+(r?"//# sourceMappingURL="+r:"");return function(e){return new sn(o,Object.assign({},e,{eval:!0}))}}function cn(e,t,n){var r=void 0===t?null:t,s=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),s=0,i=n.length;s<i;++s)r[s]=n.charCodeAt(s);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),i=s.indexOf("\n",10)+1,o=s.substring(i)+(r?"//# sourceMappingURL="+r:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}var ln="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var un,dn,hn,pn=(un="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",dn=null,hn=!1,ln?an(un,dn,hn):function(e,t,n){var r;return function(s){return r=r||cn(e,t,n),new Worker(r,s)}}(un,dn,hn));class gn{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:s,recordCanvas:i,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(n,r,s),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,s,{dataURLOptions:o})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,s){const i=nn(t,n,r),o=new Map,a=new pn;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:s,height:i}=e.data;this.mutationCb({id:t,type:vt["2D"],commands:[{property:"clearRect",args:[0,0,s,i]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{ut(t,n,r,!0)||e.push(t)}),e})().forEach(e=>Kt(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(o.get(n))return;if(o.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[r])})))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{i(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=nn(e,t,n),s=function(e,t,n,r){const s=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const i=at(t.CanvasRenderingContext2D.prototype,o,(function(s){return function(...i){return ut(this.canvas,n,r,!0)||setTimeout(()=>{const n=en([...i],t,this);e(this.canvas,{type:vt["2D"],property:o,args:n})},0),s.apply(this,i)}}));s.push(i)}catch(n){const r=ot(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:vt["2D"],property:o,args:[t],setter:!0})}});s.push(r)}return()=>{s.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),i=function(e,t,n,r,s){const i=[];return i.push(...rn(t.WebGLRenderingContext.prototype,vt.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...rn(t.WebGL2RenderingContext.prototype,vt.WebGL2,e,n,r,0,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}(e,["type"])),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:r}),this.pendingCanvasMutations.delete(e)}}class mn{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ft,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map((e,t)=>({rule:Oe(e),index:t}))})}n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function fn(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let In,yn,Cn,vn=!1;const bn=new Le;function Sn(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:s="rr-block",blockSelector:i=null,ignoreClass:o="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:u,maskInputOptions:d,slimDOMOptions:h,maskInputFn:p,maskTextFn:g,hooks:m,packFn:f,sampling:I={},dataURLOptions:y={},mousemoveWait:C,recordCanvas:v=!1,recordCrossOriginIframes:b=!1,userTriggeredOnInput:S=!1,collectFonts:w=!1,inlineImages:A=!1,plugins:k,keepIframeSrcFn:E=(()=>!1),ignoreCSSAttributes:R=new Set([])}=e,T=!b||window.parent===window;let _=!1;if(!T)try{window.parent.document,_=!1}catch(e){_=!0}if(T&&!t)throw new Error("emit function is required");void 0!==C&&void 0===I.mousemove&&(I.mousemove=C),bn.reset();const M=!0===u?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==d?d:{password:!0},N=!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===h,headMetaDescKeywords:"all"===h}:h||{};let D;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let O=0;const L=e=>{for(const t of k||[])t.eventProcessor&&(e=t.eventProcessor(e));return f&&(e=f(e)),e};In=(e,s)=>{var i;if(!(null===(i=Tt[0])||void 0===i?void 0:i.isFrozen())||e.type===It.FullSnapshot||e.type===It.IncrementalSnapshot&&e.data.source===yt.Mutation||Tt.forEach(e=>e.unfreeze()),T)null==t||t(L(e),s);else if(_){const t={type:"rrweb",event:L(e),isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===It.FullSnapshot)D=e,O=0;else if(e.type===It.IncrementalSnapshot){if(e.data.source===yt.Mutation&&e.data.isAttachIframe)return;O++;const t=r&&O>=r,s=n&&e.timestamp-D.timestamp>n;(t||s)&&yn(!0)}};const x=e=>{In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.Mutation},e)}))},P=e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.Scroll},e)})),V=e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.CanvasMutation},e)})),F=new mn({mutationCb:x,adoptedStyleSheetCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.AdoptedStyleSheet},e)}))}),U=new Zt({mirror:bn,mutationCb:x,stylesheetManager:F,recordCrossOriginIframes:b,wrappedEmit:In});for(const e of k||[])e.getMirror&&e.getMirror({nodeMirror:bn,crossOriginIframeMirror:U.crossOriginIframeMirror,crossOriginIframeStyleMirror:U.crossOriginIframeStyleMirror});Cn=new gn({recordCanvas:v,mutationCb:V,win:window,blockClass:s,blockSelector:i,mirror:bn,sampling:I.canvas,dataURLOptions:y});const B=new zt({mutationCb:x,scrollCb:P,bypassOptions:{blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:M,dataURLOptions:y,maskTextFn:g,maskInputFn:p,recordCanvas:v,inlineImages:A,sampling:I,slimDOMOptions:N,iframeManager:U,stylesheetManager:F,canvasManager:Cn,keepIframeSrcFn:E},mirror:bn});yn=(e=!1)=>{var t,n,r,o,u,d;In(fn({type:It.Meta,data:{href:window.location.href,width:lt(),height:ct()}}),e),F.reset(),Tt.forEach(e=>e.lock());const h=function(e,t){var n=t||{},r=n.mirror,s=void 0===r?new Le:r,i=n.blockClass,o=void 0===i?"rr-block":i,a=n.blockSelector,c=void 0===a?null:a,l=n.maskTextClass,u=void 0===l?"rr-mask":l,d=n.maskTextSelector,h=void 0===d?null:d,p=n.inlineStylesheet,g=void 0===p||p,m=n.inlineImages,f=void 0!==m&&m,I=n.recordCanvas,y=void 0!==I&&I,C=n.maskAllInputs,v=void 0!==C&&C,b=n.maskTextFn,S=n.maskInputFn,w=n.slimDOM,A=void 0!==w&&w,k=n.dataURLOptions,E=n.preserveWhiteSpace,R=n.onSerialize,T=n.onIframeLoad,_=n.iframeLoadTimeout,M=n.onStylesheetLoad,N=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return et(e,{doc:e,mirror:s,blockClass:o,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===v?{password:!0}:v,maskTextFn:b,maskInputFn:S,slimDOMOptions:!0===A||"all"===A?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===A,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===A?{}:A,dataURLOptions:k,inlineImages:f,recordCanvas:y,preserveWhiteSpace:E,onSerialize:R,onIframeLoad:T,iframeLoadTimeout:_,onStylesheetLoad:M,stylesheetLoadTimeout:N,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:bn,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:M,maskTextFn:g,slimDOM:N,dataURLOptions:y,recordCanvas:v,inlineImages:A,onSerialize:e=>{pt(e,bn)&&U.addIframe(e),gt(e,bn)&&F.trackLinkElement(e),mt(e)&&B.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{U.attachIframe(e,t),B.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{F.attachLinkElement(e,t)},keepIframeSrcFn:E});if(!h)return console.warn("Failed to snapshot the document");In(fn({type:It.FullSnapshot,data:{node:h,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(u=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===u?void 0:u.scrollTop)||(null===(d=null===document||void 0===document?void 0:document.body)||void 0===d?void 0:d.scrollTop)||0}}})),Tt.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&F.adoptStyleSheets(document.adoptedStyleSheets,bn.getId(document))};try{const e=[];e.push(nt("DOMContentLoaded",()=>{In(fn({type:It.DomContentLoaded,data:{}}))}));const t=e=>{var t;return qt({mutationCb:x,mousemoveCb:(e,t)=>In(fn({type:It.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.MouseInteraction},e)})),scrollCb:P,viewportResizeCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.ViewportResize},e)})),inputCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.Input},e)})),mediaInteractionCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.MediaInteraction},e)})),styleSheetRuleCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.StyleSheetRule},e)})),styleDeclarationCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.StyleDeclaration},e)})),canvasMutationCb:V,fontCb:e=>In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.Font},e)})),selectionCb:e=>{In(fn({type:It.IncrementalSnapshot,data:Object.assign({source:yt.Selection},e)}))},blockClass:s,ignoreClass:o,maskTextClass:a,maskTextSelector:c,maskInputOptions:M,inlineStylesheet:l,sampling:I,recordCanvas:v,inlineImages:A,userTriggeredOnInput:S,collectFonts:w,doc:e,maskInputFn:p,maskTextFn:g,keepIframeSrcFn:E,blockSelector:i,slimDOMOptions:N,dataURLOptions:y,mirror:bn,iframeManager:U,stylesheetManager:F,shadowDomManager:B,canvasManager:Cn,ignoreCSSAttributes:R,plugins:(null===(t=null==k?void 0:k.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>In(fn({type:It.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},m)};U.addLoadListener(n=>{e.push(t(n.contentDocument))});const n=()=>{yn(),e.push(t(document)),vn=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():e.push(nt("load",()=>{In(fn({type:It.Load,data:{}})),n()},window)),()=>{e.forEach(e=>e()),vn=!1}}catch(e){console.warn(e)}}Sn.addCustomEvent=(e,t)=>{if(!vn)throw new Error("please add custom event after start recording");In(fn({type:It.Custom,data:{tag:e,payload:t}}))},Sn.freezePage=()=>{Tt.forEach(e=>e.freeze())},Sn.takeFullSnapshot=e=>{if(!vn)throw new Error("please take full snapshot after start recording");yn(e)},Sn.mirror=bn;var wn=Uint8Array,An=Uint16Array,kn=Uint32Array,En=new wn([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]),Rn=new wn([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]),Tn=new wn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_n=function(e,t){for(var n=new An(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var s=new kn(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return[n,s]},Mn=_n(En,2),Nn=Mn[0],Dn=Mn[1];Nn[28]=258,Dn[258]=28;for(var On=_n(Rn,0),Ln=(On[0],On[1]),xn=new An(32768),Pn=0;Pn<32768;++Pn){var Vn=(43690&Pn)>>>1|(21845&Pn)<<1;Vn=(61680&(Vn=(52428&Vn)>>>2|(13107&Vn)<<2))>>>4|(3855&Vn)<<4,xn[Pn]=((65280&Vn)>>>8|(255&Vn)<<8)>>>1}var Fn=function(e,t,n){for(var r=e.length,s=0,i=new An(t);s<r;++s)++i[e[s]-1];var o,a=new An(t);for(s=0;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;if(n){o=new An(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var l=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[xn[d]>>>c]=l}else for(o=new An(r),s=0;s<r;++s)o[s]=xn[a[e[s]-1]++]>>>15-e[s];return o},Un=new wn(288);for(Pn=0;Pn<144;++Pn)Un[Pn]=8;for(Pn=144;Pn<256;++Pn)Un[Pn]=9;for(Pn=256;Pn<280;++Pn)Un[Pn]=7;for(Pn=280;Pn<288;++Pn)Un[Pn]=8;var Bn=new wn(32);for(Pn=0;Pn<32;++Pn)Bn[Pn]=5;var Gn=Fn(Un,9,0),Wn=Fn(Bn,5,0),qn=function(e){return(e/8>>0)+(7&e&&1)},Hn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof An?An:e instanceof kn?kn:wn)(n-t);return r.set(e.subarray(t,n)),r},Zn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},zn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Kn=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return[new wn(0),0];if(1==s){var o=new wn(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=s-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=i[0].s;for(r=1;r<s;++r)i[r].s>h&&(h=i[r].s);var p=new An(h+1),g=jn(n[u-1],p,0);if(g>t){r=0;var m=0,f=g-t,I=1<<f;for(i.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<s;++r){var y=i[r].s;if(!(p[y]>t))break;m+=I-(1<<g-p[y]),p[y]=t}for(m>>>=f;m>0;){var C=i[r].s;p[C]<t?m-=1<<t-p[C]++-1:++r}for(;r>=0&&m;--r){var v=i[r].s;p[v]==t&&(--p[v],++m)}g=t}return[new wn(p),g]},jn=function(e,t,n){return-1==e.s?Math.max(jn(e.l,t,n+1),jn(e.r,t,n+1)):t[e.s]=n},Yn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new An(++t),r=0,s=e[0],i=1,o=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=e[a]}return[n.subarray(0,r),t]},Jn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Qn=function(e,t,n){var r=n.length,s=qn(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var i=0;i<r;++i)e[s+i+4]=n[i];return 8*(s+4+r)},$n=function(e,t,n,r,s,i,o,a,c,l,u){Zn(t,u++,n),++s[256];for(var d=Kn(s,15),h=d[0],p=d[1],g=Kn(i,15),m=g[0],f=g[1],I=Yn(h),y=I[0],C=I[1],v=Yn(m),b=v[0],S=v[1],w=new An(19),A=0;A<y.length;++A)w[31&y[A]]++;for(A=0;A<b.length;++A)w[31&b[A]]++;for(var k=Kn(w,7),E=k[0],R=k[1],T=19;T>4&&!E[Tn[T-1]];--T);var _,M,N,D,O=l+5<<3,L=Jn(s,Un)+Jn(i,Bn)+o,x=Jn(s,h)+Jn(i,m)+o+14+3*T+Jn(w,E)+(2*w[16]+3*w[17]+7*w[18]);if(O<=L&&O<=x)return Qn(t,u,e.subarray(c,c+l));if(Zn(t,u,1+(x<L)),u+=2,x<L){_=Fn(h,p,0),M=h,N=Fn(m,f,0),D=m;var P=Fn(E,R,0);Zn(t,u,C-257),Zn(t,u+5,S-1),Zn(t,u+10,T-4),u+=14;for(A=0;A<T;++A)Zn(t,u+3*A,E[Tn[A]]);u+=3*T;for(var V=[y,b],F=0;F<2;++F){var U=V[F];for(A=0;A<U.length;++A){var B=31&U[A];Zn(t,u,P[B]),u+=E[B],B>15&&(Zn(t,u,U[A]>>>5&127),u+=U[A]>>>12)}}}else _=Gn,M=Un,N=Wn,D=Bn;for(A=0;A<a;++A)if(r[A]>255){B=r[A]>>>18&31;zn(t,u,_[B+257]),u+=M[B+257],B>7&&(Zn(t,u,r[A]>>>23&31),u+=En[B]);var G=31&r[A];zn(t,u,N[G]),u+=D[G],G>3&&(zn(t,u,r[A]>>>5&8191),u+=Rn[G])}else zn(t,u,_[r[A]]),u+=M[r[A]];return zn(t,u,_[256]),u+M[256]},Xn=new kn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),er=new wn(0),tr=function(e,t,n,r,s){return function(e,t,n,r,s,i){var o=e.length,a=new wn(r+o+5*(1+Math.floor(o/7e3))+s),c=a.subarray(r,a.length-s),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=Qn(c,l,e.subarray(u,d)):(c[u]=i,l=Qn(c,l,e.subarray(u,o)))}else{for(var h=Xn[t-1],p=h>>>13,g=8191&h,m=(1<<n)-1,f=new An(32768),I=new An(m+1),y=Math.ceil(n/3),C=2*y,v=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<C)&m},b=new kn(25e3),S=new An(288),w=new An(32),A=0,k=0,E=(u=0,0),R=0,T=0;u<o;++u){var _=v(u),M=32767&u,N=I[_];if(f[M]=N,I[_]=M,R<=u){var D=o-u;if((A>7e3||E>24576)&&D>423){l=$n(e,c,0,b,S,w,k,E,T,u-T,l),E=A=k=0,T=u;for(var O=0;O<286;++O)S[O]=0;for(O=0;O<30;++O)w[O]=0}var L=2,x=0,P=g,V=M-N&32767;if(D>2&&_==v(u-V))for(var F=Math.min(p,D)-1,U=Math.min(32767,u),B=Math.min(258,D);V<=U&&--P&&M!=N;){if(e[u+L]==e[u+L-V]){for(var G=0;G<B&&e[u+G]==e[u+G-V];++G);if(G>L){if(L=G,x=V,G>F)break;var W=Math.min(V,G-2),q=0;for(O=0;O<W;++O){var H=u-V+O+32768&32767,Z=H-f[H]+32768&32767;Z>q&&(q=Z,N=H)}}}V+=(M=N)-(N=f[M])+32768&32767}if(x){b[E++]=268435456|Dn[L]<<18|Ln[x];var z=31&Dn[L],K=31&Ln[x];k+=En[z]+Rn[K],++S[257+z],++w[K],R=u+L,++A}else b[E++]=e[u],++S[e[u]]}}l=$n(e,c,i,b,S,w,k,E,T,u-T,l),i||(l=Qn(c,l,er))}return Hn(a,0,r+qn(l)+s)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!s)};function nr(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,s=t,i=n.length,o=0;o!=i;){for(var a=Math.min(o+5552,i);o<a;++o)s+=r+=n[o];r%=65521,s%=65521}e=r,t=s},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();n.p(e);var r=tr(e,t,2,4);return function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)}(r,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(r,r.length-4,n.d()),r}const rr=e=>{const t=Object.assign(Object.assign({},e),{v:"v1"});return function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var r=0;r<e.length;){var s=e[r++];s<128||t?n+=String.fromCharCode(s):s<224?n+=String.fromCharCode((31&s)<<6|63&e[r++]):s<240?n+=String.fromCharCode((15&s)<<12|(63&e[r++])<<6|63&e[r++]):(s=((15&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,n+=String.fromCharCode(55296|s>>10,56320|1023&s))}return n}(nr(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new wn(e.length+(e.length>>>1)),s=0,i=function(e){r[s++]=e},o=0;o<n;++o){if(s+5>r.length){var a=new wn(s+8+(n-o<<1));a.set(r),r=a}var c=e.charCodeAt(o);c<128||t?i(c):c<2048?(i(192|c>>>6),i(128|63&c)):c>55295&&c<57344?(i(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),i(128|c>>>12&63),i(128|c>>>6&63),i(128|63&c)):(i(224|c>>>12),i(128|c>>>6&63),i(128|63&c))}return Hn(r,0,s)}(JSON.stringify(t))),!0)},{addCustomEvent:sr}=Sn,{freezePage:ir}=Sn;class or{constructor(){this.eventBuffer=[],this.vfCounter=0,this.didSetupRecorder=!1,this.recordStopper=null,this.firstRecordedTimestamp=null,this.lastRecordedTimestamp=null,this.invalidVideoLength=!1,this.lastFragPostTimestamp=new Date,this.pauseTimeout=!1,this.freezingEvents=!1,this.cssURLs=new Map,this.pageStateHistory=[],this.lastRRWebEvent=null,this.setupUnloadHandler(),this.setupPostMetricsHandler()}static configureInstance(){this.instance||(this.instance=new or,j(window,"click",()=>{this.instance.handleFragPost()}))}static getInstance(){if(!this.instance)throw new Error("SessionRecorder was not configured");return this.instance}addCSSURLs(e){this.cssURLs.get(e)||this.cssURLs.set(e,{seq_sent:ee.getInstance().messageSequenceNum,received:!1})}checkForCSSURLs(e){if(3===e.type||2===e.type){const t=JSON.stringify(e).match(y);t&&t.length>0&&t.forEach(e=>{if(e.length>0&&e.startsWith('"href":')){e.substring(7).split(/['"]/).forEach(e=>{e.includes(".css")&&this.addCSSURLs(e)})}})}}getCSSURLsNotReceived(){const{latestReceivedSeqNumber:e}=ee.getInstance(),t=[];return this.cssURLs.forEach((n,r)=>{if(!n.received&&n.seq_sent<e){const e=n;e.received=!0,this.cssURLs.set(r,e)}else n.received||t.push(r)}),t}setupUnloadHandler(){["pagehide","visibilitychange"].forEach(e=>j(window,e,()=>{this.pageStateHistory.push(`${Q()?"":(new Date).toISOString()}: ${e}`),"pagehide"===e&&this.handleFragPost()}))}setupPostMetricsHandler(){j(window,"noibuPostMetrics",e=>{const t=e.detail,n=null===this.lastRecordedTimestamp||null===this.firstRecordedTimestamp?0:this.lastRecordedTimestamp-this.firstRecordedTimestamp,r=ee.getInstance().sessionLength?ee.getInstance().sessionLength:0;if(ee.getInstance().retryMessageQueue.length>100){const e=this.buildDebugMessage(t,n,r),s=K.getInstance().isClientDisabled;K.getInstance().isClientDisabled=!1,K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,s,"warn")}})}recordUserSession(){if(ee.getInstance().closeIfInactive()||Y.getInstance().didCutVideo)return;if(this.didSetupRecorder)return;const e=this,t={emit(t){e.handleNewRRwebEvent(t,2e3)},inlineStylesheet:!1,maskAllInputs:!0,blockSelector:U(),ignoreCSSAttributes:d};Y.getInstance().setDidStartVideo(),e.recordStopper=Sn(t),this.didSetupRecorder=!0}handleNewRRwebEvent(e,t){if(ee.getInstance().closeIfInactive()||Y.getInstance().didCutVideo){if(this.recordStopper)try{this.recordStopper()}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!0,"error")}return}if(5===e.type&&"unfreeze"===e.data.tag)return;if(3===e.type&&0===e.data.source||(this.pauseTimeout&&(clearTimeout(this.pauseTimeout),this.freezingEvents=!1),this.pauseTimeout=setTimeout((function(){or.getInstance().freezingEvents=!0,Sn.freezePage()}),t)),e.timestamp=$(e.timestamp),this.firstRecordedTimestamp||(this.firstRecordedTimestamp=e.timestamp),(!this.lastRecordedTimestamp||e.timestamp>this.lastRecordedTimestamp)&&(this.lastRecordedTimestamp=e.timestamp),this.firstRecordedTimestamp&&e.timestamp<this.firstRecordedTimestamp)return void K.getInstance().postNoibuErrorAndOptionallyDisableClient("Detected time rewind. Client has been disabled.",!0,"error",!0);this.eventBuffer.push(rr(e)),this.lastRRWebEvent=e,this.checkForCSSURLs(e),3!==e.type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||Y.getInstance().addVideoClick();const n=new Date;n.setMilliseconds(n.getMilliseconds()-500),(this.eventBuffer.length>=10||this.lastFragPostTimestamp<n)&&this.handleFragPost()}buildDebugMessage(e,t,n){let r="Posting metrics, logging due to large retry message queue";return r+=", URL: "+document.location.href,r+=", Session Length: "+n,r+=", Video Length: "+t,r+=", Length Delta: "+(t-n),r+=", Session Start: "+new Date(ee.getInstance().sessionTimestamp),null!==this.firstRecordedTimestamp&&(r+=", Video Start: "+new Date(this.firstRecordedTimestamp),r+=", Start Delta: "+(this.firstRecordedTimestamp-ee.getInstance().sessionTimestamp)),r+=", Last active time: "+K.getInstance().lastActiveTime,r+=", Visibility: "+document.visibilityState,this.pageStateHistory.length>0&&(r+=", Page States: "+this.pageStateHistory),r+=`, Socket: Connected ${ee.getInstance().isConnected()} Count ${ee.getInstance().connectionCount} Buffer: ${ee.getInstance().socket&&ee.getInstance().socket.bufferedAmount}`,ee.getInstance().socketCloseCodes.length>0&&(r+=" Closure Codes: "+ee.getInstance().socketCloseCodes),ee.getInstance().socketOpens.length>0&&(r+=" Opens: "+ee.getInstance().socketOpens),null!==this.lastRRWebEvent&&(r+=`, Last rrweb event: Type ${this.lastRRWebEvent.type} Data Source ${this.lastRRWebEvent.data&&void 0!==this.lastRRWebEvent.data.source?this.lastRRWebEvent.data.source:-1} Data Type ${this.lastRRWebEvent.data&&void 0!==this.lastRRWebEvent.data.type?this.lastRRWebEvent.data.type:-1} Time: ${new Date(this.lastRRWebEvent.timestamp)}`),ee.getInstance().retryMessageQueue.length>0&&(r+=", Retry queue length: "+ee.getInstance().retryMessageQueue.length),r+=`, Sequence Info: Latest ${this.lastFragPostTimestamp} ${ee.getInstance().messageSequenceNum} Ack'd ${ee.getInstance().latestReceivedSeqNumStoredTime} ${ee.getInstance().latestReceivedSeqNumber}`,e&&(r+=", Event: "+e),r}handleFragPost(){if(!ee.getInstance().closeIfInactive()&&this.didSetupRecorder&&0!==this.eventBuffer.length){try{let e=0;this.firstRecordedTimestamp&&this.lastRecordedTimestamp&&!this.invalidVideoLength&&(e=this.lastRecordedTimestamp-this.firstRecordedTimestamp),!this.invalidVideoLength&&(e<0||e>=Number.MAX_SAFE_INTEGER)&&(K.getInstance().postNoibuErrorAndOptionallyDisableClient(`video lengthMS is invalid: ${e}, start time: ${this.firstRecordedTimestamp}, end time: `+this.lastRecordedTimestamp,!1,"error"),this.invalidVideoLength=!0,e=0),this.vfCounter+=1;const t={};t.vid=x(this.eventBuffer),t.seq=this.vfCounter,t.len=e,t.css_urls=this.getCSSURLsNotReceived(),ee.getInstance().addEndTimeToPayload(t,!1),Y.getInstance().addVideoFragData(this.vfCounter,e);const n={};n.pvvf=t,ee.getInstance().sendMessage("v",n),this.lastFragPostTimestamp=new Date}catch(e){if(K.getInstance().postNoibuErrorAndOptionallyDisableClient("video frag socket closed with err: "+e.message,!1,"error"),this.recordStopper)try{this.recordStopper()}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error")}}this.eventBuffer=[]}}unfreeze(){this.freezingEvents&&sr("unfreeze",{})}}class ar{constructor(){this.customIDs={},this.customErrorsCount=0,this.TOO_MANY_IDS_ADDED_MSG="TOO_MANY_IDS_ADDED",this.ID_NAME_ALREADY_ADDED_MSG="ID_NAME_ALREADY_ADDED",this.NAME_TOO_LONG_MSG="NAME_TOO_LONG",this.VALUE_TOO_LONG_MSG="VALUE_TOO_LONG",this.INVALID_NAME_TYPE_MSG="INVALID_NAME_TYPE",this.INVALID_VALUE_TYPE_MSG="INVALID_VALUE_TYPE",this.NAME_HAS_NO_LENGTH_MSG="NAME_HAS_NO_LENGTH",this.VALUE_HAS_NO_LENGTH_MSG="VALUE_HAS_NO_LENGTH",this.SUCCESS_MSG="SUCCESS",this.ERROR_HAS_NO_MSG_MSG="ERROR_HAS_NO_MSG",this.ERROR_HAS_NO_STACK_MSG="ERROR_HAS_NO_STACK",this.NULL_CUSTOM_ERR_MSG="NULL_CUSTOM_ERROR",this.ERROR_ALREADY_RECEIVED_MSG="ERROR_ALREADY_RECEIVED",this.INVALID_ERROR_SOURCE_MSG="INVALID_ERROR_SOURCE_MSG",this.TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG="TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT"}static getInstance(){return this.instance||(this.instance=new ar),this.instance}exposeFunctions(){const e=this._getSDKWindowObject();window.NOIBUJS=e}_getSDKWindowObject(){return{addCustomAttribute:this._addCustomAttribute.bind(this),addError:this._addCustomError.bind(this),addJsSdkError:this._addErrorFromJSSdk.bind(this)}}_validateCustomError(e){return e?e.message?e.stack?this.SUCCESS_MSG:this.ERROR_HAS_NO_STACK_MSG:this.ERROR_HAS_NO_MSG_MSG:this.NULL_CUSTOM_ERR_MSG}_validateAndSetCustomError(e){if(this.customErrorsCount>=500)return this.TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG;const t=this._validateCustomError(e);return t!==this.SUCCESS_MSG?t:(this.customErrorsCount+=1,this.SUCCESS_MSG)}_addErrorFromJSSdk(e,t){const n=this._validateAndSetCustomError(e);return n!==this.SUCCESS_MSG?n:"ReactError"!==t&&"VueError"!==t?this.INVALID_ERROR_SOURCE_MSG:(ie(t,{error:e}),n)}_addCustomError(e){const t=this._validateAndSetCustomError(e);return t!==this.SUCCESS_MSG||ie("CustomError",{error:e}),t}_addCustomAttribute(e,t){if(Object.keys(this.customIDs).length>=10)return this.TOO_MANY_IDS_ADDED_MSG;const n=this._validateCustomIDInput(e,t);return n!==this.SUCCESS_MSG?n:e in this.customIDs?this.ID_NAME_ALREADY_ADDED_MSG:(this.customIDs[e]=t,ee.getInstance().sendMessage("m",{pvm:{id_name:e,id_val:t}}),this.SUCCESS_MSG)}_validateCustomIDInput(e,t){return"string"!=typeof e?this.INVALID_NAME_TYPE_MSG:"string"!=typeof t?this.INVALID_VALUE_TYPE_MSG:t.length>50?this.VALUE_TOO_LONG_MSG:e.length>50?this.NAME_TOO_LONG_MSG:0===t.length?this.VALUE_HAS_NO_LENGTH_MSG:0===e.length?this.NAME_HAS_NO_LENGTH_MSG:this.SUCCESS_MSG}}!function(t){if(B())return;if(function(t){for(let n=0;n<e.length;n+=1){if(!t[e[n]])return!0}return!1}(t))return;if(!window.location.href.startsWith("http"))return;if(function(){const e=void 0!==window.noibuJSLoaded;return window.noibuJSLoaded=!0,e}())return;const n=t.metroplexHTTPBase+"/collect_error";K.configureInstance(n);try{const e=v()();if(K.getInstance().isClientDisabled)return;K.getInstance().setupBrowserIDCookie();const t=ee.getInstance(e);or.configureInstance(),te.configureInstance();const n=or.getInstance();J.getInstance();const r=new ke,s=Ae.getInstance(),i=Re.getInstance();ge.getInstance(),he(),Ce(),ye(),s.monitorClicks(),setInterval((function(){if(Ee!==window.location.href){Ee=window.location.href;const e={url:O()};ne.getInstance().addEvent(e,"loc")}}),1e3),r.monitor(),i.monitor(),Promise.all([new Promise(e=>{function t(){"complete"===document.readyState&&(window.removeEventListener("load",t),document.removeEventListener("readystatechange",t),e())}"complete"===document.readyState?e():(j(window,"load",t),j(document,"readystatechange",t))}),t.connectionPromise]).then(()=>{n.recordUserSession()}).catch(e=>{K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error")}),ar.getInstance().exposeFunctions()}catch(e){K.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!0,"error")}}({metroplexSocketBase:g(),metroplexHTTPBase:m()})})()})();