posthog-js 1.431.0 → 1.431.2

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.
Files changed (44) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/customizations.full.js +1 -1
  12. package/dist/customizations.js +1 -1
  13. package/dist/default-extensions.js +1 -1
  14. package/dist/exception-autocapture.js +1 -1
  15. package/dist/exception-autocapture.js.map +1 -1
  16. package/dist/extension-bundles.js +1 -1
  17. package/dist/lazy-recorder.js +1 -1
  18. package/dist/lazy-recorder.js.map +1 -1
  19. package/dist/main.js +1 -1
  20. package/dist/module.full.cjs +1 -1
  21. package/dist/module.full.js +1 -1
  22. package/dist/module.full.js.map +1 -1
  23. package/dist/module.full.no-external.cjs +1 -1
  24. package/dist/module.full.no-external.js +1 -1
  25. package/dist/module.full.no-external.js.map +1 -1
  26. package/dist/module.js +1 -1
  27. package/dist/module.mjs +1 -1
  28. package/dist/module.no-external.cjs +1 -1
  29. package/dist/module.no-external.js +1 -1
  30. package/dist/module.slim.js +1 -1
  31. package/dist/module.slim.no-external.js +1 -1
  32. package/dist/posthog-recorder.js +1 -1
  33. package/dist/posthog-recorder.js.map +1 -1
  34. package/dist/product-tours.js +1 -1
  35. package/dist/recorder-v2.js +1 -1
  36. package/dist/recorder-v2.js.map +1 -1
  37. package/dist/recorder.js +1 -1
  38. package/dist/recorder.js.map +1 -1
  39. package/dist/rrweb.js +1 -1
  40. package/dist/rrweb.js.map +1 -1
  41. package/lib/package.json +1 -1
  42. package/lib/src/entrypoints/exception-autocapture.js +23 -14
  43. package/lib/src/entrypoints/exception-autocapture.js.map +1 -1
  44. package/package.json +6 -6
