posthog-js 1.438.8 → 1.438.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/customizations/before-send.js +0 -9
- package/lib/src/customizations/before-send.js.map +1 -1
- package/package.json +6 -6
package/dist/posthog-recorder.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e,n,i){return(n=function(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function i(t){for(var i=1;arguments.length>i;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?n(Object(r),!0).forEach(function(n){e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function r(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function s(t){return function(){var e=this,n=arguments;return new Promise(function(i,s){var o=t.apply(e,n);function a(t){r(o,i,s,a,l,"next",t)}function l(t){r(o,i,s,a,l,"throw",t)}a(void 0)})}}const o=["type"];var a=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),l=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),u=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),c=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),h=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),d=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),f=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function v(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var p=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${p.source}`,"i"),new RegExp(p.source,"gi"),"0".repeat(32),"0".repeat(16);var m={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},g={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},y={};function b(t){if(y[t])return y[t];const e=function(t){var e,n;const i=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(n=e.__symbol__)||void 0===n?void 0:n.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],n=e.prototype,i=t in m?m[t]:void 0,r=Boolean(i&&i.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(n,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),s=t in g?g[t]:void 0,o=Boolean(s&&s.every(t=>{var e;return"function"==typeof n[t]&&(null===(e=n[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(r&&o)return y[t]=e.prototype,e.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const i=a.contentWindow;if(!i)return e.prototype;const r=i[t].prototype;return r?(v(u=navigator.userAgent,"AppleWebKit")&&!v(u,"Chrome")&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",t),l=!0),y[t]=r):n}catch(t){return n}finally{!l&&a.parentNode&&document.body.removeChild(a)}var u}var w=Object.create(null);function k(t,e,n){var i;const r=w[t],s=r[n];if(s)return s.call(e);const o=b(t),a=null===(i=Object.getOwnPropertyDescriptor(o,n))||void 0===i?void 0:i.get;return a?(r[n]=a,a.call(e)):e[n]}w.Node=Object.create(null),w.ShadowRoot=Object.create(null),w.MutationObserver=Object.create(null),w.Element=Object.create(null);var _,S={};function C(t,e,n){const i=`${t}.${String(n)}`;if(S[i])return S[i].bind(e);const r=b(t)[n];return"function"!=typeof r?e[n]:(S[i]=r,r.bind(e))}function I(){return b("MutationObserver").constructor}function M(t,e,n){try{if(!(e in t))return()=>{};const i=t[e],r={next:i},s=n(function(...t){return r.next.apply(this,t)});return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=r.next);const n=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let i=t[e],o=n(i);for(;o;){if(o.next===s)return void(o.next=r.next);i=o.next,o=n(i)}}}catch(t){return()=>{}}}var R={childNodes:t=>k("Node",t,"childNodes"),parentNode:t=>k("Node",t,"parentNode"),parentElement:t=>k("Node",t,"parentElement"),textContent:t=>k("Node",t,"textContent"),isConnected(t){if(void 0===_){var e;const t=null===(e=Object.getOwnPropertyDescriptor(b("Node"),"isConnected"))||void 0===e?void 0:e.get;_=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==_?void 0:_.call(t)},contains:(t,e)=>C("Node",t,"contains")(e),getRootNode:t=>C("Node",t,"getRootNode")(),host:t=>t&&"host"in t?k("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?k("Element",t,"shadowRoot"):null,querySelector:(t,e)=>C("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>C("Element",t,"querySelectorAll")(e),mutationObserver:I,patch:M};function A(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var x=0,T=0;function O(){x+=1}function E(){return x}function F(t,e){return(e!==x||t>6e4)&&(T+=1,!0)}var D=0,L=0,N=0,P={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},j=null,z=null,B=[],W=0,U=0,q={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function G(t){var e;(D+=1)>1||(P={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},B=[],W=0,z=(e=t)&&e>0?e:null,L=A(),N=x)}function V(){return 0===D?j||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(D-=1)>0?P:(P.durationMs=A()-L,P.deferredStylesheetCount=W,H.deferredCount+=W,z=null,F(P.durationMs,N)?P:j=P)}function Z(t,e,n){let i=t.length;if(n>=32)return i;for(let r=0;t.length>r;r++){const s=t[r];try{const t=s.cssRules;if(t&&t.length)i+=Z(t,e,n+1);else if(e&&s.styleSheet){const t=s.styleSheet;if(!e.has(t)){e.add(t);const r=t.rules||t.cssRules;r&&(i+=Z(r,e,n+1))}}}catch(t){}}return i}function J(t){if(0===D)return;const e=Z(t,null,0);P.cssRuleCount+=e,U>0&&(P.nonDeferrableCssRuleCount+=e)}function Q(t){U+=1;try{return t()}finally{U-=1}}function X(t){D>0&&(P.stylesheetMs+=t)}function Y(t){if(0===D||null===z)return!1;const e=P.cssRuleCount-P.nonDeferrableCssRuleCount;return e>=z||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const n=new WeakSet;return n.add(t),Z(e,n,0)}catch(t){return 0}}(t)>z}function K(){const t=B;return B=[],t}function tt(){H.failedCount+=1}function et(t){t>0&&(H.abandonedCount+=t)}function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function it(t,e,n){return(e=function(t){var e=function(t){if("object"!=nt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rt(t){return t.nodeType===t.ELEMENT_NODE}function st(t){const e=t&&"host"in t&&"mode"in t&&R.host(t)||null;return Boolean(e&&"shadowRoot"in e&&R.shadowRoot(e)===t)}function ot(t){return"[object ShadowRoot]"==={}.toString.call(t)}function at(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function lt(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const n=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?n.push("layer"):t.layerName&&n.push(`layer(${t.layerName})`),t.supportsText&&n.push(`supports(${t.supportsText})`),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}var ut=0;function ct(t){const e=0===ut,n=e?A():0;ut+=1;try{const e=t.rules||t.cssRules;if(!e)return null;J(e);let n=t.href;return!n&&t.ownerNode&&(n=t.ownerNode.baseURI),at(Array.from(e,t=>ht(t,n)).join(""))}catch(t){return null}finally{ut-=1,e&&X(A()-n)}}function ht(t,e){if(ft(t)){let e;try{e=ct(t.styleSheet)||lt(t)}catch(n){e=t.cssText}try{var n;if(e&&(null===(n=t.styleSheet)||void 0===n?void 0:n.href))return xt(e,t.styleSheet.href)}catch(t){}return e}{let n=t.cssText;return vt(t)&&t.selectorText.includes(":")&&(n=dt(n)),e?xt(n,e):n}}function dt(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function ft(t){return"styleSheet"in t}function vt(t){return"selectorText"in t}var pt=/^-?[A-Za-z_][\w-]*$/,mt=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function gt(t){const e=[];let n=!1,i=null;const r=new Map;function s(t){const r=e.pop();if("group"===r.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void s(null)}const n=e[e.length-1];return n.parts.push(t),void(n.index+=1)}if(!r.importRule)return n=!0,void(i=t);o(e[e.length-1],r.importRule,t)}function o(t,e,n){try{let r;try{r=n||lt(e)}catch(t){r=e.cssText}try{var i;r&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href)&&(r=xt(r,e.styleSheet.href))}catch(t){}r&&t.parts.push(r),t.index+=1}catch(t){s(null)}}function a(t){const n=t.rules[t.index];if("sheet"===t.kind&&ft(n)){const i=r.get(n);return null===i?(t.parts.push(n.cssText),void(t.index+=1)):i?void e.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:n}):void o(t,n,null)}if(function(t,n){try{const i=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(vt(t)){if("number"==typeof e.type&&1!==e.type)return null;const n=e.style?e.style.cssText:"";return`${t.selectorText} {${n?" "+n:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!pt.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let i="";try{var n;i=(null===(n=t.constructor)||void 0===n?void 0:n.name)||""}catch(t){return null}return""===i||"Object"===i||"CSSSupportsRule"===i?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?pt.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":mt.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===i)return!1;const r=n.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:r,index:0,parts:[],prelude:r?xt(i,r):i,fixColons:"sheet"===n.kind&&vt(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(n,t))return;let i=n.cssText;"sheet"===t.kind&&vt(n)&&n.selectorText.includes(":")&&(i=dt(i)),t.parts.push(t.sheetHref?xt(i,t.sheetHref):i),t.index+=1}return function(t){try{const n=t.rules||t.cssRules;if(!n)return!1;J(n);let i=t.href;!i&&t.ownerNode&&(i=t.ownerNode.baseURI);const s=Array.from(n);return e.push({kind:"sheet",sheet:t,rules:s,sheetHref:i,index:0,parts:[],importRule:null}),function(t,e){const n=[{sheet:e,rules:t,index:0}];for(;n.length>0;){const t=n[n.length-1];if(t.index>=t.rules.length){n.pop();continue}const e=t.rules[t.index];if(t.index+=1,!ft(e)||r.has(e))continue;let i=null;try{i=e.styleSheet}catch(t){r.set(e,null);continue}if(i&&!n.some(t=>t.sheet===i))try{const t=i.rules||i.cssRules;if(!t)continue;J(t);let s=i.href;!s&&i.ownerNode&&(s=i.ownerNode.baseURI);const o=Array.from(t);r.set(e,{sheet:i,rules:o,sheetHref:s}),n.push({sheet:i,rules:o,index:0})}catch(t){}}}(s,t),!0}catch(t){return!1}}(t)||(n=!0),{advance(t){if(n)return!0;const r=A();let o=t>0?t:1;try{for(;!n&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const n=t.prelude+t.parts.join("")+"}";e=t.fixColons?dt(n):n}else e=at(t.parts.join(""))}catch(t){}s(e);continue}o-=1;try{a(t)}catch(t){s(null)}}}catch(t){n=!0,i=null}finally{X(A()-r)}return n},text:()=>n?i:null,remainingRules(){if(n)return 0;let t=0;for(const n of e)t+=n.rules.length-n.index;return t}}}var yt=class{constructor(){it(this,"idNodeMap",new Map),it(this,"nodeMetaMap",new WeakMap)}getId(t){var e,n;return t&&null!==(e=null===(n=this.getMeta(t))||void 0===n?void 0:n.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),rt(t)){const e=R.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const n=this.getNode(t);if(n){const t=this.nodeMetaMap.get(n);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function bt({element:t,maskInputOptions:e,tagName:n,type:i,value:r,maskInputFn:s}){let o=r||"";const a=i&&wt(i);return(e[n.toLowerCase()]||a&&e[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function wt(t){return t.toLowerCase()}var kt=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function _t({element:t,name:e,value:n,maskAllElementAttributes:i,maskAttributeFn:r,isGenerated:s=!1}){return n?i?s&&kt.has(wt(e))?n:"*".repeat(n.length):r?r(e,n,t):n:n}var St="__rrweb_original__";function Ct(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?wt(e):null}catch(t){return null}}var It=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Mt=/^(?:[a-z+]+:)?\/\//i,Rt=/^www\..*/i,At=/^(data:)([^,]*),(.*)/i;function xt(t,e){return(t||"").replace(It,(t,n,i,r,s,o)=>{const a=i||s||o,l=n||r||"";if(!a)return t;if(Mt.test(a)||Rt.test(a))return`url(${l}${a}${l})`;if(At.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+a}${l})`;const u=e.split("/"),c=a.split("/");u.pop();for(const t of c)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${l}${u.join("/")}${l})`})}var Tt,Ot,Et=new Map,Ft=1,$t=new RegExp("[^a-z0-9-_:]");function Dt(){return Ft++}var Lt=!1,Nt=/^[^ \t\n\r\u000c]+/,Pt=/^[, \t\n\r\u000c]+/,jt=new WeakMap;function zt(t,e){return e&&""!==e.trim()?Bt(t,e):e}function Bt(t,e){let n=jt.get(t);if(n||(n=t.createElement("a"),jt.set(t,n)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return n.setAttribute("href",e),n.href}function Wt(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function Ut(t,e,n,i,r,s){if(!i)return i;if("src"===n||"href"===n&&("use"!==e||"#"!==i[0])){if("link"===e&&r){var o;const t=null===(o=r.sheet)||void 0===o?void 0:o.href;if(t)return t}const n=zt(t,i);if(n.startsWith("data:")){if("img"===e&&r){let t=n;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(t=function(t,e,n,i){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const r=Et.get(e);if(r&&r.type===n&&r.quality===i)return r.result;try{const r=document.createElement("canvas");r.width=t.naturalWidth,r.height=t.naturalHeight;const s=r.getContext("2d");if(!s)return e;s.drawImage(t,0,0);const o=r.toDataURL(n||"image/webp",null!=i?i:.4),a=e.length>o.length?o:e;if(Et.size>=10){const t=Et.keys().next().value;void 0!==t&&Et.delete(t)}return Et.set(e,{type:n,quality:i,result:a}),a}catch(t){return e}}(r,n,s.type,s.quality)),Wt(t,s)}if("image"===e)return Wt(n,s)}return n}if("xlink:href"===n&&"#"!==i[0]){const n=zt(t,i);return"image"===e&&n.startsWith("data:")?Wt(n,s):n}return"background"!==n||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===n?function(t,e){if(""===e.trim())return e;let n=0;function i(t){let i;const r=t.exec(e.substring(n));return r?(i=r[0],n+=i.length,i):""}const r=[];for(;i(Pt),e.length>n;){let s=i(Nt);if(","===s.slice(-1))s=zt(t,s.substring(0,s.length-1)),r.push(s);else{let i="";s=zt(t,s);let o=!1;for(;;){const t=e.charAt(n);if(""===t){r.push((s+i).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){n+=1,r.push((s+i).trim());break}"("===t&&(o=!0)}i+=t,n+=1}}}return r.join(", ")}(t,i):"style"===n?xt(i,Bt(t)):"object"===e&&"data"===n?zt(t,i):i:zt(t,i)}function qt(t,e,n){return("video"===t||"audio"===t)&&"autoplay"===wt(e)}function Ht(t){return"string"==typeof t&&wt(t).split(/\s+/).includes("stylesheet")}function Gt(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&Gt(R.parentNode(t),e,n);for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;return!!n&&Gt(R.parentNode(t),e,n)}function Vt(t,e,n,i){let r;if(rt(t)){if(r=t,!R.childNodes(r).length)return!1}else{if(null===R.parentElement(t))return!1;r=R.parentElement(t)}try{if("string"==typeof e){if(i){if(r.closest(`.${e}`))return!0}else if(r.classList.contains(e))return!0}else if(Gt(r,e,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(t){}return!1}function Zt(t,e,n){const i=t.removeEventListener;"function"==typeof i&&i.call(t,e,n)}var Jt=new Map;function Qt(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Xt(t){return null==t?"":t.toLowerCase()}var Yt=!1,Kt=!1;function te(t,e){const{doc:n,mirror:i,blockClass:r,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g={},inlineImages:y=!1,recordCanvas:b=!1,canvasMaskingConfigured:w,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S=5e3,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:M=5e3,keepIframeSrcFn:A=()=>!1,newlyAddedElement:x=!1,depth:T=0,maxDepth:O=50}=e;let{needsMask:E}=e,{preserveWhiteSpace:F=!0}=e;if(T>=O)return Kt=!0,Yt||(Yt=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${O}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;E||(E=Vt(t,o,a,void 0===E)),D>0&&(P.nodeCount+=1);const L=function(t,e){const{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAllElementAttributes:h=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:p,recordCanvas:m,canvasMaskingConfigured:g,keepIframeSrcFn:y,newlyAddedElement:b=!1}=e,w=function(t,e){if(!e.hasNode(t))return;const n=e.getId(t);return 1===n?void 0:n}(n,i);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:f.Document,childNodes:[],compatMode:t.compatMode}:{type:f.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e){const{doc:n,blockClass:i,blockSelector:r,inlineStylesheet:s,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:u,dataURLOptions:c={},inlineImages:h,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:p,newlyAddedElement:m=!1,rootId:g}=e,y=function(t,e,n){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;if(n)return t.matches(n)}catch(t){}return!1}(t,i,r),b=function(t){if(t instanceof HTMLFormElement)return"form";const e=wt(t.tagName);return $t.test(e)?"div":e}(t),w=new Set;let k={};const _=t.attributes.length;for(let e=0;_>e;e++){const i=t.attributes[e];qt(b,i.name)||(k[i.name]=Ut(n,b,wt(i.name),i.value,t,c))}if("link"===b&&s&&!y&&Ht(k.rel)){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=Qt(n,i),!e&&i.includes(".css"))&&(e=Qt(n,window.location.origin+"/"+i.replace(window.location.href,"")))}let i=null;e&&(Y(e)?D>0&&(B.push(t),W+=1):i=ct(e)),i&&(delete k.rel,delete k.href,k._cssText=i)}var S;if("style"===b&&t.sheet&&!(t.innerText||R.textContent(t)||"").trim().length){const e=Q(()=>ct(t.sheet));e&&(k._cssText=e)}if("input"===b||"textarea"===b||"select"===b){const e=t.value,n=t.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&e?k.value=bt({element:t,type:Ct(t),tagName:b,value:e,maskInputOptions:o,maskInputFn:a}):n&&(k.checked=n)}if("option"===b&&(t.selected&&!o.select?k.selected=!0:delete k.selected),"dialog"===b&&t.open){try{k.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}w.add("rr_open_mode")}if("canvas"===b&&d&&!(null==v?void 0:v()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let n=0;t.width>n;n+=50)for(let i=0;t.height>i;i+=50){const r=e.getImageData,s=St in r?r[St]:r;let o;try{o=s.call(e,n,i,Math.min(50,t.width-n),Math.min(50,t.height-i))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(k.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){const e=t.toDataURL(c.type,c.quality),i=n.createElement("canvas");i.width=t.width,i.height=t.height,e!==i.toDataURL(c.type,c.quality)&&(k.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(S=t)?void 0:S.name)?Lt||(Lt=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",S)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",S)}let C,I=!1;if("img"===b&&h){Tt||(Tt=n.createElement("canvas"),Ot=Tt.getContext("2d"));const e=t,i=e.currentSrc||e.getAttribute("src")||"<unknown-src>",r=e.crossOrigin,s=(e,n)=>I?_t({element:t,name:e,value:n,maskAllElementAttributes:l,maskAttributeFn:u}):n,o=()=>{Zt(e,"load",o);try{Tt.width=e.naturalWidth,Tt.height=e.naturalHeight,Ot.drawImage(e,0,0);const t=Tt.toDataURL(c.type,c.quality);k.rr_dataURL=s("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${i}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(r?k.crossOrigin=s("crossOrigin",r):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===b||"video"===b){const e=k;e.rr_mediaState=t.paused?"paused":"played",w.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(m||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),y){var M,A,x;const{width:e,height:i,left:r,top:s}=t.getBoundingClientRect(),o=null===(M=n.defaultView)||void 0===M?void 0:M.getComputedStyle(t);k={class:k.class,rr_width:`${e}px`,rr_height:`${i}px`,rr_left:`${Math.floor(r+((null===(A=n.defaultView)||void 0===A?void 0:A.scrollX)||0))}px`,rr_top:`${Math.floor(s+((null===(x=n.defaultView)||void 0===x?void 0:x.scrollY)||0))}px`},w.add("rr_width"),w.add("rr_height"),w.add("rr_left"),w.add("rr_top"),o&&(k.rr_position=o.position||"static",w.add("rr_position"),o.transform&&"none"!==o.transform&&(k.rr_transform=o.transform,w.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(k.rr_display=o.display,w.add("rr_display")))}if("iframe"!==b||p(k.src)||(t.contentDocument||(k.rr_src=k.src),delete k.src),l||u)for(const[e,n]of Object.entries(k))"string"!=typeof n&&null!==n||(k[e]=_t({element:t,name:e,value:n,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:w.has(e)}));I=!0;try{customElements.get(b)&&(C=!0)}catch(t){}return{type:f.Element,tagName:b,attributes:k,childNodes:[],isSVG:(T=t,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:y,rootId:g,isCustom:C};var T}(t,{doc:n,blockClass:r,blockSelector:s,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:d,dataURLOptions:v,inlineImages:p,recordCanvas:m,canvasMaskingConfigured:g,keepIframeSrcFn:y,newlyAddedElement:b,rootId:w});case t.TEXT_NODE:return function(t,e){const{needsMask:n,maskTextFn:i,rootId:r}=e,s=R.parentNode(t),o=s&&s.tagName;let a=R.textContent(t);const l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var c;if(t.nextSibling||t.previousSibling);else if(Y(s.sheet));else if(null===(c=s.sheet)||void 0===c?void 0:c.cssRules){const t=ct(s.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(a=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}a=xt(a,Bt(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&n&&(a=i?i(a,R.parentElement(t)):a.replace(/[\S]/g,"*")),{type:f.Text,textContent:a||"",isStyle:l,rootId:r}}(t,{doc:n,needsMask:o,maskTextFn:u,rootId:w});case t.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:f.Comment,textContent:R.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:E,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,keepIframeSrcFn:A,newlyAddedElement:x});if(!L)return console.warn(t,"not serialized"),null;let N;N=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===f.Comment)return!0;if(t.type===f.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let n;try{n=new URL(t,window.location.href)}catch(t){return null}const i=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==i?void 0:i[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Xt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Xt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Xt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Xt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Xt(t.attributes.property).match(/^(og|twitter|fb):/)||Xt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Xt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Xt(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Xt(t.attributes.name))||Xt(t.attributes.property).match(/^article:/)||Xt(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Xt(t.attributes.name)))return!0}}return!1}(L,m)||!F&&L.type===f.Text&&!L.isStyle&&!L.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Dt();const j=Object.assign(L,{id:N});if(i.add(t,j),-2===N)return null;k&&k(t);let z=!l;if(j.type===f.Element){z=z&&!j.needBlock,delete j.needBlock;const e=R.shadowRoot(t);e&&ot(e)&&(j.isShadowHost=!0)}if((j.type===f.Document||j.type===f.Element)&&z){m.headWhitespace&&j.type===f.Element&&"head"===j.tagName&&(F=!1);const e={doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:E,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:A,depth:T+1,maxDepth:O};if(j.type===f.Element&&"textarea"===j.tagName&&void 0!==j.attributes.value);else for(const n of Array.from(R.childNodes(t))){const t=te(n,e);t&&j.childNodes.push(t)}let x=null;if(rt(t)&&(x=R.shadowRoot(t)))for(const t of Array.from(R.childNodes(x))){const n=te(t,e);n&&(ot(x)&&(n.isShadow=!0),j.childNodes.push(n))}}const U=R.parentNode(t);if(U&&st(U)&&ot(U)&&(j.isShadow=!0),j.type===f.Element&&"iframe"===j.tagName){const e=function(t,e,n){const i=()=>{},r=t.contentWindow;if(!r)return i;let s;try{s=r.document.readyState}catch(t){return i}const o=()=>e();if("complete"!==s){let i=!1,r=null;const s=()=>{i||(i=!0,null!==r&&(clearTimeout(r),r=null),Zt(t,"load",a),t.addEventListener("load",o),e())},a=()=>s();return r=setTimeout(s,n),t.addEventListener("load",a),()=>{null!==r&&(clearTimeout(r),r=null),i?Zt(t,"load",o):(i=!0,Zt(t,"load",a))}}const a="about:blank";let l;try{l=r.location.href}catch(t){return i}if(l!==a||t.src===a||""===t.src){const n=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(n),Zt(t,"load",o)}}return t.addEventListener("load",o),()=>{Zt(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&_){const n=te(e,{doc:e,mirror:i,blockClass:r,blockSelector:s,needsMask:E,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:A,depth:T+1,maxDepth:O});n&&_(t,n)}},S);null==C||C(t,e)}return j.type===f.Element&&"link"===j.tagName&&Ht(j.attributes.rel)&&function(e,l,f){if(Jt.has(e))return;let C;try{C=e.sheet}catch(t){return}if(C)return;const R=new AbortController;let x=!1;const D=()=>{if(!x){x=!0;try{(()=>{if(I){const e=te(t,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:E,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:A,depth:T,maxDepth:O});e&&I(t,e)}})()}finally{Jt.delete(e),R.abort()}}},L=setTimeout(D,f);R.signal.addEventListener("abort",()=>clearTimeout(L),{once:!0}),e.addEventListener("load",D,{signal:R.signal,once:!0}),Jt.set(e,R)}(t,0,M),j}function ee(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var ne=class t{constructor(...t){it(this,"parentElement",null),it(this,"parentNode",null),it(this,"ownerDocument",void 0),it(this,"firstChild",null),it(this,"lastChild",null),it(this,"previousSibling",null),it(this,"nextSibling",null),it(this,"ELEMENT_NODE",1),it(this,"TEXT_NODE",3),it(this,"nodeType",void 0),it(this,"nodeName",void 0),it(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function ie(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>re(n,t,e,i)}function re(t,e,n,i){se(()=>{const r=t.removeEventListener;"function"==typeof r&&(void 0!==i?r.call(t,e,n,i):r.call(t,e,n))})}function se(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function oe(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var ae="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.",le={map:{},getId(){return console.warn(ae),-1},getNode(){return console.warn(ae),null},removeNodeFromMap(){console.warn(ae)},has(){return console.warn(ae),!1},reset(){console.warn(ae)}};function ue(t,e,n={}){let i=null,r=0;return function(...s){const o=Date.now();r||!1!==n.leading||(r=o);const a=e-(o-r),l=this;0>=a||a>e?(i&&(clearTimeout(i),i=null),r=o,t.apply(l,s)):i||!1===n.trailing||(i=setTimeout(()=>{r=!1===n.leading?0:Date.now(),i=null,t.apply(l,s)},a))}}function ce(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e),o=()=>ce(t,e,s||{},!0);if(i)return r.Object.defineProperty(t,e,n),o;const a=function(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var n,i;const r=null===(n=t.Zone)||void 0===n||null===(i=n.__symbol__)||void 0===i?void 0:i.call(n,"setTimeout"),s=r?t[r]:void 0;"function"==typeof s&&(e=s)}catch(t){}if(!e)return()=>{};const r=e;return e=>{try{r.call(t,e,0)}catch(t){}}}(r);return r.Object.defineProperty(t,e,{set(t){if(a(()=>{try{n.set.call(this,t)}catch(t){}}),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(le=new Proxy(le,{get(t,e,n){return"map"===e&&console.warn(ae),Reflect.get(t,e,n)}}));var he=Date.now;function de(t){var e,n,i,r;const s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null===(e=R.parentElement(s.body))||void 0===e?void 0:e.scrollLeft)||(null==s||null===(n=s.body)||void 0===n?void 0:n.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null===(i=R.parentElement(s.body))||void 0===i?void 0:i.scrollTop)||(null==s||null===(r=s.body)||void 0===r?void 0:r.scrollTop)||0}}function fe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ve(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function pe(t){return t?t.nodeType===t.ELEMENT_NODE?t:R.parentElement(t):null}function me(t,e,n,i){if(!t)return!1;const r=pe(t);if(!r)return!1;try{if("string"==typeof e){if(r.classList.contains(e))return!0;if(i&&null!==r.closest("."+e))return!0}else if(Gt(r,e,i))return!0}catch(t){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function ge(t,e,n){return!("TITLE"!==t.tagName||!n.headTitleMutations)||-2===e.getId(t)}function ye(t,e){if(st(t))return!1;const n=e.getId(t);if(!e.has(n))return!0;const i=R.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||ye(i,e))}function be(t){return Boolean(t.changedTouches)}function we(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function ke(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function _e(t){return!!t&&(t instanceof ne&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(R.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(he=()=>(new Date).getTime());var Se=class{constructor(){it(this,"id",1),it(this,"styleIDMap",new WeakMap),it(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let n;return n=void 0===e?this.id++:e,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ce(t){var e;let n=null;return"getRootNode"in t&&(null===(e=R.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&R.host(R.getRootNode(t))&&(n=R.host(R.getRootNode(t))),n}function Ie(t){const e=t.ownerDocument;if(!e)return!1;if(R.contains(e,t))return!0;const n=R.isConnected(t);return"boolean"==typeof n?n:function(t){const e=t.ownerDocument;if(!e)return!1;const n=function(t){let e,n=t;for(;e=Ce(n);)n=e;return n}(t);return R.contains(e,n)}(t)}function Me(t){return"__ln"in t}var Re,Ae=class{constructor(){it(this,"length",0),it(this,"head",null),it(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let n=0;t>n;n++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Me(t.previousSibling)){const n=t.previousSibling.__ln.next;e.next=n,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,n&&(n.previous=e)}else if(t.nextSibling&&Me(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;e.previous=n,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,n&&(n.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},xe=(t,e)=>`${t}@${e}`,Te=class{constructor(){it(this,"frozen",!1),it(this,"locked",!1),it(this,"texts",[]),it(this,"attributes",[]),it(this,"attributeMap",new WeakMap),it(this,"generatedAttributes",new WeakMap),it(this,"removes",[]),it(this,"mapRemoves",new Set),it(this,"movedMap",{}),it(this,"addedSet",new Set),it(this,"movedSet",new Set),it(this,"droppedSet",new Set),it(this,"removesSubTreeCache",new Set),it(this,"mutationCb",void 0),it(this,"blockClass",void 0),it(this,"blockSelector",void 0),it(this,"maskTextClass",void 0),it(this,"maskTextSelector",void 0),it(this,"inlineStylesheet",void 0),it(this,"maskInputOptions",void 0),it(this,"maskTextFn",void 0),it(this,"maskInputFn",void 0),it(this,"maskAllElementAttributes",void 0),it(this,"maskAttributeFn",void 0),it(this,"keepIframeSrcFn",void 0),it(this,"recordCanvas",void 0),it(this,"canvasMaskingConfigured",void 0),it(this,"inlineImages",void 0),it(this,"slimDOMOptions",void 0),it(this,"dataURLOptions",void 0),it(this,"doc",void 0),it(this,"mirror",void 0),it(this,"iframeManager",void 0),it(this,"stylesheetManager",void 0),it(this,"shadowDomManager",void 0),it(this,"canvasManager",void 0),it(this,"processedNodeManager",void 0),it(this,"unattachedDoc",void 0),it(this,"canvasManagerReleased",!1),it(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),it(this,"emit",()=>{if(this.frozen||this.locked)return;const t=A(),e=E();try{this.processBufferedMutations()}finally{n=A()-t,i=e,D>0||F(n,null!=i?i:x)||n>q.slowestBatchMs&&(q.slowestBatchMs=n)}var n,i}),it(this,"processBufferedMutations",()=>{const t=[],e=new Set,n=new Ae,i=t=>{let e=t,n=-2;for(;-2===n;)e=e&&e.nextSibling,n=e&&this.mirror.getId(e);return n};let r;const s=s=>{var o;const a=R.parentNode(s);if(!a||!Ie(s)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=st(a)?this.mirror.getId(Ce(s)):this.mirror.getId(a),u=i(s);if(-1===l||-1===u)return n.addNode(s);null!==(o=r)&&void 0!==o||(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,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{we(t,this.mirror)&&this.iframeManager.addIframe(t),ke(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),_e(t)&&!me(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(R.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const c=te(s,r);c&&(t.push({parentId:l,nextId:u,node:c}),e.add(c.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)Ee(this.removesSubTreeCache,t)&&!this.movedSet.has(R.parentNode(t))||s(t);for(const t of this.addedSet)Fe(this.droppedSet,t)||Ee(this.removesSubTreeCache,t)?Fe(this.movedSet,t)?s(t):this.droppedSet.add(t):s(t);let o=null;for(;n.length;){let t=null;if(o){const e=this.mirror.getId(R.parentNode(o.value)),n=i(o.value);-1!==e&&-1!==n&&(t=o)}if(!t){let e=n.tail;for(;e;){const n=e;if(e=e.previous,n){const e=this.mirror.getId(R.parentNode(n.value));if(-1===i(n.value))continue;if(-1!==e){t=n;break}{const e=R.parentNode(n.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=R.host(e);if(-1!==this.mirror.getId(i)){t=n;break}}}}}}if(!t){for(;n.head;)n.removeNode(n.head.value);break}o=t.previous,n.removeNode(t.value),s(t.value)}const a={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,n=R.parentNode(e);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const n=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>n.length&&(n+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[i,r]of Object.entries(e))if("string"==typeof r||null===r){var n;e[i]=_t({element:t.node,name:i,value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(n=this.generatedAttributes.get(t.node))||void 0===n?void 0:n.has(i)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),it(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),it(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const n=Array.from(R.childNodes(t),t=>R.textContent(t)||"").join("");e.attributes.value=bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Ct(t),value:n,maskInputFn:this.maskInputFn})}),it(this,"processMutation",t=>{if(!ge(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=R.textContent(t.target);me(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Vt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,pe(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const i=t.target,r=wt(i.tagName),s=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let a=function(t,e,n){if(!n)return e;const i=t.getAttributeNodeNS(n,e);if(i)return i.name;if("http://www.w3.org/1999/xlink"===n)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===n)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===n)return"xmlns"===e?e:`xmlns:${e}`;const r=t.lookupPrefix(n);return r?`${r}:${e}`:e}(i,s,o),l=o?i.getAttributeNS(o,s):t.target.getAttribute(s);if("value"===a){const t=i,e=Ct(t);l=bt({element:t,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(me(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let u=this.attributeMap.get(t.target);const c="iframe"===r&&"src"===a;if(c&&!this.keepIframeSrcFn(l)&&i.contentDocument)return;if("type"===a&&"input"===r&&"password"===(t.oldValue||"").toLowerCase()&&i.setAttribute("data-rr-is-password","true"),!qt(r,a)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=Ut(this.doc,r,wt(a),l,i,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(l)&&(a="rr_src"),u.attributes[a]=e,null===(n=this.generatedAttributes.get(t.target))||void 0===n||n.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),n=i.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(n)){const i=n.getPropertyValue(t),r=n.getPropertyPriority(t);i!==e.style.getPropertyValue(t)||r!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===r?i:[i,r]:u._unchangedStyles[t]=[i,r]}for(const t of Array.from(e.style))""===n.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===a&&"dialog"===r){u.attributes.rr_open_mode=i.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(me(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const n=this.mirror.getId(e),i=st(t.target)?this.mirror.getId(R.host(t.target)):this.mirror.getId(t.target);me(t.target,this.blockClass,this.blockSelector,!1)||ge(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Oe(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||ye(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[xe(n,i)]?Oe(this.movedSet,e):(this.removes.push({parentId:i,id:n,isShadow:!(!st(t.target)||!ot(t.target))||void 0}),function(t,e){const n=[t];for(;n.length;){const t=n.pop();e.has(t)||(e.add(t),R.childNodes(t).forEach(t=>n.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),it(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(ge(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;e&&this.mirror.hasNode(e)&&(n=this.mirror.getId(e)),n&&-1!==n&&(this.movedMap[xe(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!me(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=R.childNodes(t);for(let t=0,n=e.length;n>t;t++){const n=e[t];n&&this.genAdds(n)}if(_e(t)){const e=R.childNodes(R.shadowRoot(t));for(let n=0,i=e.length;i>n;n++){const i=e[n];i&&(this.processedNodeManager.add(i,this),this.genAdds(i,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,n=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(n&&(n.lastIndex=0),me(t,n||e,this.blockSelector,!0))return!0;const i="getRootNode"in t?R.getRootNode(t):null;t=(null==i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?R.host(i):null}return!1}};function Oe(t,e){const n=[e];for(;n.length;){const e=n.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const i=R.childNodes(e);for(let t=0,e=i.length;e>t;t++){const e=i[t];e&&n.push(e)}}}function Ee(t,e,n){return 0!==t.size&&function(t,e){const n=R.parentNode(e);return!!n&&t.has(n)}(t,e)}function Fe(t,e){if(0===t.size)return!1;let n=R.parentNode(e);for(;n;){if(t.has(n))return!0;n=R.parentNode(n)}return!1}function $e(t){Re=t}function De(){Re=void 0}var Le=(t,e="rrweb")=>Re?(...n)=>{try{return t(...n)}catch(t){if(Re&&!0===Re(t,e))return;throw t}}:t,Ne=[];function Pe(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function je(t,e){const n=new Te;let i;n.init(t);try{i=new(I())(Le(n.processMutations.bind(n)));const r={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(r.attributeFilter=t.attributeFilter),i.observe(e,r),Ne.push(n),{observer:i,buffer:n}}catch(t){try{null==i||i.disconnect(),n.destroy(),n.reset()}catch(t){}throw t}}function ze({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){const o=new Map,a=s=>{const a=Pe(s);if(!a||me(a,i,r,!0))return;const l=n.getId(a);let u,c;if(a===e&&e.defaultView){const t=de(e.defaultView);u=t.left,c=t.top}else u=a.scrollLeft,c=a.scrollTop;const h=`${u},${c}`;o.get(l)!==h&&(o.set(l,h),t({id:l,x:u,y:c}))},l=[ie("scroll",Le(ue(Le(t=>a(t)),s.scroll||100)),e)];return"onscrollend"in e&&l.push(ie("scrollend",Le(a),e)),()=>l.forEach(t=>t())}function Be(t,e){for(let n=Ne.length-1;n>=0;n--){const i=Ne[n];if(!i)continue;let r=i.bufferBelongsToIframe(t);!r&&e&&e.has(i.bufferDoc())&&(r=!0),r&&(i.reset(),Ne.splice(n,1))}}var We=["INPUT","TEXTAREA","SELECT"],Ue=new WeakMap;function qe(t){return function t(e,n){if(Je("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Je("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Je("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Je("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const i=Array.from(e.parentRule.cssRules).indexOf(e);return n.unshift(i),t(e.parentRule,n)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);n.unshift(t)}return n}(t,[])}function He(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function Ge({mirror:t,stylesheetManager:e},n){var i,r;let s=null;s=t.getId("#document"===n.nodeName?n:R.host(n));const o="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(r=n.ownerDocument)||void 0===r||null===(r=r.defaultView)||void 0===r?void 0:r.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&a?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let n;try{var i;n=null===(i=a.set)||void 0===i?void 0:i.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{e.adoptStyleSheets(t,s)}catch(t){}return n}}),Le(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Ve=new Set;function Ze(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let r,s;!function(t,e){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:d,selectionCb:f,customElementCb:v}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),n(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),i(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),r(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),s(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),c(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),f(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),v(...t)}}(t,e);const o=[],a=Le(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Ne.indexOf(s);-1!==t&&Ne.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect()}finally{oe(o)}}),h=(t,e)=>{const n=Le(()=>{try{return e()}catch(e){throw Ve.add(t),e}})();"function"==typeof n&&o.push(n)};try{if(t.recordDOM&&h("mutation",()=>{const e=je(t,t.doc);r=e.observer,s=e.buffer}),h("move",()=>function({mousemoveCb:t,sampling:e,doc:n,mirror:i}){if(!1===e.mousemove)return()=>{};const r="number"==typeof e.mousemove?e.mousemove:50,s="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const u=ue(Le(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null}),s),c=Le(ue(Le(t=>{const e=Pe(t),{clientX:n,clientY:r}=be(t)?t.changedTouches[0]:t;o||(o=he()),a.push({x:n,y:r,id:i.getId(e),timeOffset:he()-o}),u("undefined"!=typeof DragEvent&&t instanceof DragEvent?l.Drag:t instanceof MouseEvent?l.MouseMove:l.TouchMove)}),r,{trailing:!1})),h=[ie("mousemove",c,n),ie("touchmove",c,n),ie("drag",c,n)];return Le(()=>{h.forEach(t=>t())})}(t)),h("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,l=[];let h=null;return Object.keys(u).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==a[t]).forEach(o=>{let a=wt(o);const d=(e=>o=>{const a=Pe(o);if(me(a,r,s,!0))return;let l=null,d=e;if("pointerType"in o){switch(o.pointerType){case"mouse":l=c.Mouse;break;case"touch":l=c.Touch;break;case"pen":l=c.Pen}l===c.Touch&&(u[e]===u.MouseDown?d="TouchStart":u[e]===u.MouseUp&&(d="TouchEnd"))}else be(o)&&(l=c.Touch);null!==l?(h=l,(d.startsWith("Touch")&&l===c.Touch||d.startsWith("Mouse")&&l===c.Mouse)&&(l=null)):u[e]===u.Click&&(l=h,h=null);const f=be(o)?o.changedTouches[0]:o;if(!f)return;const v=n.getId(a),{clientX:p,clientY:m}=f;Le(t)(i({type:u[d],id:v,x:p,y:m},null!==l&&{pointerType:l}))})(o);if(window.PointerEvent)switch(u[o]){case u.MouseDown:case u.MouseUp:a=a.replace("mouse","pointer");break;case u.TouchStart:case u.TouchEnd:return}l.push(ie(a,d,e))}),Le(()=>{l.forEach(t=>t())})}(t)),h("scroll",()=>ze(t)),h("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let n=-1,i=-1;return ie("resize",Le(ue(Le(()=>{const e=fe(),r=ve();n===e&&i===r||(t({width:Number(r),height:Number(e)}),n=e,i=r)}),200)),e)}(t,{win:n})),h("input",()=>function({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:u,sampling:c,userTriggeredOnInput:h}){function d(t){let n=Pe(t);const i=t.isTrusted,c=e.defaultView;if(n&&c&&!(n instanceof c.HTMLElement))return;const d=n&&n.tagName;if(n&&"OPTION"===d&&(n=R.parentElement(n)),!n||!d||0>We.indexOf(d)||me(n,r,s,!0))return;if(n.classList.contains(o)||a&&n.matches(a))return;let v=n.value,p=!1;const m=Ct(n)||"";"radio"===m||"checkbox"===m?p=n.checked:(l[d.toLowerCase()]||l[m])&&(v=bt({element:n,maskInputOptions:l,tagName:d,type:m,value:v,maskInputFn:u})),f(n,h?{text:v,isChecked:p,userTriggered:i}:{text:v,isChecked:p});const g=n.name;"radio"===m&&g&&p&&e.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(t=>{if(t!==n){const e=t.value;f(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function f(e,r){const s=Ue.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Ue.set(e,r);const s=n.getId(e);Le(t)(i(i({},r),{},{id:s}))}}const v=("last"===c.input?["change"]:["input","change"]).map(t=>ie(t,Le(d),e)),p=e.defaultView;if(!p)return()=>{v.forEach(t=>t())};const m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&v.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map(t=>ce(t[0],t[1],{set(){Le(d)({target:this,isTrusted:!1})}},!1,p))),Le(()=>{oe(v)})}(t)),h("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r,doc:s}){const o=Le(s=>ue(Le(r=>{const o=Pe(r);if(!o||me(o,e,n,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:h}=o;t({type:s,id:i.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:h})}),r.media||500)),a=[ie("play",o(d.Play),s),ie("pause",o(d.Pause),s),ie("seeked",o(d.Seeked),s),ie("volumechange",o(d.VolumeChange),s),ie("ratechange",o(d.RateChange),s)];return Le(()=>{a.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,n=new Set;let i=!0;const r=t=>{if(i)try{t()}catch(t){}},s=t=>{var n;const i=e.get(t);if(i){for(;null===(n=i[0])||void 0===n?void 0:n.ready;){const t=i.shift();(null==t?void 0:t.emit)&&r(t.emit)}0===i.length&&e.delete(t)}};return{queueMutation(t,n){if(!t)return void r(n);const i=e.get(t);i?(i.push({emit:n,ready:!0}),s(t)):r(n)},queuePendingMutation(o,a,l){if(!i)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const c={emit:a,ready:!1};u.push(c);let h,d=!1,f=!1;const v=()=>{d||f||(d=!0,void 0!==h&&n.delete(h),c.ready=!0,c.emit=void 0,s(o))};try{h=t.setTimeout(v,5e3),d||f?t.clearTimeout(h):n.add(h)}catch(t){v()}return e=>{!f&&i&&(f=!0,void 0!==h&&(t.clearTimeout(h),n.delete(h)),d?e&&r(l):(c.ready=!0,e||(c.emit=void 0),s(o)))}},reset(){i=!1,n.forEach(e=>t.clearTimeout(e)),n.clear(),e.clear()}}}(n);o.push(e.reset),h("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:i,mutationQueue:r}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=He(s,e,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&r.queueMutation(s,()=>t({id:u,styleId:c,adds:[{rule:a,index:l}]})),l},"host")}),i.CSSStyleSheet.prototype.addRule=function(t,e,n=this.cssRules.length){return i.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,n])};const o=i.CSSStyleSheet.prototype.deleteRule;let a,l;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=He(s,e,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&r.queueMutation(s,()=>t({id:u,styleId:c,removes:[{index:a}]})),l},"host")}),i.CSSStyleSheet.prototype.removeRule=function(t){return i.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},i.CSSStyleSheet.prototype.replace&&(a=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);try{const i=null==l?void 0:l.then;if(s.ownerNode||!l||"function"!=typeof i)return l;n.onCssomSheetMutation(s);const{id:o,styleId:u}=He(s,e,n.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return l;const c=r.queuePendingMutation(s,()=>t({id:o,styleId:u,replace:a}),()=>{const e=ct(s);null!==e&&t({id:o,styleId:u,replace:e})});try{i.call(l,()=>c(!0),()=>c(!1))}catch(t){c(!1)}}catch(t){}return l},"host")})),i.CSSStyleSheet.prototype.replaceSync&&(l=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=He(s,e,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&r.queueMutation(s,()=>t({id:u,styleId:c,replaceSync:a})),l},"host")}));const u={};Qe("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(Qe("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),Qe("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),Qe("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const c={};return Object.entries(u).forEach(([i,s])=>{c[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(c[i].insertRule,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=He(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...qe(s),l];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,adds:[{rule:a,index:e}]}))}return l},"host")}),s.prototype.deleteRule=new Proxy(c[i].deleteRule,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=He(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...qe(s),a];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),Le(()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=o,a&&(i.CSSStyleSheet.prototype.replace=a),l&&(i.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})})}(t,{win:n,mutationQueue:e})),h("adoptedStyleSheet",()=>Ge(t,t.doc)),h("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:i},{win:r,mutationQueue:s}){const o=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Le((r,o,a)=>{var l;const[u,c,h]=a,d=r.apply(o,a);if(n.has(u))return d;const f=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;i.onCssomSheetMutation(f);const{id:v,styleId:p}=He(f,e,i.styleMirror);if(v&&-1!==v||p&&-1!==p){const e=qe(o.parentRule);s.queueMutation(f,()=>t({id:v,styleId:p,set:{property:u,value:c,priority:h},index:e}))}return d},"host")});const a=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Le((r,o,a)=>{var l;const[u]=a,c=r.apply(o,a);if(n.has(u))return c;const h=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;i.onCssomSheetMutation(h);const{id:d,styleId:f}=He(h,e,i.styleMirror);if(d&&-1!==d||f&&-1!==f){const e=qe(o.parentRule);s.queueMutation(h,()=>t({id:d,styleId:f,remove:{property:u},index:e}))}return c},"host")}),Le(()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:n,mutationQueue:e})),t.collectFonts&&h("font",()=>function({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const i=[],r=new WeakMap,s=n.FontFace;n.FontFace=function(t,e,n){const i=new s(t,e,n);return r.set(i,{family:t,buffer:"string"!=typeof e,descriptors:n,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};const o=M(e.fonts,"add",function(e){return function(n){return setTimeout(Le(()=>{const e=r.get(n);e&&(t(e),r.delete(n))}),0),e.apply(this,[n])}});return i.push(()=>{n.FontFace=s}),i.push(o),Le(()=>{i.forEach(t=>t())})}(t))}h("selection",()=>function(t){const{doc:e,mirror:n,blockClass:i,blockSelector:r,selectionCb:s}=t;let o=!0;const a=Le(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;l>e;e++){const{startContainer:s,startOffset:o,endContainer:l,endOffset:u}=t.getRangeAt(e);me(s,i,r,!0)||me(l,i,r,!0)||a.push({start:n.getId(s),startOffset:o,end:n.getId(l),endOffset:u})}s({ranges:a})});return a(),ie("selectionchange",a)}(t)),h("customElement",()=>function({doc:t,customElementCb:e}){const n=t.defaultView;return n&&n.customElements?M(n.customElements,"define",function(t){return function(n,i,r){try{e({define:{name:n}})}catch(t){console.warn(`Custom element callback failed for ${n}`)}return t.apply(this,[n,i,r])}}):()=>{}}(t));for(const e of t.plugins)h(`plugin:${e.name}`,()=>e.observer(e.callback,n,e.options))}catch(t){try{a()}catch(t){}throw t}return a}function Je(t){return void 0!==window[t]}function Qe(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Xe=class{constructor(t){it(this,"generateIdFn",void 0),it(this,"iframeRemoteIdToLocalIdMap",new WeakMap),it(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,n,i){if(0>e)return e;const r=n||this.getRemoteIdToLocalIdMap(t),s=i||this.getLocalIdToRemoteIdMap(t);let o=r.get(e);return void 0===o&&(o=this.generateIdFn(),r.set(e,o),s.set(o,e)),o}getIds(t,e){const n=this.getRemoteIdToLocalIdMap(t),i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,n,i))}getRemoteId(t,e,n){var i;return"number"!=typeof e||0>e?e:null!==(i=(n||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==i?i:-1}getRemoteIds(t,e){const n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,n))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},Ye=class{constructor(t){it(this,"iframes",new WeakMap),it(this,"crossOriginIframeMap",new WeakMap),it(this,"crossOriginIframeMirror",new Xe(Dt)),it(this,"crossOriginIframeStyleMirror",void 0),it(this,"crossOriginIframeRootIdMap",new WeakMap),it(this,"mirror",void 0),it(this,"mutationCb",void 0),it(this,"wrappedEmit",void 0),it(this,"loadListener",void 0),it(this,"pageHideListener",void 0),it(this,"stylesheetManager",void 0),it(this,"recordCrossOriginIframes",void 0),it(this,"messageHandler",void 0),it(this,"nestedIframeListeners",new Map),it(this,"attachedWindows",new WeakMap),it(this,"attachedDocuments",new WeakMap),it(this,"attachedIframes",new Map),it(this,"loadListenerDisposers",new WeakMap),it(this,"iframeElementsById",new Map),it(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Xe(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let n=this.loadListenerDisposers.get(t);n||(n=new Set,this.loadListenerDisposers.set(t,n)),n.add(e);const i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,n,i;return null!==(e=null!==(n=null===(i=this.attachedIframes.get(t))||void 0===i?void 0:i.element)&&void 0!==n?n:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>se(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{re(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const n=this.mirror.getId(t);return this.attachedIframes.set(n,{element:t,content:e}),n}attachIframe(t,e){var n;const i=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const r=t.contentWindow;if(this.recordCrossOriginIframes&&r&&!this.nestedIframeListeners.has(r)){const e=this.handleMessage.bind(this);se(()=>{r.addEventListener("message",e),this.nestedIframeListeners.set(r,e);let n=this.attachedWindows.get(t);n||(n=new Set,this.attachedWindows.set(t,n)),n.add(r)})}se(()=>{const e=t.contentWindow;if(!e)return;let n=this.pageHideHandlers.get(t);if(n)for(const t of n)if(t.win===e)return;const i=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",i),n||(n=new Set,this.pageHideHandlers.set(t,n)),n.add({win:e,handler:i})}),null===(n=this.loadListener)||void 0===n||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const i=this.transformCrossOriginEvent(n,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case a.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const n=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,n),this.patchRootIdOnNode(e.data.node,n),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:a.IncrementalSnapshot,data:{source:l.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case a.Meta:case a.Load:case a.DomContentLoaded:return!1;case a.Plugin:return e;case a.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case a.IncrementalSnapshot:switch(e.data.source){case l.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const n=this.crossOriginIframeRootIdMap.get(t);n&&this.patchRootIdOnNode(e.node,n)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case l.Drag:case l.TouchMove:case l.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case l.ViewportResize:return!1;case l.MediaInteraction:case l.MouseInteraction:case l.Scroll:case l.CanvasMutation:case l.Input:return this.replaceIds(e.data,t,["id"]),e;case l.StyleSheetRule:case l.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case l.Font:return e;case l.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case l.AdoptedStyleSheet:var n;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(n=e.data.styles)||void 0===n||n.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,n,i){for(const r of i)(Array.isArray(e[r])||"number"==typeof e[r])&&(e[r]=Array.isArray(e[r])?t.getIds(n,e[r]):t.getId(n,e[r]));return e}replaceIds(t,e,n){return this.replace(this.crossOriginIframeMirror,t,e,n)}replaceStyleIds(t,e,n){return this.replace(this.crossOriginIframeStyleMirror,t,e,n)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===f.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),n=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),n){const t=n.contentWindow,e=this.attachedWindows.get(n);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(re(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(n)),t&&this.nestedIframeListeners.has(t)&&(re(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(n),this.disposeLoadListeners(n),this.removePageHideListener(n);const i=this.attachedDocuments.get(n);i&&(i.forEach(t=>{se(()=>this.mirror.removeNodeFromMap(t))}),se(()=>Be(n,i)),this.attachedDocuments.delete(n))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,n)=>{this.mirror.has(n)||t.push(n)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&re(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{re(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Ke=class{constructor(t){it(this,"shadowDoms",new WeakSet),it(this,"mutationCb",void 0),it(this,"scrollCb",void 0),it(this,"bypassOptions",void 0),it(this,"mirror",void 0),it(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var n,r;if(!ot(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(n=null===(r=R.host(t))||void 0===r?void 0:r.ownerDocument)&&void 0!==n?n:e,{observer:o,buffer:a}=je(i(i({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){o.disconnect(),a.destroy(),a.releaseCanvasManager();const t=Ne.indexOf(a);-1!==t&&Ne.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:ze(i(i({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(R.host(t))),this.restoreHandlers.push({doc:s,handler:Ge({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){se(()=>{const e=t.contentWindow,n=t.contentDocument;e&&n&&this.patchAttachShadow(e.Element,n)})}patchAttachShadow(t,e){const n=this;this.restoreHandlers.push({doc:e,handler:M(t.prototype,"attachShadow",function(t){return function(i){const r=t.call(this,i),s=R.shadowRoot(this);return s&&Ie(this)&&n.addShadowRoot(s,e),r}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const n of this.restoreHandlers)if(n.doc===t)try{n.handler()}catch(t){}else e.push(n);this.restoreHandlers=e}},tn="skip-frame";function en(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:n,width:i,height:r}=t;return Number.isFinite(e)&&Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(r)&&i>=0&&r>=0}for(var nn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),sn=0;64>sn;sn++)rn[nn.charCodeAt(sn)]=sn;var on=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;i>e;e+=3)r+=nn[n[e]>>2],r+=nn[(3&n[e])<<4|n[e+1]>>4],r+=nn[(15&n[e+1])<<2|n[e+2]>>6],r+=nn[63&n[e+2]];return i%3==2?r=r.substring(0,r.length-1)+"=":i%3==1&&(r=r.substring(0,r.length-2)+"=="),r},an=!1,ln=new Map,un=(t,e,n)=>{if(!t||!dn(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=ln.get(t);return n||(n=new Map,ln.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}(n,t.constructor.name);let r=i.indexOf(t);return-1===r&&(r=i.length,i.push(t)),r};function cn(t,e,n,i){if(t instanceof Array)return t.map(t=>cn(t,e,n,i));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:on(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[cn(t.buffer,e,n,i),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:n}=t;return{rr_type:e,src:n}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let n;try{n=t.toDataURL(i.type,i.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?an||(an=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:n}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[cn(t.data,e,n,i),t.width,t.height]}:dn(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:un(t,e,n)}:t}var hn=(t,e,n,i)=>t.map(t=>cn(t,e,n,i)),dn=(t,e)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(n.find(n=>t instanceof e[n]))},fn=["webgl","webgl2"];function vn(t){return"nodeType"in t}function pn(t,e,n,r){const s=[];try{if(r){const r=function(t,e,n){const r=t.GPUCanvasContext;if((null==r?void 0:r.prototype)&&"function"==typeof r.prototype.configure)return M(r.prototype,"configure",function(r){return function(s){const o=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!o||vn(o)&&me(o,e,n,!0))return r.call(this,s);vn(o)&&!("__context"in o)&&(o.__context="webgpu");const a=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return r.call(this,null!==a&&s?i(i({},s),{},{usage:"number"==typeof s.usage?s.usage|a:a}):s)}})}(t,e,n);r&&s.push(r)}const o=M(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(i,...s){const o=function(t){return"experimental-webgl"===t?"webgl":t}(i);if(!me(this,e,n,!0)&&("__context"in this||(this.__context=o),r&&fn.includes(o)))if(s[0]&&"object"==typeof s[0]){const t=s[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[i,...s])}});s.push(o)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function mn(t,e,n,i,r,s,o){const a=[],l=Object.getOwnPropertyNames(t);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const l=M(t,u,function(t){return function(...a){const l=t.apply(this,a);if(un(l,s,this),this.canvas&&"tagName"in this.canvas&&!me(this.canvas,i,r,!0)){let t;try{t=hn(a,s,this,o)}catch(t){}t&&n(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(s){const o=ce(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!me(this.canvas,i,r,!0)&&n(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var gn='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',yn="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",gn],{type:"text/javascript;charset=utf-8"});function bn(t){let e;try{if(e=yn&&(self.URL||self.webkitURL).createObjectURL(yn),!e)throw"";const n=new Worker(e,{name:null==t?void 0:t.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(gn),{name:null==t?void 0:t.name})}}var wn="A page CSP that omits blob: from worker-src or script-src blocks it";function kn(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var _n,Sn,Cn,In=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){it(this,"pendingCanvasMutations",new Map),it(this,"rafStamps",{latestId:0,invokeId:null}),it(this,"mirror",void 0),it(this,"mutationCb",void 0),it(this,"resetObservers",void 0),it(this,"frozen",!1),it(this,"locked",!1),it(this,"rafIdTimestamp",null),it(this,"rafIdFlush",null),it(this,"refCount",0),it(this,"torndown",!1),it(this,"resetFrameDedup",null),it(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:n,blockClass:i,blockSelector:r,recordCanvas:s,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&"all"===e&&this.initCanvasMutationObserver(n,i,r,o),s&&"number"==typeof e&&this.initCanvasFPSObserver(e,n,i,r,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(t,e,n,i,r){var o=this;if(!("OffscreenCanvas"in e))return void kn("disabled because this browser does not support OffscreenCanvas");const a="number"==typeof r.resolutionScale&&Number.isFinite(r.resolutionScale)?Math.min(1,Math.max(.1,r.resolutionScale)):1,l=pn(e,n,i,!0),u=new Map;let c;try{c=new bn}catch(t){return kn(`disabled because the encode worker did not start. ${wn}`,t),void l()}let d=!1;c.onerror=t=>{var e;d=!0,kn(`stopped because the encode worker failed. ${wn}`,t),cancelAnimationFrame(m),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=t=>{const{id:e}=t.data;if(u.set(e,!1),!("base64"in t.data))return;const{base64:n,type:i,displayWidth:r,displayHeight:s}=t.data;this.mutationCb({id:e,type:h["2D"],commands:[{property:"clearRect",args:[0,0,r,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0,r,s]}],displayWidth:r,displayHeight:s})};let f=!1,v=!1;const p=1e3/t;let m,g=0;const y=t=>{var l;d||(g&&p>t-g||(g=t,(()=>{const t=[],r=e=>{try{e.querySelectorAll("canvas").forEach(e=>{me(e,n,i,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&r(t.shadowRoot)})}catch(t){}};return r(e.document),t})().forEach((l=s(function*(t){const e=o.mirror.getId(t);if(-1!==e&&!u.get(e)&&0!==t.width&&0!==t.height){u.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var n,i;const r=t.getContext(t.__context);if(null==r||null===(n=r.isContextLost)||void 0===n?void 0:n.call(r))return void u.set(e,!1);!1===(null==r||null===(i=r.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&r.clear(r.COLOR_BUFFER_BIT)}const s=t.clientWidth||t.width,o=t.clientHeight||t.height,l=Math.max(1,Math.round(s*a)),h=Math.max(1,Math.round(o*a)),d=function(t,e,n,i,r,s){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return tn}if(void 0===o)return;if(!Array.isArray(o)||!o.every(en))return tn;const a=n/r,l=i/s;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*a),n=Math.floor(t.y*l);return{x:e,y:n,width:Math.ceil((t.x+t.width)*a)-e,height:Math.ceil((t.y+t.height)*l)-n}})}(r.canvasMasking,t,l,h,s,o);if("skip-frame"===d)return f||(f=!0,kn("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void u.set(e,!1);const v=yield createImageBitmap(t,1>a?{resizeWidth:l,resizeHeight:h,resizeQuality:"medium"}:{resizeWidth:l,resizeHeight:h});c.postMessage({id:e,bitmap:v,width:l,height:h,displayWidth:s,displayHeight:o,dataURLOptions:r.dataURLOptions,maskRegions:d},[v])}catch(t){v||(v=!0,kn("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),u.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),m=requestAnimationFrame(y))};m=requestAnimationFrame(y),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(m),null===(t=c.terminate)||void 0===t||t.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,n,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=pn(t,e,n,!1),s=function(t,e,n,i,r){const s=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])continue;const o=M(e.CanvasRenderingContext2D.prototype,a,function(s){return function(...o){return me(this.canvas,n,i,!0)||setTimeout(()=>{let n;try{n=hn(o,e,this,r)}catch(t){return}t(this.canvas,{type:h["2D"],property:a,args:n})},0),s.apply(this,o)}});s.push(o)}catch(r){const o=ce(e.CanvasRenderingContext2D.prototype,a,{set(e){me(this.canvas,n,i,!0)||t(this.canvas,{type:h["2D"],property:a,args:[e],setter:!0})}});s.push(o)}return()=>{s.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n,i),o=function(t,e,n,i,r){const s=[];return void 0!==e.WebGLRenderingContext&&s.push(...mn(e.WebGLRenderingContext.prototype,h.WebGL,t,n,i,e,r)),void 0!==e.WebGL2RenderingContext&&s.push(...mn(e.WebGL2RenderingContext.prototype,h.WebGL2,t,n,i,e,r)),()=>{s.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n,i);this.resetObservers=()=>{r(),s(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const n=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,n)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||-1===e)return;const i=n.map(t=>function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.includes(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;s.length>i;i++)e.includes(n=s[i])||{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,o)),{type:r}=n[0];this.mutationCb({id:e,type:r,commands:i}),this.pendingCanvasMutations.delete(t)}},Mn=class{constructor(t){var e;it(this,"trackedLinkElements",new WeakSet),it(this,"pendingDeferredSheets",new Set),it(this,"mutationCb",void 0),it(this,"adoptedStyleSheetCb",void 0),it(this,"maskAllElementAttributes",void 0),it(this,"maskAttributeFn",void 0),it(this,"styleMirror",new Se),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let n=null,i=null;try{i=t.sheet,i&&(n=gt(i))}catch(t){}if(!n||!i)return tt(),null;const r=n;let s=!1;const o={sheet:i,invalidate(){s=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:n=>{if(a)return!0;const l=A(),u=E();let c=!0;try{if(s)return a=!0,tt(),!0;if(!r.advance(n))return c=!1,!1;a=!0;const o=r.text();if(!t.isConnected)return!0;let l=null;try{l=t.sheet}catch(t){}return l!==i?(tt(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(tt(),!0)}finally{c&&this.pendingDeferredSheets.delete(o),F(h=A()-l,null!=(d=u)?d:x)||(H.totalMs+=h,h>H.slowestSliceMs&&(H.slowestSliceMs=h))}var h,d},remainingRules:()=>r.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var n;null===(n=this.beginDeferredLinkInlining(t,e))||void 0===n||n.advance(1/0)}emitCssTextMutation(t,e,n){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:_t({element:t,name:"_cssText",value:n,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const n={id:e,styleIds:[]},i=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const n=this.styleMirror.add(e);t=n;const r=A();try{Q(()=>{try{const t=e.rules||e.cssRules;t&&J(t)}catch(t){}i.push({styleId:n,rules:Array.from(e.rules||CSSRule,(t,n)=>({rule:ht(t,e.href),index:n}))})})}finally{X(A()-r)}}n.styleIds.push(t)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Jt.forEach(t=>t.abort()),Jt.clear()}trackStylesheetInLinkElement(t){}},Rn=class{constructor(){it(this,"nodeMap",new WeakMap),it(this,"active",!1)}inOtherBuffer(t,e){const n=this.nodeMap.get(t);return n&&Array.from(n).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},An=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var xn;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(xn=t.contentWindow)||void 0===xn?void 0:xn.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Tn=new yt,On=new Set([l.Mutation,l.MediaInteraction,l.StyleSheetRule,l.CanvasMutation,l.Font,l.Log,l.StyleDeclaration,l.AdoptedStyleSheet]);function En(t){const e=window;if("function"==typeof e.requestIdleCallback){const n=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,n)}}}const n=setTimeout(t,250);return{cancel:()=>clearTimeout(n)}}function Fn(t={}){let e,n=!1,r=!1;const{emit:s,checkoutEveryNms:o,checkoutEveryNth:u,blockClass:c="rr-block",blockSelector:h=null,ignoreClass:d="rr-ignore",ignoreSelector:f=null,maskTextClass:v="rr-mask",maskTextSelector:p=null,inlineStylesheet:m=!0,inlineStylesheetBudgetRules:g,maskAllInputs:y,maskInputOptions:b,slimDOMOptions:w,maskInputFn:k,maskTextFn:_,maskAllElementAttributes:S=!1,maskAttributeFn:C,hooks:I,packFn:M,sampling:A={},dataURLOptions:x={},canvasResolutionScale:T,canvasMasking:E,mousemoveWait:F,recordDOM:D=!0,recordCanvas:L=!1,recordCrossOriginIframes:N=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:j=!1,collectFonts:z=!1,inlineImages:B=!1,plugins:W,keepIframeSrcFn:U=()=>!1,ignoreCSSAttributes:q=new Set([]),attributeFilter:H,errorHandler:Z}=t;$e(Z);const J=i({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},x),Q=!N||window.parent===window;let X=!1;if(!Q)try{window.parent.document&&(X=!1)}catch(t){X=!0}if(Q&&!s)throw new Error("emit function is required");if(!Q&&!X)return()=>{};void 0!==F&&void 0===A.mousemove&&(A.mousemove=F),Tn.reset();const Y=!0===y?{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!==b?b:{password:!0},tt=ee(void 0!==w&&w);let nt;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let it=0;const rt=new Map;let st,ot;const at=t=>{for(const e of W||[])e.eventProcessor&&(t=e.eventProcessor(t));return M&&!X&&(t=M(t)),t};_n=(t,e)=>{var n;const i=t;if(i.timestamp=he(),!(null===(n=Ne[0])||void 0===n?void 0:n.isFrozen())||i.type===a.FullSnapshot||i.type===a.IncrementalSnapshot&&On.has(i.data.source)||Ne.forEach(t=>t.unfreeze()),Q)null==s||s(at(i),e);else if(X){const t={type:"rrweb",event:at(i),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(i.type===a.FullSnapshot)nt=i,it=0;else if(i.type===a.IncrementalSnapshot){if(i.data.source===l.Mutation&&i.data.isAttachIframe)return;it++,(u&&it>=u||o&&i.timestamp-nt.timestamp>o)&&Sn(!0)}};const lt=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,n=new Set;if(t.adds.length>0)for(const e of t.adds){const t=Tn.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&n.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const i=dt.getIframeElementById(t);i&&n.has(i)?dt.forgetIframeId(t):(null==st||st(t),dt.removeIframeById(t))}),null==ot||ot(),dt.cleanupDetachedIframes()}_n({type:a.IncrementalSnapshot,data:i({source:l.Mutation},t)})},ut=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Scroll},t)}),ct=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.CanvasMutation},t)}),ht=new Mn({mutationCb:lt,adoptedStyleSheetCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.AdoptedStyleSheet},t)}),maskAllElementAttributes:S,maskAttributeFn:C}),dt=new Ye({mirror:Tn,mutationCb:lt,stylesheetManager:ht,recordCrossOriginIframes:N,wrappedEmit:_n});for(const t of W||[])t.getMirror&&t.getMirror({nodeMirror:Tn,crossOriginIframeMirror:dt.crossOriginIframeMirror,crossOriginIframeStyleMirror:dt.crossOriginIframeStyleMirror});const ft=new Rn,vt=null==E?void 0:E.configured;Cn=new In({recordCanvas:L,mutationCb:ct,win:window,blockClass:c,blockSelector:h,mirror:Tn,sampling:A.canvas,dataURLOptions:J,resolutionScale:T,canvasMasking:E});const pt=new Ke({mutationCb:lt,scrollCb:ut,bypassOptions:{blockClass:c,blockSelector:h,maskTextClass:v,maskTextSelector:p,inlineStylesheet:m,maskInputOptions:Y,dataURLOptions:J,maskTextFn:_,maskInputFn:k,maskAllElementAttributes:S,maskAttributeFn:C,recordCanvas:L,canvasMaskingConfigured:vt,inlineImages:B,sampling:A,slimDOMOptions:tt,iframeManager:dt,stylesheetManager:ht,canvasManager:Cn,keepIframeSrcFn:U,processedNodeManager:ft,attributeFilter:H},mirror:Tn});Sn=(t=!1)=>{if(D){G(g);try{if(_n({type:a.Meta,data:{href:window.location.href,width:ve(),height:fe()}},t),n)return;null==e||e.cancel(),e=void 0,ht.reset(),pt.init(),Ne.forEach(t=>t.lock());let i=null,r=[];try{i=function(t,e){const{mirror:n=new yt,blockClass:i="rr-block",blockSelector:r=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,canvasMaskingConfigured:c,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:f,maskAllElementAttributes:v=!1,maskAttributeFn:p,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:I=()=>!1,maxDepth:M,inlineStylesheetBudgetRules:R}=e||{},A=!0===h?{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===h?{password:!0}:h,x=ee(m);G(R);try{return te(t,{doc:t,mirror:n,blockClass:i,blockSelector:r,maskTextClass:s,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:A,maskTextFn:d,maskInputFn:f,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:x,dataURLOptions:g,inlineImages:l,recordCanvas:u,canvasMaskingConfigured:c,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:I,newlyAddedElement:!1,maxDepth:M})}finally{V()}}(document,{mirror:Tn,blockClass:c,blockSelector:h,maskTextClass:v,maskTextSelector:p,inlineStylesheet:m,maskAllInputs:Y,inlineStylesheetBudgetRules:g,maskTextFn:_,maskInputFn:k,maskAllElementAttributes:S,maskAttributeFn:C,slimDOM:tt,dataURLOptions:J,recordCanvas:L,canvasMaskingConfigured:vt,inlineImages:B,onSerialize(t){we(t,Tn)&&dt.addIframe(t),ke(t,Tn)&&ht.trackLinkElement(t),_e(t)&&pt.addShadowRoot(R.shadowRoot(t),document)},onIframeLoad(t,e){dt.attachIframe(t,e),pt.observeAttachShadow(t)},onIframeListenerRegistered(t,e){dt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){ht.attachLinkElement(t,e)},keepIframeSrcFn:U})}finally{r=K()}if(n)return;if(!i)return console.warn("Failed to snapshot the document");if(_n({type:a.FullSnapshot,data:{node:i,initialOffset:de(window)}},t),n)return;if(Ne.forEach(t=>t.unlock()),Cn.onFullSnapshot(),r.length){const t=function(t,e,n){let i=!1,r=null,s=0,o=null;const a=()=>null!==o||t.length>s,l=()=>{const n=t[s];t[s]=null,s+=1,n&&se(()=>{o=e.beginDeferredLinkInlining(n,Tn.getId(n))})},u=()=>{if(!o)return;const t=o;let e=!0;se(()=>{e=t.advance(200)}),e&&(o=null)},c=()=>{o||l(),u()},h=t=>{if(r=null,i)return;let e=0;do{try{c()}catch(t){null==o||o.discard(),o=null,et(1)}e+=1}while(!i&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));i||(a()?r=En(h):n())};return r=En(h),{cancel(){i=!0,null==o||o.discard(),o=null,null==r||r.cancel(),r=null},flush(){if(i)return;i=!0,null==r||r.cancel(),r=null;let e=0,c=0;for(;a()&&50>e;){o||l();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,c+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,c+=1}e+=1}}if(a()||c>0){let e=c+(null!==o?1:0);for(let n=s;t.length>n;n++)null!==t[n]&&(e+=1);et(e),null==o||o.discard(),o=null}n()}}}(r,ht,()=>{e===t&&(e=void 0)});e=t}N&&dt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ht.adoptStyleSheets(document.adoptedStyleSheets,Tn.getId(document))}finally{V()}}};try{const t=[];t.push(ie("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(ie(e,O,document));st=e=>{const n=rt.get(e);n&&(n.forEach(e=>{se(e);const n=t.indexOf(e);-1!==n&&t.splice(n,1)}),rt.delete(e))},ot=()=>{for(const[t]of rt){const e=Tn.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==st||st(t)}catch(e){null==st||st(t)}else null==st||st(t)}};const s=t=>{var e;return Le(Ze)({mutationCb:lt,mousemoveCb:(t,e)=>_n({type:a.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.MouseInteraction},t)}),scrollCb:ut,viewportResizeCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.ViewportResize},t)}),inputCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Input},t)}),mediaInteractionCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.MediaInteraction},t)}),styleSheetRuleCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.StyleSheetRule},t)}),styleDeclarationCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.StyleDeclaration},t)}),canvasMutationCb:ct,fontCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Font},t)}),selectionCb(t){_n({type:a.IncrementalSnapshot,data:i({source:l.Selection},t)})},customElementCb(t){_n({type:a.IncrementalSnapshot,data:i({source:l.CustomElement},t)})},blockClass:c,ignoreClass:d,ignoreSelector:f,maskTextClass:v,maskTextSelector:p,maskInputOptions:Y,inlineStylesheet:m,sampling:A,recordDOM:D,recordCanvas:L,canvasMaskingConfigured:vt,inlineImages:B,userTriggeredOnInput:j,collectFonts:z,doc:t,maskInputFn:k,maskTextFn:_,maskAllElementAttributes:S,maskAttributeFn:C,keepIframeSrcFn:U,blockSelector:h,slimDOMOptions:tt,dataURLOptions:J,mirror:Tn,iframeManager:dt,stylesheetManager:ht,shadowDomManager:pt,processedNodeManager:ft,canvasManager:Cn,ignoreCSSAttributes:q,attributeFilter:H,plugins:(null==W||null===(e=W.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>_n({type:a.Plugin,data:{plugin:t.name,payload:e}})})))||[]},I)};dt.addLoadListener(e=>{try{const n=Tn.getId(e),i=s(e.contentDocument);if("function"==typeof i&&(t.push(i),-1!==n)){let t=rt.get(n);t||(t=new Set,rt.set(n,t)),t.add(i)}}catch(t){console.warn(t)}}),dt.addPageHideListener(t=>{const e=Tn.getId(t);null==st||st(e),Be(t)});let o=-1;const u=t=>_n({type:a.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),g=()=>{var t,e,n,i;const r=document,s=null!==(t=null!==(e=null!==(n=null!==(i=r.fullscreenElement)&&void 0!==i?i:r.webkitFullscreenElement)&&void 0!==n?n:r.mozFullScreenElement)&&void 0!==e?e:r.msFullscreenElement)&&void 0!==t?t:null,a=s?Tn.getId(s):-1;a!==o&&(-1!==o&&u({id:o,enter:!1}),o=a,-1!==a&&u({id:a,enter:!0}))},y=()=>{if(n||r)return;if(r=!0,Sn(),n)return;const e=s(document);n?"function"==typeof e&&oe([e]):("function"==typeof e&&t.push(e),t.push(ie("fullscreenchange",g)),t.push(ie("webkitfullscreenchange",g)),t.push(ie("mozfullscreenchange",g)),t.push(ie("MSFullscreenChange",g)),An=!0)};return["interactive","complete"].includes(document.readyState)?y():(t.push(ie("DOMContentLoaded",()=>{_n({type:a.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&setTimeout(y,0)})),t.push(ie("load",()=>{_n({type:a.Load,data:{}}),"load"===P&&y()},window))),()=>{n=!0;try{null==e||e.flush()}catch(t){}e=void 0,oe(t),ft.destroy(),dt.removeLoadListener(),dt.destroy(),rt.clear(),pt.reset(),Tn.reset(),An=!1,De()}}catch(t){console.warn(t)}}Fn.addCustomEvent=(t,e)=>{if(!An)throw new Error("please add custom event after start recording");_n({type:a.Custom,data:{tag:t,payload:e}})},Fn.freezePage=()=>{Ne.forEach(t=>t.freeze())},Fn.takeFullSnapshot=t=>{if(!An)throw new Error("please take full snapshot after start recording");Sn(t)},Fn.isRecording=()=>An,Fn.mirror=Tn,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var $n=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${$n.source}`,"i"),new RegExp($n.source,"gi"),"0".repeat(32),"0".repeat(16);var Dn=Object.create(null);function Ln(t){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(t)}function Nn(t,e,n){return(e=function(t){var e=function(t){if("object"!=Ln(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ln(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ln(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Dn.Node=Object.create(null),Dn.ShadowRoot=Object.create(null),Dn.MutationObserver=Object.create(null),Dn.Element=Object.create(null);var Pn=class{constructor(t){Nn(this,"fileName",void 0),Nn(this,"functionName",void 0),Nn(this,"lineNumber",void 0),Nn(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},jn=/(^|@)\S+:\d+/,zn=/^\s*at .*(\S+:\d+|\(native\))/m,Bn=/^(eval@)?(\[native code])?$/,Wn={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(zn)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(zn)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=n?e.replace(n[0],""):e;const i=e.split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:i.pop());return new Pn({functionName:i.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0],lineNumber:r[1],columnNumber:r[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(Bn)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Pn({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(t.replace(e,""));return new Pn({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),i=[];for(let t=2,r=n.length;r>t;t+=2){const r=e.exec(n[t]);r&&i.push(new Pn({fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),i=[];for(let t=0,r=n.length;r>t;t+=2){const r=e.exec(n[t]);r&&i.push(new Pn({functionName:r[3]||void 0,fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(jn)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),n=this.extractLocation(e.pop());return new Pn({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function Un(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let n=t.localName;if(!n)break;n=n.toLowerCase();const i=t.parentElement,r=[];if(i.children&&i.children.length>0)for(let t=0;i.children.length>t;t++){const e=i.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===n&&r.push(e)}r.length>1&&(n+=`:eq(${r.indexOf(t)})`),e=n+(e?">"+e:""),t=i}return e}function qn(t){return Array.isArray(t)}function Hn(t){return"object"==typeof t&&null!==t&&!qn(t)}function Gn(t,e){if(0===e)return!0;const n=Object.keys(t);for(const i of n)if(Hn(t[i])&&Gn(t[i],e-1))return!0;return!1}function Vn(t,e){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,e);const i=[],r=[];return JSON.stringify(t,function(t,e){if(i.length>0){const n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?r.splice(n,1/0,t):r.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Hn(s=e)&&Object.keys(s).length>n.numOfKeysLimit||"function"==typeof s||Hn(s)&&Gn(s,n.depthOfLimit))return function(t){let e=t.toString();return n.stringLengthLimit&&e.length>n.stringLengthLimit&&(e=`${e.slice(0,n.stringLengthLimit)}...`),e}(e);var s;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const n in e){const i=e[n];t[n]=qn(i)?Un(i.length?i[0]:null):i}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var Zn={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Jn(t,e,n){const i=n?Object.assign({},Zn,n):Zn,r=i.logger;if(!r)return()=>{};let s;s="string"==typeof r?e[r]:r;let o=0,a=!1,l=!0;const u=[];if(i.level.includes("error")){const n=e=>{const n=e.message;t({level:"error",trace:Wn.parse(e.error).map(t=>t.toString()),payload:[Vn(n,i.stringifyOptions)]})};e.addEventListener("error",n),u.push(()=>{e.removeEventListener("error",n)});const r=e=>{let n,r;e.reason instanceof Error?(n=e.reason,r=[Vn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[Vn("Uncaught (in promise)",i.stringifyOptions),Vn(e.reason,i.stringifyOptions)]),t({level:"error",trace:Wn.parse(n).map(t=>t.toString()),payload:r})};e.addEventListener("unhandledrejection",r),u.push(()=>{e.removeEventListener("unhandledrejection",r)})}for(const t of i.level)u.push(c(s,t));return()=>{l=!1,u.forEach(t=>t())};function c(e,n){return e[n]?function(r,s){try{if(!(s in r))return()=>{};const u=r[s],c={next:u},h=(r=>(...s)=>{if(r.apply(e,s),l&&!("assert"===n&&s[0]||a)){a=!0;try{const e=Wn.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===n?s.slice(1):s).map(t=>Vn(t,i.stringifyOptions));o++,i.lengthThreshold>o?t({level:n,trace:e,payload:r}):o===i.lengthThreshold&&t({level:"warn",trace:[],payload:[Vn("The number of log records reached the threshold.")]})}catch(t){r.apply(e,["rrweb logger error:",t,...s])}finally{a=!1}}})(function(...t){return c.next.apply(this,t)});return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),r[s]=h,()=>{if(r[s]===h)return void(r[s]=c.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=r[s],n=t(e);for(;n;){if(n.next===h)return void(n.next=c.next);e=n.next,n=t(e)}}}catch(t){return()=>{}}}(e,n):()=>{}}}const Qn="u">typeof window?window:void 0,Xn="u">typeof globalThis?globalThis:Qn,Yn=null==Xn?void 0:Xn.document,Kn=null==Xn?void 0:Xn.location;null!=Xn&&Xn.XMLHttpRequest&&new Xn.XMLHttpRequest;const ti="undefined"!=typeof globalThis?globalThis:Qn;ti&&"undefined"==typeof self&&(ti.self=ti),ti&&"undefined"==typeof File&&(ti.File=function(){});const ei=null!=Qn?Qn:{},ni=Object.prototype,ii=ni.hasOwnProperty,ri=ni.toString,si=Array.isArray||function(t){return"[object Array]"===ri.call(t)},oi=t=>"function"==typeof t,ai=t=>t===Object(t)&&!si(t),li=t=>void 0===t,ui=t=>"[object String]"==ri.call(t),ci=t=>null===t,hi=t=>li(t)||ci(t),di=t=>"[object Number]"==ri.call(t)&&t==t,fi=t=>"[object Boolean]"===ri.call(t),vi=t=>t instanceof FormData;function pi(t,e,n,i,r){return e>n&&(i.warn("min cannot be greater than max."),e=n),di(t)?t>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),pi(null!=r?r:n,e,n,i))}var mi=class{constructor(t){this.C={},this.I=t.I,this.R=pi(t.bucketSize,0,100,t.A),this.$=pi(t.refillRate,0,this.R,t.A),this.O=pi(t.refillInterval,0,864e5,t.A)}F(t,e){const n=Math.floor((e-t.lastAccess)/this.O);n>0&&(t.tokens=Math.min(t.tokens+n*this.$,this.R),t.lastAccess=t.lastAccess+n*this.O)}consumeRateLimit(t){var e;const n=Date.now(),i=String(t);let r=this.C[i];return r?this.F(r,n):(r={tokens:this.R,lastAccess:n},this.C[i]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===r.tokens)}stop(){this.C={}}};function gi(t){return t?t.split("#")[0]:t}const yi="NativeGzipValidationError";let bi;const wi=t=>{throw function(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return n}(yi,`Native gzip produced invalid output: ${t}`)},ki=(_i=s(function*(t,e){18>t.size&&wi("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());var i;(2>(i=n).length||31!==i[0]||139!==i[1]||8!==n[2])&&wi("invalid-header");const r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{const e=(()=>{if(bi)return bi;bi=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;bi[t]=e>>>0}return bi})();let n=4294967295;for(let i=0;t.length>i;i++)n=e[255&(n^t[i])]^n>>>8;return(4294967295^n)>>>0})(e)&&wi("invalid-crc");const s=e.length>>>0;r.getUint32(4,!0)!==s&&wi("invalid-size")}),function(t,e){return _i.apply(this,arguments)});var _i;function Si(){return Si=s(function*(t,e=!0,n){try{const e=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),r=n.writable.getWriter(),o=r.write(e).then(()=>r.close()).catch((i=s(function*(t){try{yield r.abort(t)}catch(t){}throw t}),function(t){return i.apply(this,arguments)})),a=new Response(n.readable).blob(),[l]=yield Promise.all([a,o]);return yield ki(l,e),l}catch(t){if(null==n?void 0:n.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var i}),Si.apply(this,arguments)}const Ci="0.9.4",Ii={DEBUG:!1,LIB_VERSION:Ci,LIB_NAME:"browser-common",JS_SDK_VERSION:Ci},Mi=(t,{debugEnabled:e}={})=>{const n={N(n,...i){let r;try{r=typeof window>"u"?void 0:window}catch(t){return}r&&(Ii.DEBUG||r.POSTHOG_DEBUG||e)&&!li(r.console)&&r.console&&("__rrweb_original__"in r.console[n]?r.console[n].__rrweb_original__:r.console[n])(t,...i)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...e){console.error(t,...e)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(e,n)=>Mi(`${t} ${e}`,n)};return n},Ri=Mi("[PostHog.js]"),Ai=Ri.createLogger;function xi(t,e){if(!hi(t))if(si(t))t.forEach(e);else if(vi(t))t.forEach((t,n)=>e(t,n));else for(const n in t)ii.call(t,n)&&e(t[n],n)}function Ti(t,e,n,i){const{capture:r=!1,passive:s=!0}=null!=i?i:{};null==t||t.addEventListener(e,n,{capture:r,passive:s})}const Oi=["localhost","127.0.0.1"],Ei=t=>{const e=null==Yn?void 0:Yn.createElement("a");return li(e)?null:(e.href=t,e)},Fi=()=>{},$i=t=>{var e;if(oi(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Di(t,e,n){try{if(!(e in t))return Fi;const i={next:t[e]},r=n(function(...t){return i.next.apply(this,t)});return oi(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=i.next);let n=t[e],s=$i(n);for(;s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=$i(n)}}}catch(t){return Fi}}function Li(t,e){var n;const i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),r={hostname:i,isHostDenied:!1};if(!(null===(n=e.payloadHostDenyList)||void 0===n?void 0:n.length)||!(null==i?void 0:i.trim().length))return r;for(const t of e.payloadHostDenyList)if(i.endsWith(t))return{hostname:i,isHostDenied:!0};return r}function Ni(t){var e;const n=null==Qn||null===(e=Qn.location)||void 0===e?void 0:e.href;return li(n)?void 0:function(t,e){var n;const i=null==t||null===(n=t.config)||void 0===n?void 0:n.get_current_url;if(!oi(i))return e;try{const t=i(e);return ui(t)&&t?t:e}catch(t){return Ri.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,n)}const Pi="$stored_person_properties",ji=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),zi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Bi=[16,15,14,13],Wi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Ui=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),qi=/[0-9A-Za-z_]/;function Hi(t){let e=0,n=!1;for(let i=t.length-1;i>=0;i--){let r=t.charCodeAt(i)-48;n&&(r*=2,r>9&&(r-=9)),e+=r,n=!n}return e%10==0}const Gi=1e6;function Vi(t){var e;return Math.min(Gi,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Gi)}const Zi={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Gi,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},Ji=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Qi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Xi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Yi=t=>{hi(t)||xi(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Ji.includes(e)||Xi.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Ki=["/s/","/e/","/i/"];function tr(t,e,n,i){if(hi(t))return t;let r=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ui(r)&&(r=parseInt(r)),r>n?`[SessionRecording] ${i} body too large to record (${r} bytes)`:t}function er(t,e){if(hi(t))return t;let n=t;return function(t,e=!0){if(hi(t))return!1;if(ui(t)){if(t=t.trim(),e?ji.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(zi.lastIndex=0;e=zi.exec(t);){const t=e[2];if(!t)continue;const n=t.replace(/[- ]/g,"");for(let t=0;n.length>t;t++)for(const e of Bi){const i=t+e;if(n.length>=i){const e=n.slice(t,i);if(ji.test(e)&&Hi(e))return!0}}}return!1}(t))return!1;if(e?Wi.test(t):function(t){let e;for(Ui.lastIndex=0;e=Ui.exec(t);){const t=e[1],n=e[3];if(!(t&&n&&qi.test(t)&&qi.test(n)))return!0}return!1}(t))return!1}return!0}(n,!1)||(n="[SessionRecording] "+e+" body redacted"),xi(Qi,t=>{(null==n?void 0:n.length)&&-1!==(null==n?void 0:n.indexOf(t))&&(n="[SessionRecording] "+e+" body redacted as might contain: "+t)}),n}const nr=new WeakSet,ir=Ai("[Recorder]"),rr=t=>"navigation"===t.entryType,sr=t=>"resource"===t.entryType,or=()=>{};function ar(t,e){var n;return rr(e)&&"complete"===(null===(n=t.document)||void 0===n?void 0:n.readyState)&&e.loadEventEnd>0}function lr(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(n=>ar(t,n)||sr(n)&&e.initiatorTypes.includes(n.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>ar(t,e))}(t):[]}function ur(t,e){return!!e&&(fi(e)||e[t])}function cr(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const hr=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function dr({type:t,recordBody:e,headers:n,url:i}){function r(t){const e=Object.keys(n).find(t=>"content-type"===t.toLowerCase()),i=e&&n[e];return t.some(t=>null==i?void 0:i.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!cr(e)&&t(e.url)}catch(t){return!1}}(i))return!1;if(r(hr))return!1;if(fi(e))return!0;if(si(e))return r(e);const s=e[t];return fi(s)?s:r(s)}function fr(t,e,n,i,r){return vr.apply(this,arguments)}function vr(){return vr=s(function*(t,e,n,i,r,s=0){if(s>10)return ir.warn("Failed to get performance entry for request",{url:n,initiatorType:e}),null;const o=function(t,e){for(let n=t.length-1;n>=0;n-=1)if(e(t[n]))return t[n]}(t.performance.getEntriesByName(n),t=>sr(t)&&t.initiatorType===e&&(li(i)||t.startTime>=i)&&(li(r)||r>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*s)),fr(t,e,n,i,r,s+1))}),vr.apply(this,arguments)}function pr({body:t,options:e,url:n}){if(hi(t))return null;const{hostname:i,isHostDenied:r}=Li(n,e);if(r)return i+" is in deny list";if(ui(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(vi(t))return function(t,e="&"){let n,i;const r=[];return xi(t,function(t,e){li(t)||li(e)||"undefined"===e||(n=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),r[r.length]=i+"="+n)}),r.join(e)}(t);if(ai(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const mr=t=>!ci(t)&&("navigation"===t.entryType||"resource"===t.entryType);function gr(t,{entry:e,method:n,status:r,networkRequest:s,isInitial:o,start:a,end:l,url:u,initiatorType:c}){a=e?e.startTime:a,l=e?e.responseEnd:l;const h=Math.floor(Date.now()-t.performance.now()),d=Math.floor(h+(a||0)),f=[i(i({},e?JSON.parse(JSON.stringify(e.toJSON())):{name:u}),{},{startTime:li(a)?void 0:Math.round(a),endTime:li(l)?void 0:Math.round(l),timeOrigin:h,timestamp:d,method:n,initiatorType:c||(e?e.initiatorType:void 0),status:r,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:o})];if(mr(e))for(const t of e.serverTiming||[])f.push({timeOrigin:h,timestamp:d,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return f}const yr=["video/","audio/"];function br(t){return ai(t)&&oi(t.getReader)&&oi(t.tee)}const wr="[SessionReplay] Timeout while trying to read body",kr="[SessionReplay] Failed to read body";function _r(t){return`${kr}: ${t}`}function Sr(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Cr(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const n=setTimeout(()=>e(wr),500);try{t.clone().text().then(t=>e(t),t=>e(_r(t))).finally(()=>clearTimeout(n))}catch(t){clearTimeout(n),e(kr)}})}(t);const n=Vi(e);return function(t,e){try{var n,i;const r=null===(n=t.headers)||void 0===n||null===(i=n.get)||void 0===i?void 0:i.call(n,"content-length");if(!r)return!1;const s=parseInt(r,10);return Number.isFinite(s)&&s>e}catch(t){return!1}}(t,n)?Promise.resolve(Sr(n)):function(t,e){return new Promise(n=>{let i,r=!1;function s(){try{null==i||i.cancel().catch(()=>{})}catch(t){}}function o(t){r||(r=!0,clearTimeout(a),s(),n(t))}const a=setTimeout(()=>o(wr),500);let l;try{l=t.clone()}catch(t){return void o(kr)}const u=l.body;if(!br(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(_r(t)))}catch(t){o(kr)}return}try{i=u.getReader()}catch(t){return void o(kr)}const c=[];let h=0;!function t(){i.read().then(({done:n,value:i})=>{if(r)s();else if(n)o((new TextDecoder).decode(function(t,e){const n=new Uint8Array(e);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n}(c,h)));else{if(i){if(h+i.byteLength>e)return void o(Sr(e));h+=i.byteLength,c.push(i)}t()}},t=>o(_r(t)))}()})}(t,n)}function Ir(t){return Mr.apply(this,arguments)}function Mr(){return(Mr=s(function*({r:t,options:e,url:n}){const{hostname:i,isHostDenied:r}=Li(n,e);return r?Promise.resolve(i+" is in deny list"):Cr(t,e)})).apply(this,arguments)}function Rr(t){return Ar.apply(this,arguments)}function Ar(){return(Ar=s(function*({r:t,options:e,url:n}){const i=function({r:t,options:e,url:n}){var i;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const r=null===(i=t.headers.get("Content-Type"))||void 0===i?void 0:i.toLowerCase(),s=yr.some(t=>null==r?void 0:r.startsWith(t));if(r&&s)return`Content-Type ${r} is not supported`;const{hostname:o,isHostDenied:a}=Li(n,e);return a?o+" is in deny list":null}({r:t,options:e,url:n});return ci(i)?Cr(t,e):Promise.resolve(i)})).apply(this,arguments)}let xr=null;function Tr(t,e,n){if(!("performance"in e))return()=>{};if(xr)return ir.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},Zi,n):Zi;let o=!0,a=!1;const l=e=>{if(!o)return;const n=[];let s=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&s)return;let i;try{i=r.maskRequestFn(t)}catch(t){return a||(a=!0,ir.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(e||(s=!0))}e||(s=!i||(t=>!!t&&nr.has(t))(i)),i&&n.push(i)}),n.length>0&&t(i(i({},e),{},{requests:n}))},u=function(t,e,n){try{t({requests:lr(e,n).flatMap(t=>gr(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){ir.error("Failed to capture initial performance entries for network capture",t)}const i=e.PerformanceObserver,r=null==i?void 0:i.supportedEntryTypes;if(!i||!si(r))return;const s=r.filter(t=>n.performanceEntryTypeToObserve.includes(t));if(!s.length)return;const o=new i(i=>{t({requests:i.getEntries().filter(t=>rr(t)||sr(t)&&n.initiatorTypes.includes(t.initiatorType)&&(t=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>gr(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:s}),()=>{o.disconnect()}}(l,e,r),c=r.recordHeaders||r.recordBody;if(!u&&!c)return o=!1,or;let h=()=>{},d=()=>{};return c&&(h=function(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=ur("request",n.recordHeaders),r=ur("response",n.recordHeaders),s=Di(e.XMLHttpRequest.prototype,"open",s=>function(o,a,l=!0,u,c){const h=this;try{const s=new Request(a),l={};let u,c;const d={},f=h.setRequestHeader.bind(h);h.setRequestHeader=(t,e)=>(d[t]=e,f(t,e)),i&&(l.requestHeaders=d);const v=h.send.bind(h);h.send=t=>(dr({type:"request",headers:d,url:a,recordBody:n.recordBody})&&(l.requestBody=pr({body:t,options:n,url:a})),u=e.performance.now(),v(t));const p=()=>{h.removeEventListener("readystatechange",m),h.removeEventListener("error",p),h.removeEventListener("abort",p),h.removeEventListener("timeout",p)},m=()=>{if(h.readyState!==h.DONE)return;p(),c=e.performance.now();const i={};h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),n=e.shift(),r=e.join(": ");n&&(i[n]=r)}),r&&(l.responseHeaders=i),dr({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(l.responseBody=pr({body:h.response,options:n,url:a})),fr(e,"xmlhttprequest",s.url,u,c).then(n=>{t({requests:gr(e,{entry:n,method:o,status:null==h?void 0:h.status,networkRequest:l,start:u,end:c,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};h.addEventListener("readystatechange",m),h.addEventListener("error",p),h.addEventListener("abort",p),h.addEventListener("timeout",p)}catch(t){ir.error("Failed to instrument XHR for network capture",t)}s.call(h,o,a.toString(),l,u,c)});return()=>{s()}}(l,e,r),d=!0===r.captureFetchSynchronously?function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=ur("request",n.recordHeaders),r=ur("response",n.recordHeaders),o=Di(e,"fetch",o=>function(a,l){let u;try{u=new Request(a,l)}catch(t){ir.error("Failed to instrument fetch for network capture",t);try{return Promise.resolve(o(a,l))}catch(t){return new Promise((e,n)=>n(t))}}const c={};let h,d;const f=s(function*(){try{const t={};u.headers.forEach((e,n)=>{t[n]=e}),i&&(c.requestHeaders=t),!br(null==l?void 0:l.body)&&dr({type:"request",headers:t,url:a,recordBody:n.recordBody})&&(c.requestBody=yield Ir({r:u,options:n,url:a}))}catch(t){ir.error("Failed to record fetch request for network capture",t)}})(),v=(p=s(function*(t){try{const e={};t.headers.forEach((t,n)=>{e[n]=t}),r&&(c.responseHeaders=e),dr({type:"response",headers:e,url:a,recordBody:n.recordBody})&&(c.responseBody=yield Rr({r:t,options:n,url:a}))}catch(t){ir.error("Failed to record fetch response for network capture",t)}}),function(t){return p.apply(this,arguments)});var p;try{h=e.performance.now()}catch(t){}let m;try{m=cr(a)?o(u):o(a,l)}catch(t){m=new Promise((e,n)=>n(t))}const g=Promise.resolve(m).then(t=>{try{d=e.performance.now()}catch(t){}return{status:"fulfilled",response:t}},t=>({status:"rejected",error:t}));return s(function*(){let n;try{yield f;const t=yield g;if("rejected"===t.status)throw t.error;return n=t.response,yield v(n),n}finally{(i=n,fr(e,"fetch",u.url,h,d).then(n=>{t({requests:gr(e,{entry:n,method:u.method,status:null==i?void 0:i.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"})})})).catch(()=>{})}var i})()});return()=>{o()}}(l,e,r):function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=ur("request",n.recordHeaders),r=ur("response",n.recordHeaders),o=Di(e,"fetch",o=>function(){var a=s(function*(s,a){let l,u;try{l=new Request(s,a)}catch(t){return ir.error("Failed to instrument fetch for network capture",t),o(s,a)}const c={};let h,d;try{try{const t={};l.headers.forEach((e,n)=>{t[n]=e}),i&&(c.requestHeaders=t),!br(null==a?void 0:a.body)&&dr({type:"request",headers:t,url:s,recordBody:n.recordBody})&&(c.requestBody=yield Ir({r:l,options:n,url:s}))}catch(t){ir.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=cr(s)?yield o(l):yield o(s,a),d=e.performance.now();try{const t={};u.headers.forEach((e,n)=>{t[n]=e}),r&&(c.responseHeaders=t),dr({type:"response",headers:t,url:s,recordBody:n.recordBody})&&(c.responseBody=yield Rr({r:u,options:n,url:s}))}catch(t){ir.error("Failed to record fetch response for network capture",t)}return u}finally{fr(e,"fetch",l.url,h,d).then(n=>{t({requests:gr(e,{entry:n,method:l.method,status:null==u?void 0:u.status,networkRequest:c,start:h,end:d,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return a.apply(this,arguments)}}());return()=>{o()}}(l,e,r)),xr=()=>{o=!1,null==u||u(),h(),d(),xr=null},xr}const Or="$replay_override_sampling",Er="$replay_override_linked_flag",Fr="$replay_override_url_trigger",$r="$replay_override_event_trigger",Dr="$session_is_sampled",Lr="$session_recording_url_trigger_activated_session",Nr="$session_recording_event_trigger_activated_session",Pr="$posthog_sr_group_event_trigger_",jr="$posthog_sr_group_url_trigger_",zr="$sess_rec_flush_size",Br="$sdk_debug_replay_event_trigger_status",Wr="$sdk_debug_replay_linked_flag_trigger_status",Ur="$sdk_debug_replay_matched_recording_trigger_groups",qr="$sdk_debug_replay_pending_trigger_conditions",Hr="$sdk_debug_replay_remote_trigger_matching_config",Gr="$sdk_debug_replay_trigger_groups_count",Vr="$sdk_debug_replay_url_trigger_status",Zr="$sdk_debug_rrweb_attached",Jr="$sdk_debug_rrweb_start_attempted",Qr="$session_recording_start_reason",Xr="disabled",Yr="sampled",Kr="active",ts="buffering",es="paused",ns="rrweb_error",is="trigger_activated",rs="trigger_pending",ss="trigger_disabled";function os(t,e,n,i,r,s){return 0===e?ss:(null==t?void 0:t.get_property(n?i+n:r))===s?is:rs}function as(t,e,n){return e.some(e=>{var i;return"regex"===e.matching&&(null!==(i=null==n?void 0:n.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)})}function ls(t){return t.includes("trigger_activated")?is:t.includes("trigger_pending")?rs:ss}function us(t){const e=new Set(t);switch(e.delete(ss),e.size){case 0:return ss;case 1:return Array.from(e)[0];default:return rs}}var cs=class{constructor(t){this.q=t}triggerStatus(t){return ls(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return ls(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},hs=class{constructor(t){this.q=t}triggerStatus(t){return us(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return us(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},ds=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return is}stop(){}};const fs=t=>"sessionRecording"in t;var vs=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,n;this.j=(fs(t)?ai(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(fs(t)?ai(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.G()}G(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Ri.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Ri.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}Z(t){return os(this._instance,this.j.length,this.V,jr,Lr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Vr]:e}),e}triggerStatusNoSideEffects(t){return this.Z(t)}isCurrentUrlBlocked(){const t=Ni(this._instance);if(!t)return!1;try{return as(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const n=Ni(this._instance);if(!n)return;if(n===this.W)return;this.W=n;const i=this.urlBlocked,r=as(n,this.B,this.U);i&&r||(r&&!i?t():!r&&i&&e())}checkUrlTriggerConditions(t,e,n,i){const r=Ni(this._instance);if(!r)return;if(r===this.W)return;this.W=r;const s=this.urlBlocked,o=as(r,this.B,this.U);o&&!s?t():!o&&s&&e();const a=this.Z(i)===is,l=as(r,this.j,this.H);!a&&l&&n("url",r)}stop(){this.W=""}},ps=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Wr]:t}),t}triggerStatusNoSideEffects(){let t=rs;return hi(this.linkedFlag)&&(t=ss),this.linkedFlagSeen&&(t=is),t}onConfig(t,e){var n;if(this.linkedFlag=(fs(t)?ai(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!hi(this.linkedFlag)&&!this.linkedFlagSeen){const t=ui(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ui(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((i,r)=>{let s=!1;if(ai(r)&&t in r){const e=r[t];s=fi(e)?!0===e:n?e===n:!!e}const o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(t,n)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},ms=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(fs(t)?ai(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return os(this._instance,this.K.length,this.V,Pr,Nr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Br]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,n){if(0===this.K.length)return;const i=this.X(n)===is,r=this.K.includes(t);!i&&r&&e("event",t)}stop(){}},gs=class{constructor(t,e,n){if(this._instance=t,this.group=e,this.Y=new vs(t,e.id),this.tt=new ms(t,e.id),this.et=new ps(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),i={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(i),this.tt.onConfig(i),this.et.onConfig(i,n);const r=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new cs(r):new hs(r)}else this.nt=new ds}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===rs).map(({label:t})=>t)}checkEventTriggerConditions(t,e,n){this.tt.checkEventTriggerConditions(t,e,n)}checkUrlTriggerConditions(t,e,n,i){this.Y.checkUrlTriggerConditions(t,e,n,i)}activateTrigger(t,e){var n;const i="url"===t?jr+this.group.id:Pr+this.group.id;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function ys(t){if(t.rrwebError)return ns;if(!t.receivedFlags)return ts;if(!t.isRecordingEnabled)return Xr;if(t.urlTriggerMatching.urlBlocked)return es;const e=!0===t.isSampled,n=new cs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Yr:"trigger_activated"===n?Kr:"trigger_pending"===n?ts:!1===t.isSampled?Xr:Kr}function bs(t){if(t.rrwebError)return ns;if(!t.receivedFlags)return ts;if(!t.isRecordingEnabled)return Xr;if(t.urlTriggerMatching.urlBlocked)return es;const e=new hs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==ss,i=fi(t.isSampled);return n&&"trigger_pending"===e?ts:n&&"trigger_disabled"===e||i&&!t.isSampled?Xr:!0===t.isSampled?Yr:Kr}function ws(){const t=[];return function(e,n){if(ai(n)||si(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n}}function ks(t){try{const e=JSON.stringify(t,ws());return e?new Blob([e]).size:0}catch(t){return-1}}function _s(t){if(ci(t))return 4;if(li(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(si(t)){let e=2;for(let n=0;t.length>n;n++){n>0&&(e+=1);const i=t[n];e+=li(i)||ci(i)?4:_s(i)}return e}const e=t;let n=2,i=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const r=e[t];li(r)||(i||(n+=1),i=!1,n+=t.length+3+_s(r))}return n}default:return 0}}function Ss(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),n=t.sizes.slice(0,e),i=t.sizes.slice(e);return[Ss({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:n,sessionId:t.sessionId,windowId:t.windowId}),Ss({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:i,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var Cs=Uint8Array,Is=Uint16Array,Ms=Uint32Array,Rs=new Cs([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]),As=new Cs([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]),xs=new Cs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ts=function(t,e){for(var n=new Is(31),i=0;31>i;++i)n[i]=e+=1<<t[i-1];var r=new Ms(n[30]);for(i=1;30>i;++i)for(var s=n[i];n[i+1]>s;++s)r[s]=s-n[i]<<5|i;return[n,r]},Os=Ts(Rs,2),Es=Os[1];Os[0][28]=258,Es[258]=28;for(var Fs=Ts(As,0)[1],$s=new Is(32768),Ds=0;32768>Ds;++Ds){var Ls=(43690&Ds)>>>1|(21845&Ds)<<1;$s[Ds]=((65280&(Ls=(61680&(Ls=(52428&Ls)>>>2|(13107&Ls)<<2))>>>4|(3855&Ls)<<4))>>>8|(255&Ls)<<8)>>>1}var Ns=function(t,e,n){for(var i=t.length,r=0,s=new Is(e);i>r;++r)++s[t[r]-1];var o,a=new Is(e);for(r=0;e>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new Is(1<<e);var l=15-e;for(r=0;i>r;++r)if(t[r])for(var u=r<<4|t[r],c=e-t[r],h=a[t[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[$s[h]>>>l]=u}else for(o=new Is(i),r=0;i>r;++r)o[r]=$s[a[t[r]-1]++]>>>15-t[r];return o},Ps=new Cs(288);for(Ds=0;144>Ds;++Ds)Ps[Ds]=8;for(Ds=144;256>Ds;++Ds)Ps[Ds]=9;for(Ds=256;280>Ds;++Ds)Ps[Ds]=7;for(Ds=280;288>Ds;++Ds)Ps[Ds]=8;var js=new Cs(32);for(Ds=0;32>Ds;++Ds)js[Ds]=5;var zs=Ns(Ps,9,0),Bs=Ns(js,5,0),Ws=function(t){return(t/8|0)+(7&t&&1)},Us=function(t,e,n){(null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof Is?Is:t instanceof Ms?Ms:Cs)(n-e);return i.set(t.subarray(e,n)),i},qs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8},Hs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8,t[i+2]|=n>>>16},Gs=function(t,e){for(var n=[],i=0;t.length>i;++i)t[i]&&n.push({s:i,f:t[i]});var r=n.length,s=n.slice();if(!r)return[new Cs(0),0];if(1==r){var o=new Cs(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(t,e){return t.f-e.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,h=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=n[n[h].f>n[u].f?u++:h++],l=n[u!=c&&n[h].f>n[u].f?u++:h++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=s[0].s;for(i=1;r>i;++i)s[i].s>d&&(d=s[i].s);var f=new Is(d+1),v=Vs(n[c-1],f,0);if(v>e){i=0;var p=0,m=v-e,g=1<<m;for(s.sort(function(t,e){return f[e.s]-f[t.s]||t.f-e.f});r>i;++i){var y=s[i].s;if(e>=f[y])break;p+=g-(1<<v-f[y]),f[y]=e}for(p>>>=m;p>0;){var b=s[i].s;e>f[b]?p-=1<<e-f[b]++-1:++i}for(;i>=0&&p;--i){var w=s[i].s;f[w]==e&&(--f[w],++p)}v=e}return[new Cs(f),v]},Vs=function(t,e,n){return-1==t.s?Math.max(Vs(t.l,e,n+1),Vs(t.r,e,n+1)):e[t.s]=n},Zs=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Is(++e),i=0,r=t[0],s=1,o=function(t){n[i++]=t},a=1;e>=a;++a)if(t[a]==r&&a!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=t[a]}return[n.subarray(0,i),e]},Js=function(t,e){for(var n=0,i=0;e.length>i;++i)n+=t[i]*e[i];return n},Qs=function(t,e,n){var i=n.length,r=Ws(e+2);t[r]=255&i,t[r+1]=i>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;i>s;++s)t[r+s+4]=n[s];return 8*(r+4+i)},Xs=function(t,e,n,i,r,s,o,a,l,u,c){qs(e,c++,n),++r[256];for(var h=Gs(r,15),d=h[0],f=h[1],v=Gs(s,15),p=v[0],m=v[1],g=Zs(d),y=g[0],b=g[1],w=Zs(p),k=w[0],_=w[1],S=new Is(19),C=0;y.length>C;++C)S[31&y[C]]++;for(C=0;k.length>C;++C)S[31&k[C]]++;for(var I=Gs(S,7),M=I[0],R=I[1],A=19;A>4&&!M[xs[A-1]];--A);var x,T,O,E,F=u+5<<3,D=Js(r,Ps)+Js(s,js)+o,L=Js(r,d)+Js(s,p)+o+14+3*A+Js(S,M)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return Qs(e,c,t.subarray(l,l+u));if(qs(e,c,1+(D>L)),c+=2,D>L){x=Ns(d,f,0),T=d,O=Ns(p,m,0),E=p;var N=Ns(M,R,0);for(qs(e,c,b-257),qs(e,c+5,_-1),qs(e,c+10,A-4),c+=14,C=0;A>C;++C)qs(e,c+3*C,M[xs[C]]);c+=3*A;for(var P=[y,k],j=0;2>j;++j){var z=P[j];for(C=0;z.length>C;++C)qs(e,c,N[B=31&z[C]]),c+=M[B],B>15&&(qs(e,c,z[C]>>>5&127),c+=z[C]>>>12)}}else x=zs,T=Ps,O=Bs,E=js;for(C=0;a>C;++C)if(i[C]>255){var B;Hs(e,c,x[257+(B=i[C]>>>18&31)]),c+=T[B+257],B>7&&(qs(e,c,i[C]>>>23&31),c+=Rs[B]);var W=31&i[C];Hs(e,c,O[W]),c+=E[W],W>3&&(Hs(e,c,i[C]>>>5&8191),c+=As[W])}else Hs(e,c,x[i[C]]),c+=T[i[C]];return Hs(e,c,x[256]),c+T[256]},Ys=new Ms([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ks=new Cs(0),to=function(){for(var t=new Ms(256),e=0;256>e;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),eo=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function no(t,e){void 0===e&&(e={});var n=function(){var t=4294967295;return{p(e){for(var n=t,i=0;e.length>i;++i)n=to[255&n^e[i]]^n>>>8;t=n},d(){return 4294967295^t}}}(),i=t.length;n.p(t);var r,s,o,a,l,u,c=(a=10+((r=e).filename&&r.filename.length+1||0),l=8,function(t,e,n,i,r,s){var o=t.length,a=new Cs(i+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(i,a.length-r),u=0;if(!e||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=Qs(l,u,t.subarray(c,h)):(l[c]=s,u=Qs(l,u,t.subarray(c,o)))}else{for(var d=Ys[e-1],f=d>>>13,v=8191&d,p=(1<<n)-1,m=new Is(32768),g=new Is(p+1),y=Math.ceil(n/3),b=2*y,w=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},k=new Ms(25e3),_=new Is(288),S=new Is(32),C=0,I=0,M=(c=0,0),R=0,A=0;o>c;++c){var x=w(c),T=32767&c,O=g[x];if(m[T]=O,g[x]=T,c>=R){var E=o-c;if((C>7e3||M>24576)&&E>423){u=Xs(t,l,0,k,_,S,I,M,A,c-A,u),M=C=I=0,A=c;for(var F=0;286>F;++F)_[F]=0;for(F=0;30>F;++F)S[F]=0}var D=2,L=0,N=v,P=T-O&32767;if(E>2&&x==w(c-P))for(var j=Math.min(f,E)-1,z=Math.min(32767,c),B=Math.min(258,E);z>=P&&--N&&T!=O;){if(t[c+D]==t[c+D-P]){for(var W=0;B>W&&t[c+W]==t[c+W-P];++W);if(W>D){if(D=W,L=P,W>j)break;var U=Math.min(P,W-2),q=0;for(F=0;U>F;++F){var H=c-P+F+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,O=H)}}}P+=(T=O)-(O=m[T])+32768&32767}if(L){k[M++]=268435456|Es[D]<<18|Fs[L];var V=31&Es[D],Z=31&Fs[L];I+=Rs[V]+As[Z],++_[257+V],++S[Z],R=c+D,++C}else k[M++]=t[c],++_[t[c]]}}u=Xs(t,l,s,k,_,S,I,M,A,c-A,u),s||(u=Qs(l,u,Ks))}return Us(a,0,i+Ws(u)+r)}(s=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,l,!u)),h=c.length;return function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&eo(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var i=0;n.length>=i;++i)t[i+10]=n.charCodeAt(i)}}(c,e),eo(c,h-8,n.d()),eo(c,h-4,i),c}function io(t,e){var n="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var i=0;t.length>i;){var r=t[i++];128>r||e?n+=String.fromCharCode(r):224>r?n+=String.fromCharCode((31&r)<<6|63&t[i++]):240>r?n+=String.fromCharCode((15&r)<<12|(63&t[i++])<<6|63&t[i++]):(r=((15&r)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}var ro=class{constructor(t,e={}){var n,i,r,s;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,n;this.rt[t]=!0;const i=this.vt(t);null===(e=(n=this.it).onBlockedNode)||void 0===e||e.call(n,t,i)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,n,i,r,s,o,a,l;return(null!==(e=null===(n=t.removes)||void 0===n?void 0:n.length)&&void 0!==e?e:0)+(null!==(i=null===(r=t.attributes)||void 0===r?void 0:r.length)&&void 0!==i?i:0)+(null!==(s=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null===(l=t.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,n=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const n=t-e.attributes.length;var i,r;n>0&&(null===(i=(r=this.it).onDroppedAttributeMutations)||void 0===i||i.call(r,n))}const s=this.bt(e);if(0===s&&n!==s)return;if(this.kt)return t;this.ut();const o=_s(t);var a,l;return o>this.ct?(null===(a=(l=this.it).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new mi({bucketSize:null!==(n=this.it.bucketSize)&&void 0!==n?n:100,refillRate:null!==(i=this.it.refillRate)&&void 0!==i?i:10,refillInterval:1e3,I:this.ft,A:Ri}),this.dt=null!==(r=this.it.bytesBucketSize)&&void 0!==r?r:0,this.ht=null!==(s=this.it.bytesRefillRate)&&void 0!==s?s:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=di(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return di(t)&&isFinite(t)&&Math.floor(t)===t}),Qn&&!li(Qn.crypto)&&crypto;let so=null;const oo={At(){if(!ci(so))return so;if(so=!0,li(Qn))so=!1;else try{const t="__support__";oo.$t(t,"xyz"),'"xyz"'!==oo.Ot(t)&&(so=!1),oo.Pt(t)}catch(t){so=!1}return so},Lt(t){Ri.error("sessionStorage error: ",t)},Ot(t){try{return null==Qn?void 0:Qn.sessionStorage.getItem(t)}catch(t){oo.Lt(t)}return null},Dt(t){try{return JSON.parse(oo.Ot(t))||null}catch(t){}return null},$t(t,e){try{return null==Qn||Qn.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){oo.Lt(t)}return!1},Pt(t){try{null==Qn||Qn.sessionStorage.removeItem(t)}catch(t){oo.Lt(t)}}};Ii.DEBUG=!1,Ii.LIB_VERSION="1.438.8",Ii.LIB_NAME="web";var ao=Ii,lo=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(zr,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(zr);return ai(n=e)&&ui(n.sessionId)&&di(n.size)&&e.sessionId===t?e.size:0;var n}};function uo(t,e){return function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return Math.abs(e)}(t)%100<pi(100*e,0,100,Ri)}const co=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},ho=t=>t.toLowerCase(),fo={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>co(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!co(e,t))),icontains:(t,e)=>e.map(ho).some(e=>t.map(ho).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(ho).every(e=>t.map(ho).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const n=parseFloat(e);return!isNaN(n)&&t.some(t=>n>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const n=parseFloat(e);return!isNaN(n)&&t.some(t=>n<parseFloat(t))})},vo=new Set(["is_not","not_icontains","not_regex"]);function po(t,e,n){return!t||0===t.length||t.every(t=>{const i="person"===t.type?n:e,r=null==i?void 0:i[t.key],s=t.operator||"exact";if(li(r)||ci(r))return vo.has(s);const o=fo[s];return!!o&&!li(t.value)&&!ci(t.value)&&o(si(t.value)?t.value.map(String):[String(t.value)],si(r)?r.map(String):[String(r)])})}const mo=Ai("[SessionRecording]");function go(t,e){return e?t:"!"+t}function yo(t,e){return t===e||t!=="!"+e&&null}var bo=class{constructor(t,e,n,i,r,s,o){this._instance=t,this.Y=e,this.tt=n,this.et=i,this.qt=r,this.jt=s,this.Bt=o,this.zt=null,this.Ht=bs}onRemoteConfig(t){this.zt=di(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new cs([this.tt,this.Y]),this.Ht=ys):(this.Ut=new hs([this.tt,this.Y]),this.Ht=bs),this._instance.register_for_session({[Hr]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.Ht({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),n=null==e?void 0:e.minimumDurationMilliseconds;return di(n)?n:null}checkUrlTriggers(t,e,n,i){this.Y.checkUrlTriggerConditions(e,n,i,t)}setupEventTriggerListeners(t,e,n){if(0!==this.tt.K.length&&hi(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,n,e)}catch(t){mo.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const n=this.zt;var i,r;if(!di(n))return null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),void(null===(r=this._instance.persistence)||void 0===r||r.unregister("$replay_sample_rate"));const s=this._instance.get_property(Dr),o=this._instance.get_property("$replay_sample_rate"),a=yo(s,t),l=di(o)&&o!==n,u=li(o)&&s===t,c=l||u||!fi(a),h=c?uo(t,n):a;c&&(h?this.qt("sampled"):mo.warn(`Sample rate (${n}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:go(t,h),$replay_sample_rate:ci(o)&&s===t?null:n})}ensureSamplingDecision(t){if(!di(this.zt))return;const e=this._instance.get_property(Dr);fi(yo(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,n,i,r;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$replay_sample_rate"),null===(r=this._instance.persistence)||void 0===r||r.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===rs}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===rs).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},wo=class{constructor(t,e,n,i,r){this._instance=t,this.Y=e,this.qt=n,this.Vt=i,this.Bt=r,this.Gt=[],this.Qt=new Map,this.Zt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[Hr]:"v2_trigger_groups",[Gr]:t.triggerGroups.length}),this.Y.onConfig(t)):mo.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return ns;if(!t.receivedFlags)return ts;if(!t.isRecordingEnabled)return Xr;if(t.urlTriggerMatching.urlBlocked)return es;const e=t.triggerGroupMatchers,n=t.triggerGroupSamplingResults;if(0===e.length)return Xr;let i=!1,r=!1;for(const s of e){const e=s.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=s.group.id,e=n.get(t);li(e)?Ri.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(r=!0)}else"trigger_pending"===e&&(i=!0)}return r?Yr:i?ts:Xr}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Gt,triggerGroupSamplingResults:this.Qt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const n of this.Gt)if("trigger_activated"===n.triggerStatus(t)){const t=n.group.minDurationMs;di(t)&&(ci(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,n,i){this.Y.checkUrlBlocklist(e,n);for(const i of this.Gt)i.checkUrlTriggerConditions(e,n,e=>{this.Kt(i,void 0)&&(i.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,n){return this.Wt=t(t=>{var n;if(this.Zt)return mo.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(n=this.Wt)||void 0===n||n.call(this),void(this.Wt=void 0);try{for(const n of this.Gt)n.checkEventTriggerConditions(t.event,i=>{if(!this.Kt(n,t.properties))return;const r=(n.group.conditions.events||[]).filter(e=>e.name===t.event),s=this._instance.get_property(Pi);r.some(e=>!e.properties||0===e.properties.length||po(e.properties,t.properties,s))&&(n.activateTrigger(i,e),this.updateActiveTriggers(e),this.Bt(i))},e)}catch(t){mo.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const n of this.Gt){var e;const i=n.group,r=i.id,s=i.sampleRate,o="$posthog_sr_group_sampling_"+r,a=this._instance.get_property(o);let l=null,u=!1,c=!1,h=!1;if(ai(a)){const e=a.sessionId,n=a.sampleRate,i=a.sampled;u="string"==typeof e&&e!==t,c=di(n)&&n!==s,l=e===t&&di(n)&&n===s&&fi(i)?i:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!fi(l),f=d?uo(t+r,s):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:r,group_name:i.name,sampleRate:s,isSampled:f}),this.Qt.set(r,f),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:s,sampled:f}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Zt=!0}clearConditionalRecordingPersistence(){var t,e,n;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_past_minimum_duration");for(const t of this.Gt){var i,r,s;const e=t.group.id;null===(i=this._instance.persistence)||void 0===i||i.unregister("$posthog_sr_group_event_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_url_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const n of this.Gt){const i=n.group,r=i.id,s="trigger_activated"===n.triggerStatus(t),o=!0===this.Qt.get(r);s&&e.push({id:r,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Ur]:e})}hasPendingTriggers(t){for(const e of this.Gt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Gt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear(),this.Y.stop()}Kt(t,e){const n=t.group.conditions.properties;return!n||0===n.length||po(n,e,this._instance.get_property(Pi))}Jt(t){this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear();for(const e of t){const t=new gs(this._instance,e,(t,n)=>{this.qt("linked_flag_matched",{flag:t,variant:n,group_id:e.id,group_name:e.name}),this.Bt()});this.Gt.push(t)}}};const ko=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],_o=1e5,So=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Co=[],Io=()=>!1,Mo="@type @id actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),Ro="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Ao="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),xo="Accommodation AdministrativeArea Country Place State".split(" "),To={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:Ro,publisher:Ao},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Co},Offer:{seller:Ao},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Ao,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Ao,areaServed:xo,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Co}},Oo=[["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),To.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),To.Event],[Ao,To.Organization],[xo,To.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),To.Product]];function Eo(t,e){return ii.call(t,e)?t[e]:void 0}function Fo(t){const e=typeof t;return ci(t)||"string"===e||"number"===e||"boolean"===e}function $o(t,e){return e&&function(t){return ui(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Do(t,e){return si(t)&&t.every(Fo)?t.map(t=>$o(t,e)).filter(t=>!li(t)):Fo(t)?$o(t,e):void 0}function Lo(t,e){if("string"!=typeof t)return;const n=t.trim(),i=n.indexOf("#"),r=0>i?n:n.slice(i+1);if(!(!r||0>i&&(/^[a-z][a-z\d+.-]*:/i.test(n)||n.includes("/")||n.includes("?"))))try{return e(r)?r:void 0}catch(t){return}}function No(t){if(ii.call(To,t))return To[t];for(const[e,n]of Oo)if(e.includes(t))return n}function Po(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0})}function jo(t,e,n,i){if(si(t)){const r=t.map(t=>jo(t,e,n,i)).filter(t=>!li(t));return r.length?r:void 0}return zo(t,e,n,i)||void 0}function zo(t,e,n,i){if(!ai(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(n))return null;const r=Eo(t,"@type"),s=function(t){const e=new Set,n="string"==typeof t?[t]:si(t)?t:[],i=[];for(const t of n){if("string"!=typeof t)continue;const n=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&So.test(n)&&!e.has(n)&&(e.add(n),i.push(n),20===i.length))break}return i}(r),o=s.filter(t=>!!No(t)&&(!i||!i.length||i.includes(t))),a={};for(const i of Mo){const o="@type"===i?s.length?"string"==typeof r?s[0]:s:void 0:"@id"===i?Lo(Eo(t,i),e):Do(Eo(t,i),n.maskUrl);li(o)||Po(a,i,o)}for(const i of o){const r=No(i);for(const i of Object.keys(r)){const s=Eo(t,i),o=r[i];if(!0===o){const t=Do(s,n.maskUrl);li(t)||Po(a,i,t)}else{const t=jo(s,e,n,o);li(t)||Po(a,i,t)}}}const l=jo(Eo(t,"@graph"),e,n);return li(l)||Po(a,"@graph",l),Object.keys(a).length?a:null}function Bo(t,e,n){if(!ai(t))return null;const r=Eo(t,"@context");if("string"!=typeof r||!/^https?:\/\/schema\.org\/?$/.test(r))return null;const s=zo(t,e,n);return s?i({"@context":"https://schema.org"},s):null}function Wo(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function Uo(t,e,n){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!n&&t.matches(n)}catch(t){return!1}}function qo(t,e,n){for(let i=t;i;){if(Uo(i,e,n))return!0;const t=i.parentNode;i=i.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function Ho(t){return Wo(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Wo)}function Go(t){return ai(t)?t.network_timing:t}const Vo=Ai("[SessionRecording]"),Zo=[1,2,3,4,5,6,7,12],Jo=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Qo(){var t;return null==ei||null===(t=ei.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function Xo(){var t;return null===(t=Qo())||void 0===t?void 0:t.record}function Yo(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,ws())}}function Ko(t){return io(no(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Cs(t.length+(t.length>>>1)),i=0,r=function(t){n[i++]=t},s=0;e>s;++s){if(i+5>n.length){var o=new Cs(i+8+(e-s<<1));o.set(n),n=o}var a=t.charCodeAt(s);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++s))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return Us(n,0,i)}(Yo(t))),!0)}function ta(t){return ea.apply(this,arguments)}function ea(){return ea=s(function*(t){const e=yield function(t){return Si.apply(this,arguments)}(Yo(t),ao.DEBUG,{rethrow:!0});return io(new Uint8Array(yield e.arrayBuffer()),!0)}),ea.apply(this,arguments)}let na,ia;const ra="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let sa=!1;function oa(t){var e;return si(t)&&0===t.length?(na=null!==(e=na)&&void 0!==e?e:Ko([]),na):Ko(t)}function aa(t){return la.apply(this,arguments)}function la(){return(la=s(function*(t){var e;return si(t)&&0===t.length?na||(ia=null!==(e=ia)&&void 0!==e?e:ta([]).then(t=>(na=t,t)).catch(t=>{throw na=void 0,ia=void 0,t}),ia):ta(t)})).apply(this,arguments)}function ua(t){return ra&&!sa&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function ca(t){return{event:t,size:_s(t)}}function ha(t,e){return i(i({},t),{},{data:e,cv:"2024-10"})}function da(t,e){return i(i({},t),{},{cv:"2024-10",data:i(i({},t.data),e)})}function fa(t){try{if(2===t.type)return ca(ha(t,Ko(t.data)));if(3===t.type&&0===t.data.source)return ca(da(t,{texts:oa(t.data.texts),attributes:oa(t.data.attributes),removes:oa(t.data.removes),adds:oa(t.data.adds)}));if(3===t.type&&8===t.data.source)return ca(da(t,{adds:t.data.adds?Ko(t.data.adds):void 0,removes:t.data.removes?Ko(t.data.removes):void 0}))}catch(t){Vo.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:ks(t)}}function va(){return(va=s(function*(t){try{if(2===t.type)return ca(ha(t,yield ta(t.data)));if(3===t.type&&0===t.data.source){const[e,n,i,r]=yield Promise.all([aa(t.data.texts),aa(t.data.attributes),aa(t.data.removes),aa(t.data.adds)]);return ca(da(t,{texts:e,attributes:n,removes:i,adds:r}))}if(3===t.type&&8===t.data.source){const[e,n]=yield Promise.all([t.data.adds?ta(t.data.adds):void 0,t.data.removes?ta(t.data.removes):void 0]);return ca(da(t,{adds:e,removes:n}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===yi})(e)&&(sa=!0),Vo.warn("could not compress event asynchronously - trying synchronous compression",e),fa(t)}return{event:t,size:ks(t)}})).apply(this,arguments)}function pa(t,e){return 5===t.type&&t.data.tag===e}function ma(t){return pa(t,"sessionIdle")}function ga(t){return pa(t,"$session_ending")}function ya(t){return pa(t,"$session_starting")}var ba=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return yo(this._instance.get_property(Dr),this.sessionId)}get zt(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return di(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=0,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Ie=!1,this.Me=!1,this.Te=void 0,this.Re=void 0,this.Ee=!1,this.Ae=[],this.$e=0,this.Oe=0,this.Pe=!1,this.Le=void 0,this.Wt=void 0,this.De=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=(t,e,n)=>{var i,r,s,o;if(!n)return;if(t===this.Xt&&e===this.je)return;const a=!n.noSessionId&&(n.activityTimeout||n.sessionPastMaximumLength),l=this.Xt,u=this.je;var c;if(a&&this.Vt("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:n,lastActivityTimestamp:this.le,flushed_size:null===(c=this.Be)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),null===(r=Qo())||void 0===r||null===(s=r.resetMaxDepthState)||void 0===s||s.call(r),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:n}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.je===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.He(e)}a&&this.Vt("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:n,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.Ue=!1,this.We=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$session_past_minimum_duration)===this.Xt},this.Ve=()=>{var t,e;if(0===this.Rt.data.length)return null;const n=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,i=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return di(n)&&di(i)?i-n:null},this.Ge=()=>{var t,e;const n=this.ie;if(!di(n))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return di(t)&&t>=0&&n>t}if(this.We())return!1;const i=this.Ve();return!!ci(i)||n>i||(null===(r=this._instance.persistence)||void 0===r||r.register({$session_past_minimum_duration:this.Xt}),!1);var r},this.Ze=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Je&&(this.Ke(void 0),this.be&&(this.be=!1,this.jt())),this.Xe(),this.Ye(!0)):this.tn()},this.en=()=>{this.Ze()},this.nn=()=>{this.Vt("browser offline",{})},this.rn=()=>{this.Vt("browser online",{})},this.sn=()=>{(null==Yn?void 0:Yn.visibilityState)&&("visible"===Yn.visibilityState&&(this.Je=!0),this.Vt("window "+Yn.visibilityState,{}))},this.Je=null==e||e;const{sessionId:n,windowId:i,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=n,this.je=i,this._sessionStartTimestamp=r,this.et=new ps(this._instance),this.Y=new vs(this._instance),this.tt=new ms(this._instance),this.Rt=this.tn(),this.an="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||Vo.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.Be=new lo(this._instance)}setDocumentWasEverVisible(t){t&&(this.Je=!0)}get ln(){var t,e,n,i,r,s,o,a,l;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,c={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.maskTextSelector,blockSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.blockSelector,maskAllElementAttributes:null===(r=this._instance.config.session_recording)||void 0===r?void 0:r.maskAllElementAttributes},h=null!==(s=null==c?void 0:c.maskAllInputs)&&void 0!==s?s:null==u?void 0:u.maskAllInputs,d=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,f=null!==(a=null==c?void 0:c.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,v=null!==(l=null==c?void 0:c.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return li(h)&&li(d)&&li(f)&&li(v)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:f,maskAllElementAttributes:v}}un(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(hi(e))return;const n=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const i=null==n?void 0:n[t],r=e[t];return!li(i)&&i!==r});0!==i.length&&(this.xe=!0,Vo.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==n?void 0:n.maskAllInputs,maskTextSelector:null==n?void 0:n.maskTextSelector,blockSelector:null==n?void 0:n.blockSelector,maskAllElementAttributes:null==n?void 0:n.maskAllElementAttributes},project:e}))}get cn(){var t;return pi(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Ai("canvas recording resolution scale"),1)}get dn(){var t,e,n,i,r,s,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(n=null==a?void 0:a.recordCanvas)&&void 0!==n?n:null==l?void 0:l.enabled)&&void 0!==e&&e,c=null!==(i=null!==(r=null==a?void 0:a.canvasFps)&&void 0!==r?r:null==l?void 0:l.fps)&&void 0!==i?i:4;let h=null!==(s=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof h){const t=parseFloat(h);h=isNaN(t)?.4:t}return{enabled:u,fps:pi(c,0,12,Ai("canvas recording fps"),4),quality:pi(h,0,1,Ai("canvas recording quality"),.4)}}get hn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),n=this._instance.config.enable_recording_console_log;return null!=n?n:e}get fn(){var t,e,n;const i=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,r={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.recordBody},s=(null==r?void 0:r.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==r?void 0:r.recordBody)||(null==i?void 0:i.recordBody),a=Go(this._instance.config.capture_performance),l=Go(null==i?void 0:i.capturePerformance),u=!!(fi(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}vn(){var t,e;const n=[],r=null===(t=ei.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.hn&&n.push(r());const s=null===(e=ei.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.fn&&oi(s))if(!Oi.includes(Kn.hostname)||this._forceAllowLocalhostNetworkCapture){const t=oi(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;n.push(s(i(i({},((t,e,n)=>{const r={payloadSizeLimitBytes:Zi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Zi.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Zi.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,o=!1!==t.session_recording.recordBody&&e.recordBody,a=!1!==t.capture_performance&&e.recordPerformance,l=(t=>{const e=Vi(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=tr(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=tr(t.responseBody,t.responseHeaders,e,"Response")),t)})(r),u=e=>{return l(((t,e,n)=>{var i;if(null==n?void 0:n(t.name))return;const r=Ei(t.name);let s=0===e.indexOf("http")?null===(i=Ei(e))||void 0===i?void 0:i.pathname:e;"/"===s&&(s="");const o=null==r?void 0:r.pathname.replace(s||"","");return r&&o&&Ki.some(t=>0===o.indexOf(t))?void 0:t})((Yi((i=e).requestHeaders),Yi(i.responseHeaders),i),t.api_host,n));var i},c=oi(t.session_recording.maskNetworkRequestFn);return c&&oi(t.session_recording.maskCapturedNetworkRequestFn)?Ri.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):c&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const n=t.session_recording.maskNetworkRequestFn({url:e.name});return!n&&e.isInitial?n:i(i({},e),{},{name:null==n?void 0:n.url})}),r.maskRequestFn=oi(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var n,i;const r=u(e);if(!r)return;const s=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,o=null===(n=(i=t.session_recording).maskCapturedNetworkRequestFn)||void 0===n?void 0:n.call(i,r);return hi(o)&&s?(nr.add(s),s):null!=o?o:void 0}:t=>function(t){if(!li(t))return t.requestBody=er(t.requestBody,"Request"),t.responseBody=er(t.responseBody,"Response"),t}(u(t)),i(i(i({},Zi),r),{},{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.fn,t)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch})))}else Vo.info("NetworkCapture not started because we are on localhost.");return n}pn(t){return this._instance.config.disable_capture_url_hashes?gi(t):t}mn(t,e=!1){const n=e?gi(t):this.pn(t),i=this._instance.config.mask_personal_data_properties?[...ko,...this._instance.config.custom_personal_data_properties||[]]:[];return this.gn(function(t,e){if(!t||!e||!e.length)return t;const n=t.split("#"),i=n[1],r=(n[0]||"").split("?"),s=r[1],o=r[0],a=(s||"").split("&"),l=[];for(let t=0;a.length>t;t++){const n=a[t].split("=");si(n)&&(e.includes(n[0])?l.push(n[0]+"=<masked>"):l.push(a[t]))}let u=o;return null!=s&&(u+="?"+l.join("&")),null!=i&&(u+="#"+i),u}(n,i))}gn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var n;const i=e.maskCapturedNetworkRequestFn({name:t});return null!==(n=null==i?void 0:i.name)&&void 0!==n?n:null==i?void 0:i.url}if(e.maskNetworkRequestFn){const n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}yn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Vo.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.yn(Jo(()=>Xo().addCustomEvent(t,e)))}bn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}wn(t){if(!this.bn())return!1;try{const e=Xo();return!!e&&(e.addCustomEvent("$json_ld",t),this.bn())}catch(t){return!1}}kn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this._n)||void 0===e?void 0:e.scan(t)})}Sn(){try{if(this._instance.config.capture_pageview||!Qn)return;const t=new URL(Qn.location.href),e=this.mn(t.origin+t.pathname+t.search);this.xn!==e&&(this.xn=e,this.Vt("$url_changed",{href:e}))}catch(t){}}Cn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.yn(t)})}}jt(){return this.yn(Jo(()=>Xo().takeFullSnapshot()))}get In(){var t,e,n;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var i;const t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.trigger_pending_buffer_interval_millis;return di(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Mn(){if(this.Tn&&clearInterval(this.Tn),!0===this.de)return;const t=this.In;t&&(this.Tn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.Rn(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Mn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this._n)||void 0===t||t.scan(),clearInterval(this.Tn),Vo.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this._n)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.kn(),this.Mn(),this.Vt("recording resumed",{reason:"left blocked url"}),Vo.info("recording resumed"))}$n(t,e){var n;if("event"===t&&this.Rn(),!this.ue&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var i,r;const n="url"===t?Lr:Nr;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:this.sessionId}),null===(r=this.re)||void 0===r||r.updateActiveTriggers(this.sessionId),this.Bt(),this.Ye(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property("$session_recording_remote_config");if(!t)return;let e;try{e=ai(t)?t:JSON.parse(t)}catch(t){return void Vo.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ue){var n;const i=null!==(n=e.cache_timestamp)&&void 0!==n?n:Date.now();if(Date.now()-i>36e5)return void Vo.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:t})}return e}On(t,e,n){this._instance.get_property(t)&&(e(),n())}start(t){var e,n;const i=this.ne;if(!i)return void Vo.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ke(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.Pe&&(this.Pn(),this.tn());const{sessionId:r,windowId:s,sessionStartTimestamp:o}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=r,this.je=s,this._sessionStartTimestamp=o,this.Ln(),null===(e=this._instance.persistence)||void 0===e||e.unregister("$debug_first_full_snapshot_timestamp"),(null==i?void 0:i.endpoint)&&(this.oe=null==i?void 0:i.endpoint),this.re=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new wo(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new bo(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(i),null===(n=this.Wt)||void 0===n||n.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.$n(t,e)),this.On(Or,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Or)}),this.On(Er,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Er)}),this.On($r,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister($r)}),this.On(Fr,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Fr)}),this.re.makeSamplingDecisions(this.sessionId),this.Dn(),this.ke||(Ti(Qn,"beforeunload",this.Ze),Ti(Qn,"pagehide",this.en),Ti(Qn,"offline",this.nn),Ti(Qn,"online",this.rn),Ti(Yn,"visibilitychange",this.sn),!this.De&&oi(this.Yt.onSessionId)&&(this.De=this.Yt.onSessionId(this.qe)),!this.Fe&&oi(this.Yt.on)?this.Fe=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.Ne=this.Yt.onSessionId((t,e,n)=>{var i;null===(i=this.Ne)||void 0===i||i.call(this),this.Ne=void 0,this.qe(t,e,n)})}):oi(this.Yt.on)||Vo.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),hi(this.Le)&&(this.Le=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.mn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Vo.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(t||"recording_initialized"))}Fn(){var t,e,n,i,r,s;null==Qn||Qn.removeEventListener("beforeunload",this.Ze),null==Qn||Qn.removeEventListener("pagehide",this.en),null==Qn||Qn.removeEventListener("offline",this.nn),null==Qn||Qn.removeEventListener("online",this.rn),null==Yn||Yn.removeEventListener("visibilitychange",this.sn),clearInterval(this.Tn),this.Nn(),null===(t=this.Le)||void 0===t||t.call(this),this.Le=void 0,null===(e=this.Wt)||void 0===e||e.call(this),this.Wt=void 0,null===(n=this.De)||void 0===n||n.call(this),this.De=void 0,null===(i=this.Fe)||void 0===i||i.call(this),this.Fe=void 0,null===(r=this.Ne)||void 0===r||r.call(this),this.Ne=void 0,null===(s=this.re)||void 0===s||s.stop(),this.qn(),this.Pn()}Pn(){this.Oe+=1,this.Ae=[],this.$e=0,this.jn=void 0,this.Pe=!1}qn(){var t,e;null===(t=this.Bn)||void 0===t||t.stop(),this.ce=[],null===(e=this._n)||void 0===e||e.stop(),this._n=void 0,this.ae=!1;try{var n;null===(n=this.se)||void 0===n||n.call(this)}catch(t){Vo.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.jn||0===this.$e)return!1;if(this.Pe)return!0;this.Pe=!0,this.Hn=void 0;const t=this.Oe;return this.Nn(),this.qn(),this.jn.catch(()=>{}).then(()=>{t===this.Oe&&(this.Pe=!1,this.Ye(),this.tn(),this.Un(),this.Fn(),Vo.info("stopped"))}).catch(()=>{this.Pe=!1,this.Un(),this.Fn(),Vo.info("stopped")}),!0}stop(){if(this.qn(),this.Ue)this.Xe();else if(this.zn())return;this.Ye(),this.tn(),this.Un(),this.Fn(),Vo.info("stopped")}Un(){this.Ke(void 0,{preserveLogDedup:this.Ue}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Xe(),this.Ye())}He(t){this.Ue=!0,this.le=Date.now();try{var e,n;this.stop(),this.Wn=void 0,this.me=0,this.fe=0,this.ve=0,this.pe=0,null===(e=Qo())||void 0===e||null===(n=e.resetSnapshotCostState)||void 0===n||n.call(e),this.start("session_id_changed")}finally{this.Ue=!1}this.Ke(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ke(t,{preserveLogDedup:e=!1}={}){if(this.ge=!li(t),this.Hn=t,li(t))return void(e||(this.Vn=void 0));if(this.Ue)return;const n=`${this.sessionId}:${t}`;n!==this.Vn&&(this.Vn=n,Vo.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}Rn(){this.isStarted||(this.we=!0),this.ge&&(this.Ke(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Gn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.tn(),this.qn()),this.tn(),this.Fn(),this.tn(),this.Un(),Vo.info("discarded")}Qn(t,e,n,i,r){if(-1===n)return this.me+=1,void Vo.warn("could not stringify event - dropping it to keep the rest of the recording");const s={$snapshot_bytes:n,$snapshot_data:e,$session_id:i,$window_id:r};"disabled"!==this.status?(this.Zn(t,i),this.Jn(s)):this.tn()}Kn(){try{this.Xn()}catch(t){this.Se||(this.Se=!0,Vo.error("could not track full snapshot cost",t))}}Xn(){var t,e;const n=null===(t=Qo())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);n&&n!==this.Wn&&(this.Wn=n,500>n.durationMs||Vo.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(n.durationMs),stylesheetMs:Math.round(n.stylesheetMs),nodeCount:n.nodeCount,cssRuleCount:n.cssRuleCount,nonDeferrableCssRuleCount:n.nonDeferrableCssRuleCount,deferredStylesheetCount:n.deferredStylesheetCount}))}Zn(t,e){2!==t.type?3===t.type&&(li(this.Te)||this.Te===e||this.Re===e||(this.Re=e,Vo.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Te=e}Yn(t){t.counted&&t.generation===this.Oe&&(this.$e=Math.max(0,this.$e-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ti(t,e,n){t.processed||t.generation!==this.Oe||(t.processed=!0,this.Qn(t.event,e,n,t.targetSessionId,t.targetWindowId))}ei(t){try{let e,n=t.event;if(t.compressionEnabled)try{({event:n,size:e}=fa(t.event))}catch(t){Vo.warn("could not process queued compression event - will use uncompressed event",t)}li(e)&&(e=ks(t.event));try{this.ti(t,n,e)}catch(t){Vo.warn("could not capture queued compression event",t)}}finally{this.Yn(t)}}Xe(){[...this.Ae].forEach(t=>{try{this.ei(t)}catch(t){Vo.warn("could not drain queued compression event",t)}})}ni(t,e,n,i){var r=this;const o={event:t,compressionEnabled:e,targetSessionId:n,targetWindowId:i,generation:this.Oe,processed:!1,counted:!0};this.Ae.push(o),this.$e+=1;const a=(l=s(function*(){try{if(o.processed)return;let n,i;try{const r=e?ua(t)?yield function(t){return va.apply(this,arguments)}(t):fa(t):{event:t,size:ks(t)};n=r.event,i=r.size}catch(e){Vo.warn("could not process queued compression event - will use uncompressed event",e),n=t,i=ks(t)}r.ti(o,n,i)}finally{r.Yn(o)}}),function(){return l.apply(this,arguments)});var l;this.jn=this.jn?this.jn.catch(()=>{}).then(a):a()}onRRwebEmit(t){var e,n,i,r,s,o,a,l,u,c,h,d;if(!this._instance.sessionManager)return;if(this.Cn(),!t||!ai(t))return;if(4===t.type){const e=this.mn(t.data.href);if(this.xn=e,!e)return;t.data.href=e}else this.Sn();if(null===(e=this.re)||void 0===e||e.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.$n(t,e)),this.Y.urlBlocked&&(5!==(c=t).type||"recording paused"!==c.data.tag))return;2===t.type&&(this.Kn(),Promise.resolve().then(()=>this.Kn()),this.Mn(),null===(h=this.Bn)||void 0===h||h.reset(),null===(d=this._instance.persistence)||void 0===d||d.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const f=2===t.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));f&&this.ii();const v=this.Bn?this.Bn.throttleMutations(t):t;if(!v)return void(!0===this.de&&this.he++);const p=function(t){const e=t;if(e&&ai(e)&&6===e.type&&ai(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const n=[];for(let t=0;e.data.payload.payload.length>t;t++)n.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=n,t}return t}(v),m=function(t){return ga(t)?t.data.payload:null}(p),g=function(t){return ya(t)?t.data.payload:null}(p),y=function(t){return ma(t)?t.data.payload:null}(p);m||g?(null==m?void 0:m.lastActivityTimestamp)&&(p.timestamp=m.lastActivityTimestamp):(null==y?void 0:y.sessionId)||this.ri(p);const b=null!==(i=null!==(r=null!==(s=null==m?void 0:m.currentSessionId)&&void 0!==s?s:null==g?void 0:g.nextSessionId)&&void 0!==r?r:null==y?void 0:y.sessionId)&&void 0!==i?i:this.Xt,w=null!==(o=null!==(a=null!==(l=null==m?void 0:m.currentWindowId)&&void 0!==l?l:null==g?void 0:g.nextWindowId)&&void 0!==a?a:null==y?void 0:y.windowId)&&void 0!==o?o:this.je;if(!0===this.de&&!function(t){return ma(t)||ga(t)||ya(t)}(p))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(p)&&this.he++);2===p.type&&(this.he=0),y&&(p.timestamp=y.lastActivityTimestamp+y.threshold);const k=this.ae;this.ae=!0,f?this.kn(!0):k||this.kn();const _=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===p.type&&"$json_ld"===p.data.tag){let t;try{t=Qn?this.mn(Qn.location.href):void 0}catch(t){}p.data.href=t}if(this.$e>0||_&&ua(p))return void this.ni(p,_,b,w);const{event:S,size:C}=_?fa(p):{event:p,size:ks(p)};this.Qn(p,S,C,b,w)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.ke,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):Xr}log(t,e="log"){var n;null===(n=this._instance.sessionRecording)||void 0===n||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.Rn(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.Rn(),this.qt("sampling_overridden")}overrideTrigger(t){this.$n(t),this.Rn()}oi(){try{var t;const e=null==Qn||null===(t=Qn.location)||void 0===t?void 0:t.href;if(!e)return;const n=this.mn(e);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}Nn(){this.si&&(clearTimeout(this.si),this.si=void 0)}Gn(){this.si||(this.si=setTimeout(()=>{this.Ye()},2e3))}ai(){return this.Te!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!ga(t)&&!ya(t))}li(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}ui(t){if("buffering"!==t)return li(this.ci)||this._instance.register_for_session({[qr]:[]}),void(this.ci=void 0);const e=this.li();if(0===e.length)return li(this.ci)||this._instance.register_for_session({[qr]:[]}),void(this.ci=void 0);const n=e.join(", "),i=`${this.sessionId}:${n}`;i!==this.ci&&(this.ci=i,this._instance.register_for_session({[qr]:e}),Vo.info(`buffering: ${n}`))}di(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.hi)&&oo.At()}fi(){0!==this.Rt.data.length&&this.Rt.size!==this.pi&&943718.4>=this.Rt.size&&this.di()&&(this.pi=this.Rt.size,oo.$t(this.an,this.Rt))}Ln(){if(this.Ee||!this.di())return;this.Ee=!0;const t=oo.Dt(this.an);oo.Pt(this.an),ai(t)&&si(t.data)&&0!==t.data.length&&si(t.sizes)&&t.sizes.length===t.data.length&&di(t.size)&&t.sessionId===this.Xt&&t.windowId===this.je&&(this.Rt.data.length>0||(this.Rt=t))}Ye(t=!1){var e;if(this.Nn(),this.ge)return this.Rt;if(this.ai())return this.Rt.size>943718.4?this.tn():(t&&this.fi(),this.Rt);const n=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const r=this.Ge(),s=this.status;if(this.ui(s),"buffering"===s||"paused"===s||"disabled"===s||r)return!t||"active"!==s&&"sampled"!==s||this.fi(),this.Gn(),this.Rt;if(this.Rt!==n)return this.Rt;if(n.data.length>0){var o;const t=this.oi();Ss(n).forEach(e=>{try{var n;null===(n=this.Be)||void 0===n||n.trackSize(e.sessionId,e.size),this.mi(i(i(i(i({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:ao.LIB_NAME,$lib_version:ao.LIB_VERSION,$snapshot_host:t},this.fe>0?{$sdk_debug_replay_throttled_mutations_dropped:this.fe}:{}),this.ve>0?{$sdk_debug_replay_oversized_mutations_dropped:this.ve}:{}),this.pe>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe}:{}),this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){Vo.warn("could not capture snapshot chunk - skipping it",t)}}),li(this.pi)||(oo.Pt(this.an),this.pi=void 0),null===(o=this.re)||void 0===o||o.onFlushComplete()}return this.tn()}Jn(t){var e;const n=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),i=t.$session_id,r=this.Rt.sessionId!==i;if(r||!0!==this.de&&!this.ge&&this.Rt.size+t.$snapshot_bytes+n>943718.4){const e=this.Xt;if(this.Rt=this.Ye(),this.Xt!==e)return;r&&this.Rt.data.length>0&&(this.Rt=this.tn()),this.Rt.sessionId=i,this.Rt.windowId=t.$window_id}this.ge&&(this.be||this.Rt.size+t.$snapshot_bytes+n>943718.4)?this.be=!0:(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.ge||this.Gn())}mi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const n=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return n?n.timestamp-this._sessionStartTimestamp:null}ii(){if(!this.Rt||0===this.Rt.data.length)return this.tn();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.tn():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}tn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.je},this.Rt}qt(t,e){this._instance.register_for_session({[Qr]:t}),Vo.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",i({reason:t},e))}gi(t){var e;return 3===t.type&&-1!==Zo.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ri(t){const e=this.gi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Tn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.je}),this.Ye());const{windowId:n,sessionId:i}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let r=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}const s=this.Xt!==i,o=this.je!==n;if(this.je=n,this.Xt=i,s||o){const t=s&&!1!==this.de;t&&(this.de="unknown"),this.He(t)}else if(e&&this.Rn(),r){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.re)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this.kn(),this.Mn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Hn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(t=this.Be)||void 0===t?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this.ke,[Zr]:this.yi,[Jr]:this._e}}get yi(){var t,e,n;return!!this.se&&(null===(t=null===(e=Xo())||void 0===e||null===(n=e.isRecording)||void 0===n?void 0:n.call(e))||void 0===t||t)}Dn(){var t;if(this.se)return;this._e=!0;const e={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},n=this._instance.config.session_recording;for(const[t,r]of Object.entries(n||{}))if(t in e)if("maskInputOptions"===t)e.maskInputOptions=i({password:!0},r);else if("sampling"===t){const t=null!=r?r:{},n={};li(t.mousemove)||(n.mousemove=t.mousemove),li(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),e.sampling=n}else e[t]=r;var r,s,o,a;!0===(null==n?void 0:n.captureJsonLd)&&!0!==e.slimDOMOptions&&"all"!==e.slimDOMOptions&&(e.slimDOMOptions=i(i({},e.slimDOMOptions),{},{script:!0})),this.dn&&this.dn.enabled&&(e.recordCanvas=!0,e.sampling=i(i({},e.sampling),{},{canvas:this.dn.fps}),e.dataURLOptions={type:"image/webp",quality:this.dn.quality},e.canvasResolutionScale=this.cn,e.canvasMasking={configured:()=>{var t;return oi(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const n=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(oi(n))try{var i;return null!==(i=n(t))&&void 0!==i?i:null}catch(t){return this.Ie||(this.Ie=!0,Vo.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.ln&&(e.maskAllInputs=null===(r=this.ln.maskAllInputs)||void 0===r||r,e.maskTextSelector=null!==(s=this.ln.maskTextSelector)&&void 0!==s?s:void 0,e.blockSelector=null!==(o=this.ln.blockSelector)&&void 0!==o?o:void 0,e.maskAllElementAttributes=null!==(a=this.ln.maskAllElementAttributes)&&void 0!==a&&a),e.maskAllElementAttributes&&e.maskAttributeFn&&(e.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,Vo.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.un();const l=Xo();if(!l)return void Vo.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Bn=null!==(t=this.Bn)&&void 0!==t?t:new ro(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const n=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;Vo.info(n,{node:e}),this.log("[SessionRecording] "+n,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const u=this.vn();if(this.se=l(i(i({emit:t=>{this.onRRwebEmit(t)},plugins:u,errorHandler:(t,e)=>"rrweb"===e&&(this.Me||(this.Me=!0,Vo.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},e),{},{recordAfter:"DOMContentLoaded"})),!this.se)return this.ke=!0,void Vo.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ke=!1,!0===(null==n?void 0:n.captureJsonLd)&&Yn&&(null==Qn?void 0:Qn.MutationObserver)&&!this._n&&(this._n=function(t,e,n){const i=new WeakMap,r=n.getCaptureState||(()=>!0);let s=_o;const o=function(t,e){const n=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==n?void 0:n.length)&&!n.includes("id")?Io:n=>{const i=t.getElementById(n);return!!i&&"SCRIPT"!==i.nodeName&&(!e.isRecordedElement||e.isRecordedElement(i))&&!qo(i,e.blockClass,e.blockSelector)}}(t,n),a=e=>{try{const a=r();if(!s||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){return qo(t,e.blockClass,e.blockSelector)||qo(t,e.maskTextClass,e.maskTextSelector)}(e,n))return;const l=function(t,e=Io,n){if(!t||t.length>_o)return null;try{const i=JSON.parse(t),r={maskUrl:n,remainingNodes:2048,exceeded:!1},s=si(i)?i.map(t=>Bo(t,e,r)):Bo(i,e,r);if(r.exceeded||ci(s)||si(s)&&(!s.length||s.some(ci)))return null;const o=JSON.stringify(s);return o.length>2e4?null:[s,o]}catch(t){return null}}(e.text,o,n.maskUrl);if(!l)return void i.delete(e);const[u,c]=l;if(ci(a))return void i.set(e,c);if(i.get(e)!==c){if(c.length>s)return void(s=0);n.emit(u)&&(i.set(e,c),s-=c.length)}}catch(t){return}};try{const n=new e(t=>{try{if(!s||!1===r())return;const e=t=>{for(const e of Ho(t))a(e)};for(const n of t)if("childList"===n.type)Wo(n.target)&&a(n.target),n.addedNodes.forEach(e);else if("characterData"===n.type){const t=n.target.parentNode;t&&Wo(t)&&a(t)}else"attributes"===n.type&&Wo(n.target)&&a(n.target)}catch(t){return}});return n.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){s&&!1!==r()&&Ho(t.documentElement).forEach(t=>{e&&i.delete(t),a(t)})},stop(){return n.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(Yn,Qn.MutationObserver,{maskUrl:t=>this.mn(t),attributeFilter:e.attributeFilter,blockClass:e.blockClass,blockSelector:e.blockSelector,isRecordedElement:t=>l.mirror.getId(t)>0,maskAllElementAttributes:e.maskAllElementAttributes,maskAttributeFn:e.maskAttributeFn,maskTextClass:e.maskTextClass,maskTextSelector:e.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.bn()},emit:t=>this.wn(t)}),this.Y.isCurrentUrlBlocked()&&this._n.scan()),this.le=Date.now(),this.de=fi(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:e,activePlugins:u.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};ei.__PosthogExtensions__=ei.__PosthogExtensions__||{},ei.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:Jn,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:Tr,options:t})},ei.__PosthogExtensions__.rrweb={record:Fn,version:"v2",wasMaxDepthReached:()=>Kt,resetMaxDepthState(){Kt=!1,Yt=!1},getLastSnapshotCost:()=>j,getMutationCost:()=>i({},q),getDeferredStylesheetStats:()=>i({},H),getDiscardedDurationSamples:()=>T,getObserverInitFailures:()=>Ve.size?Array.from(Ve):void 0,resetSnapshotCostState(){D=0,L=0,N=0,x=0,T=0,P={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},j=null,z=null,B=[],W=0,U=0,q={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},ei.__PosthogExtensions__.initSessionRecording=(t,e)=>new ba(t,e)}();
|
|
1
|
+
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e,n,i){return(n=function(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function i(t){for(var i=1;arguments.length>i;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?n(Object(r),!0).forEach(function(n){e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function r(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function s(t){return function(){var e=this,n=arguments;return new Promise(function(i,s){var o=t.apply(e,n);function a(t){r(o,i,s,a,l,"next",t)}function l(t){r(o,i,s,a,l,"throw",t)}a(void 0)})}}const o=["type"];var a=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),l=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),u=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),c=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),h=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),d=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),f=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function v(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var p=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${p.source}`,"i"),new RegExp(p.source,"gi"),"0".repeat(32),"0".repeat(16);var m={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},g={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},y={};function b(t){if(y[t])return y[t];const e=function(t){var e,n;const i=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(n=e.__symbol__)||void 0===n?void 0:n.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],n=e.prototype,i=t in m?m[t]:void 0,r=Boolean(i&&i.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(n,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),s=t in g?g[t]:void 0,o=Boolean(s&&s.every(t=>{var e;return"function"==typeof n[t]&&(null===(e=n[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(r&&o)return y[t]=e.prototype,e.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const i=a.contentWindow;if(!i)return e.prototype;const r=i[t].prototype;return r?(v(u=navigator.userAgent,"AppleWebKit")&&!v(u,"Chrome")&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",t),l=!0),y[t]=r):n}catch(t){return n}finally{!l&&a.parentNode&&document.body.removeChild(a)}var u}var w=Object.create(null);function k(t,e,n){var i;const r=w[t],s=r[n];if(s)return s.call(e);const o=b(t),a=null===(i=Object.getOwnPropertyDescriptor(o,n))||void 0===i?void 0:i.get;return a?(r[n]=a,a.call(e)):e[n]}w.Node=Object.create(null),w.ShadowRoot=Object.create(null),w.MutationObserver=Object.create(null),w.Element=Object.create(null);var _,S={};function C(t,e,n){const i=`${t}.${String(n)}`;if(S[i])return S[i].bind(e);const r=b(t)[n];return"function"!=typeof r?e[n]:(S[i]=r,r.bind(e))}function I(){return b("MutationObserver").constructor}function M(t,e,n){try{if(!(e in t))return()=>{};const i=t[e],r={next:i},s=n(function(...t){return r.next.apply(this,t)});return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=r.next);const n=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let i=t[e],o=n(i);for(;o;){if(o.next===s)return void(o.next=r.next);i=o.next,o=n(i)}}}catch(t){return()=>{}}}var R={childNodes:t=>k("Node",t,"childNodes"),parentNode:t=>k("Node",t,"parentNode"),parentElement:t=>k("Node",t,"parentElement"),textContent:t=>k("Node",t,"textContent"),isConnected(t){if(void 0===_){var e;const t=null===(e=Object.getOwnPropertyDescriptor(b("Node"),"isConnected"))||void 0===e?void 0:e.get;_=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==_?void 0:_.call(t)},contains:(t,e)=>C("Node",t,"contains")(e),getRootNode:t=>C("Node",t,"getRootNode")(),host:t=>t&&"host"in t?k("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?k("Element",t,"shadowRoot"):null,querySelector:(t,e)=>C("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>C("Element",t,"querySelectorAll")(e),mutationObserver:I,patch:M};function A(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var x=0,T=0;function O(){x+=1}function E(){return x}function F(t,e){return(e!==x||t>6e4)&&(T+=1,!0)}var D=0,L=0,N=0,P={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},j=null,z=null,B=[],W=0,U=0,q={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function G(t){var e;(D+=1)>1||(P={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},B=[],W=0,z=(e=t)&&e>0?e:null,L=A(),N=x)}function V(){return 0===D?j||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(D-=1)>0?P:(P.durationMs=A()-L,P.deferredStylesheetCount=W,H.deferredCount+=W,z=null,F(P.durationMs,N)?P:j=P)}function Z(t,e,n){let i=t.length;if(n>=32)return i;for(let r=0;t.length>r;r++){const s=t[r];try{const t=s.cssRules;if(t&&t.length)i+=Z(t,e,n+1);else if(e&&s.styleSheet){const t=s.styleSheet;if(!e.has(t)){e.add(t);const r=t.rules||t.cssRules;r&&(i+=Z(r,e,n+1))}}}catch(t){}}return i}function J(t){if(0===D)return;const e=Z(t,null,0);P.cssRuleCount+=e,U>0&&(P.nonDeferrableCssRuleCount+=e)}function Q(t){U+=1;try{return t()}finally{U-=1}}function X(t){D>0&&(P.stylesheetMs+=t)}function Y(t){if(0===D||null===z)return!1;const e=P.cssRuleCount-P.nonDeferrableCssRuleCount;return e>=z||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const n=new WeakSet;return n.add(t),Z(e,n,0)}catch(t){return 0}}(t)>z}function K(){const t=B;return B=[],t}function tt(){H.failedCount+=1}function et(t){t>0&&(H.abandonedCount+=t)}function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function it(t,e,n){return(e=function(t){var e=function(t){if("object"!=nt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rt(t){return t.nodeType===t.ELEMENT_NODE}function st(t){const e=t&&"host"in t&&"mode"in t&&R.host(t)||null;return Boolean(e&&"shadowRoot"in e&&R.shadowRoot(e)===t)}function ot(t){return"[object ShadowRoot]"==={}.toString.call(t)}function at(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function lt(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const n=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?n.push("layer"):t.layerName&&n.push(`layer(${t.layerName})`),t.supportsText&&n.push(`supports(${t.supportsText})`),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}var ut=0;function ct(t){const e=0===ut,n=e?A():0;ut+=1;try{const e=t.rules||t.cssRules;if(!e)return null;J(e);let n=t.href;return!n&&t.ownerNode&&(n=t.ownerNode.baseURI),at(Array.from(e,t=>ht(t,n)).join(""))}catch(t){return null}finally{ut-=1,e&&X(A()-n)}}function ht(t,e){if(ft(t)){let e;try{e=ct(t.styleSheet)||lt(t)}catch(n){e=t.cssText}try{var n;if(e&&(null===(n=t.styleSheet)||void 0===n?void 0:n.href))return xt(e,t.styleSheet.href)}catch(t){}return e}{let n=t.cssText;return vt(t)&&t.selectorText.includes(":")&&(n=dt(n)),e?xt(n,e):n}}function dt(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function ft(t){return"styleSheet"in t}function vt(t){return"selectorText"in t}var pt=/^-?[A-Za-z_][\w-]*$/,mt=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function gt(t){const e=[];let n=!1,i=null;const r=new Map;function s(t){const r=e.pop();if("group"===r.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void s(null)}const n=e[e.length-1];return n.parts.push(t),void(n.index+=1)}if(!r.importRule)return n=!0,void(i=t);o(e[e.length-1],r.importRule,t)}function o(t,e,n){try{let r;try{r=n||lt(e)}catch(t){r=e.cssText}try{var i;r&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href)&&(r=xt(r,e.styleSheet.href))}catch(t){}r&&t.parts.push(r),t.index+=1}catch(t){s(null)}}function a(t){const n=t.rules[t.index];if("sheet"===t.kind&&ft(n)){const i=r.get(n);return null===i?(t.parts.push(n.cssText),void(t.index+=1)):i?void e.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:n}):void o(t,n,null)}if(function(t,n){try{const i=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(vt(t)){if("number"==typeof e.type&&1!==e.type)return null;const n=e.style?e.style.cssText:"";return`${t.selectorText} {${n?" "+n:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!pt.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let i="";try{var n;i=(null===(n=t.constructor)||void 0===n?void 0:n.name)||""}catch(t){return null}return""===i||"Object"===i||"CSSSupportsRule"===i?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?pt.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":mt.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===i)return!1;const r=n.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:r,index:0,parts:[],prelude:r?xt(i,r):i,fixColons:"sheet"===n.kind&&vt(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(n,t))return;let i=n.cssText;"sheet"===t.kind&&vt(n)&&n.selectorText.includes(":")&&(i=dt(i)),t.parts.push(t.sheetHref?xt(i,t.sheetHref):i),t.index+=1}return function(t){try{const n=t.rules||t.cssRules;if(!n)return!1;J(n);let i=t.href;!i&&t.ownerNode&&(i=t.ownerNode.baseURI);const s=Array.from(n);return e.push({kind:"sheet",sheet:t,rules:s,sheetHref:i,index:0,parts:[],importRule:null}),function(t,e){const n=[{sheet:e,rules:t,index:0}];for(;n.length>0;){const t=n[n.length-1];if(t.index>=t.rules.length){n.pop();continue}const e=t.rules[t.index];if(t.index+=1,!ft(e)||r.has(e))continue;let i=null;try{i=e.styleSheet}catch(t){r.set(e,null);continue}if(i&&!n.some(t=>t.sheet===i))try{const t=i.rules||i.cssRules;if(!t)continue;J(t);let s=i.href;!s&&i.ownerNode&&(s=i.ownerNode.baseURI);const o=Array.from(t);r.set(e,{sheet:i,rules:o,sheetHref:s}),n.push({sheet:i,rules:o,index:0})}catch(t){}}}(s,t),!0}catch(t){return!1}}(t)||(n=!0),{advance(t){if(n)return!0;const r=A();let o=t>0?t:1;try{for(;!n&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const n=t.prelude+t.parts.join("")+"}";e=t.fixColons?dt(n):n}else e=at(t.parts.join(""))}catch(t){}s(e);continue}o-=1;try{a(t)}catch(t){s(null)}}}catch(t){n=!0,i=null}finally{X(A()-r)}return n},text:()=>n?i:null,remainingRules(){if(n)return 0;let t=0;for(const n of e)t+=n.rules.length-n.index;return t}}}var yt=class{constructor(){it(this,"idNodeMap",new Map),it(this,"nodeMetaMap",new WeakMap)}getId(t){var e,n;return t&&null!==(e=null===(n=this.getMeta(t))||void 0===n?void 0:n.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),rt(t)){const e=R.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const n=this.getNode(t);if(n){const t=this.nodeMetaMap.get(n);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function bt({element:t,maskInputOptions:e,tagName:n,type:i,value:r,maskInputFn:s}){let o=r||"";const a=i&&wt(i);return(e[n.toLowerCase()]||a&&e[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function wt(t){return t.toLowerCase()}var kt=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function _t({element:t,name:e,value:n,maskAllElementAttributes:i,maskAttributeFn:r,isGenerated:s=!1}){return n?i?s&&kt.has(wt(e))?n:"*".repeat(n.length):r?r(e,n,t):n:n}var St="__rrweb_original__";function Ct(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?wt(e):null}catch(t){return null}}var It=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Mt=/^(?:[a-z+]+:)?\/\//i,Rt=/^www\..*/i,At=/^(data:)([^,]*),(.*)/i;function xt(t,e){return(t||"").replace(It,(t,n,i,r,s,o)=>{const a=i||s||o,l=n||r||"";if(!a)return t;if(Mt.test(a)||Rt.test(a))return`url(${l}${a}${l})`;if(At.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+a}${l})`;const u=e.split("/"),c=a.split("/");u.pop();for(const t of c)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${l}${u.join("/")}${l})`})}var Tt,Ot,Et=new Map,Ft=1,$t=new RegExp("[^a-z0-9-_:]");function Dt(){return Ft++}var Lt=!1,Nt=/^[^ \t\n\r\u000c]+/,Pt=/^[, \t\n\r\u000c]+/,jt=new WeakMap;function zt(t,e){return e&&""!==e.trim()?Bt(t,e):e}function Bt(t,e){let n=jt.get(t);if(n||(n=t.createElement("a"),jt.set(t,n)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return n.setAttribute("href",e),n.href}function Wt(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function Ut(t,e,n,i,r,s){if(!i)return i;if("src"===n||"href"===n&&("use"!==e||"#"!==i[0])){if("link"===e&&r){var o;const t=null===(o=r.sheet)||void 0===o?void 0:o.href;if(t)return t}const n=zt(t,i);if(n.startsWith("data:")){if("img"===e&&r){let t=n;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(t=function(t,e,n,i){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const r=Et.get(e);if(r&&r.type===n&&r.quality===i)return r.result;try{const r=document.createElement("canvas");r.width=t.naturalWidth,r.height=t.naturalHeight;const s=r.getContext("2d");if(!s)return e;s.drawImage(t,0,0);const o=r.toDataURL(n||"image/webp",null!=i?i:.4),a=e.length>o.length?o:e;if(Et.size>=10){const t=Et.keys().next().value;void 0!==t&&Et.delete(t)}return Et.set(e,{type:n,quality:i,result:a}),a}catch(t){return e}}(r,n,s.type,s.quality)),Wt(t,s)}if("image"===e)return Wt(n,s)}return n}if("xlink:href"===n&&"#"!==i[0]){const n=zt(t,i);return"image"===e&&n.startsWith("data:")?Wt(n,s):n}return"background"!==n||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===n?function(t,e){if(""===e.trim())return e;let n=0;function i(t){let i;const r=t.exec(e.substring(n));return r?(i=r[0],n+=i.length,i):""}const r=[];for(;i(Pt),e.length>n;){let s=i(Nt);if(","===s.slice(-1))s=zt(t,s.substring(0,s.length-1)),r.push(s);else{let i="";s=zt(t,s);let o=!1;for(;;){const t=e.charAt(n);if(""===t){r.push((s+i).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){n+=1,r.push((s+i).trim());break}"("===t&&(o=!0)}i+=t,n+=1}}}return r.join(", ")}(t,i):"style"===n?xt(i,Bt(t)):"object"===e&&"data"===n?zt(t,i):i:zt(t,i)}function qt(t,e,n){return("video"===t||"audio"===t)&&"autoplay"===wt(e)}function Ht(t){return"string"==typeof t&&wt(t).split(/\s+/).includes("stylesheet")}function Gt(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&Gt(R.parentNode(t),e,n);for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;return!!n&&Gt(R.parentNode(t),e,n)}function Vt(t,e,n,i){let r;if(rt(t)){if(r=t,!R.childNodes(r).length)return!1}else{if(null===R.parentElement(t))return!1;r=R.parentElement(t)}try{if("string"==typeof e){if(i){if(r.closest(`.${e}`))return!0}else if(r.classList.contains(e))return!0}else if(Gt(r,e,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(t){}return!1}function Zt(t,e,n){const i=t.removeEventListener;"function"==typeof i&&i.call(t,e,n)}var Jt=new Map;function Qt(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Xt(t){return null==t?"":t.toLowerCase()}var Yt=!1,Kt=!1;function te(t,e){const{doc:n,mirror:i,blockClass:r,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g={},inlineImages:y=!1,recordCanvas:b=!1,canvasMaskingConfigured:w,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S=5e3,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:M=5e3,keepIframeSrcFn:A=()=>!1,newlyAddedElement:x=!1,depth:T=0,maxDepth:O=50}=e;let{needsMask:E}=e,{preserveWhiteSpace:F=!0}=e;if(T>=O)return Kt=!0,Yt||(Yt=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${O}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;E||(E=Vt(t,o,a,void 0===E)),D>0&&(P.nodeCount+=1);const L=function(t,e){const{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAllElementAttributes:h=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:p,recordCanvas:m,canvasMaskingConfigured:g,keepIframeSrcFn:y,newlyAddedElement:b=!1}=e,w=function(t,e){if(!e.hasNode(t))return;const n=e.getId(t);return 1===n?void 0:n}(n,i);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:f.Document,childNodes:[],compatMode:t.compatMode}:{type:f.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e){const{doc:n,blockClass:i,blockSelector:r,inlineStylesheet:s,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:u,dataURLOptions:c={},inlineImages:h,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:p,newlyAddedElement:m=!1,rootId:g}=e,y=function(t,e,n){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;if(n)return t.matches(n)}catch(t){}return!1}(t,i,r),b=function(t){if(t instanceof HTMLFormElement)return"form";const e=wt(t.tagName);return $t.test(e)?"div":e}(t),w=new Set;let k={};const _=t.attributes.length;for(let e=0;_>e;e++){const i=t.attributes[e];qt(b,i.name)||(k[i.name]=Ut(n,b,wt(i.name),i.value,t,c))}if("link"===b&&s&&!y&&Ht(k.rel)){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=Qt(n,i),!e&&i.includes(".css"))&&(e=Qt(n,window.location.origin+"/"+i.replace(window.location.href,"")))}let i=null;e&&(Y(e)?D>0&&(B.push(t),W+=1):i=ct(e)),i&&(delete k.rel,delete k.href,k._cssText=i)}var S;if("style"===b&&t.sheet&&!(t.innerText||R.textContent(t)||"").trim().length){const e=Q(()=>ct(t.sheet));e&&(k._cssText=e)}if("input"===b||"textarea"===b||"select"===b){const e=t.value,n=t.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&e?k.value=bt({element:t,type:Ct(t),tagName:b,value:e,maskInputOptions:o,maskInputFn:a}):n&&(k.checked=n)}if("option"===b&&(t.selected&&!o.select?k.selected=!0:delete k.selected),"dialog"===b&&t.open){try{k.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}w.add("rr_open_mode")}if("canvas"===b&&d&&!(null==v?void 0:v()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let n=0;t.width>n;n+=50)for(let i=0;t.height>i;i+=50){const r=e.getImageData,s=St in r?r[St]:r;let o;try{o=s.call(e,n,i,Math.min(50,t.width-n),Math.min(50,t.height-i))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(k.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){const e=t.toDataURL(c.type,c.quality),i=n.createElement("canvas");i.width=t.width,i.height=t.height,e!==i.toDataURL(c.type,c.quality)&&(k.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(S=t)?void 0:S.name)?Lt||(Lt=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",S)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",S)}let C,I=!1;if("img"===b&&h){Tt||(Tt=n.createElement("canvas"),Ot=Tt.getContext("2d"));const e=t,i=e.currentSrc||e.getAttribute("src")||"<unknown-src>",r=e.crossOrigin,s=(e,n)=>I?_t({element:t,name:e,value:n,maskAllElementAttributes:l,maskAttributeFn:u}):n,o=()=>{Zt(e,"load",o);try{Tt.width=e.naturalWidth,Tt.height=e.naturalHeight,Ot.drawImage(e,0,0);const t=Tt.toDataURL(c.type,c.quality);k.rr_dataURL=s("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${i}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(r?k.crossOrigin=s("crossOrigin",r):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===b||"video"===b){const e=k;e.rr_mediaState=t.paused?"paused":"played",w.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(m||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),y){var M,A,x;const{width:e,height:i,left:r,top:s}=t.getBoundingClientRect(),o=null===(M=n.defaultView)||void 0===M?void 0:M.getComputedStyle(t);k={class:k.class,rr_width:`${e}px`,rr_height:`${i}px`,rr_left:`${Math.floor(r+((null===(A=n.defaultView)||void 0===A?void 0:A.scrollX)||0))}px`,rr_top:`${Math.floor(s+((null===(x=n.defaultView)||void 0===x?void 0:x.scrollY)||0))}px`},w.add("rr_width"),w.add("rr_height"),w.add("rr_left"),w.add("rr_top"),o&&(k.rr_position=o.position||"static",w.add("rr_position"),o.transform&&"none"!==o.transform&&(k.rr_transform=o.transform,w.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(k.rr_display=o.display,w.add("rr_display")))}if("iframe"!==b||p(k.src)||(t.contentDocument||(k.rr_src=k.src),delete k.src),l||u)for(const[e,n]of Object.entries(k))"string"!=typeof n&&null!==n||(k[e]=_t({element:t,name:e,value:n,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:w.has(e)}));I=!0;try{customElements.get(b)&&(C=!0)}catch(t){}return{type:f.Element,tagName:b,attributes:k,childNodes:[],isSVG:(T=t,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:y,rootId:g,isCustom:C};var T}(t,{doc:n,blockClass:r,blockSelector:s,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:d,dataURLOptions:v,inlineImages:p,recordCanvas:m,canvasMaskingConfigured:g,keepIframeSrcFn:y,newlyAddedElement:b,rootId:w});case t.TEXT_NODE:return function(t,e){const{needsMask:n,maskTextFn:i,rootId:r}=e,s=R.parentNode(t),o=s&&s.tagName;let a=R.textContent(t);const l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var c;if(t.nextSibling||t.previousSibling);else if(Y(s.sheet));else if(null===(c=s.sheet)||void 0===c?void 0:c.cssRules){const t=ct(s.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(a=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}a=xt(a,Bt(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&n&&(a=i?i(a,R.parentElement(t)):a.replace(/[\S]/g,"*")),{type:f.Text,textContent:a||"",isStyle:l,rootId:r}}(t,{doc:n,needsMask:o,maskTextFn:u,rootId:w});case t.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:f.Comment,textContent:R.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:E,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,keepIframeSrcFn:A,newlyAddedElement:x});if(!L)return console.warn(t,"not serialized"),null;let N;N=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===f.Comment)return!0;if(t.type===f.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let n;try{n=new URL(t,window.location.href)}catch(t){return null}const i=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==i?void 0:i[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Xt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Xt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Xt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Xt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Xt(t.attributes.property).match(/^(og|twitter|fb):/)||Xt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Xt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Xt(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Xt(t.attributes.name))||Xt(t.attributes.property).match(/^article:/)||Xt(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Xt(t.attributes.name)))return!0}}return!1}(L,m)||!F&&L.type===f.Text&&!L.isStyle&&!L.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Dt();const j=Object.assign(L,{id:N});if(i.add(t,j),-2===N)return null;k&&k(t);let z=!l;if(j.type===f.Element){z=z&&!j.needBlock,delete j.needBlock;const e=R.shadowRoot(t);e&&ot(e)&&(j.isShadowHost=!0)}if((j.type===f.Document||j.type===f.Element)&&z){m.headWhitespace&&j.type===f.Element&&"head"===j.tagName&&(F=!1);const e={doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:E,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:A,depth:T+1,maxDepth:O};if(j.type===f.Element&&"textarea"===j.tagName&&void 0!==j.attributes.value);else for(const n of Array.from(R.childNodes(t))){const t=te(n,e);t&&j.childNodes.push(t)}let x=null;if(rt(t)&&(x=R.shadowRoot(t)))for(const t of Array.from(R.childNodes(x))){const n=te(t,e);n&&(ot(x)&&(n.isShadow=!0),j.childNodes.push(n))}}const U=R.parentNode(t);if(U&&st(U)&&ot(U)&&(j.isShadow=!0),j.type===f.Element&&"iframe"===j.tagName){const e=function(t,e,n){const i=()=>{},r=t.contentWindow;if(!r)return i;let s;try{s=r.document.readyState}catch(t){return i}const o=()=>e();if("complete"!==s){let i=!1,r=null;const s=()=>{i||(i=!0,null!==r&&(clearTimeout(r),r=null),Zt(t,"load",a),t.addEventListener("load",o),e())},a=()=>s();return r=setTimeout(s,n),t.addEventListener("load",a),()=>{null!==r&&(clearTimeout(r),r=null),i?Zt(t,"load",o):(i=!0,Zt(t,"load",a))}}const a="about:blank";let l;try{l=r.location.href}catch(t){return i}if(l!==a||t.src===a||""===t.src){const n=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(n),Zt(t,"load",o)}}return t.addEventListener("load",o),()=>{Zt(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&_){const n=te(e,{doc:e,mirror:i,blockClass:r,blockSelector:s,needsMask:E,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:A,depth:T+1,maxDepth:O});n&&_(t,n)}},S);null==C||C(t,e)}return j.type===f.Element&&"link"===j.tagName&&Ht(j.attributes.rel)&&function(e,l,f){if(Jt.has(e))return;let C;try{C=e.sheet}catch(t){return}if(C)return;const R=new AbortController;let x=!1;const D=()=>{if(!x){x=!0;try{(()=>{if(I){const e=te(t,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:E,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:y,recordCanvas:b,canvasMaskingConfigured:w,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:_,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:A,depth:T,maxDepth:O});e&&I(t,e)}})()}finally{Jt.delete(e),R.abort()}}},L=setTimeout(D,f);R.signal.addEventListener("abort",()=>clearTimeout(L),{once:!0}),e.addEventListener("load",D,{signal:R.signal,once:!0}),Jt.set(e,R)}(t,0,M),j}function ee(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var ne=class t{constructor(...t){it(this,"parentElement",null),it(this,"parentNode",null),it(this,"ownerDocument",void 0),it(this,"firstChild",null),it(this,"lastChild",null),it(this,"previousSibling",null),it(this,"nextSibling",null),it(this,"ELEMENT_NODE",1),it(this,"TEXT_NODE",3),it(this,"nodeType",void 0),it(this,"nodeName",void 0),it(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function ie(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>re(n,t,e,i)}function re(t,e,n,i){se(()=>{const r=t.removeEventListener;"function"==typeof r&&(void 0!==i?r.call(t,e,n,i):r.call(t,e,n))})}function se(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function oe(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var ae="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.",le={map:{},getId(){return console.warn(ae),-1},getNode(){return console.warn(ae),null},removeNodeFromMap(){console.warn(ae)},has(){return console.warn(ae),!1},reset(){console.warn(ae)}};function ue(t,e,n={}){let i=null,r=0;return function(...s){const o=Date.now();r||!1!==n.leading||(r=o);const a=e-(o-r),l=this;0>=a||a>e?(i&&(clearTimeout(i),i=null),r=o,t.apply(l,s)):i||!1===n.trailing||(i=setTimeout(()=>{r=!1===n.leading?0:Date.now(),i=null,t.apply(l,s)},a))}}function ce(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e),o=()=>ce(t,e,s||{},!0);if(i)return r.Object.defineProperty(t,e,n),o;const a=function(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var n,i;const r=null===(n=t.Zone)||void 0===n||null===(i=n.__symbol__)||void 0===i?void 0:i.call(n,"setTimeout"),s=r?t[r]:void 0;"function"==typeof s&&(e=s)}catch(t){}if(!e)return()=>{};const r=e;return e=>{try{r.call(t,e,0)}catch(t){}}}(r);return r.Object.defineProperty(t,e,{set(t){if(a(()=>{try{n.set.call(this,t)}catch(t){}}),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(le=new Proxy(le,{get(t,e,n){return"map"===e&&console.warn(ae),Reflect.get(t,e,n)}}));var he=Date.now;function de(t){var e,n,i,r;const s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null===(e=R.parentElement(s.body))||void 0===e?void 0:e.scrollLeft)||(null==s||null===(n=s.body)||void 0===n?void 0:n.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null===(i=R.parentElement(s.body))||void 0===i?void 0:i.scrollTop)||(null==s||null===(r=s.body)||void 0===r?void 0:r.scrollTop)||0}}function fe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ve(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function pe(t){return t?t.nodeType===t.ELEMENT_NODE?t:R.parentElement(t):null}function me(t,e,n,i){if(!t)return!1;const r=pe(t);if(!r)return!1;try{if("string"==typeof e){if(r.classList.contains(e))return!0;if(i&&null!==r.closest("."+e))return!0}else if(Gt(r,e,i))return!0}catch(t){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function ge(t,e,n){return!("TITLE"!==t.tagName||!n.headTitleMutations)||-2===e.getId(t)}function ye(t,e){if(st(t))return!1;const n=e.getId(t);if(!e.has(n))return!0;const i=R.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||ye(i,e))}function be(t){return Boolean(t.changedTouches)}function we(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function ke(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function _e(t){return!!t&&(t instanceof ne&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(R.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(he=()=>(new Date).getTime());var Se=class{constructor(){it(this,"id",1),it(this,"styleIDMap",new WeakMap),it(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let n;return n=void 0===e?this.id++:e,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ce(t){var e;let n=null;return"getRootNode"in t&&(null===(e=R.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&R.host(R.getRootNode(t))&&(n=R.host(R.getRootNode(t))),n}function Ie(t){const e=t.ownerDocument;if(!e)return!1;if(R.contains(e,t))return!0;const n=R.isConnected(t);return"boolean"==typeof n?n:function(t){const e=t.ownerDocument;if(!e)return!1;const n=function(t){let e,n=t;for(;e=Ce(n);)n=e;return n}(t);return R.contains(e,n)}(t)}function Me(t){return"__ln"in t}var Re,Ae=class{constructor(){it(this,"length",0),it(this,"head",null),it(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let n=0;t>n;n++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Me(t.previousSibling)){const n=t.previousSibling.__ln.next;e.next=n,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,n&&(n.previous=e)}else if(t.nextSibling&&Me(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;e.previous=n,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,n&&(n.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},xe=(t,e)=>`${t}@${e}`,Te=class{constructor(){it(this,"frozen",!1),it(this,"locked",!1),it(this,"texts",[]),it(this,"attributes",[]),it(this,"attributeMap",new WeakMap),it(this,"generatedAttributes",new WeakMap),it(this,"removes",[]),it(this,"mapRemoves",new Set),it(this,"movedMap",{}),it(this,"addedSet",new Set),it(this,"movedSet",new Set),it(this,"droppedSet",new Set),it(this,"removesSubTreeCache",new Set),it(this,"mutationCb",void 0),it(this,"blockClass",void 0),it(this,"blockSelector",void 0),it(this,"maskTextClass",void 0),it(this,"maskTextSelector",void 0),it(this,"inlineStylesheet",void 0),it(this,"maskInputOptions",void 0),it(this,"maskTextFn",void 0),it(this,"maskInputFn",void 0),it(this,"maskAllElementAttributes",void 0),it(this,"maskAttributeFn",void 0),it(this,"keepIframeSrcFn",void 0),it(this,"recordCanvas",void 0),it(this,"canvasMaskingConfigured",void 0),it(this,"inlineImages",void 0),it(this,"slimDOMOptions",void 0),it(this,"dataURLOptions",void 0),it(this,"doc",void 0),it(this,"mirror",void 0),it(this,"iframeManager",void 0),it(this,"stylesheetManager",void 0),it(this,"shadowDomManager",void 0),it(this,"canvasManager",void 0),it(this,"processedNodeManager",void 0),it(this,"unattachedDoc",void 0),it(this,"canvasManagerReleased",!1),it(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),it(this,"emit",()=>{if(this.frozen||this.locked)return;const t=A(),e=E();try{this.processBufferedMutations()}finally{n=A()-t,i=e,D>0||F(n,null!=i?i:x)||n>q.slowestBatchMs&&(q.slowestBatchMs=n)}var n,i}),it(this,"processBufferedMutations",()=>{const t=[],e=new Set,n=new Ae,i=t=>{let e=t,n=-2;for(;-2===n;)e=e&&e.nextSibling,n=e&&this.mirror.getId(e);return n};let r;const s=s=>{var o;const a=R.parentNode(s);if(!a||!Ie(s)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=st(a)?this.mirror.getId(Ce(s)):this.mirror.getId(a),u=i(s);if(-1===l||-1===u)return n.addNode(s);null!==(o=r)&&void 0!==o||(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,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{we(t,this.mirror)&&this.iframeManager.addIframe(t),ke(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),_e(t)&&!me(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(R.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const c=te(s,r);c&&(t.push({parentId:l,nextId:u,node:c}),e.add(c.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)Ee(this.removesSubTreeCache,t)&&!this.movedSet.has(R.parentNode(t))||s(t);for(const t of this.addedSet)Fe(this.droppedSet,t)||Ee(this.removesSubTreeCache,t)?Fe(this.movedSet,t)?s(t):this.droppedSet.add(t):s(t);let o=null;for(;n.length;){let t=null;if(o){const e=this.mirror.getId(R.parentNode(o.value)),n=i(o.value);-1!==e&&-1!==n&&(t=o)}if(!t){let e=n.tail;for(;e;){const n=e;if(e=e.previous,n){const e=this.mirror.getId(R.parentNode(n.value));if(-1===i(n.value))continue;if(-1!==e){t=n;break}{const e=R.parentNode(n.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=R.host(e);if(-1!==this.mirror.getId(i)){t=n;break}}}}}}if(!t){for(;n.head;)n.removeNode(n.head.value);break}o=t.previous,n.removeNode(t.value),s(t.value)}const a={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,n=R.parentNode(e);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const n=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>n.length&&(n+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[i,r]of Object.entries(e))if("string"==typeof r||null===r){var n;e[i]=_t({element:t.node,name:i,value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(n=this.generatedAttributes.get(t.node))||void 0===n?void 0:n.has(i)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),it(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),it(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const n=Array.from(R.childNodes(t),t=>R.textContent(t)||"").join("");e.attributes.value=bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Ct(t),value:n,maskInputFn:this.maskInputFn})}),it(this,"processMutation",t=>{if(!ge(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=R.textContent(t.target);me(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Vt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,pe(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const i=t.target,r=wt(i.tagName),s=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let a=function(t,e,n){if(!n)return e;const i=t.getAttributeNodeNS(n,e);if(i)return i.name;if("http://www.w3.org/1999/xlink"===n)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===n)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===n)return"xmlns"===e?e:`xmlns:${e}`;const r=t.lookupPrefix(n);return r?`${r}:${e}`:e}(i,s,o),l=o?i.getAttributeNS(o,s):t.target.getAttribute(s);if("value"===a){const t=i,e=Ct(t);l=bt({element:t,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(me(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let u=this.attributeMap.get(t.target);const c="iframe"===r&&"src"===a;if(c&&!this.keepIframeSrcFn(l)&&i.contentDocument)return;if("type"===a&&"input"===r&&"password"===(t.oldValue||"").toLowerCase()&&i.setAttribute("data-rr-is-password","true"),!qt(r,a)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=Ut(this.doc,r,wt(a),l,i,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(l)&&(a="rr_src"),u.attributes[a]=e,null===(n=this.generatedAttributes.get(t.target))||void 0===n||n.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),n=i.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(n)){const i=n.getPropertyValue(t),r=n.getPropertyPriority(t);i!==e.style.getPropertyValue(t)||r!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===r?i:[i,r]:u._unchangedStyles[t]=[i,r]}for(const t of Array.from(e.style))""===n.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===a&&"dialog"===r){u.attributes.rr_open_mode=i.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(me(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const n=this.mirror.getId(e),i=st(t.target)?this.mirror.getId(R.host(t.target)):this.mirror.getId(t.target);me(t.target,this.blockClass,this.blockSelector,!1)||ge(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Oe(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||ye(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[xe(n,i)]?Oe(this.movedSet,e):(this.removes.push({parentId:i,id:n,isShadow:!(!st(t.target)||!ot(t.target))||void 0}),function(t,e){const n=[t];for(;n.length;){const t=n.pop();e.has(t)||(e.add(t),R.childNodes(t).forEach(t=>n.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),it(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(ge(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;e&&this.mirror.hasNode(e)&&(n=this.mirror.getId(e)),n&&-1!==n&&(this.movedMap[xe(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!me(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=R.childNodes(t);for(let t=0,n=e.length;n>t;t++){const n=e[t];n&&this.genAdds(n)}if(_e(t)){const e=R.childNodes(R.shadowRoot(t));for(let n=0,i=e.length;i>n;n++){const i=e[n];i&&(this.processedNodeManager.add(i,this),this.genAdds(i,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,n=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(n&&(n.lastIndex=0),me(t,n||e,this.blockSelector,!0))return!0;const i="getRootNode"in t?R.getRootNode(t):null;t=(null==i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?R.host(i):null}return!1}};function Oe(t,e){const n=[e];for(;n.length;){const e=n.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const i=R.childNodes(e);for(let t=0,e=i.length;e>t;t++){const e=i[t];e&&n.push(e)}}}function Ee(t,e,n){return 0!==t.size&&function(t,e){const n=R.parentNode(e);return!!n&&t.has(n)}(t,e)}function Fe(t,e){if(0===t.size)return!1;let n=R.parentNode(e);for(;n;){if(t.has(n))return!0;n=R.parentNode(n)}return!1}function $e(t){Re=t}function De(){Re=void 0}var Le=(t,e="rrweb")=>Re?(...n)=>{try{return t(...n)}catch(t){if(Re&&!0===Re(t,e))return;throw t}}:t,Ne=[];function Pe(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function je(t,e){const n=new Te;let i;n.init(t);try{i=new(I())(Le(n.processMutations.bind(n)));const r={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(r.attributeFilter=t.attributeFilter),i.observe(e,r),Ne.push(n),{observer:i,buffer:n}}catch(t){try{null==i||i.disconnect(),n.destroy(),n.reset()}catch(t){}throw t}}function ze({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){const o=new Map,a=s=>{const a=Pe(s);if(!a||me(a,i,r,!0))return;const l=n.getId(a);let u,c;if(a===e&&e.defaultView){const t=de(e.defaultView);u=t.left,c=t.top}else u=a.scrollLeft,c=a.scrollTop;const h=`${u},${c}`;o.get(l)!==h&&(o.set(l,h),t({id:l,x:u,y:c}))},l=[ie("scroll",Le(ue(Le(t=>a(t)),s.scroll||100)),e)];return"onscrollend"in e&&l.push(ie("scrollend",Le(a),e)),()=>l.forEach(t=>t())}function Be(t,e){for(let n=Ne.length-1;n>=0;n--){const i=Ne[n];if(!i)continue;let r=i.bufferBelongsToIframe(t);!r&&e&&e.has(i.bufferDoc())&&(r=!0),r&&(i.reset(),Ne.splice(n,1))}}var We=["INPUT","TEXTAREA","SELECT"],Ue=new WeakMap;function qe(t){return function t(e,n){if(Je("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Je("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Je("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Je("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const i=Array.from(e.parentRule.cssRules).indexOf(e);return n.unshift(i),t(e.parentRule,n)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);n.unshift(t)}return n}(t,[])}function He(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function Ge({mirror:t,stylesheetManager:e},n){var i,r;let s=null;s=t.getId("#document"===n.nodeName?n:R.host(n));const o="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(r=n.ownerDocument)||void 0===r||null===(r=r.defaultView)||void 0===r?void 0:r.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&a?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let n;try{var i;n=null===(i=a.set)||void 0===i?void 0:i.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{e.adoptStyleSheets(t,s)}catch(t){}return n}}),Le(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Ve=new Set;function Ze(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let r,s;!function(t,e){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:d,selectionCb:f,customElementCb:v}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),n(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),i(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),r(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),s(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),c(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),f(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),v(...t)}}(t,e);const o=[],a=Le(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Ne.indexOf(s);-1!==t&&Ne.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect()}finally{oe(o)}}),h=(t,e)=>{const n=Le(()=>{try{return e()}catch(e){throw Ve.add(t),e}})();"function"==typeof n&&o.push(n)};try{if(t.recordDOM&&h("mutation",()=>{const e=je(t,t.doc);r=e.observer,s=e.buffer}),h("move",()=>function({mousemoveCb:t,sampling:e,doc:n,mirror:i}){if(!1===e.mousemove)return()=>{};const r="number"==typeof e.mousemove?e.mousemove:50,s="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const u=ue(Le(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null}),s),c=Le(ue(Le(t=>{const e=Pe(t),{clientX:n,clientY:r}=be(t)?t.changedTouches[0]:t;o||(o=he()),a.push({x:n,y:r,id:i.getId(e),timeOffset:he()-o}),u("undefined"!=typeof DragEvent&&t instanceof DragEvent?l.Drag:t instanceof MouseEvent?l.MouseMove:l.TouchMove)}),r,{trailing:!1})),h=[ie("mousemove",c,n),ie("touchmove",c,n),ie("drag",c,n)];return Le(()=>{h.forEach(t=>t())})}(t)),h("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,l=[];let h=null;return Object.keys(u).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==a[t]).forEach(o=>{let a=wt(o);const d=(e=>o=>{const a=Pe(o);if(me(a,r,s,!0))return;let l=null,d=e;if("pointerType"in o){switch(o.pointerType){case"mouse":l=c.Mouse;break;case"touch":l=c.Touch;break;case"pen":l=c.Pen}l===c.Touch&&(u[e]===u.MouseDown?d="TouchStart":u[e]===u.MouseUp&&(d="TouchEnd"))}else be(o)&&(l=c.Touch);null!==l?(h=l,(d.startsWith("Touch")&&l===c.Touch||d.startsWith("Mouse")&&l===c.Mouse)&&(l=null)):u[e]===u.Click&&(l=h,h=null);const f=be(o)?o.changedTouches[0]:o;if(!f)return;const v=n.getId(a),{clientX:p,clientY:m}=f;Le(t)(i({type:u[d],id:v,x:p,y:m},null!==l&&{pointerType:l}))})(o);if(window.PointerEvent)switch(u[o]){case u.MouseDown:case u.MouseUp:a=a.replace("mouse","pointer");break;case u.TouchStart:case u.TouchEnd:return}l.push(ie(a,d,e))}),Le(()=>{l.forEach(t=>t())})}(t)),h("scroll",()=>ze(t)),h("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let n=-1,i=-1;return ie("resize",Le(ue(Le(()=>{const e=fe(),r=ve();n===e&&i===r||(t({width:Number(r),height:Number(e)}),n=e,i=r)}),200)),e)}(t,{win:n})),h("input",()=>function({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:u,sampling:c,userTriggeredOnInput:h}){function d(t){let n=Pe(t);const i=t.isTrusted,c=e.defaultView;if(n&&c&&!(n instanceof c.HTMLElement))return;const d=n&&n.tagName;if(n&&"OPTION"===d&&(n=R.parentElement(n)),!n||!d||0>We.indexOf(d)||me(n,r,s,!0))return;if(n.classList.contains(o)||a&&n.matches(a))return;let v=n.value,p=!1;const m=Ct(n)||"";"radio"===m||"checkbox"===m?p=n.checked:(l[d.toLowerCase()]||l[m])&&(v=bt({element:n,maskInputOptions:l,tagName:d,type:m,value:v,maskInputFn:u})),f(n,h?{text:v,isChecked:p,userTriggered:i}:{text:v,isChecked:p});const g=n.name;"radio"===m&&g&&p&&e.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(t=>{if(t!==n){const e=t.value;f(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function f(e,r){const s=Ue.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Ue.set(e,r);const s=n.getId(e);Le(t)(i(i({},r),{},{id:s}))}}const v=("last"===c.input?["change"]:["input","change"]).map(t=>ie(t,Le(d),e)),p=e.defaultView;if(!p)return()=>{v.forEach(t=>t())};const m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&v.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map(t=>ce(t[0],t[1],{set(){Le(d)({target:this,isTrusted:!1})}},!1,p))),Le(()=>{oe(v)})}(t)),h("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r,doc:s}){const o=Le(s=>ue(Le(r=>{const o=Pe(r);if(!o||me(o,e,n,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:h}=o;t({type:s,id:i.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:h})}),r.media||500)),a=[ie("play",o(d.Play),s),ie("pause",o(d.Pause),s),ie("seeked",o(d.Seeked),s),ie("volumechange",o(d.VolumeChange),s),ie("ratechange",o(d.RateChange),s)];return Le(()=>{a.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,n=new Set;let i=!0;const r=t=>{if(i)try{t()}catch(t){}},s=t=>{var n;const i=e.get(t);if(i){for(;null===(n=i[0])||void 0===n?void 0:n.ready;){const t=i.shift();(null==t?void 0:t.emit)&&r(t.emit)}0===i.length&&e.delete(t)}};return{queueMutation(t,n){if(!t)return void r(n);const i=e.get(t);i?(i.push({emit:n,ready:!0}),s(t)):r(n)},queuePendingMutation(o,a,l){if(!i)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const c={emit:a,ready:!1};u.push(c);let h,d=!1,f=!1;const v=()=>{d||f||(d=!0,void 0!==h&&n.delete(h),c.ready=!0,c.emit=void 0,s(o))};try{h=t.setTimeout(v,5e3),d||f?t.clearTimeout(h):n.add(h)}catch(t){v()}return e=>{!f&&i&&(f=!0,void 0!==h&&(t.clearTimeout(h),n.delete(h)),d?e&&r(l):(c.ready=!0,e||(c.emit=void 0),s(o)))}},reset(){i=!1,n.forEach(e=>t.clearTimeout(e)),n.clear(),e.clear()}}}(n);o.push(e.reset),h("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:i,mutationQueue:r}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=He(s,e,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&r.queueMutation(s,()=>t({id:u,styleId:c,adds:[{rule:a,index:l}]})),l},"host")}),i.CSSStyleSheet.prototype.addRule=function(t,e,n=this.cssRules.length){return i.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,n])};const o=i.CSSStyleSheet.prototype.deleteRule;let a,l;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=He(s,e,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&r.queueMutation(s,()=>t({id:u,styleId:c,removes:[{index:a}]})),l},"host")}),i.CSSStyleSheet.prototype.removeRule=function(t){return i.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},i.CSSStyleSheet.prototype.replace&&(a=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);try{const i=null==l?void 0:l.then;if(s.ownerNode||!l||"function"!=typeof i)return l;n.onCssomSheetMutation(s);const{id:o,styleId:u}=He(s,e,n.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return l;const c=r.queuePendingMutation(s,()=>t({id:o,styleId:u,replace:a}),()=>{const e=ct(s);null!==e&&t({id:o,styleId:u,replace:e})});try{i.call(l,()=>c(!0),()=>c(!1))}catch(t){c(!1)}}catch(t){}return l},"host")})),i.CSSStyleSheet.prototype.replaceSync&&(l=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=He(s,e,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&r.queueMutation(s,()=>t({id:u,styleId:c,replaceSync:a})),l},"host")}));const u={};Qe("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(Qe("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),Qe("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),Qe("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const c={};return Object.entries(u).forEach(([i,s])=>{c[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(c[i].insertRule,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=He(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...qe(s),l];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,adds:[{rule:a,index:e}]}))}return l},"host")}),s.prototype.deleteRule=new Proxy(c[i].deleteRule,{apply:Le((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=He(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...qe(s),a];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),Le(()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=o,a&&(i.CSSStyleSheet.prototype.replace=a),l&&(i.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})})}(t,{win:n,mutationQueue:e})),h("adoptedStyleSheet",()=>Ge(t,t.doc)),h("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:i},{win:r,mutationQueue:s}){const o=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Le((r,o,a)=>{var l;const[u,c,h]=a,d=r.apply(o,a);if(n.has(u))return d;const f=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;i.onCssomSheetMutation(f);const{id:v,styleId:p}=He(f,e,i.styleMirror);if(v&&-1!==v||p&&-1!==p){const e=qe(o.parentRule);s.queueMutation(f,()=>t({id:v,styleId:p,set:{property:u,value:c,priority:h},index:e}))}return d},"host")});const a=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Le((r,o,a)=>{var l;const[u]=a,c=r.apply(o,a);if(n.has(u))return c;const h=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;i.onCssomSheetMutation(h);const{id:d,styleId:f}=He(h,e,i.styleMirror);if(d&&-1!==d||f&&-1!==f){const e=qe(o.parentRule);s.queueMutation(h,()=>t({id:d,styleId:f,remove:{property:u},index:e}))}return c},"host")}),Le(()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:n,mutationQueue:e})),t.collectFonts&&h("font",()=>function({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const i=[],r=new WeakMap,s=n.FontFace;n.FontFace=function(t,e,n){const i=new s(t,e,n);return r.set(i,{family:t,buffer:"string"!=typeof e,descriptors:n,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};const o=M(e.fonts,"add",function(e){return function(n){return setTimeout(Le(()=>{const e=r.get(n);e&&(t(e),r.delete(n))}),0),e.apply(this,[n])}});return i.push(()=>{n.FontFace=s}),i.push(o),Le(()=>{i.forEach(t=>t())})}(t))}h("selection",()=>function(t){const{doc:e,mirror:n,blockClass:i,blockSelector:r,selectionCb:s}=t;let o=!0;const a=Le(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;l>e;e++){const{startContainer:s,startOffset:o,endContainer:l,endOffset:u}=t.getRangeAt(e);me(s,i,r,!0)||me(l,i,r,!0)||a.push({start:n.getId(s),startOffset:o,end:n.getId(l),endOffset:u})}s({ranges:a})});return a(),ie("selectionchange",a)}(t)),h("customElement",()=>function({doc:t,customElementCb:e}){const n=t.defaultView;return n&&n.customElements?M(n.customElements,"define",function(t){return function(n,i,r){try{e({define:{name:n}})}catch(t){console.warn(`Custom element callback failed for ${n}`)}return t.apply(this,[n,i,r])}}):()=>{}}(t));for(const e of t.plugins)h(`plugin:${e.name}`,()=>e.observer(e.callback,n,e.options))}catch(t){try{a()}catch(t){}throw t}return a}function Je(t){return void 0!==window[t]}function Qe(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Xe=class{constructor(t){it(this,"generateIdFn",void 0),it(this,"iframeRemoteIdToLocalIdMap",new WeakMap),it(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,n,i){if(0>e)return e;const r=n||this.getRemoteIdToLocalIdMap(t),s=i||this.getLocalIdToRemoteIdMap(t);let o=r.get(e);return void 0===o&&(o=this.generateIdFn(),r.set(e,o),s.set(o,e)),o}getIds(t,e){const n=this.getRemoteIdToLocalIdMap(t),i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,n,i))}getRemoteId(t,e,n){var i;return"number"!=typeof e||0>e?e:null!==(i=(n||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==i?i:-1}getRemoteIds(t,e){const n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,n))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},Ye=class{constructor(t){it(this,"iframes",new WeakMap),it(this,"crossOriginIframeMap",new WeakMap),it(this,"crossOriginIframeMirror",new Xe(Dt)),it(this,"crossOriginIframeStyleMirror",void 0),it(this,"crossOriginIframeRootIdMap",new WeakMap),it(this,"mirror",void 0),it(this,"mutationCb",void 0),it(this,"wrappedEmit",void 0),it(this,"loadListener",void 0),it(this,"pageHideListener",void 0),it(this,"stylesheetManager",void 0),it(this,"recordCrossOriginIframes",void 0),it(this,"messageHandler",void 0),it(this,"nestedIframeListeners",new Map),it(this,"attachedWindows",new WeakMap),it(this,"attachedDocuments",new WeakMap),it(this,"attachedIframes",new Map),it(this,"loadListenerDisposers",new WeakMap),it(this,"iframeElementsById",new Map),it(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Xe(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let n=this.loadListenerDisposers.get(t);n||(n=new Set,this.loadListenerDisposers.set(t,n)),n.add(e);const i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,n,i;return null!==(e=null!==(n=null===(i=this.attachedIframes.get(t))||void 0===i?void 0:i.element)&&void 0!==n?n:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>se(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{re(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const n=this.mirror.getId(t);return this.attachedIframes.set(n,{element:t,content:e}),n}attachIframe(t,e){var n;const i=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const r=t.contentWindow;if(this.recordCrossOriginIframes&&r&&!this.nestedIframeListeners.has(r)){const e=this.handleMessage.bind(this);se(()=>{r.addEventListener("message",e),this.nestedIframeListeners.set(r,e);let n=this.attachedWindows.get(t);n||(n=new Set,this.attachedWindows.set(t,n)),n.add(r)})}se(()=>{const e=t.contentWindow;if(!e)return;let n=this.pageHideHandlers.get(t);if(n)for(const t of n)if(t.win===e)return;const i=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",i),n||(n=new Set,this.pageHideHandlers.set(t,n)),n.add({win:e,handler:i})}),null===(n=this.loadListener)||void 0===n||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const i=this.transformCrossOriginEvent(n,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case a.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const n=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,n),this.patchRootIdOnNode(e.data.node,n),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:a.IncrementalSnapshot,data:{source:l.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case a.Meta:case a.Load:case a.DomContentLoaded:return!1;case a.Plugin:return e;case a.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case a.IncrementalSnapshot:switch(e.data.source){case l.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const n=this.crossOriginIframeRootIdMap.get(t);n&&this.patchRootIdOnNode(e.node,n)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case l.Drag:case l.TouchMove:case l.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case l.ViewportResize:return!1;case l.MediaInteraction:case l.MouseInteraction:case l.Scroll:case l.CanvasMutation:case l.Input:return this.replaceIds(e.data,t,["id"]),e;case l.StyleSheetRule:case l.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case l.Font:return e;case l.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case l.AdoptedStyleSheet:var n;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(n=e.data.styles)||void 0===n||n.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,n,i){for(const r of i)(Array.isArray(e[r])||"number"==typeof e[r])&&(e[r]=Array.isArray(e[r])?t.getIds(n,e[r]):t.getId(n,e[r]));return e}replaceIds(t,e,n){return this.replace(this.crossOriginIframeMirror,t,e,n)}replaceStyleIds(t,e,n){return this.replace(this.crossOriginIframeStyleMirror,t,e,n)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===f.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),n=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),n){const t=n.contentWindow,e=this.attachedWindows.get(n);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(re(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(n)),t&&this.nestedIframeListeners.has(t)&&(re(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(n),this.disposeLoadListeners(n),this.removePageHideListener(n);const i=this.attachedDocuments.get(n);i&&(i.forEach(t=>{se(()=>this.mirror.removeNodeFromMap(t))}),se(()=>Be(n,i)),this.attachedDocuments.delete(n))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,n)=>{this.mirror.has(n)||t.push(n)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&re(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{re(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Ke=class{constructor(t){it(this,"shadowDoms",new WeakSet),it(this,"mutationCb",void 0),it(this,"scrollCb",void 0),it(this,"bypassOptions",void 0),it(this,"mirror",void 0),it(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var n,r;if(!ot(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(n=null===(r=R.host(t))||void 0===r?void 0:r.ownerDocument)&&void 0!==n?n:e,{observer:o,buffer:a}=je(i(i({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){o.disconnect(),a.destroy(),a.releaseCanvasManager();const t=Ne.indexOf(a);-1!==t&&Ne.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:ze(i(i({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(R.host(t))),this.restoreHandlers.push({doc:s,handler:Ge({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){se(()=>{const e=t.contentWindow,n=t.contentDocument;e&&n&&this.patchAttachShadow(e.Element,n)})}patchAttachShadow(t,e){const n=this;this.restoreHandlers.push({doc:e,handler:M(t.prototype,"attachShadow",function(t){return function(i){const r=t.call(this,i),s=R.shadowRoot(this);return s&&Ie(this)&&n.addShadowRoot(s,e),r}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const n of this.restoreHandlers)if(n.doc===t)try{n.handler()}catch(t){}else e.push(n);this.restoreHandlers=e}},tn="skip-frame";function en(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:n,width:i,height:r}=t;return Number.isFinite(e)&&Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(r)&&i>=0&&r>=0}for(var nn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),sn=0;64>sn;sn++)rn[nn.charCodeAt(sn)]=sn;var on=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;i>e;e+=3)r+=nn[n[e]>>2],r+=nn[(3&n[e])<<4|n[e+1]>>4],r+=nn[(15&n[e+1])<<2|n[e+2]>>6],r+=nn[63&n[e+2]];return i%3==2?r=r.substring(0,r.length-1)+"=":i%3==1&&(r=r.substring(0,r.length-2)+"=="),r},an=!1,ln=new Map,un=(t,e,n)=>{if(!t||!dn(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=ln.get(t);return n||(n=new Map,ln.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}(n,t.constructor.name);let r=i.indexOf(t);return-1===r&&(r=i.length,i.push(t)),r};function cn(t,e,n,i){if(t instanceof Array)return t.map(t=>cn(t,e,n,i));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:on(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[cn(t.buffer,e,n,i),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:n}=t;return{rr_type:e,src:n}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let n;try{n=t.toDataURL(i.type,i.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?an||(an=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:n}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[cn(t.data,e,n,i),t.width,t.height]}:dn(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:un(t,e,n)}:t}var hn=(t,e,n,i)=>t.map(t=>cn(t,e,n,i)),dn=(t,e)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(n.find(n=>t instanceof e[n]))},fn=["webgl","webgl2"];function vn(t){return"nodeType"in t}function pn(t,e,n,r){const s=[];try{if(r){const r=function(t,e,n){const r=t.GPUCanvasContext;if((null==r?void 0:r.prototype)&&"function"==typeof r.prototype.configure)return M(r.prototype,"configure",function(r){return function(s){const o=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!o||vn(o)&&me(o,e,n,!0))return r.call(this,s);vn(o)&&!("__context"in o)&&(o.__context="webgpu");const a=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return r.call(this,null!==a&&s?i(i({},s),{},{usage:"number"==typeof s.usage?s.usage|a:a}):s)}})}(t,e,n);r&&s.push(r)}const o=M(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(i,...s){const o=function(t){return"experimental-webgl"===t?"webgl":t}(i);if(!me(this,e,n,!0)&&("__context"in this||(this.__context=o),r&&fn.includes(o)))if(s[0]&&"object"==typeof s[0]){const t=s[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[i,...s])}});s.push(o)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function mn(t,e,n,i,r,s,o){const a=[],l=Object.getOwnPropertyNames(t);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const l=M(t,u,function(t){return function(...a){const l=t.apply(this,a);if(un(l,s,this),this.canvas&&"tagName"in this.canvas&&!me(this.canvas,i,r,!0)){let t;try{t=hn(a,s,this,o)}catch(t){}t&&n(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(s){const o=ce(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!me(this.canvas,i,r,!0)&&n(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var gn='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',yn="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",gn],{type:"text/javascript;charset=utf-8"});function bn(t){let e;try{if(e=yn&&(self.URL||self.webkitURL).createObjectURL(yn),!e)throw"";const n=new Worker(e,{name:null==t?void 0:t.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(gn),{name:null==t?void 0:t.name})}}var wn="A page CSP that omits blob: from worker-src or script-src blocks it";function kn(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var _n,Sn,Cn,In=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){it(this,"pendingCanvasMutations",new Map),it(this,"rafStamps",{latestId:0,invokeId:null}),it(this,"mirror",void 0),it(this,"mutationCb",void 0),it(this,"resetObservers",void 0),it(this,"frozen",!1),it(this,"locked",!1),it(this,"rafIdTimestamp",null),it(this,"rafIdFlush",null),it(this,"refCount",0),it(this,"torndown",!1),it(this,"resetFrameDedup",null),it(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:n,blockClass:i,blockSelector:r,recordCanvas:s,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&"all"===e&&this.initCanvasMutationObserver(n,i,r,o),s&&"number"==typeof e&&this.initCanvasFPSObserver(e,n,i,r,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(t,e,n,i,r){var o=this;if(!("OffscreenCanvas"in e))return void kn("disabled because this browser does not support OffscreenCanvas");const a="number"==typeof r.resolutionScale&&Number.isFinite(r.resolutionScale)?Math.min(1,Math.max(.1,r.resolutionScale)):1,l=pn(e,n,i,!0),u=new Map;let c;try{c=new bn}catch(t){return kn(`disabled because the encode worker did not start. ${wn}`,t),void l()}let d=!1;c.onerror=t=>{var e;d=!0,kn(`stopped because the encode worker failed. ${wn}`,t),cancelAnimationFrame(m),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=t=>{const{id:e}=t.data;if(u.set(e,!1),!("base64"in t.data))return;const{base64:n,type:i,displayWidth:r,displayHeight:s}=t.data;this.mutationCb({id:e,type:h["2D"],commands:[{property:"clearRect",args:[0,0,r,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0,r,s]}],displayWidth:r,displayHeight:s})};let f=!1,v=!1;const p=1e3/t;let m,g=0;const y=t=>{var l;d||(g&&p>t-g||(g=t,(()=>{const t=[],r=e=>{try{e.querySelectorAll("canvas").forEach(e=>{me(e,n,i,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&r(t.shadowRoot)})}catch(t){}};return r(e.document),t})().forEach((l=s(function*(t){const e=o.mirror.getId(t);if(-1!==e&&!u.get(e)&&0!==t.width&&0!==t.height){u.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var n,i;const r=t.getContext(t.__context);if(null==r||null===(n=r.isContextLost)||void 0===n?void 0:n.call(r))return void u.set(e,!1);!1===(null==r||null===(i=r.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&r.clear(r.COLOR_BUFFER_BIT)}const s=t.clientWidth||t.width,o=t.clientHeight||t.height,l=Math.max(1,Math.round(s*a)),h=Math.max(1,Math.round(o*a)),d=function(t,e,n,i,r,s){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return tn}if(void 0===o)return;if(!Array.isArray(o)||!o.every(en))return tn;const a=n/r,l=i/s;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*a),n=Math.floor(t.y*l);return{x:e,y:n,width:Math.ceil((t.x+t.width)*a)-e,height:Math.ceil((t.y+t.height)*l)-n}})}(r.canvasMasking,t,l,h,s,o);if("skip-frame"===d)return f||(f=!0,kn("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void u.set(e,!1);const v=yield createImageBitmap(t,1>a?{resizeWidth:l,resizeHeight:h,resizeQuality:"medium"}:{resizeWidth:l,resizeHeight:h});c.postMessage({id:e,bitmap:v,width:l,height:h,displayWidth:s,displayHeight:o,dataURLOptions:r.dataURLOptions,maskRegions:d},[v])}catch(t){v||(v=!0,kn("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),u.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),m=requestAnimationFrame(y))};m=requestAnimationFrame(y),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(m),null===(t=c.terminate)||void 0===t||t.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,n,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=pn(t,e,n,!1),s=function(t,e,n,i,r){const s=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])continue;const o=M(e.CanvasRenderingContext2D.prototype,a,function(s){return function(...o){return me(this.canvas,n,i,!0)||setTimeout(()=>{let n;try{n=hn(o,e,this,r)}catch(t){return}t(this.canvas,{type:h["2D"],property:a,args:n})},0),s.apply(this,o)}});s.push(o)}catch(r){const o=ce(e.CanvasRenderingContext2D.prototype,a,{set(e){me(this.canvas,n,i,!0)||t(this.canvas,{type:h["2D"],property:a,args:[e],setter:!0})}});s.push(o)}return()=>{s.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n,i),o=function(t,e,n,i,r){const s=[];return void 0!==e.WebGLRenderingContext&&s.push(...mn(e.WebGLRenderingContext.prototype,h.WebGL,t,n,i,e,r)),void 0!==e.WebGL2RenderingContext&&s.push(...mn(e.WebGL2RenderingContext.prototype,h.WebGL2,t,n,i,e,r)),()=>{s.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n,i);this.resetObservers=()=>{r(),s(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const n=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,n)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||-1===e)return;const i=n.map(t=>function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.includes(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;s.length>i;i++)e.includes(n=s[i])||{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,o)),{type:r}=n[0];this.mutationCb({id:e,type:r,commands:i}),this.pendingCanvasMutations.delete(t)}},Mn=class{constructor(t){var e;it(this,"trackedLinkElements",new WeakSet),it(this,"pendingDeferredSheets",new Set),it(this,"mutationCb",void 0),it(this,"adoptedStyleSheetCb",void 0),it(this,"maskAllElementAttributes",void 0),it(this,"maskAttributeFn",void 0),it(this,"styleMirror",new Se),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let n=null,i=null;try{i=t.sheet,i&&(n=gt(i))}catch(t){}if(!n||!i)return tt(),null;const r=n;let s=!1;const o={sheet:i,invalidate(){s=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:n=>{if(a)return!0;const l=A(),u=E();let c=!0;try{if(s)return a=!0,tt(),!0;if(!r.advance(n))return c=!1,!1;a=!0;const o=r.text();if(!t.isConnected)return!0;let l=null;try{l=t.sheet}catch(t){}return l!==i?(tt(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(tt(),!0)}finally{c&&this.pendingDeferredSheets.delete(o),F(h=A()-l,null!=(d=u)?d:x)||(H.totalMs+=h,h>H.slowestSliceMs&&(H.slowestSliceMs=h))}var h,d},remainingRules:()=>r.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var n;null===(n=this.beginDeferredLinkInlining(t,e))||void 0===n||n.advance(1/0)}emitCssTextMutation(t,e,n){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:_t({element:t,name:"_cssText",value:n,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const n={id:e,styleIds:[]},i=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const n=this.styleMirror.add(e);t=n;const r=A();try{Q(()=>{try{const t=e.rules||e.cssRules;t&&J(t)}catch(t){}i.push({styleId:n,rules:Array.from(e.rules||CSSRule,(t,n)=>({rule:ht(t,e.href),index:n}))})})}finally{X(A()-r)}}n.styleIds.push(t)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Jt.forEach(t=>t.abort()),Jt.clear()}trackStylesheetInLinkElement(t){}},Rn=class{constructor(){it(this,"nodeMap",new WeakMap),it(this,"active",!1)}inOtherBuffer(t,e){const n=this.nodeMap.get(t);return n&&Array.from(n).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},An=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var xn;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(xn=t.contentWindow)||void 0===xn?void 0:xn.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Tn=new yt,On=new Set([l.Mutation,l.MediaInteraction,l.StyleSheetRule,l.CanvasMutation,l.Font,l.Log,l.StyleDeclaration,l.AdoptedStyleSheet]);function En(t){const e=window;if("function"==typeof e.requestIdleCallback){const n=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,n)}}}const n=setTimeout(t,250);return{cancel:()=>clearTimeout(n)}}function Fn(t={}){let e,n=!1,r=!1;const{emit:s,checkoutEveryNms:o,checkoutEveryNth:u,blockClass:c="rr-block",blockSelector:h=null,ignoreClass:d="rr-ignore",ignoreSelector:f=null,maskTextClass:v="rr-mask",maskTextSelector:p=null,inlineStylesheet:m=!0,inlineStylesheetBudgetRules:g,maskAllInputs:y,maskInputOptions:b,slimDOMOptions:w,maskInputFn:k,maskTextFn:_,maskAllElementAttributes:S=!1,maskAttributeFn:C,hooks:I,packFn:M,sampling:A={},dataURLOptions:x={},canvasResolutionScale:T,canvasMasking:E,mousemoveWait:F,recordDOM:D=!0,recordCanvas:L=!1,recordCrossOriginIframes:N=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:j=!1,collectFonts:z=!1,inlineImages:B=!1,plugins:W,keepIframeSrcFn:U=()=>!1,ignoreCSSAttributes:q=new Set([]),attributeFilter:H,errorHandler:Z}=t;$e(Z);const J=i({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},x),Q=!N||window.parent===window;let X=!1;if(!Q)try{window.parent.document&&(X=!1)}catch(t){X=!0}if(Q&&!s)throw new Error("emit function is required");if(!Q&&!X)return()=>{};void 0!==F&&void 0===A.mousemove&&(A.mousemove=F),Tn.reset();const Y=!0===y?{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!==b?b:{password:!0},tt=ee(void 0!==w&&w);let nt;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let it=0;const rt=new Map;let st,ot;const at=t=>{for(const e of W||[])e.eventProcessor&&(t=e.eventProcessor(t));return M&&!X&&(t=M(t)),t};_n=(t,e)=>{var n;const i=t;if(i.timestamp=he(),!(null===(n=Ne[0])||void 0===n?void 0:n.isFrozen())||i.type===a.FullSnapshot||i.type===a.IncrementalSnapshot&&On.has(i.data.source)||Ne.forEach(t=>t.unfreeze()),Q)null==s||s(at(i),e);else if(X){const t={type:"rrweb",event:at(i),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(i.type===a.FullSnapshot)nt=i,it=0;else if(i.type===a.IncrementalSnapshot){if(i.data.source===l.Mutation&&i.data.isAttachIframe)return;it++,(u&&it>=u||o&&i.timestamp-nt.timestamp>o)&&Sn(!0)}};const lt=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,n=new Set;if(t.adds.length>0)for(const e of t.adds){const t=Tn.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&n.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const i=dt.getIframeElementById(t);i&&n.has(i)?dt.forgetIframeId(t):(null==st||st(t),dt.removeIframeById(t))}),null==ot||ot(),dt.cleanupDetachedIframes()}_n({type:a.IncrementalSnapshot,data:i({source:l.Mutation},t)})},ut=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Scroll},t)}),ct=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.CanvasMutation},t)}),ht=new Mn({mutationCb:lt,adoptedStyleSheetCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.AdoptedStyleSheet},t)}),maskAllElementAttributes:S,maskAttributeFn:C}),dt=new Ye({mirror:Tn,mutationCb:lt,stylesheetManager:ht,recordCrossOriginIframes:N,wrappedEmit:_n});for(const t of W||[])t.getMirror&&t.getMirror({nodeMirror:Tn,crossOriginIframeMirror:dt.crossOriginIframeMirror,crossOriginIframeStyleMirror:dt.crossOriginIframeStyleMirror});const ft=new Rn,vt=null==E?void 0:E.configured;Cn=new In({recordCanvas:L,mutationCb:ct,win:window,blockClass:c,blockSelector:h,mirror:Tn,sampling:A.canvas,dataURLOptions:J,resolutionScale:T,canvasMasking:E});const pt=new Ke({mutationCb:lt,scrollCb:ut,bypassOptions:{blockClass:c,blockSelector:h,maskTextClass:v,maskTextSelector:p,inlineStylesheet:m,maskInputOptions:Y,dataURLOptions:J,maskTextFn:_,maskInputFn:k,maskAllElementAttributes:S,maskAttributeFn:C,recordCanvas:L,canvasMaskingConfigured:vt,inlineImages:B,sampling:A,slimDOMOptions:tt,iframeManager:dt,stylesheetManager:ht,canvasManager:Cn,keepIframeSrcFn:U,processedNodeManager:ft,attributeFilter:H},mirror:Tn});Sn=(t=!1)=>{if(D){G(g);try{if(_n({type:a.Meta,data:{href:window.location.href,width:ve(),height:fe()}},t),n)return;null==e||e.cancel(),e=void 0,ht.reset(),pt.init(),Ne.forEach(t=>t.lock());let i=null,r=[];try{i=function(t,e){const{mirror:n=new yt,blockClass:i="rr-block",blockSelector:r=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,canvasMaskingConfigured:c,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:f,maskAllElementAttributes:v=!1,maskAttributeFn:p,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:I=()=>!1,maxDepth:M,inlineStylesheetBudgetRules:R}=e||{},A=!0===h?{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===h?{password:!0}:h,x=ee(m);G(R);try{return te(t,{doc:t,mirror:n,blockClass:i,blockSelector:r,maskTextClass:s,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:A,maskTextFn:d,maskInputFn:f,maskAllElementAttributes:v,maskAttributeFn:p,slimDOMOptions:x,dataURLOptions:g,inlineImages:l,recordCanvas:u,canvasMaskingConfigured:c,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:I,newlyAddedElement:!1,maxDepth:M})}finally{V()}}(document,{mirror:Tn,blockClass:c,blockSelector:h,maskTextClass:v,maskTextSelector:p,inlineStylesheet:m,maskAllInputs:Y,inlineStylesheetBudgetRules:g,maskTextFn:_,maskInputFn:k,maskAllElementAttributes:S,maskAttributeFn:C,slimDOM:tt,dataURLOptions:J,recordCanvas:L,canvasMaskingConfigured:vt,inlineImages:B,onSerialize(t){we(t,Tn)&&dt.addIframe(t),ke(t,Tn)&&ht.trackLinkElement(t),_e(t)&&pt.addShadowRoot(R.shadowRoot(t),document)},onIframeLoad(t,e){dt.attachIframe(t,e),pt.observeAttachShadow(t)},onIframeListenerRegistered(t,e){dt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){ht.attachLinkElement(t,e)},keepIframeSrcFn:U})}finally{r=K()}if(n)return;if(!i)return console.warn("Failed to snapshot the document");if(_n({type:a.FullSnapshot,data:{node:i,initialOffset:de(window)}},t),n)return;if(Ne.forEach(t=>t.unlock()),Cn.onFullSnapshot(),r.length){const t=function(t,e,n){let i=!1,r=null,s=0,o=null;const a=()=>null!==o||t.length>s,l=()=>{const n=t[s];t[s]=null,s+=1,n&&se(()=>{o=e.beginDeferredLinkInlining(n,Tn.getId(n))})},u=()=>{if(!o)return;const t=o;let e=!0;se(()=>{e=t.advance(200)}),e&&(o=null)},c=()=>{o||l(),u()},h=t=>{if(r=null,i)return;let e=0;do{try{c()}catch(t){null==o||o.discard(),o=null,et(1)}e+=1}while(!i&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));i||(a()?r=En(h):n())};return r=En(h),{cancel(){i=!0,null==o||o.discard(),o=null,null==r||r.cancel(),r=null},flush(){if(i)return;i=!0,null==r||r.cancel(),r=null;let e=0,c=0;for(;a()&&50>e;){o||l();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,c+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,c+=1}e+=1}}if(a()||c>0){let e=c+(null!==o?1:0);for(let n=s;t.length>n;n++)null!==t[n]&&(e+=1);et(e),null==o||o.discard(),o=null}n()}}}(r,ht,()=>{e===t&&(e=void 0)});e=t}N&&dt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ht.adoptStyleSheets(document.adoptedStyleSheets,Tn.getId(document))}finally{V()}}};try{const t=[];t.push(ie("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(ie(e,O,document));st=e=>{const n=rt.get(e);n&&(n.forEach(e=>{se(e);const n=t.indexOf(e);-1!==n&&t.splice(n,1)}),rt.delete(e))},ot=()=>{for(const[t]of rt){const e=Tn.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==st||st(t)}catch(e){null==st||st(t)}else null==st||st(t)}};const s=t=>{var e;return Le(Ze)({mutationCb:lt,mousemoveCb:(t,e)=>_n({type:a.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.MouseInteraction},t)}),scrollCb:ut,viewportResizeCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.ViewportResize},t)}),inputCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Input},t)}),mediaInteractionCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.MediaInteraction},t)}),styleSheetRuleCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.StyleSheetRule},t)}),styleDeclarationCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.StyleDeclaration},t)}),canvasMutationCb:ct,fontCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Font},t)}),selectionCb(t){_n({type:a.IncrementalSnapshot,data:i({source:l.Selection},t)})},customElementCb(t){_n({type:a.IncrementalSnapshot,data:i({source:l.CustomElement},t)})},blockClass:c,ignoreClass:d,ignoreSelector:f,maskTextClass:v,maskTextSelector:p,maskInputOptions:Y,inlineStylesheet:m,sampling:A,recordDOM:D,recordCanvas:L,canvasMaskingConfigured:vt,inlineImages:B,userTriggeredOnInput:j,collectFonts:z,doc:t,maskInputFn:k,maskTextFn:_,maskAllElementAttributes:S,maskAttributeFn:C,keepIframeSrcFn:U,blockSelector:h,slimDOMOptions:tt,dataURLOptions:J,mirror:Tn,iframeManager:dt,stylesheetManager:ht,shadowDomManager:pt,processedNodeManager:ft,canvasManager:Cn,ignoreCSSAttributes:q,attributeFilter:H,plugins:(null==W||null===(e=W.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>_n({type:a.Plugin,data:{plugin:t.name,payload:e}})})))||[]},I)};dt.addLoadListener(e=>{try{const n=Tn.getId(e),i=s(e.contentDocument);if("function"==typeof i&&(t.push(i),-1!==n)){let t=rt.get(n);t||(t=new Set,rt.set(n,t)),t.add(i)}}catch(t){console.warn(t)}}),dt.addPageHideListener(t=>{const e=Tn.getId(t);null==st||st(e),Be(t)});let o=-1;const u=t=>_n({type:a.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),g=()=>{var t,e,n,i;const r=document,s=null!==(t=null!==(e=null!==(n=null!==(i=r.fullscreenElement)&&void 0!==i?i:r.webkitFullscreenElement)&&void 0!==n?n:r.mozFullScreenElement)&&void 0!==e?e:r.msFullscreenElement)&&void 0!==t?t:null,a=s?Tn.getId(s):-1;a!==o&&(-1!==o&&u({id:o,enter:!1}),o=a,-1!==a&&u({id:a,enter:!0}))},y=()=>{if(n||r)return;if(r=!0,Sn(),n)return;const e=s(document);n?"function"==typeof e&&oe([e]):("function"==typeof e&&t.push(e),t.push(ie("fullscreenchange",g)),t.push(ie("webkitfullscreenchange",g)),t.push(ie("mozfullscreenchange",g)),t.push(ie("MSFullscreenChange",g)),An=!0)};return["interactive","complete"].includes(document.readyState)?y():(t.push(ie("DOMContentLoaded",()=>{_n({type:a.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&setTimeout(y,0)})),t.push(ie("load",()=>{_n({type:a.Load,data:{}}),"load"===P&&y()},window))),()=>{n=!0;try{null==e||e.flush()}catch(t){}e=void 0,oe(t),ft.destroy(),dt.removeLoadListener(),dt.destroy(),rt.clear(),pt.reset(),Tn.reset(),An=!1,De()}}catch(t){console.warn(t)}}Fn.addCustomEvent=(t,e)=>{if(!An)throw new Error("please add custom event after start recording");_n({type:a.Custom,data:{tag:t,payload:e}})},Fn.freezePage=()=>{Ne.forEach(t=>t.freeze())},Fn.takeFullSnapshot=t=>{if(!An)throw new Error("please take full snapshot after start recording");Sn(t)},Fn.isRecording=()=>An,Fn.mirror=Tn,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var $n=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${$n.source}`,"i"),new RegExp($n.source,"gi"),"0".repeat(32),"0".repeat(16);var Dn=Object.create(null);function Ln(t){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(t)}function Nn(t,e,n){return(e=function(t){var e=function(t){if("object"!=Ln(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ln(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ln(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Dn.Node=Object.create(null),Dn.ShadowRoot=Object.create(null),Dn.MutationObserver=Object.create(null),Dn.Element=Object.create(null);var Pn=class{constructor(t){Nn(this,"fileName",void 0),Nn(this,"functionName",void 0),Nn(this,"lineNumber",void 0),Nn(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},jn=/(^|@)\S+:\d+/,zn=/^\s*at .*(\S+:\d+|\(native\))/m,Bn=/^(eval@)?(\[native code])?$/,Wn={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(zn)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(zn)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=n?e.replace(n[0],""):e;const i=e.split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:i.pop());return new Pn({functionName:i.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0],lineNumber:r[1],columnNumber:r[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(Bn)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Pn({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(t.replace(e,""));return new Pn({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),i=[];for(let t=2,r=n.length;r>t;t+=2){const r=e.exec(n[t]);r&&i.push(new Pn({fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),i=[];for(let t=0,r=n.length;r>t;t+=2){const r=e.exec(n[t]);r&&i.push(new Pn({functionName:r[3]||void 0,fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(jn)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),n=this.extractLocation(e.pop());return new Pn({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function Un(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let n=t.localName;if(!n)break;n=n.toLowerCase();const i=t.parentElement,r=[];if(i.children&&i.children.length>0)for(let t=0;i.children.length>t;t++){const e=i.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===n&&r.push(e)}r.length>1&&(n+=`:eq(${r.indexOf(t)})`),e=n+(e?">"+e:""),t=i}return e}function qn(t){return Array.isArray(t)}function Hn(t){return"object"==typeof t&&null!==t&&!qn(t)}function Gn(t,e){if(0===e)return!0;const n=Object.keys(t);for(const i of n)if(Hn(t[i])&&Gn(t[i],e-1))return!0;return!1}function Vn(t,e){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,e);const i=[],r=[];return JSON.stringify(t,function(t,e){if(i.length>0){const n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?r.splice(n,1/0,t):r.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Hn(s=e)&&Object.keys(s).length>n.numOfKeysLimit||"function"==typeof s||Hn(s)&&Gn(s,n.depthOfLimit))return function(t){let e=t.toString();return n.stringLengthLimit&&e.length>n.stringLengthLimit&&(e=`${e.slice(0,n.stringLengthLimit)}...`),e}(e);var s;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const n in e){const i=e[n];t[n]=qn(i)?Un(i.length?i[0]:null):i}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var Zn={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Jn(t,e,n){const i=n?Object.assign({},Zn,n):Zn,r=i.logger;if(!r)return()=>{};let s;s="string"==typeof r?e[r]:r;let o=0,a=!1,l=!0;const u=[];if(i.level.includes("error")){const n=e=>{const n=e.message;t({level:"error",trace:Wn.parse(e.error).map(t=>t.toString()),payload:[Vn(n,i.stringifyOptions)]})};e.addEventListener("error",n),u.push(()=>{e.removeEventListener("error",n)});const r=e=>{let n,r;e.reason instanceof Error?(n=e.reason,r=[Vn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[Vn("Uncaught (in promise)",i.stringifyOptions),Vn(e.reason,i.stringifyOptions)]),t({level:"error",trace:Wn.parse(n).map(t=>t.toString()),payload:r})};e.addEventListener("unhandledrejection",r),u.push(()=>{e.removeEventListener("unhandledrejection",r)})}for(const t of i.level)u.push(c(s,t));return()=>{l=!1,u.forEach(t=>t())};function c(e,n){return e[n]?function(r,s){try{if(!(s in r))return()=>{};const u=r[s],c={next:u},h=(r=>(...s)=>{if(r.apply(e,s),l&&!("assert"===n&&s[0]||a)){a=!0;try{const e=Wn.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===n?s.slice(1):s).map(t=>Vn(t,i.stringifyOptions));o++,i.lengthThreshold>o?t({level:n,trace:e,payload:r}):o===i.lengthThreshold&&t({level:"warn",trace:[],payload:[Vn("The number of log records reached the threshold.")]})}catch(t){r.apply(e,["rrweb logger error:",t,...s])}finally{a=!1}}})(function(...t){return c.next.apply(this,t)});return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),r[s]=h,()=>{if(r[s]===h)return void(r[s]=c.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=r[s],n=t(e);for(;n;){if(n.next===h)return void(n.next=c.next);e=n.next,n=t(e)}}}catch(t){return()=>{}}}(e,n):()=>{}}}const Qn="u">typeof window?window:void 0,Xn="u">typeof globalThis?globalThis:Qn,Yn=null==Xn?void 0:Xn.document,Kn=null==Xn?void 0:Xn.location;null!=Xn&&Xn.XMLHttpRequest&&new Xn.XMLHttpRequest;const ti="undefined"!=typeof globalThis?globalThis:Qn;ti&&"undefined"==typeof self&&(ti.self=ti),ti&&"undefined"==typeof File&&(ti.File=function(){});const ei=null!=Qn?Qn:{},ni=Object.prototype,ii=ni.hasOwnProperty,ri=ni.toString,si=Array.isArray||function(t){return"[object Array]"===ri.call(t)},oi=t=>"function"==typeof t,ai=t=>t===Object(t)&&!si(t),li=t=>void 0===t,ui=t=>"[object String]"==ri.call(t),ci=t=>null===t,hi=t=>li(t)||ci(t),di=t=>"[object Number]"==ri.call(t)&&t==t,fi=t=>"[object Boolean]"===ri.call(t),vi=t=>t instanceof FormData;function pi(t,e,n,i,r){return e>n&&(i.warn("min cannot be greater than max."),e=n),di(t)?t>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),pi(null!=r?r:n,e,n,i))}var mi=class{constructor(t){this.C={},this.I=t.I,this.R=pi(t.bucketSize,0,100,t.A),this.$=pi(t.refillRate,0,this.R,t.A),this.O=pi(t.refillInterval,0,864e5,t.A)}F(t,e){const n=Math.floor((e-t.lastAccess)/this.O);n>0&&(t.tokens=Math.min(t.tokens+n*this.$,this.R),t.lastAccess=t.lastAccess+n*this.O)}consumeRateLimit(t){var e;const n=Date.now(),i=String(t);let r=this.C[i];return r?this.F(r,n):(r={tokens:this.R,lastAccess:n},this.C[i]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===r.tokens)}stop(){this.C={}}};function gi(t){return t?t.split("#")[0]:t}const yi="NativeGzipValidationError";let bi;const wi=t=>{throw function(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return n}(yi,`Native gzip produced invalid output: ${t}`)},ki=(_i=s(function*(t,e){18>t.size&&wi("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());var i;(2>(i=n).length||31!==i[0]||139!==i[1]||8!==n[2])&&wi("invalid-header");const r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{const e=(()=>{if(bi)return bi;bi=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;bi[t]=e>>>0}return bi})();let n=4294967295;for(let i=0;t.length>i;i++)n=e[255&(n^t[i])]^n>>>8;return(4294967295^n)>>>0})(e)&&wi("invalid-crc");const s=e.length>>>0;r.getUint32(4,!0)!==s&&wi("invalid-size")}),function(t,e){return _i.apply(this,arguments)});var _i;function Si(){return Si=s(function*(t,e=!0,n){try{const e=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),r=n.writable.getWriter(),o=r.write(e).then(()=>r.close()).catch((i=s(function*(t){try{yield r.abort(t)}catch(t){}throw t}),function(t){return i.apply(this,arguments)})),a=new Response(n.readable).blob(),[l]=yield Promise.all([a,o]);return yield ki(l,e),l}catch(t){if(null==n?void 0:n.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var i}),Si.apply(this,arguments)}const Ci="0.9.4",Ii={DEBUG:!1,LIB_VERSION:Ci,LIB_NAME:"browser-common",JS_SDK_VERSION:Ci},Mi=(t,{debugEnabled:e}={})=>{const n={N(n,...i){let r;try{r=typeof window>"u"?void 0:window}catch(t){return}r&&(Ii.DEBUG||r.POSTHOG_DEBUG||e)&&!li(r.console)&&r.console&&("__rrweb_original__"in r.console[n]?r.console[n].__rrweb_original__:r.console[n])(t,...i)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...e){console.error(t,...e)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(e,n)=>Mi(`${t} ${e}`,n)};return n},Ri=Mi("[PostHog.js]"),Ai=Ri.createLogger;function xi(t,e){if(!hi(t))if(si(t))t.forEach(e);else if(vi(t))t.forEach((t,n)=>e(t,n));else for(const n in t)ii.call(t,n)&&e(t[n],n)}function Ti(t,e,n,i){const{capture:r=!1,passive:s=!0}=null!=i?i:{};null==t||t.addEventListener(e,n,{capture:r,passive:s})}const Oi=["localhost","127.0.0.1"],Ei=t=>{const e=null==Yn?void 0:Yn.createElement("a");return li(e)?null:(e.href=t,e)},Fi=()=>{},$i=t=>{var e;if(oi(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Di(t,e,n){try{if(!(e in t))return Fi;const i={next:t[e]},r=n(function(...t){return i.next.apply(this,t)});return oi(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=i.next);let n=t[e],s=$i(n);for(;s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=$i(n)}}}catch(t){return Fi}}function Li(t,e){var n;const i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),r={hostname:i,isHostDenied:!1};if(!(null===(n=e.payloadHostDenyList)||void 0===n?void 0:n.length)||!(null==i?void 0:i.trim().length))return r;for(const t of e.payloadHostDenyList)if(i.endsWith(t))return{hostname:i,isHostDenied:!0};return r}function Ni(t){var e;const n=null==Qn||null===(e=Qn.location)||void 0===e?void 0:e.href;return li(n)?void 0:function(t,e){var n;const i=null==t||null===(n=t.config)||void 0===n?void 0:n.get_current_url;if(!oi(i))return e;try{const t=i(e);return ui(t)&&t?t:e}catch(t){return Ri.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,n)}const Pi="$stored_person_properties",ji=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),zi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Bi=[16,15,14,13],Wi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Ui=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),qi=/[0-9A-Za-z_]/;function Hi(t){let e=0,n=!1;for(let i=t.length-1;i>=0;i--){let r=t.charCodeAt(i)-48;n&&(r*=2,r>9&&(r-=9)),e+=r,n=!n}return e%10==0}const Gi=1e6;function Vi(t){var e;return Math.min(Gi,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Gi)}const Zi={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Gi,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},Ji=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Qi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Xi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Yi=t=>{hi(t)||xi(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Ji.includes(e)||Xi.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Ki=["/s/","/e/","/i/"];function tr(t,e,n,i){if(hi(t))return t;let r=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ui(r)&&(r=parseInt(r)),r>n?`[SessionRecording] ${i} body too large to record (${r} bytes)`:t}function er(t,e){if(hi(t))return t;let n=t;return function(t,e=!0){if(hi(t))return!1;if(ui(t)){if(t=t.trim(),e?ji.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(zi.lastIndex=0;e=zi.exec(t);){const t=e[2];if(!t)continue;const n=t.replace(/[- ]/g,"");for(let t=0;n.length>t;t++)for(const e of Bi){const i=t+e;if(n.length>=i){const e=n.slice(t,i);if(ji.test(e)&&Hi(e))return!0}}}return!1}(t))return!1;if(e?Wi.test(t):function(t){let e;for(Ui.lastIndex=0;e=Ui.exec(t);){const t=e[1],n=e[3];if(!(t&&n&&qi.test(t)&&qi.test(n)))return!0}return!1}(t))return!1}return!0}(n,!1)||(n="[SessionRecording] "+e+" body redacted"),xi(Qi,t=>{(null==n?void 0:n.length)&&-1!==(null==n?void 0:n.indexOf(t))&&(n="[SessionRecording] "+e+" body redacted as might contain: "+t)}),n}const nr=new WeakSet,ir=Ai("[Recorder]"),rr=t=>"navigation"===t.entryType,sr=t=>"resource"===t.entryType,or=()=>{};function ar(t,e){var n;return rr(e)&&"complete"===(null===(n=t.document)||void 0===n?void 0:n.readyState)&&e.loadEventEnd>0}function lr(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(n=>ar(t,n)||sr(n)&&e.initiatorTypes.includes(n.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>ar(t,e))}(t):[]}function ur(t,e){return!!e&&(fi(e)||e[t])}function cr(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const hr=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function dr({type:t,recordBody:e,headers:n,url:i}){function r(t){const e=Object.keys(n).find(t=>"content-type"===t.toLowerCase()),i=e&&n[e];return t.some(t=>null==i?void 0:i.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!cr(e)&&t(e.url)}catch(t){return!1}}(i))return!1;if(r(hr))return!1;if(fi(e))return!0;if(si(e))return r(e);const s=e[t];return fi(s)?s:r(s)}function fr(t,e,n,i,r){return vr.apply(this,arguments)}function vr(){return vr=s(function*(t,e,n,i,r,s=0){if(s>10)return ir.warn("Failed to get performance entry for request",{url:n,initiatorType:e}),null;const o=function(t,e){for(let n=t.length-1;n>=0;n-=1)if(e(t[n]))return t[n]}(t.performance.getEntriesByName(n),t=>sr(t)&&t.initiatorType===e&&(li(i)||t.startTime>=i)&&(li(r)||r>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*s)),fr(t,e,n,i,r,s+1))}),vr.apply(this,arguments)}function pr({body:t,options:e,url:n}){if(hi(t))return null;const{hostname:i,isHostDenied:r}=Li(n,e);if(r)return i+" is in deny list";if(ui(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(vi(t))return function(t,e="&"){let n,i;const r=[];return xi(t,function(t,e){li(t)||li(e)||"undefined"===e||(n=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),r[r.length]=i+"="+n)}),r.join(e)}(t);if(ai(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const mr=t=>!ci(t)&&("navigation"===t.entryType||"resource"===t.entryType);function gr(t,{entry:e,method:n,status:r,networkRequest:s,isInitial:o,start:a,end:l,url:u,initiatorType:c}){a=e?e.startTime:a,l=e?e.responseEnd:l;const h=Math.floor(Date.now()-t.performance.now()),d=Math.floor(h+(a||0)),f=[i(i({},e?JSON.parse(JSON.stringify(e.toJSON())):{name:u}),{},{startTime:li(a)?void 0:Math.round(a),endTime:li(l)?void 0:Math.round(l),timeOrigin:h,timestamp:d,method:n,initiatorType:c||(e?e.initiatorType:void 0),status:r,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:o})];if(mr(e))for(const t of e.serverTiming||[])f.push({timeOrigin:h,timestamp:d,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return f}const yr=["video/","audio/"];function br(t){return ai(t)&&oi(t.getReader)&&oi(t.tee)}const wr="[SessionReplay] Timeout while trying to read body",kr="[SessionReplay] Failed to read body";function _r(t){return`${kr}: ${t}`}function Sr(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Cr(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const n=setTimeout(()=>e(wr),500);try{t.clone().text().then(t=>e(t),t=>e(_r(t))).finally(()=>clearTimeout(n))}catch(t){clearTimeout(n),e(kr)}})}(t);const n=Vi(e);return function(t,e){try{var n,i;const r=null===(n=t.headers)||void 0===n||null===(i=n.get)||void 0===i?void 0:i.call(n,"content-length");if(!r)return!1;const s=parseInt(r,10);return Number.isFinite(s)&&s>e}catch(t){return!1}}(t,n)?Promise.resolve(Sr(n)):function(t,e){return new Promise(n=>{let i,r=!1;function s(){try{null==i||i.cancel().catch(()=>{})}catch(t){}}function o(t){r||(r=!0,clearTimeout(a),s(),n(t))}const a=setTimeout(()=>o(wr),500);let l;try{l=t.clone()}catch(t){return void o(kr)}const u=l.body;if(!br(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(_r(t)))}catch(t){o(kr)}return}try{i=u.getReader()}catch(t){return void o(kr)}const c=[];let h=0;!function t(){i.read().then(({done:n,value:i})=>{if(r)s();else if(n)o((new TextDecoder).decode(function(t,e){const n=new Uint8Array(e);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n}(c,h)));else{if(i){if(h+i.byteLength>e)return void o(Sr(e));h+=i.byteLength,c.push(i)}t()}},t=>o(_r(t)))}()})}(t,n)}function Ir(t){return Mr.apply(this,arguments)}function Mr(){return(Mr=s(function*({r:t,options:e,url:n}){const{hostname:i,isHostDenied:r}=Li(n,e);return r?Promise.resolve(i+" is in deny list"):Cr(t,e)})).apply(this,arguments)}function Rr(t){return Ar.apply(this,arguments)}function Ar(){return(Ar=s(function*({r:t,options:e,url:n}){const i=function({r:t,options:e,url:n}){var i;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const r=null===(i=t.headers.get("Content-Type"))||void 0===i?void 0:i.toLowerCase(),s=yr.some(t=>null==r?void 0:r.startsWith(t));if(r&&s)return`Content-Type ${r} is not supported`;const{hostname:o,isHostDenied:a}=Li(n,e);return a?o+" is in deny list":null}({r:t,options:e,url:n});return ci(i)?Cr(t,e):Promise.resolve(i)})).apply(this,arguments)}let xr=null;function Tr(t,e,n){if(!("performance"in e))return()=>{};if(xr)return ir.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},Zi,n):Zi;let o=!0,a=!1;const l=e=>{if(!o)return;const n=[];let s=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&s)return;let i;try{i=r.maskRequestFn(t)}catch(t){return a||(a=!0,ir.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(e||(s=!0))}e||(s=!i||(t=>!!t&&nr.has(t))(i)),i&&n.push(i)}),n.length>0&&t(i(i({},e),{},{requests:n}))},u=function(t,e,n){try{t({requests:lr(e,n).flatMap(t=>gr(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){ir.error("Failed to capture initial performance entries for network capture",t)}const i=e.PerformanceObserver,r=null==i?void 0:i.supportedEntryTypes;if(!i||!si(r))return;const s=r.filter(t=>n.performanceEntryTypeToObserve.includes(t));if(!s.length)return;const o=new i(i=>{t({requests:i.getEntries().filter(t=>rr(t)||sr(t)&&n.initiatorTypes.includes(t.initiatorType)&&(t=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>gr(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:s}),()=>{o.disconnect()}}(l,e,r),c=r.recordHeaders||r.recordBody;if(!u&&!c)return o=!1,or;let h=()=>{},d=()=>{};return c&&(h=function(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=ur("request",n.recordHeaders),r=ur("response",n.recordHeaders),s=Di(e.XMLHttpRequest.prototype,"open",s=>function(o,a,l=!0,u,c){const h=this;try{const s=new Request(a),l={};let u,c;const d={},f=h.setRequestHeader.bind(h);h.setRequestHeader=(t,e)=>(d[t]=e,f(t,e)),i&&(l.requestHeaders=d);const v=h.send.bind(h);h.send=t=>(dr({type:"request",headers:d,url:a,recordBody:n.recordBody})&&(l.requestBody=pr({body:t,options:n,url:a})),u=e.performance.now(),v(t));const p=()=>{h.removeEventListener("readystatechange",m),h.removeEventListener("error",p),h.removeEventListener("abort",p),h.removeEventListener("timeout",p)},m=()=>{if(h.readyState!==h.DONE)return;p(),c=e.performance.now();const i={};h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),n=e.shift(),r=e.join(": ");n&&(i[n]=r)}),r&&(l.responseHeaders=i),dr({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(l.responseBody=pr({body:h.response,options:n,url:a})),fr(e,"xmlhttprequest",s.url,u,c).then(n=>{t({requests:gr(e,{entry:n,method:o,status:null==h?void 0:h.status,networkRequest:l,start:u,end:c,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};h.addEventListener("readystatechange",m),h.addEventListener("error",p),h.addEventListener("abort",p),h.addEventListener("timeout",p)}catch(t){ir.error("Failed to instrument XHR for network capture",t)}s.call(h,o,a.toString(),l,u,c)});return()=>{s()}}(l,e,r),d=!0===r.captureFetchSynchronously?function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=ur("request",n.recordHeaders),r=ur("response",n.recordHeaders),o=Di(e,"fetch",o=>function(a,l){let u;try{u=new Request(a,l)}catch(t){ir.error("Failed to instrument fetch for network capture",t);try{return Promise.resolve(o(a,l))}catch(t){return new Promise((e,n)=>n(t))}}const c={};let h,d;const f=s(function*(){try{const t={};u.headers.forEach((e,n)=>{t[n]=e}),i&&(c.requestHeaders=t),!br(null==l?void 0:l.body)&&dr({type:"request",headers:t,url:a,recordBody:n.recordBody})&&(c.requestBody=yield Ir({r:u,options:n,url:a}))}catch(t){ir.error("Failed to record fetch request for network capture",t)}})(),v=(p=s(function*(t){try{const e={};t.headers.forEach((t,n)=>{e[n]=t}),r&&(c.responseHeaders=e),dr({type:"response",headers:e,url:a,recordBody:n.recordBody})&&(c.responseBody=yield Rr({r:t,options:n,url:a}))}catch(t){ir.error("Failed to record fetch response for network capture",t)}}),function(t){return p.apply(this,arguments)});var p;try{h=e.performance.now()}catch(t){}let m;try{m=cr(a)?o(u):o(a,l)}catch(t){m=new Promise((e,n)=>n(t))}const g=Promise.resolve(m).then(t=>{try{d=e.performance.now()}catch(t){}return{status:"fulfilled",response:t}},t=>({status:"rejected",error:t}));return s(function*(){let n;try{yield f;const t=yield g;if("rejected"===t.status)throw t.error;return n=t.response,yield v(n),n}finally{(i=n,fr(e,"fetch",u.url,h,d).then(n=>{t({requests:gr(e,{entry:n,method:u.method,status:null==i?void 0:i.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"})})})).catch(()=>{})}var i})()});return()=>{o()}}(l,e,r):function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=ur("request",n.recordHeaders),r=ur("response",n.recordHeaders),o=Di(e,"fetch",o=>function(){var a=s(function*(s,a){let l,u;try{l=new Request(s,a)}catch(t){return ir.error("Failed to instrument fetch for network capture",t),o(s,a)}const c={};let h,d;try{try{const t={};l.headers.forEach((e,n)=>{t[n]=e}),i&&(c.requestHeaders=t),!br(null==a?void 0:a.body)&&dr({type:"request",headers:t,url:s,recordBody:n.recordBody})&&(c.requestBody=yield Ir({r:l,options:n,url:s}))}catch(t){ir.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=cr(s)?yield o(l):yield o(s,a),d=e.performance.now();try{const t={};u.headers.forEach((e,n)=>{t[n]=e}),r&&(c.responseHeaders=t),dr({type:"response",headers:t,url:s,recordBody:n.recordBody})&&(c.responseBody=yield Rr({r:u,options:n,url:s}))}catch(t){ir.error("Failed to record fetch response for network capture",t)}return u}finally{fr(e,"fetch",l.url,h,d).then(n=>{t({requests:gr(e,{entry:n,method:l.method,status:null==u?void 0:u.status,networkRequest:c,start:h,end:d,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return a.apply(this,arguments)}}());return()=>{o()}}(l,e,r)),xr=()=>{o=!1,null==u||u(),h(),d(),xr=null},xr}const Or="$replay_override_sampling",Er="$replay_override_linked_flag",Fr="$replay_override_url_trigger",$r="$replay_override_event_trigger",Dr="$session_is_sampled",Lr="$session_recording_url_trigger_activated_session",Nr="$session_recording_event_trigger_activated_session",Pr="$posthog_sr_group_event_trigger_",jr="$posthog_sr_group_url_trigger_",zr="$sess_rec_flush_size",Br="$sdk_debug_replay_event_trigger_status",Wr="$sdk_debug_replay_linked_flag_trigger_status",Ur="$sdk_debug_replay_matched_recording_trigger_groups",qr="$sdk_debug_replay_pending_trigger_conditions",Hr="$sdk_debug_replay_remote_trigger_matching_config",Gr="$sdk_debug_replay_trigger_groups_count",Vr="$sdk_debug_replay_url_trigger_status",Zr="$sdk_debug_rrweb_attached",Jr="$sdk_debug_rrweb_start_attempted",Qr="$session_recording_start_reason",Xr="disabled",Yr="sampled",Kr="active",ts="buffering",es="paused",ns="rrweb_error",is="trigger_activated",rs="trigger_pending",ss="trigger_disabled";function os(t,e,n,i,r,s){return 0===e?ss:(null==t?void 0:t.get_property(n?i+n:r))===s?is:rs}function as(t,e,n){return e.some(e=>{var i;return"regex"===e.matching&&(null!==(i=null==n?void 0:n.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)})}function ls(t){return t.includes("trigger_activated")?is:t.includes("trigger_pending")?rs:ss}function us(t){const e=new Set(t);switch(e.delete(ss),e.size){case 0:return ss;case 1:return Array.from(e)[0];default:return rs}}var cs=class{constructor(t){this.q=t}triggerStatus(t){return ls(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return ls(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},hs=class{constructor(t){this.q=t}triggerStatus(t){return us(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return us(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},ds=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return is}stop(){}};const fs=t=>"sessionRecording"in t;var vs=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,n;this.j=(fs(t)?ai(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(fs(t)?ai(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.G()}G(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Ri.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Ri.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}Z(t){return os(this._instance,this.j.length,this.V,jr,Lr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Vr]:e}),e}triggerStatusNoSideEffects(t){return this.Z(t)}isCurrentUrlBlocked(){const t=Ni(this._instance);if(!t)return!1;try{return as(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const n=Ni(this._instance);if(!n)return;if(n===this.W)return;this.W=n;const i=this.urlBlocked,r=as(n,this.B,this.U);i&&r||(r&&!i?t():!r&&i&&e())}checkUrlTriggerConditions(t,e,n,i){const r=Ni(this._instance);if(!r)return;if(r===this.W)return;this.W=r;const s=this.urlBlocked,o=as(r,this.B,this.U);o&&!s?t():!o&&s&&e();const a=this.Z(i)===is,l=as(r,this.j,this.H);!a&&l&&n("url",r)}stop(){this.W=""}},ps=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Wr]:t}),t}triggerStatusNoSideEffects(){let t=rs;return hi(this.linkedFlag)&&(t=ss),this.linkedFlagSeen&&(t=is),t}onConfig(t,e){var n;if(this.linkedFlag=(fs(t)?ai(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!hi(this.linkedFlag)&&!this.linkedFlagSeen){const t=ui(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ui(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((i,r)=>{let s=!1;if(ai(r)&&t in r){const e=r[t];s=fi(e)?!0===e:n?e===n:!!e}const o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(t,n)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},ms=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(fs(t)?ai(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return os(this._instance,this.K.length,this.V,Pr,Nr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Br]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,n){if(0===this.K.length)return;const i=this.X(n)===is,r=this.K.includes(t);!i&&r&&e("event",t)}stop(){}},gs=class{constructor(t,e,n){if(this._instance=t,this.group=e,this.Y=new vs(t,e.id),this.tt=new ms(t,e.id),this.et=new ps(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),i={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(i),this.tt.onConfig(i),this.et.onConfig(i,n);const r=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new cs(r):new hs(r)}else this.nt=new ds}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===rs).map(({label:t})=>t)}checkEventTriggerConditions(t,e,n){this.tt.checkEventTriggerConditions(t,e,n)}checkUrlTriggerConditions(t,e,n,i){this.Y.checkUrlTriggerConditions(t,e,n,i)}activateTrigger(t,e){var n;const i="url"===t?jr+this.group.id:Pr+this.group.id;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function ys(t){if(t.rrwebError)return ns;if(!t.receivedFlags)return ts;if(!t.isRecordingEnabled)return Xr;if(t.urlTriggerMatching.urlBlocked)return es;const e=!0===t.isSampled,n=new cs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Yr:"trigger_activated"===n?Kr:"trigger_pending"===n?ts:!1===t.isSampled?Xr:Kr}function bs(t){if(t.rrwebError)return ns;if(!t.receivedFlags)return ts;if(!t.isRecordingEnabled)return Xr;if(t.urlTriggerMatching.urlBlocked)return es;const e=new hs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==ss,i=fi(t.isSampled);return n&&"trigger_pending"===e?ts:n&&"trigger_disabled"===e||i&&!t.isSampled?Xr:!0===t.isSampled?Yr:Kr}function ws(){const t=[];return function(e,n){if(ai(n)||si(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n}}function ks(t){try{const e=JSON.stringify(t,ws());return e?new Blob([e]).size:0}catch(t){return-1}}function _s(t){if(ci(t))return 4;if(li(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(si(t)){let e=2;for(let n=0;t.length>n;n++){n>0&&(e+=1);const i=t[n];e+=li(i)||ci(i)?4:_s(i)}return e}const e=t;let n=2,i=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const r=e[t];li(r)||(i||(n+=1),i=!1,n+=t.length+3+_s(r))}return n}default:return 0}}function Ss(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),n=t.sizes.slice(0,e),i=t.sizes.slice(e);return[Ss({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:n,sessionId:t.sessionId,windowId:t.windowId}),Ss({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:i,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var Cs=Uint8Array,Is=Uint16Array,Ms=Uint32Array,Rs=new Cs([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]),As=new Cs([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]),xs=new Cs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ts=function(t,e){for(var n=new Is(31),i=0;31>i;++i)n[i]=e+=1<<t[i-1];var r=new Ms(n[30]);for(i=1;30>i;++i)for(var s=n[i];n[i+1]>s;++s)r[s]=s-n[i]<<5|i;return[n,r]},Os=Ts(Rs,2),Es=Os[1];Os[0][28]=258,Es[258]=28;for(var Fs=Ts(As,0)[1],$s=new Is(32768),Ds=0;32768>Ds;++Ds){var Ls=(43690&Ds)>>>1|(21845&Ds)<<1;$s[Ds]=((65280&(Ls=(61680&(Ls=(52428&Ls)>>>2|(13107&Ls)<<2))>>>4|(3855&Ls)<<4))>>>8|(255&Ls)<<8)>>>1}var Ns=function(t,e,n){for(var i=t.length,r=0,s=new Is(e);i>r;++r)++s[t[r]-1];var o,a=new Is(e);for(r=0;e>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new Is(1<<e);var l=15-e;for(r=0;i>r;++r)if(t[r])for(var u=r<<4|t[r],c=e-t[r],h=a[t[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[$s[h]>>>l]=u}else for(o=new Is(i),r=0;i>r;++r)o[r]=$s[a[t[r]-1]++]>>>15-t[r];return o},Ps=new Cs(288);for(Ds=0;144>Ds;++Ds)Ps[Ds]=8;for(Ds=144;256>Ds;++Ds)Ps[Ds]=9;for(Ds=256;280>Ds;++Ds)Ps[Ds]=7;for(Ds=280;288>Ds;++Ds)Ps[Ds]=8;var js=new Cs(32);for(Ds=0;32>Ds;++Ds)js[Ds]=5;var zs=Ns(Ps,9,0),Bs=Ns(js,5,0),Ws=function(t){return(t/8|0)+(7&t&&1)},Us=function(t,e,n){(null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof Is?Is:t instanceof Ms?Ms:Cs)(n-e);return i.set(t.subarray(e,n)),i},qs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8},Hs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8,t[i+2]|=n>>>16},Gs=function(t,e){for(var n=[],i=0;t.length>i;++i)t[i]&&n.push({s:i,f:t[i]});var r=n.length,s=n.slice();if(!r)return[new Cs(0),0];if(1==r){var o=new Cs(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(t,e){return t.f-e.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,h=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=n[n[h].f>n[u].f?u++:h++],l=n[u!=c&&n[h].f>n[u].f?u++:h++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=s[0].s;for(i=1;r>i;++i)s[i].s>d&&(d=s[i].s);var f=new Is(d+1),v=Vs(n[c-1],f,0);if(v>e){i=0;var p=0,m=v-e,g=1<<m;for(s.sort(function(t,e){return f[e.s]-f[t.s]||t.f-e.f});r>i;++i){var y=s[i].s;if(e>=f[y])break;p+=g-(1<<v-f[y]),f[y]=e}for(p>>>=m;p>0;){var b=s[i].s;e>f[b]?p-=1<<e-f[b]++-1:++i}for(;i>=0&&p;--i){var w=s[i].s;f[w]==e&&(--f[w],++p)}v=e}return[new Cs(f),v]},Vs=function(t,e,n){return-1==t.s?Math.max(Vs(t.l,e,n+1),Vs(t.r,e,n+1)):e[t.s]=n},Zs=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Is(++e),i=0,r=t[0],s=1,o=function(t){n[i++]=t},a=1;e>=a;++a)if(t[a]==r&&a!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=t[a]}return[n.subarray(0,i),e]},Js=function(t,e){for(var n=0,i=0;e.length>i;++i)n+=t[i]*e[i];return n},Qs=function(t,e,n){var i=n.length,r=Ws(e+2);t[r]=255&i,t[r+1]=i>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;i>s;++s)t[r+s+4]=n[s];return 8*(r+4+i)},Xs=function(t,e,n,i,r,s,o,a,l,u,c){qs(e,c++,n),++r[256];for(var h=Gs(r,15),d=h[0],f=h[1],v=Gs(s,15),p=v[0],m=v[1],g=Zs(d),y=g[0],b=g[1],w=Zs(p),k=w[0],_=w[1],S=new Is(19),C=0;y.length>C;++C)S[31&y[C]]++;for(C=0;k.length>C;++C)S[31&k[C]]++;for(var I=Gs(S,7),M=I[0],R=I[1],A=19;A>4&&!M[xs[A-1]];--A);var x,T,O,E,F=u+5<<3,D=Js(r,Ps)+Js(s,js)+o,L=Js(r,d)+Js(s,p)+o+14+3*A+Js(S,M)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return Qs(e,c,t.subarray(l,l+u));if(qs(e,c,1+(D>L)),c+=2,D>L){x=Ns(d,f,0),T=d,O=Ns(p,m,0),E=p;var N=Ns(M,R,0);for(qs(e,c,b-257),qs(e,c+5,_-1),qs(e,c+10,A-4),c+=14,C=0;A>C;++C)qs(e,c+3*C,M[xs[C]]);c+=3*A;for(var P=[y,k],j=0;2>j;++j){var z=P[j];for(C=0;z.length>C;++C)qs(e,c,N[B=31&z[C]]),c+=M[B],B>15&&(qs(e,c,z[C]>>>5&127),c+=z[C]>>>12)}}else x=zs,T=Ps,O=Bs,E=js;for(C=0;a>C;++C)if(i[C]>255){var B;Hs(e,c,x[257+(B=i[C]>>>18&31)]),c+=T[B+257],B>7&&(qs(e,c,i[C]>>>23&31),c+=Rs[B]);var W=31&i[C];Hs(e,c,O[W]),c+=E[W],W>3&&(Hs(e,c,i[C]>>>5&8191),c+=As[W])}else Hs(e,c,x[i[C]]),c+=T[i[C]];return Hs(e,c,x[256]),c+T[256]},Ys=new Ms([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ks=new Cs(0),to=function(){for(var t=new Ms(256),e=0;256>e;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),eo=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function no(t,e){void 0===e&&(e={});var n=function(){var t=4294967295;return{p(e){for(var n=t,i=0;e.length>i;++i)n=to[255&n^e[i]]^n>>>8;t=n},d(){return 4294967295^t}}}(),i=t.length;n.p(t);var r,s,o,a,l,u,c=(a=10+((r=e).filename&&r.filename.length+1||0),l=8,function(t,e,n,i,r,s){var o=t.length,a=new Cs(i+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(i,a.length-r),u=0;if(!e||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=Qs(l,u,t.subarray(c,h)):(l[c]=s,u=Qs(l,u,t.subarray(c,o)))}else{for(var d=Ys[e-1],f=d>>>13,v=8191&d,p=(1<<n)-1,m=new Is(32768),g=new Is(p+1),y=Math.ceil(n/3),b=2*y,w=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},k=new Ms(25e3),_=new Is(288),S=new Is(32),C=0,I=0,M=(c=0,0),R=0,A=0;o>c;++c){var x=w(c),T=32767&c,O=g[x];if(m[T]=O,g[x]=T,c>=R){var E=o-c;if((C>7e3||M>24576)&&E>423){u=Xs(t,l,0,k,_,S,I,M,A,c-A,u),M=C=I=0,A=c;for(var F=0;286>F;++F)_[F]=0;for(F=0;30>F;++F)S[F]=0}var D=2,L=0,N=v,P=T-O&32767;if(E>2&&x==w(c-P))for(var j=Math.min(f,E)-1,z=Math.min(32767,c),B=Math.min(258,E);z>=P&&--N&&T!=O;){if(t[c+D]==t[c+D-P]){for(var W=0;B>W&&t[c+W]==t[c+W-P];++W);if(W>D){if(D=W,L=P,W>j)break;var U=Math.min(P,W-2),q=0;for(F=0;U>F;++F){var H=c-P+F+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,O=H)}}}P+=(T=O)-(O=m[T])+32768&32767}if(L){k[M++]=268435456|Es[D]<<18|Fs[L];var V=31&Es[D],Z=31&Fs[L];I+=Rs[V]+As[Z],++_[257+V],++S[Z],R=c+D,++C}else k[M++]=t[c],++_[t[c]]}}u=Xs(t,l,s,k,_,S,I,M,A,c-A,u),s||(u=Qs(l,u,Ks))}return Us(a,0,i+Ws(u)+r)}(s=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,l,!u)),h=c.length;return function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&eo(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var i=0;n.length>=i;++i)t[i+10]=n.charCodeAt(i)}}(c,e),eo(c,h-8,n.d()),eo(c,h-4,i),c}function io(t,e){var n="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var i=0;t.length>i;){var r=t[i++];128>r||e?n+=String.fromCharCode(r):224>r?n+=String.fromCharCode((31&r)<<6|63&t[i++]):240>r?n+=String.fromCharCode((15&r)<<12|(63&t[i++])<<6|63&t[i++]):(r=((15&r)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}var ro=class{constructor(t,e={}){var n,i,r,s;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,n;this.rt[t]=!0;const i=this.vt(t);null===(e=(n=this.it).onBlockedNode)||void 0===e||e.call(n,t,i)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,n,i,r,s,o,a,l;return(null!==(e=null===(n=t.removes)||void 0===n?void 0:n.length)&&void 0!==e?e:0)+(null!==(i=null===(r=t.attributes)||void 0===r?void 0:r.length)&&void 0!==i?i:0)+(null!==(s=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null===(l=t.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,n=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const n=t-e.attributes.length;var i,r;n>0&&(null===(i=(r=this.it).onDroppedAttributeMutations)||void 0===i||i.call(r,n))}const s=this.bt(e);if(0===s&&n!==s)return;if(this.kt)return t;this.ut();const o=_s(t);var a,l;return o>this.ct?(null===(a=(l=this.it).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new mi({bucketSize:null!==(n=this.it.bucketSize)&&void 0!==n?n:100,refillRate:null!==(i=this.it.refillRate)&&void 0!==i?i:10,refillInterval:1e3,I:this.ft,A:Ri}),this.dt=null!==(r=this.it.bytesBucketSize)&&void 0!==r?r:0,this.ht=null!==(s=this.it.bytesRefillRate)&&void 0!==s?s:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=di(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return di(t)&&isFinite(t)&&Math.floor(t)===t}),Qn&&!li(Qn.crypto)&&crypto;let so=null;const oo={At(){if(!ci(so))return so;if(so=!0,li(Qn))so=!1;else try{const t="__support__";oo.$t(t,"xyz"),'"xyz"'!==oo.Ot(t)&&(so=!1),oo.Pt(t)}catch(t){so=!1}return so},Lt(t){Ri.error("sessionStorage error: ",t)},Ot(t){try{return null==Qn?void 0:Qn.sessionStorage.getItem(t)}catch(t){oo.Lt(t)}return null},Dt(t){try{return JSON.parse(oo.Ot(t))||null}catch(t){}return null},$t(t,e){try{return null==Qn||Qn.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){oo.Lt(t)}return!1},Pt(t){try{null==Qn||Qn.sessionStorage.removeItem(t)}catch(t){oo.Lt(t)}}};Ii.DEBUG=!1,Ii.LIB_VERSION="1.438.9",Ii.LIB_NAME="web";var ao=Ii,lo=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(zr,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(zr);return ai(n=e)&&ui(n.sessionId)&&di(n.size)&&e.sessionId===t?e.size:0;var n}};function uo(t,e){return function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return Math.abs(e)}(t)%100<pi(100*e,0,100,Ri)}const co=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},ho=t=>t.toLowerCase(),fo={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>co(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!co(e,t))),icontains:(t,e)=>e.map(ho).some(e=>t.map(ho).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(ho).every(e=>t.map(ho).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const n=parseFloat(e);return!isNaN(n)&&t.some(t=>n>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const n=parseFloat(e);return!isNaN(n)&&t.some(t=>n<parseFloat(t))})},vo=new Set(["is_not","not_icontains","not_regex"]);function po(t,e,n){return!t||0===t.length||t.every(t=>{const i="person"===t.type?n:e,r=null==i?void 0:i[t.key],s=t.operator||"exact";if(li(r)||ci(r))return vo.has(s);const o=fo[s];return!!o&&!li(t.value)&&!ci(t.value)&&o(si(t.value)?t.value.map(String):[String(t.value)],si(r)?r.map(String):[String(r)])})}const mo=Ai("[SessionRecording]");function go(t,e){return e?t:"!"+t}function yo(t,e){return t===e||t!=="!"+e&&null}var bo=class{constructor(t,e,n,i,r,s,o){this._instance=t,this.Y=e,this.tt=n,this.et=i,this.qt=r,this.jt=s,this.Bt=o,this.zt=null,this.Ht=bs}onRemoteConfig(t){this.zt=di(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new cs([this.tt,this.Y]),this.Ht=ys):(this.Ut=new hs([this.tt,this.Y]),this.Ht=bs),this._instance.register_for_session({[Hr]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.Ht({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),n=null==e?void 0:e.minimumDurationMilliseconds;return di(n)?n:null}checkUrlTriggers(t,e,n,i){this.Y.checkUrlTriggerConditions(e,n,i,t)}setupEventTriggerListeners(t,e,n){if(0!==this.tt.K.length&&hi(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,n,e)}catch(t){mo.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const n=this.zt;var i,r;if(!di(n))return null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),void(null===(r=this._instance.persistence)||void 0===r||r.unregister("$replay_sample_rate"));const s=this._instance.get_property(Dr),o=this._instance.get_property("$replay_sample_rate"),a=yo(s,t),l=di(o)&&o!==n,u=li(o)&&s===t,c=l||u||!fi(a),h=c?uo(t,n):a;c&&(h?this.qt("sampled"):mo.warn(`Sample rate (${n}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:go(t,h),$replay_sample_rate:ci(o)&&s===t?null:n})}ensureSamplingDecision(t){if(!di(this.zt))return;const e=this._instance.get_property(Dr);fi(yo(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,n,i,r;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$replay_sample_rate"),null===(r=this._instance.persistence)||void 0===r||r.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===rs}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===rs).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},wo=class{constructor(t,e,n,i,r){this._instance=t,this.Y=e,this.qt=n,this.Vt=i,this.Bt=r,this.Gt=[],this.Qt=new Map,this.Zt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[Hr]:"v2_trigger_groups",[Gr]:t.triggerGroups.length}),this.Y.onConfig(t)):mo.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return ns;if(!t.receivedFlags)return ts;if(!t.isRecordingEnabled)return Xr;if(t.urlTriggerMatching.urlBlocked)return es;const e=t.triggerGroupMatchers,n=t.triggerGroupSamplingResults;if(0===e.length)return Xr;let i=!1,r=!1;for(const s of e){const e=s.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=s.group.id,e=n.get(t);li(e)?Ri.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(r=!0)}else"trigger_pending"===e&&(i=!0)}return r?Yr:i?ts:Xr}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Gt,triggerGroupSamplingResults:this.Qt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const n of this.Gt)if("trigger_activated"===n.triggerStatus(t)){const t=n.group.minDurationMs;di(t)&&(ci(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,n,i){this.Y.checkUrlBlocklist(e,n);for(const i of this.Gt)i.checkUrlTriggerConditions(e,n,e=>{this.Kt(i,void 0)&&(i.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,n){return this.Wt=t(t=>{var n;if(this.Zt)return mo.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(n=this.Wt)||void 0===n||n.call(this),void(this.Wt=void 0);try{for(const n of this.Gt)n.checkEventTriggerConditions(t.event,i=>{if(!this.Kt(n,t.properties))return;const r=(n.group.conditions.events||[]).filter(e=>e.name===t.event),s=this._instance.get_property(Pi);r.some(e=>!e.properties||0===e.properties.length||po(e.properties,t.properties,s))&&(n.activateTrigger(i,e),this.updateActiveTriggers(e),this.Bt(i))},e)}catch(t){mo.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const n of this.Gt){var e;const i=n.group,r=i.id,s=i.sampleRate,o="$posthog_sr_group_sampling_"+r,a=this._instance.get_property(o);let l=null,u=!1,c=!1,h=!1;if(ai(a)){const e=a.sessionId,n=a.sampleRate,i=a.sampled;u="string"==typeof e&&e!==t,c=di(n)&&n!==s,l=e===t&&di(n)&&n===s&&fi(i)?i:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!fi(l),f=d?uo(t+r,s):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:r,group_name:i.name,sampleRate:s,isSampled:f}),this.Qt.set(r,f),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:s,sampled:f}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Zt=!0}clearConditionalRecordingPersistence(){var t,e,n;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_past_minimum_duration");for(const t of this.Gt){var i,r,s;const e=t.group.id;null===(i=this._instance.persistence)||void 0===i||i.unregister("$posthog_sr_group_event_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_url_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const n of this.Gt){const i=n.group,r=i.id,s="trigger_activated"===n.triggerStatus(t),o=!0===this.Qt.get(r);s&&e.push({id:r,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Ur]:e})}hasPendingTriggers(t){for(const e of this.Gt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Gt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear(),this.Y.stop()}Kt(t,e){const n=t.group.conditions.properties;return!n||0===n.length||po(n,e,this._instance.get_property(Pi))}Jt(t){this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear();for(const e of t){const t=new gs(this._instance,e,(t,n)=>{this.qt("linked_flag_matched",{flag:t,variant:n,group_id:e.id,group_name:e.name}),this.Bt()});this.Gt.push(t)}}};const ko=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],_o=1e5,So=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Co=[],Io=()=>!1,Mo="@type @id actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),Ro="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Ao="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),xo="Accommodation AdministrativeArea Country Place State".split(" "),To={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:Ro,publisher:Ao},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Co},Offer:{seller:Ao},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Ao,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Ao,areaServed:xo,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Co}},Oo=[["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),To.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),To.Event],[Ao,To.Organization],[xo,To.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),To.Product]];function Eo(t,e){return ii.call(t,e)?t[e]:void 0}function Fo(t){const e=typeof t;return ci(t)||"string"===e||"number"===e||"boolean"===e}function $o(t,e){return e&&function(t){return ui(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Do(t,e){return si(t)&&t.every(Fo)?t.map(t=>$o(t,e)).filter(t=>!li(t)):Fo(t)?$o(t,e):void 0}function Lo(t,e){if("string"!=typeof t)return;const n=t.trim(),i=n.indexOf("#"),r=0>i?n:n.slice(i+1);if(!(!r||0>i&&(/^[a-z][a-z\d+.-]*:/i.test(n)||n.includes("/")||n.includes("?"))))try{return e(r)?r:void 0}catch(t){return}}function No(t){if(ii.call(To,t))return To[t];for(const[e,n]of Oo)if(e.includes(t))return n}function Po(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0})}function jo(t,e,n,i){if(si(t)){const r=t.map(t=>jo(t,e,n,i)).filter(t=>!li(t));return r.length?r:void 0}return zo(t,e,n,i)||void 0}function zo(t,e,n,i){if(!ai(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(n))return null;const r=Eo(t,"@type"),s=function(t){const e=new Set,n="string"==typeof t?[t]:si(t)?t:[],i=[];for(const t of n){if("string"!=typeof t)continue;const n=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&So.test(n)&&!e.has(n)&&(e.add(n),i.push(n),20===i.length))break}return i}(r),o=s.filter(t=>!!No(t)&&(!i||!i.length||i.includes(t))),a={};for(const i of Mo){const o="@type"===i?s.length?"string"==typeof r?s[0]:s:void 0:"@id"===i?Lo(Eo(t,i),e):Do(Eo(t,i),n.maskUrl);li(o)||Po(a,i,o)}for(const i of o){const r=No(i);for(const i of Object.keys(r)){const s=Eo(t,i),o=r[i];if(!0===o){const t=Do(s,n.maskUrl);li(t)||Po(a,i,t)}else{const t=jo(s,e,n,o);li(t)||Po(a,i,t)}}}const l=jo(Eo(t,"@graph"),e,n);return li(l)||Po(a,"@graph",l),Object.keys(a).length?a:null}function Bo(t,e,n){if(!ai(t))return null;const r=Eo(t,"@context");if("string"!=typeof r||!/^https?:\/\/schema\.org\/?$/.test(r))return null;const s=zo(t,e,n);return s?i({"@context":"https://schema.org"},s):null}function Wo(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function Uo(t,e,n){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!n&&t.matches(n)}catch(t){return!1}}function qo(t,e,n){for(let i=t;i;){if(Uo(i,e,n))return!0;const t=i.parentNode;i=i.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function Ho(t){return Wo(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Wo)}function Go(t){return ai(t)?t.network_timing:t}const Vo=Ai("[SessionRecording]"),Zo=[1,2,3,4,5,6,7,12],Jo=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Qo(){var t;return null==ei||null===(t=ei.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function Xo(){var t;return null===(t=Qo())||void 0===t?void 0:t.record}function Yo(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,ws())}}function Ko(t){return io(no(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Cs(t.length+(t.length>>>1)),i=0,r=function(t){n[i++]=t},s=0;e>s;++s){if(i+5>n.length){var o=new Cs(i+8+(e-s<<1));o.set(n),n=o}var a=t.charCodeAt(s);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++s))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return Us(n,0,i)}(Yo(t))),!0)}function ta(t){return ea.apply(this,arguments)}function ea(){return ea=s(function*(t){const e=yield function(t){return Si.apply(this,arguments)}(Yo(t),ao.DEBUG,{rethrow:!0});return io(new Uint8Array(yield e.arrayBuffer()),!0)}),ea.apply(this,arguments)}let na,ia;const ra="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let sa=!1;function oa(t){var e;return si(t)&&0===t.length?(na=null!==(e=na)&&void 0!==e?e:Ko([]),na):Ko(t)}function aa(t){return la.apply(this,arguments)}function la(){return(la=s(function*(t){var e;return si(t)&&0===t.length?na||(ia=null!==(e=ia)&&void 0!==e?e:ta([]).then(t=>(na=t,t)).catch(t=>{throw na=void 0,ia=void 0,t}),ia):ta(t)})).apply(this,arguments)}function ua(t){return ra&&!sa&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function ca(t){return{event:t,size:_s(t)}}function ha(t,e){return i(i({},t),{},{data:e,cv:"2024-10"})}function da(t,e){return i(i({},t),{},{cv:"2024-10",data:i(i({},t.data),e)})}function fa(t){try{if(2===t.type)return ca(ha(t,Ko(t.data)));if(3===t.type&&0===t.data.source)return ca(da(t,{texts:oa(t.data.texts),attributes:oa(t.data.attributes),removes:oa(t.data.removes),adds:oa(t.data.adds)}));if(3===t.type&&8===t.data.source)return ca(da(t,{adds:t.data.adds?Ko(t.data.adds):void 0,removes:t.data.removes?Ko(t.data.removes):void 0}))}catch(t){Vo.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:ks(t)}}function va(){return(va=s(function*(t){try{if(2===t.type)return ca(ha(t,yield ta(t.data)));if(3===t.type&&0===t.data.source){const[e,n,i,r]=yield Promise.all([aa(t.data.texts),aa(t.data.attributes),aa(t.data.removes),aa(t.data.adds)]);return ca(da(t,{texts:e,attributes:n,removes:i,adds:r}))}if(3===t.type&&8===t.data.source){const[e,n]=yield Promise.all([t.data.adds?ta(t.data.adds):void 0,t.data.removes?ta(t.data.removes):void 0]);return ca(da(t,{adds:e,removes:n}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===yi})(e)&&(sa=!0),Vo.warn("could not compress event asynchronously - trying synchronous compression",e),fa(t)}return{event:t,size:ks(t)}})).apply(this,arguments)}function pa(t,e){return 5===t.type&&t.data.tag===e}function ma(t){return pa(t,"sessionIdle")}function ga(t){return pa(t,"$session_ending")}function ya(t){return pa(t,"$session_starting")}var ba=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return yo(this._instance.get_property(Dr),this.sessionId)}get zt(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return di(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=0,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Ie=!1,this.Me=!1,this.Te=void 0,this.Re=void 0,this.Ee=!1,this.Ae=[],this.$e=0,this.Oe=0,this.Pe=!1,this.Le=void 0,this.Wt=void 0,this.De=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=(t,e,n)=>{var i,r,s,o;if(!n)return;if(t===this.Xt&&e===this.je)return;const a=!n.noSessionId&&(n.activityTimeout||n.sessionPastMaximumLength),l=this.Xt,u=this.je;var c;if(a&&this.Vt("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:n,lastActivityTimestamp:this.le,flushed_size:null===(c=this.Be)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),null===(r=Qo())||void 0===r||null===(s=r.resetMaxDepthState)||void 0===s||s.call(r),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:n}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.je===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.He(e)}a&&this.Vt("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:n,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.Ue=!1,this.We=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$session_past_minimum_duration)===this.Xt},this.Ve=()=>{var t,e;if(0===this.Rt.data.length)return null;const n=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,i=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return di(n)&&di(i)?i-n:null},this.Ge=()=>{var t,e;const n=this.ie;if(!di(n))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return di(t)&&t>=0&&n>t}if(this.We())return!1;const i=this.Ve();return!!ci(i)||n>i||(null===(r=this._instance.persistence)||void 0===r||r.register({$session_past_minimum_duration:this.Xt}),!1);var r},this.Ze=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Je&&(this.Ke(void 0),this.be&&(this.be=!1,this.jt())),this.Xe(),this.Ye(!0)):this.tn()},this.en=()=>{this.Ze()},this.nn=()=>{this.Vt("browser offline",{})},this.rn=()=>{this.Vt("browser online",{})},this.sn=()=>{(null==Yn?void 0:Yn.visibilityState)&&("visible"===Yn.visibilityState&&(this.Je=!0),this.Vt("window "+Yn.visibilityState,{}))},this.Je=null==e||e;const{sessionId:n,windowId:i,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=n,this.je=i,this._sessionStartTimestamp=r,this.et=new ps(this._instance),this.Y=new vs(this._instance),this.tt=new ms(this._instance),this.Rt=this.tn(),this.an="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||Vo.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.Be=new lo(this._instance)}setDocumentWasEverVisible(t){t&&(this.Je=!0)}get ln(){var t,e,n,i,r,s,o,a,l;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,c={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.maskTextSelector,blockSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.blockSelector,maskAllElementAttributes:null===(r=this._instance.config.session_recording)||void 0===r?void 0:r.maskAllElementAttributes},h=null!==(s=null==c?void 0:c.maskAllInputs)&&void 0!==s?s:null==u?void 0:u.maskAllInputs,d=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,f=null!==(a=null==c?void 0:c.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,v=null!==(l=null==c?void 0:c.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return li(h)&&li(d)&&li(f)&&li(v)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:f,maskAllElementAttributes:v}}un(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(hi(e))return;const n=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const i=null==n?void 0:n[t],r=e[t];return!li(i)&&i!==r});0!==i.length&&(this.xe=!0,Vo.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==n?void 0:n.maskAllInputs,maskTextSelector:null==n?void 0:n.maskTextSelector,blockSelector:null==n?void 0:n.blockSelector,maskAllElementAttributes:null==n?void 0:n.maskAllElementAttributes},project:e}))}get cn(){var t;return pi(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Ai("canvas recording resolution scale"),1)}get dn(){var t,e,n,i,r,s,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(n=null==a?void 0:a.recordCanvas)&&void 0!==n?n:null==l?void 0:l.enabled)&&void 0!==e&&e,c=null!==(i=null!==(r=null==a?void 0:a.canvasFps)&&void 0!==r?r:null==l?void 0:l.fps)&&void 0!==i?i:4;let h=null!==(s=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof h){const t=parseFloat(h);h=isNaN(t)?.4:t}return{enabled:u,fps:pi(c,0,12,Ai("canvas recording fps"),4),quality:pi(h,0,1,Ai("canvas recording quality"),.4)}}get hn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),n=this._instance.config.enable_recording_console_log;return null!=n?n:e}get fn(){var t,e,n;const i=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,r={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.recordBody},s=(null==r?void 0:r.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==r?void 0:r.recordBody)||(null==i?void 0:i.recordBody),a=Go(this._instance.config.capture_performance),l=Go(null==i?void 0:i.capturePerformance),u=!!(fi(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}vn(){var t,e;const n=[],r=null===(t=ei.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.hn&&n.push(r());const s=null===(e=ei.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.fn&&oi(s))if(!Oi.includes(Kn.hostname)||this._forceAllowLocalhostNetworkCapture){const t=oi(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;n.push(s(i(i({},((t,e,n)=>{const r={payloadSizeLimitBytes:Zi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Zi.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Zi.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,o=!1!==t.session_recording.recordBody&&e.recordBody,a=!1!==t.capture_performance&&e.recordPerformance,l=(t=>{const e=Vi(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=tr(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=tr(t.responseBody,t.responseHeaders,e,"Response")),t)})(r),u=e=>{return l(((t,e,n)=>{var i;if(null==n?void 0:n(t.name))return;const r=Ei(t.name);let s=0===e.indexOf("http")?null===(i=Ei(e))||void 0===i?void 0:i.pathname:e;"/"===s&&(s="");const o=null==r?void 0:r.pathname.replace(s||"","");return r&&o&&Ki.some(t=>0===o.indexOf(t))?void 0:t})((Yi((i=e).requestHeaders),Yi(i.responseHeaders),i),t.api_host,n));var i},c=oi(t.session_recording.maskNetworkRequestFn);return c&&oi(t.session_recording.maskCapturedNetworkRequestFn)?Ri.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):c&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const n=t.session_recording.maskNetworkRequestFn({url:e.name});return!n&&e.isInitial?n:i(i({},e),{},{name:null==n?void 0:n.url})}),r.maskRequestFn=oi(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var n,i;const r=u(e);if(!r)return;const s=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,o=null===(n=(i=t.session_recording).maskCapturedNetworkRequestFn)||void 0===n?void 0:n.call(i,r);return hi(o)&&s?(nr.add(s),s):null!=o?o:void 0}:t=>function(t){if(!li(t))return t.requestBody=er(t.requestBody,"Request"),t.responseBody=er(t.responseBody,"Response"),t}(u(t)),i(i(i({},Zi),r),{},{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.fn,t)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch})))}else Vo.info("NetworkCapture not started because we are on localhost.");return n}pn(t){return this._instance.config.disable_capture_url_hashes?gi(t):t}mn(t,e=!1){const n=e?gi(t):this.pn(t),i=this._instance.config.mask_personal_data_properties?[...ko,...this._instance.config.custom_personal_data_properties||[]]:[];return this.gn(function(t,e){if(!t||!e||!e.length)return t;const n=t.split("#"),i=n[1],r=(n[0]||"").split("?"),s=r[1],o=r[0],a=(s||"").split("&"),l=[];for(let t=0;a.length>t;t++){const n=a[t].split("=");si(n)&&(e.includes(n[0])?l.push(n[0]+"=<masked>"):l.push(a[t]))}let u=o;return null!=s&&(u+="?"+l.join("&")),null!=i&&(u+="#"+i),u}(n,i))}gn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var n;const i=e.maskCapturedNetworkRequestFn({name:t});return null!==(n=null==i?void 0:i.name)&&void 0!==n?n:null==i?void 0:i.url}if(e.maskNetworkRequestFn){const n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}yn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Vo.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.yn(Jo(()=>Xo().addCustomEvent(t,e)))}bn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}wn(t){if(!this.bn())return!1;try{const e=Xo();return!!e&&(e.addCustomEvent("$json_ld",t),this.bn())}catch(t){return!1}}kn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this._n)||void 0===e?void 0:e.scan(t)})}Sn(){try{if(this._instance.config.capture_pageview||!Qn)return;const t=new URL(Qn.location.href),e=this.mn(t.origin+t.pathname+t.search);this.xn!==e&&(this.xn=e,this.Vt("$url_changed",{href:e}))}catch(t){}}Cn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.yn(t)})}}jt(){return this.yn(Jo(()=>Xo().takeFullSnapshot()))}get In(){var t,e,n;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var i;const t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.trigger_pending_buffer_interval_millis;return di(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Mn(){if(this.Tn&&clearInterval(this.Tn),!0===this.de)return;const t=this.In;t&&(this.Tn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.Rn(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Mn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this._n)||void 0===t||t.scan(),clearInterval(this.Tn),Vo.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this._n)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.kn(),this.Mn(),this.Vt("recording resumed",{reason:"left blocked url"}),Vo.info("recording resumed"))}$n(t,e){var n;if("event"===t&&this.Rn(),!this.ue&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var i,r;const n="url"===t?Lr:Nr;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:this.sessionId}),null===(r=this.re)||void 0===r||r.updateActiveTriggers(this.sessionId),this.Bt(),this.Ye(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property("$session_recording_remote_config");if(!t)return;let e;try{e=ai(t)?t:JSON.parse(t)}catch(t){return void Vo.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ue){var n;const i=null!==(n=e.cache_timestamp)&&void 0!==n?n:Date.now();if(Date.now()-i>36e5)return void Vo.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:t})}return e}On(t,e,n){this._instance.get_property(t)&&(e(),n())}start(t){var e,n;const i=this.ne;if(!i)return void Vo.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ke(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.Pe&&(this.Pn(),this.tn());const{sessionId:r,windowId:s,sessionStartTimestamp:o}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=r,this.je=s,this._sessionStartTimestamp=o,this.Ln(),null===(e=this._instance.persistence)||void 0===e||e.unregister("$debug_first_full_snapshot_timestamp"),(null==i?void 0:i.endpoint)&&(this.oe=null==i?void 0:i.endpoint),this.re=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new wo(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new bo(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(i),null===(n=this.Wt)||void 0===n||n.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.$n(t,e)),this.On(Or,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Or)}),this.On(Er,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Er)}),this.On($r,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister($r)}),this.On(Fr,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Fr)}),this.re.makeSamplingDecisions(this.sessionId),this.Dn(),this.ke||(Ti(Qn,"beforeunload",this.Ze),Ti(Qn,"pagehide",this.en),Ti(Qn,"offline",this.nn),Ti(Qn,"online",this.rn),Ti(Yn,"visibilitychange",this.sn),!this.De&&oi(this.Yt.onSessionId)&&(this.De=this.Yt.onSessionId(this.qe)),!this.Fe&&oi(this.Yt.on)?this.Fe=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.Ne=this.Yt.onSessionId((t,e,n)=>{var i;null===(i=this.Ne)||void 0===i||i.call(this),this.Ne=void 0,this.qe(t,e,n)})}):oi(this.Yt.on)||Vo.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),hi(this.Le)&&(this.Le=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.mn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Vo.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(t||"recording_initialized"))}Fn(){var t,e,n,i,r,s;null==Qn||Qn.removeEventListener("beforeunload",this.Ze),null==Qn||Qn.removeEventListener("pagehide",this.en),null==Qn||Qn.removeEventListener("offline",this.nn),null==Qn||Qn.removeEventListener("online",this.rn),null==Yn||Yn.removeEventListener("visibilitychange",this.sn),clearInterval(this.Tn),this.Nn(),null===(t=this.Le)||void 0===t||t.call(this),this.Le=void 0,null===(e=this.Wt)||void 0===e||e.call(this),this.Wt=void 0,null===(n=this.De)||void 0===n||n.call(this),this.De=void 0,null===(i=this.Fe)||void 0===i||i.call(this),this.Fe=void 0,null===(r=this.Ne)||void 0===r||r.call(this),this.Ne=void 0,null===(s=this.re)||void 0===s||s.stop(),this.qn(),this.Pn()}Pn(){this.Oe+=1,this.Ae=[],this.$e=0,this.jn=void 0,this.Pe=!1}qn(){var t,e;null===(t=this.Bn)||void 0===t||t.stop(),this.ce=[],null===(e=this._n)||void 0===e||e.stop(),this._n=void 0,this.ae=!1;try{var n;null===(n=this.se)||void 0===n||n.call(this)}catch(t){Vo.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.jn||0===this.$e)return!1;if(this.Pe)return!0;this.Pe=!0,this.Hn=void 0;const t=this.Oe;return this.Nn(),this.qn(),this.jn.catch(()=>{}).then(()=>{t===this.Oe&&(this.Pe=!1,this.Ye(),this.tn(),this.Un(),this.Fn(),Vo.info("stopped"))}).catch(()=>{this.Pe=!1,this.Un(),this.Fn(),Vo.info("stopped")}),!0}stop(){if(this.qn(),this.Ue)this.Xe();else if(this.zn())return;this.Ye(),this.tn(),this.Un(),this.Fn(),Vo.info("stopped")}Un(){this.Ke(void 0,{preserveLogDedup:this.Ue}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Xe(),this.Ye())}He(t){this.Ue=!0,this.le=Date.now();try{var e,n;this.stop(),this.Wn=void 0,this.me=0,this.fe=0,this.ve=0,this.pe=0,null===(e=Qo())||void 0===e||null===(n=e.resetSnapshotCostState)||void 0===n||n.call(e),this.start("session_id_changed")}finally{this.Ue=!1}this.Ke(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ke(t,{preserveLogDedup:e=!1}={}){if(this.ge=!li(t),this.Hn=t,li(t))return void(e||(this.Vn=void 0));if(this.Ue)return;const n=`${this.sessionId}:${t}`;n!==this.Vn&&(this.Vn=n,Vo.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}Rn(){this.isStarted||(this.we=!0),this.ge&&(this.Ke(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Gn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.tn(),this.qn()),this.tn(),this.Fn(),this.tn(),this.Un(),Vo.info("discarded")}Qn(t,e,n,i,r){if(-1===n)return this.me+=1,void Vo.warn("could not stringify event - dropping it to keep the rest of the recording");const s={$snapshot_bytes:n,$snapshot_data:e,$session_id:i,$window_id:r};"disabled"!==this.status?(this.Zn(t,i),this.Jn(s)):this.tn()}Kn(){try{this.Xn()}catch(t){this.Se||(this.Se=!0,Vo.error("could not track full snapshot cost",t))}}Xn(){var t,e;const n=null===(t=Qo())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);n&&n!==this.Wn&&(this.Wn=n,500>n.durationMs||Vo.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(n.durationMs),stylesheetMs:Math.round(n.stylesheetMs),nodeCount:n.nodeCount,cssRuleCount:n.cssRuleCount,nonDeferrableCssRuleCount:n.nonDeferrableCssRuleCount,deferredStylesheetCount:n.deferredStylesheetCount}))}Zn(t,e){2!==t.type?3===t.type&&(li(this.Te)||this.Te===e||this.Re===e||(this.Re=e,Vo.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Te=e}Yn(t){t.counted&&t.generation===this.Oe&&(this.$e=Math.max(0,this.$e-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ti(t,e,n){t.processed||t.generation!==this.Oe||(t.processed=!0,this.Qn(t.event,e,n,t.targetSessionId,t.targetWindowId))}ei(t){try{let e,n=t.event;if(t.compressionEnabled)try{({event:n,size:e}=fa(t.event))}catch(t){Vo.warn("could not process queued compression event - will use uncompressed event",t)}li(e)&&(e=ks(t.event));try{this.ti(t,n,e)}catch(t){Vo.warn("could not capture queued compression event",t)}}finally{this.Yn(t)}}Xe(){[...this.Ae].forEach(t=>{try{this.ei(t)}catch(t){Vo.warn("could not drain queued compression event",t)}})}ni(t,e,n,i){var r=this;const o={event:t,compressionEnabled:e,targetSessionId:n,targetWindowId:i,generation:this.Oe,processed:!1,counted:!0};this.Ae.push(o),this.$e+=1;const a=(l=s(function*(){try{if(o.processed)return;let n,i;try{const r=e?ua(t)?yield function(t){return va.apply(this,arguments)}(t):fa(t):{event:t,size:ks(t)};n=r.event,i=r.size}catch(e){Vo.warn("could not process queued compression event - will use uncompressed event",e),n=t,i=ks(t)}r.ti(o,n,i)}finally{r.Yn(o)}}),function(){return l.apply(this,arguments)});var l;this.jn=this.jn?this.jn.catch(()=>{}).then(a):a()}onRRwebEmit(t){var e,n,i,r,s,o,a,l,u,c,h,d;if(!this._instance.sessionManager)return;if(this.Cn(),!t||!ai(t))return;if(4===t.type){const e=this.mn(t.data.href);if(this.xn=e,!e)return;t.data.href=e}else this.Sn();if(null===(e=this.re)||void 0===e||e.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.$n(t,e)),this.Y.urlBlocked&&(5!==(c=t).type||"recording paused"!==c.data.tag))return;2===t.type&&(this.Kn(),Promise.resolve().then(()=>this.Kn()),this.Mn(),null===(h=this.Bn)||void 0===h||h.reset(),null===(d=this._instance.persistence)||void 0===d||d.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const f=2===t.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));f&&this.ii();const v=this.Bn?this.Bn.throttleMutations(t):t;if(!v)return void(!0===this.de&&this.he++);const p=function(t){const e=t;if(e&&ai(e)&&6===e.type&&ai(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const n=[];for(let t=0;e.data.payload.payload.length>t;t++)n.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=n,t}return t}(v),m=function(t){return ga(t)?t.data.payload:null}(p),g=function(t){return ya(t)?t.data.payload:null}(p),y=function(t){return ma(t)?t.data.payload:null}(p);m||g?(null==m?void 0:m.lastActivityTimestamp)&&(p.timestamp=m.lastActivityTimestamp):(null==y?void 0:y.sessionId)||this.ri(p);const b=null!==(i=null!==(r=null!==(s=null==m?void 0:m.currentSessionId)&&void 0!==s?s:null==g?void 0:g.nextSessionId)&&void 0!==r?r:null==y?void 0:y.sessionId)&&void 0!==i?i:this.Xt,w=null!==(o=null!==(a=null!==(l=null==m?void 0:m.currentWindowId)&&void 0!==l?l:null==g?void 0:g.nextWindowId)&&void 0!==a?a:null==y?void 0:y.windowId)&&void 0!==o?o:this.je;if(!0===this.de&&!function(t){return ma(t)||ga(t)||ya(t)}(p))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(p)&&this.he++);2===p.type&&(this.he=0),y&&(p.timestamp=y.lastActivityTimestamp+y.threshold);const k=this.ae;this.ae=!0,f?this.kn(!0):k||this.kn();const _=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===p.type&&"$json_ld"===p.data.tag){let t;try{t=Qn?this.mn(Qn.location.href):void 0}catch(t){}p.data.href=t}if(this.$e>0||_&&ua(p))return void this.ni(p,_,b,w);const{event:S,size:C}=_?fa(p):{event:p,size:ks(p)};this.Qn(p,S,C,b,w)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.ke,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):Xr}log(t,e="log"){var n;null===(n=this._instance.sessionRecording)||void 0===n||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.Rn(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.Rn(),this.qt("sampling_overridden")}overrideTrigger(t){this.$n(t),this.Rn()}oi(){try{var t;const e=null==Qn||null===(t=Qn.location)||void 0===t?void 0:t.href;if(!e)return;const n=this.mn(e);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}Nn(){this.si&&(clearTimeout(this.si),this.si=void 0)}Gn(){this.si||(this.si=setTimeout(()=>{this.Ye()},2e3))}ai(){return this.Te!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!ga(t)&&!ya(t))}li(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}ui(t){if("buffering"!==t)return li(this.ci)||this._instance.register_for_session({[qr]:[]}),void(this.ci=void 0);const e=this.li();if(0===e.length)return li(this.ci)||this._instance.register_for_session({[qr]:[]}),void(this.ci=void 0);const n=e.join(", "),i=`${this.sessionId}:${n}`;i!==this.ci&&(this.ci=i,this._instance.register_for_session({[qr]:e}),Vo.info(`buffering: ${n}`))}di(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.hi)&&oo.At()}fi(){0!==this.Rt.data.length&&this.Rt.size!==this.pi&&943718.4>=this.Rt.size&&this.di()&&(this.pi=this.Rt.size,oo.$t(this.an,this.Rt))}Ln(){if(this.Ee||!this.di())return;this.Ee=!0;const t=oo.Dt(this.an);oo.Pt(this.an),ai(t)&&si(t.data)&&0!==t.data.length&&si(t.sizes)&&t.sizes.length===t.data.length&&di(t.size)&&t.sessionId===this.Xt&&t.windowId===this.je&&(this.Rt.data.length>0||(this.Rt=t))}Ye(t=!1){var e;if(this.Nn(),this.ge)return this.Rt;if(this.ai())return this.Rt.size>943718.4?this.tn():(t&&this.fi(),this.Rt);const n=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const r=this.Ge(),s=this.status;if(this.ui(s),"buffering"===s||"paused"===s||"disabled"===s||r)return!t||"active"!==s&&"sampled"!==s||this.fi(),this.Gn(),this.Rt;if(this.Rt!==n)return this.Rt;if(n.data.length>0){var o;const t=this.oi();Ss(n).forEach(e=>{try{var n;null===(n=this.Be)||void 0===n||n.trackSize(e.sessionId,e.size),this.mi(i(i(i(i({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:ao.LIB_NAME,$lib_version:ao.LIB_VERSION,$snapshot_host:t},this.fe>0?{$sdk_debug_replay_throttled_mutations_dropped:this.fe}:{}),this.ve>0?{$sdk_debug_replay_oversized_mutations_dropped:this.ve}:{}),this.pe>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe}:{}),this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){Vo.warn("could not capture snapshot chunk - skipping it",t)}}),li(this.pi)||(oo.Pt(this.an),this.pi=void 0),null===(o=this.re)||void 0===o||o.onFlushComplete()}return this.tn()}Jn(t){var e;const n=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),i=t.$session_id,r=this.Rt.sessionId!==i;if(r||!0!==this.de&&!this.ge&&this.Rt.size+t.$snapshot_bytes+n>943718.4){const e=this.Xt;if(this.Rt=this.Ye(),this.Xt!==e)return;r&&this.Rt.data.length>0&&(this.Rt=this.tn()),this.Rt.sessionId=i,this.Rt.windowId=t.$window_id}this.ge&&(this.be||this.Rt.size+t.$snapshot_bytes+n>943718.4)?this.be=!0:(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.ge||this.Gn())}mi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const n=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return n?n.timestamp-this._sessionStartTimestamp:null}ii(){if(!this.Rt||0===this.Rt.data.length)return this.tn();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.tn():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}tn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.je},this.Rt}qt(t,e){this._instance.register_for_session({[Qr]:t}),Vo.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",i({reason:t},e))}gi(t){var e;return 3===t.type&&-1!==Zo.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ri(t){const e=this.gi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Tn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.je}),this.Ye());const{windowId:n,sessionId:i}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let r=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}const s=this.Xt!==i,o=this.je!==n;if(this.je=n,this.Xt=i,s||o){const t=s&&!1!==this.de;t&&(this.de="unknown"),this.He(t)}else if(e&&this.Rn(),r){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.re)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this.kn(),this.Mn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Hn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(t=this.Be)||void 0===t?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this.ke,[Zr]:this.yi,[Jr]:this._e}}get yi(){var t,e,n;return!!this.se&&(null===(t=null===(e=Xo())||void 0===e||null===(n=e.isRecording)||void 0===n?void 0:n.call(e))||void 0===t||t)}Dn(){var t;if(this.se)return;this._e=!0;const e={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},n=this._instance.config.session_recording;for(const[t,r]of Object.entries(n||{}))if(t in e)if("maskInputOptions"===t)e.maskInputOptions=i({password:!0},r);else if("sampling"===t){const t=null!=r?r:{},n={};li(t.mousemove)||(n.mousemove=t.mousemove),li(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),e.sampling=n}else e[t]=r;var r,s,o,a;!0===(null==n?void 0:n.captureJsonLd)&&!0!==e.slimDOMOptions&&"all"!==e.slimDOMOptions&&(e.slimDOMOptions=i(i({},e.slimDOMOptions),{},{script:!0})),this.dn&&this.dn.enabled&&(e.recordCanvas=!0,e.sampling=i(i({},e.sampling),{},{canvas:this.dn.fps}),e.dataURLOptions={type:"image/webp",quality:this.dn.quality},e.canvasResolutionScale=this.cn,e.canvasMasking={configured:()=>{var t;return oi(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const n=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(oi(n))try{var i;return null!==(i=n(t))&&void 0!==i?i:null}catch(t){return this.Ie||(this.Ie=!0,Vo.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.ln&&(e.maskAllInputs=null===(r=this.ln.maskAllInputs)||void 0===r||r,e.maskTextSelector=null!==(s=this.ln.maskTextSelector)&&void 0!==s?s:void 0,e.blockSelector=null!==(o=this.ln.blockSelector)&&void 0!==o?o:void 0,e.maskAllElementAttributes=null!==(a=this.ln.maskAllElementAttributes)&&void 0!==a&&a),e.maskAllElementAttributes&&e.maskAttributeFn&&(e.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,Vo.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.un();const l=Xo();if(!l)return void Vo.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Bn=null!==(t=this.Bn)&&void 0!==t?t:new ro(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const n=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;Vo.info(n,{node:e}),this.log("[SessionRecording] "+n,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const u=this.vn();if(this.se=l(i(i({emit:t=>{this.onRRwebEmit(t)},plugins:u,errorHandler:(t,e)=>"rrweb"===e&&(this.Me||(this.Me=!0,Vo.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},e),{},{recordAfter:"DOMContentLoaded"})),!this.se)return this.ke=!0,void Vo.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ke=!1,!0===(null==n?void 0:n.captureJsonLd)&&Yn&&(null==Qn?void 0:Qn.MutationObserver)&&!this._n&&(this._n=function(t,e,n){const i=new WeakMap,r=n.getCaptureState||(()=>!0);let s=_o;const o=function(t,e){const n=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==n?void 0:n.length)&&!n.includes("id")?Io:n=>{const i=t.getElementById(n);return!!i&&"SCRIPT"!==i.nodeName&&(!e.isRecordedElement||e.isRecordedElement(i))&&!qo(i,e.blockClass,e.blockSelector)}}(t,n),a=e=>{try{const a=r();if(!s||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){return qo(t,e.blockClass,e.blockSelector)||qo(t,e.maskTextClass,e.maskTextSelector)}(e,n))return;const l=function(t,e=Io,n){if(!t||t.length>_o)return null;try{const i=JSON.parse(t),r={maskUrl:n,remainingNodes:2048,exceeded:!1},s=si(i)?i.map(t=>Bo(t,e,r)):Bo(i,e,r);if(r.exceeded||ci(s)||si(s)&&(!s.length||s.some(ci)))return null;const o=JSON.stringify(s);return o.length>2e4?null:[s,o]}catch(t){return null}}(e.text,o,n.maskUrl);if(!l)return void i.delete(e);const[u,c]=l;if(ci(a))return void i.set(e,c);if(i.get(e)!==c){if(c.length>s)return void(s=0);n.emit(u)&&(i.set(e,c),s-=c.length)}}catch(t){return}};try{const n=new e(t=>{try{if(!s||!1===r())return;const e=t=>{for(const e of Ho(t))a(e)};for(const n of t)if("childList"===n.type)Wo(n.target)&&a(n.target),n.addedNodes.forEach(e);else if("characterData"===n.type){const t=n.target.parentNode;t&&Wo(t)&&a(t)}else"attributes"===n.type&&Wo(n.target)&&a(n.target)}catch(t){return}});return n.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){s&&!1!==r()&&Ho(t.documentElement).forEach(t=>{e&&i.delete(t),a(t)})},stop(){return n.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(Yn,Qn.MutationObserver,{maskUrl:t=>this.mn(t),attributeFilter:e.attributeFilter,blockClass:e.blockClass,blockSelector:e.blockSelector,isRecordedElement:t=>l.mirror.getId(t)>0,maskAllElementAttributes:e.maskAllElementAttributes,maskAttributeFn:e.maskAttributeFn,maskTextClass:e.maskTextClass,maskTextSelector:e.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.bn()},emit:t=>this.wn(t)}),this.Y.isCurrentUrlBlocked()&&this._n.scan()),this.le=Date.now(),this.de=fi(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:e,activePlugins:u.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};ei.__PosthogExtensions__=ei.__PosthogExtensions__||{},ei.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:Jn,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:Tr,options:t})},ei.__PosthogExtensions__.rrweb={record:Fn,version:"v2",wasMaxDepthReached:()=>Kt,resetMaxDepthState(){Kt=!1,Yt=!1},getLastSnapshotCost:()=>j,getMutationCost:()=>i({},q),getDeferredStylesheetStats:()=>i({},H),getDiscardedDurationSamples:()=>T,getObserverInitFailures:()=>Ve.size?Array.from(Ve):void 0,resetSnapshotCostState(){D=0,L=0,N=0,x=0,T=0,P={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},j=null,z=null,B=[],W=0,U=0,q={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},ei.__PosthogExtensions__.initSessionRecording=(t,e)=>new ba(t,e)}();
|
|
2
2
|
//# sourceMappingURL=posthog-recorder.js.map
|