posthog-js 1.434.11 → 1.434.13

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.
@@ -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,"0".repeat(32),"0".repeat(16);var p={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},m={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},g={};function y(t){if(g[t])return g[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 p?p[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 m?m[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 g[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),g[t]=r):n}catch(t){return n}finally{!l&&a.parentNode&&document.body.removeChild(a)}var u}var b=Object.create(null);function w(t,e,n){var i;const r=b[t],s=r[n];if(s)return s.call(e);const o=y(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]}b.Node=Object.create(null),b.ShadowRoot=Object.create(null),b.MutationObserver=Object.create(null),b.Element=Object.create(null);var _,k={};function S(t,e,n){const i=`${t}.${String(n)}`;if(k[i])return k[i].bind(e);const r=y(t)[n];return"function"!=typeof r?e[n]:(k[i]=r,r.bind(e))}function C(){return y("MutationObserver").constructor}function I(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 M={childNodes:t=>w("Node",t,"childNodes"),parentNode:t=>w("Node",t,"parentNode"),parentElement:t=>w("Node",t,"parentElement"),textContent:t=>w("Node",t,"textContent"),isConnected(t){if(void 0===_){var e;const t=null===(e=Object.getOwnPropertyDescriptor(y("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)=>S("Node",t,"contains")(e),getRootNode:t=>S("Node",t,"getRootNode")(),host:t=>t&&"host"in t?w("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?w("Element",t,"shadowRoot"):null,querySelector:(t,e)=>S("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>S("Element",t,"querySelectorAll")(e),mutationObserver:C,patch:I};function R(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var A=0,x=0;function T(){A+=1}function O(){return A}function E(t,e){return(e!==A||t>6e4)&&(x+=1,!0)}var F=0,D=0,L=0,N={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},P=null,j=null,B=[],z=0,W=0,U={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function q(t){var e;(F+=1)>1||(N={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},B=[],z=0,j=(e=t)&&e>0?e:null,D=R(),L=A)}function G(){return 0===F?P||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(F-=1)>0?N:(N.durationMs=R()-D,N.deferredStylesheetCount=z,H.deferredCount+=z,j=null,E(N.durationMs,L)?N:P=N)}function V(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+=V(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+=V(r,e,n+1))}}}catch(t){}}return i}function Z(t){if(0===F)return;const e=V(t,null,0);N.cssRuleCount+=e,W>0&&(N.nonDeferrableCssRuleCount+=e)}function J(t){W+=1;try{return t()}finally{W-=1}}function Q(t){F>0&&(N.stylesheetMs+=t)}function X(t){if(0===F||null===j)return!1;const e=N.cssRuleCount-N.nonDeferrableCssRuleCount;return e>=j||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const n=new WeakSet;return n.add(t),V(e,n,0)}catch(t){return 0}}(t)>j}function Y(){const t=B;return B=[],t}function K(){H.failedCount+=1}function tt(t){t>0&&(H.abandonedCount+=t)}function et(t){return et="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},et(t)}function nt(t,e,n){return(e=function(t){var e=function(t){if("object"!=et(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function it(t){return t.nodeType===t.ELEMENT_NODE}function rt(t){const e=t&&"host"in t&&"mode"in t&&M.host(t)||null;return Boolean(e&&"shadowRoot"in e&&M.shadowRoot(e)===t)}function st(t){return"[object ShadowRoot]"==={}.toString.call(t)}function ot(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 at(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 lt=0;function ut(t){const e=0===lt,n=e?R():0;lt+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Z(e);let n=t.href;return!n&&t.ownerNode&&(n=t.ownerNode.baseURI),ot(Array.from(e,t=>ct(t,n)).join(""))}catch(t){return null}finally{lt-=1,e&&Q(R()-n)}}function ct(t,e){if(dt(t)){let e;try{e=ut(t.styleSheet)||at(t)}catch(n){e=t.cssText}try{var n;if(e&&(null===(n=t.styleSheet)||void 0===n?void 0:n.href))return At(e,t.styleSheet.href)}catch(t){}return e}{let n=t.cssText;return ft(t)&&t.selectorText.includes(":")&&(n=ht(n)),e?At(n,e):n}}function ht(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function dt(t){return"styleSheet"in t}function ft(t){return"selectorText"in t}var vt=/^-?[A-Za-z_][\w-]*$/,pt=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function mt(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||at(e)}catch(t){r=e.cssText}try{var i;r&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href)&&(r=At(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&&dt(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(ft(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&&!vt.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]?vt.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":pt.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?At(i,r):i,fixColons:"sheet"===n.kind&&ft(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(n,t))return;let i=n.cssText;"sheet"===t.kind&&ft(n)&&n.selectorText.includes(":")&&(i=ht(i)),t.parts.push(t.sheetHref?At(i,t.sheetHref):i),t.index+=1}return function(t){try{const n=t.rules||t.cssRules;if(!n)return!1;Z(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,!dt(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;Z(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=R();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?ht(n):n}else e=ot(t.parts.join(""))}catch(t){}s(e);continue}o-=1;try{a(t)}catch(t){s(null)}}}catch(t){n=!0,i=null}finally{Q(R()-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 gt=class{constructor(){nt(this,"idNodeMap",new Map),nt(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)),it(t)){const e=M.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 yt({element:t,maskInputOptions:e,tagName:n,type:i,value:r,maskInputFn:s}){let o=r||"";const a=i&&bt(i);return(e[n.toLowerCase()]||a&&e[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function bt(t){return t.toLowerCase()}var wt=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&&wt.has(bt(e))?n:"*".repeat(n.length):r?r(e,n,t):n:n}var kt="__rrweb_original__";function St(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?bt(e):null}catch(t){return null}}var Ct=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,It=/^(?:[a-z+]+:)?\/\//i,Mt=/^www\..*/i,Rt=/^(data:)([^,]*),(.*)/i;function At(t,e){return(t||"").replace(Ct,(t,n,i,r,s,o)=>{const a=i||s||o,l=n||r||"";if(!a)return t;if(It.test(a)||Mt.test(a))return`url(${l}${a}${l})`;if(Rt.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 xt,Tt,Ot=new Map,Et=1,Ft=new RegExp("[^a-z0-9-_:]");function $t(){return Et++}var Dt=!1,Lt=/^[^ \t\n\r\u000c]+/,Nt=/^[, \t\n\r\u000c]+/,Pt=new WeakMap;function jt(t,e){return e&&""!==e.trim()?Bt(t,e):e}function Bt(t,e){let n=Pt.get(t);if(n||(n=t.createElement("a"),Pt.set(t,n)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return n.setAttribute("href",e),n.href}function zt(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 Wt(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=jt(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=Ot.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(Ot.size>=10){const t=Ot.keys().next().value;void 0!==t&&Ot.delete(t)}return Ot.set(e,{type:n,quality:i,result:a}),a}catch(t){return e}}(r,n,s.type,s.quality)),zt(t,s)}if("image"===e)return zt(n,s)}return n}if("xlink:href"===n&&"#"!==i[0]){const n=jt(t,i);return"image"===e&&n.startsWith("data:")?zt(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(Nt),e.length>n;){let s=i(Lt);if(","===s.slice(-1))s=jt(t,s.substring(0,s.length-1)),r.push(s);else{let i="";s=jt(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?At(i,Bt(t)):"object"===e&&"data"===n?jt(t,i):i:jt(t,i)}function Ut(t,e,n){return("video"===t||"audio"===t)&&"autoplay"===bt(e)}function Ht(t){return"string"==typeof t&&bt(t).split(/\s+/).includes("stylesheet")}function qt(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&qt(M.parentNode(t),e,n);for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;return!!n&&qt(M.parentNode(t),e,n)}function Gt(t,e,n,i){let r;if(it(t)){if(r=t,!M.childNodes(r).length)return!1}else{if(null===M.parentElement(t))return!1;r=M.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(qt(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 Vt(t,e,n){const i=t.removeEventListener;"function"==typeof i&&i.call(t,e,n)}var Zt=new Map;function Jt(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Qt(t){return null==t?"":t.toLowerCase()}var Xt=!1,Yt=!1;function Kt(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:_,onIframeLoad:k,iframeLoadTimeout:S=5e3,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:A=()=>!1,newlyAddedElement:x=!1,depth:T=0,maxDepth:O=50}=e;let{needsMask:E}=e,{preserveWhiteSpace:D=!0}=e;if(T>=O)return Yt=!0,Xt||(Xt=!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=Gt(t,o,a,void 0===E)),F>0&&(N.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=bt(t.tagName);return Ft.test(e)?"div":e}(t),w=new Set;let _={};const k=t.attributes.length;for(let e=0;k>e;e++){const i=t.attributes[e];Ut(b,i.name)||(_[i.name]=Wt(n,b,bt(i.name),i.value,t,c))}if("link"===b&&s&&!y&&Ht(_.rel)){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=Jt(n,i),!e&&i.includes(".css"))&&(e=Jt(n,window.location.origin+"/"+i.replace(window.location.href,"")))}let i=null;e&&(X(e)?F>0&&(B.push(t),z+=1):i=ut(e)),i&&(delete _.rel,delete _.href,_._cssText=i)}var S;if("style"===b&&t.sheet&&!(t.innerText||M.textContent(t)||"").trim().length){const e=J(()=>ut(t.sheet));e&&(_._cssText=e)}if("input"===b||"textarea"===b||"select"===b){const e=t.value,n=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=yt({element:t,type:St(t),tagName:b,value:e,maskInputOptions:o,maskInputFn:a}):n&&(_.checked=n)}if("option"===b&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===b&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.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=kt in r?r[kt]: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)||(_.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)&&(_.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(S=t)?void 0:S.name)?Dt||(Dt=!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){xt||(xt=n.createElement("canvas"),Tt=xt.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=()=>{Vt(e,"load",o);try{xt.width=e.naturalWidth,xt.height=e.naturalHeight,Tt.drawImage(e,0,0);const t=xt.toDataURL(c.type,c.quality);_.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?_.crossOrigin=s("crossOrigin",r):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===b||"video"===b){const e=_;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&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),y){var R,A,x;const{width:e,height:i,left:r,top:s}=t.getBoundingClientRect(),o=null===(R=n.defaultView)||void 0===R?void 0:R.getComputedStyle(t);_={class:_.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&&(_.rr_position=o.position||"static",w.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,w.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,w.add("rr_display")))}if("iframe"!==b||p(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),l||u)for(const[e,n]of Object.entries(_))"string"!=typeof n&&null!==n||(_[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:_,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=M.parentNode(t),o=s&&s.tagName;let a=M.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(X(s.sheet));else if(null===(c=s.sheet)||void 0===c?void 0:c.cssRules){const t=ut(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=At(a,Bt(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&n&&(a=i?i(a,M.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:M.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 P;P=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&&(Qt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Qt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Qt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Qt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Qt(t.attributes.property).match(/^(og|twitter|fb):/)||Qt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Qt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Qt(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(Qt(t.attributes.name))||Qt(t.attributes.property).match(/^article:/)||Qt(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(Qt(t.attributes.name)))return!0}}return!1}(L,m)||!D&&L.type===f.Text&&!L.isStyle&&!L.textContent.replace(/^\s+|\s+$/gm,"").length?-2:$t();const j=Object.assign(L,{id:P});if(i.add(t,j),-2===P)return null;_&&_(t);let W=!l;if(j.type===f.Element){W=W&&!j.needBlock,delete j.needBlock;const e=M.shadowRoot(t);e&&st(e)&&(j.isShadowHost=!0)}if((j.type===f.Document||j.type===f.Element)&&W){m.headWhitespace&&j.type===f.Element&&"head"===j.tagName&&(D=!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:D,onSerialize:_,onIframeLoad:k,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:R,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(M.childNodes(t))){const t=Kt(n,e);t&&j.childNodes.push(t)}let x=null;if(it(t)&&(x=M.shadowRoot(t)))for(const t of Array.from(M.childNodes(x))){const n=Kt(t,e);n&&(st(x)&&(n.isShadow=!0),j.childNodes.push(n))}}const U=M.parentNode(t);if(U&&rt(U)&&st(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),Vt(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?Vt(t,"load",o):(i=!0,Vt(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),Vt(t,"load",o)}}return t.addEventListener("load",o),()=>{Vt(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&k){const n=Kt(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:D,onSerialize:_,onIframeLoad:k,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:R,keepIframeSrcFn:A,depth:T+1,maxDepth:O});n&&k(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(Zt.has(e))return;let C;try{C=e.sheet}catch(t){return}if(C)return;const M=new AbortController;let x=!1;const F=()=>{if(!x){x=!0;try{(()=>{if(I){const e=Kt(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:D,onSerialize:_,onIframeLoad:k,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:R,keepIframeSrcFn:A,depth:T,maxDepth:O});e&&I(t,e)}})()}finally{Zt.delete(e),M.abort()}}},L=setTimeout(F,f);M.signal.addEventListener("abort",()=>clearTimeout(L),{once:!0}),e.addEventListener("load",F,{signal:M.signal,once:!0}),Zt.set(e,M)}(t,0,R),j}function te(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 ee=class t{constructor(...t){nt(this,"parentElement",null),nt(this,"parentNode",null),nt(this,"ownerDocument",void 0),nt(this,"firstChild",null),nt(this,"lastChild",null),nt(this,"previousSibling",null),nt(this,"nextSibling",null),nt(this,"ELEMENT_NODE",1),nt(this,"TEXT_NODE",3),nt(this,"nodeType",void 0),nt(this,"nodeName",void 0),nt(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 ne(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>ie(n,t,e,i)}function ie(t,e,n,i){re(()=>{const r=t.removeEventListener;"function"==typeof r&&(void 0!==i?r.call(t,e,n,i):r.call(t,e,n))})}function re(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function se(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var oe="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.",ae={map:{},getId(){return console.warn(oe),-1},getNode(){return console.warn(oe),null},removeNodeFromMap(){console.warn(oe)},has(){return console.warn(oe),!1},reset(){console.warn(oe)}};function le(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 ue(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e),o=()=>ue(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&&(ae=new Proxy(ae,{get(t,e,n){return"map"===e&&console.warn(oe),Reflect.get(t,e,n)}}));var ce=Date.now;function he(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=M.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=M.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 de(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function fe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ve(t){return t?t.nodeType===t.ELEMENT_NODE?t:M.parentElement(t):null}function pe(t,e,n,i){if(!t)return!1;const r=ve(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(qt(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 me(t,e,n){return!("TITLE"!==t.tagName||!n.headTitleMutations)||-2===e.getId(t)}function ge(t,e){if(rt(t))return!1;const n=e.getId(t);if(!e.has(n))return!0;const i=M.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||ge(i,e))}function ye(t){return Boolean(t.changedTouches)}function be(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function we(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 ee&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(M.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(ce=()=>(new Date).getTime());var ke=class{constructor(){nt(this,"id",1),nt(this,"styleIDMap",new WeakMap),nt(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 Se(t){var e;let n=null;return"getRootNode"in t&&(null===(e=M.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&M.host(M.getRootNode(t))&&(n=M.host(M.getRootNode(t))),n}function Ce(t){const e=t.ownerDocument;if(!e)return!1;if(M.contains(e,t))return!0;const n=M.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=Se(n);)n=e;return n}(t);return M.contains(e,n)}(t)}function Ie(t){return"__ln"in t}var Me,Re=class{constructor(){nt(this,"length",0),nt(this,"head",null),nt(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&&Ie(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&&Ie(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--)}},Ae=(t,e)=>`${t}@${e}`,xe=class{constructor(){nt(this,"frozen",!1),nt(this,"locked",!1),nt(this,"texts",[]),nt(this,"attributes",[]),nt(this,"attributeMap",new WeakMap),nt(this,"generatedAttributes",new WeakMap),nt(this,"removes",[]),nt(this,"mapRemoves",new Set),nt(this,"movedMap",{}),nt(this,"addedSet",new Set),nt(this,"movedSet",new Set),nt(this,"droppedSet",new Set),nt(this,"removesSubTreeCache",new Set),nt(this,"mutationCb",void 0),nt(this,"blockClass",void 0),nt(this,"blockSelector",void 0),nt(this,"maskTextClass",void 0),nt(this,"maskTextSelector",void 0),nt(this,"inlineStylesheet",void 0),nt(this,"maskInputOptions",void 0),nt(this,"maskTextFn",void 0),nt(this,"maskInputFn",void 0),nt(this,"maskAllElementAttributes",void 0),nt(this,"maskAttributeFn",void 0),nt(this,"keepIframeSrcFn",void 0),nt(this,"recordCanvas",void 0),nt(this,"canvasMaskingConfigured",void 0),nt(this,"inlineImages",void 0),nt(this,"slimDOMOptions",void 0),nt(this,"dataURLOptions",void 0),nt(this,"doc",void 0),nt(this,"mirror",void 0),nt(this,"iframeManager",void 0),nt(this,"stylesheetManager",void 0),nt(this,"shadowDomManager",void 0),nt(this,"canvasManager",void 0),nt(this,"processedNodeManager",void 0),nt(this,"unattachedDoc",void 0),nt(this,"canvasManagerReleased",!1),nt(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),nt(this,"emit",()=>{if(this.frozen||this.locked)return;const t=R(),e=O();try{this.processBufferedMutations()}finally{n=R()-t,i=e,F>0||E(n,null!=i?i:A)||n>U.slowestBatchMs&&(U.slowestBatchMs=n)}var n,i}),nt(this,"processBufferedMutations",()=>{const t=[],e=new Set,n=new Re,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=M.parentNode(s);if(!a||!Ce(s)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=rt(a)?this.mirror.getId(Se(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=>{be(t,this.mirror)&&this.iframeManager.addIframe(t),we(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),_e(t)&&!pe(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(M.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=Kt(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)Oe(this.removesSubTreeCache,t)&&!this.movedSet.has(M.parentNode(t))||s(t);for(const t of this.addedSet)Ee(this.droppedSet,t)||Oe(this.removesSubTreeCache,t)?Ee(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(M.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(M.parentNode(n.value));if(-1===i(n.value))continue;if(-1!==e){t=n;break}{const e=M.parentNode(n.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=M.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=M.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)}),nt(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),nt(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(M.childNodes(t),t=>M.textContent(t)||"").join("");e.attributes.value=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:St(t),value:n,maskInputFn:this.maskInputFn})}),nt(this,"processMutation",t=>{if(!me(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=M.textContent(t.target);pe(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Gt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,ve(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const i=t.target,r=bt(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=St(t);l=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(pe(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"),!Ut(r,a)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=Wt(this.doc,r,bt(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(pe(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=rt(t.target)?this.mirror.getId(M.host(t.target)):this.mirror.getId(t.target);pe(t.target,this.blockClass,this.blockSelector,!1)||me(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Te(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||ge(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Ae(n,i)]?Te(this.movedSet,e):(this.removes.push({parentId:i,id:n,isShadow:!(!rt(t.target)||!st(t.target))||void 0}),function(t,e){const n=[t];for(;n.length;){const t=n.pop();e.has(t)||(e.add(t),M.childNodes(t).forEach(t=>n.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),nt(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(me(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[Ae(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!pe(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=M.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=M.childNodes(M.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),pe(t,n||e,this.blockSelector,!0))return!0;const i="getRootNode"in t?M.getRootNode(t):null;t=(null==i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?M.host(i):null}return!1}};function Te(t,e){const n=[e];for(;n.length;){const e=n.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const i=M.childNodes(e);for(let t=0,e=i.length;e>t;t++){const e=i[t];e&&n.push(e)}}}function Oe(t,e,n){return 0!==t.size&&function(t,e){const n=M.parentNode(e);return!!n&&t.has(n)}(t,e)}function Ee(t,e){if(0===t.size)return!1;let n=M.parentNode(e);for(;n;){if(t.has(n))return!0;n=M.parentNode(n)}return!1}function Fe(t){Me=t}function $e(){Me=void 0}var De=(t,e="rrweb")=>Me?(...n)=>{try{return t(...n)}catch(t){if(Me&&!0===Me(t,e))return;throw t}}:t,Le=[];function Ne(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 Pe(t,e){const n=new xe;let i;n.init(t);try{i=new(C())(De(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),Le.push(n),{observer:i,buffer:n}}catch(t){try{null==i||i.disconnect(),n.destroy(),n.reset()}catch(t){}throw t}}function je({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){const o=new Map,a=s=>{const a=Ne(s);if(!a||pe(a,i,r,!0))return;const l=n.getId(a);let u,c;if(a===e&&e.defaultView){const t=he(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=[ne("scroll",De(le(De(t=>a(t)),s.scroll||100)),e)];return"onscrollend"in e&&l.push(ne("scrollend",De(a),e)),()=>l.forEach(t=>t())}function Be(t,e){for(let n=Le.length-1;n>=0;n--){const i=Le[n];if(!i)continue;let r=i.bufferBelongsToIframe(t);!r&&e&&e.has(i.bufferDoc())&&(r=!0),r&&(i.reset(),Le.splice(n,1))}}var ze=["INPUT","TEXTAREA","SELECT"],We=new WeakMap;function Ue(t){return function t(e,n){if(Ze("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Ze("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Ze("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Ze("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 qe({mirror:t,stylesheetManager:e},n){var i,r;let s=null;s=t.getId("#document"===n.nodeName?n:M.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}}),De(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Ge=new Set;function Ve(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=De(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Le.indexOf(s);-1!==t&&Le.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect()}finally{se(o)}}),h=(t,e)=>{const n=De(()=>{try{return e()}catch(e){throw Ge.add(t),e}})();"function"==typeof n&&o.push(n)};try{if(t.recordDOM&&h("mutation",()=>{const e=Pe(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=le(De(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null}),s),c=De(le(De(t=>{const e=Ne(t),{clientX:n,clientY:r}=ye(t)?t.changedTouches[0]:t;o||(o=ce()),a.push({x:n,y:r,id:i.getId(e),timeOffset:ce()-o}),u("undefined"!=typeof DragEvent&&t instanceof DragEvent?l.Drag:t instanceof MouseEvent?l.MouseMove:l.TouchMove)}),r,{trailing:!1})),h=[ne("mousemove",c,n),ne("touchmove",c,n),ne("drag",c,n)];return De(()=>{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=bt(o);const d=(e=>o=>{const a=Ne(o);if(pe(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 ye(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=ye(o)?o.changedTouches[0]:o;if(!f)return;const v=n.getId(a),{clientX:p,clientY:m}=f;De(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(ne(a,d,e))}),De(()=>{l.forEach(t=>t())})}(t)),h("scroll",()=>je(t)),h("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let n=-1,i=-1;return ne("resize",De(le(De(()=>{const e=de(),r=fe();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=Ne(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=M.parentElement(n)),!n||!d||0>ze.indexOf(d)||pe(n,r,s,!0))return;if(n.classList.contains(o)||a&&n.matches(a))return;let v=n.value,p=!1;const m=St(n)||"";"radio"===m||"checkbox"===m?p=n.checked:(l[d.toLowerCase()]||l[m])&&(v=yt({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=We.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){We.set(e,r);const s=n.getId(e);De(t)(i(i({},r),{},{id:s}))}}const v=("last"===c.input?["change"]:["input","change"]).map(t=>ne(t,De(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=>ue(t[0],t[1],{set(){De(d)({target:this,isTrusted:!1})}},!1,p))),De(()=>{se(v)})}(t)),h("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r,doc:s}){const o=De(s=>le(De(r=>{const o=Ne(r);if(!o||pe(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=[ne("play",o(d.Play),s),ne("pause",o(d.Pause),s),ne("seeked",o(d.Seeked),s),ne("volumechange",o(d.VolumeChange),s),ne("ratechange",o(d.RateChange),s)];return De(()=>{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:De((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:De((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:De((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=ut(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:De((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={};Je("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(Je("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),Je("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),Je("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:De((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=[...Ue(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:De((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=[...Ue(s),a];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),De(()=>{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",()=>qe(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:De((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=Ue(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:De((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=Ue(o.parentRule);s.queueMutation(h,()=>t({id:d,styleId:f,remove:{property:u},index:e}))}return c},"host")}),De(()=>{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=I(e.fonts,"add",function(e){return function(n){return setTimeout(De(()=>{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),De(()=>{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=De(()=>{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);pe(s,i,r,!0)||pe(l,i,r,!0)||a.push({start:n.getId(s),startOffset:o,end:n.getId(l),endOffset:u})}s({ranges:a})});return a(),ne("selectionchange",a)}(t)),h("customElement",()=>function({doc:t,customElementCb:e}){const n=t.defaultView;return n&&n.customElements?I(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 Ze(t){return void 0!==window[t]}function Je(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Qe=class{constructor(t){nt(this,"generateIdFn",void 0),nt(this,"iframeRemoteIdToLocalIdMap",new WeakMap),nt(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}},Xe=class{constructor(t){nt(this,"iframes",new WeakMap),nt(this,"crossOriginIframeMap",new WeakMap),nt(this,"crossOriginIframeMirror",new Qe($t)),nt(this,"crossOriginIframeStyleMirror",void 0),nt(this,"crossOriginIframeRootIdMap",new WeakMap),nt(this,"mirror",void 0),nt(this,"mutationCb",void 0),nt(this,"wrappedEmit",void 0),nt(this,"loadListener",void 0),nt(this,"pageHideListener",void 0),nt(this,"stylesheetManager",void 0),nt(this,"recordCrossOriginIframes",void 0),nt(this,"messageHandler",void 0),nt(this,"nestedIframeListeners",new Map),nt(this,"attachedWindows",new WeakMap),nt(this,"attachedDocuments",new WeakMap),nt(this,"attachedIframes",new Map),nt(this,"loadListenerDisposers",new WeakMap),nt(this,"iframeElementsById",new Map),nt(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Qe(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=>re(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{ie(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);re(()=>{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)})}re(()=>{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&&(ie(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(n)),t&&this.nestedIframeListeners.has(t)&&(ie(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=>{re(()=>this.mirror.removeNodeFromMap(t))}),re(()=>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&&ie(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{ie(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}},Ye=class{constructor(t){nt(this,"shadowDoms",new WeakSet),nt(this,"mutationCb",void 0),nt(this,"scrollCb",void 0),nt(this,"bypassOptions",void 0),nt(this,"mirror",void 0),nt(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(!st(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(n=null===(r=M.host(t))||void 0===r?void 0:r.ownerDocument)&&void 0!==n?n:e,{observer:o,buffer:a}=Pe(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=Le.indexOf(a);-1!==t&&Le.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:je(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(M.host(t))),this.restoreHandlers.push({doc:s,handler:qe({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const n=this;this.restoreHandlers.push({doc:e,handler:I(t.prototype,"attachShadow",function(t){return function(i){const r=t.call(this,i),s=M.shadowRoot(this);return s&&Ce(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}},Ke="skip-frame";function tn(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 en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),rn=0;64>rn;rn++)nn[en.charCodeAt(rn)]=rn;var sn=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;i>e;e+=3)r+=en[n[e]>>2],r+=en[(3&n[e])<<4|n[e+1]>>4],r+=en[(15&n[e+1])<<2|n[e+2]>>6],r+=en[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},on=!1,an=new Map,ln=(t,e,n)=>{if(!t||!hn(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=an.get(t);return n||(n=new Map,an.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 un(t,e,n,i){if(t instanceof Array)return t.map(t=>un(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:sn(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[un(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)?on||(on=!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:[un(t.data,e,n,i),t.width,t.height]}:hn(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ln(t,e,n)}:t}var cn=(t,e,n,i)=>t.map(t=>un(t,e,n,i)),hn=(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]))},dn=["webgl","webgl2"];function fn(t){return"nodeType"in t}function vn(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 I(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||fn(o)&&pe(o,e,n,!0))return r.call(this,s);fn(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=I(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(i,...s){const o=function(t){return"experimental-webgl"===t?"webgl":t}(i);if(!pe(this,e,n,!0)&&("__context"in this||(this.__context=o),r&&dn.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 pn(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=I(t,u,function(t){return function(...a){const l=t.apply(this,a);if(ln(l,s,this),this.canvas&&"tagName"in this.canvas&&!pe(this.canvas,i,r,!0)){let t;try{t=cn(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=ue(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!pe(this.canvas,i,r,!0)&&n(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var mn='(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',gn="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",mn],{type:"text/javascript;charset=utf-8"});function yn(t){let e;try{if(e=gn&&(self.URL||self.webkitURL).createObjectURL(gn),!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(mn),{name:null==t?void 0:t.name})}}var bn="A page CSP that omits blob: from worker-src or script-src blocks it";function wn(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var _n,kn,Sn,Cn=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){nt(this,"pendingCanvasMutations",new Map),nt(this,"rafStamps",{latestId:0,invokeId:null}),nt(this,"mirror",void 0),nt(this,"mutationCb",void 0),nt(this,"resetObservers",void 0),nt(this,"frozen",!1),nt(this,"locked",!1),nt(this,"rafIdTimestamp",null),nt(this,"rafIdFlush",null),nt(this,"refCount",0),nt(this,"torndown",!1),nt(this,"resetFrameDedup",null),nt(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 wn("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=vn(e,n,i,!0),u=new Map;let c;try{c=new yn}catch(t){return wn(`disabled because the encode worker did not start. ${bn}`,t),void l()}let d=!1;c.onerror=t=>{var e;d=!0,wn(`stopped because the encode worker failed. ${bn}`,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=>{pe(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 Ke}if(void 0===o)return;if(!Array.isArray(o)||!o.every(tn))return Ke;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,wn("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,wn("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=vn(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=I(e.CanvasRenderingContext2D.prototype,a,function(s){return function(...o){return pe(this.canvas,n,i,!0)||setTimeout(()=>{let n;try{n=cn(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=ue(e.CanvasRenderingContext2D.prototype,a,{set(e){pe(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(...pn(e.WebGLRenderingContext.prototype,h.WebGL,t,n,i,e,r)),void 0!==e.WebGL2RenderingContext&&s.push(...pn(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)}},In=class{constructor(t){var e;nt(this,"trackedLinkElements",new WeakSet),nt(this,"pendingDeferredSheets",new Set),nt(this,"mutationCb",void 0),nt(this,"adoptedStyleSheetCb",void 0),nt(this,"maskAllElementAttributes",void 0),nt(this,"maskAttributeFn",void 0),nt(this,"styleMirror",new ke),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=mt(i))}catch(t){}if(!n||!i)return K(),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=R(),u=O();let c=!0;try{if(s)return a=!0,K(),!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?(K(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(K(),!0)}finally{c&&this.pendingDeferredSheets.delete(o),E(h=R()-l,null!=(d=u)?d:A)||(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=R();try{J(()=>{try{const t=e.rules||e.cssRules;t&&Z(t)}catch(t){}i.push({styleId:n,rules:Array.from(e.rules||CSSRule,(t,n)=>({rule:ct(t,e.href),index:n}))})})}finally{Q(R()-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(),Zt.forEach(t=>t.abort()),Zt.clear()}trackStylesheetInLinkElement(t){}},Mn=class{constructor(){nt(this,"nodeMap",new WeakMap),nt(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(){}},Rn=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var An;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(An=t.contentWindow)||void 0===An?void 0:An.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var xn=new gt,Tn=new Set([l.Mutation,l.MediaInteraction,l.StyleSheetRule,l.CanvasMutation,l.Font,l.Log,l.StyleDeclaration,l.AdoptedStyleSheet]);function On(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 En(t={}){let e;const{emit:n,checkoutEveryNms:r,checkoutEveryNth:s,blockClass:o="rr-block",blockSelector:u=null,ignoreClass:c="rr-ignore",ignoreSelector:h=null,maskTextClass:d="rr-mask",maskTextSelector:f=null,inlineStylesheet:v=!0,inlineStylesheetBudgetRules:p,maskAllInputs:m,maskInputOptions:g,slimDOMOptions:y,maskInputFn:b,maskTextFn:w,maskAllElementAttributes:_=!1,maskAttributeFn:k,hooks:S,packFn:C,sampling:I={},dataURLOptions:R={},canvasResolutionScale:A,canvasMasking:x,mousemoveWait:O,recordDOM:E=!0,recordCanvas:F=!1,recordCrossOriginIframes:D=!1,recordAfter:L=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:N=!1,collectFonts:P=!1,inlineImages:j=!1,plugins:B,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:W=new Set([]),attributeFilter:U,errorHandler:H}=t;Fe(H);const V=i({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},R),Z=!D||window.parent===window;let J=!1;if(!Z)try{window.parent.document&&(J=!1)}catch(t){J=!0}if(Z&&!n)throw new Error("emit function is required");if(!Z&&!J)return()=>{};void 0!==O&&void 0===I.mousemove&&(I.mousemove=O),xn.reset();const Q=!0===m?{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!==g?g:{password:!0},X=te(void 0!==y&&y);let K;!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 et=0;const nt=new Map;let it,rt;const st=t=>{for(const e of B||[])e.eventProcessor&&(t=e.eventProcessor(t));return C&&!J&&(t=C(t)),t};_n=(t,e)=>{var i;const o=t;if(o.timestamp=ce(),!(null===(i=Le[0])||void 0===i?void 0:i.isFrozen())||o.type===a.FullSnapshot||o.type===a.IncrementalSnapshot&&Tn.has(o.data.source)||Le.forEach(t=>t.unfreeze()),Z)null==n||n(st(o),e);else if(J){const t={type:"rrweb",event:st(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===a.FullSnapshot)K=o,et=0;else if(o.type===a.IncrementalSnapshot){if(o.data.source===l.Mutation&&o.data.isAttachIframe)return;et++,(s&&et>=s||r&&o.timestamp-K.timestamp>r)&&kn(!0)}};const ot=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=xn.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&n.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const i=ct.getIframeElementById(t);i&&n.has(i)?ct.forgetIframeId(t):(null==it||it(t),ct.removeIframeById(t))}),null==rt||rt(),ct.cleanupDetachedIframes()}_n({type:a.IncrementalSnapshot,data:i({source:l.Mutation},t)})},at=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Scroll},t)}),lt=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.CanvasMutation},t)}),ut=new In({mutationCb:ot,adoptedStyleSheetCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.AdoptedStyleSheet},t)}),maskAllElementAttributes:_,maskAttributeFn:k}),ct=new Xe({mirror:xn,mutationCb:ot,stylesheetManager:ut,recordCrossOriginIframes:D,wrappedEmit:_n});for(const t of B||[])t.getMirror&&t.getMirror({nodeMirror:xn,crossOriginIframeMirror:ct.crossOriginIframeMirror,crossOriginIframeStyleMirror:ct.crossOriginIframeStyleMirror});const ht=new Mn,dt=null==x?void 0:x.configured;Sn=new Cn({recordCanvas:F,mutationCb:lt,win:window,blockClass:o,blockSelector:u,mirror:xn,sampling:I.canvas,dataURLOptions:V,resolutionScale:A,canvasMasking:x});const ft=new Ye({mutationCb:ot,scrollCb:at,bypassOptions:{blockClass:o,blockSelector:u,maskTextClass:d,maskTextSelector:f,inlineStylesheet:v,maskInputOptions:Q,dataURLOptions:V,maskTextFn:w,maskInputFn:b,maskAllElementAttributes:_,maskAttributeFn:k,recordCanvas:F,canvasMaskingConfigured:dt,inlineImages:j,sampling:I,slimDOMOptions:X,iframeManager:ct,stylesheetManager:ut,canvasManager:Sn,keepIframeSrcFn:z,processedNodeManager:ht,attributeFilter:U},mirror:xn});kn=(t=!1)=>{if(E){q(p);try{_n({type:a.Meta,data:{href:window.location.href,width:fe(),height:de()}},t),null==e||e.cancel(),e=void 0,ut.reset(),ft.init(),Le.forEach(t=>t.lock());let n=null,i=[];try{n=function(t,e){const{mirror:n=new gt,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:_,onIframeListenerRegistered:k,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=te(m);q(R);try{return Kt(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:_,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:I,newlyAddedElement:!1,maxDepth:M})}finally{G()}}(document,{mirror:xn,blockClass:o,blockSelector:u,maskTextClass:d,maskTextSelector:f,inlineStylesheet:v,maskAllInputs:Q,inlineStylesheetBudgetRules:p,maskTextFn:w,maskInputFn:b,maskAllElementAttributes:_,maskAttributeFn:k,slimDOM:X,dataURLOptions:V,recordCanvas:F,canvasMaskingConfigured:dt,inlineImages:j,onSerialize(t){be(t,xn)&&ct.addIframe(t),we(t,xn)&&ut.trackLinkElement(t),_e(t)&&ft.addShadowRoot(M.shadowRoot(t),document)},onIframeLoad(t,e){ct.attachIframe(t,e),ft.observeAttachShadow(t)},onIframeListenerRegistered(t,e){ct.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){ut.attachLinkElement(t,e)},keepIframeSrcFn:z})}finally{i=Y()}if(!n)return console.warn("Failed to snapshot the document");if(_n({type:a.FullSnapshot,data:{node:n,initialOffset:he(window)}},t),Le.forEach(t=>t.unlock()),Sn.onFullSnapshot(),i.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&&re(()=>{o=e.beginDeferredLinkInlining(n,xn.getId(n))})},u=()=>{if(!o)return;const t=o;let e=!0;re(()=>{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,tt(1)}e+=1}while(!i&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));i||(a()?r=On(h):n())};return r=On(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);tt(e),null==o||o.discard(),o=null}n()}}}(i,ut,()=>{e===t&&(e=void 0)});e=t}D&&ct.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ut.adoptStyleSheets(document.adoptedStyleSheets,xn.getId(document))}finally{G()}}};try{const t=[];t.push(ne("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(ne(e,T,document));it=e=>{const n=nt.get(e);n&&(n.forEach(e=>{re(e);const n=t.indexOf(e);-1!==n&&t.splice(n,1)}),nt.delete(e))},rt=()=>{for(const[t]of nt){const e=xn.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==it||it(t)}catch(e){null==it||it(t)}else null==it||it(t)}};const n=t=>{var e;return De(Ve)({mutationCb:ot,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:at,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:lt,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:o,ignoreClass:c,ignoreSelector:h,maskTextClass:d,maskTextSelector:f,maskInputOptions:Q,inlineStylesheet:v,sampling:I,recordDOM:E,recordCanvas:F,canvasMaskingConfigured:dt,inlineImages:j,userTriggeredOnInput:N,collectFonts:P,doc:t,maskInputFn:b,maskTextFn:w,maskAllElementAttributes:_,maskAttributeFn:k,keepIframeSrcFn:z,blockSelector:u,slimDOMOptions:X,dataURLOptions:V,mirror:xn,iframeManager:ct,stylesheetManager:ut,shadowDomManager:ft,processedNodeManager:ht,canvasManager:Sn,ignoreCSSAttributes:W,attributeFilter:U,plugins:(null==B||null===(e=B.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}})})))||[]},S)};ct.addLoadListener(e=>{try{const i=xn.getId(e),r=n(e.contentDocument);if("function"==typeof r&&(t.push(r),-1!==i)){let t=nt.get(i);t||(t=new Set,nt.set(i,t)),t.add(r)}}catch(t){console.warn(t)}}),ct.addPageHideListener(t=>{const e=xn.getId(t);null==it||it(e),Be(t)});let r=-1;const s=t=>_n({type:a.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),p=()=>{var t,e,n,i;const o=document,a=null!==(t=null!==(e=null!==(n=null!==(i=o.fullscreenElement)&&void 0!==i?i:o.webkitFullscreenElement)&&void 0!==n?n:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,l=a?xn.getId(a):-1;l!==r&&(-1!==r&&s({id:r,enter:!1}),r=l,-1!==l&&s({id:l,enter:!0}))},m=()=>{kn();const e=n(document);"function"==typeof e&&t.push(e),t.push(ne("fullscreenchange",p)),t.push(ne("webkitfullscreenchange",p)),t.push(ne("mozfullscreenchange",p)),t.push(ne("MSFullscreenChange",p)),Rn=!0};return["interactive","complete"].includes(document.readyState)?m():(t.push(ne("DOMContentLoaded",()=>{_n({type:a.DomContentLoaded,data:{}}),"DOMContentLoaded"===L&&m()})),t.push(ne("load",()=>{_n({type:a.Load,data:{}}),"load"===L&&m()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,se(t),ht.destroy(),ct.removeLoadListener(),ct.destroy(),nt.clear(),ft.reset(),xn.reset(),Rn=!1,$e()}}catch(t){console.warn(t)}}En.addCustomEvent=(t,e)=>{if(!Rn)throw new Error("please add custom event after start recording");_n({type:a.Custom,data:{tag:t,payload:e}})},En.freezePage=()=>{Le.forEach(t=>t.freeze())},En.takeFullSnapshot=t=>{if(!Rn)throw new Error("please take full snapshot after start recording");kn(t)},En.mirror=xn,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Fn=Object.create(null);function $n(t){return $n="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},$n(t)}function Dn(t,e,n){return(e=function(t){var e=function(t){if("object"!=$n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$n(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Fn.Node=Object.create(null),Fn.ShadowRoot=Object.create(null),Fn.MutationObserver=Object.create(null),Fn.Element=Object.create(null);var Ln=class{constructor(t){Dn(this,"fileName",void 0),Dn(this,"functionName",void 0),Dn(this,"lineNumber",void 0),Dn(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}`}},Nn=/(^|@)\S+:\d+/,Pn=/^\s*at .*(\S+:\d+|\(native\))/m,jn=/^(eval@)?(\[native code])?$/,Bn={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Pn)?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(Pn)},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 Ln({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(jn)},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 Ln({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(t.replace(e,""));return new Ln({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 Ln({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 Ln({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(Nn)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),n=this.extractLocation(e.pop());return new Ln({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function zn(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 Wn(t){return Array.isArray(t)}function Un(t){return"object"==typeof t&&null!==t&&!Wn(t)}function Hn(t,e){if(0===e)return!0;const n=Object.keys(t);for(const i of n)if(Un(t[i])&&Hn(t[i],e-1))return!0;return!1}function qn(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(Un(s=e)&&Object.keys(s).length>n.numOfKeysLimit||"function"==typeof s||Un(s)&&Hn(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]=Wn(i)?zn(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 Gn={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 Vn(t,e,n){const i=n?Object.assign({},Gn,n):Gn,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:Bn.parse(e.error).map(t=>t.toString()),payload:[qn(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=[qn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[qn("Uncaught (in promise)",i.stringifyOptions),qn(e.reason,i.stringifyOptions)]),t({level:"error",trace:Bn.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=Bn.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===n?s.slice(1):s).map(t=>qn(t,i.stringifyOptions));o++,i.lengthThreshold>o?t({level:n,trace:e,payload:r}):o===i.lengthThreshold&&t({level:"warn",trace:[],payload:[qn("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 Zn="u">typeof window?window:void 0,Jn="u">typeof globalThis?globalThis:Zn,Qn=null==Jn?void 0:Jn.document,Xn=null==Jn?void 0:Jn.location;null!=Jn&&Jn.XMLHttpRequest&&new Jn.XMLHttpRequest;const Yn="undefined"!=typeof globalThis?globalThis:Zn;Yn&&"undefined"==typeof self&&(Yn.self=Yn),Yn&&"undefined"==typeof File&&(Yn.File=function(){});const Kn=null!=Zn?Zn:{},ti=Object.prototype,ei=ti.hasOwnProperty,ni=ti.toString,ii=Array.isArray||function(t){return"[object Array]"===ni.call(t)},ri=t=>"function"==typeof t,si=t=>t===Object(t)&&!ii(t),oi=t=>void 0===t,ai=t=>"[object String]"==ni.call(t),li=t=>null===t,ui=t=>oi(t)||li(t),ci=t=>"[object Number]"==ni.call(t)&&t==t,hi=t=>"[object Boolean]"===ni.call(t),di=t=>t instanceof FormData;function fi(t,e,n,i,r){return e>n&&(i.warn("min cannot be greater than max."),e=n),ci(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),fi(null!=r?r:n,e,n,i))}var vi=class{constructor(t){this.C={},this.I=t.I,this.R=fi(t.bucketSize,0,100,t.$),this.A=fi(t.refillRate,0,this.R,t.$),this.O=fi(t.refillInterval,0,864e5,t.$)}F(t,e){const n=Math.floor((e-t.lastAccess)/this.O);n>0&&(t.tokens=Math.min(t.tokens+n*this.A,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 pi(t){return t?t.split("#")[0]:t}const mi="NativeGzipValidationError";let gi;const yi=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}(mi,`Native gzip produced invalid output: ${t}`)},bi=(wi=s(function*(t,e){18>t.size&&yi("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])&&yi("invalid-header");const r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{const e=(()=>{if(gi)return gi;gi=[];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;gi[t]=e>>>0}return gi})();let n=4294967295;for(let i=0;t.length>i;i++)n=e[255&(n^t[i])]^n>>>8;return(4294967295^n)>>>0})(e)&&yi("invalid-crc");const s=e.length>>>0;r.getUint32(4,!0)!==s&&yi("invalid-size")}),function(t,e){return wi.apply(this,arguments)});var wi;function _i(){return _i=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 bi(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}),_i.apply(this,arguments)}const ki="0.9.0",Si={DEBUG:!1,LIB_VERSION:ki,LIB_NAME:"browser-common",JS_SDK_VERSION:ki},Ci=(t,{debugEnabled:e}={})=>{const n={N(n,...i){Zn&&(Si.DEBUG||Zn.POSTHOG_DEBUG||e)&&!oi(Zn.console)&&Zn.console&&("__rrweb_original__"in Zn.console[n]?Zn.console[n].__rrweb_original__:Zn.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)=>Ci(`${t} ${e}`,n)};return n},Ii=Ci("[PostHog.js]"),Mi=Ii.createLogger;function Ri(t,e){if(!ui(t))if(ii(t))t.forEach(e);else if(di(t))t.forEach((t,n)=>e(t,n));else for(const n in t)ei.call(t,n)&&e(t[n],n)}function Ai(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 xi=["localhost","127.0.0.1"],Ti=t=>{const e=null==Qn?void 0:Qn.createElement("a");return oi(e)?null:(e.href=t,e)},Oi=()=>{},Ei=t=>{var e;if(ri(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Fi(t,e,n){try{if(!(e in t))return Oi;const i={next:t[e]},r=n(function(...t){return i.next.apply(this,t)});return ri(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=Ei(n);for(;s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=Ei(n)}}}catch(t){return Oi}}function $i(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 Di(t){var e;const n=null==Zn||null===(e=Zn.location)||void 0===e?void 0:e.href;return oi(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(!ri(i))return e;try{const t=i(e);return ai(t)&&t?t:e}catch(t){return Ii.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,n)}const Li=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}))$"),Ni=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Pi=[16,15,14,13],ji=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Bi=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),zi=/[0-9A-Za-z_]/;function Wi(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 Ui=1e6;function Hi(t){var e;return Math.min(Ui,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Ui)}const qi={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:Ui,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},Gi=["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"],Vi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Zi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Ji=t=>{ui(t)||Ri(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Gi.includes(e)||Zi.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Qi=["/s/","/e/","/i/"];function Xi(t,e,n,i){if(ui(t))return t;let r=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ai(r)&&(r=parseInt(r)),r>n?`[SessionRecording] ${i} body too large to record (${r} bytes)`:t}function Yi(t,e){if(ui(t))return t;let n=t;return function(t,e=!0){if(ui(t))return!1;if(ai(t)){if(t=t.trim(),e?Li.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Ni.lastIndex=0;e=Ni.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 Pi){const i=t+e;if(n.length>=i){const e=n.slice(t,i);if(Li.test(e)&&Wi(e))return!0}}}return!1}(t))return!1;if(e?ji.test(t):function(t){let e;for(Bi.lastIndex=0;e=Bi.exec(t);){const t=e[1],n=e[3];if(!(t&&n&&zi.test(t)&&zi.test(n)))return!0}return!1}(t))return!1}return!0}(n,!1)||(n="[SessionRecording] "+e+" body redacted"),Ri(Vi,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 Ki=new WeakSet,tr=Mi("[Recorder]"),er=t=>"navigation"===t.entryType,nr=t=>"resource"===t.entryType,ir=()=>{};function rr(t,e){var n;return er(e)&&"complete"===(null===(n=t.document)||void 0===n?void 0:n.readyState)&&e.loadEventEnd>0}function sr(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(n=>rr(t,n)||nr(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=>rr(t,e))}(t):[]}function or(t,e){return!!e&&(hi(e)||e[t])}function ar(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 lr=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function ur({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:!!ar(e)&&t(e.url)}catch(t){return!1}}(i))return!1;if(r(lr))return!1;if(hi(e))return!0;if(ii(e))return r(e);const s=e[t];return hi(s)?s:r(s)}function cr(t,e,n,i,r){return hr.apply(this,arguments)}function hr(){return hr=s(function*(t,e,n,i,r,s=0){if(s>10)return tr.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=>nr(t)&&t.initiatorType===e&&(oi(i)||t.startTime>=i)&&(oi(r)||r>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*s)),cr(t,e,n,i,r,s+1))}),hr.apply(this,arguments)}function dr({body:t,options:e,url:n}){if(ui(t))return null;const{hostname:i,isHostDenied:r}=$i(n,e);if(r)return i+" is in deny list";if(ai(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(di(t))return function(t,e="&"){let n,i;const r=[];return Ri(t,function(t,e){oi(t)||oi(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(si(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 fr=t=>!li(t)&&("navigation"===t.entryType||"resource"===t.entryType);function vr(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?e.toJSON():{name:u}),{},{startTime:oi(a)?void 0:Math.round(a),endTime:oi(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(fr(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 pr=["video/","audio/"];function mr(t){return si(t)&&ri(t.getReader)&&ri(t.tee)}const gr="[SessionReplay] Timeout while trying to read body",yr="[SessionReplay] Failed to read body";function br(t){return`${yr}: ${t}`}function wr(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function _r(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const n=setTimeout(()=>e(gr),500);try{t.clone().text().then(t=>e(t),t=>e(br(t))).finally(()=>clearTimeout(n))}catch(t){clearTimeout(n),e(yr)}})}(t);const n=Hi(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(wr(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(gr),500);let l;try{l=t.clone()}catch(t){return void o(yr)}const u=l.body;if(!mr(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(br(t)))}catch(t){o(yr)}return}try{i=u.getReader()}catch(t){return void o(yr)}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(wr(e));h+=i.byteLength,c.push(i)}t()}},t=>o(br(t)))}()})}(t,n)}function kr(){return(kr=s(function*({r:t,options:e,url:n}){const{hostname:i,isHostDenied:r}=$i(n,e);return r?Promise.resolve(i+" is in deny list"):_r(t,e)})).apply(this,arguments)}function Sr(){return(Sr=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=pr.some(t=>null==r?void 0:r.startsWith(t));if(r&&s)return`Content-Type ${r} is not supported`;const{hostname:o,isHostDenied:a}=$i(n,e);return a?o+" is in deny list":null}({r:t,options:e,url:n});return li(i)?_r(t,e):Promise.resolve(i)})).apply(this,arguments)}let Cr=null;function Ir(t,e,n){if(!("performance"in e))return()=>{};if(Cr)return tr.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},qi,n):qi;let o=!0;const a=e=>{if(!o)return;const n=[];let s=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&s)return;const i=r.maskRequestFn(t);e||(s=!i||(t=>!!t&&Ki.has(t))(i)),i&&n.push(i)}),n.length>0&&t(i(i({},e),{},{requests:n}))},l=function(t,e,n){try{t({requests:sr(e,n).flatMap(t=>vr(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){tr.error("Failed to capture initial performance entries for network capture",t)}const i=e.PerformanceObserver,r=null==i?void 0:i.supportedEntryTypes;if(!i||!ii(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=>er(t)||nr(t)&&n.initiatorTypes.includes(t.initiatorType)&&(t=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>vr(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:s}),()=>{o.disconnect()}}(a,e,r),u=r.recordHeaders||r.recordBody;if(!l&&!u)return o=!1,ir;let c=()=>{},h=()=>{};return u&&(c=function(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=or("request",n.recordHeaders),r=or("response",n.recordHeaders),s=Fi(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=>(ur({type:"request",headers:d,url:a,recordBody:n.recordBody})&&(l.requestBody=dr({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),ur({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(l.responseBody=dr({body:h.response,options:n,url:a})),cr(e,"xmlhttprequest",s.url,u,c).then(n=>{t({requests:vr(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){tr.error("Failed to instrument XHR for network capture",t)}s.call(h,o,a.toString(),l,u,c)});return()=>{s()}}(a,e,r),h=function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=or("request",n.recordHeaders),r=or("response",n.recordHeaders),o=Fi(e,"fetch",o=>function(){var a=s(function*(s,a){let l,u;try{l=new Request(s,a)}catch(t){return tr.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),!mr(null==a?void 0:a.body)&&ur({type:"request",headers:t,url:s,recordBody:n.recordBody})&&(c.requestBody=yield function(t){return kr.apply(this,arguments)}({r:l,options:n,url:s}))}catch(t){tr.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=ar(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),ur({type:"response",headers:t,url:s,recordBody:n.recordBody})&&(c.responseBody=yield function(t){return Sr.apply(this,arguments)}({r:u,options:n,url:s}))}catch(t){tr.error("Failed to record fetch response for network capture",t)}return u}finally{cr(e,"fetch",l.url,h,d).then(n=>{t({requests:vr(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()}}(a,e,r)),Cr=()=>{o=!1,null==l||l(),c(),h(),Cr=null},Cr}const Mr="$replay_override_sampling",Rr="$replay_override_linked_flag",Ar="$replay_override_url_trigger",xr="$replay_override_event_trigger",Tr="$session_is_sampled",Or="$session_recording_url_trigger_activated_session",Er="$session_recording_event_trigger_activated_session",Fr="$posthog_sr_group_event_trigger_",$r="$posthog_sr_group_url_trigger_",Dr="$sess_rec_flush_size",Lr="$stored_person_properties",Nr="$sdk_debug_replay_event_trigger_status",Pr="$sdk_debug_replay_linked_flag_trigger_status",jr="$sdk_debug_replay_matched_recording_trigger_groups",Br="$sdk_debug_replay_pending_trigger_conditions",zr="$sdk_debug_replay_remote_trigger_matching_config",Wr="$sdk_debug_replay_trigger_groups_count",Ur="$sdk_debug_replay_url_trigger_status",Hr="$sdk_debug_rrweb_attached",qr="$sdk_debug_rrweb_start_attempted",Gr="$session_recording_start_reason",Vr="disabled",Zr="sampled",Jr="active",Qr="buffering",Xr="paused",Yr="rrweb_error",Kr="trigger_activated",ts="trigger_pending",es="trigger_disabled";function ns(t,e,n,i,r,s){return 0===e?es:(null==t?void 0:t.get_property(n?i+n:r))===s?Kr:ts}function is(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 rs(t){return t.includes("trigger_activated")?Kr:t.includes("trigger_pending")?ts:es}function ss(t){const e=new Set(t);switch(e.delete(es),e.size){case 0:return es;case 1:return Array.from(e)[0];default:return ts}}var os=class{constructor(t){this.q=t}triggerStatus(t){return rs(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return rs(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},as=class{constructor(t){this.q=t}triggerStatus(t){return ss(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return ss(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},ls=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return Kr}stop(){}};const us=t=>"sessionRecording"in t;var cs=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=(us(t)?si(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(us(t)?si(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){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){Ii.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){Ii.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return ns(this._instance,this.j.length,this.V,$r,Or,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Ur]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=Di(this._instance);if(!t)return!1;try{return is(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const n=Di(this._instance);if(!n)return;if(n===this.W)return;this.W=n;const i=this.urlBlocked,r=is(n,this.B,this.U);i&&r||(r&&!i?t():!r&&i&&e())}checkUrlTriggerConditions(t,e,n,i){const r=Di(this._instance);if(!r)return;if(r===this.W)return;this.W=r;const s=this.urlBlocked,o=is(r,this.B,this.U);o&&!s?t():!o&&s&&e();const a=this.G(i)===Kr,l=is(r,this.j,this.H);!a&&l&&n("url",r)}stop(){this.W=""}},hs=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({[Pr]:t}),t}triggerStatusNoSideEffects(){let t=ts;return ui(this.linkedFlag)&&(t=es),this.linkedFlagSeen&&(t=Kr),t}onConfig(t,e){var n;if(this.linkedFlag=(us(t)?si(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!ui(this.linkedFlag)&&!this.linkedFlagSeen){const t=ai(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ai(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((i,r)=>{let s=!1;if(si(r)&&t in r){const e=r[t];s=hi(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()}},ds=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(us(t)?si(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 ns(this._instance,this.K.length,this.V,Fr,Er,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Nr]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,n){if(0===this.K.length)return;const i=this.X(n)===Kr,r=this.K.includes(t);!i&&r&&e("event",t)}stop(){}},fs=class{constructor(t,e,n){if(this._instance=t,this.group=e,this.Y=new cs(t,e.id),this.tt=new ds(t,e.id),this.et=new hs(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 os(r):new as(r)}else this.nt=new ls}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===ts).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?$r+this.group.id:Fr+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 vs(t){if(t.rrwebError)return Yr;if(!t.receivedFlags)return Qr;if(!t.isRecordingEnabled)return Vr;if(t.urlTriggerMatching.urlBlocked)return Xr;const e=!0===t.isSampled,n=new os([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Zr:"trigger_activated"===n?Jr:"trigger_pending"===n?Qr:!1===t.isSampled?Vr:Jr}function ps(t){if(t.rrwebError)return Yr;if(!t.receivedFlags)return Qr;if(!t.isRecordingEnabled)return Vr;if(t.urlTriggerMatching.urlBlocked)return Xr;const e=new as([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==es,i=hi(t.isSampled);return n&&"trigger_pending"===e?Qr:n&&"trigger_disabled"===e||i&&!t.isSampled?Vr:!0===t.isSampled?Zr:Jr}function ms(){const t=[];return function(e,n){if(si(n)||ii(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n}}function gs(t){try{const e=JSON.stringify(t,ms());return e?new Blob([e]).size:0}catch(t){return-1}}function ys(t){if(li(t))return 4;if(oi(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(ii(t)){let e=2;for(let n=0;t.length>n;n++){n>0&&(e+=1);const i=t[n];e+=oi(i)||li(i)?4:ys(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];oi(r)||(i||(n+=1),i=!1,n+=t.length+3+ys(r))}return n}default:return 0}}function bs(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[bs({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:n,sessionId:t.sessionId,windowId:t.windowId}),bs({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 ws=Uint8Array,_s=Uint16Array,ks=Uint32Array,Ss=new ws([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]),Cs=new ws([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]),Is=new ws([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ms=function(t,e){for(var n=new _s(31),i=0;31>i;++i)n[i]=e+=1<<t[i-1];var r=new ks(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]},Rs=Ms(Ss,2),As=Rs[1];Rs[0][28]=258,As[258]=28;for(var xs=Ms(Cs,0)[1],Ts=new _s(32768),Os=0;32768>Os;++Os){var Es=(43690&Os)>>>1|(21845&Os)<<1;Ts[Os]=((65280&(Es=(61680&(Es=(52428&Es)>>>2|(13107&Es)<<2))>>>4|(3855&Es)<<4))>>>8|(255&Es)<<8)>>>1}var Fs=function(t,e,n){for(var i=t.length,r=0,s=new _s(e);i>r;++r)++s[t[r]-1];var o,a=new _s(e);for(r=0;e>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new _s(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[Ts[h]>>>l]=u}else for(o=new _s(i),r=0;i>r;++r)o[r]=Ts[a[t[r]-1]++]>>>15-t[r];return o},$s=new ws(288);for(Os=0;144>Os;++Os)$s[Os]=8;for(Os=144;256>Os;++Os)$s[Os]=9;for(Os=256;280>Os;++Os)$s[Os]=7;for(Os=280;288>Os;++Os)$s[Os]=8;var Ds=new ws(32);for(Os=0;32>Os;++Os)Ds[Os]=5;var Ls=Fs($s,9,0),Ns=Fs(Ds,5,0),Ps=function(t){return(t/8|0)+(7&t&&1)},js=function(t,e,n){(null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof _s?_s:t instanceof ks?ks:ws)(n-e);return i.set(t.subarray(e,n)),i},Bs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8},zs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8,t[i+2]|=n>>>16},Ws=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 ws(0),0];if(1==r){var o=new ws(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 _s(d+1),v=Us(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 ws(f),v]},Us=function(t,e,n){return-1==t.s?Math.max(Us(t.l,e,n+1),Us(t.r,e,n+1)):e[t.s]=n},Hs=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new _s(++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]},qs=function(t,e){for(var n=0,i=0;e.length>i;++i)n+=t[i]*e[i];return n},Gs=function(t,e,n){var i=n.length,r=Ps(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)},Vs=function(t,e,n,i,r,s,o,a,l,u,c){Bs(e,c++,n),++r[256];for(var h=Ws(r,15),d=h[0],f=h[1],v=Ws(s,15),p=v[0],m=v[1],g=Hs(d),y=g[0],b=g[1],w=Hs(p),_=w[0],k=w[1],S=new _s(19),C=0;y.length>C;++C)S[31&y[C]]++;for(C=0;_.length>C;++C)S[31&_[C]]++;for(var I=Ws(S,7),M=I[0],R=I[1],A=19;A>4&&!M[Is[A-1]];--A);var x,T,O,E,F=u+5<<3,D=qs(r,$s)+qs(s,Ds)+o,L=qs(r,d)+qs(s,p)+o+14+3*A+qs(S,M)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return Gs(e,c,t.subarray(l,l+u));if(Bs(e,c,1+(D>L)),c+=2,D>L){x=Fs(d,f,0),T=d,O=Fs(p,m,0),E=p;var N=Fs(M,R,0);for(Bs(e,c,b-257),Bs(e,c+5,k-1),Bs(e,c+10,A-4),c+=14,C=0;A>C;++C)Bs(e,c+3*C,M[Is[C]]);c+=3*A;for(var P=[y,_],j=0;2>j;++j){var B=P[j];for(C=0;B.length>C;++C)Bs(e,c,N[z=31&B[C]]),c+=M[z],z>15&&(Bs(e,c,B[C]>>>5&127),c+=B[C]>>>12)}}else x=Ls,T=$s,O=Ns,E=Ds;for(C=0;a>C;++C)if(i[C]>255){var z;zs(e,c,x[257+(z=i[C]>>>18&31)]),c+=T[z+257],z>7&&(Bs(e,c,i[C]>>>23&31),c+=Ss[z]);var W=31&i[C];zs(e,c,O[W]),c+=E[W],W>3&&(zs(e,c,i[C]>>>5&8191),c+=Cs[W])}else zs(e,c,x[i[C]]),c+=T[i[C]];return zs(e,c,x[256]),c+T[256]},Zs=new ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Js=new ws(0),Qs=function(){for(var t=new ks(256),e=0;256>e;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Xs=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function Ys(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=Qs[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 ws(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=Gs(l,u,t.subarray(c,h)):(l[c]=s,u=Gs(l,u,t.subarray(c,o)))}else{for(var d=Zs[e-1],f=d>>>13,v=8191&d,p=(1<<n)-1,m=new _s(32768),g=new _s(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},_=new ks(25e3),k=new _s(288),S=new _s(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=Vs(t,l,0,_,k,S,I,M,A,c-A,u),M=C=I=0,A=c;for(var F=0;286>F;++F)k[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,B=Math.min(32767,c),z=Math.min(258,E);B>=P&&--N&&T!=O;){if(t[c+D]==t[c+D-P]){for(var W=0;z>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),H=0;for(F=0;U>F;++F){var q=c-P+F+32768&32767,G=q-m[q]+32768&32767;G>H&&(H=G,O=q)}}}P+=(T=O)-(O=m[T])+32768&32767}if(L){_[M++]=268435456|As[D]<<18|xs[L];var V=31&As[D],Z=31&xs[L];I+=Ss[V]+Cs[Z],++k[257+V],++S[Z],R=c+D,++C}else _[M++]=t[c],++k[t[c]]}}u=Vs(t,l,s,_,k,S,I,M,A,c-A,u),s||(u=Gs(l,u,Js))}return js(a,0,i+Ps(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&&Xs(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),Xs(c,h-8,n.d()),Xs(c,h-4,i),c}function Ks(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 to=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=ys(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 vi({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,$:Ii}),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=ci(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 ci(t)&&isFinite(t)&&Math.floor(t)===t}),Zn&&!oi(Zn.crypto)&&crypto;let eo=null;const no={Et(){if(!li(eo))return eo;if(eo=!0,oi(Zn))eo=!1;else try{const t="__support__";no.At(t,"xyz"),'"xyz"'!==no.Ot(t)&&(eo=!1),no.Lt(t)}catch(t){eo=!1}return eo},Pt(t){Ii.error("sessionStorage error: ",t)},Ot(t){try{return null==Zn?void 0:Zn.sessionStorage.getItem(t)}catch(t){no.Pt(t)}return null},Dt(t){try{return JSON.parse(no.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==Zn||Zn.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){no.Pt(t)}return!1},Lt(t){try{null==Zn||Zn.sessionStorage.removeItem(t)}catch(t){no.Pt(t)}}};Si.DEBUG=!1,Si.LIB_VERSION="1.434.11",Si.LIB_NAME="web";var io=Si,ro=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(Dr,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(Dr);return si(n=e)&&ai(n.sessionId)&&ci(n.size)&&e.sessionId===t?e.size:0;var n}};function so(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<fi(100*e,0,100,Ii)}const oo=(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}},ao=t=>t.toLowerCase(),lo={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=>oo(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!oo(e,t))),icontains:(t,e)=>e.map(ao).some(e=>t.map(ao).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(ao).every(e=>t.map(ao).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))})},uo=new Set(["is_not","not_icontains","not_regex"]);function co(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(oi(r)||li(r))return uo.has(s);const o=lo[s];return!!o&&!oi(t.value)&&!li(t.value)&&o(ii(t.value)?t.value.map(String):[String(t.value)],ii(r)?r.map(String):[String(r)])})}const ho=Mi("[SessionRecording]");function fo(t,e){return e?t:"!"+t}function vo(t,e){return t===e||t!=="!"+e&&null}var po=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.Ht=null,this.zt=ps}onRemoteConfig(t){this.Ht=ci(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new os([this.tt,this.Y]),this.zt=vs):(this.Ut=new as([this.tt,this.Y]),this.zt=ps),this._instance.register_for_session({[zr]: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.zt({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 ci(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&&ui(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,n,e)}catch(t){ho.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const n=this.Ht;var i,r;if(!ci(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(Tr),o=this._instance.get_property("$replay_sample_rate"),a=vo(s,t),l=ci(o)&&o!==n,u=oi(o)&&s===t,c=l||u||!hi(a),h=c?so(t,n):a;c&&(h?this.qt("sampled"):ho.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:fo(t,h),$replay_sample_rate:li(o)&&s===t?null:n})}ensureSamplingDecision(t){if(!ci(this.Ht))return;const e=this._instance.get_property(Tr);hi(vo(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))===ts}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===ts).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()}},mo=class{constructor(t,e,n,i,r){this._instance=t,this.Y=e,this.qt=n,this.Vt=i,this.Bt=r,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[zr]:"v2_trigger_groups",[Wr]:t.triggerGroups.length}),this.Y.onConfig(t)):ho.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Yr;if(!t.receivedFlags)return Qr;if(!t.isRecordingEnabled)return Vr;if(t.urlTriggerMatching.urlBlocked)return Xr;const e=t.triggerGroupMatchers,n=t.triggerGroupSamplingResults;if(0===e.length)return Vr;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);oi(e)?Ii.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(r=!0)}else"trigger_pending"===e&&(i=!0)}return r?Zr:i?Qr:Vr}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const n of this.Zt)if("trigger_activated"===n.triggerStatus(t)){const t=n.group.minDurationMs;ci(t)&&(li(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,n,i){this.Y.checkUrlBlocklist(e,n);for(const i of this.Zt)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.Qt)return ho.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.Zt)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(Lr);r.some(e=>!e.properties||0===e.properties.length||co(e.properties,t.properties,s))&&(n.activateTrigger(i,e),this.updateActiveTriggers(e),this.Bt(i))},e)}catch(t){ho.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const n of this.Zt){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(si(a)){const e=a.sessionId,n=a.sampleRate,i=a.sampled;u="string"==typeof e&&e!==t,c=ci(n)&&n!==s,l=e===t&&ci(n)&&n===s&&hi(i)?i:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!hi(l),f=d?so(t+r,s):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:r,group_name:i.name,sampleRate:s,isSampled:f}),this.Gt.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.Qt=!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.Zt){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.Zt){const i=n.group,r=i.id,s="trigger_activated"===n.triggerStatus(t),o=!0===this.Gt.get(r);s&&e.push({id:r,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[jr]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.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.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const n=t.group.conditions.properties;return!n||0===n.length||co(n,e,this._instance.get_property(Lr))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new fs(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.Zt.push(t)}}};const go=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],yo=1e5,bo=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,wo=[],_o=()=>!1,ko="@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(" "),So="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Co="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(" "),Io="Accommodation AdministrativeArea Country Place State".split(" "),Mo={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:So,publisher:Co},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:wo},Offer:{seller:Co},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:Co,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Co,areaServed:Io,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:wo}},Ro=[["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(" "),Mo.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Mo.Event],[Co,Mo.Organization],[Io,Mo.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Mo.Product]];function Ao(t,e){return ei.call(t,e)?t[e]:void 0}function xo(t){const e=typeof t;return li(t)||"string"===e||"number"===e||"boolean"===e}function To(t,e){return e&&function(t){return ai(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Oo(t,e){return ii(t)&&t.every(xo)?t.map(t=>To(t,e)).filter(t=>!oi(t)):xo(t)?To(t,e):void 0}function Eo(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 Fo(t){if(ei.call(Mo,t))return Mo[t];for(const[e,n]of Ro)if(e.includes(t))return n}function $o(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Do(t,e,n,i){if(ii(t)){const r=t.map(t=>Do(t,e,n,i)).filter(t=>!oi(t));return r.length?r:void 0}return Lo(t,e,n,i)||void 0}function Lo(t,e,n,i){if(!si(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(n))return null;const r=Ao(t,"@type"),s=function(t){const e=new Set,n="string"==typeof t?[t]:ii(t)?t:[],i=[];for(const t of n){if("string"!=typeof t)continue;const n=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&bo.test(n)&&!e.has(n)&&(e.add(n),i.push(n),20===i.length))break}return i}(r),o=s.filter(t=>!!Fo(t)&&(!i||!i.length||i.includes(t))),a={};for(const i of ko){const o="@type"===i?s.length?"string"==typeof r?s[0]:s:void 0:"@id"===i?Eo(Ao(t,i),e):Oo(Ao(t,i),n.maskUrl);oi(o)||$o(a,i,o)}for(const i of o){const r=Fo(i);for(const i of Object.keys(r)){const s=Ao(t,i),o=r[i];if(!0===o){const t=Oo(s,n.maskUrl);oi(t)||$o(a,i,t)}else{const t=Do(s,e,n,o);oi(t)||$o(a,i,t)}}}const l=Do(Ao(t,"@graph"),e,n);return oi(l)||$o(a,"@graph",l),Object.keys(a).length?a:null}function No(t,e,n){if(!si(t))return null;const r=Ao(t,"@context");if("string"!=typeof r||!/^https?:\/\/schema\.org\/?$/.test(r))return null;const s=Lo(t,e,n);return s?i({"@context":"https://schema.org"},s):null}function Po(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function jo(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 Bo(t,e,n){for(let i=t;i;){if(jo(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 zo(t){return Po(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Po)}function Wo(t){return oi(t)?void 0:Math.round(t)}function Uo(t){return si(t)?t.network_timing:t}const Ho=Mi("[SessionRecording]"),qo=[1,2,3,4,5,6,7,12],Go=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Vo(){var t;return null==Kn||null===(t=Kn.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function Zo(){var t;return null===(t=Vo())||void 0===t?void 0:t.record}function Jo(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,ms())}}function Qo(t){return Ks(Ys(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new ws(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 ws(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 js(n,0,i)}(Jo(t))),!0)}function Xo(t){return Yo.apply(this,arguments)}function Yo(){return Yo=s(function*(t){const e=yield function(t){return _i.apply(this,arguments)}(Jo(t),io.DEBUG,{rethrow:!0});return Ks(new Uint8Array(yield e.arrayBuffer()),!0)}),Yo.apply(this,arguments)}let Ko,ta;const ea="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let na=!1;function ia(t){var e;return ii(t)&&0===t.length?(Ko=null!==(e=Ko)&&void 0!==e?e:Qo([]),Ko):Qo(t)}function ra(t){return sa.apply(this,arguments)}function sa(){return(sa=s(function*(t){var e;return ii(t)&&0===t.length?Ko||(ta=null!==(e=ta)&&void 0!==e?e:Xo([]).then(t=>(Ko=t,t)).catch(t=>{throw Ko=void 0,ta=void 0,t}),ta):Xo(t)})).apply(this,arguments)}function oa(t){return ea&&!na&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function aa(t){return{event:t,size:ys(t)}}function la(t,e){return i(i({},t),{},{data:e,cv:"2024-10"})}function ua(t,e){return i(i({},t),{},{cv:"2024-10",data:i(i({},t.data),e)})}function ca(t){try{if(2===t.type)return aa(la(t,Qo(t.data)));if(3===t.type&&0===t.data.source)return aa(ua(t,{texts:ia(t.data.texts),attributes:ia(t.data.attributes),removes:ia(t.data.removes),adds:ia(t.data.adds)}));if(3===t.type&&8===t.data.source)return aa(ua(t,{adds:t.data.adds?Qo(t.data.adds):void 0,removes:t.data.removes?Qo(t.data.removes):void 0}))}catch(t){Ho.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:gs(t)}}function ha(){return(ha=s(function*(t){try{if(2===t.type)return aa(la(t,yield Xo(t.data)));if(3===t.type&&0===t.data.source){const[e,n,i,r]=yield Promise.all([ra(t.data.texts),ra(t.data.attributes),ra(t.data.removes),ra(t.data.adds)]);return aa(ua(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?Xo(t.data.adds):void 0,t.data.removes?Xo(t.data.removes):void 0]);return aa(ua(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===mi})(e)&&(na=!0),Ho.warn("could not compress event asynchronously - trying synchronous compression",e),ca(t)}return{event:t,size:gs(t)}})).apply(this,arguments)}function da(t,e){return 5===t.type&&t.data.tag===e}function fa(t){return da(t,"sessionIdle")}function va(t){return da(t,"$session_ending")}function pa(t){return da(t,"$session_starting")}var ma=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 vo(this._instance.get_property(Tr),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return ci(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.Me=!1,this.Ie=!1,this.Te=!1,this.Re=[],this.$e=void 0,this.Ee=void 0,this.Ae=!1,this.Oe=[],this.Le=0,this.Pe=0,this.De=!1,this.Fe=void 0,this.Wt=void 0,this.Ne=void 0,this.qe=void 0,this.je=void 0,this.Be=(t,e,n)=>{var i,r,s,o;if(!n)return;if(t===this.Xt&&e===this.He)return;const a=!n.noSessionId&&(n.activityTimeout||n.sessionPastMaximumLength),l=this.Xt,u=this.He;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.ze)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),this.Se=!1,null===(r=Vo())||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.Ue(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.He===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.We(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.Ve=!1,this.Ze=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$session_past_minimum_duration)===this.Xt},this.Ge=()=>{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 ci(n)&&ci(i)?i-n:null},this.Qe=()=>{var t,e;const n=this.ie;if(!ci(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.Je;return ci(t)&&t>=0&&n>t}if(this.Ze())return!1;const i=this.Ge();return!!li(i)||n>i||(null===(r=this._instance.persistence)||void 0===r||r.register({$session_past_minimum_duration:this.Xt}),!1);var r},this.Ke=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Xe&&!this.be&&this.Ye(void 0),this.tn(),this.en(!0)):this.nn()},this.rn=()=>{this.Ke()},this.sn=()=>{this.Vt("browser offline",{})},this.an=()=>{this.Vt("browser online",{})},this.ln=()=>{(null==Qn?void 0:Qn.visibilityState)&&("visible"===Qn.visibilityState&&(this.Xe=!0),this.Vt("window "+Qn.visibilityState,{}))},this.Xe=null==e||e;const{sessionId:n,windowId:i,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=n,this.He=i,this._sessionStartTimestamp=r,this.et=new hs(this._instance),this.Y=new cs(this._instance),this.tt=new ds(this._instance),this.Rt=this.nn(),this.un="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||Ho.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.ze=new ro(this._instance)}setDocumentWasEverVisible(t){t&&(this.Xe=!0)}get cn(){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 oi(h)&&oi(d)&&oi(f)&&oi(v)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:f,maskAllElementAttributes:v}}dn(){var t;if(this.Ce)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(ui(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!oi(i)&&i!==r});0!==i.length&&(this.Ce=!0,Ho.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 hn(){var t;return fi(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Mi("canvas recording resolution scale"),1)}get fn(){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:fi(c,0,12,Mi("canvas recording fps"),4),quality:fi(h,0,1,Mi("canvas recording quality"),.4)}}get vn(){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 pn(){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=Uo(this._instance.config.capture_performance),l=Uo(null==i?void 0:i.capturePerformance),u=!!(hi(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}mn(){var t,e;const n=[],r=null===(t=Kn.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.vn&&n.push(r());const s=null===(e=Kn.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.pn&&ri(s))if(!xi.includes(Xn.hostname)||this._forceAllowLocalhostNetworkCapture){const t=ri(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;n.push(s(((t,e,n)=>{const r={payloadSizeLimitBytes:qi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...qi.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...qi.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=Hi(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=Xi(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=Xi(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=Ti(t.name);let s=0===e.indexOf("http")?null===(i=Ti(e))||void 0===i?void 0:i.pathname:e;"/"===s&&(s="");const o=null==r?void 0:r.pathname.replace(s||"","");return r&&o&&Qi.some(t=>0===o.indexOf(t))?void 0:t})((Ji((i=e).requestHeaders),Ji(i.responseHeaders),i),t.api_host,n));var i},c=ri(t.session_recording.maskNetworkRequestFn);return c&&ri(t.session_recording.maskCapturedNetworkRequestFn)&&Ii.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=ri(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 ui(o)&&s?(Ki.add(s),s):null!=o?o:void 0}:t=>function(t){if(!oi(t))return t.requestBody=Yi(t.requestBody,"Request"),t.responseBody=Yi(t.responseBody,"Response"),t}(u(t)),i(i(i({},qi),r),{},{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.pn,t)))}else Ho.info("NetworkCapture not started because we are on localhost.");return n}gn(t){return this._instance.config.disable_capture_url_hashes?pi(t):t}yn(t,e=!1){const n=e?pi(t):this.gn(t),i=this._instance.config.mask_personal_data_properties?[...go,...this._instance.config.custom_personal_data_properties||[]]:[];return this.bn(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("=");ii(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))}bn(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}wn(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}):Ho.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.wn(Go(()=>Zo().addCustomEvent(t,e)))}kn(){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}_n(t){if(!this.kn())return!1;try{const e=Zo();return!!e&&(e.addCustomEvent("$json_ld",t),this.kn())}catch(t){return!1}}Sn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.xn)||void 0===e?void 0:e.scan(t)})}Cn(){try{if(this._instance.config.capture_pageview||!Zn)return;const t=new URL(Zn.location.href),e=this.yn(t.origin+t.pathname+t.search);this.Mn!==e&&(this.Mn=e,this.Vt("$url_changed",{href:e}))}catch(t){}}In(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.wn(t)})}}jt(){return this.wn(Go(()=>Zo().takeFullSnapshot()))}get Tn(){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 ci(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}Rn(){if(this.$n&&clearInterval(this.$n),!0===this.de)return;const t=this.Tn;t&&(this.$n=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.En(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Rn()}An(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.xn)||void 0===t||t.scan(),clearInterval(this.$n),Ho.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}On(){var t;this.Y.urlBlocked&&(null===(t=this.xn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.Sn(),this.Rn(),this.Vt("recording resumed",{reason:"left blocked url"}),Ho.info("recording resumed"))}Ln(t,e){var n;if("event"===t&&this.En(),!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?Or:Er;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.en(),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=si(t)?t:JSON.parse(t)}catch(t){return void Ho.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ve){var n;const i=null!==(n=e.cache_timestamp)&&void 0!==n?n:Date.now();if(Date.now()-i>36e5)return void Ho.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:t})}return e}Pn(t,e,n){this._instance.get_property(t)&&(e(),n())}start(t){var e,n;const i=this.ne;if(!i)return void Ho.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ye(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.De&&(this.Dn(),this.nn());const{sessionId:r,windowId:s,sessionStartTimestamp:o}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=r,this.He=s,this._sessionStartTimestamp=o,this.Fn(),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 mo(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new po(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.Ln(t,e)),this.Pn(Mr,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Mr)}),this.Pn(Rr,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Rr)}),this.Pn(xr,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(xr)}),this.Pn(Ar,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Ar)}),this.re.makeSamplingDecisions(this.sessionId),this.Nn(),this.ke||(Ai(Zn,"beforeunload",this.Ke),Ai(Zn,"pagehide",this.rn),Ai(Zn,"offline",this.sn),Ai(Zn,"online",this.an),Ai(Qn,"visibilitychange",this.ln),!this.Ne&&ri(this.Yt.onSessionId)&&(this.Ne=this.Yt.onSessionId(this.Be)),!this.qe&&ri(this.Yt.on)?this.qe=this.Yt.on("forcedIdleReset",()=>{this.Ue(),this.de="unknown",this.stop(),this.je=this.Yt.onSessionId((t,e,n)=>{var i;null===(i=this.je)||void 0===i||i.call(this),this.je=void 0,this.Be(t,e,n)})}):ri(this.Yt.on)||Ho.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),ui(this.Fe)&&(this.Fe=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.yn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Ho.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(t||"recording_initialized"))}qn(){var t,e,n,i,r,s;null==Zn||Zn.removeEventListener("beforeunload",this.Ke),null==Zn||Zn.removeEventListener("pagehide",this.rn),null==Zn||Zn.removeEventListener("offline",this.sn),null==Zn||Zn.removeEventListener("online",this.an),null==Qn||Qn.removeEventListener("visibilitychange",this.ln),clearInterval(this.$n),this.jn(),null===(t=this.Fe)||void 0===t||t.call(this),this.Fe=void 0,null===(e=this.Wt)||void 0===e||e.call(this),this.Wt=void 0,null===(n=this.Ne)||void 0===n||n.call(this),this.Ne=void 0,null===(i=this.qe)||void 0===i||i.call(this),this.qe=void 0,null===(r=this.je)||void 0===r||r.call(this),this.je=void 0,null===(s=this.re)||void 0===s||s.stop(),this.Bn(),this.Dn()}Dn(){this.Pe+=1,this.Oe=[],this.Le=0,this.Hn=void 0,this.De=!1}Bn(){var t,e;null===(t=this.zn)||void 0===t||t.stop(),this.ce=[],null===(e=this.xn)||void 0===e||e.stop(),this.xn=void 0,this.ae=!1;try{var n;null===(n=this.se)||void 0===n||n.call(this)}catch(t){Ho.warn("could not stop rrweb",t)}this.se=void 0}Un(){if(!this.Hn||0===this.Le)return!1;if(this.De)return!0;this.De=!0,this.Wn=void 0;const t=this.Pe;return this.jn(),this.Bn(),this.Hn.catch(()=>{}).then(()=>{t===this.Pe&&(this.De=!1,this.en(),this.nn(),this.Vn(),this.qn(),Ho.info("stopped"))}).catch(()=>{this.De=!1,this.Vn(),this.qn(),Ho.info("stopped")}),!0}stop(){if(this.Bn(),this.Ve)this.tn();else if(this.Un())return;this.en(),this.nn(),this.Vn(),this.qn(),Ho.info("stopped")}Vn(){this.Ye(void 0,{preserveLogDedup:this.Ve}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.De)&&(this.tn(),this.en())}We(t){this.Ve=!0,this.le=Date.now();try{var e,n;this.stop(),this.Zn=void 0,this.Gn=void 0,this.fe=0,this.ve=0,this.pe=0,this.me=0,null===(e=Vo())||void 0===e||null===(n=e.resetSnapshotCostState)||void 0===n||n.call(e),this.start("session_id_changed")}finally{this.Ve=!1}this.Ye(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ye(t,{preserveLogDedup:e=!1}={}){if(this.ge=!oi(t),this.Wn=t,oi(t))return void(e||(this.Qn=void 0));if(this.Ve)return;const n=`${this.sessionId}:${t}`;n!==this.Qn&&(this.Qn=n,Ho.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}En(){this.isStarted||(this.we=!0),this.ge&&(this.Ye(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Jn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.nn(),this.Bn()),this.nn(),this.qn(),this.nn(),this.Vn(),Ho.info("discarded")}Kn(t,e,n,i,r){if(-1===n)return this.me+=1,void Ho.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.Xn(t,i),this.Yn(s)):this.nn()}ti(){try{this.ei()}catch(t){this.xe||(this.xe=!0,Ho.error("could not track full snapshot cost",t))}}ei(){var t,e;const n=null===(t=Vo())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);n&&n!==this.Gn&&(this.Gn=n,this.Zn&&this.Zn.durationMs>=n.durationMs||(this.Zn=n),500>n.durationMs||Ho.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}))}Xn(t,e){2!==t.type?3===t.type&&(oi(this.$e)||this.$e===e||this.Ee===e||(this.Ee=e,Ho.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.$e=e}ni(t){t.counted&&t.generation===this.Pe&&(this.Le=Math.max(0,this.Le-1)),t.counted=!1,this.Oe=this.Oe.filter(e=>e!==t)}ii(t,e,n){t.processed||t.generation!==this.Pe||(t.processed=!0,this.Kn(t.event,e,n,t.targetSessionId,t.targetWindowId))}ri(t){try{let e,n=t.event;if(t.compressionEnabled)try{({event:n,size:e}=ca(t.event))}catch(t){Ho.warn("could not process queued compression event - will use uncompressed event",t)}oi(e)&&(e=gs(t.event));try{this.ii(t,n,e)}catch(t){Ho.warn("could not capture queued compression event",t)}}finally{this.ni(t)}}tn(){[...this.Oe].forEach(t=>{try{this.ri(t)}catch(t){Ho.warn("could not drain queued compression event",t)}})}oi(t,e,n,i){var r=this;const o={event:t,compressionEnabled:e,targetSessionId:n,targetWindowId:i,generation:this.Pe,processed:!1,counted:!0};this.Oe.push(o),this.Le+=1;const a=(l=s(function*(){try{if(o.processed)return;let n,i;try{const r=e?oa(t)?yield function(t){return ha.apply(this,arguments)}(t):ca(t):{event:t,size:gs(t)};n=r.event,i=r.size}catch(e){Ho.warn("could not process queued compression event - will use uncompressed event",e),n=t,i=gs(t)}r.ii(o,n,i)}finally{r.ni(o)}}),function(){return l.apply(this,arguments)});var l;this.Hn=this.Hn?this.Hn.catch(()=>{}).then(a):a()}onRRwebEmit(t){var e,n,i,r,s,o,a,l,u,c,h,d,f,v;if(!this._instance.sessionManager)return;if(this.In(),!t||!si(t))return;if(4===t.type){const e=this.yn(t.data.href);if(this.Mn=e,!e)return;t.data.href=e}else this.Cn();if(null===(e=this.re)||void 0===e||e.checkUrlTriggers(this.sessionId,()=>this.An(),()=>this.On(),(t,e)=>this.Ln(t,e)),this.Y.urlBlocked&&(5!==(c=t).type||"recording paused"!==c.data.tag))return;2===t.type&&((null===(h=Vo())||void 0===h||null===(d=h.wasMaxDepthReached)||void 0===d?void 0:d.call(h))&&(this.Se=!0),this.ti(),Promise.resolve().then(()=>this.ti()),this.Rn(),null===(f=this.zn)||void 0===f||f.reset(),null===(v=this._instance.persistence)||void 0===v||v.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const p=2===t.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.si();const m=this.zn?this.zn.throttleMutations(t):t;if(!m)return void(!0===this.de&&this.he++);const g=function(t){const e=t;if(e&&si(e)&&6===e.type&&si(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}(m),y=function(t){return va(t)?t.data.payload:null}(g),b=function(t){return pa(t)?t.data.payload:null}(g),w=function(t){return fa(t)?t.data.payload:null}(g);y||b?(null==y?void 0:y.lastActivityTimestamp)&&(g.timestamp=y.lastActivityTimestamp):(null==w?void 0:w.sessionId)||this.ai(g),2===t.type&&(this.Re.push([this.Xt,t.timestamp]),this.Re.length>6&&(this.Re=this.Re.slice(-6)));const _=null!==(i=null!==(r=null!==(s=null==y?void 0:y.currentSessionId)&&void 0!==s?s:null==b?void 0:b.nextSessionId)&&void 0!==r?r:null==w?void 0:w.sessionId)&&void 0!==i?i:this.Xt,k=null!==(o=null!==(a=null!==(l=null==y?void 0:y.currentWindowId)&&void 0!==l?l:null==b?void 0:b.nextWindowId)&&void 0!==a?a:null==w?void 0:w.windowId)&&void 0!==o?o:this.He;if(!0===this.de&&!function(t){return fa(t)||va(t)||pa(t)}(g))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(g)&&this.he++);2===g.type&&(this.he=0),w&&(g.timestamp=w.lastActivityTimestamp+w.threshold);const S=this.ae;this.ae=!0,p?this.Sn(!0):S||this.Sn();const C=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===g.type&&"$json_ld"===g.data.tag){let t;try{t=Zn?this.yn(Zn.location.href):void 0}catch(t){}g.data.href=t}if(this.Le>0||C&&oa(g))return void this.oi(g,C,_,k);const{event:I,size:M}=C?ca(g):{event:g,size:gs(g)};this.Kn(g,I,M,_,k)}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}):Vr}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.En(),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.En(),this.qt("sampling_overridden")}overrideTrigger(t){this.Ln(t),this.En()}li(){try{var t;const e=null==Zn||null===(t=Zn.location)||void 0===t?void 0:t.href;if(!e)return;const n=this.yn(e);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}jn(){this.ui&&(clearTimeout(this.ui),this.ui=void 0)}Jn(){this.ui||(this.ui=setTimeout(()=>{this.en()},2e3))}ci(){return this.$e!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!va(t)&&!pa(t))}di(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}hi(t){if("buffering"!==t)return oi(this.fi)||this._instance.register_for_session({[Br]:[]}),void(this.fi=void 0);const e=this.di();if(0===e.length)return oi(this.fi)||this._instance.register_for_session({[Br]:[]}),void(this.fi=void 0);const n=e.join(", "),i=`${this.sessionId}:${n}`;i!==this.fi&&(this.fi=i,this._instance.register_for_session({[Br]:e}),Ho.info(`buffering: ${n}`))}pi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.mi)&&no.Et()}gi(){0!==this.Rt.data.length&&this.Rt.size!==this.yi&&943718.4>=this.Rt.size&&this.pi()&&(this.yi=this.Rt.size,no.At(this.un,this.Rt))}Fn(){if(this.Ae||!this.pi())return;this.Ae=!0;const t=no.Dt(this.un);no.Lt(this.un),si(t)&&ii(t.data)&&0!==t.data.length&&ii(t.sizes)&&t.sizes.length===t.data.length&&ci(t.size)&&t.sessionId===this.Xt&&t.windowId===this.He&&(this.Rt.data.length>0||(this.Rt=t))}en(t=!1){var e;if(this.jn(),this.ge)return this.Rt;if(this.ci())return this.Rt.size>943718.4?this.nn():(t&&this.gi(),this.Rt);const n=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const r=this.Qe(),s=this.status;if(this.hi(s),"buffering"===s||"paused"===s||"disabled"===s||r)return!t||"active"!==s&&"sampled"!==s||this.gi(),this.Jn(),this.Rt;if(this.Rt!==n)return this.Rt;if(n.data.length>0){var o;const t=this.li();bs(n).forEach(e=>{try{var n;null===(n=this.ze)||void 0===n||n.trackSize(e.sessionId,e.size),this.bi(i({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:io.LIB_NAME,$lib_version:io.LIB_VERSION,$snapshot_host:t},this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){Ho.warn("could not capture snapshot chunk - skipping it",t)}}),oi(this.yi)||(no.Lt(this.un),this.yi=void 0),null===(o=this.re)||void 0===o||o.onFlushComplete()}return this.nn()}Yn(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.en(),this.Xt!==e)return;r&&this.Rt.data.length>0&&(this.Rt=this.nn()),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||(this.be=!0,this.Rt=this.nn()):(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.Jn())}bi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Je(){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}si(){if(!this.Rt||0===this.Rt.data.length)return this.nn();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.nn():(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)}nn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.He},this.Rt}qt(t,e){this._instance.register_for_session({[Gr]:t}),Ho.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",i({reason:t},e))}wi(t){var e;return 3===t.type&&-1!==qo.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ai(t){const e=this.wi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.$n),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.He}),this.en());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.He!==n;if(this.He=n,this.Xt=i,s||o){const t=s&&!1!==this.de;t&&(this.de="unknown"),this.We(t)}else if(e&&this.En(),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.Sn(),this.Rn()}}Ue(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,n,i,r,s,o,a,l,u,c,h,d,f;const v=null===(t=Vo())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Wn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Je,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(n=this.ze)||void 0===n?void 0:n.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Re,$snapshot_max_depth_exceeded:this.Se,$sdk_debug_replay_slowest_full_snapshot_ms:Wo(null===(i=this.Zn)||void 0===i?void 0:i.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Wo(null===(r=this.Zn)||void 0===r?void 0:r.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(s=this.Zn)||void 0===s?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Zn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this.Zn)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==v?void 0:v.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==v?void 0:v.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==v?void 0:v.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Wo(null==v?void 0:v.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Wo(null==v?void 0:v.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Wo(null===(l=Vo())||void 0===l||null===(u=l.getMutationCost)||void 0===u||null===(u=u.call(l))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(c=Vo())||void 0===c||null===(h=c.getDiscardedDurationSamples)||void 0===h?void 0:h.call(c),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_unstringifiable_events_dropped:this.me,$sdk_debug_replay_rrweb_error:this.ke,$sdk_debug_replay_observer_init_failures:null===(d=Vo())||void 0===d||null===(f=d.getObserverInitFailures)||void 0===f?void 0:f.call(d),[Hr]:!!this.se,[qr]:this._e}}Nn(){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={};oi(t.mousemove)||(n.mousemove=t.mousemove),oi(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.fn&&this.fn.enabled&&(e.recordCanvas=!0,e.sampling=i(i({},e.sampling),{},{canvas:this.fn.fps}),e.dataURLOptions={type:"image/webp",quality:this.fn.quality},e.canvasResolutionScale=this.hn,e.canvasMasking={configured:()=>{var t;return ri(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(ri(n))try{var i;return null!==(i=n(t))&&void 0!==i?i:null}catch(t){return this.Ie||(this.Ie=!0,Ho.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.cn&&(e.maskAllInputs=null===(r=this.cn.maskAllInputs)||void 0===r||r,e.maskTextSelector=null!==(s=this.cn.maskTextSelector)&&void 0!==s?s:void 0,e.blockSelector=null!==(o=this.cn.blockSelector)&&void 0!==o?o:void 0,e.maskAllElementAttributes=null!==(a=this.cn.maskAllElementAttributes)&&void 0!==a&&a),e.maskAllElementAttributes&&e.maskAttributeFn&&(e.maskAttributeFn=void 0,this.Me||(this.Me=!0,Ho.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.dn();const l=Zo();if(!l)return void Ho.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.zn=null!==(t=this.zn)&&void 0!==t?t:new to(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`;Ho.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.Tn,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.mn();if(this.se=l(i({emit:t=>{this.onRRwebEmit(t)},plugins:u,errorHandler:(t,e)=>"rrweb"===e&&(this.Te||(this.Te=!0,Ho.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},e)),!this.se)return this.ke=!0,void Ho.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)&&Qn&&(null==Zn?void 0:Zn.MutationObserver)&&!this.xn&&(this.xn=function(t,e,n){const i=new WeakMap,r=n.getCaptureState||(()=>!0);let s=yo;const o=function(t,e){const n=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==n?void 0:n.length)&&!n.includes("id")?_o:n=>{const i=t.getElementById(n);return!!i&&"SCRIPT"!==i.nodeName&&(!e.isRecordedElement||e.isRecordedElement(i))&&!Bo(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 Bo(t,e.blockClass,e.blockSelector)||Bo(t,e.maskTextClass,e.maskTextSelector)}(e,n))return;const l=function(t,e=_o,n){if(!t||t.length>yo)return null;try{const i=JSON.parse(t),r={maskUrl:n,remainingNodes:2048,exceeded:!1},s=ii(i)?i.map(t=>No(t,e,r)):No(i,e,r);if(r.exceeded||li(s)||ii(s)&&(!s.length||s.some(li)))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(li(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 zo(t))a(e)};for(const n of t)if("childList"===n.type)Po(n.target)&&a(n.target),n.addedNodes.forEach(e);else if("characterData"===n.type){const t=n.target.parentNode;t&&Po(t)&&a(t)}else"attributes"===n.type&&Po(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()&&zo(t.documentElement).forEach(t=>{e&&i.delete(t),a(t)})},stop(){return n.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(Qn,Zn.MutationObserver,{maskUrl:t=>this.yn(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.kn()},emit:t=>this._n(t)}),this.Y.isCurrentUrlBlocked()&&this.xn.scan()),this.le=Date.now(),this.de=hi(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)}};Kn.__PosthogExtensions__=Kn.__PosthogExtensions__||{},Kn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:Vn,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:Ir,options:t})},Kn.__PosthogExtensions__.rrweb={record:En,version:"v2",wasMaxDepthReached:()=>Yt,resetMaxDepthState(){Yt=!1,Xt=!1},getLastSnapshotCost:()=>P,getMutationCost:()=>i({},U),getDeferredStylesheetStats:()=>i({},H),getDiscardedDurationSamples:()=>x,getObserverInitFailures:()=>Ge.size?Array.from(Ge):void 0,resetSnapshotCostState(){F=0,D=0,L=0,A=0,x=0,N={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},P=null,j=null,B=[],z=0,W=0,U={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},Kn.__PosthogExtensions__.initSessionRecording=(t,e)=>new ma(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,"0".repeat(32),"0".repeat(16);var p={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},m={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},g={};function y(t){if(g[t])return g[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 p?p[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 m?m[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 g[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),g[t]=r):n}catch(t){return n}finally{!l&&a.parentNode&&document.body.removeChild(a)}var u}var b=Object.create(null);function w(t,e,n){var i;const r=b[t],s=r[n];if(s)return s.call(e);const o=y(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]}b.Node=Object.create(null),b.ShadowRoot=Object.create(null),b.MutationObserver=Object.create(null),b.Element=Object.create(null);var _,k={};function S(t,e,n){const i=`${t}.${String(n)}`;if(k[i])return k[i].bind(e);const r=y(t)[n];return"function"!=typeof r?e[n]:(k[i]=r,r.bind(e))}function C(){return y("MutationObserver").constructor}function I(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 M={childNodes:t=>w("Node",t,"childNodes"),parentNode:t=>w("Node",t,"parentNode"),parentElement:t=>w("Node",t,"parentElement"),textContent:t=>w("Node",t,"textContent"),isConnected(t){if(void 0===_){var e;const t=null===(e=Object.getOwnPropertyDescriptor(y("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)=>S("Node",t,"contains")(e),getRootNode:t=>S("Node",t,"getRootNode")(),host:t=>t&&"host"in t?w("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?w("Element",t,"shadowRoot"):null,querySelector:(t,e)=>S("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>S("Element",t,"querySelectorAll")(e),mutationObserver:C,patch:I};function R(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var A=0,x=0;function T(){A+=1}function O(){return A}function E(t,e){return(e!==A||t>6e4)&&(x+=1,!0)}var F=0,D=0,L=0,N={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},P=null,j=null,B=[],z=0,W=0,U={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function q(t){var e;(F+=1)>1||(N={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},B=[],z=0,j=(e=t)&&e>0?e:null,D=R(),L=A)}function G(){return 0===F?P||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(F-=1)>0?N:(N.durationMs=R()-D,N.deferredStylesheetCount=z,H.deferredCount+=z,j=null,E(N.durationMs,L)?N:P=N)}function V(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+=V(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+=V(r,e,n+1))}}}catch(t){}}return i}function Z(t){if(0===F)return;const e=V(t,null,0);N.cssRuleCount+=e,W>0&&(N.nonDeferrableCssRuleCount+=e)}function J(t){W+=1;try{return t()}finally{W-=1}}function Q(t){F>0&&(N.stylesheetMs+=t)}function X(t){if(0===F||null===j)return!1;const e=N.cssRuleCount-N.nonDeferrableCssRuleCount;return e>=j||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const n=new WeakSet;return n.add(t),V(e,n,0)}catch(t){return 0}}(t)>j}function Y(){const t=B;return B=[],t}function K(){H.failedCount+=1}function tt(t){t>0&&(H.abandonedCount+=t)}function et(t){return et="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},et(t)}function nt(t,e,n){return(e=function(t){var e=function(t){if("object"!=et(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function it(t){return t.nodeType===t.ELEMENT_NODE}function rt(t){const e=t&&"host"in t&&"mode"in t&&M.host(t)||null;return Boolean(e&&"shadowRoot"in e&&M.shadowRoot(e)===t)}function st(t){return"[object ShadowRoot]"==={}.toString.call(t)}function ot(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 at(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 lt=0;function ut(t){const e=0===lt,n=e?R():0;lt+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Z(e);let n=t.href;return!n&&t.ownerNode&&(n=t.ownerNode.baseURI),ot(Array.from(e,t=>ct(t,n)).join(""))}catch(t){return null}finally{lt-=1,e&&Q(R()-n)}}function ct(t,e){if(dt(t)){let e;try{e=ut(t.styleSheet)||at(t)}catch(n){e=t.cssText}try{var n;if(e&&(null===(n=t.styleSheet)||void 0===n?void 0:n.href))return At(e,t.styleSheet.href)}catch(t){}return e}{let n=t.cssText;return ft(t)&&t.selectorText.includes(":")&&(n=ht(n)),e?At(n,e):n}}function ht(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function dt(t){return"styleSheet"in t}function ft(t){return"selectorText"in t}var vt=/^-?[A-Za-z_][\w-]*$/,pt=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function mt(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||at(e)}catch(t){r=e.cssText}try{var i;r&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href)&&(r=At(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&&dt(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(ft(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&&!vt.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]?vt.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":pt.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?At(i,r):i,fixColons:"sheet"===n.kind&&ft(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(n,t))return;let i=n.cssText;"sheet"===t.kind&&ft(n)&&n.selectorText.includes(":")&&(i=ht(i)),t.parts.push(t.sheetHref?At(i,t.sheetHref):i),t.index+=1}return function(t){try{const n=t.rules||t.cssRules;if(!n)return!1;Z(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,!dt(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;Z(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=R();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?ht(n):n}else e=ot(t.parts.join(""))}catch(t){}s(e);continue}o-=1;try{a(t)}catch(t){s(null)}}}catch(t){n=!0,i=null}finally{Q(R()-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 gt=class{constructor(){nt(this,"idNodeMap",new Map),nt(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)),it(t)){const e=M.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 yt({element:t,maskInputOptions:e,tagName:n,type:i,value:r,maskInputFn:s}){let o=r||"";const a=i&&bt(i);return(e[n.toLowerCase()]||a&&e[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function bt(t){return t.toLowerCase()}var wt=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&&wt.has(bt(e))?n:"*".repeat(n.length):r?r(e,n,t):n:n}var kt="__rrweb_original__";function St(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?bt(e):null}catch(t){return null}}var Ct=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,It=/^(?:[a-z+]+:)?\/\//i,Mt=/^www\..*/i,Rt=/^(data:)([^,]*),(.*)/i;function At(t,e){return(t||"").replace(Ct,(t,n,i,r,s,o)=>{const a=i||s||o,l=n||r||"";if(!a)return t;if(It.test(a)||Mt.test(a))return`url(${l}${a}${l})`;if(Rt.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 xt,Tt,Ot=new Map,Et=1,Ft=new RegExp("[^a-z0-9-_:]");function $t(){return Et++}var Dt=!1,Lt=/^[^ \t\n\r\u000c]+/,Nt=/^[, \t\n\r\u000c]+/,Pt=new WeakMap;function jt(t,e){return e&&""!==e.trim()?Bt(t,e):e}function Bt(t,e){let n=Pt.get(t);if(n||(n=t.createElement("a"),Pt.set(t,n)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return n.setAttribute("href",e),n.href}function zt(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 Wt(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=jt(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=Ot.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(Ot.size>=10){const t=Ot.keys().next().value;void 0!==t&&Ot.delete(t)}return Ot.set(e,{type:n,quality:i,result:a}),a}catch(t){return e}}(r,n,s.type,s.quality)),zt(t,s)}if("image"===e)return zt(n,s)}return n}if("xlink:href"===n&&"#"!==i[0]){const n=jt(t,i);return"image"===e&&n.startsWith("data:")?zt(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(Nt),e.length>n;){let s=i(Lt);if(","===s.slice(-1))s=jt(t,s.substring(0,s.length-1)),r.push(s);else{let i="";s=jt(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?At(i,Bt(t)):"object"===e&&"data"===n?jt(t,i):i:jt(t,i)}function Ut(t,e,n){return("video"===t||"audio"===t)&&"autoplay"===bt(e)}function Ht(t){return"string"==typeof t&&bt(t).split(/\s+/).includes("stylesheet")}function qt(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&qt(M.parentNode(t),e,n);for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;return!!n&&qt(M.parentNode(t),e,n)}function Gt(t,e,n,i){let r;if(it(t)){if(r=t,!M.childNodes(r).length)return!1}else{if(null===M.parentElement(t))return!1;r=M.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(qt(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 Vt(t,e,n){const i=t.removeEventListener;"function"==typeof i&&i.call(t,e,n)}var Zt=new Map;function Jt(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Qt(t){return null==t?"":t.toLowerCase()}var Xt=!1,Yt=!1;function Kt(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:_,onIframeLoad:k,iframeLoadTimeout:S=5e3,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:A=()=>!1,newlyAddedElement:x=!1,depth:T=0,maxDepth:O=50}=e;let{needsMask:E}=e,{preserveWhiteSpace:D=!0}=e;if(T>=O)return Yt=!0,Xt||(Xt=!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=Gt(t,o,a,void 0===E)),F>0&&(N.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=bt(t.tagName);return Ft.test(e)?"div":e}(t),w=new Set;let _={};const k=t.attributes.length;for(let e=0;k>e;e++){const i=t.attributes[e];Ut(b,i.name)||(_[i.name]=Wt(n,b,bt(i.name),i.value,t,c))}if("link"===b&&s&&!y&&Ht(_.rel)){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=Jt(n,i),!e&&i.includes(".css"))&&(e=Jt(n,window.location.origin+"/"+i.replace(window.location.href,"")))}let i=null;e&&(X(e)?F>0&&(B.push(t),z+=1):i=ut(e)),i&&(delete _.rel,delete _.href,_._cssText=i)}var S;if("style"===b&&t.sheet&&!(t.innerText||M.textContent(t)||"").trim().length){const e=J(()=>ut(t.sheet));e&&(_._cssText=e)}if("input"===b||"textarea"===b||"select"===b){const e=t.value,n=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=yt({element:t,type:St(t),tagName:b,value:e,maskInputOptions:o,maskInputFn:a}):n&&(_.checked=n)}if("option"===b&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===b&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.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=kt in r?r[kt]: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)||(_.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)&&(_.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(S=t)?void 0:S.name)?Dt||(Dt=!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){xt||(xt=n.createElement("canvas"),Tt=xt.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=()=>{Vt(e,"load",o);try{xt.width=e.naturalWidth,xt.height=e.naturalHeight,Tt.drawImage(e,0,0);const t=xt.toDataURL(c.type,c.quality);_.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?_.crossOrigin=s("crossOrigin",r):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===b||"video"===b){const e=_;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&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),y){var R,A,x;const{width:e,height:i,left:r,top:s}=t.getBoundingClientRect(),o=null===(R=n.defaultView)||void 0===R?void 0:R.getComputedStyle(t);_={class:_.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&&(_.rr_position=o.position||"static",w.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,w.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,w.add("rr_display")))}if("iframe"!==b||p(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),l||u)for(const[e,n]of Object.entries(_))"string"!=typeof n&&null!==n||(_[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:_,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=M.parentNode(t),o=s&&s.tagName;let a=M.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(X(s.sheet));else if(null===(c=s.sheet)||void 0===c?void 0:c.cssRules){const t=ut(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=At(a,Bt(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&n&&(a=i?i(a,M.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:M.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 P;P=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&&(Qt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Qt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Qt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Qt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Qt(t.attributes.property).match(/^(og|twitter|fb):/)||Qt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Qt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Qt(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(Qt(t.attributes.name))||Qt(t.attributes.property).match(/^article:/)||Qt(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(Qt(t.attributes.name)))return!0}}return!1}(L,m)||!D&&L.type===f.Text&&!L.isStyle&&!L.textContent.replace(/^\s+|\s+$/gm,"").length?-2:$t();const j=Object.assign(L,{id:P});if(i.add(t,j),-2===P)return null;_&&_(t);let W=!l;if(j.type===f.Element){W=W&&!j.needBlock,delete j.needBlock;const e=M.shadowRoot(t);e&&st(e)&&(j.isShadowHost=!0)}if((j.type===f.Document||j.type===f.Element)&&W){m.headWhitespace&&j.type===f.Element&&"head"===j.tagName&&(D=!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:D,onSerialize:_,onIframeLoad:k,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:R,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(M.childNodes(t))){const t=Kt(n,e);t&&j.childNodes.push(t)}let x=null;if(it(t)&&(x=M.shadowRoot(t)))for(const t of Array.from(M.childNodes(x))){const n=Kt(t,e);n&&(st(x)&&(n.isShadow=!0),j.childNodes.push(n))}}const U=M.parentNode(t);if(U&&rt(U)&&st(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),Vt(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?Vt(t,"load",o):(i=!0,Vt(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),Vt(t,"load",o)}}return t.addEventListener("load",o),()=>{Vt(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&k){const n=Kt(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:D,onSerialize:_,onIframeLoad:k,iframeLoadTimeout:S,onIframeListenerRegistered:C,onStylesheetLoad:I,stylesheetLoadTimeout:R,keepIframeSrcFn:A,depth:T+1,maxDepth:O});n&&k(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(Zt.has(e))return;let C;try{C=e.sheet}catch(t){return}if(C)return;const M=new AbortController;let x=!1;const F=()=>{if(!x){x=!0;try{(()=>{if(I){const e=Kt(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:D,onSerialize:_,onIframeLoad:k,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:R,keepIframeSrcFn:A,depth:T,maxDepth:O});e&&I(t,e)}})()}finally{Zt.delete(e),M.abort()}}},L=setTimeout(F,f);M.signal.addEventListener("abort",()=>clearTimeout(L),{once:!0}),e.addEventListener("load",F,{signal:M.signal,once:!0}),Zt.set(e,M)}(t,0,R),j}function te(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 ee=class t{constructor(...t){nt(this,"parentElement",null),nt(this,"parentNode",null),nt(this,"ownerDocument",void 0),nt(this,"firstChild",null),nt(this,"lastChild",null),nt(this,"previousSibling",null),nt(this,"nextSibling",null),nt(this,"ELEMENT_NODE",1),nt(this,"TEXT_NODE",3),nt(this,"nodeType",void 0),nt(this,"nodeName",void 0),nt(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 ne(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>ie(n,t,e,i)}function ie(t,e,n,i){re(()=>{const r=t.removeEventListener;"function"==typeof r&&(void 0!==i?r.call(t,e,n,i):r.call(t,e,n))})}function re(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function se(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var oe="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.",ae={map:{},getId(){return console.warn(oe),-1},getNode(){return console.warn(oe),null},removeNodeFromMap(){console.warn(oe)},has(){return console.warn(oe),!1},reset(){console.warn(oe)}};function le(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 ue(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e),o=()=>ue(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&&(ae=new Proxy(ae,{get(t,e,n){return"map"===e&&console.warn(oe),Reflect.get(t,e,n)}}));var ce=Date.now;function he(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=M.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=M.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 de(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function fe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ve(t){return t?t.nodeType===t.ELEMENT_NODE?t:M.parentElement(t):null}function pe(t,e,n,i){if(!t)return!1;const r=ve(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(qt(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 me(t,e,n){return!("TITLE"!==t.tagName||!n.headTitleMutations)||-2===e.getId(t)}function ge(t,e){if(rt(t))return!1;const n=e.getId(t);if(!e.has(n))return!0;const i=M.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||ge(i,e))}function ye(t){return Boolean(t.changedTouches)}function be(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function we(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 ee&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(M.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(ce=()=>(new Date).getTime());var ke=class{constructor(){nt(this,"id",1),nt(this,"styleIDMap",new WeakMap),nt(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 Se(t){var e;let n=null;return"getRootNode"in t&&(null===(e=M.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&M.host(M.getRootNode(t))&&(n=M.host(M.getRootNode(t))),n}function Ce(t){const e=t.ownerDocument;if(!e)return!1;if(M.contains(e,t))return!0;const n=M.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=Se(n);)n=e;return n}(t);return M.contains(e,n)}(t)}function Ie(t){return"__ln"in t}var Me,Re=class{constructor(){nt(this,"length",0),nt(this,"head",null),nt(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&&Ie(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&&Ie(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--)}},Ae=(t,e)=>`${t}@${e}`,xe=class{constructor(){nt(this,"frozen",!1),nt(this,"locked",!1),nt(this,"texts",[]),nt(this,"attributes",[]),nt(this,"attributeMap",new WeakMap),nt(this,"generatedAttributes",new WeakMap),nt(this,"removes",[]),nt(this,"mapRemoves",new Set),nt(this,"movedMap",{}),nt(this,"addedSet",new Set),nt(this,"movedSet",new Set),nt(this,"droppedSet",new Set),nt(this,"removesSubTreeCache",new Set),nt(this,"mutationCb",void 0),nt(this,"blockClass",void 0),nt(this,"blockSelector",void 0),nt(this,"maskTextClass",void 0),nt(this,"maskTextSelector",void 0),nt(this,"inlineStylesheet",void 0),nt(this,"maskInputOptions",void 0),nt(this,"maskTextFn",void 0),nt(this,"maskInputFn",void 0),nt(this,"maskAllElementAttributes",void 0),nt(this,"maskAttributeFn",void 0),nt(this,"keepIframeSrcFn",void 0),nt(this,"recordCanvas",void 0),nt(this,"canvasMaskingConfigured",void 0),nt(this,"inlineImages",void 0),nt(this,"slimDOMOptions",void 0),nt(this,"dataURLOptions",void 0),nt(this,"doc",void 0),nt(this,"mirror",void 0),nt(this,"iframeManager",void 0),nt(this,"stylesheetManager",void 0),nt(this,"shadowDomManager",void 0),nt(this,"canvasManager",void 0),nt(this,"processedNodeManager",void 0),nt(this,"unattachedDoc",void 0),nt(this,"canvasManagerReleased",!1),nt(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),nt(this,"emit",()=>{if(this.frozen||this.locked)return;const t=R(),e=O();try{this.processBufferedMutations()}finally{n=R()-t,i=e,F>0||E(n,null!=i?i:A)||n>U.slowestBatchMs&&(U.slowestBatchMs=n)}var n,i}),nt(this,"processBufferedMutations",()=>{const t=[],e=new Set,n=new Re,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=M.parentNode(s);if(!a||!Ce(s)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=rt(a)?this.mirror.getId(Se(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=>{be(t,this.mirror)&&this.iframeManager.addIframe(t),we(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),_e(t)&&!pe(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(M.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=Kt(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)Oe(this.removesSubTreeCache,t)&&!this.movedSet.has(M.parentNode(t))||s(t);for(const t of this.addedSet)Ee(this.droppedSet,t)||Oe(this.removesSubTreeCache,t)?Ee(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(M.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(M.parentNode(n.value));if(-1===i(n.value))continue;if(-1!==e){t=n;break}{const e=M.parentNode(n.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=M.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=M.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)}),nt(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),nt(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(M.childNodes(t),t=>M.textContent(t)||"").join("");e.attributes.value=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:St(t),value:n,maskInputFn:this.maskInputFn})}),nt(this,"processMutation",t=>{if(!me(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=M.textContent(t.target);pe(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Gt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,ve(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const i=t.target,r=bt(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=St(t);l=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(pe(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"),!Ut(r,a)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=Wt(this.doc,r,bt(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(pe(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=rt(t.target)?this.mirror.getId(M.host(t.target)):this.mirror.getId(t.target);pe(t.target,this.blockClass,this.blockSelector,!1)||me(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Te(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||ge(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Ae(n,i)]?Te(this.movedSet,e):(this.removes.push({parentId:i,id:n,isShadow:!(!rt(t.target)||!st(t.target))||void 0}),function(t,e){const n=[t];for(;n.length;){const t=n.pop();e.has(t)||(e.add(t),M.childNodes(t).forEach(t=>n.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),nt(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(me(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[Ae(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!pe(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=M.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=M.childNodes(M.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),pe(t,n||e,this.blockSelector,!0))return!0;const i="getRootNode"in t?M.getRootNode(t):null;t=(null==i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?M.host(i):null}return!1}};function Te(t,e){const n=[e];for(;n.length;){const e=n.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const i=M.childNodes(e);for(let t=0,e=i.length;e>t;t++){const e=i[t];e&&n.push(e)}}}function Oe(t,e,n){return 0!==t.size&&function(t,e){const n=M.parentNode(e);return!!n&&t.has(n)}(t,e)}function Ee(t,e){if(0===t.size)return!1;let n=M.parentNode(e);for(;n;){if(t.has(n))return!0;n=M.parentNode(n)}return!1}function Fe(t){Me=t}function $e(){Me=void 0}var De=(t,e="rrweb")=>Me?(...n)=>{try{return t(...n)}catch(t){if(Me&&!0===Me(t,e))return;throw t}}:t,Le=[];function Ne(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 Pe(t,e){const n=new xe;let i;n.init(t);try{i=new(C())(De(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),Le.push(n),{observer:i,buffer:n}}catch(t){try{null==i||i.disconnect(),n.destroy(),n.reset()}catch(t){}throw t}}function je({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){const o=new Map,a=s=>{const a=Ne(s);if(!a||pe(a,i,r,!0))return;const l=n.getId(a);let u,c;if(a===e&&e.defaultView){const t=he(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=[ne("scroll",De(le(De(t=>a(t)),s.scroll||100)),e)];return"onscrollend"in e&&l.push(ne("scrollend",De(a),e)),()=>l.forEach(t=>t())}function Be(t,e){for(let n=Le.length-1;n>=0;n--){const i=Le[n];if(!i)continue;let r=i.bufferBelongsToIframe(t);!r&&e&&e.has(i.bufferDoc())&&(r=!0),r&&(i.reset(),Le.splice(n,1))}}var ze=["INPUT","TEXTAREA","SELECT"],We=new WeakMap;function Ue(t){return function t(e,n){if(Ze("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Ze("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Ze("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Ze("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 qe({mirror:t,stylesheetManager:e},n){var i,r;let s=null;s=t.getId("#document"===n.nodeName?n:M.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}}),De(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Ge=new Set;function Ve(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=De(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Le.indexOf(s);-1!==t&&Le.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect()}finally{se(o)}}),h=(t,e)=>{const n=De(()=>{try{return e()}catch(e){throw Ge.add(t),e}})();"function"==typeof n&&o.push(n)};try{if(t.recordDOM&&h("mutation",()=>{const e=Pe(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=le(De(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null}),s),c=De(le(De(t=>{const e=Ne(t),{clientX:n,clientY:r}=ye(t)?t.changedTouches[0]:t;o||(o=ce()),a.push({x:n,y:r,id:i.getId(e),timeOffset:ce()-o}),u("undefined"!=typeof DragEvent&&t instanceof DragEvent?l.Drag:t instanceof MouseEvent?l.MouseMove:l.TouchMove)}),r,{trailing:!1})),h=[ne("mousemove",c,n),ne("touchmove",c,n),ne("drag",c,n)];return De(()=>{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=bt(o);const d=(e=>o=>{const a=Ne(o);if(pe(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 ye(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=ye(o)?o.changedTouches[0]:o;if(!f)return;const v=n.getId(a),{clientX:p,clientY:m}=f;De(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(ne(a,d,e))}),De(()=>{l.forEach(t=>t())})}(t)),h("scroll",()=>je(t)),h("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let n=-1,i=-1;return ne("resize",De(le(De(()=>{const e=de(),r=fe();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=Ne(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=M.parentElement(n)),!n||!d||0>ze.indexOf(d)||pe(n,r,s,!0))return;if(n.classList.contains(o)||a&&n.matches(a))return;let v=n.value,p=!1;const m=St(n)||"";"radio"===m||"checkbox"===m?p=n.checked:(l[d.toLowerCase()]||l[m])&&(v=yt({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=We.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){We.set(e,r);const s=n.getId(e);De(t)(i(i({},r),{},{id:s}))}}const v=("last"===c.input?["change"]:["input","change"]).map(t=>ne(t,De(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=>ue(t[0],t[1],{set(){De(d)({target:this,isTrusted:!1})}},!1,p))),De(()=>{se(v)})}(t)),h("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r,doc:s}){const o=De(s=>le(De(r=>{const o=Ne(r);if(!o||pe(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=[ne("play",o(d.Play),s),ne("pause",o(d.Pause),s),ne("seeked",o(d.Seeked),s),ne("volumechange",o(d.VolumeChange),s),ne("ratechange",o(d.RateChange),s)];return De(()=>{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:De((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:De((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:De((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=ut(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:De((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={};Je("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(Je("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),Je("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),Je("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:De((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=[...Ue(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:De((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=[...Ue(s),a];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),De(()=>{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",()=>qe(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:De((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=Ue(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:De((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=Ue(o.parentRule);s.queueMutation(h,()=>t({id:d,styleId:f,remove:{property:u},index:e}))}return c},"host")}),De(()=>{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=I(e.fonts,"add",function(e){return function(n){return setTimeout(De(()=>{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),De(()=>{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=De(()=>{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);pe(s,i,r,!0)||pe(l,i,r,!0)||a.push({start:n.getId(s),startOffset:o,end:n.getId(l),endOffset:u})}s({ranges:a})});return a(),ne("selectionchange",a)}(t)),h("customElement",()=>function({doc:t,customElementCb:e}){const n=t.defaultView;return n&&n.customElements?I(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 Ze(t){return void 0!==window[t]}function Je(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Qe=class{constructor(t){nt(this,"generateIdFn",void 0),nt(this,"iframeRemoteIdToLocalIdMap",new WeakMap),nt(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}},Xe=class{constructor(t){nt(this,"iframes",new WeakMap),nt(this,"crossOriginIframeMap",new WeakMap),nt(this,"crossOriginIframeMirror",new Qe($t)),nt(this,"crossOriginIframeStyleMirror",void 0),nt(this,"crossOriginIframeRootIdMap",new WeakMap),nt(this,"mirror",void 0),nt(this,"mutationCb",void 0),nt(this,"wrappedEmit",void 0),nt(this,"loadListener",void 0),nt(this,"pageHideListener",void 0),nt(this,"stylesheetManager",void 0),nt(this,"recordCrossOriginIframes",void 0),nt(this,"messageHandler",void 0),nt(this,"nestedIframeListeners",new Map),nt(this,"attachedWindows",new WeakMap),nt(this,"attachedDocuments",new WeakMap),nt(this,"attachedIframes",new Map),nt(this,"loadListenerDisposers",new WeakMap),nt(this,"iframeElementsById",new Map),nt(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Qe(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=>re(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{ie(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);re(()=>{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)})}re(()=>{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&&(ie(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(n)),t&&this.nestedIframeListeners.has(t)&&(ie(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=>{re(()=>this.mirror.removeNodeFromMap(t))}),re(()=>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&&ie(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{ie(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}},Ye=class{constructor(t){nt(this,"shadowDoms",new WeakSet),nt(this,"mutationCb",void 0),nt(this,"scrollCb",void 0),nt(this,"bypassOptions",void 0),nt(this,"mirror",void 0),nt(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(!st(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(n=null===(r=M.host(t))||void 0===r?void 0:r.ownerDocument)&&void 0!==n?n:e,{observer:o,buffer:a}=Pe(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=Le.indexOf(a);-1!==t&&Le.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:je(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(M.host(t))),this.restoreHandlers.push({doc:s,handler:qe({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const n=this;this.restoreHandlers.push({doc:e,handler:I(t.prototype,"attachShadow",function(t){return function(i){const r=t.call(this,i),s=M.shadowRoot(this);return s&&Ce(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}},Ke="skip-frame";function tn(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 en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),rn=0;64>rn;rn++)nn[en.charCodeAt(rn)]=rn;var sn=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;i>e;e+=3)r+=en[n[e]>>2],r+=en[(3&n[e])<<4|n[e+1]>>4],r+=en[(15&n[e+1])<<2|n[e+2]>>6],r+=en[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},on=!1,an=new Map,ln=(t,e,n)=>{if(!t||!hn(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=an.get(t);return n||(n=new Map,an.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 un(t,e,n,i){if(t instanceof Array)return t.map(t=>un(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:sn(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[un(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)?on||(on=!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:[un(t.data,e,n,i),t.width,t.height]}:hn(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ln(t,e,n)}:t}var cn=(t,e,n,i)=>t.map(t=>un(t,e,n,i)),hn=(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]))},dn=["webgl","webgl2"];function fn(t){return"nodeType"in t}function vn(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 I(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||fn(o)&&pe(o,e,n,!0))return r.call(this,s);fn(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=I(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(i,...s){const o=function(t){return"experimental-webgl"===t?"webgl":t}(i);if(!pe(this,e,n,!0)&&("__context"in this||(this.__context=o),r&&dn.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 pn(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=I(t,u,function(t){return function(...a){const l=t.apply(this,a);if(ln(l,s,this),this.canvas&&"tagName"in this.canvas&&!pe(this.canvas,i,r,!0)){let t;try{t=cn(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=ue(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!pe(this.canvas,i,r,!0)&&n(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var mn='(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',gn="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",mn],{type:"text/javascript;charset=utf-8"});function yn(t){let e;try{if(e=gn&&(self.URL||self.webkitURL).createObjectURL(gn),!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(mn),{name:null==t?void 0:t.name})}}var bn="A page CSP that omits blob: from worker-src or script-src blocks it";function wn(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var _n,kn,Sn,Cn=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){nt(this,"pendingCanvasMutations",new Map),nt(this,"rafStamps",{latestId:0,invokeId:null}),nt(this,"mirror",void 0),nt(this,"mutationCb",void 0),nt(this,"resetObservers",void 0),nt(this,"frozen",!1),nt(this,"locked",!1),nt(this,"rafIdTimestamp",null),nt(this,"rafIdFlush",null),nt(this,"refCount",0),nt(this,"torndown",!1),nt(this,"resetFrameDedup",null),nt(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 wn("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=vn(e,n,i,!0),u=new Map;let c;try{c=new yn}catch(t){return wn(`disabled because the encode worker did not start. ${bn}`,t),void l()}let d=!1;c.onerror=t=>{var e;d=!0,wn(`stopped because the encode worker failed. ${bn}`,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=>{pe(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 Ke}if(void 0===o)return;if(!Array.isArray(o)||!o.every(tn))return Ke;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,wn("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,wn("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=vn(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=I(e.CanvasRenderingContext2D.prototype,a,function(s){return function(...o){return pe(this.canvas,n,i,!0)||setTimeout(()=>{let n;try{n=cn(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=ue(e.CanvasRenderingContext2D.prototype,a,{set(e){pe(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(...pn(e.WebGLRenderingContext.prototype,h.WebGL,t,n,i,e,r)),void 0!==e.WebGL2RenderingContext&&s.push(...pn(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)}},In=class{constructor(t){var e;nt(this,"trackedLinkElements",new WeakSet),nt(this,"pendingDeferredSheets",new Set),nt(this,"mutationCb",void 0),nt(this,"adoptedStyleSheetCb",void 0),nt(this,"maskAllElementAttributes",void 0),nt(this,"maskAttributeFn",void 0),nt(this,"styleMirror",new ke),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=mt(i))}catch(t){}if(!n||!i)return K(),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=R(),u=O();let c=!0;try{if(s)return a=!0,K(),!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?(K(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(K(),!0)}finally{c&&this.pendingDeferredSheets.delete(o),E(h=R()-l,null!=(d=u)?d:A)||(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=R();try{J(()=>{try{const t=e.rules||e.cssRules;t&&Z(t)}catch(t){}i.push({styleId:n,rules:Array.from(e.rules||CSSRule,(t,n)=>({rule:ct(t,e.href),index:n}))})})}finally{Q(R()-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(),Zt.forEach(t=>t.abort()),Zt.clear()}trackStylesheetInLinkElement(t){}},Mn=class{constructor(){nt(this,"nodeMap",new WeakMap),nt(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(){}},Rn=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var An;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(An=t.contentWindow)||void 0===An?void 0:An.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var xn=new gt,Tn=new Set([l.Mutation,l.MediaInteraction,l.StyleSheetRule,l.CanvasMutation,l.Font,l.Log,l.StyleDeclaration,l.AdoptedStyleSheet]);function On(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 En(t={}){let e;const{emit:n,checkoutEveryNms:r,checkoutEveryNth:s,blockClass:o="rr-block",blockSelector:u=null,ignoreClass:c="rr-ignore",ignoreSelector:h=null,maskTextClass:d="rr-mask",maskTextSelector:f=null,inlineStylesheet:v=!0,inlineStylesheetBudgetRules:p,maskAllInputs:m,maskInputOptions:g,slimDOMOptions:y,maskInputFn:b,maskTextFn:w,maskAllElementAttributes:_=!1,maskAttributeFn:k,hooks:S,packFn:C,sampling:I={},dataURLOptions:R={},canvasResolutionScale:A,canvasMasking:x,mousemoveWait:O,recordDOM:E=!0,recordCanvas:F=!1,recordCrossOriginIframes:D=!1,recordAfter:L=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:N=!1,collectFonts:P=!1,inlineImages:j=!1,plugins:B,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:W=new Set([]),attributeFilter:U,errorHandler:H}=t;Fe(H);const V=i({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},R),Z=!D||window.parent===window;let J=!1;if(!Z)try{window.parent.document&&(J=!1)}catch(t){J=!0}if(Z&&!n)throw new Error("emit function is required");if(!Z&&!J)return()=>{};void 0!==O&&void 0===I.mousemove&&(I.mousemove=O),xn.reset();const Q=!0===m?{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!==g?g:{password:!0},X=te(void 0!==y&&y);let K;!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 et=0;const nt=new Map;let it,rt;const st=t=>{for(const e of B||[])e.eventProcessor&&(t=e.eventProcessor(t));return C&&!J&&(t=C(t)),t};_n=(t,e)=>{var i;const o=t;if(o.timestamp=ce(),!(null===(i=Le[0])||void 0===i?void 0:i.isFrozen())||o.type===a.FullSnapshot||o.type===a.IncrementalSnapshot&&Tn.has(o.data.source)||Le.forEach(t=>t.unfreeze()),Z)null==n||n(st(o),e);else if(J){const t={type:"rrweb",event:st(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===a.FullSnapshot)K=o,et=0;else if(o.type===a.IncrementalSnapshot){if(o.data.source===l.Mutation&&o.data.isAttachIframe)return;et++,(s&&et>=s||r&&o.timestamp-K.timestamp>r)&&kn(!0)}};const ot=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=xn.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&n.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const i=ct.getIframeElementById(t);i&&n.has(i)?ct.forgetIframeId(t):(null==it||it(t),ct.removeIframeById(t))}),null==rt||rt(),ct.cleanupDetachedIframes()}_n({type:a.IncrementalSnapshot,data:i({source:l.Mutation},t)})},at=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.Scroll},t)}),lt=t=>_n({type:a.IncrementalSnapshot,data:i({source:l.CanvasMutation},t)}),ut=new In({mutationCb:ot,adoptedStyleSheetCb:t=>_n({type:a.IncrementalSnapshot,data:i({source:l.AdoptedStyleSheet},t)}),maskAllElementAttributes:_,maskAttributeFn:k}),ct=new Xe({mirror:xn,mutationCb:ot,stylesheetManager:ut,recordCrossOriginIframes:D,wrappedEmit:_n});for(const t of B||[])t.getMirror&&t.getMirror({nodeMirror:xn,crossOriginIframeMirror:ct.crossOriginIframeMirror,crossOriginIframeStyleMirror:ct.crossOriginIframeStyleMirror});const ht=new Mn,dt=null==x?void 0:x.configured;Sn=new Cn({recordCanvas:F,mutationCb:lt,win:window,blockClass:o,blockSelector:u,mirror:xn,sampling:I.canvas,dataURLOptions:V,resolutionScale:A,canvasMasking:x});const ft=new Ye({mutationCb:ot,scrollCb:at,bypassOptions:{blockClass:o,blockSelector:u,maskTextClass:d,maskTextSelector:f,inlineStylesheet:v,maskInputOptions:Q,dataURLOptions:V,maskTextFn:w,maskInputFn:b,maskAllElementAttributes:_,maskAttributeFn:k,recordCanvas:F,canvasMaskingConfigured:dt,inlineImages:j,sampling:I,slimDOMOptions:X,iframeManager:ct,stylesheetManager:ut,canvasManager:Sn,keepIframeSrcFn:z,processedNodeManager:ht,attributeFilter:U},mirror:xn});kn=(t=!1)=>{if(E){q(p);try{_n({type:a.Meta,data:{href:window.location.href,width:fe(),height:de()}},t),null==e||e.cancel(),e=void 0,ut.reset(),ft.init(),Le.forEach(t=>t.lock());let n=null,i=[];try{n=function(t,e){const{mirror:n=new gt,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:_,onIframeListenerRegistered:k,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=te(m);q(R);try{return Kt(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:_,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:I,newlyAddedElement:!1,maxDepth:M})}finally{G()}}(document,{mirror:xn,blockClass:o,blockSelector:u,maskTextClass:d,maskTextSelector:f,inlineStylesheet:v,maskAllInputs:Q,inlineStylesheetBudgetRules:p,maskTextFn:w,maskInputFn:b,maskAllElementAttributes:_,maskAttributeFn:k,slimDOM:X,dataURLOptions:V,recordCanvas:F,canvasMaskingConfigured:dt,inlineImages:j,onSerialize(t){be(t,xn)&&ct.addIframe(t),we(t,xn)&&ut.trackLinkElement(t),_e(t)&&ft.addShadowRoot(M.shadowRoot(t),document)},onIframeLoad(t,e){ct.attachIframe(t,e),ft.observeAttachShadow(t)},onIframeListenerRegistered(t,e){ct.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){ut.attachLinkElement(t,e)},keepIframeSrcFn:z})}finally{i=Y()}if(!n)return console.warn("Failed to snapshot the document");if(_n({type:a.FullSnapshot,data:{node:n,initialOffset:he(window)}},t),Le.forEach(t=>t.unlock()),Sn.onFullSnapshot(),i.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&&re(()=>{o=e.beginDeferredLinkInlining(n,xn.getId(n))})},u=()=>{if(!o)return;const t=o;let e=!0;re(()=>{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,tt(1)}e+=1}while(!i&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));i||(a()?r=On(h):n())};return r=On(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);tt(e),null==o||o.discard(),o=null}n()}}}(i,ut,()=>{e===t&&(e=void 0)});e=t}D&&ct.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ut.adoptStyleSheets(document.adoptedStyleSheets,xn.getId(document))}finally{G()}}};try{const t=[];t.push(ne("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(ne(e,T,document));it=e=>{const n=nt.get(e);n&&(n.forEach(e=>{re(e);const n=t.indexOf(e);-1!==n&&t.splice(n,1)}),nt.delete(e))},rt=()=>{for(const[t]of nt){const e=xn.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==it||it(t)}catch(e){null==it||it(t)}else null==it||it(t)}};const n=t=>{var e;return De(Ve)({mutationCb:ot,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:at,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:lt,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:o,ignoreClass:c,ignoreSelector:h,maskTextClass:d,maskTextSelector:f,maskInputOptions:Q,inlineStylesheet:v,sampling:I,recordDOM:E,recordCanvas:F,canvasMaskingConfigured:dt,inlineImages:j,userTriggeredOnInput:N,collectFonts:P,doc:t,maskInputFn:b,maskTextFn:w,maskAllElementAttributes:_,maskAttributeFn:k,keepIframeSrcFn:z,blockSelector:u,slimDOMOptions:X,dataURLOptions:V,mirror:xn,iframeManager:ct,stylesheetManager:ut,shadowDomManager:ft,processedNodeManager:ht,canvasManager:Sn,ignoreCSSAttributes:W,attributeFilter:U,plugins:(null==B||null===(e=B.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}})})))||[]},S)};ct.addLoadListener(e=>{try{const i=xn.getId(e),r=n(e.contentDocument);if("function"==typeof r&&(t.push(r),-1!==i)){let t=nt.get(i);t||(t=new Set,nt.set(i,t)),t.add(r)}}catch(t){console.warn(t)}}),ct.addPageHideListener(t=>{const e=xn.getId(t);null==it||it(e),Be(t)});let r=-1;const s=t=>_n({type:a.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),p=()=>{var t,e,n,i;const o=document,a=null!==(t=null!==(e=null!==(n=null!==(i=o.fullscreenElement)&&void 0!==i?i:o.webkitFullscreenElement)&&void 0!==n?n:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,l=a?xn.getId(a):-1;l!==r&&(-1!==r&&s({id:r,enter:!1}),r=l,-1!==l&&s({id:l,enter:!0}))},m=()=>{kn();const e=n(document);"function"==typeof e&&t.push(e),t.push(ne("fullscreenchange",p)),t.push(ne("webkitfullscreenchange",p)),t.push(ne("mozfullscreenchange",p)),t.push(ne("MSFullscreenChange",p)),Rn=!0};return["interactive","complete"].includes(document.readyState)?m():(t.push(ne("DOMContentLoaded",()=>{_n({type:a.DomContentLoaded,data:{}}),"DOMContentLoaded"===L&&m()})),t.push(ne("load",()=>{_n({type:a.Load,data:{}}),"load"===L&&m()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,se(t),ht.destroy(),ct.removeLoadListener(),ct.destroy(),nt.clear(),ft.reset(),xn.reset(),Rn=!1,$e()}}catch(t){console.warn(t)}}En.addCustomEvent=(t,e)=>{if(!Rn)throw new Error("please add custom event after start recording");_n({type:a.Custom,data:{tag:t,payload:e}})},En.freezePage=()=>{Le.forEach(t=>t.freeze())},En.takeFullSnapshot=t=>{if(!Rn)throw new Error("please take full snapshot after start recording");kn(t)},En.mirror=xn,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Fn=Object.create(null);function $n(t){return $n="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},$n(t)}function Dn(t,e,n){return(e=function(t){var e=function(t){if("object"!=$n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$n(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Fn.Node=Object.create(null),Fn.ShadowRoot=Object.create(null),Fn.MutationObserver=Object.create(null),Fn.Element=Object.create(null);var Ln=class{constructor(t){Dn(this,"fileName",void 0),Dn(this,"functionName",void 0),Dn(this,"lineNumber",void 0),Dn(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}`}},Nn=/(^|@)\S+:\d+/,Pn=/^\s*at .*(\S+:\d+|\(native\))/m,jn=/^(eval@)?(\[native code])?$/,Bn={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Pn)?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(Pn)},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 Ln({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(jn)},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 Ln({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(t.replace(e,""));return new Ln({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 Ln({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 Ln({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(Nn)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),n=this.extractLocation(e.pop());return new Ln({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function zn(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 Wn(t){return Array.isArray(t)}function Un(t){return"object"==typeof t&&null!==t&&!Wn(t)}function Hn(t,e){if(0===e)return!0;const n=Object.keys(t);for(const i of n)if(Un(t[i])&&Hn(t[i],e-1))return!0;return!1}function qn(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(Un(s=e)&&Object.keys(s).length>n.numOfKeysLimit||"function"==typeof s||Un(s)&&Hn(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]=Wn(i)?zn(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 Gn={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 Vn(t,e,n){const i=n?Object.assign({},Gn,n):Gn,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:Bn.parse(e.error).map(t=>t.toString()),payload:[qn(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=[qn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[qn("Uncaught (in promise)",i.stringifyOptions),qn(e.reason,i.stringifyOptions)]),t({level:"error",trace:Bn.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=Bn.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===n?s.slice(1):s).map(t=>qn(t,i.stringifyOptions));o++,i.lengthThreshold>o?t({level:n,trace:e,payload:r}):o===i.lengthThreshold&&t({level:"warn",trace:[],payload:[qn("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 Zn="u">typeof window?window:void 0,Jn="u">typeof globalThis?globalThis:Zn,Qn=null==Jn?void 0:Jn.document,Xn=null==Jn?void 0:Jn.location;null!=Jn&&Jn.XMLHttpRequest&&new Jn.XMLHttpRequest;const Yn="undefined"!=typeof globalThis?globalThis:Zn;Yn&&"undefined"==typeof self&&(Yn.self=Yn),Yn&&"undefined"==typeof File&&(Yn.File=function(){});const Kn=null!=Zn?Zn:{},ti=Object.prototype,ei=ti.hasOwnProperty,ni=ti.toString,ii=Array.isArray||function(t){return"[object Array]"===ni.call(t)},ri=t=>"function"==typeof t,si=t=>t===Object(t)&&!ii(t),oi=t=>void 0===t,ai=t=>"[object String]"==ni.call(t),li=t=>null===t,ui=t=>oi(t)||li(t),ci=t=>"[object Number]"==ni.call(t)&&t==t,hi=t=>"[object Boolean]"===ni.call(t),di=t=>t instanceof FormData;function fi(t,e,n,i,r){return e>n&&(i.warn("min cannot be greater than max."),e=n),ci(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),fi(null!=r?r:n,e,n,i))}var vi=class{constructor(t){this.C={},this.I=t.I,this.R=fi(t.bucketSize,0,100,t.$),this.A=fi(t.refillRate,0,this.R,t.$),this.O=fi(t.refillInterval,0,864e5,t.$)}F(t,e){const n=Math.floor((e-t.lastAccess)/this.O);n>0&&(t.tokens=Math.min(t.tokens+n*this.A,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 pi(t){return t?t.split("#")[0]:t}const mi="NativeGzipValidationError";let gi;const yi=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}(mi,`Native gzip produced invalid output: ${t}`)},bi=(wi=s(function*(t,e){18>t.size&&yi("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])&&yi("invalid-header");const r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{const e=(()=>{if(gi)return gi;gi=[];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;gi[t]=e>>>0}return gi})();let n=4294967295;for(let i=0;t.length>i;i++)n=e[255&(n^t[i])]^n>>>8;return(4294967295^n)>>>0})(e)&&yi("invalid-crc");const s=e.length>>>0;r.getUint32(4,!0)!==s&&yi("invalid-size")}),function(t,e){return wi.apply(this,arguments)});var wi;function _i(){return _i=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 bi(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}),_i.apply(this,arguments)}const ki="0.9.0",Si={DEBUG:!1,LIB_VERSION:ki,LIB_NAME:"browser-common",JS_SDK_VERSION:ki},Ci=(t,{debugEnabled:e}={})=>{const n={N(n,...i){Zn&&(Si.DEBUG||Zn.POSTHOG_DEBUG||e)&&!oi(Zn.console)&&Zn.console&&("__rrweb_original__"in Zn.console[n]?Zn.console[n].__rrweb_original__:Zn.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)=>Ci(`${t} ${e}`,n)};return n},Ii=Ci("[PostHog.js]"),Mi=Ii.createLogger;function Ri(t,e){if(!ui(t))if(ii(t))t.forEach(e);else if(di(t))t.forEach((t,n)=>e(t,n));else for(const n in t)ei.call(t,n)&&e(t[n],n)}function Ai(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 xi=["localhost","127.0.0.1"],Ti=t=>{const e=null==Qn?void 0:Qn.createElement("a");return oi(e)?null:(e.href=t,e)},Oi=()=>{},Ei=t=>{var e;if(ri(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Fi(t,e,n){try{if(!(e in t))return Oi;const i={next:t[e]},r=n(function(...t){return i.next.apply(this,t)});return ri(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=Ei(n);for(;s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=Ei(n)}}}catch(t){return Oi}}function $i(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 Di(t){var e;const n=null==Zn||null===(e=Zn.location)||void 0===e?void 0:e.href;return oi(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(!ri(i))return e;try{const t=i(e);return ai(t)&&t?t:e}catch(t){return Ii.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,n)}const Li=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}))$"),Ni=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Pi=[16,15,14,13],ji=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Bi=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),zi=/[0-9A-Za-z_]/;function Wi(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 Ui=1e6;function Hi(t){var e;return Math.min(Ui,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Ui)}const qi={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:Ui,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},Gi=["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"],Vi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Zi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Ji=t=>{ui(t)||Ri(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Gi.includes(e)||Zi.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Qi=["/s/","/e/","/i/"];function Xi(t,e,n,i){if(ui(t))return t;let r=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ai(r)&&(r=parseInt(r)),r>n?`[SessionRecording] ${i} body too large to record (${r} bytes)`:t}function Yi(t,e){if(ui(t))return t;let n=t;return function(t,e=!0){if(ui(t))return!1;if(ai(t)){if(t=t.trim(),e?Li.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Ni.lastIndex=0;e=Ni.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 Pi){const i=t+e;if(n.length>=i){const e=n.slice(t,i);if(Li.test(e)&&Wi(e))return!0}}}return!1}(t))return!1;if(e?ji.test(t):function(t){let e;for(Bi.lastIndex=0;e=Bi.exec(t);){const t=e[1],n=e[3];if(!(t&&n&&zi.test(t)&&zi.test(n)))return!0}return!1}(t))return!1}return!0}(n,!1)||(n="[SessionRecording] "+e+" body redacted"),Ri(Vi,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 Ki=new WeakSet,tr=Mi("[Recorder]"),er=t=>"navigation"===t.entryType,nr=t=>"resource"===t.entryType,ir=()=>{};function rr(t,e){var n;return er(e)&&"complete"===(null===(n=t.document)||void 0===n?void 0:n.readyState)&&e.loadEventEnd>0}function sr(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(n=>rr(t,n)||nr(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=>rr(t,e))}(t):[]}function or(t,e){return!!e&&(hi(e)||e[t])}function ar(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 lr=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function ur({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:!!ar(e)&&t(e.url)}catch(t){return!1}}(i))return!1;if(r(lr))return!1;if(hi(e))return!0;if(ii(e))return r(e);const s=e[t];return hi(s)?s:r(s)}function cr(t,e,n,i,r){return hr.apply(this,arguments)}function hr(){return hr=s(function*(t,e,n,i,r,s=0){if(s>10)return tr.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=>nr(t)&&t.initiatorType===e&&(oi(i)||t.startTime>=i)&&(oi(r)||r>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*s)),cr(t,e,n,i,r,s+1))}),hr.apply(this,arguments)}function dr({body:t,options:e,url:n}){if(ui(t))return null;const{hostname:i,isHostDenied:r}=$i(n,e);if(r)return i+" is in deny list";if(ai(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(di(t))return function(t,e="&"){let n,i;const r=[];return Ri(t,function(t,e){oi(t)||oi(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(si(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 fr=t=>!li(t)&&("navigation"===t.entryType||"resource"===t.entryType);function vr(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?e.toJSON():{name:u}),{},{startTime:oi(a)?void 0:Math.round(a),endTime:oi(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(fr(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 pr=["video/","audio/"];function mr(t){return si(t)&&ri(t.getReader)&&ri(t.tee)}const gr="[SessionReplay] Timeout while trying to read body",yr="[SessionReplay] Failed to read body";function br(t){return`${yr}: ${t}`}function wr(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function _r(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const n=setTimeout(()=>e(gr),500);try{t.clone().text().then(t=>e(t),t=>e(br(t))).finally(()=>clearTimeout(n))}catch(t){clearTimeout(n),e(yr)}})}(t);const n=Hi(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(wr(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(gr),500);let l;try{l=t.clone()}catch(t){return void o(yr)}const u=l.body;if(!mr(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(br(t)))}catch(t){o(yr)}return}try{i=u.getReader()}catch(t){return void o(yr)}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(wr(e));h+=i.byteLength,c.push(i)}t()}},t=>o(br(t)))}()})}(t,n)}function kr(){return(kr=s(function*({r:t,options:e,url:n}){const{hostname:i,isHostDenied:r}=$i(n,e);return r?Promise.resolve(i+" is in deny list"):_r(t,e)})).apply(this,arguments)}function Sr(){return(Sr=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=pr.some(t=>null==r?void 0:r.startsWith(t));if(r&&s)return`Content-Type ${r} is not supported`;const{hostname:o,isHostDenied:a}=$i(n,e);return a?o+" is in deny list":null}({r:t,options:e,url:n});return li(i)?_r(t,e):Promise.resolve(i)})).apply(this,arguments)}let Cr=null;function Ir(t,e,n){if(!("performance"in e))return()=>{};if(Cr)return tr.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},qi,n):qi;let o=!0;const a=e=>{if(!o)return;const n=[];let s=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&s)return;const i=r.maskRequestFn(t);e||(s=!i||(t=>!!t&&Ki.has(t))(i)),i&&n.push(i)}),n.length>0&&t(i(i({},e),{},{requests:n}))},l=function(t,e,n){try{t({requests:sr(e,n).flatMap(t=>vr(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){tr.error("Failed to capture initial performance entries for network capture",t)}const i=e.PerformanceObserver,r=null==i?void 0:i.supportedEntryTypes;if(!i||!ii(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=>er(t)||nr(t)&&n.initiatorTypes.includes(t.initiatorType)&&(t=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>vr(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:s}),()=>{o.disconnect()}}(a,e,r),u=r.recordHeaders||r.recordBody;if(!l&&!u)return o=!1,ir;let c=()=>{},h=()=>{};return u&&(c=function(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=or("request",n.recordHeaders),r=or("response",n.recordHeaders),s=Fi(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=>(ur({type:"request",headers:d,url:a,recordBody:n.recordBody})&&(l.requestBody=dr({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),ur({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(l.responseBody=dr({body:h.response,options:n,url:a})),cr(e,"xmlhttprequest",s.url,u,c).then(n=>{t({requests:vr(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){tr.error("Failed to instrument XHR for network capture",t)}s.call(h,o,a.toString(),l,u,c)});return()=>{s()}}(a,e,r),h=function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=or("request",n.recordHeaders),r=or("response",n.recordHeaders),o=Fi(e,"fetch",o=>function(){var a=s(function*(s,a){let l,u;try{l=new Request(s,a)}catch(t){return tr.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),!mr(null==a?void 0:a.body)&&ur({type:"request",headers:t,url:s,recordBody:n.recordBody})&&(c.requestBody=yield function(t){return kr.apply(this,arguments)}({r:l,options:n,url:s}))}catch(t){tr.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=ar(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),ur({type:"response",headers:t,url:s,recordBody:n.recordBody})&&(c.responseBody=yield function(t){return Sr.apply(this,arguments)}({r:u,options:n,url:s}))}catch(t){tr.error("Failed to record fetch response for network capture",t)}return u}finally{cr(e,"fetch",l.url,h,d).then(n=>{t({requests:vr(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()}}(a,e,r)),Cr=()=>{o=!1,null==l||l(),c(),h(),Cr=null},Cr}const Mr="$replay_override_sampling",Rr="$replay_override_linked_flag",Ar="$replay_override_url_trigger",xr="$replay_override_event_trigger",Tr="$session_is_sampled",Or="$session_recording_url_trigger_activated_session",Er="$session_recording_event_trigger_activated_session",Fr="$posthog_sr_group_event_trigger_",$r="$posthog_sr_group_url_trigger_",Dr="$sess_rec_flush_size",Lr="$stored_person_properties",Nr="$sdk_debug_replay_event_trigger_status",Pr="$sdk_debug_replay_linked_flag_trigger_status",jr="$sdk_debug_replay_matched_recording_trigger_groups",Br="$sdk_debug_replay_pending_trigger_conditions",zr="$sdk_debug_replay_remote_trigger_matching_config",Wr="$sdk_debug_replay_trigger_groups_count",Ur="$sdk_debug_replay_url_trigger_status",Hr="$sdk_debug_rrweb_attached",qr="$sdk_debug_rrweb_start_attempted",Gr="$session_recording_start_reason",Vr="disabled",Zr="sampled",Jr="active",Qr="buffering",Xr="paused",Yr="rrweb_error",Kr="trigger_activated",ts="trigger_pending",es="trigger_disabled";function ns(t,e,n,i,r,s){return 0===e?es:(null==t?void 0:t.get_property(n?i+n:r))===s?Kr:ts}function is(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 rs(t){return t.includes("trigger_activated")?Kr:t.includes("trigger_pending")?ts:es}function ss(t){const e=new Set(t);switch(e.delete(es),e.size){case 0:return es;case 1:return Array.from(e)[0];default:return ts}}var os=class{constructor(t){this.q=t}triggerStatus(t){return rs(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return rs(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},as=class{constructor(t){this.q=t}triggerStatus(t){return ss(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return ss(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},ls=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return Kr}stop(){}};const us=t=>"sessionRecording"in t;var cs=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=(us(t)?si(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(us(t)?si(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){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){Ii.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){Ii.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return ns(this._instance,this.j.length,this.V,$r,Or,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Ur]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=Di(this._instance);if(!t)return!1;try{return is(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const n=Di(this._instance);if(!n)return;if(n===this.W)return;this.W=n;const i=this.urlBlocked,r=is(n,this.B,this.U);i&&r||(r&&!i?t():!r&&i&&e())}checkUrlTriggerConditions(t,e,n,i){const r=Di(this._instance);if(!r)return;if(r===this.W)return;this.W=r;const s=this.urlBlocked,o=is(r,this.B,this.U);o&&!s?t():!o&&s&&e();const a=this.G(i)===Kr,l=is(r,this.j,this.H);!a&&l&&n("url",r)}stop(){this.W=""}},hs=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({[Pr]:t}),t}triggerStatusNoSideEffects(){let t=ts;return ui(this.linkedFlag)&&(t=es),this.linkedFlagSeen&&(t=Kr),t}onConfig(t,e){var n;if(this.linkedFlag=(us(t)?si(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!ui(this.linkedFlag)&&!this.linkedFlagSeen){const t=ai(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ai(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((i,r)=>{let s=!1;if(si(r)&&t in r){const e=r[t];s=hi(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()}},ds=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(us(t)?si(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 ns(this._instance,this.K.length,this.V,Fr,Er,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Nr]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,n){if(0===this.K.length)return;const i=this.X(n)===Kr,r=this.K.includes(t);!i&&r&&e("event",t)}stop(){}},fs=class{constructor(t,e,n){if(this._instance=t,this.group=e,this.Y=new cs(t,e.id),this.tt=new ds(t,e.id),this.et=new hs(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 os(r):new as(r)}else this.nt=new ls}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===ts).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?$r+this.group.id:Fr+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 vs(t){if(t.rrwebError)return Yr;if(!t.receivedFlags)return Qr;if(!t.isRecordingEnabled)return Vr;if(t.urlTriggerMatching.urlBlocked)return Xr;const e=!0===t.isSampled,n=new os([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Zr:"trigger_activated"===n?Jr:"trigger_pending"===n?Qr:!1===t.isSampled?Vr:Jr}function ps(t){if(t.rrwebError)return Yr;if(!t.receivedFlags)return Qr;if(!t.isRecordingEnabled)return Vr;if(t.urlTriggerMatching.urlBlocked)return Xr;const e=new as([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==es,i=hi(t.isSampled);return n&&"trigger_pending"===e?Qr:n&&"trigger_disabled"===e||i&&!t.isSampled?Vr:!0===t.isSampled?Zr:Jr}function ms(){const t=[];return function(e,n){if(si(n)||ii(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n}}function gs(t){try{const e=JSON.stringify(t,ms());return e?new Blob([e]).size:0}catch(t){return-1}}function ys(t){if(li(t))return 4;if(oi(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(ii(t)){let e=2;for(let n=0;t.length>n;n++){n>0&&(e+=1);const i=t[n];e+=oi(i)||li(i)?4:ys(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];oi(r)||(i||(n+=1),i=!1,n+=t.length+3+ys(r))}return n}default:return 0}}function bs(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[bs({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:n,sessionId:t.sessionId,windowId:t.windowId}),bs({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 ws=Uint8Array,_s=Uint16Array,ks=Uint32Array,Ss=new ws([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]),Cs=new ws([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]),Is=new ws([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ms=function(t,e){for(var n=new _s(31),i=0;31>i;++i)n[i]=e+=1<<t[i-1];var r=new ks(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]},Rs=Ms(Ss,2),As=Rs[1];Rs[0][28]=258,As[258]=28;for(var xs=Ms(Cs,0)[1],Ts=new _s(32768),Os=0;32768>Os;++Os){var Es=(43690&Os)>>>1|(21845&Os)<<1;Ts[Os]=((65280&(Es=(61680&(Es=(52428&Es)>>>2|(13107&Es)<<2))>>>4|(3855&Es)<<4))>>>8|(255&Es)<<8)>>>1}var Fs=function(t,e,n){for(var i=t.length,r=0,s=new _s(e);i>r;++r)++s[t[r]-1];var o,a=new _s(e);for(r=0;e>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new _s(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[Ts[h]>>>l]=u}else for(o=new _s(i),r=0;i>r;++r)o[r]=Ts[a[t[r]-1]++]>>>15-t[r];return o},$s=new ws(288);for(Os=0;144>Os;++Os)$s[Os]=8;for(Os=144;256>Os;++Os)$s[Os]=9;for(Os=256;280>Os;++Os)$s[Os]=7;for(Os=280;288>Os;++Os)$s[Os]=8;var Ds=new ws(32);for(Os=0;32>Os;++Os)Ds[Os]=5;var Ls=Fs($s,9,0),Ns=Fs(Ds,5,0),Ps=function(t){return(t/8|0)+(7&t&&1)},js=function(t,e,n){(null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof _s?_s:t instanceof ks?ks:ws)(n-e);return i.set(t.subarray(e,n)),i},Bs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8},zs=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8,t[i+2]|=n>>>16},Ws=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 ws(0),0];if(1==r){var o=new ws(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 _s(d+1),v=Us(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 ws(f),v]},Us=function(t,e,n){return-1==t.s?Math.max(Us(t.l,e,n+1),Us(t.r,e,n+1)):e[t.s]=n},Hs=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new _s(++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]},qs=function(t,e){for(var n=0,i=0;e.length>i;++i)n+=t[i]*e[i];return n},Gs=function(t,e,n){var i=n.length,r=Ps(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)},Vs=function(t,e,n,i,r,s,o,a,l,u,c){Bs(e,c++,n),++r[256];for(var h=Ws(r,15),d=h[0],f=h[1],v=Ws(s,15),p=v[0],m=v[1],g=Hs(d),y=g[0],b=g[1],w=Hs(p),_=w[0],k=w[1],S=new _s(19),C=0;y.length>C;++C)S[31&y[C]]++;for(C=0;_.length>C;++C)S[31&_[C]]++;for(var I=Ws(S,7),M=I[0],R=I[1],A=19;A>4&&!M[Is[A-1]];--A);var x,T,O,E,F=u+5<<3,D=qs(r,$s)+qs(s,Ds)+o,L=qs(r,d)+qs(s,p)+o+14+3*A+qs(S,M)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return Gs(e,c,t.subarray(l,l+u));if(Bs(e,c,1+(D>L)),c+=2,D>L){x=Fs(d,f,0),T=d,O=Fs(p,m,0),E=p;var N=Fs(M,R,0);for(Bs(e,c,b-257),Bs(e,c+5,k-1),Bs(e,c+10,A-4),c+=14,C=0;A>C;++C)Bs(e,c+3*C,M[Is[C]]);c+=3*A;for(var P=[y,_],j=0;2>j;++j){var B=P[j];for(C=0;B.length>C;++C)Bs(e,c,N[z=31&B[C]]),c+=M[z],z>15&&(Bs(e,c,B[C]>>>5&127),c+=B[C]>>>12)}}else x=Ls,T=$s,O=Ns,E=Ds;for(C=0;a>C;++C)if(i[C]>255){var z;zs(e,c,x[257+(z=i[C]>>>18&31)]),c+=T[z+257],z>7&&(Bs(e,c,i[C]>>>23&31),c+=Ss[z]);var W=31&i[C];zs(e,c,O[W]),c+=E[W],W>3&&(zs(e,c,i[C]>>>5&8191),c+=Cs[W])}else zs(e,c,x[i[C]]),c+=T[i[C]];return zs(e,c,x[256]),c+T[256]},Zs=new ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Js=new ws(0),Qs=function(){for(var t=new ks(256),e=0;256>e;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Xs=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function Ys(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=Qs[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 ws(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=Gs(l,u,t.subarray(c,h)):(l[c]=s,u=Gs(l,u,t.subarray(c,o)))}else{for(var d=Zs[e-1],f=d>>>13,v=8191&d,p=(1<<n)-1,m=new _s(32768),g=new _s(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},_=new ks(25e3),k=new _s(288),S=new _s(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=Vs(t,l,0,_,k,S,I,M,A,c-A,u),M=C=I=0,A=c;for(var F=0;286>F;++F)k[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,B=Math.min(32767,c),z=Math.min(258,E);B>=P&&--N&&T!=O;){if(t[c+D]==t[c+D-P]){for(var W=0;z>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),H=0;for(F=0;U>F;++F){var q=c-P+F+32768&32767,G=q-m[q]+32768&32767;G>H&&(H=G,O=q)}}}P+=(T=O)-(O=m[T])+32768&32767}if(L){_[M++]=268435456|As[D]<<18|xs[L];var V=31&As[D],Z=31&xs[L];I+=Ss[V]+Cs[Z],++k[257+V],++S[Z],R=c+D,++C}else _[M++]=t[c],++k[t[c]]}}u=Vs(t,l,s,_,k,S,I,M,A,c-A,u),s||(u=Gs(l,u,Js))}return js(a,0,i+Ps(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&&Xs(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),Xs(c,h-8,n.d()),Xs(c,h-4,i),c}function Ks(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 to=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=ys(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 vi({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,$:Ii}),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=ci(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 ci(t)&&isFinite(t)&&Math.floor(t)===t}),Zn&&!oi(Zn.crypto)&&crypto;let eo=null;const no={Et(){if(!li(eo))return eo;if(eo=!0,oi(Zn))eo=!1;else try{const t="__support__";no.At(t,"xyz"),'"xyz"'!==no.Ot(t)&&(eo=!1),no.Lt(t)}catch(t){eo=!1}return eo},Pt(t){Ii.error("sessionStorage error: ",t)},Ot(t){try{return null==Zn?void 0:Zn.sessionStorage.getItem(t)}catch(t){no.Pt(t)}return null},Dt(t){try{return JSON.parse(no.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==Zn||Zn.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){no.Pt(t)}return!1},Lt(t){try{null==Zn||Zn.sessionStorage.removeItem(t)}catch(t){no.Pt(t)}}};Si.DEBUG=!1,Si.LIB_VERSION="1.434.13",Si.LIB_NAME="web";var io=Si,ro=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(Dr,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(Dr);return si(n=e)&&ai(n.sessionId)&&ci(n.size)&&e.sessionId===t?e.size:0;var n}};function so(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<fi(100*e,0,100,Ii)}const oo=(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}},ao=t=>t.toLowerCase(),lo={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=>oo(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!oo(e,t))),icontains:(t,e)=>e.map(ao).some(e=>t.map(ao).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(ao).every(e=>t.map(ao).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))})},uo=new Set(["is_not","not_icontains","not_regex"]);function co(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(oi(r)||li(r))return uo.has(s);const o=lo[s];return!!o&&!oi(t.value)&&!li(t.value)&&o(ii(t.value)?t.value.map(String):[String(t.value)],ii(r)?r.map(String):[String(r)])})}const ho=Mi("[SessionRecording]");function fo(t,e){return e?t:"!"+t}function vo(t,e){return t===e||t!=="!"+e&&null}var po=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.Ht=null,this.zt=ps}onRemoteConfig(t){this.Ht=ci(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new os([this.tt,this.Y]),this.zt=vs):(this.Ut=new as([this.tt,this.Y]),this.zt=ps),this._instance.register_for_session({[zr]: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.zt({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 ci(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&&ui(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,n,e)}catch(t){ho.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const n=this.Ht;var i,r;if(!ci(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(Tr),o=this._instance.get_property("$replay_sample_rate"),a=vo(s,t),l=ci(o)&&o!==n,u=oi(o)&&s===t,c=l||u||!hi(a),h=c?so(t,n):a;c&&(h?this.qt("sampled"):ho.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:fo(t,h),$replay_sample_rate:li(o)&&s===t?null:n})}ensureSamplingDecision(t){if(!ci(this.Ht))return;const e=this._instance.get_property(Tr);hi(vo(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))===ts}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===ts).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()}},mo=class{constructor(t,e,n,i,r){this._instance=t,this.Y=e,this.qt=n,this.Vt=i,this.Bt=r,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[zr]:"v2_trigger_groups",[Wr]:t.triggerGroups.length}),this.Y.onConfig(t)):ho.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Yr;if(!t.receivedFlags)return Qr;if(!t.isRecordingEnabled)return Vr;if(t.urlTriggerMatching.urlBlocked)return Xr;const e=t.triggerGroupMatchers,n=t.triggerGroupSamplingResults;if(0===e.length)return Vr;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);oi(e)?Ii.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(r=!0)}else"trigger_pending"===e&&(i=!0)}return r?Zr:i?Qr:Vr}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const n of this.Zt)if("trigger_activated"===n.triggerStatus(t)){const t=n.group.minDurationMs;ci(t)&&(li(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,n,i){this.Y.checkUrlBlocklist(e,n);for(const i of this.Zt)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.Qt)return ho.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.Zt)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(Lr);r.some(e=>!e.properties||0===e.properties.length||co(e.properties,t.properties,s))&&(n.activateTrigger(i,e),this.updateActiveTriggers(e),this.Bt(i))},e)}catch(t){ho.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const n of this.Zt){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(si(a)){const e=a.sessionId,n=a.sampleRate,i=a.sampled;u="string"==typeof e&&e!==t,c=ci(n)&&n!==s,l=e===t&&ci(n)&&n===s&&hi(i)?i:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!hi(l),f=d?so(t+r,s):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:r,group_name:i.name,sampleRate:s,isSampled:f}),this.Gt.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.Qt=!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.Zt){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.Zt){const i=n.group,r=i.id,s="trigger_activated"===n.triggerStatus(t),o=!0===this.Gt.get(r);s&&e.push({id:r,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[jr]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.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.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const n=t.group.conditions.properties;return!n||0===n.length||co(n,e,this._instance.get_property(Lr))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new fs(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.Zt.push(t)}}};const go=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],yo=1e5,bo=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,wo=[],_o=()=>!1,ko="@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(" "),So="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Co="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(" "),Io="Accommodation AdministrativeArea Country Place State".split(" "),Mo={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:So,publisher:Co},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:wo},Offer:{seller:Co},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:Co,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Co,areaServed:Io,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:wo}},Ro=[["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(" "),Mo.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Mo.Event],[Co,Mo.Organization],[Io,Mo.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Mo.Product]];function Ao(t,e){return ei.call(t,e)?t[e]:void 0}function xo(t){const e=typeof t;return li(t)||"string"===e||"number"===e||"boolean"===e}function To(t,e){return e&&function(t){return ai(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Oo(t,e){return ii(t)&&t.every(xo)?t.map(t=>To(t,e)).filter(t=>!oi(t)):xo(t)?To(t,e):void 0}function Eo(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 Fo(t){if(ei.call(Mo,t))return Mo[t];for(const[e,n]of Ro)if(e.includes(t))return n}function $o(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Do(t,e,n,i){if(ii(t)){const r=t.map(t=>Do(t,e,n,i)).filter(t=>!oi(t));return r.length?r:void 0}return Lo(t,e,n,i)||void 0}function Lo(t,e,n,i){if(!si(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(n))return null;const r=Ao(t,"@type"),s=function(t){const e=new Set,n="string"==typeof t?[t]:ii(t)?t:[],i=[];for(const t of n){if("string"!=typeof t)continue;const n=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&bo.test(n)&&!e.has(n)&&(e.add(n),i.push(n),20===i.length))break}return i}(r),o=s.filter(t=>!!Fo(t)&&(!i||!i.length||i.includes(t))),a={};for(const i of ko){const o="@type"===i?s.length?"string"==typeof r?s[0]:s:void 0:"@id"===i?Eo(Ao(t,i),e):Oo(Ao(t,i),n.maskUrl);oi(o)||$o(a,i,o)}for(const i of o){const r=Fo(i);for(const i of Object.keys(r)){const s=Ao(t,i),o=r[i];if(!0===o){const t=Oo(s,n.maskUrl);oi(t)||$o(a,i,t)}else{const t=Do(s,e,n,o);oi(t)||$o(a,i,t)}}}const l=Do(Ao(t,"@graph"),e,n);return oi(l)||$o(a,"@graph",l),Object.keys(a).length?a:null}function No(t,e,n){if(!si(t))return null;const r=Ao(t,"@context");if("string"!=typeof r||!/^https?:\/\/schema\.org\/?$/.test(r))return null;const s=Lo(t,e,n);return s?i({"@context":"https://schema.org"},s):null}function Po(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function jo(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 Bo(t,e,n){for(let i=t;i;){if(jo(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 zo(t){return Po(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Po)}function Wo(t){return oi(t)?void 0:Math.round(t)}function Uo(t){return si(t)?t.network_timing:t}const Ho=Mi("[SessionRecording]"),qo=[1,2,3,4,5,6,7,12],Go=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Vo(){var t;return null==Kn||null===(t=Kn.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function Zo(){var t;return null===(t=Vo())||void 0===t?void 0:t.record}function Jo(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,ms())}}function Qo(t){return Ks(Ys(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new ws(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 ws(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 js(n,0,i)}(Jo(t))),!0)}function Xo(t){return Yo.apply(this,arguments)}function Yo(){return Yo=s(function*(t){const e=yield function(t){return _i.apply(this,arguments)}(Jo(t),io.DEBUG,{rethrow:!0});return Ks(new Uint8Array(yield e.arrayBuffer()),!0)}),Yo.apply(this,arguments)}let Ko,ta;const ea="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let na=!1;function ia(t){var e;return ii(t)&&0===t.length?(Ko=null!==(e=Ko)&&void 0!==e?e:Qo([]),Ko):Qo(t)}function ra(t){return sa.apply(this,arguments)}function sa(){return(sa=s(function*(t){var e;return ii(t)&&0===t.length?Ko||(ta=null!==(e=ta)&&void 0!==e?e:Xo([]).then(t=>(Ko=t,t)).catch(t=>{throw Ko=void 0,ta=void 0,t}),ta):Xo(t)})).apply(this,arguments)}function oa(t){return ea&&!na&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function aa(t){return{event:t,size:ys(t)}}function la(t,e){return i(i({},t),{},{data:e,cv:"2024-10"})}function ua(t,e){return i(i({},t),{},{cv:"2024-10",data:i(i({},t.data),e)})}function ca(t){try{if(2===t.type)return aa(la(t,Qo(t.data)));if(3===t.type&&0===t.data.source)return aa(ua(t,{texts:ia(t.data.texts),attributes:ia(t.data.attributes),removes:ia(t.data.removes),adds:ia(t.data.adds)}));if(3===t.type&&8===t.data.source)return aa(ua(t,{adds:t.data.adds?Qo(t.data.adds):void 0,removes:t.data.removes?Qo(t.data.removes):void 0}))}catch(t){Ho.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:gs(t)}}function ha(){return(ha=s(function*(t){try{if(2===t.type)return aa(la(t,yield Xo(t.data)));if(3===t.type&&0===t.data.source){const[e,n,i,r]=yield Promise.all([ra(t.data.texts),ra(t.data.attributes),ra(t.data.removes),ra(t.data.adds)]);return aa(ua(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?Xo(t.data.adds):void 0,t.data.removes?Xo(t.data.removes):void 0]);return aa(ua(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===mi})(e)&&(na=!0),Ho.warn("could not compress event asynchronously - trying synchronous compression",e),ca(t)}return{event:t,size:gs(t)}})).apply(this,arguments)}function da(t,e){return 5===t.type&&t.data.tag===e}function fa(t){return da(t,"sessionIdle")}function va(t){return da(t,"$session_ending")}function pa(t){return da(t,"$session_starting")}var ma=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 vo(this._instance.get_property(Tr),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return ci(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.Me=!1,this.Ie=!1,this.Te=!1,this.Re=[],this.$e=void 0,this.Ee=void 0,this.Ae=!1,this.Oe=[],this.Le=0,this.Pe=0,this.De=!1,this.Fe=void 0,this.Wt=void 0,this.Ne=void 0,this.qe=void 0,this.je=void 0,this.Be=(t,e,n)=>{var i,r,s,o;if(!n)return;if(t===this.Xt&&e===this.He)return;const a=!n.noSessionId&&(n.activityTimeout||n.sessionPastMaximumLength),l=this.Xt,u=this.He;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.ze)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),this.Se=!1,null===(r=Vo())||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.Ue(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.He===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.We(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.Ve=!1,this.Ze=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$session_past_minimum_duration)===this.Xt},this.Ge=()=>{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 ci(n)&&ci(i)?i-n:null},this.Qe=()=>{var t,e;const n=this.ie;if(!ci(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.Je;return ci(t)&&t>=0&&n>t}if(this.Ze())return!1;const i=this.Ge();return!!li(i)||n>i||(null===(r=this._instance.persistence)||void 0===r||r.register({$session_past_minimum_duration:this.Xt}),!1);var r},this.Ke=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Xe&&!this.be&&this.Ye(void 0),this.tn(),this.en(!0)):this.nn()},this.rn=()=>{this.Ke()},this.sn=()=>{this.Vt("browser offline",{})},this.an=()=>{this.Vt("browser online",{})},this.ln=()=>{(null==Qn?void 0:Qn.visibilityState)&&("visible"===Qn.visibilityState&&(this.Xe=!0),this.Vt("window "+Qn.visibilityState,{}))},this.Xe=null==e||e;const{sessionId:n,windowId:i,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=n,this.He=i,this._sessionStartTimestamp=r,this.et=new hs(this._instance),this.Y=new cs(this._instance),this.tt=new ds(this._instance),this.Rt=this.nn(),this.un="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||Ho.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.ze=new ro(this._instance)}setDocumentWasEverVisible(t){t&&(this.Xe=!0)}get cn(){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 oi(h)&&oi(d)&&oi(f)&&oi(v)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:f,maskAllElementAttributes:v}}dn(){var t;if(this.Ce)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(ui(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!oi(i)&&i!==r});0!==i.length&&(this.Ce=!0,Ho.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 hn(){var t;return fi(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Mi("canvas recording resolution scale"),1)}get fn(){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:fi(c,0,12,Mi("canvas recording fps"),4),quality:fi(h,0,1,Mi("canvas recording quality"),.4)}}get vn(){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 pn(){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=Uo(this._instance.config.capture_performance),l=Uo(null==i?void 0:i.capturePerformance),u=!!(hi(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}mn(){var t,e;const n=[],r=null===(t=Kn.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.vn&&n.push(r());const s=null===(e=Kn.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.pn&&ri(s))if(!xi.includes(Xn.hostname)||this._forceAllowLocalhostNetworkCapture){const t=ri(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;n.push(s(((t,e,n)=>{const r={payloadSizeLimitBytes:qi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...qi.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...qi.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=Hi(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=Xi(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=Xi(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=Ti(t.name);let s=0===e.indexOf("http")?null===(i=Ti(e))||void 0===i?void 0:i.pathname:e;"/"===s&&(s="");const o=null==r?void 0:r.pathname.replace(s||"","");return r&&o&&Qi.some(t=>0===o.indexOf(t))?void 0:t})((Ji((i=e).requestHeaders),Ji(i.responseHeaders),i),t.api_host,n));var i},c=ri(t.session_recording.maskNetworkRequestFn);return c&&ri(t.session_recording.maskCapturedNetworkRequestFn)&&Ii.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=ri(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 ui(o)&&s?(Ki.add(s),s):null!=o?o:void 0}:t=>function(t){if(!oi(t))return t.requestBody=Yi(t.requestBody,"Request"),t.responseBody=Yi(t.responseBody,"Response"),t}(u(t)),i(i(i({},qi),r),{},{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.pn,t)))}else Ho.info("NetworkCapture not started because we are on localhost.");return n}gn(t){return this._instance.config.disable_capture_url_hashes?pi(t):t}yn(t,e=!1){const n=e?pi(t):this.gn(t),i=this._instance.config.mask_personal_data_properties?[...go,...this._instance.config.custom_personal_data_properties||[]]:[];return this.bn(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("=");ii(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))}bn(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}wn(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}):Ho.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.wn(Go(()=>Zo().addCustomEvent(t,e)))}kn(){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}_n(t){if(!this.kn())return!1;try{const e=Zo();return!!e&&(e.addCustomEvent("$json_ld",t),this.kn())}catch(t){return!1}}Sn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.xn)||void 0===e?void 0:e.scan(t)})}Cn(){try{if(this._instance.config.capture_pageview||!Zn)return;const t=new URL(Zn.location.href),e=this.yn(t.origin+t.pathname+t.search);this.Mn!==e&&(this.Mn=e,this.Vt("$url_changed",{href:e}))}catch(t){}}In(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.wn(t)})}}jt(){return this.wn(Go(()=>Zo().takeFullSnapshot()))}get Tn(){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 ci(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}Rn(){if(this.$n&&clearInterval(this.$n),!0===this.de)return;const t=this.Tn;t&&(this.$n=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.En(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Rn()}An(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.xn)||void 0===t||t.scan(),clearInterval(this.$n),Ho.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}On(){var t;this.Y.urlBlocked&&(null===(t=this.xn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.Sn(),this.Rn(),this.Vt("recording resumed",{reason:"left blocked url"}),Ho.info("recording resumed"))}Ln(t,e){var n;if("event"===t&&this.En(),!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?Or:Er;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.en(),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=si(t)?t:JSON.parse(t)}catch(t){return void Ho.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ve){var n;const i=null!==(n=e.cache_timestamp)&&void 0!==n?n:Date.now();if(Date.now()-i>36e5)return void Ho.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:t})}return e}Pn(t,e,n){this._instance.get_property(t)&&(e(),n())}start(t){var e,n;const i=this.ne;if(!i)return void Ho.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ye(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.De&&(this.Dn(),this.nn());const{sessionId:r,windowId:s,sessionStartTimestamp:o}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=r,this.He=s,this._sessionStartTimestamp=o,this.Fn(),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 mo(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new po(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.Ln(t,e)),this.Pn(Mr,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Mr)}),this.Pn(Rr,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Rr)}),this.Pn(xr,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(xr)}),this.Pn(Ar,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(Ar)}),this.re.makeSamplingDecisions(this.sessionId),this.Nn(),this.ke||(Ai(Zn,"beforeunload",this.Ke),Ai(Zn,"pagehide",this.rn),Ai(Zn,"offline",this.sn),Ai(Zn,"online",this.an),Ai(Qn,"visibilitychange",this.ln),!this.Ne&&ri(this.Yt.onSessionId)&&(this.Ne=this.Yt.onSessionId(this.Be)),!this.qe&&ri(this.Yt.on)?this.qe=this.Yt.on("forcedIdleReset",()=>{this.Ue(),this.de="unknown",this.stop(),this.je=this.Yt.onSessionId((t,e,n)=>{var i;null===(i=this.je)||void 0===i||i.call(this),this.je=void 0,this.Be(t,e,n)})}):ri(this.Yt.on)||Ho.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),ui(this.Fe)&&(this.Fe=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.yn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Ho.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(t||"recording_initialized"))}qn(){var t,e,n,i,r,s;null==Zn||Zn.removeEventListener("beforeunload",this.Ke),null==Zn||Zn.removeEventListener("pagehide",this.rn),null==Zn||Zn.removeEventListener("offline",this.sn),null==Zn||Zn.removeEventListener("online",this.an),null==Qn||Qn.removeEventListener("visibilitychange",this.ln),clearInterval(this.$n),this.jn(),null===(t=this.Fe)||void 0===t||t.call(this),this.Fe=void 0,null===(e=this.Wt)||void 0===e||e.call(this),this.Wt=void 0,null===(n=this.Ne)||void 0===n||n.call(this),this.Ne=void 0,null===(i=this.qe)||void 0===i||i.call(this),this.qe=void 0,null===(r=this.je)||void 0===r||r.call(this),this.je=void 0,null===(s=this.re)||void 0===s||s.stop(),this.Bn(),this.Dn()}Dn(){this.Pe+=1,this.Oe=[],this.Le=0,this.Hn=void 0,this.De=!1}Bn(){var t,e;null===(t=this.zn)||void 0===t||t.stop(),this.ce=[],null===(e=this.xn)||void 0===e||e.stop(),this.xn=void 0,this.ae=!1;try{var n;null===(n=this.se)||void 0===n||n.call(this)}catch(t){Ho.warn("could not stop rrweb",t)}this.se=void 0}Un(){if(!this.Hn||0===this.Le)return!1;if(this.De)return!0;this.De=!0,this.Wn=void 0;const t=this.Pe;return this.jn(),this.Bn(),this.Hn.catch(()=>{}).then(()=>{t===this.Pe&&(this.De=!1,this.en(),this.nn(),this.Vn(),this.qn(),Ho.info("stopped"))}).catch(()=>{this.De=!1,this.Vn(),this.qn(),Ho.info("stopped")}),!0}stop(){if(this.Bn(),this.Ve)this.tn();else if(this.Un())return;this.en(),this.nn(),this.Vn(),this.qn(),Ho.info("stopped")}Vn(){this.Ye(void 0,{preserveLogDedup:this.Ve}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.De)&&(this.tn(),this.en())}We(t){this.Ve=!0,this.le=Date.now();try{var e,n;this.stop(),this.Zn=void 0,this.Gn=void 0,this.fe=0,this.ve=0,this.pe=0,this.me=0,null===(e=Vo())||void 0===e||null===(n=e.resetSnapshotCostState)||void 0===n||n.call(e),this.start("session_id_changed")}finally{this.Ve=!1}this.Ye(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ye(t,{preserveLogDedup:e=!1}={}){if(this.ge=!oi(t),this.Wn=t,oi(t))return void(e||(this.Qn=void 0));if(this.Ve)return;const n=`${this.sessionId}:${t}`;n!==this.Qn&&(this.Qn=n,Ho.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}En(){this.isStarted||(this.we=!0),this.ge&&(this.Ye(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Jn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.nn(),this.Bn()),this.nn(),this.qn(),this.nn(),this.Vn(),Ho.info("discarded")}Kn(t,e,n,i,r){if(-1===n)return this.me+=1,void Ho.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.Xn(t,i),this.Yn(s)):this.nn()}ti(){try{this.ei()}catch(t){this.xe||(this.xe=!0,Ho.error("could not track full snapshot cost",t))}}ei(){var t,e;const n=null===(t=Vo())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);n&&n!==this.Gn&&(this.Gn=n,this.Zn&&this.Zn.durationMs>=n.durationMs||(this.Zn=n),500>n.durationMs||Ho.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}))}Xn(t,e){2!==t.type?3===t.type&&(oi(this.$e)||this.$e===e||this.Ee===e||(this.Ee=e,Ho.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.$e=e}ni(t){t.counted&&t.generation===this.Pe&&(this.Le=Math.max(0,this.Le-1)),t.counted=!1,this.Oe=this.Oe.filter(e=>e!==t)}ii(t,e,n){t.processed||t.generation!==this.Pe||(t.processed=!0,this.Kn(t.event,e,n,t.targetSessionId,t.targetWindowId))}ri(t){try{let e,n=t.event;if(t.compressionEnabled)try{({event:n,size:e}=ca(t.event))}catch(t){Ho.warn("could not process queued compression event - will use uncompressed event",t)}oi(e)&&(e=gs(t.event));try{this.ii(t,n,e)}catch(t){Ho.warn("could not capture queued compression event",t)}}finally{this.ni(t)}}tn(){[...this.Oe].forEach(t=>{try{this.ri(t)}catch(t){Ho.warn("could not drain queued compression event",t)}})}oi(t,e,n,i){var r=this;const o={event:t,compressionEnabled:e,targetSessionId:n,targetWindowId:i,generation:this.Pe,processed:!1,counted:!0};this.Oe.push(o),this.Le+=1;const a=(l=s(function*(){try{if(o.processed)return;let n,i;try{const r=e?oa(t)?yield function(t){return ha.apply(this,arguments)}(t):ca(t):{event:t,size:gs(t)};n=r.event,i=r.size}catch(e){Ho.warn("could not process queued compression event - will use uncompressed event",e),n=t,i=gs(t)}r.ii(o,n,i)}finally{r.ni(o)}}),function(){return l.apply(this,arguments)});var l;this.Hn=this.Hn?this.Hn.catch(()=>{}).then(a):a()}onRRwebEmit(t){var e,n,i,r,s,o,a,l,u,c,h,d,f,v;if(!this._instance.sessionManager)return;if(this.In(),!t||!si(t))return;if(4===t.type){const e=this.yn(t.data.href);if(this.Mn=e,!e)return;t.data.href=e}else this.Cn();if(null===(e=this.re)||void 0===e||e.checkUrlTriggers(this.sessionId,()=>this.An(),()=>this.On(),(t,e)=>this.Ln(t,e)),this.Y.urlBlocked&&(5!==(c=t).type||"recording paused"!==c.data.tag))return;2===t.type&&((null===(h=Vo())||void 0===h||null===(d=h.wasMaxDepthReached)||void 0===d?void 0:d.call(h))&&(this.Se=!0),this.ti(),Promise.resolve().then(()=>this.ti()),this.Rn(),null===(f=this.zn)||void 0===f||f.reset(),null===(v=this._instance.persistence)||void 0===v||v.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const p=2===t.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.si();const m=this.zn?this.zn.throttleMutations(t):t;if(!m)return void(!0===this.de&&this.he++);const g=function(t){const e=t;if(e&&si(e)&&6===e.type&&si(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}(m),y=function(t){return va(t)?t.data.payload:null}(g),b=function(t){return pa(t)?t.data.payload:null}(g),w=function(t){return fa(t)?t.data.payload:null}(g);y||b?(null==y?void 0:y.lastActivityTimestamp)&&(g.timestamp=y.lastActivityTimestamp):(null==w?void 0:w.sessionId)||this.ai(g),2===t.type&&(this.Re.push([this.Xt,t.timestamp]),this.Re.length>6&&(this.Re=this.Re.slice(-6)));const _=null!==(i=null!==(r=null!==(s=null==y?void 0:y.currentSessionId)&&void 0!==s?s:null==b?void 0:b.nextSessionId)&&void 0!==r?r:null==w?void 0:w.sessionId)&&void 0!==i?i:this.Xt,k=null!==(o=null!==(a=null!==(l=null==y?void 0:y.currentWindowId)&&void 0!==l?l:null==b?void 0:b.nextWindowId)&&void 0!==a?a:null==w?void 0:w.windowId)&&void 0!==o?o:this.He;if(!0===this.de&&!function(t){return fa(t)||va(t)||pa(t)}(g))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(g)&&this.he++);2===g.type&&(this.he=0),w&&(g.timestamp=w.lastActivityTimestamp+w.threshold);const S=this.ae;this.ae=!0,p?this.Sn(!0):S||this.Sn();const C=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===g.type&&"$json_ld"===g.data.tag){let t;try{t=Zn?this.yn(Zn.location.href):void 0}catch(t){}g.data.href=t}if(this.Le>0||C&&oa(g))return void this.oi(g,C,_,k);const{event:I,size:M}=C?ca(g):{event:g,size:gs(g)};this.Kn(g,I,M,_,k)}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}):Vr}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.En(),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.En(),this.qt("sampling_overridden")}overrideTrigger(t){this.Ln(t),this.En()}li(){try{var t;const e=null==Zn||null===(t=Zn.location)||void 0===t?void 0:t.href;if(!e)return;const n=this.yn(e);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}jn(){this.ui&&(clearTimeout(this.ui),this.ui=void 0)}Jn(){this.ui||(this.ui=setTimeout(()=>{this.en()},2e3))}ci(){return this.$e!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!va(t)&&!pa(t))}di(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}hi(t){if("buffering"!==t)return oi(this.fi)||this._instance.register_for_session({[Br]:[]}),void(this.fi=void 0);const e=this.di();if(0===e.length)return oi(this.fi)||this._instance.register_for_session({[Br]:[]}),void(this.fi=void 0);const n=e.join(", "),i=`${this.sessionId}:${n}`;i!==this.fi&&(this.fi=i,this._instance.register_for_session({[Br]:e}),Ho.info(`buffering: ${n}`))}pi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.mi)&&no.Et()}gi(){0!==this.Rt.data.length&&this.Rt.size!==this.yi&&943718.4>=this.Rt.size&&this.pi()&&(this.yi=this.Rt.size,no.At(this.un,this.Rt))}Fn(){if(this.Ae||!this.pi())return;this.Ae=!0;const t=no.Dt(this.un);no.Lt(this.un),si(t)&&ii(t.data)&&0!==t.data.length&&ii(t.sizes)&&t.sizes.length===t.data.length&&ci(t.size)&&t.sessionId===this.Xt&&t.windowId===this.He&&(this.Rt.data.length>0||(this.Rt=t))}en(t=!1){var e;if(this.jn(),this.ge)return this.Rt;if(this.ci())return this.Rt.size>943718.4?this.nn():(t&&this.gi(),this.Rt);const n=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const r=this.Qe(),s=this.status;if(this.hi(s),"buffering"===s||"paused"===s||"disabled"===s||r)return!t||"active"!==s&&"sampled"!==s||this.gi(),this.Jn(),this.Rt;if(this.Rt!==n)return this.Rt;if(n.data.length>0){var o;const t=this.li();bs(n).forEach(e=>{try{var n;null===(n=this.ze)||void 0===n||n.trackSize(e.sessionId,e.size),this.bi(i({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:io.LIB_NAME,$lib_version:io.LIB_VERSION,$snapshot_host:t},this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){Ho.warn("could not capture snapshot chunk - skipping it",t)}}),oi(this.yi)||(no.Lt(this.un),this.yi=void 0),null===(o=this.re)||void 0===o||o.onFlushComplete()}return this.nn()}Yn(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.en(),this.Xt!==e)return;r&&this.Rt.data.length>0&&(this.Rt=this.nn()),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||(this.be=!0,this.Rt=this.nn()):(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.Jn())}bi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Je(){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}si(){if(!this.Rt||0===this.Rt.data.length)return this.nn();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.nn():(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)}nn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.He},this.Rt}qt(t,e){this._instance.register_for_session({[Gr]:t}),Ho.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",i({reason:t},e))}wi(t){var e;return 3===t.type&&-1!==qo.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ai(t){const e=this.wi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.$n),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.He}),this.en());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.He!==n;if(this.He=n,this.Xt=i,s||o){const t=s&&!1!==this.de;t&&(this.de="unknown"),this.We(t)}else if(e&&this.En(),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.Sn(),this.Rn()}}Ue(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,n,i,r,s,o,a,l,u,c,h,d,f;const v=null===(t=Vo())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Wn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Je,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(n=this.ze)||void 0===n?void 0:n.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Re,$snapshot_max_depth_exceeded:this.Se,$sdk_debug_replay_slowest_full_snapshot_ms:Wo(null===(i=this.Zn)||void 0===i?void 0:i.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Wo(null===(r=this.Zn)||void 0===r?void 0:r.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(s=this.Zn)||void 0===s?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Zn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this.Zn)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==v?void 0:v.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==v?void 0:v.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==v?void 0:v.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Wo(null==v?void 0:v.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Wo(null==v?void 0:v.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Wo(null===(l=Vo())||void 0===l||null===(u=l.getMutationCost)||void 0===u||null===(u=u.call(l))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(c=Vo())||void 0===c||null===(h=c.getDiscardedDurationSamples)||void 0===h?void 0:h.call(c),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_unstringifiable_events_dropped:this.me,$sdk_debug_replay_rrweb_error:this.ke,$sdk_debug_replay_observer_init_failures:null===(d=Vo())||void 0===d||null===(f=d.getObserverInitFailures)||void 0===f?void 0:f.call(d),[Hr]:!!this.se,[qr]:this._e}}Nn(){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={};oi(t.mousemove)||(n.mousemove=t.mousemove),oi(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.fn&&this.fn.enabled&&(e.recordCanvas=!0,e.sampling=i(i({},e.sampling),{},{canvas:this.fn.fps}),e.dataURLOptions={type:"image/webp",quality:this.fn.quality},e.canvasResolutionScale=this.hn,e.canvasMasking={configured:()=>{var t;return ri(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(ri(n))try{var i;return null!==(i=n(t))&&void 0!==i?i:null}catch(t){return this.Ie||(this.Ie=!0,Ho.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.cn&&(e.maskAllInputs=null===(r=this.cn.maskAllInputs)||void 0===r||r,e.maskTextSelector=null!==(s=this.cn.maskTextSelector)&&void 0!==s?s:void 0,e.blockSelector=null!==(o=this.cn.blockSelector)&&void 0!==o?o:void 0,e.maskAllElementAttributes=null!==(a=this.cn.maskAllElementAttributes)&&void 0!==a&&a),e.maskAllElementAttributes&&e.maskAttributeFn&&(e.maskAttributeFn=void 0,this.Me||(this.Me=!0,Ho.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.dn();const l=Zo();if(!l)return void Ho.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.zn=null!==(t=this.zn)&&void 0!==t?t:new to(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`;Ho.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.Tn,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.mn();if(this.se=l(i({emit:t=>{this.onRRwebEmit(t)},plugins:u,errorHandler:(t,e)=>"rrweb"===e&&(this.Te||(this.Te=!0,Ho.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},e)),!this.se)return this.ke=!0,void Ho.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)&&Qn&&(null==Zn?void 0:Zn.MutationObserver)&&!this.xn&&(this.xn=function(t,e,n){const i=new WeakMap,r=n.getCaptureState||(()=>!0);let s=yo;const o=function(t,e){const n=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==n?void 0:n.length)&&!n.includes("id")?_o:n=>{const i=t.getElementById(n);return!!i&&"SCRIPT"!==i.nodeName&&(!e.isRecordedElement||e.isRecordedElement(i))&&!Bo(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 Bo(t,e.blockClass,e.blockSelector)||Bo(t,e.maskTextClass,e.maskTextSelector)}(e,n))return;const l=function(t,e=_o,n){if(!t||t.length>yo)return null;try{const i=JSON.parse(t),r={maskUrl:n,remainingNodes:2048,exceeded:!1},s=ii(i)?i.map(t=>No(t,e,r)):No(i,e,r);if(r.exceeded||li(s)||ii(s)&&(!s.length||s.some(li)))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(li(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 zo(t))a(e)};for(const n of t)if("childList"===n.type)Po(n.target)&&a(n.target),n.addedNodes.forEach(e);else if("characterData"===n.type){const t=n.target.parentNode;t&&Po(t)&&a(t)}else"attributes"===n.type&&Po(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()&&zo(t.documentElement).forEach(t=>{e&&i.delete(t),a(t)})},stop(){return n.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(Qn,Zn.MutationObserver,{maskUrl:t=>this.yn(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.kn()},emit:t=>this._n(t)}),this.Y.isCurrentUrlBlocked()&&this.xn.scan()),this.le=Date.now(),this.de=hi(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)}};Kn.__PosthogExtensions__=Kn.__PosthogExtensions__||{},Kn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:Vn,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:Ir,options:t})},Kn.__PosthogExtensions__.rrweb={record:En,version:"v2",wasMaxDepthReached:()=>Yt,resetMaxDepthState(){Yt=!1,Xt=!1},getLastSnapshotCost:()=>P,getMutationCost:()=>i({},U),getDeferredStylesheetStats:()=>i({},H),getDiscardedDurationSamples:()=>x,getObserverInitFailures:()=>Ge.size?Array.from(Ge):void 0,resetSnapshotCostState(){F=0,D=0,L=0,A=0,x=0,N={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},P=null,j=null,B=[],z=0,W=0,U={slowestBatchMs:0},H={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},Kn.__PosthogExtensions__.initSessionRecording=(t,e)=>new ma(t,e)}();
2
2
  //# sourceMappingURL=posthog-recorder.js.map