@@ -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=/^[^ \t\n\r\u000c]+/,Lt=/^[, \t\n\r\u000c]+/,Nt=new WeakMap;function Pt(t,e){return e&&""!==e.trim()?jt(t,e):e}function jt(t,e){let n=Nt.get(t);if(n||(n=t.createElement("a"),Nt.set(t,n)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return n.setAttribute("href",e),n.href}function Bt(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 zt(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=Pt(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)),Bt(t,s)}if("image"===e)return Bt(n,s)}return n}if("xlink:href"===n&&"#"!==i[0]){const n=Pt(t,i);return"image"===e&&n.startsWith("data:")?Bt(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(Lt),e.length>n;){let s=i(Dt);if(","===s.slice(-1))s=Pt(t,s.substring(0,s.length-1)),r.push(s);else{let i="";s=Pt(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,jt(t)):"object"===e&&"data"===n?Pt(t,i):i:Pt(t,i)}function Wt(t,e,n){return("video"===t||"audio"===t)&&"autoplay"===bt(e)}function Ut(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&Ut(M.parentNode(t),e,n);for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;return!!n&&Ut(M.parentNode(t),e,n)}function Ht(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(Ut(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 qt(t,e,n){const i=t.removeEventListener;"function"==typeof i&&i.call(t,e,n)}var Gt=new Map;function Vt(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Zt(t){return null==t?"":t.toLowerCase()}var Jt=!1,Qt=!1;function Xt(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 Qt=!0,Jt||(Jt=!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=Ht(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];Wt(b,i.name)||(_[i.name]=zt(n,b,bt(i.name),i.value,t,c))}if("link"===b&&s&&!y){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=Vt(n,i),!e&&i.includes(".css"))&&(e=Vt(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)}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()))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;if(new Uint32Array((kt in r?r[kt]:r).call(e,n,i,Math.min(50,t.width-n),Math.min(50,t.height-i)).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)}let S,C=!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)=>C?_t({element:t,name:e,value:n,maskAllElementAttributes:l,maskAttributeFn:u}):n,o=()=>{qt(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 I,R,A;const{width:e,height:i,left:r,top:s}=t.getBoundingClientRect(),o=null===(I=n.defaultView)||void 0===I?void 0:I.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${i}px`,rr_left:`${Math.floor(r+((null===(R=n.defaultView)||void 0===R?void 0:R.scrollX)||0))}px`,rr_top:`${Math.floor(s+((null===(A=n.defaultView)||void 0===A?void 0:A.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)}));C=!0;try{customElements.get(b)&&(S=!0)}catch(t){}return{type:f.Element,tagName:b,attributes:_,childNodes:[],isSVG:(x=t,Boolean("svg"===x.tagName||x.ownerSVGElement)||void 0),needBlock:y,rootId:g,isCustom:S};var x}(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,jt(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&&(Zt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Zt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Zt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Zt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Zt(t.attributes.property).match(/^(og|twitter|fb):/)||Zt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Zt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Zt(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(Zt(t.attributes.name))||Zt(t.attributes.property).match(/^article:/)||Zt(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(Zt(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=Xt(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=Xt(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),qt(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?qt(t,"load",o):(i=!0,qt(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),qt(t,"load",o)}}return t.addEventListener("load",o),()=>{qt(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&k){const n=Xt(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&&"stylesheet"===j.attributes.rel&&function(e,l,f){if(Gt.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=Xt(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{Gt.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}),Gt.set(e,M)}(t,0,R),j}function Yt(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 Kt=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 te(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>ee(n,t,e,i)}function ee(t,e,n,i){ne(()=>{const r=t.removeEventListener;"function"==typeof r&&(void 0!==i?r.call(t,e,n,i):r.call(t,e,n))})}function ne(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function ie(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var re="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.",se={map:{},getId(){return console.error(re),-1},getNode(){return console.error(re),null},removeNodeFromMap(){console.error(re)},has(){return console.error(re),!1},reset(){console.error(re)}};function oe(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 ae(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e);return r.Object.defineProperty(t,e,i?n:{set(t){if(setTimeout(()=>{try{n.set.call(this,t)}catch(t){}},0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>ae(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(se=new Proxy(se,{get(t,e,n){return"map"===e&&console.error(re),Reflect.get(t,e,n)}}));var le=Date.now;function ue(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 ce(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function he(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function de(t){return t?t.nodeType===t.ELEMENT_NODE?t:M.parentElement(t):null}function fe(t,e,n,i){if(!t)return!1;const r=de(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(Ut(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 ve(t,e,n){return!("TITLE"!==t.tagName||!n.headTitleMutations)||-2===e.getId(t)}function pe(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||pe(i,e))}function me(t){return Boolean(t.changedTouches)}function ge(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function ye(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function be(t){return!!t&&(t instanceof Kt&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(M.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(le=()=>(new Date).getTime());var we=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 _e(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 ke(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=_e(n);)n=e;return n}(t);return M.contains(e,n)}(t)}function Se(t){return"__ln"in t}var Ce,Ie=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&&Se(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&&Se(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--)}},Me=(t,e)=>`${t}@${e}`,Re=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 Ie,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||!ke(s)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=rt(a)?this.mirror.getId(_e(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=>{ge(t,this.mirror)&&this.iframeManager.addIframe(t),ye(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),be(t)&&!fe(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=Xt(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)xe(this.removesSubTreeCache,t)&&!this.movedSet.has(M.parentNode(t))||s(t);for(const t of this.addedSet)Te(this.droppedSet,t)||xe(this.removesSubTreeCache,t)?Te(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(!ve(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=M.textContent(t.target);fe(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Ht(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,de(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(fe(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"),!Wt(r,a)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=zt(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(fe(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);fe(t.target,this.blockClass,this.blockSelector,!1)||ve(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Ae(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||pe(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Me(n,i)]?Ae(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(ve(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[Me(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!fe(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(be(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),fe(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 Ae(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 xe(t,e,n){return 0!==t.size&&function(t,e){const n=M.parentNode(e);return!!n&&t.has(n)}(t,e)}function Te(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 Oe(t){Ce=t}function Ee(){Ce=void 0}var Fe=(t,e="rrweb")=>Ce?(...n)=>{try{return t(...n)}catch(t){if(Ce&&!0===Ce(t,e))return;throw t}}:t,$e=[];function De(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 Le(t,e){const n=new Re;let i;n.init(t);try{i=new(C())(Fe(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),$e.push(n),{observer:i,buffer:n}}catch(t){try{null==i||i.disconnect(),n.destroy(),n.reset()}catch(t){}throw t}}function Ne({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){const o=new Map,a=s=>{const a=De(s);if(!a||fe(a,i,r,!0))return;const l=n.getId(a);let u,c;if(a===e&&e.defaultView){const t=ue(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=[te("scroll",Fe(oe(Fe(t=>a(t)),s.scroll||100)),e)];return"onscrollend"in e&&l.push(te("scrollend",Fe(a),e)),()=>l.forEach(t=>t())}function Pe(t,e){for(let n=$e.length-1;n>=0;n--){const i=$e[n];if(!i)continue;let r=i.bufferBelongsToIframe(t);!r&&e&&e.has(i.bufferDoc())&&(r=!0),r&&(i.reset(),$e.splice(n,1))}}var je=["INPUT","TEXTAREA","SELECT"],Be=new WeakMap;function ze(t){return function t(e,n){if(qe("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||qe("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||qe("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||qe("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 We(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function Ue({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}}),Fe(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}function He(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=Fe(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=$e.indexOf(s);-1!==t&&$e.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect()}finally{ie(o)}});try{if(t.recordDOM){const e=Le(t,t.doc);r=e.observer,s=e.buffer}if(o.push(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=oe(Fe(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null}),s),c=Fe(oe(Fe(t=>{const e=De(t),{clientX:n,clientY:r}=me(t)?t.changedTouches[0]:t;o||(o=le()),a.push({x:n,y:r,id:i.getId(e),timeOffset:le()-o}),u("undefined"!=typeof DragEvent&&t instanceof DragEvent?l.Drag:t instanceof MouseEvent?l.MouseMove:l.TouchMove)}),r,{trailing:!1})),h=[te("mousemove",c,n),te("touchmove",c,n),te("drag",c,n)];return Fe(()=>{h.forEach(t=>t())})}(t)),o.push(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=De(o);if(fe(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 me(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=me(o)?o.changedTouches[0]:o;if(!f)return;const v=n.getId(a),{clientX:p,clientY:m}=f;Fe(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(te(a,d,e))}),Fe(()=>{l.forEach(t=>t())})}(t)),o.push(Ne(t)),o.push(function({viewportResizeCb:t},{win:e}){let n=-1,i=-1;return te("resize",Fe(oe(Fe(()=>{const e=ce(),r=he();n===e&&i===r||(t({width:Number(r),height:Number(e)}),n=e,i=r)}),200)),e)}(t,{win:n})),o.push(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=De(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>je.indexOf(d)||fe(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=Be.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Be.set(e,r);const s=n.getId(e);Fe(t)(i(i({},r),{},{id:s}))}}const v=("last"===c.input?["change"]:["input","change"]).map(t=>te(t,Fe(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=>ae(t[0],t[1],{set(){Fe(d)({target:this,isTrusted:!1})}},!1,p))),Fe(()=>{ie(v)})}(t)),o.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r,doc:s}){const o=Fe(s=>oe(Fe(r=>{const o=De(r);if(!o||fe(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=[te("play",o(d.Play),s),te("pause",o(d.Pause),s),te("seeked",o(d.Seeked),s),te("volumechange",o(d.VolumeChange),s),te("ratechange",o(d.RateChange),s)];return Fe(()=>{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),o.push(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=We(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=We(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:Fe((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}=We(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=We(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={};Ge("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(Ge("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),Ge("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),Ge("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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=We(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...ze(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=We(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...ze(s),a];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),Fe(()=>{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})),o.push(Ue(t,t.doc)),o.push(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:Fe((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}=We(f,e,i.styleMirror);if(v&&-1!==v||p&&-1!==p){const e=ze(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:Fe((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}=We(h,e,i.styleMirror);if(d&&-1!==d||f&&-1!==f){const e=ze(o.parentRule);s.queueMutation(h,()=>t({id:d,styleId:f,remove:{property:u},index:e}))}return c},"host")}),Fe(()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:n,mutationQueue:e})),t.collectFonts&&o.push(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(Fe(()=>{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),Fe(()=>{i.forEach(t=>t())})}(t))}o.push(function(t){const{doc:e,mirror:n,blockClass:i,blockSelector:r,selectionCb:s}=t;let o=!0;const a=Fe(()=>{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);fe(s,i,r,!0)||fe(l,i,r,!0)||a.push({start:n.getId(s),startOffset:o,end:n.getId(l),endOffset:u})}s({ranges:a})});return a(),te("selectionchange",a)}(t)),o.push(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)o.push(e.observer(e.callback,n,e.options))}catch(t){try{a()}catch(t){}throw t}return a}function qe(t){return void 0!==window[t]}function Ge(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Ve=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}},Ze=class{constructor(t){nt(this,"iframes",new WeakMap),nt(this,"crossOriginIframeMap",new WeakMap),nt(this,"crossOriginIframeMirror",new Ve($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 Ve(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=>ne(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{ee(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);ne(()=>{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)})}ne(()=>{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&&(ee(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(n)),t&&this.nestedIframeListeners.has(t)&&(ee(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=>{ne(()=>this.mirror.removeNodeFromMap(t))}),ne(()=>Pe(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&&ee(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{ee(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}},Je=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}=Le(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=$e.indexOf(a);-1!==t&&$e.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:Ne(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:Ue({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&&ke(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}},Qe="skip-frame";function Xe(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 Ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ke="undefined"==typeof Uint8Array?[]:new Uint8Array(256),tn=0;64>tn;tn++)Ke[Ye.charCodeAt(tn)]=tn;var en=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;i>e;e+=3)r+=Ye[n[e]>>2],r+=Ye[(3&n[e])<<4|n[e+1]>>4],r+=Ye[(15&n[e+1])<<2|n[e+2]>>6],r+=Ye[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},nn=new Map,rn=(t,e,n)=>{if(!t||!an(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=nn.get(t);return n||(n=new Map,nn.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 sn(t,e,n,i){if(t instanceof Array)return t.map(t=>sn(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:en(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[sn(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}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[sn(t.data,e,n,i),t.width,t.height]}:an(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:rn(t,e,n)}:t}var on=(t,e,n,i)=>t.map(t=>sn(t,e,n,i)),an=(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]))},ln=["webgl","webgl2"];function un(t){return"nodeType"in t}function cn(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||un(o)&&fe(o,e,n,!0))return r.call(this,s);un(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(!fe(this,e,n,!0)&&("__context"in this||(this.__context=o),r&&ln.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.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function hn(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(rn(l,s,this),this.canvas&&"tagName"in this.canvas&&!fe(this.canvas,i,r,!0)){const t=on(a,s,this,o);n(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(s){const o=ae(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!fe(this.canvas,i,r,!0)&&n(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var dn='(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',fn="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",dn],{type:"text/javascript;charset=utf-8"});function vn(t){let e;try{if(e=fn&&(self.URL||self.webkitURL).createObjectURL(fn),!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(dn),{name:null==t?void 0:t.name})}}var pn,mn,gn,yn=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;const a="number"==typeof r.resolutionScale&&Number.isFinite(r.resolutionScale)?Math.min(1,Math.max(.1,r.resolutionScale)):1,l=cn(e,n,i,!0),u=new Map;let c;try{c=new vn}catch(t){return}let d=!1;c.onerror=()=>{var t;d=!0,cancelAnimationFrame(v),null===(t=c.terminate)||void 0===t||t.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})};const f=1e3/t;let v,p=0;const m=t=>{var l;d||(p&&f>t-p||(p=t,(()=>{const t=[],r=e=>{try{e.querySelectorAll("canvas").forEach(e=>{fe(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(!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 Qe}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Xe))return Qe;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 void u.set(e,!1);const f=yield createImageBitmap(t,1>a?{resizeWidth:l,resizeHeight:h,resizeQuality:"medium"}:{resizeWidth:l,resizeHeight:h});c.postMessage({id:e,bitmap:f,width:l,height:h,displayWidth:s,displayHeight:o,dataURLOptions:r.dataURLOptions,maskRegions:d},[f])}catch(t){u.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),v=requestAnimationFrame(m))};v=requestAnimationFrame(m),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(v),null===(t=c.terminate)||void 0===t||t.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,n,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=cn(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 fe(this.canvas,n,i,!0)||setTimeout(()=>{const n=on(o,e,this,r);t(this.canvas,{type:h["2D"],property:a,args:n})},0),s.apply(this,o)}});s.push(o)}catch(r){const o=ae(e.CanvasRenderingContext2D.prototype,a,{set(e){fe(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(...hn(e.WebGLRenderingContext.prototype,h.WebGL,t,n,i,e,r)),void 0!==e.WebGL2RenderingContext&&s.push(...hn(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)}},bn=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 we),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(),Gt.forEach(t=>t.abort()),Gt.clear()}trackStylesheetInLinkElement(t){}},wn=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(){}},_n=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var kn;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(kn=t.contentWindow)||void 0===kn?void 0:kn.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Sn=new gt,Cn=new Set([l.Mutation,l.MediaInteraction,l.StyleSheetRule,l.CanvasMutation,l.Font,l.Log,l.StyleDeclaration,l.AdoptedStyleSheet]);function In(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 Mn(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;Oe(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),Sn.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=Yt(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};pn=(t,e)=>{var i;const o=t;if(o.timestamp=le(),!(null===(i=$e[0])||void 0===i?void 0:i.isFrozen())||o.type===a.FullSnapshot||o.type===a.IncrementalSnapshot&&Cn.has(o.data.source)||$e.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)&&mn(!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=Sn.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()}pn({type:a.IncrementalSnapshot,data:i({source:l.Mutation},t)})},at=t=>pn({type:a.IncrementalSnapshot,data:i({source:l.Scroll},t)}),lt=t=>pn({type:a.IncrementalSnapshot,data:i({source:l.CanvasMutation},t)}),ut=new bn({mutationCb:ot,adoptedStyleSheetCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.AdoptedStyleSheet},t)}),maskAllElementAttributes:_,maskAttributeFn:k}),ct=new Ze({mirror:Sn,mutationCb:ot,stylesheetManager:ut,recordCrossOriginIframes:D,wrappedEmit:pn});for(const t of B||[])t.getMirror&&t.getMirror({nodeMirror:Sn,crossOriginIframeMirror:ct.crossOriginIframeMirror,crossOriginIframeStyleMirror:ct.crossOriginIframeStyleMirror});const ht=new wn,dt=null==x?void 0:x.configured;gn=new yn({recordCanvas:F,mutationCb:lt,win:window,blockClass:o,blockSelector:u,mirror:Sn,sampling:I.canvas,dataURLOptions:V,resolutionScale:A,canvasMasking:x});const ft=new Je({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:gn,keepIframeSrcFn:z,processedNodeManager:ht,attributeFilter:U},mirror:Sn});mn=(t=!1)=>{if(E){q(p);try{pn({type:a.Meta,data:{href:window.location.href,width:he(),height:ce()}},t),null==e||e.cancel(),e=void 0,ut.reset(),ft.init(),$e.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=Yt(m);q(R);try{return Xt(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:Sn,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){ge(t,Sn)&&ct.addIframe(t),ye(t,Sn)&&ut.trackLinkElement(t),be(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(pn({type:a.FullSnapshot,data:{node:n,initialOffset:ue(window)}},t),$e.forEach(t=>t.unlock()),gn.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&&ne(()=>{o=e.beginDeferredLinkInlining(n,Sn.getId(n))})},u=()=>{if(!o)return;const t=o;let e=!0;ne(()=>{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=In(h):n())};return r=In(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,Sn.getId(document))}finally{G()}}};try{const t=[];t.push(te("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(te(e,T,document));it=e=>{const n=nt.get(e);n&&(n.forEach(e=>{ne(e);const n=t.indexOf(e);-1!==n&&t.splice(n,1)}),nt.delete(e))},rt=()=>{for(const[t]of nt){const e=Sn.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 Fe(He)({mutationCb:ot,mousemoveCb:(t,e)=>pn({type:a.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.MouseInteraction},t)}),scrollCb:at,viewportResizeCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.ViewportResize},t)}),inputCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.Input},t)}),mediaInteractionCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.MediaInteraction},t)}),styleSheetRuleCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.StyleSheetRule},t)}),styleDeclarationCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.StyleDeclaration},t)}),canvasMutationCb:lt,fontCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.Font},t)}),selectionCb(t){pn({type:a.IncrementalSnapshot,data:i({source:l.Selection},t)})},customElementCb(t){pn({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:Sn,iframeManager:ct,stylesheetManager:ut,shadowDomManager:ft,processedNodeManager:ht,canvasManager:gn,ignoreCSSAttributes:W,attributeFilter:U,plugins:(null==B||null===(e=B.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>pn({type:a.Plugin,data:{plugin:t.name,payload:e}})})))||[]},S)};ct.addLoadListener(e=>{try{const i=Sn.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=Sn.getId(t);null==it||it(e),Pe(t)});let r=-1;const s=t=>pn({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?Sn.getId(a):-1;l!==r&&(-1!==r&&s({id:r,enter:!1}),r=l,-1!==l&&s({id:l,enter:!0}))},m=()=>{mn();const e=n(document);"function"==typeof e&&t.push(e),t.push(te("fullscreenchange",p)),t.push(te("webkitfullscreenchange",p)),t.push(te("mozfullscreenchange",p)),t.push(te("MSFullscreenChange",p)),_n=!0};return["interactive","complete"].includes(document.readyState)?m():(t.push(te("DOMContentLoaded",()=>{pn({type:a.DomContentLoaded,data:{}}),"DOMContentLoaded"===L&&m()})),t.push(te("load",()=>{pn({type:a.Load,data:{}}),"load"===L&&m()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,ie(t),ht.destroy(),ct.removeLoadListener(),ct.destroy(),nt.clear(),ft.reset(),Sn.reset(),_n=!1,Ee()}}catch(t){console.warn(t)}}Mn.addCustomEvent=(t,e)=>{if(!_n)throw new Error("please add custom event after start recording");pn({type:a.Custom,data:{tag:t,payload:e}})},Mn.freezePage=()=>{$e.forEach(t=>t.freeze())},Mn.takeFullSnapshot=t=>{if(!_n)throw new Error("please take full snapshot after start recording");mn(t)},Mn.mirror=Sn,"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 Rn=Object.create(null);function An(t){return An="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},An(t)}function xn(t,e,n){return(e=function(t){var e=function(t){if("object"!=An(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=An(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==An(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Rn.Node=Object.create(null),Rn.ShadowRoot=Object.create(null),Rn.MutationObserver=Object.create(null),Rn.Element=Object.create(null);var Tn=class{constructor(t){xn(this,"fileName",void 0),xn(this,"functionName",void 0),xn(this,"lineNumber",void 0),xn(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}`}},On=/(^|@)\S+:\d+/,En=/^\s*at .*(\S+:\d+|\(native\))/m,Fn=/^(eval@)?(\[native code])?$/,$n={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(En)?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(En)},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 Tn({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(Fn)},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 Tn({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(t.replace(e,""));return new Tn({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 Tn({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 Tn({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(On)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),n=this.extractLocation(e.pop());return new Tn({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function Dn(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 Ln(t){return Array.isArray(t)}function Nn(t){return"object"==typeof t&&null!==t&&!Ln(t)}function Pn(t,e){if(0===e)return!0;const n=Object.keys(t);for(const i of n)if(Nn(t[i])&&Pn(t[i],e-1))return!0;return!1}function jn(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(Nn(s=e)&&Object.keys(s).length>n.numOfKeysLimit||"function"==typeof s||Nn(s)&&Pn(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]=Ln(i)?Dn(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 Bn={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 zn(t,e,n){const i=n?Object.assign({},Bn,n):Bn,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:$n.parse(e.error).map(t=>t.toString()),payload:[jn(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=[jn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[jn("Uncaught (in promise)",i.stringifyOptions),jn(e.reason,i.stringifyOptions)]),t({level:"error",trace:$n.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=$n.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===n?s.slice(1):s).map(t=>jn(t,i.stringifyOptions));o++,i.lengthThreshold>o?t({level:n,trace:e,payload:r}):o===i.lengthThreshold&&t({level:"warn",trace:[],payload:[jn("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 Wn="u">typeof window?window:void 0,Un="u">typeof globalThis?globalThis:Wn,Hn=null==Un?void 0:Un.document,qn=null==Un?void 0:Un.location;null!=Un&&Un.XMLHttpRequest&&new Un.XMLHttpRequest;const Gn="undefined"!=typeof globalThis?globalThis:Wn;Gn&&"undefined"==typeof self&&(Gn.self=Gn),Gn&&"undefined"==typeof File&&(Gn.File=function(){});const Vn=null!=Wn?Wn:{},Zn=Object.prototype,Jn=Zn.hasOwnProperty,Qn=Zn.toString,Xn=Array.isArray||function(t){return"[object Array]"===Qn.call(t)},Yn=t=>"function"==typeof t,Kn=t=>t===Object(t)&&!Xn(t),ti=t=>void 0===t,ei=t=>"[object String]"==Qn.call(t),ni=t=>null===t,ii=t=>ti(t)||ni(t),ri=t=>"[object Number]"==Qn.call(t)&&t==t,si=t=>"[object Boolean]"===Qn.call(t),oi=t=>t instanceof FormData;function ai(t,e,n,i,r){return e>n&&(i.warn("min cannot be greater than max."),e=n),ri(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),ai(null!=r?r:n,e,n,i))}var li=class{constructor(t){this.C={},this.I=t.I,this.R=ai(t.bucketSize,0,100,t.$),this.A=ai(t.refillRate,0,this.R,t.$),this.O=ai(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 ui(t){return t?t.split("#")[0]:t}const ci="NativeGzipValidationError";let hi;const di=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}(ci,`Native gzip produced invalid output: ${t}`)},fi=(vi=s(function*(t,e){18>t.size&&di("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])&&di("invalid-header");const r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{const e=(()=>{if(hi)return hi;hi=[];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;hi[t]=e>>>0}return hi})();let n=4294967295;for(let i=0;t.length>i;i++)n=e[255&(n^t[i])]^n>>>8;return(4294967295^n)>>>0})(e)&&di("invalid-crc");const s=e.length>>>0;r.getUint32(4,!0)!==s&&di("invalid-size")}),function(t,e){return vi.apply(this,arguments)});var vi;function pi(){return pi=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 fi(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}),pi.apply(this,arguments)}const mi="0.8.3",gi={DEBUG:!1,LIB_VERSION:mi,LIB_NAME:"browser-common",JS_SDK_VERSION:mi},yi=(t,{debugEnabled:e}={})=>{const n={N(n,...i){Wn&&(gi.DEBUG||Wn.POSTHOG_DEBUG||e)&&!ti(Wn.console)&&Wn.console&&("__rrweb_original__"in Wn.console[n]?Wn.console[n].__rrweb_original__:Wn.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)=>yi(`${t} ${e}`,n)};return n},bi=yi("[PostHog.js]"),wi=bi.createLogger;function _i(t,e){if(!ii(t))if(Xn(t))t.forEach(e);else if(oi(t))t.forEach((t,n)=>e(t,n));else for(const n in t)Jn.call(t,n)&&e(t[n],n)}function ki(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 Si=["localhost","127.0.0.1"],Ci=t=>{const e=null==Hn?void 0:Hn.createElement("a");return ti(e)?null:(e.href=t,e)},Ii=()=>{},Mi=t=>{var e;if(Yn(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Ri(t,e,n){try{if(!(e in t))return Ii;const i={next:t[e]},r=n(function(...t){return i.next.apply(this,t)});return Yn(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=Mi(n);for(;s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=Mi(n)}}}catch(t){return Ii}}function Ai(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 xi(t){var e;const n=null==Wn||null===(e=Wn.location)||void 0===e?void 0:e.href;return ti(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(!Yn(i))return e;try{const t=i(e);return ei(t)&&t?t:e}catch(t){return bi.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,n)}const Ti=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}))$"),Oi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ei=[16,15,14,13],Fi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),$i=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Di=/[0-9A-Za-z_]/;function Li(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 Ni=1e6;function Pi(t){var e;return Math.min(Ni,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Ni)}const ji={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:Ni,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},Bi=["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"],zi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Wi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Ui=t=>{ii(t)||_i(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Bi.includes(e)||Wi.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Hi=["/s/","/e/","/i/"];function qi(t,e,n,i){if(ii(t))return t;let r=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ei(r)&&(r=parseInt(r)),r>n?`[SessionRecording] ${i} body too large to record (${r} bytes)`:t}function Gi(t,e){if(ii(t))return t;let n=t;return function(t,e=!0){if(ii(t))return!1;if(ei(t)){if(t=t.trim(),e?Ti.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Oi.lastIndex=0;e=Oi.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 Ei){const i=t+e;if(n.length>=i){const e=n.slice(t,i);if(Ti.test(e)&&Li(e))return!0}}}return!1}(t))return!1;if(e?Fi.test(t):function(t){let e;for($i.lastIndex=0;e=$i.exec(t);){const t=e[1],n=e[3];if(!(t&&n&&Di.test(t)&&Di.test(n)))return!0}return!1}(t))return!1}return!0}(n,!1)||(n="[SessionRecording] "+e+" body redacted"),_i(zi,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 Vi=new WeakSet,Zi=wi("[Recorder]"),Ji=t=>"navigation"===t.entryType,Qi=t=>"resource"===t.entryType;function Xi(t,e){return!!e&&(si(e)||e[t])}function Yi(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 Ki=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function tr({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:!!Yi(e)&&t(e.url)}catch(t){return!1}}(i))return!1;if(r(Ki))return!1;if(si(e))return!0;if(Xn(e))return r(e);const s=e[t];return si(s)?s:r(s)}function er(t,e,n,i,r){return nr.apply(this,arguments)}function nr(){return nr=s(function*(t,e,n,i,r,s=0){if(s>10)return Zi.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=>Qi(t)&&t.initiatorType===e&&(ti(i)||t.startTime>=i)&&(ti(r)||r>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*s)),er(t,e,n,i,r,s+1))}),nr.apply(this,arguments)}function ir({body:t,options:e,url:n}){if(ii(t))return null;const{hostname:i,isHostDenied:r}=Ai(n,e);if(r)return i+" is in deny list";if(ei(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(oi(t))return function(t,e="&"){let n,i;const r=[];return _i(t,function(t,e){ti(t)||ti(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(Kn(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 rr=t=>!ni(t)&&("navigation"===t.entryType||"resource"===t.entryType);function sr({entry:t,method:e,status:n,networkRequest:r,isInitial:s,start:o,end:a,url:l,initiatorType:u}){o=t?t.startTime:o,a=t?t.responseEnd:a;const c=Math.floor(Date.now()-performance.now()),h=Math.floor(c+(o||0)),d=[i(i({},t?t.toJSON():{name:l}),{},{startTime:ti(o)?void 0:Math.round(o),endTime:ti(a)?void 0:Math.round(a),timeOrigin:c,timestamp:h,method:e,initiatorType:u||(t?t.initiatorType:void 0),status:n,requestHeaders:r.requestHeaders,requestBody:r.requestBody,responseHeaders:r.responseHeaders,responseBody:r.responseBody,isInitial:s})];if(rr(t))for(const e of t.serverTiming||[])d.push({timeOrigin:c,timestamp:h,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return d}const or=["video/","audio/"];function ar(t){return Kn(t)&&Yn(t.getReader)&&Yn(t.tee)}const lr="[SessionReplay] Timeout while trying to read body",ur="[SessionReplay] Failed to read body";function cr(t){return`${ur}: ${t}`}function hr(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function dr(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const n=setTimeout(()=>e(lr),500);try{t.clone().text().then(t=>e(t),t=>e(cr(t))).finally(()=>clearTimeout(n))}catch(t){clearTimeout(n),e(ur)}})}(t);const n=Pi(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(hr(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(lr),500);let l;try{l=t.clone()}catch(t){return void o(ur)}const u=l.body;if(!ar(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(cr(t)))}catch(t){o(ur)}return}try{i=u.getReader()}catch(t){return void o(ur)}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(hr(e));h+=i.byteLength,c.push(i)}t()}},t=>o(cr(t)))}()})}(t,n)}function fr(){return(fr=s(function*({r:t,options:e,url:n}){const{hostname:i,isHostDenied:r}=Ai(n,e);return r?Promise.resolve(i+" is in deny list"):dr(t,e)})).apply(this,arguments)}function vr(){return(vr=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=or.some(t=>null==r?void 0:r.startsWith(t));if(r&&s)return`Content-Type ${r} is not supported`;const{hostname:o,isHostDenied:a}=Ai(n,e);return a?o+" is in deny list":null}({r:t,options:e,url:n});return ni(i)?dr(t,e):Promise.resolve(i)})).apply(this,arguments)}let pr=null;function mr(t,e,n){if(!("performance"in e))return()=>{};if(pr)return Zi.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},ji,n):ji,o=e=>{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&&Vi.has(t))(i)),i&&n.push(i)}),n.length>0&&t(i(i({},e),{},{requests:n}))},a=function(t,e,n){n.recordInitialRequests&&t({requests:e.performance.getEntries().filter(t=>Ji(t)||Qi(t)&&n.initiatorTypes.includes(t.initiatorType)).flatMap(t=>sr({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const i=new e.PerformanceObserver(e=>{t({requests:e.getEntries().filter(t=>Ji(t)||Qi(t)&&n.initiatorTypes.includes(t.initiatorType)&&(t=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>sr({entry:t,method:void 0,status:void 0,networkRequest:{}}))})}),r=PerformanceObserver.supportedEntryTypes.filter(t=>n.performanceEntryTypeToObserve.includes(t));return i.observe({entryTypes:r}),()=>{i.disconnect()}}(o,e,r);let l=()=>{},u=()=>{};return(r.recordHeaders||r.recordBody)&&(l=function(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=Xi("request",n.recordHeaders),r=Xi("response",n.recordHeaders),s=Ri(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=>(tr({type:"request",headers:d,url:a,recordBody:n.recordBody})&&(l.requestBody=ir({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),tr({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(l.responseBody=ir({body:h.response,options:n,url:a})),er(e,"xmlhttprequest",s.url,u,c).then(e=>{t({requests:sr({entry:e,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){Zi.error("Failed to instrument XHR for network capture",t)}s.call(h,o,a.toString(),l,u,c)});return()=>{s()}}(o,e,r),u=function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=Xi("request",n.recordHeaders),r=Xi("response",n.recordHeaders),o=Ri(e,"fetch",o=>function(){var a=s(function*(s,a){let l,u;try{l=new Request(s,a)}catch(t){return Zi.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),!ar(null==a?void 0:a.body)&&tr({type:"request",headers:t,url:s,recordBody:n.recordBody})&&(c.requestBody=yield function(t){return fr.apply(this,arguments)}({r:l,options:n,url:s}))}catch(t){Zi.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=Yi(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),tr({type:"response",headers:t,url:s,recordBody:n.recordBody})&&(c.responseBody=yield function(t){return vr.apply(this,arguments)}({r:u,options:n,url:s}))}catch(t){Zi.error("Failed to record fetch response for network capture",t)}return u}finally{er(e,"fetch",l.url,h,d).then(e=>{t({requests:sr({entry:e,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()}}(o,e,r)),pr=()=>{a(),l(),u(),pr=null},pr}const gr="$replay_override_sampling",yr="$replay_override_linked_flag",br="$replay_override_url_trigger",wr="$replay_override_event_trigger",_r="$session_is_sampled",kr="$session_recording_url_trigger_activated_session",Sr="$session_recording_event_trigger_activated_session",Cr="$posthog_sr_group_event_trigger_",Ir="$posthog_sr_group_url_trigger_",Mr="$sess_rec_flush_size",Rr="$stored_person_properties",Ar="$sdk_debug_replay_event_trigger_status",xr="$sdk_debug_replay_linked_flag_trigger_status",Tr="$sdk_debug_replay_matched_recording_trigger_groups",Or="$sdk_debug_replay_pending_trigger_conditions",Er="$sdk_debug_replay_remote_trigger_matching_config",Fr="$sdk_debug_replay_trigger_groups_count",$r="$sdk_debug_replay_url_trigger_status",Dr="$sdk_debug_rrweb_attached",Lr="$sdk_debug_rrweb_start_attempted",Nr="$session_recording_start_reason",Pr="disabled",jr="sampled",Br="active",zr="buffering",Wr="paused",Ur="rrweb_error",Hr="trigger_activated",qr="trigger_pending",Gr="trigger_disabled";function Vr(t,e,n,i,r,s){return 0===e?Gr:(null==t?void 0:t.get_property(n?i+n:r))===s?Hr:qr}function Zr(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 Jr(t){return t.includes("trigger_activated")?Hr:t.includes("trigger_pending")?qr:Gr}function Qr(t){const e=new Set(t);switch(e.delete(Gr),e.size){case 0:return Gr;case 1:return Array.from(e)[0];default:return qr}}var Xr=class{constructor(t){this.q=t}triggerStatus(t){return Jr(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Jr(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Yr=class{constructor(t){this.q=t}triggerStatus(t){return Qr(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Qr(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Kr=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return Hr}stop(){}};const ts=t=>"sessionRecording"in t;var es=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=(ts(t)?Kn(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(ts(t)?Kn(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){bi.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){bi.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return Vr(this._instance,this.j.length,this.V,Ir,kr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[$r]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=xi(this._instance);if(!t)return!1;try{return Zr(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const n=xi(this._instance);if(!n)return;if(n===this.W)return;this.W=n;const i=this.urlBlocked,r=Zr(n,this.B,this.U);i&&r||(r&&!i?t():!r&&i&&e())}checkUrlTriggerConditions(t,e,n,i){const r=xi(this._instance);if(!r)return;if(r===this.W)return;this.W=r;const s=this.urlBlocked,o=Zr(r,this.B,this.U);o&&!s?t():!o&&s&&e();const a=this.G(i)===Hr,l=Zr(r,this.j,this.H);!a&&l&&n("url",r)}stop(){this.W=""}},ns=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({[xr]:t}),t}triggerStatusNoSideEffects(){let t=qr;return ii(this.linkedFlag)&&(t=Gr),this.linkedFlagSeen&&(t=Hr),t}onConfig(t,e){var n;if(this.linkedFlag=(ts(t)?Kn(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!ii(this.linkedFlag)&&!this.linkedFlagSeen){const t=ei(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ei(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((i,r)=>{let s=!1;if(Kn(r)&&t in r){const e=r[t];s=si(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()}},is=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(ts(t)?Kn(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 Vr(this._instance,this.K.length,this.V,Cr,Sr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Ar]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,n){if(0===this.K.length)return;const i=this.X(n)===Hr,r=this.K.includes(t);!i&&r&&e("event",t)}stop(){}},rs=class{constructor(t,e,n){if(this._instance=t,this.group=e,this.Y=new es(t,e.id),this.tt=new is(t,e.id),this.et=new ns(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 Xr(r):new Yr(r)}else this.nt=new Kr}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===qr).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?Ir+this.group.id:Cr+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 ss(t){if(t.rrwebError)return Ur;if(!t.receivedFlags)return zr;if(!t.isRecordingEnabled)return Pr;if(t.urlTriggerMatching.urlBlocked)return Wr;const e=!0===t.isSampled,n=new Xr([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?jr:"trigger_activated"===n?Br:"trigger_pending"===n?zr:!1===t.isSampled?Pr:Br}function os(t){if(t.rrwebError)return Ur;if(!t.receivedFlags)return zr;if(!t.isRecordingEnabled)return Pr;if(t.urlTriggerMatching.urlBlocked)return Wr;const e=new Yr([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==Gr,i=si(t.isSampled);return n&&"trigger_pending"===e?zr:n&&"trigger_disabled"===e||i&&!t.isSampled?Pr:!0===t.isSampled?jr:Br}function as(){const t=[];return function(e,n){if(Kn(n)||Xn(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n}}function ls(t){const e=JSON.stringify(t,as());return e?new Blob([e]).size:0}function us(t){if(ni(t))return 4;if(ti(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(Xn(t)){let e=2;for(let n=0;t.length>n;n++){n>0&&(e+=1);const i=t[n];e+=ti(i)||ni(i)?4:us(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];ti(r)||(i||(n+=1),i=!1,n+=t.length+3+us(r))}return n}default:return 0}}function cs(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[cs({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:n,sessionId:t.sessionId,windowId:t.windowId}),cs({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 hs=Uint8Array,ds=Uint16Array,fs=Uint32Array,vs=new hs([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]),ps=new hs([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]),ms=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gs=function(t,e){for(var n=new ds(31),i=0;31>i;++i)n[i]=e+=1<<t[i-1];var r=new fs(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]},ys=gs(vs,2),bs=ys[1];ys[0][28]=258,bs[258]=28;for(var ws=gs(ps,0)[1],_s=new ds(32768),ks=0;32768>ks;++ks){var Ss=(43690&ks)>>>1|(21845&ks)<<1;_s[ks]=((65280&(Ss=(61680&(Ss=(52428&Ss)>>>2|(13107&Ss)<<2))>>>4|(3855&Ss)<<4))>>>8|(255&Ss)<<8)>>>1}var Cs=function(t,e,n){for(var i=t.length,r=0,s=new ds(e);i>r;++r)++s[t[r]-1];var o,a=new ds(e);for(r=0;e>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new ds(1<<e);var l=15-e;for(r=0;i>r;++r)if(t[r])for(var u=r<<4|t[r],c=e-t[r],h=a[t[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[_s[h]>>>l]=u}else for(o=new ds(i),r=0;i>r;++r)o[r]=_s[a[t[r]-1]++]>>>15-t[r];return o},Is=new hs(288);for(ks=0;144>ks;++ks)Is[ks]=8;for(ks=144;256>ks;++ks)Is[ks]=9;for(ks=256;280>ks;++ks)Is[ks]=7;for(ks=280;288>ks;++ks)Is[ks]=8;var Ms=new hs(32);for(ks=0;32>ks;++ks)Ms[ks]=5;var Rs=Cs(Is,9,0),As=Cs(Ms,5,0),xs=function(t){return(t/8|0)+(7&t&&1)},Ts=function(t,e,n){(null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof ds?ds:t instanceof fs?fs:hs)(n-e);return i.set(t.subarray(e,n)),i},Os=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8},Es=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8,t[i+2]|=n>>>16},Fs=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 hs(0),0];if(1==r){var o=new hs(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 ds(d+1),v=$s(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 hs(f),v]},$s=function(t,e,n){return-1==t.s?Math.max($s(t.l,e,n+1),$s(t.r,e,n+1)):e[t.s]=n},Ds=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new ds(++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]},Ls=function(t,e){for(var n=0,i=0;e.length>i;++i)n+=t[i]*e[i];return n},Ns=function(t,e,n){var i=n.length,r=xs(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)},Ps=function(t,e,n,i,r,s,o,a,l,u,c){Os(e,c++,n),++r[256];for(var h=Fs(r,15),d=h[0],f=h[1],v=Fs(s,15),p=v[0],m=v[1],g=Ds(d),y=g[0],b=g[1],w=Ds(p),_=w[0],k=w[1],S=new ds(19),C=0;y.length>C;++C)S[31&y[C]]++;for(C=0;_.length>C;++C)S[31&_[C]]++;for(var I=Fs(S,7),M=I[0],R=I[1],A=19;A>4&&!M[ms[A-1]];--A);var x,T,O,E,F=u+5<<3,D=Ls(r,Is)+Ls(s,Ms)+o,L=Ls(r,d)+Ls(s,p)+o+14+3*A+Ls(S,M)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return Ns(e,c,t.subarray(l,l+u));if(Os(e,c,1+(D>L)),c+=2,D>L){x=Cs(d,f,0),T=d,O=Cs(p,m,0),E=p;var N=Cs(M,R,0);for(Os(e,c,b-257),Os(e,c+5,k-1),Os(e,c+10,A-4),c+=14,C=0;A>C;++C)Os(e,c+3*C,M[ms[C]]);c+=3*A;for(var P=[y,_],j=0;2>j;++j){var B=P[j];for(C=0;B.length>C;++C)Os(e,c,N[z=31&B[C]]),c+=M[z],z>15&&(Os(e,c,B[C]>>>5&127),c+=B[C]>>>12)}}else x=Rs,T=Is,O=As,E=Ms;for(C=0;a>C;++C)if(i[C]>255){var z;Es(e,c,x[257+(z=i[C]>>>18&31)]),c+=T[z+257],z>7&&(Os(e,c,i[C]>>>23&31),c+=vs[z]);var W=31&i[C];Es(e,c,O[W]),c+=E[W],W>3&&(Es(e,c,i[C]>>>5&8191),c+=ps[W])}else Es(e,c,x[i[C]]),c+=T[i[C]];return Es(e,c,x[256]),c+T[256]},js=new fs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bs=new hs(0),zs=function(){for(var t=new fs(256),e=0;256>e;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Ws=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function Us(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=zs[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 hs(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=Ns(l,u,t.subarray(c,h)):(l[c]=s,u=Ns(l,u,t.subarray(c,o)))}else{for(var d=js[e-1],f=d>>>13,v=8191&d,p=(1<<n)-1,m=new ds(32768),g=new ds(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 fs(25e3),k=new ds(288),S=new ds(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=Ps(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|bs[D]<<18|ws[L];var V=31&bs[D],Z=31&ws[L];I+=vs[V]+ps[Z],++k[257+V],++S[Z],R=c+D,++C}else _[M++]=t[c],++k[t[c]]}}u=Ps(t,l,s,_,k,S,I,M,A,c-A,u),s||(u=Ns(l,u,Bs))}return Ts(a,0,i+xs(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&&Ws(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),Ws(c,h-8,n.d()),Ws(c,h-4,i),c}function Hs(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 qs=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=us(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 li({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,$:bi}),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=ri(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 ri(t)&&isFinite(t)&&Math.floor(t)===t}),Wn&&!ti(Wn.crypto)&&crypto;let Gs=null;const Vs={Et(){if(!ni(Gs))return Gs;if(Gs=!0,ti(Wn))Gs=!1;else try{const t="__support__";Vs.At(t,"xyz"),'"xyz"'!==Vs.Ot(t)&&(Gs=!1),Vs.Lt(t)}catch(t){Gs=!1}return Gs},Pt(t){bi.error("sessionStorage error: ",t)},Ot(t){try{return null==Wn?void 0:Wn.sessionStorage.getItem(t)}catch(t){Vs.Pt(t)}return null},Dt(t){try{return JSON.parse(Vs.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==Wn||Wn.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Vs.Pt(t)}return!1},Lt(t){try{null==Wn||Wn.sessionStorage.removeItem(t)}catch(t){Vs.Pt(t)}}};gi.DEBUG=!1,gi.LIB_VERSION="1.431.0",gi.LIB_NAME="web";var Zs=gi,Js=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(Mr,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(Mr);return Kn(n=e)&&ei(n.sessionId)&&ri(n.size)&&e.sessionId===t?e.size:0;var n}};function Qs(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<ai(100*e,0,100,bi)}const Xs=(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}},Ys=t=>t.toLowerCase(),Ks={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=>Xs(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!Xs(e,t))),icontains:(t,e)=>e.map(Ys).some(e=>t.map(Ys).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(Ys).every(e=>t.map(Ys).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))})},to=new Set(["is_not","not_icontains","not_regex"]);function eo(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(ti(r)||ni(r))return to.has(s);const o=Ks[s];return!!o&&!ti(t.value)&&!ni(t.value)&&o(Xn(t.value)?t.value.map(String):[String(t.value)],Xn(r)?r.map(String):[String(r)])})}const no=wi("[SessionRecording]");function io(t,e){return e?t:"!"+t}function ro(t,e){return t===e||t!=="!"+e&&null}var so=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=os}onRemoteConfig(t){this.Ht=ri(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new Xr([this.tt,this.Y]),this.zt=ss):(this.Ut=new Yr([this.tt,this.Y]),this.zt=os),this._instance.register_for_session({[Er]: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 ri(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&&ii(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,n,e)}catch(t){no.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const n=this.Ht;var i,r;if(!ri(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(_r),o=this._instance.get_property("$replay_sample_rate"),a=ro(s,t),l=ri(o)&&o!==n,u=ti(o)&&s===t,c=l||u||!si(a),h=c?Qs(t,n):a;c&&(h?this.qt("sampled"):no.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:io(t,h),$replay_sample_rate:ni(o)&&s===t?null:n})}ensureSamplingDecision(t){if(!ri(this.Ht))return;const e=this._instance.get_property(_r);si(ro(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))===qr}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===qr).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()}},oo=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({[Er]:"v2_trigger_groups",[Fr]:t.triggerGroups.length}),this.Y.onConfig(t)):no.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Ur;if(!t.receivedFlags)return zr;if(!t.isRecordingEnabled)return Pr;if(t.urlTriggerMatching.urlBlocked)return Wr;const e=t.triggerGroupMatchers,n=t.triggerGroupSamplingResults;if(0===e.length)return Pr;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);ti(e)?bi.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(r=!0)}else"trigger_pending"===e&&(i=!0)}return r?jr:i?zr:Pr}({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;ri(t)&&(ni(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 no.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(Rr);r.some(e=>!e.properties||0===e.properties.length||eo(e.properties,t.properties,s))&&(n.activateTrigger(i,e),this.updateActiveTriggers(e),this.Bt(i))},e)}catch(t){no.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(Kn(a)){const e=a.sessionId,n=a.sampleRate,i=a.sampled;u="string"==typeof e&&e!==t,c=ri(n)&&n!==s,l=e===t&&ri(n)&&n===s&&si(i)?i:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!si(l),f=d?Qs(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({[Tr]: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||eo(n,e,this._instance.get_property(Rr))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new rs(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 ao=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lo=1e5,uo=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,co=[],ho=()=>!1,fo="@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(" "),vo="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),po="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(" "),mo="Accommodation AdministrativeArea Country Place State".split(" "),go={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:vo,publisher:po},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:co},Offer:{seller:po},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:po,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:po,areaServed:mo,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:co}},yo=[["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(" "),go.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),go.Event],[po,go.Organization],[mo,go.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),go.Product]];function bo(t,e){return Jn.call(t,e)?t[e]:void 0}function wo(t){const e=typeof t;return ni(t)||"string"===e||"number"===e||"boolean"===e}function _o(t,e){return e&&function(t){return ei(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function ko(t,e){return Xn(t)&&t.every(wo)?t.map(t=>_o(t,e)).filter(t=>!ti(t)):wo(t)?_o(t,e):void 0}function So(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 Co(t){if(Jn.call(go,t))return go[t];for(const[e,n]of yo)if(e.includes(t))return n}function Io(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Mo(t,e,n,i){if(Xn(t)){const r=t.map(t=>Mo(t,e,n,i)).filter(t=>!ti(t));return r.length?r:void 0}return Ro(t,e,n,i)||void 0}function Ro(t,e,n,i){if(!Kn(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(n))return null;const r=bo(t,"@type"),s=function(t){const e=new Set,n="string"==typeof t?[t]:Xn(t)?t:[],i=[];for(const t of n){if("string"!=typeof t)continue;const n=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&uo.test(n)&&!e.has(n)&&(e.add(n),i.push(n),20===i.length))break}return i}(r),o=s.filter(t=>!!Co(t)&&(!i||!i.length||i.includes(t))),a={};for(const i of fo){const o="@type"===i?s.length?"string"==typeof r?s[0]:s:void 0:"@id"===i?So(bo(t,i),e):ko(bo(t,i),n.maskUrl);ti(o)||Io(a,i,o)}for(const i of o){const r=Co(i);for(const i of Object.keys(r)){const s=bo(t,i),o=r[i];if(!0===o){const t=ko(s,n.maskUrl);ti(t)||Io(a,i,t)}else{const t=Mo(s,e,n,o);ti(t)||Io(a,i,t)}}}const l=Mo(bo(t,"@graph"),e,n);return ti(l)||Io(a,"@graph",l),Object.keys(a).length?a:null}function Ao(t,e,n){if(!Kn(t))return null;const r=bo(t,"@context");if("string"!=typeof r||!/^https?:\/\/schema\.org\/?$/.test(r))return null;const s=Ro(t,e,n);return s?i({"@context":"https://schema.org"},s):null}function xo(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function To(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 Oo(t,e,n){for(let i=t;i;){if(To(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 Eo(t){return xo(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(xo)}function Fo(t){return ti(t)?void 0:Math.round(t)}function $o(t){return Kn(t)?t.network_timing:t}const Do=wi("[SessionRecording]"),Lo=[1,2,3,4,5,6,7,12],No=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Po(){var t;return null==Vn||null===(t=Vn.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function jo(){var t;return null===(t=Po())||void 0===t?void 0:t.record}function Bo(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,as())}}function zo(t){return Hs(Us(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new hs(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 hs(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 Ts(n,0,i)}(Bo(t))),!0)}function Wo(t){return Uo.apply(this,arguments)}function Uo(){return Uo=s(function*(t){const e=yield function(t){return pi.apply(this,arguments)}(Bo(t),Zs.DEBUG,{rethrow:!0});return Hs(new Uint8Array(yield e.arrayBuffer()),!0)}),Uo.apply(this,arguments)}let Ho,qo;const Go="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let Vo=!1;function Zo(t){var e;return Xn(t)&&0===t.length?(Ho=null!==(e=Ho)&&void 0!==e?e:zo([]),Ho):zo(t)}function Jo(t){return Qo.apply(this,arguments)}function Qo(){return(Qo=s(function*(t){var e;return Xn(t)&&0===t.length?Ho||(qo=null!==(e=qo)&&void 0!==e?e:Wo([]).then(t=>(Ho=t,t)).catch(t=>{throw Ho=void 0,qo=void 0,t}),qo):Wo(t)})).apply(this,arguments)}function Xo(t){return Go&&!Vo&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Yo(t){return{event:t,size:us(t)}}function Ko(t,e){return i(i({},t),{},{data:e,cv:"2024-10"})}function ta(t,e){return i(i({},t),{},{cv:"2024-10",data:i(i({},t.data),e)})}function ea(t){try{if(2===t.type)return Yo(Ko(t,zo(t.data)));if(3===t.type&&0===t.data.source)return Yo(ta(t,{texts:Zo(t.data.texts),attributes:Zo(t.data.attributes),removes:Zo(t.data.removes),adds:Zo(t.data.adds)}));if(3===t.type&&8===t.data.source)return Yo(ta(t,{adds:t.data.adds?zo(t.data.adds):void 0,removes:t.data.removes?zo(t.data.removes):void 0}))}catch(t){Do.error("could not compress event - will use uncompressed event",t)}return{event:t,size:ls(t)}}function na(){return(na=s(function*(t){try{if(2===t.type)return Yo(Ko(t,yield Wo(t.data)));if(3===t.type&&0===t.data.source){const[e,n,i,r]=yield Promise.all([Jo(t.data.texts),Jo(t.data.attributes),Jo(t.data.removes),Jo(t.data.adds)]);return Yo(ta(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?Wo(t.data.adds):void 0,t.data.removes?Wo(t.data.removes):void 0]);return Yo(ta(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===ci})(e)&&(Vo=!0),Do.error("could not compress event asynchronously - trying synchronous compression",e),ea(t)}return{event:t,size:ls(t)}})).apply(this,arguments)}function ia(t,e){return 5===t.type&&t.data.tag===e}function ra(t){return ia(t,"sessionIdle")}function sa(t){return ia(t,"$session_ending")}function oa(t){return ia(t,"$session_starting")}var aa=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 ro(this._instance.get_property(_r),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return ri(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=!1,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=[],this.Re=void 0,this.$e=void 0,this.Ee=!1,this.Ae=[],this.Oe=0,this.Le=0,this.Pe=!1,this.De=void 0,this.Wt=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=void 0,this.je=(t,e,n)=>{var i,r,s,o;if(!n)return;if(t===this.Xt&&e===this.Be)return;const a=!n.noSessionId&&(n.activityTimeout||n.sessionPastMaximumLength),l=this.Xt,u=this.Be;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.He)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),this._e=!1,null===(r=Po())||void 0===r||null===(s=r.resetMaxDepthState)||void 0===s||s.call(r),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:n}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.Ue(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.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$session_past_minimum_duration)===this.Xt},this.Ze=()=>{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 ri(n)&&ri(i)?i-n:null},this.Ge=()=>{var t,e;const n=this.ie;if(!ri(n))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return ri(t)&&t>=0&&n>t}if(this.Ve())return!1;const i=this.Ze();return!!ni(i)||n>i||(null===(r=this._instance.persistence)||void 0===r||r.register({$session_past_minimum_duration:this.Xt}),!1);var r},this.Je=()=>{"buffering"!==this.status?(this.me&&this.ge&&this.Ke&&!this.ye&&this.Xe(void 0),this.Ye(),this.tn(!0)):this.en()},this.nn=()=>{this.Je()},this.rn=()=>{this.Vt("browser offline",{})},this.sn=()=>{this.Vt("browser online",{})},this.an=()=>{(null==Hn?void 0:Hn.visibilityState)&&("visible"===Hn.visibilityState&&(this.Ke=!0),this.Vt("window "+Hn.visibilityState,{}))},this.Ke=null==e||e;const{sessionId:n,windowId:i,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=n,this.Be=i,this._sessionStartTimestamp=r,this.et=new ns(this._instance),this.Y=new es(this._instance),this.tt=new is(this._instance),this.Rt=this.en(),this.ln="ph_"+(this._instance.config.persistence_name||this._instance.config.token)+"_replay_pending_buffer",this.Yt.sessionTimeoutMs>this.te||Do.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.He=new Js(this._instance)}setDocumentWasEverVisible(t){t&&(this.Ke=!0)}get un(){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 ti(h)&&ti(d)&&ti(f)&&ti(v)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:f,maskAllElementAttributes:v}}cn(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(ii(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!ti(i)&&i!==r});0!==i.length&&(this.xe=!0,Do.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 dn(){var t;return ai(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,wi("canvas recording resolution scale"),1)}get hn(){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:ai(c,0,12,wi("canvas recording fps"),4),quality:ai(h,0,1,wi("canvas recording quality"),.4)}}get fn(){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 vn(){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=$o(this._instance.config.capture_performance),l=$o(null==i?void 0:i.capturePerformance),u=!!(si(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}pn(){var t,e;const n=[],r=null===(t=Vn.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.fn&&n.push(r());const s=null===(e=Vn.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.vn&&Yn(s))if(!Si.includes(qn.hostname)||this._forceAllowLocalhostNetworkCapture){const t=Yn(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;n.push(s(((t,e,n)=>{const r={payloadSizeLimitBytes:ji.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ji.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ji.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=Pi(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=qi(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=qi(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=Ci(t.name);let s=0===e.indexOf("http")?null===(i=Ci(e))||void 0===i?void 0:i.pathname:e;"/"===s&&(s="");const o=null==r?void 0:r.pathname.replace(s||"","");return r&&o&&Hi.some(t=>0===o.indexOf(t))?void 0:t})((Ui((i=e).requestHeaders),Ui(i.responseHeaders),i),t.api_host,n));var i},c=Yn(t.session_recording.maskNetworkRequestFn);return c&&Yn(t.session_recording.maskCapturedNetworkRequestFn)&&bi.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=Yn(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 ii(o)&&s?(Vi.add(s),s):null!=o?o:void 0}:t=>function(t){if(!ti(t))return t.requestBody=Gi(t.requestBody,"Request"),t.responseBody=Gi(t.responseBody,"Response"),t}(u(t)),i(i(i({},ji),r),{},{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else Do.info("NetworkCapture not started because we are on localhost.");return n}mn(t){return this._instance.config.disable_capture_url_hashes?ui(t):t}gn(t,e=!1){const n=e?ui(t):this.mn(t),i=this._instance.config.mask_personal_data_properties?[...ao,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(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("=");Xn(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))}yn(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}bn(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}):Do.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(No(()=>jo().addCustomEvent(t,e)))}wn(){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}kn(t){if(!this.wn())return!1;try{const e=jo();return!!e&&(e.addCustomEvent("$json_ld",t),this.wn())}catch(t){return!1}}_n(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.Sn)||void 0===e?void 0:e.scan(t)})}xn(){try{if(this._instance.config.capture_pageview||!Wn)return;const t=new URL(Wn.location.href),e=this.gn(t.origin+t.pathname+t.search);this.Cn!==e&&(this.Cn=e,this.Vt("$url_changed",{href:e}))}catch(t){}}Mn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.bn(t)})}}jt(){return this.bn(No(()=>jo().takeFullSnapshot()))}get In(){var t,e,n;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var i;const t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.trigger_pending_buffer_interval_millis;return ri(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}Tn(){if(this.Rn&&clearInterval(this.Rn),!0===this.de)return;const t=this.In;t&&(this.Rn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.$n(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Tn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.Sn)||void 0===t||t.scan(),clearInterval(this.Rn),Do.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this.Sn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this._n(),this.Tn(),this.Vt("recording resumed",{reason:"left blocked url"}),Do.info("recording resumed"))}On(t,e){var n;if("event"===t&&this.$n(),!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?kr:Sr;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.tn(),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=Kn(t)?t:JSON.parse(t)}catch(t){return void Do.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var n;const i=null!==(n=e.cache_timestamp)&&void 0!==n?n:Date.now();if(Date.now()-i>36e5)return void Do.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:t})}return e}Ln(t,e,n){this._instance.get_property(t)&&(e(),n())}start(t){var e,n;const i=this.ne;if(!i)return void Do.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.be;this.Xe(t?"no_interaction_since_recording_started":void 0),this.be=!1,this.ge=t,this.ye=!1}this.Pe&&(this.Pn(),this.en());const{sessionId:r,windowId:s,sessionStartTimestamp:o}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=r,this.Be=s,this._sessionStartTimestamp=o,this.Dn(),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 oo(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new so(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.On(t,e)),this.Ln(gr,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(gr)}),this.Ln(yr,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(yr)}),this.Ln(wr,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(wr)}),this.Ln(br,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(br)}),this.re.makeSamplingDecisions(this.sessionId),this.Fn(),this.we||(ki(Wn,"beforeunload",this.Je),ki(Wn,"pagehide",this.nn),ki(Wn,"offline",this.rn),ki(Wn,"online",this.sn),ki(Hn,"visibilitychange",this.an),!this.Fe&&Yn(this.Yt.onSessionId)&&(this.Fe=this.Yt.onSessionId(this.je)),!this.Ne&&Yn(this.Yt.on)?this.Ne=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,n)=>{var i;null===(i=this.qe)||void 0===i||i.call(this),this.qe=void 0,this.je(t,e,n)})}):Yn(this.Yt.on)||Do.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),ii(this.De)&&(this.De=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.gn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Do.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(t||"recording_initialized"))}Nn(){var t,e,n,i,r,s;null==Wn||Wn.removeEventListener("beforeunload",this.Je),null==Wn||Wn.removeEventListener("pagehide",this.nn),null==Wn||Wn.removeEventListener("offline",this.rn),null==Wn||Wn.removeEventListener("online",this.sn),null==Hn||Hn.removeEventListener("visibilitychange",this.an),clearInterval(this.Rn),this.qn(),null===(t=this.De)||void 0===t||t.call(this),this.De=void 0,null===(e=this.Wt)||void 0===e||e.call(this),this.Wt=void 0,null===(n=this.Fe)||void 0===n||n.call(this),this.Fe=void 0,null===(i=this.Ne)||void 0===i||i.call(this),this.Ne=void 0,null===(r=this.qe)||void 0===r||r.call(this),this.qe=void 0,null===(s=this.re)||void 0===s||s.stop(),this.jn(),this.Pn()}Pn(){this.Le+=1,this.Ae=[],this.Oe=0,this.Bn=void 0,this.Pe=!1}jn(){var t,e;null===(t=this.Hn)||void 0===t||t.stop(),this.ce=[],null===(e=this.Sn)||void 0===e||e.stop(),this.Sn=void 0,this.ae=!1;try{var n;null===(n=this.se)||void 0===n||n.call(this)}catch(t){Do.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.Un=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),Do.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),Do.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.zn())return;this.tn(),this.en(),this.Wn(),this.Nn(),Do.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}Ue(t){this.We=!0,this.le=Date.now();try{var e,n;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=Po())||void 0===e||null===(n=e.resetSnapshotCostState)||void 0===n||n.call(e),this.start("session_id_changed")}finally{this.We=!1}this.Xe(t?"no_interaction_since_session_rotated":void 0),this.ge=!1}Xe(t,{preserveLogDedup:e=!1}={}){if(this.me=!ti(t),this.Un=t,ti(t))return void(e||(this.Gn=void 0));if(this.We)return;const n=`${this.sessionId}:${t}`;n!==this.Gn&&(this.Gn=n,Do.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}$n(){this.isStarted||(this.be=!0),this.me&&(this.Xe(void 0),this.ge=!1,this.ye&&(this.ye=!1,this.jt()),this.Qn())}discard({discardProducerEvents:t=!1}={}){this.me=!0,t&&(this.en(),this.jn()),this.en(),this.Nn(),this.en(),this.Wn(),Do.info("discarded")}Jn(t,e,n,i,r){const s={$snapshot_bytes:n,$snapshot_data:e,$session_id:i,$window_id:r};"disabled"!==this.status?(this.Kn(t,i),this.Xn(s)):this.en()}Yn(){try{this.ti()}catch(t){this.Se||(this.Se=!0,Do.error("could not track full snapshot cost",t))}}ti(){var t,e;const n=null===(t=Po())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);n&&n!==this.Zn&&(this.Zn=n,this.Vn&&this.Vn.durationMs>=n.durationMs||(this.Vn=n),500>n.durationMs||Do.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}))}Kn(t,e){2!==t.type?3===t.type&&(ti(this.Re)||this.Re===e||this.$e===e||(this.$e=e,Do.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Re=e}ei(t){t.counted&&t.generation===this.Le&&(this.Oe=Math.max(0,this.Oe-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ni(t,e,n){t.processed||t.generation!==this.Le||(t.processed=!0,this.Jn(t.event,e,n,t.targetSessionId,t.targetWindowId))}ii(t){try{let e=t.event,n=ls(t.event);if(t.compressionEnabled)try{({event:e,size:n}=ea(t.event))}catch(t){Do.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,n)}catch(t){Do.error("could not capture queued compression event",t)}}finally{this.ei(t)}}Ye(){[...this.Ae].forEach(t=>{this.ii(t)})}ri(t,e,n,i){var r=this;const o={event:t,compressionEnabled:e,targetSessionId:n,targetWindowId:i,generation:this.Le,processed:!1,counted:!0};this.Ae.push(o),this.Oe+=1;const a=(l=s(function*(){try{if(o.processed)return;let n,i;try{const r=e?Xo(t)?yield function(t){return na.apply(this,arguments)}(t):ea(t):{event:t,size:ls(t)};n=r.event,i=r.size}catch(e){Do.error("could not process queued compression event - will use uncompressed event",e),n=t,i=ls(t)}r.ni(o,n,i)}finally{r.ei(o)}}),function(){return l.apply(this,arguments)});var l;this.Bn=this.Bn?this.Bn.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.Mn(),!t||!Kn(t))return;if(4===t.type){const e=this.gn(t.data.href);if(this.Cn=e,!e)return;t.data.href=e}else this.xn();if(null===(e=this.re)||void 0===e||e.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.On(t,e)),this.Y.urlBlocked&&(5!==(c=t).type||"recording paused"!==c.data.tag))return;2===t.type&&((null===(h=Po())||void 0===h||null===(d=h.wasMaxDepthReached)||void 0===d?void 0:d.call(h))&&(this._e=!0),this.Yn(),Promise.resolve().then(()=>this.Yn()),this.Tn(),null===(f=this.Hn)||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.oi();const m=this.Hn?this.Hn.throttleMutations(t):t;if(!m)return void(!0===this.de&&this.he++);const g=function(t){const e=t;if(e&&Kn(e)&&6===e.type&&Kn(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 sa(t)?t.data.payload:null}(g),b=function(t){return oa(t)?t.data.payload:null}(g),w=function(t){return ra(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.si(g),2===t.type&&(this.Te.push([this.Xt,t.timestamp]),this.Te.length>6&&(this.Te=this.Te.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.Be;if(!0===this.de&&!function(t){return ra(t)||sa(t)||oa(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._n(!0):S||this._n();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=Wn?this.gn(Wn.location.href):void 0}catch(t){}g.data.href=t}if(this.Oe>0||C&&Xo(g))return void this.ri(g,C,_,k);const{event:I,size:M}=C?ea(g):{event:g,size:ls(g)};this.Jn(g,I,M,_,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.we,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):Pr}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.$n(),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.$n(),this.qt("sampling_overridden")}overrideTrigger(t){this.On(t),this.$n()}ai(){try{var t;const e=null==Wn||null===(t=Wn.location)||void 0===t?void 0:t.href;if(!e)return;const n=this.gn(e);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}qn(){this.li&&(clearTimeout(this.li),this.li=void 0)}Qn(){this.li||(this.li=setTimeout(()=>{this.tn()},2e3))}ui(){return this.Re!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!sa(t)&&!oa(t))}ci(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}di(t){if("buffering"!==t)return ti(this.hi)||this._instance.register_for_session({[Or]:[]}),void(this.hi=void 0);const e=this.ci();if(0===e.length)return ti(this.hi)||this._instance.register_for_session({[Or]:[]}),void(this.hi=void 0);const n=e.join(", "),i=`${this.sessionId}:${n}`;i!==this.hi&&(this.hi=i,this._instance.register_for_session({[Or]:e}),Do.info(`buffering: ${n}`))}fi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.pi)&&Vs.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Vs.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Vs.Dt(this.ln);Vs.Lt(this.ln),Kn(t)&&Xn(t.data)&&0!==t.data.length&&Xn(t.sizes)&&t.sizes.length===t.data.length&&ri(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Be&&(this.Rt.data.length>0||(this.Rt=t))}tn(t=!1){var e;if(this.qn(),this.me)return this.Rt;if(this.ui())return this.Rt.size>943718.4?this.en():(t&&this.mi(),this.Rt);const n=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const i=this.Ge(),r=this.status;if(this.di(r),"buffering"===r||"paused"===r||"disabled"===r||i)return!t||"active"!==r&&"sampled"!==r||this.mi(),this.Qn(),this.Rt;if(this.Rt!==n)return this.Rt;if(n.data.length>0){var s;const t=this.ai();cs(n).forEach(e=>{try{var n;null===(n=this.He)||void 0===n||n.trackSize(e.sessionId,e.size),this.yi({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Zs.LIB_NAME,$lib_version:Zs.LIB_VERSION,$snapshot_host:t})}catch(t){Do.warn("could not capture snapshot chunk - skipping it",t)}}),ti(this.gi)||(Vs.Lt(this.ln),this.gi=void 0),null===(s=this.re)||void 0===s||s.onFlushComplete()}return this.en()}Xn(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.me&&this.Rt.size+t.$snapshot_bytes+n>943718.4){const e=this.Xt;if(this.Rt=this.tn(),this.Xt!==e)return;r&&this.Rt.data.length>0&&(this.Rt=this.en()),this.Rt.sessionId=i,this.Rt.windowId=t.$window_id}this.me&&(this.ye||this.Rt.size+t.$snapshot_bytes+n>943718.4)?this.ye||(this.ye=!0,this.Rt=this.en()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.me||this.Qn())}yi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const n=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return n?n.timestamp-this._sessionStartTimestamp:null}oi(){if(!this.Rt||0===this.Rt.data.length)return this.en();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.en():(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)}en(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Be},this.Rt}qt(t,e){this._instance.register_for_session({[Nr]:t}),Do.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",i({reason:t},e))}bi(t){var e;return 3===t.type&&-1!==Lo.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),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.Be}),this.tn());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.Be!==n;if(this.Be=n,this.Xt=i,s||o){const t=s&&!1!==this.de;t&&(this.de="unknown"),this.Ue(t)}else if(e&&this.$n(),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._n(),this.Tn()}}ze(){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;const d=null===(t=Po())||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.Un,$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.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(n=this.He)||void 0===n?void 0:n.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:Fo(null===(i=this.Vn)||void 0===i?void 0:i.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Fo(null===(r=this.Vn)||void 0===r?void 0:r.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(s=this.Vn)||void 0===s?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Vn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this.Vn)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==d?void 0:d.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==d?void 0:d.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==d?void 0:d.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Fo(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Fo(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Fo(null===(l=Po())||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=Po())||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_rrweb_error:this.we,[Dr]:!!this.se,[Lr]:this.ke}}Fn(){var t;if(this.se)return;this.ke=!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={};ti(t.mousemove)||(n.mousemove=t.mousemove),ti(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.hn&&this.hn.enabled&&(e.recordCanvas=!0,e.sampling=i(i({},e.sampling),{},{canvas:this.hn.fps}),e.dataURLOptions={type:"image/webp",quality:this.hn.quality},e.canvasResolutionScale=this.dn,e.canvasMasking={configured:()=>{var t;return Yn(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(Yn(n))try{var i;return null!==(i=n(t))&&void 0!==i?i:null}catch(t){return this.Me||(this.Me=!0,Do.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.un&&(e.maskAllInputs=null===(r=this.un.maskAllInputs)||void 0===r||r,e.maskTextSelector=null!==(s=this.un.maskTextSelector)&&void 0!==s?s:void 0,e.blockSelector=null!==(o=this.un.blockSelector)&&void 0!==o?o:void 0,e.maskAllElementAttributes=null!==(a=this.un.maskAllElementAttributes)&&void 0!==a&&a),e.maskAllElementAttributes&&e.maskAttributeFn&&(e.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,Do.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.cn();const l=jo();if(!l)return void Do.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Hn=null!==(t=this.Hn)&&void 0!==t?t:new qs(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`;Do.info(n,{node:e}),this.log("[SessionRecording] "+n,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const u=this.pn();if(this.se=l(i({emit:t=>{this.onRRwebEmit(t)},plugins:u,errorHandler:(t,e)=>"rrweb"===e&&(this.Ie||(this.Ie=!0,Do.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},e)),!this.se)return this.we=!0,void Do.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.we=!1,!0===(null==n?void 0:n.captureJsonLd)&&Hn&&(null==Wn?void 0:Wn.MutationObserver)&&!this.Sn&&(this.Sn=function(t,e,n){const i=new WeakMap,r=n.getCaptureState||(()=>!0);let s=lo;const o=function(t,e){const n=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==n?void 0:n.length)&&!n.includes("id")?ho:n=>{const i=t.getElementById(n);return!!i&&"SCRIPT"!==i.nodeName&&(!e.isRecordedElement||e.isRecordedElement(i))&&!Oo(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 Oo(t,e.blockClass,e.blockSelector)||Oo(t,e.maskTextClass,e.maskTextSelector)}(e,n))return;const l=function(t,e=ho,n){if(!t||t.length>lo)return null;try{const i=JSON.parse(t),r={maskUrl:n,remainingNodes:2048,exceeded:!1},s=Xn(i)?i.map(t=>Ao(t,e,r)):Ao(i,e,r);if(r.exceeded||ni(s)||Xn(s)&&(!s.length||s.some(ni)))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(ni(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 Eo(t))a(e)};for(const n of t)if("childList"===n.type)xo(n.target)&&a(n.target),n.addedNodes.forEach(e);else if("characterData"===n.type){const t=n.target.parentNode;t&&xo(t)&&a(t)}else"attributes"===n.type&&xo(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()&&Eo(t.documentElement).forEach(t=>{e&&i.delete(t),a(t)})},stop(){return n.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(Hn,Wn.MutationObserver,{maskUrl:t=>this.gn(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.wn()},emit:t=>this.kn(t)}),this.Y.isCurrentUrlBlocked()&&this.Sn.scan()),this.le=Date.now(),this.de=si(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)}};Vn.__PosthogExtensions__=Vn.__PosthogExtensions__||{},Vn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:zn,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:mr,options:t})},Vn.__PosthogExtensions__.rrweb={record:Mn,version:"v2",wasMaxDepthReached:()=>Qt,resetMaxDepthState(){Qt=!1,Jt=!1},getLastSnapshotCost:()=>P,getMutationCost:()=>i({},U),getDeferredStylesheetStats:()=>i({},H),getDiscardedDurationSamples:()=>x,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}}},Vn.__PosthogExtensions__.initSessionRecording=(t,e)=>new aa(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=/^[^ \t\n\r\u000c]+/,Lt=/^[, \t\n\r\u000c]+/,Nt=new WeakMap;function Pt(t,e){return e&&""!==e.trim()?jt(t,e):e}function jt(t,e){let n=Nt.get(t);if(n||(n=t.createElement("a"),Nt.set(t,n)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return n.setAttribute("href",e),n.href}function Bt(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 zt(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=Pt(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)),Bt(t,s)}if("image"===e)return Bt(n,s)}return n}if("xlink:href"===n&&"#"!==i[0]){const n=Pt(t,i);return"image"===e&&n.startsWith("data:")?Bt(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(Lt),e.length>n;){let s=i(Dt);if(","===s.slice(-1))s=Pt(t,s.substring(0,s.length-1)),r.push(s);else{let i="";s=Pt(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,jt(t)):"object"===e&&"data"===n?Pt(t,i):i:Pt(t,i)}function Wt(t,e,n){return("video"===t||"audio"===t)&&"autoplay"===bt(e)}function Ut(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&Ut(M.parentNode(t),e,n);for(let n=t.classList.length;n--;)if(e.test(t.classList[n]))return!0;return!!n&&Ut(M.parentNode(t),e,n)}function Ht(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(Ut(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 qt(t,e,n){const i=t.removeEventListener;"function"==typeof i&&i.call(t,e,n)}var Gt=new Map;function Vt(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Zt(t){return null==t?"":t.toLowerCase()}var Jt=!1,Qt=!1;function Xt(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 Qt=!0,Jt||(Jt=!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=Ht(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];Wt(b,i.name)||(_[i.name]=zt(n,b,bt(i.name),i.value,t,c))}if("link"===b&&s&&!y){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=Vt(n,i),!e&&i.includes(".css"))&&(e=Vt(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)}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()))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;if(new Uint32Array((kt in r?r[kt]:r).call(e,n,i,Math.min(50,t.width-n),Math.min(50,t.height-i)).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)}let S,C=!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)=>C?_t({element:t,name:e,value:n,maskAllElementAttributes:l,maskAttributeFn:u}):n,o=()=>{qt(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 I,R,A;const{width:e,height:i,left:r,top:s}=t.getBoundingClientRect(),o=null===(I=n.defaultView)||void 0===I?void 0:I.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${i}px`,rr_left:`${Math.floor(r+((null===(R=n.defaultView)||void 0===R?void 0:R.scrollX)||0))}px`,rr_top:`${Math.floor(s+((null===(A=n.defaultView)||void 0===A?void 0:A.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)}));C=!0;try{customElements.get(b)&&(S=!0)}catch(t){}return{type:f.Element,tagName:b,attributes:_,childNodes:[],isSVG:(x=t,Boolean("svg"===x.tagName||x.ownerSVGElement)||void 0),needBlock:y,rootId:g,isCustom:S};var x}(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,jt(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&&(Zt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Zt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Zt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Zt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Zt(t.attributes.property).match(/^(og|twitter|fb):/)||Zt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Zt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Zt(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(Zt(t.attributes.name))||Zt(t.attributes.property).match(/^article:/)||Zt(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(Zt(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=Xt(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=Xt(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),qt(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?qt(t,"load",o):(i=!0,qt(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),qt(t,"load",o)}}return t.addEventListener("load",o),()=>{qt(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&k){const n=Xt(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&&"stylesheet"===j.attributes.rel&&function(e,l,f){if(Gt.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=Xt(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{Gt.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}),Gt.set(e,M)}(t,0,R),j}function Yt(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 Kt=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 te(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>ee(n,t,e,i)}function ee(t,e,n,i){ne(()=>{const r=t.removeEventListener;"function"==typeof r&&(void 0!==i?r.call(t,e,n,i):r.call(t,e,n))})}function ne(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function ie(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var re="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.",se={map:{},getId(){return console.warn(re),-1},getNode(){return console.warn(re),null},removeNodeFromMap(){console.warn(re)},has(){return console.warn(re),!1},reset(){console.warn(re)}};function oe(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 ae(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e);return r.Object.defineProperty(t,e,i?n:{set(t){if(setTimeout(()=>{try{n.set.call(this,t)}catch(t){}},0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>ae(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(se=new Proxy(se,{get(t,e,n){return"map"===e&&console.warn(re),Reflect.get(t,e,n)}}));var le=Date.now;function ue(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 ce(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function he(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function de(t){return t?t.nodeType===t.ELEMENT_NODE?t:M.parentElement(t):null}function fe(t,e,n,i){if(!t)return!1;const r=de(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(Ut(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 ve(t,e,n){return!("TITLE"!==t.tagName||!n.headTitleMutations)||-2===e.getId(t)}function pe(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||pe(i,e))}function me(t){return Boolean(t.changedTouches)}function ge(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function ye(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function be(t){return!!t&&(t instanceof Kt&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(M.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(le=()=>(new Date).getTime());var we=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 _e(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 ke(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=_e(n);)n=e;return n}(t);return M.contains(e,n)}(t)}function Se(t){return"__ln"in t}var Ce,Ie=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&&Se(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&&Se(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--)}},Me=(t,e)=>`${t}@${e}`,Re=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 Ie,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||!ke(s)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=rt(a)?this.mirror.getId(_e(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=>{ge(t,this.mirror)&&this.iframeManager.addIframe(t),ye(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),be(t)&&!fe(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=Xt(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)xe(this.removesSubTreeCache,t)&&!this.movedSet.has(M.parentNode(t))||s(t);for(const t of this.addedSet)Te(this.droppedSet,t)||xe(this.removesSubTreeCache,t)?Te(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(!ve(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=M.textContent(t.target);fe(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Ht(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,de(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(fe(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"),!Wt(r,a)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=zt(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(fe(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);fe(t.target,this.blockClass,this.blockSelector,!1)||ve(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Ae(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||pe(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Me(n,i)]?Ae(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(ve(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[Me(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!fe(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(be(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),fe(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 Ae(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 xe(t,e,n){return 0!==t.size&&function(t,e){const n=M.parentNode(e);return!!n&&t.has(n)}(t,e)}function Te(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 Oe(t){Ce=t}function Ee(){Ce=void 0}var Fe=(t,e="rrweb")=>Ce?(...n)=>{try{return t(...n)}catch(t){if(Ce&&!0===Ce(t,e))return;throw t}}:t,$e=[];function De(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 Le(t,e){const n=new Re;let i;n.init(t);try{i=new(C())(Fe(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),$e.push(n),{observer:i,buffer:n}}catch(t){try{null==i||i.disconnect(),n.destroy(),n.reset()}catch(t){}throw t}}function Ne({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){const o=new Map,a=s=>{const a=De(s);if(!a||fe(a,i,r,!0))return;const l=n.getId(a);let u,c;if(a===e&&e.defaultView){const t=ue(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=[te("scroll",Fe(oe(Fe(t=>a(t)),s.scroll||100)),e)];return"onscrollend"in e&&l.push(te("scrollend",Fe(a),e)),()=>l.forEach(t=>t())}function Pe(t,e){for(let n=$e.length-1;n>=0;n--){const i=$e[n];if(!i)continue;let r=i.bufferBelongsToIframe(t);!r&&e&&e.has(i.bufferDoc())&&(r=!0),r&&(i.reset(),$e.splice(n,1))}}var je=["INPUT","TEXTAREA","SELECT"],Be=new WeakMap;function ze(t){return function t(e,n){if(qe("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||qe("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||qe("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||qe("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 We(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function Ue({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}}),Fe(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}function He(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=Fe(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=$e.indexOf(s);-1!==t&&$e.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect()}finally{ie(o)}});try{if(t.recordDOM){const e=Le(t,t.doc);r=e.observer,s=e.buffer}if(o.push(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=oe(Fe(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null}),s),c=Fe(oe(Fe(t=>{const e=De(t),{clientX:n,clientY:r}=me(t)?t.changedTouches[0]:t;o||(o=le()),a.push({x:n,y:r,id:i.getId(e),timeOffset:le()-o}),u("undefined"!=typeof DragEvent&&t instanceof DragEvent?l.Drag:t instanceof MouseEvent?l.MouseMove:l.TouchMove)}),r,{trailing:!1})),h=[te("mousemove",c,n),te("touchmove",c,n),te("drag",c,n)];return Fe(()=>{h.forEach(t=>t())})}(t)),o.push(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=De(o);if(fe(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 me(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=me(o)?o.changedTouches[0]:o;if(!f)return;const v=n.getId(a),{clientX:p,clientY:m}=f;Fe(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(te(a,d,e))}),Fe(()=>{l.forEach(t=>t())})}(t)),o.push(Ne(t)),o.push(function({viewportResizeCb:t},{win:e}){let n=-1,i=-1;return te("resize",Fe(oe(Fe(()=>{const e=ce(),r=he();n===e&&i===r||(t({width:Number(r),height:Number(e)}),n=e,i=r)}),200)),e)}(t,{win:n})),o.push(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=De(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>je.indexOf(d)||fe(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=Be.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Be.set(e,r);const s=n.getId(e);Fe(t)(i(i({},r),{},{id:s}))}}const v=("last"===c.input?["change"]:["input","change"]).map(t=>te(t,Fe(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=>ae(t[0],t[1],{set(){Fe(d)({target:this,isTrusted:!1})}},!1,p))),Fe(()=>{ie(v)})}(t)),o.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r,doc:s}){const o=Fe(s=>oe(Fe(r=>{const o=De(r);if(!o||fe(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=[te("play",o(d.Play),s),te("pause",o(d.Pause),s),te("seeked",o(d.Seeked),s),te("volumechange",o(d.VolumeChange),s),te("ratechange",o(d.RateChange),s)];return Fe(()=>{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),o.push(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=We(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=We(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:Fe((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}=We(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s);const{id:u,styleId:c}=We(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={};Ge("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(Ge("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),Ge("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),Ge("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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=We(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...ze(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:Fe((i,s,o)=>{const[a]=o,l=i.apply(s,o);n.onCssomSheetMutation(s.parentStyleSheet);const{id:u,styleId:c}=We(s.parentStyleSheet,e,n.styleMirror);if(s.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...ze(s),a];r.queueMutation(s.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),Fe(()=>{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})),o.push(Ue(t,t.doc)),o.push(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:Fe((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}=We(f,e,i.styleMirror);if(v&&-1!==v||p&&-1!==p){const e=ze(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:Fe((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}=We(h,e,i.styleMirror);if(d&&-1!==d||f&&-1!==f){const e=ze(o.parentRule);s.queueMutation(h,()=>t({id:d,styleId:f,remove:{property:u},index:e}))}return c},"host")}),Fe(()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:n,mutationQueue:e})),t.collectFonts&&o.push(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(Fe(()=>{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),Fe(()=>{i.forEach(t=>t())})}(t))}o.push(function(t){const{doc:e,mirror:n,blockClass:i,blockSelector:r,selectionCb:s}=t;let o=!0;const a=Fe(()=>{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);fe(s,i,r,!0)||fe(l,i,r,!0)||a.push({start:n.getId(s),startOffset:o,end:n.getId(l),endOffset:u})}s({ranges:a})});return a(),te("selectionchange",a)}(t)),o.push(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)o.push(e.observer(e.callback,n,e.options))}catch(t){try{a()}catch(t){}throw t}return a}function qe(t){return void 0!==window[t]}function Ge(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Ve=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}},Ze=class{constructor(t){nt(this,"iframes",new WeakMap),nt(this,"crossOriginIframeMap",new WeakMap),nt(this,"crossOriginIframeMirror",new Ve($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 Ve(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=>ne(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{ee(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);ne(()=>{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)})}ne(()=>{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&&(ee(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(n)),t&&this.nestedIframeListeners.has(t)&&(ee(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=>{ne(()=>this.mirror.removeNodeFromMap(t))}),ne(()=>Pe(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&&ee(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{ee(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}},Je=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}=Le(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=$e.indexOf(a);-1!==t&&$e.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:Ne(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:Ue({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&&ke(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}},Qe="skip-frame";function Xe(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 Ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ke="undefined"==typeof Uint8Array?[]:new Uint8Array(256),tn=0;64>tn;tn++)Ke[Ye.charCodeAt(tn)]=tn;var en=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;i>e;e+=3)r+=Ye[n[e]>>2],r+=Ye[(3&n[e])<<4|n[e+1]>>4],r+=Ye[(15&n[e+1])<<2|n[e+2]>>6],r+=Ye[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},nn=new Map,rn=(t,e,n)=>{if(!t||!an(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=nn.get(t);return n||(n=new Map,nn.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 sn(t,e,n,i){if(t instanceof Array)return t.map(t=>sn(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:en(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[sn(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}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[sn(t.data,e,n,i),t.width,t.height]}:an(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:rn(t,e,n)}:t}var on=(t,e,n,i)=>t.map(t=>sn(t,e,n,i)),an=(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]))},ln=["webgl","webgl2"];function un(t){return"nodeType"in t}function cn(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||un(o)&&fe(o,e,n,!0))return r.call(this,s);un(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(!fe(this,e,n,!0)&&("__context"in this||(this.__context=o),r&&ln.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 hn(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(rn(l,s,this),this.canvas&&"tagName"in this.canvas&&!fe(this.canvas,i,r,!0)){const t=on(a,s,this,o);n(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(s){const o=ae(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!fe(this.canvas,i,r,!0)&&n(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var dn='(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',fn="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",dn],{type:"text/javascript;charset=utf-8"});function vn(t){let e;try{if(e=fn&&(self.URL||self.webkitURL).createObjectURL(fn),!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(dn),{name:null==t?void 0:t.name})}}var pn,mn,gn,yn=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;const a="number"==typeof r.resolutionScale&&Number.isFinite(r.resolutionScale)?Math.min(1,Math.max(.1,r.resolutionScale)):1,l=cn(e,n,i,!0),u=new Map;let c;try{c=new vn}catch(t){return}let d=!1;c.onerror=()=>{var t;d=!0,cancelAnimationFrame(v),null===(t=c.terminate)||void 0===t||t.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})};const f=1e3/t;let v,p=0;const m=t=>{var l;d||(p&&f>t-p||(p=t,(()=>{const t=[],r=e=>{try{e.querySelectorAll("canvas").forEach(e=>{fe(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(!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 Qe}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Xe))return Qe;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 void u.set(e,!1);const f=yield createImageBitmap(t,1>a?{resizeWidth:l,resizeHeight:h,resizeQuality:"medium"}:{resizeWidth:l,resizeHeight:h});c.postMessage({id:e,bitmap:f,width:l,height:h,displayWidth:s,displayHeight:o,dataURLOptions:r.dataURLOptions,maskRegions:d},[f])}catch(t){u.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),v=requestAnimationFrame(m))};v=requestAnimationFrame(m),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(v),null===(t=c.terminate)||void 0===t||t.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,n,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=cn(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 fe(this.canvas,n,i,!0)||setTimeout(()=>{const n=on(o,e,this,r);t(this.canvas,{type:h["2D"],property:a,args:n})},0),s.apply(this,o)}});s.push(o)}catch(r){const o=ae(e.CanvasRenderingContext2D.prototype,a,{set(e){fe(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(...hn(e.WebGLRenderingContext.prototype,h.WebGL,t,n,i,e,r)),void 0!==e.WebGL2RenderingContext&&s.push(...hn(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)}},bn=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 we),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(),Gt.forEach(t=>t.abort()),Gt.clear()}trackStylesheetInLinkElement(t){}},wn=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(){}},_n=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var kn;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(kn=t.contentWindow)||void 0===kn?void 0:kn.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Sn=new gt,Cn=new Set([l.Mutation,l.MediaInteraction,l.StyleSheetRule,l.CanvasMutation,l.Font,l.Log,l.StyleDeclaration,l.AdoptedStyleSheet]);function In(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 Mn(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;Oe(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),Sn.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=Yt(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};pn=(t,e)=>{var i;const o=t;if(o.timestamp=le(),!(null===(i=$e[0])||void 0===i?void 0:i.isFrozen())||o.type===a.FullSnapshot||o.type===a.IncrementalSnapshot&&Cn.has(o.data.source)||$e.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)&&mn(!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=Sn.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()}pn({type:a.IncrementalSnapshot,data:i({source:l.Mutation},t)})},at=t=>pn({type:a.IncrementalSnapshot,data:i({source:l.Scroll},t)}),lt=t=>pn({type:a.IncrementalSnapshot,data:i({source:l.CanvasMutation},t)}),ut=new bn({mutationCb:ot,adoptedStyleSheetCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.AdoptedStyleSheet},t)}),maskAllElementAttributes:_,maskAttributeFn:k}),ct=new Ze({mirror:Sn,mutationCb:ot,stylesheetManager:ut,recordCrossOriginIframes:D,wrappedEmit:pn});for(const t of B||[])t.getMirror&&t.getMirror({nodeMirror:Sn,crossOriginIframeMirror:ct.crossOriginIframeMirror,crossOriginIframeStyleMirror:ct.crossOriginIframeStyleMirror});const ht=new wn,dt=null==x?void 0:x.configured;gn=new yn({recordCanvas:F,mutationCb:lt,win:window,blockClass:o,blockSelector:u,mirror:Sn,sampling:I.canvas,dataURLOptions:V,resolutionScale:A,canvasMasking:x});const ft=new Je({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:gn,keepIframeSrcFn:z,processedNodeManager:ht,attributeFilter:U},mirror:Sn});mn=(t=!1)=>{if(E){q(p);try{pn({type:a.Meta,data:{href:window.location.href,width:he(),height:ce()}},t),null==e||e.cancel(),e=void 0,ut.reset(),ft.init(),$e.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=Yt(m);q(R);try{return Xt(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:Sn,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){ge(t,Sn)&&ct.addIframe(t),ye(t,Sn)&&ut.trackLinkElement(t),be(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(pn({type:a.FullSnapshot,data:{node:n,initialOffset:ue(window)}},t),$e.forEach(t=>t.unlock()),gn.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&&ne(()=>{o=e.beginDeferredLinkInlining(n,Sn.getId(n))})},u=()=>{if(!o)return;const t=o;let e=!0;ne(()=>{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=In(h):n())};return r=In(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,Sn.getId(document))}finally{G()}}};try{const t=[];t.push(te("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(te(e,T,document));it=e=>{const n=nt.get(e);n&&(n.forEach(e=>{ne(e);const n=t.indexOf(e);-1!==n&&t.splice(n,1)}),nt.delete(e))},rt=()=>{for(const[t]of nt){const e=Sn.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 Fe(He)({mutationCb:ot,mousemoveCb:(t,e)=>pn({type:a.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.MouseInteraction},t)}),scrollCb:at,viewportResizeCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.ViewportResize},t)}),inputCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.Input},t)}),mediaInteractionCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.MediaInteraction},t)}),styleSheetRuleCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.StyleSheetRule},t)}),styleDeclarationCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.StyleDeclaration},t)}),canvasMutationCb:lt,fontCb:t=>pn({type:a.IncrementalSnapshot,data:i({source:l.Font},t)}),selectionCb(t){pn({type:a.IncrementalSnapshot,data:i({source:l.Selection},t)})},customElementCb(t){pn({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:Sn,iframeManager:ct,stylesheetManager:ut,shadowDomManager:ft,processedNodeManager:ht,canvasManager:gn,ignoreCSSAttributes:W,attributeFilter:U,plugins:(null==B||null===(e=B.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>pn({type:a.Plugin,data:{plugin:t.name,payload:e}})})))||[]},S)};ct.addLoadListener(e=>{try{const i=Sn.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=Sn.getId(t);null==it||it(e),Pe(t)});let r=-1;const s=t=>pn({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?Sn.getId(a):-1;l!==r&&(-1!==r&&s({id:r,enter:!1}),r=l,-1!==l&&s({id:l,enter:!0}))},m=()=>{mn();const e=n(document);"function"==typeof e&&t.push(e),t.push(te("fullscreenchange",p)),t.push(te("webkitfullscreenchange",p)),t.push(te("mozfullscreenchange",p)),t.push(te("MSFullscreenChange",p)),_n=!0};return["interactive","complete"].includes(document.readyState)?m():(t.push(te("DOMContentLoaded",()=>{pn({type:a.DomContentLoaded,data:{}}),"DOMContentLoaded"===L&&m()})),t.push(te("load",()=>{pn({type:a.Load,data:{}}),"load"===L&&m()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,ie(t),ht.destroy(),ct.removeLoadListener(),ct.destroy(),nt.clear(),ft.reset(),Sn.reset(),_n=!1,Ee()}}catch(t){console.warn(t)}}Mn.addCustomEvent=(t,e)=>{if(!_n)throw new Error("please add custom event after start recording");pn({type:a.Custom,data:{tag:t,payload:e}})},Mn.freezePage=()=>{$e.forEach(t=>t.freeze())},Mn.takeFullSnapshot=t=>{if(!_n)throw new Error("please take full snapshot after start recording");mn(t)},Mn.mirror=Sn,"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 Rn=Object.create(null);function An(t){return An="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},An(t)}function xn(t,e,n){return(e=function(t){var e=function(t){if("object"!=An(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=An(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==An(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Rn.Node=Object.create(null),Rn.ShadowRoot=Object.create(null),Rn.MutationObserver=Object.create(null),Rn.Element=Object.create(null);var Tn=class{constructor(t){xn(this,"fileName",void 0),xn(this,"functionName",void 0),xn(this,"lineNumber",void 0),xn(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}`}},On=/(^|@)\S+:\d+/,En=/^\s*at .*(\S+:\d+|\(native\))/m,Fn=/^(eval@)?(\[native code])?$/,$n={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(En)?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(En)},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 Tn({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(Fn)},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 Tn({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(t.replace(e,""));return new Tn({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 Tn({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 Tn({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(On)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),n=this.extractLocation(e.pop());return new Tn({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function Dn(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 Ln(t){return Array.isArray(t)}function Nn(t){return"object"==typeof t&&null!==t&&!Ln(t)}function Pn(t,e){if(0===e)return!0;const n=Object.keys(t);for(const i of n)if(Nn(t[i])&&Pn(t[i],e-1))return!0;return!1}function jn(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(Nn(s=e)&&Object.keys(s).length>n.numOfKeysLimit||"function"==typeof s||Nn(s)&&Pn(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]=Ln(i)?Dn(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 Bn={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 zn(t,e,n){const i=n?Object.assign({},Bn,n):Bn,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:$n.parse(e.error).map(t=>t.toString()),payload:[jn(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=[jn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[jn("Uncaught (in promise)",i.stringifyOptions),jn(e.reason,i.stringifyOptions)]),t({level:"error",trace:$n.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=$n.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===n?s.slice(1):s).map(t=>jn(t,i.stringifyOptions));o++,i.lengthThreshold>o?t({level:n,trace:e,payload:r}):o===i.lengthThreshold&&t({level:"warn",trace:[],payload:[jn("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 Wn="u">typeof window?window:void 0,Un="u">typeof globalThis?globalThis:Wn,Hn=null==Un?void 0:Un.document,qn=null==Un?void 0:Un.location;null!=Un&&Un.XMLHttpRequest&&new Un.XMLHttpRequest;const Gn="undefined"!=typeof globalThis?globalThis:Wn;Gn&&"undefined"==typeof self&&(Gn.self=Gn),Gn&&"undefined"==typeof File&&(Gn.File=function(){});const Vn=null!=Wn?Wn:{},Zn=Object.prototype,Jn=Zn.hasOwnProperty,Qn=Zn.toString,Xn=Array.isArray||function(t){return"[object Array]"===Qn.call(t)},Yn=t=>"function"==typeof t,Kn=t=>t===Object(t)&&!Xn(t),ti=t=>void 0===t,ei=t=>"[object String]"==Qn.call(t),ni=t=>null===t,ii=t=>ti(t)||ni(t),ri=t=>"[object Number]"==Qn.call(t)&&t==t,si=t=>"[object Boolean]"===Qn.call(t),oi=t=>t instanceof FormData;function ai(t,e,n,i,r){return e>n&&(i.warn("min cannot be greater than max."),e=n),ri(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),ai(null!=r?r:n,e,n,i))}var li=class{constructor(t){this.C={},this.I=t.I,this.R=ai(t.bucketSize,0,100,t.$),this.A=ai(t.refillRate,0,this.R,t.$),this.O=ai(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 ui(t){return t?t.split("#")[0]:t}const ci="NativeGzipValidationError";let hi;const di=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}(ci,`Native gzip produced invalid output: ${t}`)},fi=(vi=s(function*(t,e){18>t.size&&di("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])&&di("invalid-header");const r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{const e=(()=>{if(hi)return hi;hi=[];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;hi[t]=e>>>0}return hi})();let n=4294967295;for(let i=0;t.length>i;i++)n=e[255&(n^t[i])]^n>>>8;return(4294967295^n)>>>0})(e)&&di("invalid-crc");const s=e.length>>>0;r.getUint32(4,!0)!==s&&di("invalid-size")}),function(t,e){return vi.apply(this,arguments)});var vi;function pi(){return pi=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 fi(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}),pi.apply(this,arguments)}const mi="0.8.3",gi={DEBUG:!1,LIB_VERSION:mi,LIB_NAME:"browser-common",JS_SDK_VERSION:mi},yi=(t,{debugEnabled:e}={})=>{const n={N(n,...i){Wn&&(gi.DEBUG||Wn.POSTHOG_DEBUG||e)&&!ti(Wn.console)&&Wn.console&&("__rrweb_original__"in Wn.console[n]?Wn.console[n].__rrweb_original__:Wn.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)=>yi(`${t} ${e}`,n)};return n},bi=yi("[PostHog.js]"),wi=bi.createLogger;function _i(t,e){if(!ii(t))if(Xn(t))t.forEach(e);else if(oi(t))t.forEach((t,n)=>e(t,n));else for(const n in t)Jn.call(t,n)&&e(t[n],n)}function ki(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 Si=["localhost","127.0.0.1"],Ci=t=>{const e=null==Hn?void 0:Hn.createElement("a");return ti(e)?null:(e.href=t,e)},Ii=()=>{},Mi=t=>{var e;if(Yn(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Ri(t,e,n){try{if(!(e in t))return Ii;const i={next:t[e]},r=n(function(...t){return i.next.apply(this,t)});return Yn(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=Mi(n);for(;s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=Mi(n)}}}catch(t){return Ii}}function Ai(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 xi(t){var e;const n=null==Wn||null===(e=Wn.location)||void 0===e?void 0:e.href;return ti(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(!Yn(i))return e;try{const t=i(e);return ei(t)&&t?t:e}catch(t){return bi.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,n)}const Ti=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}))$"),Oi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ei=[16,15,14,13],Fi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),$i=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Di=/[0-9A-Za-z_]/;function Li(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 Ni=1e6;function Pi(t){var e;return Math.min(Ni,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Ni)}const ji={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:Ni,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},Bi=["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"],zi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Wi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Ui=t=>{ii(t)||_i(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Bi.includes(e)||Wi.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Hi=["/s/","/e/","/i/"];function qi(t,e,n,i){if(ii(t))return t;let r=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ei(r)&&(r=parseInt(r)),r>n?`[SessionRecording] ${i} body too large to record (${r} bytes)`:t}function Gi(t,e){if(ii(t))return t;let n=t;return function(t,e=!0){if(ii(t))return!1;if(ei(t)){if(t=t.trim(),e?Ti.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Oi.lastIndex=0;e=Oi.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 Ei){const i=t+e;if(n.length>=i){const e=n.slice(t,i);if(Ti.test(e)&&Li(e))return!0}}}return!1}(t))return!1;if(e?Fi.test(t):function(t){let e;for($i.lastIndex=0;e=$i.exec(t);){const t=e[1],n=e[3];if(!(t&&n&&Di.test(t)&&Di.test(n)))return!0}return!1}(t))return!1}return!0}(n,!1)||(n="[SessionRecording] "+e+" body redacted"),_i(zi,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 Vi=new WeakSet,Zi=wi("[Recorder]"),Ji=t=>"navigation"===t.entryType,Qi=t=>"resource"===t.entryType;function Xi(t,e){return!!e&&(si(e)||e[t])}function Yi(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 Ki=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function tr({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:!!Yi(e)&&t(e.url)}catch(t){return!1}}(i))return!1;if(r(Ki))return!1;if(si(e))return!0;if(Xn(e))return r(e);const s=e[t];return si(s)?s:r(s)}function er(t,e,n,i,r){return nr.apply(this,arguments)}function nr(){return nr=s(function*(t,e,n,i,r,s=0){if(s>10)return Zi.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=>Qi(t)&&t.initiatorType===e&&(ti(i)||t.startTime>=i)&&(ti(r)||r>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*s)),er(t,e,n,i,r,s+1))}),nr.apply(this,arguments)}function ir({body:t,options:e,url:n}){if(ii(t))return null;const{hostname:i,isHostDenied:r}=Ai(n,e);if(r)return i+" is in deny list";if(ei(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(oi(t))return function(t,e="&"){let n,i;const r=[];return _i(t,function(t,e){ti(t)||ti(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(Kn(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 rr=t=>!ni(t)&&("navigation"===t.entryType||"resource"===t.entryType);function sr({entry:t,method:e,status:n,networkRequest:r,isInitial:s,start:o,end:a,url:l,initiatorType:u}){o=t?t.startTime:o,a=t?t.responseEnd:a;const c=Math.floor(Date.now()-performance.now()),h=Math.floor(c+(o||0)),d=[i(i({},t?t.toJSON():{name:l}),{},{startTime:ti(o)?void 0:Math.round(o),endTime:ti(a)?void 0:Math.round(a),timeOrigin:c,timestamp:h,method:e,initiatorType:u||(t?t.initiatorType:void 0),status:n,requestHeaders:r.requestHeaders,requestBody:r.requestBody,responseHeaders:r.responseHeaders,responseBody:r.responseBody,isInitial:s})];if(rr(t))for(const e of t.serverTiming||[])d.push({timeOrigin:c,timestamp:h,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return d}const or=["video/","audio/"];function ar(t){return Kn(t)&&Yn(t.getReader)&&Yn(t.tee)}const lr="[SessionReplay] Timeout while trying to read body",ur="[SessionReplay] Failed to read body";function cr(t){return`${ur}: ${t}`}function hr(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function dr(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const n=setTimeout(()=>e(lr),500);try{t.clone().text().then(t=>e(t),t=>e(cr(t))).finally(()=>clearTimeout(n))}catch(t){clearTimeout(n),e(ur)}})}(t);const n=Pi(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(hr(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(lr),500);let l;try{l=t.clone()}catch(t){return void o(ur)}const u=l.body;if(!ar(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(cr(t)))}catch(t){o(ur)}return}try{i=u.getReader()}catch(t){return void o(ur)}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(hr(e));h+=i.byteLength,c.push(i)}t()}},t=>o(cr(t)))}()})}(t,n)}function fr(){return(fr=s(function*({r:t,options:e,url:n}){const{hostname:i,isHostDenied:r}=Ai(n,e);return r?Promise.resolve(i+" is in deny list"):dr(t,e)})).apply(this,arguments)}function vr(){return(vr=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=or.some(t=>null==r?void 0:r.startsWith(t));if(r&&s)return`Content-Type ${r} is not supported`;const{hostname:o,isHostDenied:a}=Ai(n,e);return a?o+" is in deny list":null}({r:t,options:e,url:n});return ni(i)?dr(t,e):Promise.resolve(i)})).apply(this,arguments)}let pr=null;function mr(t,e,n){if(!("performance"in e))return()=>{};if(pr)return Zi.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},ji,n):ji,o=e=>{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&&Vi.has(t))(i)),i&&n.push(i)}),n.length>0&&t(i(i({},e),{},{requests:n}))},a=function(t,e,n){n.recordInitialRequests&&t({requests:e.performance.getEntries().filter(t=>Ji(t)||Qi(t)&&n.initiatorTypes.includes(t.initiatorType)).flatMap(t=>sr({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const i=new e.PerformanceObserver(e=>{t({requests:e.getEntries().filter(t=>Ji(t)||Qi(t)&&n.initiatorTypes.includes(t.initiatorType)&&(t=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>sr({entry:t,method:void 0,status:void 0,networkRequest:{}}))})}),r=PerformanceObserver.supportedEntryTypes.filter(t=>n.performanceEntryTypeToObserve.includes(t));return i.observe({entryTypes:r}),()=>{i.disconnect()}}(o,e,r);let l=()=>{},u=()=>{};return(r.recordHeaders||r.recordBody)&&(l=function(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=Xi("request",n.recordHeaders),r=Xi("response",n.recordHeaders),s=Ri(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=>(tr({type:"request",headers:d,url:a,recordBody:n.recordBody})&&(l.requestBody=ir({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),tr({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(l.responseBody=ir({body:h.response,options:n,url:a})),er(e,"xmlhttprequest",s.url,u,c).then(e=>{t({requests:sr({entry:e,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){Zi.error("Failed to instrument XHR for network capture",t)}s.call(h,o,a.toString(),l,u,c)});return()=>{s()}}(o,e,r),u=function(t,e,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=Xi("request",n.recordHeaders),r=Xi("response",n.recordHeaders),o=Ri(e,"fetch",o=>function(){var a=s(function*(s,a){let l,u;try{l=new Request(s,a)}catch(t){return Zi.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),!ar(null==a?void 0:a.body)&&tr({type:"request",headers:t,url:s,recordBody:n.recordBody})&&(c.requestBody=yield function(t){return fr.apply(this,arguments)}({r:l,options:n,url:s}))}catch(t){Zi.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=Yi(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),tr({type:"response",headers:t,url:s,recordBody:n.recordBody})&&(c.responseBody=yield function(t){return vr.apply(this,arguments)}({r:u,options:n,url:s}))}catch(t){Zi.error("Failed to record fetch response for network capture",t)}return u}finally{er(e,"fetch",l.url,h,d).then(e=>{t({requests:sr({entry:e,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()}}(o,e,r)),pr=()=>{a(),l(),u(),pr=null},pr}const gr="$replay_override_sampling",yr="$replay_override_linked_flag",br="$replay_override_url_trigger",wr="$replay_override_event_trigger",_r="$session_is_sampled",kr="$session_recording_url_trigger_activated_session",Sr="$session_recording_event_trigger_activated_session",Cr="$posthog_sr_group_event_trigger_",Ir="$posthog_sr_group_url_trigger_",Mr="$sess_rec_flush_size",Rr="$stored_person_properties",Ar="$sdk_debug_replay_event_trigger_status",xr="$sdk_debug_replay_linked_flag_trigger_status",Tr="$sdk_debug_replay_matched_recording_trigger_groups",Or="$sdk_debug_replay_pending_trigger_conditions",Er="$sdk_debug_replay_remote_trigger_matching_config",Fr="$sdk_debug_replay_trigger_groups_count",$r="$sdk_debug_replay_url_trigger_status",Dr="$sdk_debug_rrweb_attached",Lr="$sdk_debug_rrweb_start_attempted",Nr="$session_recording_start_reason",Pr="disabled",jr="sampled",Br="active",zr="buffering",Wr="paused",Ur="rrweb_error",Hr="trigger_activated",qr="trigger_pending",Gr="trigger_disabled";function Vr(t,e,n,i,r,s){return 0===e?Gr:(null==t?void 0:t.get_property(n?i+n:r))===s?Hr:qr}function Zr(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 Jr(t){return t.includes("trigger_activated")?Hr:t.includes("trigger_pending")?qr:Gr}function Qr(t){const e=new Set(t);switch(e.delete(Gr),e.size){case 0:return Gr;case 1:return Array.from(e)[0];default:return qr}}var Xr=class{constructor(t){this.q=t}triggerStatus(t){return Jr(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Jr(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Yr=class{constructor(t){this.q=t}triggerStatus(t){return Qr(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Qr(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Kr=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return Hr}stop(){}};const ts=t=>"sessionRecording"in t;var es=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=(ts(t)?Kn(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(ts(t)?Kn(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){bi.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){bi.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return Vr(this._instance,this.j.length,this.V,Ir,kr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[$r]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=xi(this._instance);if(!t)return!1;try{return Zr(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const n=xi(this._instance);if(!n)return;if(n===this.W)return;this.W=n;const i=this.urlBlocked,r=Zr(n,this.B,this.U);i&&r||(r&&!i?t():!r&&i&&e())}checkUrlTriggerConditions(t,e,n,i){const r=xi(this._instance);if(!r)return;if(r===this.W)return;this.W=r;const s=this.urlBlocked,o=Zr(r,this.B,this.U);o&&!s?t():!o&&s&&e();const a=this.G(i)===Hr,l=Zr(r,this.j,this.H);!a&&l&&n("url",r)}stop(){this.W=""}},ns=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({[xr]:t}),t}triggerStatusNoSideEffects(){let t=qr;return ii(this.linkedFlag)&&(t=Gr),this.linkedFlagSeen&&(t=Hr),t}onConfig(t,e){var n;if(this.linkedFlag=(ts(t)?Kn(t.sessionRecording)?null===(n=t.sessionRecording)||void 0===n?void 0:n.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!ii(this.linkedFlag)&&!this.linkedFlagSeen){const t=ei(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ei(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((i,r)=>{let s=!1;if(Kn(r)&&t in r){const e=r[t];s=si(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()}},is=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(ts(t)?Kn(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 Vr(this._instance,this.K.length,this.V,Cr,Sr,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Ar]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,n){if(0===this.K.length)return;const i=this.X(n)===Hr,r=this.K.includes(t);!i&&r&&e("event",t)}stop(){}},rs=class{constructor(t,e,n){if(this._instance=t,this.group=e,this.Y=new es(t,e.id),this.tt=new is(t,e.id),this.et=new ns(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 Xr(r):new Yr(r)}else this.nt=new Kr}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===qr).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?Ir+this.group.id:Cr+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 ss(t){if(t.rrwebError)return Ur;if(!t.receivedFlags)return zr;if(!t.isRecordingEnabled)return Pr;if(t.urlTriggerMatching.urlBlocked)return Wr;const e=!0===t.isSampled,n=new Xr([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?jr:"trigger_activated"===n?Br:"trigger_pending"===n?zr:!1===t.isSampled?Pr:Br}function os(t){if(t.rrwebError)return Ur;if(!t.receivedFlags)return zr;if(!t.isRecordingEnabled)return Pr;if(t.urlTriggerMatching.urlBlocked)return Wr;const e=new Yr([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==Gr,i=si(t.isSampled);return n&&"trigger_pending"===e?zr:n&&"trigger_disabled"===e||i&&!t.isSampled?Pr:!0===t.isSampled?jr:Br}function as(){const t=[];return function(e,n){if(Kn(n)||Xn(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n}}function ls(t){const e=JSON.stringify(t,as());return e?new Blob([e]).size:0}function us(t){if(ni(t))return 4;if(ti(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(Xn(t)){let e=2;for(let n=0;t.length>n;n++){n>0&&(e+=1);const i=t[n];e+=ti(i)||ni(i)?4:us(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];ti(r)||(i||(n+=1),i=!1,n+=t.length+3+us(r))}return n}default:return 0}}function cs(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[cs({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:n,sessionId:t.sessionId,windowId:t.windowId}),cs({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 hs=Uint8Array,ds=Uint16Array,fs=Uint32Array,vs=new hs([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]),ps=new hs([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]),ms=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gs=function(t,e){for(var n=new ds(31),i=0;31>i;++i)n[i]=e+=1<<t[i-1];var r=new fs(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]},ys=gs(vs,2),bs=ys[1];ys[0][28]=258,bs[258]=28;for(var ws=gs(ps,0)[1],_s=new ds(32768),ks=0;32768>ks;++ks){var Ss=(43690&ks)>>>1|(21845&ks)<<1;_s[ks]=((65280&(Ss=(61680&(Ss=(52428&Ss)>>>2|(13107&Ss)<<2))>>>4|(3855&Ss)<<4))>>>8|(255&Ss)<<8)>>>1}var Cs=function(t,e,n){for(var i=t.length,r=0,s=new ds(e);i>r;++r)++s[t[r]-1];var o,a=new ds(e);for(r=0;e>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new ds(1<<e);var l=15-e;for(r=0;i>r;++r)if(t[r])for(var u=r<<4|t[r],c=e-t[r],h=a[t[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[_s[h]>>>l]=u}else for(o=new ds(i),r=0;i>r;++r)o[r]=_s[a[t[r]-1]++]>>>15-t[r];return o},Is=new hs(288);for(ks=0;144>ks;++ks)Is[ks]=8;for(ks=144;256>ks;++ks)Is[ks]=9;for(ks=256;280>ks;++ks)Is[ks]=7;for(ks=280;288>ks;++ks)Is[ks]=8;var Ms=new hs(32);for(ks=0;32>ks;++ks)Ms[ks]=5;var Rs=Cs(Is,9,0),As=Cs(Ms,5,0),xs=function(t){return(t/8|0)+(7&t&&1)},Ts=function(t,e,n){(null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof ds?ds:t instanceof fs?fs:hs)(n-e);return i.set(t.subarray(e,n)),i},Os=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8},Es=function(t,e,n){var i=e/8|0;t[i]|=n<<=7&e,t[i+1]|=n>>>8,t[i+2]|=n>>>16},Fs=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 hs(0),0];if(1==r){var o=new hs(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 ds(d+1),v=$s(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 hs(f),v]},$s=function(t,e,n){return-1==t.s?Math.max($s(t.l,e,n+1),$s(t.r,e,n+1)):e[t.s]=n},Ds=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new ds(++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]},Ls=function(t,e){for(var n=0,i=0;e.length>i;++i)n+=t[i]*e[i];return n},Ns=function(t,e,n){var i=n.length,r=xs(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)},Ps=function(t,e,n,i,r,s,o,a,l,u,c){Os(e,c++,n),++r[256];for(var h=Fs(r,15),d=h[0],f=h[1],v=Fs(s,15),p=v[0],m=v[1],g=Ds(d),y=g[0],b=g[1],w=Ds(p),_=w[0],k=w[1],S=new ds(19),C=0;y.length>C;++C)S[31&y[C]]++;for(C=0;_.length>C;++C)S[31&_[C]]++;for(var I=Fs(S,7),M=I[0],R=I[1],A=19;A>4&&!M[ms[A-1]];--A);var x,T,O,E,F=u+5<<3,D=Ls(r,Is)+Ls(s,Ms)+o,L=Ls(r,d)+Ls(s,p)+o+14+3*A+Ls(S,M)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return Ns(e,c,t.subarray(l,l+u));if(Os(e,c,1+(D>L)),c+=2,D>L){x=Cs(d,f,0),T=d,O=Cs(p,m,0),E=p;var N=Cs(M,R,0);for(Os(e,c,b-257),Os(e,c+5,k-1),Os(e,c+10,A-4),c+=14,C=0;A>C;++C)Os(e,c+3*C,M[ms[C]]);c+=3*A;for(var P=[y,_],j=0;2>j;++j){var B=P[j];for(C=0;B.length>C;++C)Os(e,c,N[z=31&B[C]]),c+=M[z],z>15&&(Os(e,c,B[C]>>>5&127),c+=B[C]>>>12)}}else x=Rs,T=Is,O=As,E=Ms;for(C=0;a>C;++C)if(i[C]>255){var z;Es(e,c,x[257+(z=i[C]>>>18&31)]),c+=T[z+257],z>7&&(Os(e,c,i[C]>>>23&31),c+=vs[z]);var W=31&i[C];Es(e,c,O[W]),c+=E[W],W>3&&(Es(e,c,i[C]>>>5&8191),c+=ps[W])}else Es(e,c,x[i[C]]),c+=T[i[C]];return Es(e,c,x[256]),c+T[256]},js=new fs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bs=new hs(0),zs=function(){for(var t=new fs(256),e=0;256>e;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Ws=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function Us(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=zs[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 hs(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=Ns(l,u,t.subarray(c,h)):(l[c]=s,u=Ns(l,u,t.subarray(c,o)))}else{for(var d=js[e-1],f=d>>>13,v=8191&d,p=(1<<n)-1,m=new ds(32768),g=new ds(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 fs(25e3),k=new ds(288),S=new ds(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=Ps(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|bs[D]<<18|ws[L];var V=31&bs[D],Z=31&ws[L];I+=vs[V]+ps[Z],++k[257+V],++S[Z],R=c+D,++C}else _[M++]=t[c],++k[t[c]]}}u=Ps(t,l,s,_,k,S,I,M,A,c-A,u),s||(u=Ns(l,u,Bs))}return Ts(a,0,i+xs(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&&Ws(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),Ws(c,h-8,n.d()),Ws(c,h-4,i),c}function Hs(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 qs=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=us(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 li({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,$:bi}),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=ri(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 ri(t)&&isFinite(t)&&Math.floor(t)===t}),Wn&&!ti(Wn.crypto)&&crypto;let Gs=null;const Vs={Et(){if(!ni(Gs))return Gs;if(Gs=!0,ti(Wn))Gs=!1;else try{const t="__support__";Vs.At(t,"xyz"),'"xyz"'!==Vs.Ot(t)&&(Gs=!1),Vs.Lt(t)}catch(t){Gs=!1}return Gs},Pt(t){bi.error("sessionStorage error: ",t)},Ot(t){try{return null==Wn?void 0:Wn.sessionStorage.getItem(t)}catch(t){Vs.Pt(t)}return null},Dt(t){try{return JSON.parse(Vs.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==Wn||Wn.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Vs.Pt(t)}return!1},Lt(t){try{null==Wn||Wn.sessionStorage.removeItem(t)}catch(t){Vs.Pt(t)}}};gi.DEBUG=!1,gi.LIB_VERSION="1.431.2",gi.LIB_NAME="web";var Zs=gi,Js=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(Mr,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(Mr);return Kn(n=e)&&ei(n.sessionId)&&ri(n.size)&&e.sessionId===t?e.size:0;var n}};function Qs(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<ai(100*e,0,100,bi)}const Xs=(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}},Ys=t=>t.toLowerCase(),Ks={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=>Xs(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!Xs(e,t))),icontains:(t,e)=>e.map(Ys).some(e=>t.map(Ys).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(Ys).every(e=>t.map(Ys).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))})},to=new Set(["is_not","not_icontains","not_regex"]);function eo(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(ti(r)||ni(r))return to.has(s);const o=Ks[s];return!!o&&!ti(t.value)&&!ni(t.value)&&o(Xn(t.value)?t.value.map(String):[String(t.value)],Xn(r)?r.map(String):[String(r)])})}const no=wi("[SessionRecording]");function io(t,e){return e?t:"!"+t}function ro(t,e){return t===e||t!=="!"+e&&null}var so=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=os}onRemoteConfig(t){this.Ht=ri(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new Xr([this.tt,this.Y]),this.zt=ss):(this.Ut=new Yr([this.tt,this.Y]),this.zt=os),this._instance.register_for_session({[Er]: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 ri(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&&ii(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,n,e)}catch(t){no.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const n=this.Ht;var i,r;if(!ri(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(_r),o=this._instance.get_property("$replay_sample_rate"),a=ro(s,t),l=ri(o)&&o!==n,u=ti(o)&&s===t,c=l||u||!si(a),h=c?Qs(t,n):a;c&&(h?this.qt("sampled"):no.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:io(t,h),$replay_sample_rate:ni(o)&&s===t?null:n})}ensureSamplingDecision(t){if(!ri(this.Ht))return;const e=this._instance.get_property(_r);si(ro(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))===qr}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===qr).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()}},oo=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({[Er]:"v2_trigger_groups",[Fr]:t.triggerGroups.length}),this.Y.onConfig(t)):no.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Ur;if(!t.receivedFlags)return zr;if(!t.isRecordingEnabled)return Pr;if(t.urlTriggerMatching.urlBlocked)return Wr;const e=t.triggerGroupMatchers,n=t.triggerGroupSamplingResults;if(0===e.length)return Pr;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);ti(e)?bi.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(r=!0)}else"trigger_pending"===e&&(i=!0)}return r?jr:i?zr:Pr}({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;ri(t)&&(ni(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 no.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(Rr);r.some(e=>!e.properties||0===e.properties.length||eo(e.properties,t.properties,s))&&(n.activateTrigger(i,e),this.updateActiveTriggers(e),this.Bt(i))},e)}catch(t){no.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(Kn(a)){const e=a.sessionId,n=a.sampleRate,i=a.sampled;u="string"==typeof e&&e!==t,c=ri(n)&&n!==s,l=e===t&&ri(n)&&n===s&&si(i)?i:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!si(l),f=d?Qs(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({[Tr]: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||eo(n,e,this._instance.get_property(Rr))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new rs(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 ao=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lo=1e5,uo=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,co=[],ho=()=>!1,fo="@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(" "),vo="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),po="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(" "),mo="Accommodation AdministrativeArea Country Place State".split(" "),go={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:vo,publisher:po},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:co},Offer:{seller:po},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:po,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:po,areaServed:mo,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:co}},yo=[["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(" "),go.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),go.Event],[po,go.Organization],[mo,go.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),go.Product]];function bo(t,e){return Jn.call(t,e)?t[e]:void 0}function wo(t){const e=typeof t;return ni(t)||"string"===e||"number"===e||"boolean"===e}function _o(t,e){return e&&function(t){return ei(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function ko(t,e){return Xn(t)&&t.every(wo)?t.map(t=>_o(t,e)).filter(t=>!ti(t)):wo(t)?_o(t,e):void 0}function So(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 Co(t){if(Jn.call(go,t))return go[t];for(const[e,n]of yo)if(e.includes(t))return n}function Io(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Mo(t,e,n,i){if(Xn(t)){const r=t.map(t=>Mo(t,e,n,i)).filter(t=>!ti(t));return r.length?r:void 0}return Ro(t,e,n,i)||void 0}function Ro(t,e,n,i){if(!Kn(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(n))return null;const r=bo(t,"@type"),s=function(t){const e=new Set,n="string"==typeof t?[t]:Xn(t)?t:[],i=[];for(const t of n){if("string"!=typeof t)continue;const n=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&uo.test(n)&&!e.has(n)&&(e.add(n),i.push(n),20===i.length))break}return i}(r),o=s.filter(t=>!!Co(t)&&(!i||!i.length||i.includes(t))),a={};for(const i of fo){const o="@type"===i?s.length?"string"==typeof r?s[0]:s:void 0:"@id"===i?So(bo(t,i),e):ko(bo(t,i),n.maskUrl);ti(o)||Io(a,i,o)}for(const i of o){const r=Co(i);for(const i of Object.keys(r)){const s=bo(t,i),o=r[i];if(!0===o){const t=ko(s,n.maskUrl);ti(t)||Io(a,i,t)}else{const t=Mo(s,e,n,o);ti(t)||Io(a,i,t)}}}const l=Mo(bo(t,"@graph"),e,n);return ti(l)||Io(a,"@graph",l),Object.keys(a).length?a:null}function Ao(t,e,n){if(!Kn(t))return null;const r=bo(t,"@context");if("string"!=typeof r||!/^https?:\/\/schema\.org\/?$/.test(r))return null;const s=Ro(t,e,n);return s?i({"@context":"https://schema.org"},s):null}function xo(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function To(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 Oo(t,e,n){for(let i=t;i;){if(To(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 Eo(t){return xo(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(xo)}function Fo(t){return ti(t)?void 0:Math.round(t)}function $o(t){return Kn(t)?t.network_timing:t}const Do=wi("[SessionRecording]"),Lo=[1,2,3,4,5,6,7,12],No=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Po(){var t;return null==Vn||null===(t=Vn.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function jo(){var t;return null===(t=Po())||void 0===t?void 0:t.record}function Bo(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,as())}}function zo(t){return Hs(Us(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new hs(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 hs(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 Ts(n,0,i)}(Bo(t))),!0)}function Wo(t){return Uo.apply(this,arguments)}function Uo(){return Uo=s(function*(t){const e=yield function(t){return pi.apply(this,arguments)}(Bo(t),Zs.DEBUG,{rethrow:!0});return Hs(new Uint8Array(yield e.arrayBuffer()),!0)}),Uo.apply(this,arguments)}let Ho,qo;const Go="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let Vo=!1;function Zo(t){var e;return Xn(t)&&0===t.length?(Ho=null!==(e=Ho)&&void 0!==e?e:zo([]),Ho):zo(t)}function Jo(t){return Qo.apply(this,arguments)}function Qo(){return(Qo=s(function*(t){var e;return Xn(t)&&0===t.length?Ho||(qo=null!==(e=qo)&&void 0!==e?e:Wo([]).then(t=>(Ho=t,t)).catch(t=>{throw Ho=void 0,qo=void 0,t}),qo):Wo(t)})).apply(this,arguments)}function Xo(t){return Go&&!Vo&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Yo(t){return{event:t,size:us(t)}}function Ko(t,e){return i(i({},t),{},{data:e,cv:"2024-10"})}function ta(t,e){return i(i({},t),{},{cv:"2024-10",data:i(i({},t.data),e)})}function ea(t){try{if(2===t.type)return Yo(Ko(t,zo(t.data)));if(3===t.type&&0===t.data.source)return Yo(ta(t,{texts:Zo(t.data.texts),attributes:Zo(t.data.attributes),removes:Zo(t.data.removes),adds:Zo(t.data.adds)}));if(3===t.type&&8===t.data.source)return Yo(ta(t,{adds:t.data.adds?zo(t.data.adds):void 0,removes:t.data.removes?zo(t.data.removes):void 0}))}catch(t){Do.error("could not compress event - will use uncompressed event",t)}return{event:t,size:ls(t)}}function na(){return(na=s(function*(t){try{if(2===t.type)return Yo(Ko(t,yield Wo(t.data)));if(3===t.type&&0===t.data.source){const[e,n,i,r]=yield Promise.all([Jo(t.data.texts),Jo(t.data.attributes),Jo(t.data.removes),Jo(t.data.adds)]);return Yo(ta(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?Wo(t.data.adds):void 0,t.data.removes?Wo(t.data.removes):void 0]);return Yo(ta(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===ci})(e)&&(Vo=!0),Do.error("could not compress event asynchronously - trying synchronous compression",e),ea(t)}return{event:t,size:ls(t)}})).apply(this,arguments)}function ia(t,e){return 5===t.type&&t.data.tag===e}function ra(t){return ia(t,"sessionIdle")}function sa(t){return ia(t,"$session_ending")}function oa(t){return ia(t,"$session_starting")}var aa=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 ro(this._instance.get_property(_r),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return ri(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=!1,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=[],this.Re=void 0,this.$e=void 0,this.Ee=!1,this.Ae=[],this.Oe=0,this.Le=0,this.Pe=!1,this.De=void 0,this.Wt=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=void 0,this.je=(t,e,n)=>{var i,r,s,o;if(!n)return;if(t===this.Xt&&e===this.Be)return;const a=!n.noSessionId&&(n.activityTimeout||n.sessionPastMaximumLength),l=this.Xt,u=this.Be;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.He)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),this._e=!1,null===(r=Po())||void 0===r||null===(s=r.resetMaxDepthState)||void 0===s||s.call(r),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:n}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.Ue(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.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$session_past_minimum_duration)===this.Xt},this.Ze=()=>{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 ri(n)&&ri(i)?i-n:null},this.Ge=()=>{var t,e;const n=this.ie;if(!ri(n))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return ri(t)&&t>=0&&n>t}if(this.Ve())return!1;const i=this.Ze();return!!ni(i)||n>i||(null===(r=this._instance.persistence)||void 0===r||r.register({$session_past_minimum_duration:this.Xt}),!1);var r},this.Je=()=>{"buffering"!==this.status?(this.me&&this.ge&&this.Ke&&!this.ye&&this.Xe(void 0),this.Ye(),this.tn(!0)):this.en()},this.nn=()=>{this.Je()},this.rn=()=>{this.Vt("browser offline",{})},this.sn=()=>{this.Vt("browser online",{})},this.an=()=>{(null==Hn?void 0:Hn.visibilityState)&&("visible"===Hn.visibilityState&&(this.Ke=!0),this.Vt("window "+Hn.visibilityState,{}))},this.Ke=null==e||e;const{sessionId:n,windowId:i,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=n,this.Be=i,this._sessionStartTimestamp=r,this.et=new ns(this._instance),this.Y=new es(this._instance),this.tt=new is(this._instance),this.Rt=this.en(),this.ln="ph_"+(this._instance.config.persistence_name||this._instance.config.token)+"_replay_pending_buffer",this.Yt.sessionTimeoutMs>this.te||Do.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.He=new Js(this._instance)}setDocumentWasEverVisible(t){t&&(this.Ke=!0)}get un(){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 ti(h)&&ti(d)&&ti(f)&&ti(v)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:f,maskAllElementAttributes:v}}cn(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(ii(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!ti(i)&&i!==r});0!==i.length&&(this.xe=!0,Do.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 dn(){var t;return ai(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,wi("canvas recording resolution scale"),1)}get hn(){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:ai(c,0,12,wi("canvas recording fps"),4),quality:ai(h,0,1,wi("canvas recording quality"),.4)}}get fn(){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 vn(){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=$o(this._instance.config.capture_performance),l=$o(null==i?void 0:i.capturePerformance),u=!!(si(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}pn(){var t,e;const n=[],r=null===(t=Vn.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.fn&&n.push(r());const s=null===(e=Vn.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.vn&&Yn(s))if(!Si.includes(qn.hostname)||this._forceAllowLocalhostNetworkCapture){const t=Yn(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;n.push(s(((t,e,n)=>{const r={payloadSizeLimitBytes:ji.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ji.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ji.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=Pi(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=qi(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=qi(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=Ci(t.name);let s=0===e.indexOf("http")?null===(i=Ci(e))||void 0===i?void 0:i.pathname:e;"/"===s&&(s="");const o=null==r?void 0:r.pathname.replace(s||"","");return r&&o&&Hi.some(t=>0===o.indexOf(t))?void 0:t})((Ui((i=e).requestHeaders),Ui(i.responseHeaders),i),t.api_host,n));var i},c=Yn(t.session_recording.maskNetworkRequestFn);return c&&Yn(t.session_recording.maskCapturedNetworkRequestFn)&&bi.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=Yn(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 ii(o)&&s?(Vi.add(s),s):null!=o?o:void 0}:t=>function(t){if(!ti(t))return t.requestBody=Gi(t.requestBody,"Request"),t.responseBody=Gi(t.responseBody,"Response"),t}(u(t)),i(i(i({},ji),r),{},{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else Do.info("NetworkCapture not started because we are on localhost.");return n}mn(t){return this._instance.config.disable_capture_url_hashes?ui(t):t}gn(t,e=!1){const n=e?ui(t):this.mn(t),i=this._instance.config.mask_personal_data_properties?[...ao,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(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("=");Xn(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))}yn(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}bn(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}):Do.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(No(()=>jo().addCustomEvent(t,e)))}wn(){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}kn(t){if(!this.wn())return!1;try{const e=jo();return!!e&&(e.addCustomEvent("$json_ld",t),this.wn())}catch(t){return!1}}_n(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.Sn)||void 0===e?void 0:e.scan(t)})}xn(){try{if(this._instance.config.capture_pageview||!Wn)return;const t=new URL(Wn.location.href),e=this.gn(t.origin+t.pathname+t.search);this.Cn!==e&&(this.Cn=e,this.Vt("$url_changed",{href:e}))}catch(t){}}Mn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.bn(t)})}}jt(){return this.bn(No(()=>jo().takeFullSnapshot()))}get In(){var t,e,n;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var i;const t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.trigger_pending_buffer_interval_millis;return ri(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}Tn(){if(this.Rn&&clearInterval(this.Rn),!0===this.de)return;const t=this.In;t&&(this.Rn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.$n(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Tn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.Sn)||void 0===t||t.scan(),clearInterval(this.Rn),Do.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this.Sn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this._n(),this.Tn(),this.Vt("recording resumed",{reason:"left blocked url"}),Do.info("recording resumed"))}On(t,e){var n;if("event"===t&&this.$n(),!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?kr:Sr;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.tn(),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=Kn(t)?t:JSON.parse(t)}catch(t){return void Do.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var n;const i=null!==(n=e.cache_timestamp)&&void 0!==n?n:Date.now();if(Date.now()-i>36e5)return void Do.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:t})}return e}Ln(t,e,n){this._instance.get_property(t)&&(e(),n())}start(t){var e,n;const i=this.ne;if(!i)return void Do.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.be;this.Xe(t?"no_interaction_since_recording_started":void 0),this.be=!1,this.ge=t,this.ye=!1}this.Pe&&(this.Pn(),this.en());const{sessionId:r,windowId:s,sessionStartTimestamp:o}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=r,this.Be=s,this._sessionStartTimestamp=o,this.Dn(),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 oo(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new so(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.On(t,e)),this.Ln(gr,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(gr)}),this.Ln(yr,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(yr)}),this.Ln(wr,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(wr)}),this.Ln(br,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(br)}),this.re.makeSamplingDecisions(this.sessionId),this.Fn(),this.we||(ki(Wn,"beforeunload",this.Je),ki(Wn,"pagehide",this.nn),ki(Wn,"offline",this.rn),ki(Wn,"online",this.sn),ki(Hn,"visibilitychange",this.an),!this.Fe&&Yn(this.Yt.onSessionId)&&(this.Fe=this.Yt.onSessionId(this.je)),!this.Ne&&Yn(this.Yt.on)?this.Ne=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,n)=>{var i;null===(i=this.qe)||void 0===i||i.call(this),this.qe=void 0,this.je(t,e,n)})}):Yn(this.Yt.on)||Do.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),ii(this.De)&&(this.De=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.gn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Do.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(t||"recording_initialized"))}Nn(){var t,e,n,i,r,s;null==Wn||Wn.removeEventListener("beforeunload",this.Je),null==Wn||Wn.removeEventListener("pagehide",this.nn),null==Wn||Wn.removeEventListener("offline",this.rn),null==Wn||Wn.removeEventListener("online",this.sn),null==Hn||Hn.removeEventListener("visibilitychange",this.an),clearInterval(this.Rn),this.qn(),null===(t=this.De)||void 0===t||t.call(this),this.De=void 0,null===(e=this.Wt)||void 0===e||e.call(this),this.Wt=void 0,null===(n=this.Fe)||void 0===n||n.call(this),this.Fe=void 0,null===(i=this.Ne)||void 0===i||i.call(this),this.Ne=void 0,null===(r=this.qe)||void 0===r||r.call(this),this.qe=void 0,null===(s=this.re)||void 0===s||s.stop(),this.jn(),this.Pn()}Pn(){this.Le+=1,this.Ae=[],this.Oe=0,this.Bn=void 0,this.Pe=!1}jn(){var t,e;null===(t=this.Hn)||void 0===t||t.stop(),this.ce=[],null===(e=this.Sn)||void 0===e||e.stop(),this.Sn=void 0,this.ae=!1;try{var n;null===(n=this.se)||void 0===n||n.call(this)}catch(t){Do.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.Un=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),Do.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),Do.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.zn())return;this.tn(),this.en(),this.Wn(),this.Nn(),Do.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}Ue(t){this.We=!0,this.le=Date.now();try{var e,n;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=Po())||void 0===e||null===(n=e.resetSnapshotCostState)||void 0===n||n.call(e),this.start("session_id_changed")}finally{this.We=!1}this.Xe(t?"no_interaction_since_session_rotated":void 0),this.ge=!1}Xe(t,{preserveLogDedup:e=!1}={}){if(this.me=!ti(t),this.Un=t,ti(t))return void(e||(this.Gn=void 0));if(this.We)return;const n=`${this.sessionId}:${t}`;n!==this.Gn&&(this.Gn=n,Do.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}$n(){this.isStarted||(this.be=!0),this.me&&(this.Xe(void 0),this.ge=!1,this.ye&&(this.ye=!1,this.jt()),this.Qn())}discard({discardProducerEvents:t=!1}={}){this.me=!0,t&&(this.en(),this.jn()),this.en(),this.Nn(),this.en(),this.Wn(),Do.info("discarded")}Jn(t,e,n,i,r){const s={$snapshot_bytes:n,$snapshot_data:e,$session_id:i,$window_id:r};"disabled"!==this.status?(this.Kn(t,i),this.Xn(s)):this.en()}Yn(){try{this.ti()}catch(t){this.Se||(this.Se=!0,Do.error("could not track full snapshot cost",t))}}ti(){var t,e;const n=null===(t=Po())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);n&&n!==this.Zn&&(this.Zn=n,this.Vn&&this.Vn.durationMs>=n.durationMs||(this.Vn=n),500>n.durationMs||Do.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}))}Kn(t,e){2!==t.type?3===t.type&&(ti(this.Re)||this.Re===e||this.$e===e||(this.$e=e,Do.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Re=e}ei(t){t.counted&&t.generation===this.Le&&(this.Oe=Math.max(0,this.Oe-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ni(t,e,n){t.processed||t.generation!==this.Le||(t.processed=!0,this.Jn(t.event,e,n,t.targetSessionId,t.targetWindowId))}ii(t){try{let e=t.event,n=ls(t.event);if(t.compressionEnabled)try{({event:e,size:n}=ea(t.event))}catch(t){Do.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,n)}catch(t){Do.error("could not capture queued compression event",t)}}finally{this.ei(t)}}Ye(){[...this.Ae].forEach(t=>{this.ii(t)})}ri(t,e,n,i){var r=this;const o={event:t,compressionEnabled:e,targetSessionId:n,targetWindowId:i,generation:this.Le,processed:!1,counted:!0};this.Ae.push(o),this.Oe+=1;const a=(l=s(function*(){try{if(o.processed)return;let n,i;try{const r=e?Xo(t)?yield function(t){return na.apply(this,arguments)}(t):ea(t):{event:t,size:ls(t)};n=r.event,i=r.size}catch(e){Do.error("could not process queued compression event - will use uncompressed event",e),n=t,i=ls(t)}r.ni(o,n,i)}finally{r.ei(o)}}),function(){return l.apply(this,arguments)});var l;this.Bn=this.Bn?this.Bn.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.Mn(),!t||!Kn(t))return;if(4===t.type){const e=this.gn(t.data.href);if(this.Cn=e,!e)return;t.data.href=e}else this.xn();if(null===(e=this.re)||void 0===e||e.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.On(t,e)),this.Y.urlBlocked&&(5!==(c=t).type||"recording paused"!==c.data.tag))return;2===t.type&&((null===(h=Po())||void 0===h||null===(d=h.wasMaxDepthReached)||void 0===d?void 0:d.call(h))&&(this._e=!0),this.Yn(),Promise.resolve().then(()=>this.Yn()),this.Tn(),null===(f=this.Hn)||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.oi();const m=this.Hn?this.Hn.throttleMutations(t):t;if(!m)return void(!0===this.de&&this.he++);const g=function(t){const e=t;if(e&&Kn(e)&&6===e.type&&Kn(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 sa(t)?t.data.payload:null}(g),b=function(t){return oa(t)?t.data.payload:null}(g),w=function(t){return ra(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.si(g),2===t.type&&(this.Te.push([this.Xt,t.timestamp]),this.Te.length>6&&(this.Te=this.Te.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.Be;if(!0===this.de&&!function(t){return ra(t)||sa(t)||oa(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._n(!0):S||this._n();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=Wn?this.gn(Wn.location.href):void 0}catch(t){}g.data.href=t}if(this.Oe>0||C&&Xo(g))return void this.ri(g,C,_,k);const{event:I,size:M}=C?ea(g):{event:g,size:ls(g)};this.Jn(g,I,M,_,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.we,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):Pr}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.$n(),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.$n(),this.qt("sampling_overridden")}overrideTrigger(t){this.On(t),this.$n()}ai(){try{var t;const e=null==Wn||null===(t=Wn.location)||void 0===t?void 0:t.href;if(!e)return;const n=this.gn(e);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}qn(){this.li&&(clearTimeout(this.li),this.li=void 0)}Qn(){this.li||(this.li=setTimeout(()=>{this.tn()},2e3))}ui(){return this.Re!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!sa(t)&&!oa(t))}ci(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}di(t){if("buffering"!==t)return ti(this.hi)||this._instance.register_for_session({[Or]:[]}),void(this.hi=void 0);const e=this.ci();if(0===e.length)return ti(this.hi)||this._instance.register_for_session({[Or]:[]}),void(this.hi=void 0);const n=e.join(", "),i=`${this.sessionId}:${n}`;i!==this.hi&&(this.hi=i,this._instance.register_for_session({[Or]:e}),Do.info(`buffering: ${n}`))}fi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.pi)&&Vs.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Vs.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Vs.Dt(this.ln);Vs.Lt(this.ln),Kn(t)&&Xn(t.data)&&0!==t.data.length&&Xn(t.sizes)&&t.sizes.length===t.data.length&&ri(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Be&&(this.Rt.data.length>0||(this.Rt=t))}tn(t=!1){var e;if(this.qn(),this.me)return this.Rt;if(this.ui())return this.Rt.size>943718.4?this.en():(t&&this.mi(),this.Rt);const n=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const i=this.Ge(),r=this.status;if(this.di(r),"buffering"===r||"paused"===r||"disabled"===r||i)return!t||"active"!==r&&"sampled"!==r||this.mi(),this.Qn(),this.Rt;if(this.Rt!==n)return this.Rt;if(n.data.length>0){var s;const t=this.ai();cs(n).forEach(e=>{try{var n;null===(n=this.He)||void 0===n||n.trackSize(e.sessionId,e.size),this.yi({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Zs.LIB_NAME,$lib_version:Zs.LIB_VERSION,$snapshot_host:t})}catch(t){Do.warn("could not capture snapshot chunk - skipping it",t)}}),ti(this.gi)||(Vs.Lt(this.ln),this.gi=void 0),null===(s=this.re)||void 0===s||s.onFlushComplete()}return this.en()}Xn(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.me&&this.Rt.size+t.$snapshot_bytes+n>943718.4){const e=this.Xt;if(this.Rt=this.tn(),this.Xt!==e)return;r&&this.Rt.data.length>0&&(this.Rt=this.en()),this.Rt.sessionId=i,this.Rt.windowId=t.$window_id}this.me&&(this.ye||this.Rt.size+t.$snapshot_bytes+n>943718.4)?this.ye||(this.ye=!0,this.Rt=this.en()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.me||this.Qn())}yi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const n=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return n?n.timestamp-this._sessionStartTimestamp:null}oi(){if(!this.Rt||0===this.Rt.data.length)return this.en();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.en():(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)}en(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Be},this.Rt}qt(t,e){this._instance.register_for_session({[Nr]:t}),Do.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",i({reason:t},e))}bi(t){var e;return 3===t.type&&-1!==Lo.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),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.Be}),this.tn());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.Be!==n;if(this.Be=n,this.Xt=i,s||o){const t=s&&!1!==this.de;t&&(this.de="unknown"),this.Ue(t)}else if(e&&this.$n(),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._n(),this.Tn()}}ze(){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;const d=null===(t=Po())||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.Un,$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.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(n=this.He)||void 0===n?void 0:n.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:Fo(null===(i=this.Vn)||void 0===i?void 0:i.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Fo(null===(r=this.Vn)||void 0===r?void 0:r.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(s=this.Vn)||void 0===s?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Vn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this.Vn)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==d?void 0:d.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==d?void 0:d.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==d?void 0:d.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Fo(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Fo(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Fo(null===(l=Po())||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=Po())||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_rrweb_error:this.we,[Dr]:!!this.se,[Lr]:this.ke}}Fn(){var t;if(this.se)return;this.ke=!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={};ti(t.mousemove)||(n.mousemove=t.mousemove),ti(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.hn&&this.hn.enabled&&(e.recordCanvas=!0,e.sampling=i(i({},e.sampling),{},{canvas:this.hn.fps}),e.dataURLOptions={type:"image/webp",quality:this.hn.quality},e.canvasResolutionScale=this.dn,e.canvasMasking={configured:()=>{var t;return Yn(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(Yn(n))try{var i;return null!==(i=n(t))&&void 0!==i?i:null}catch(t){return this.Me||(this.Me=!0,Do.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.un&&(e.maskAllInputs=null===(r=this.un.maskAllInputs)||void 0===r||r,e.maskTextSelector=null!==(s=this.un.maskTextSelector)&&void 0!==s?s:void 0,e.blockSelector=null!==(o=this.un.blockSelector)&&void 0!==o?o:void 0,e.maskAllElementAttributes=null!==(a=this.un.maskAllElementAttributes)&&void 0!==a&&a),e.maskAllElementAttributes&&e.maskAttributeFn&&(e.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,Do.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.cn();const l=jo();if(!l)return void Do.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Hn=null!==(t=this.Hn)&&void 0!==t?t:new qs(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`;Do.info(n,{node:e}),this.log("[SessionRecording] "+n,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const u=this.pn();if(this.se=l(i({emit:t=>{this.onRRwebEmit(t)},plugins:u,errorHandler:(t,e)=>"rrweb"===e&&(this.Ie||(this.Ie=!0,Do.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},e)),!this.se)return this.we=!0,void Do.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.we=!1,!0===(null==n?void 0:n.captureJsonLd)&&Hn&&(null==Wn?void 0:Wn.MutationObserver)&&!this.Sn&&(this.Sn=function(t,e,n){const i=new WeakMap,r=n.getCaptureState||(()=>!0);let s=lo;const o=function(t,e){const n=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==n?void 0:n.length)&&!n.includes("id")?ho:n=>{const i=t.getElementById(n);return!!i&&"SCRIPT"!==i.nodeName&&(!e.isRecordedElement||e.isRecordedElement(i))&&!Oo(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 Oo(t,e.blockClass,e.blockSelector)||Oo(t,e.maskTextClass,e.maskTextSelector)}(e,n))return;const l=function(t,e=ho,n){if(!t||t.length>lo)return null;try{const i=JSON.parse(t),r={maskUrl:n,remainingNodes:2048,exceeded:!1},s=Xn(i)?i.map(t=>Ao(t,e,r)):Ao(i,e,r);if(r.exceeded||ni(s)||Xn(s)&&(!s.length||s.some(ni)))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(ni(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 Eo(t))a(e)};for(const n of t)if("childList"===n.type)xo(n.target)&&a(n.target),n.addedNodes.forEach(e);else if("characterData"===n.type){const t=n.target.parentNode;t&&xo(t)&&a(t)}else"attributes"===n.type&&xo(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()&&Eo(t.documentElement).forEach(t=>{e&&i.delete(t),a(t)})},stop(){return n.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(Hn,Wn.MutationObserver,{maskUrl:t=>this.gn(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.wn()},emit:t=>this.kn(t)}),this.Y.isCurrentUrlBlocked()&&this.Sn.scan()),this.le=Date.now(),this.de=si(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)}};Vn.__PosthogExtensions__=Vn.__PosthogExtensions__||{},Vn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:zn,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:mr,options:t})},Vn.__PosthogExtensions__.rrweb={record:Mn,version:"v2",wasMaxDepthReached:()=>Qt,resetMaxDepthState(){Qt=!1,Jt=!1},getLastSnapshotCost:()=>P,getMutationCost:()=>i({},U),getDeferredStylesheetStats:()=>i({},H),getDiscardedDurationSamples:()=>x,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}}},Vn.__PosthogExtensions__.initSessionRecording=(t,e)=>new aa(t,e)}();
2
2
  //# sourceMappingURL=posthog-recorder.js.map