posthog-js 1.412.0 → 1.412.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,r=null==e?void 0:e.document,i=null==e?void 0:e.location;null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;var n="undefined"!=typeof globalThis?globalThis:t;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});var s=null!=t?t:{};function a(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){a(s,i,n,o,u,"next",t)}function u(t){a(s,i,n,o,u,"throw",t)}o(void 0)}))}}function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},u.apply(null,arguments)}var l,h={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},d={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},c="NativeGzipValidationError",v=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=c,e},f=function(){var t=o((function*(t,e){18>t.size&&v("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&v("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(l)return l;l=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;l[t]=e>>>0}return l})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&v("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&v("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function p(){return p=o((function*(t,e,r){void 0===e&&(e=!0);try{var i=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),a=s.write(i).then((()=>s.close())).catch(function(){var t=o((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(n.readable).blob(),l=(yield Promise.all([u,a]))[0];return yield f(l,i),l}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),p.apply(this,arguments)}var m=function(t){return t.trim()},g=Object.prototype,y=g.hasOwnProperty,w=g.toString,b=Array.isArray||function(t){return"[object Array]"===w.call(t)},k=t=>"function"==typeof t,_=t=>t===Object(t)&&!b(t),S=t=>void 0===t,I=t=>"[object String]"==w.call(t),M=t=>null===t,C=t=>S(t)||M(t),R=t=>"[object Number]"==w.call(t)&&t==t,x=t=>"[object Boolean]"===w.call(t),T=t=>t instanceof FormData;function A(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),R(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):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: "+r+", fallback: "+n),A(n||r,e,r,i))}class O{constructor(t){this.tt={},this.et=t.et,this.it=A(t.bucketSize,0,100,t.rt),this.nt=A(t.refillRate,0,this.it,t.rt),this.st=A(t.refillInterval,0,864e5,t.rt)}ot(t,e){var r=Math.floor((e-t.lastAccess)/this.st);r>0&&(t.tokens=Math.min(t.tokens+r*this.nt,this.it),t.lastAccess=t.lastAccess+r*this.st)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.tt[i];return n?this.ot(n,r):this.tt[i]=n={tokens:this.it,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.et)||e.call(this,t)),0===n.tokens)}stop(){this.tt={}}}function E(t){return t?t.split("#")[0]:t}var F={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"},N=function(e,r){var i=(void 0===r?{}:r).debugEnabled,n={k(r){if(t&&(F.DEBUG||t.POSTHOG_DEBUG||i)&&!S(t.console)&&t.console){for(var n=("__rrweb_original__"in t.console[r]?t.console[r].__rrweb_original__:t.console[r]),s=arguments.length,a=new Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];n(e,...a)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("error",...e)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(t){n.error("You must initialize PostHog before calling "+t)},createLogger:(t,r)=>N(e+" "+t,r)};return n},L=N("[PostHog.js]"),D=L.createLogger;function P(t,e){if(!C(t))if(b(t))t.forEach(e);else if(T(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)y.call(t,r)&&e(t[r],r)}function B(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var W=["localhost","127.0.0.1"],z=t=>{var e=null==r?void 0:r.createElement("a");return S(e)?null:(e.href=t,e)},U=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return P(t,(function(t,e){S(t)||S(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)};function j(e){var r,i=null==t||null==(r=t.location)?void 0:r.href;return S(i)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!k(i))return e;try{var n=i(e);return I(n)&&n?n:e}catch(t){return L.error("Error in get_current_url, falling back to window.location.href",t),e}}(e,i)}var q=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}))$"),H=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,G=[16,15,14,13],V=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Z=/[0-9A-Za-z_]/;function J(t){for(var e=0,r=!1,i=t.length-1;i>=0;i--){var n=t.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),e+=n,r=!r}return e%10==0}var Q="[SessionRecording]",K="redacted",X=1e6;function Y(t){var e;return Math.min(X,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:X)}var tt={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:X,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},et=["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"],rt=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],it=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],nt=t=>{C(t)||P(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return et.includes(e)||it.some((t=>e.includes(t)))})(e)&&(t[e]=K)}))},st=["/s/","/e/","/i/"];function at(t,e,r,i){if(C(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return I(n)&&(n=parseInt(n)),n>r?Q+" "+i+" body too large to record ("+n+" bytes)":t}function ot(t,e){if(C(t))return t;var r=t;return function(t,e){if(C(t))return!1;if(I(t)){if(function(t){var e;for(H.lastIndex=0;e=H.exec(t);){var r=e[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of G){var a=n+s;if(i.length>=a){var o=i.slice(n,a);if(q.test(o)&&J(o))return!0}}}return!1}(t=m(t)))return!1;var r=function(t){var e;for(V.lastIndex=0;e=V.exec(t);){var r=e[1],i=e[3];if(!(r&&i&&Z.test(r)&&Z.test(i)))return!0}return!1}(t);if(r)return!1}return!0}(r)||(r=Q+" "+e+" body "+K),P(rt,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Q+" "+e+" body "+K+" as might contain: "+t)})),r}var ut="$session_recording_remote_config",lt="$replay_sample_rate",ht="$replay_override_sampling",dt="$replay_override_linked_flag",ct="$replay_override_url_trigger",vt="$replay_override_event_trigger",ft="$session_is_sampled",pt="$session_past_minimum_duration",mt="$session_recording_url_trigger_activated_session",gt="$session_recording_event_trigger_activated_session",yt="$posthog_sr_group_event_trigger_",wt="$posthog_sr_group_url_trigger_",bt="$posthog_sr_group_sampling_",kt="$debug_first_full_snapshot_timestamp",_t="$sess_rec_flush_size",St="$stored_person_properties",It="$sdk_debug_replay_remote_trigger_matching_config",Mt="disabled",Ct="sampled",Rt="active",xt="buffering",Tt="paused",At="rrweb_error",Ot="trigger",Et=Ot+"_activated",Ft=Ot+"_pending",Nt=Ot+"_"+Mt;function Lt(t,e,r,i,n,s){return 0===e?Nt:(null==t?void 0:t.get_property(r?i+r:n))===s?Et:Ft}function Dt(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}class Pt{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(Et)?Et:e.includes(Ft)?Ft:Nt}stop(){this.u.forEach((t=>t.stop()))}}class $t{constructor(t){this.u=t}triggerStatus(t){var e=new Set;for(var r of this.u)e.add(r.triggerStatus(t));switch(e.delete(Nt),e.size){case 0:return Nt;case 1:return Array.from(e)[0];default:return Ft}}stop(){this.u.forEach((t=>t.stop()))}}class Bt{triggerStatus(){return Et}stop(){}}var Wt=t=>"sessionRecording"in t;class zt{constructor(t,e){this.th=[],this.eh=[],this.rh=new Map,this.ih=new Map,this.nh="",this.urlBlocked=!1,this._instance=t,this.sh=e}onConfig(t){var e,r;this.th=(Wt(t)?_(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.eh=(Wt(t)?_(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.ah()}ah(){for(var t of(this.rh.clear(),this.ih.clear(),this.th))if("regex"===t.matching&&!this.rh.has(t.url))try{this.rh.set(t.url,new RegExp(t.url))}catch(e){L.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.eh)if("regex"===e.matching&&!this.ih.has(e.url))try{this.ih.set(e.url,new RegExp(e.url))}catch(t){L.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}oh(t){return Lt(this._instance,this.th.length,this.sh,wt,mt,t)}triggerStatus(t){var e=this.oh(t),r=e===Et?Et:e===Ft?Ft:Nt;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){var r=j(this._instance);if(r&&r!==this.nh){this.nh=r;var i=this.urlBlocked,n=Dt(r,this.eh,this.ih);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=j(this._instance);if(n&&n!==this.nh){this.nh=n;var s=this.urlBlocked,a=Dt(n,this.eh,this.ih);a&&!s?t():!a&&s&&e();var o=this.oh(i)===Et,u=Dt(n,this.th,this.rh);!o&&u&&r("url",n)}}stop(){this.nh=""}}class Ut{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.uh=()=>{},this._instance=t}triggerStatus(){var t=Ft;return C(this.linkedFlag)&&(t=Nt),this.linkedFlagSeen&&(t=Et),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(Wt(t)?_(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!C(this.linkedFlag)&&!this.linkedFlagSeen){var i=I(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=I(this.linkedFlag)?null:this.linkedFlag.variant;this.uh=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(_(r)&&i in r){var a=r[i];s=x(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.uh()}}class jt{constructor(t,e){this.lh=[],this._instance=t,this.sh=e}onConfig(t){var e;this.lh=(Wt(t)?_(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}hh(t){return Lt(this._instance,this.lh.length,this.sh,yt,gt,t)}triggerStatus(t){var e=this.hh(t),r=e===Et?Et:e===Ft?Ft:Nt;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.lh.length){var i=this.hh(r)===Et,n=this.lh.includes(t);!i&&n&&e("event",t)}}stop(){}}class qt{constructor(t,e,r){if(this._instance=t,this.group=e,this.dh=new zt(t,e.id),this.fh=new jt(t,e.id),this.ph=new Ut(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.dh.onConfig(n),this.fh.onConfig(n),this.ph.onConfig(n,r);var s=[this.fh,this.dh,this.ph];this.mh="any"===e.conditions.matchType?new Pt(s):new $t(s)}else this.mh=new Bt}triggerStatus(t){return this.mh.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.fh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.dh.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?wt+this.group.id:yt+this.group.id]:e})}stop(){this.dh.stop(),this.fh.stop(),this.ph.stop()}}function Ht(t){if(t.rrwebError)return At;if(!t.receivedFlags)return xt;if(!t.isRecordingEnabled)return Mt;if(t.urlTriggerMatching.urlBlocked)return Tt;var e=!0===t.isSampled,r=new Pt([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Ct:r===Et?Rt:r===Ft?xt:!1===t.isSampled?Mt:Rt}function Gt(t){if(t.rrwebError)return At;if(!t.receivedFlags)return xt;if(!t.isRecordingEnabled)return Mt;if(t.urlTriggerMatching.urlBlocked)return Tt;var e=new $t([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Nt,i=x(t.isSampled);return r&&e===Ft?xt:r&&e===Nt||i&&!t.isSampled?Mt:!0===t.isSampled?Ct:Rt}function Vt(){var t=[];return function(e,r){if(_(r)||b(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function Zt(t){var e=JSON.stringify(t,Vt());return e?new Blob([e]).size:0}function Jt(t){if(M(t))return 4;if(S(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(b(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=S(i)||M(i)?4:Jt(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];S(u)||(a||(s+=1),a=!1,s+=o.length+3+Jt(u))}return s;default:return 0}}function Qt(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[Qt({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Qt({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Kt=Uint8Array,Xt=Uint16Array,Yt=Uint32Array,te=new Kt([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]),ee=new Kt([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]),re=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ie=function(t,e){for(var r=new Xt(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Yt(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},ne=ie(te,2),se=ne[1];ne[0][28]=258,se[258]=28;for(var ae=ie(ee,0)[1],oe=new Xt(32768),ue=0;32768>ue;++ue){var le=(43690&ue)>>>1|(21845&ue)<<1;oe[ue]=((65280&(le=(61680&(le=(52428&le)>>>2|(13107&le)<<2))>>>4|(3855&le)<<4))>>>8|(255&le)<<8)>>>1}var he=function(t,e,r){for(var i=t.length,n=0,s=new Xt(e);i>n;++n)++s[t[n]-1];var a,o=new Xt(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new Xt(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)a[oe[d]>>>u]=l}else for(a=new Xt(i),n=0;i>n;++n)a[n]=oe[o[t[n]-1]++]>>>15-t[n];return a},de=new Kt(288);for(ue=0;144>ue;++ue)de[ue]=8;for(ue=144;256>ue;++ue)de[ue]=9;for(ue=256;280>ue;++ue)de[ue]=7;for(ue=280;288>ue;++ue)de[ue]=8;var ce=new Kt(32);for(ue=0;32>ue;++ue)ce[ue]=5;var ve=he(de,9,0),fe=he(ce,5,0),pe=function(t){return(t/8>>0)+(7&t&&1)},me=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof Xt?Xt:t instanceof Yt?Yt:Kt)(r-e);return i.set(t.subarray(e,r)),i},ge=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},ye=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},we=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Kt(0),0];if(1==n){var a=new Kt(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var v=new Xt(c+1),f=be(r[h-1],v,0);if(f>e){i=0;var p=0,m=f-e,g=1<<m;for(s.sort((function(t,e){return v[e.s]-v[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=v[y])break;p+=g-(1<<f-v[y]),v[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>v[w]?p-=1<<e-v[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;v[b]==e&&(--v[b],++p)}f=e}return[new Kt(v),f]},be=function(t,e,r){return-1==t.s?Math.max(be(t.l,e,r+1),be(t.r,e,r+1)):e[t.s]=r},ke=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Xt(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},_e=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},Se=function(t,e,r){var i=r.length,n=pe(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},Ie=function(t,e,r,i,n,s,a,o,u,l,h){ge(e,h++,r),++n[256];for(var d=we(n,15),c=d[0],v=d[1],f=we(s,15),p=f[0],m=f[1],g=ke(c),y=g[0],w=g[1],b=ke(p),k=b[0],_=b[1],S=new Xt(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;k.length>I;++I)S[31&k[I]]++;for(var M=we(S,7),C=M[0],R=M[1],x=19;x>4&&!C[re[x-1]];--x);var T,A,O,E,F=l+5<<3,N=_e(n,de)+_e(s,ce)+a,L=_e(n,c)+_e(s,p)+a+14+3*x+_e(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(N>=F&&L>=F)return Se(e,h,t.subarray(u,u+l));if(ge(e,h,1+(N>L)),h+=2,N>L){T=he(c,v,0),A=c,O=he(p,m,0),E=p;var D=he(C,R,0);for(ge(e,h,w-257),ge(e,h+5,_-1),ge(e,h+10,x-4),h+=14,I=0;x>I;++I)ge(e,h+3*I,C[re[I]]);h+=3*x;for(var P=[y,k],B=0;2>B;++B){var W=P[B];for(I=0;W.length>I;++I)ge(e,h,D[z=31&W[I]]),h+=C[z],z>15&&(ge(e,h,W[I]>>>5&127),h+=W[I]>>>12)}}else T=ve,A=de,O=fe,E=ce;for(I=0;o>I;++I)if(i[I]>255){var z;ye(e,h,T[257+(z=i[I]>>>18&31)]),h+=A[z+257],z>7&&(ge(e,h,i[I]>>>23&31),h+=te[z]);var U=31&i[I];ye(e,h,O[U]),h+=E[U],U>3&&(ye(e,h,i[I]>>>5&8191),h+=ee[U])}else ye(e,h,T[i[I]]),h+=A[i[I]];return ye(e,h,T[256]),h+A[256]},Me=new Yt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ce=function(){for(var t=new Yt(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),Re=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=Ce[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},xe=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new Kt(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=Se(u,l,t.subarray(h,d)):(u[h]=true,l=Se(u,l,t.subarray(h,a)))}else{for(var c=Me[e-1],v=c>>>13,f=8191&c,p=(1<<r)-1,m=new Xt(32768),g=new Xt(p+1),y=Math.ceil(r/3),w=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<w)&p},k=new Yt(25e3),_=new Xt(288),S=new Xt(32),I=0,M=0,C=(h=0,0),R=0,x=0;a>h;++h){var T=b(h),A=32767&h,O=g[T];if(m[A]=O,g[T]=A,h>=R){var E=a-h;if((I>7e3||C>24576)&&E>423){l=Ie(t,u,0,k,_,S,M,C,x,h-x,l),C=I=M=0,x=h;for(var F=0;286>F;++F)_[F]=0;for(F=0;30>F;++F)S[F]=0}var N=2,L=0,D=f,P=A-O&32767;if(E>2&&T==b(h-P))for(var B=Math.min(v,E)-1,W=Math.min(32767,h),z=Math.min(258,E);W>=P&&--D&&A!=O;){if(t[h+N]==t[h+N-P]){for(var U=0;z>U&&t[h+U]==t[h+U-P];++U);if(U>N){if(N=U,L=P,U>B)break;var j=Math.min(P,U-2),q=0;for(F=0;j>F;++F){var H=h-P+F+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,O=H)}}}P+=(A=O)-(O=m[A])+32768&32767}if(L){k[C++]=268435456|se[N]<<18|ae[L];var V=31&se[N],Z=31&ae[L];M+=te[V]+ee[Z],++_[257+V],++S[Z],R=h+N,++I}else k[C++]=t[h],++_[t[h]]}}l=Ie(t,u,true,k,_,S,M,C,x,h-x,l)}return me(o,0,i+pe(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Te=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Ae=function(t,e){var r=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&&Te(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},Oe=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Ee(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Fe{constructor(t,e){var r,i;void 0===e&&(e={}),this.gh={},this.yh=t=>{if(!this.gh[t]){var e,r;this.gh[t]=!0;var i=this.wh(t);null==(e=(r=this.bh).onBlockedNode)||e.call(r,t,i)}},this.kh=t=>{var e=this.wh(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.wh=t=>this._rrweb.mirror.getNode(t),this._h=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this._h(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var e=this.kh(t.id);return!this.To.consumeRateLimit(e[0])&&t})));var i=this._h(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.bh=e,this.To=new O({bucketSize:null!==(r=this.bh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.bh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,et:this.yh,rt:L})}reset(){this.gh={}}stop(){this.To.stop(),this.reset()}}F.DEBUG=!1,F.LIB_VERSION="1.412.0",F.LIB_NAME="web";class Ne{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.Sh=t.get_property.bind(t),this.Ih=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Ih(_t,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.Sh(_t);return _(e=r)&&I(e.sessionId)&&R(e.size)&&r.sessionId===t?r.size:0}}function Le(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100<A(100*e,0,100,L)}var De=function(t,e){if(!function(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}},Pe={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=>De(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!De(e,t))))),icontains:(t,e)=>e.map($e).some((e=>t.map($e).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map($e).every((e=>t.map($e).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r<parseFloat(t)))}))},$e=t=>t.toLowerCase(),Be=new Set(["is_not","not_icontains","not_regex"]);function We(t,e,r){return!t||0===t.length||t.every((t=>{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(S(n)||M(n))return Be.has(s);var a=Pe[s];return!!a&&!S(t.value)&&!M(t.value)&&a(b(t.value)?t.value.map(String):[String(t.value)],b(n)?n.map(String):[String(n)])}))}var ze=D("[SessionRecording]");function Ue(t,e){return e?t:"!"+t}function je(t,e){return t===e||t!=="!"+e&&null}class qe{constructor(t,e,r,i,n,s,a){this.Mh=null,this.Ch=Gt,this._instance=t,this.dh=e,this.fh=r,this.ph=i,this.Rh=n,this.xh=s,this.Th=a}onRemoteConfig(t){this.Mh=R(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ah=new Pt([this.fh,this.dh]),this.Ch=Ht):(this.Ah=new $t([this.fh,this.dh]),this.Ch=Gt),this._instance.register_for_session({[It]:t.triggerMatchType}),this.dh.onConfig(t),this.fh.onConfig(t),this.ph.onConfig(t,((t,e)=>{this.Rh("linked_flag_matched",{flag:t,variant:e}),this.Th()}))}getStatus(t){return this.Ch({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return R(r)?r:null}checkUrlTriggers(t,e,r,i){this.dh.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.fh.lh.length&&C(this.Oh))return this.Oh=t((t=>{try{this.fh.checkEventTriggerConditions(t.event,r,e)}catch(t){ze.error("Could not activate event trigger",t)}})),this.Oh}makeSamplingDecisions(t){var e,r,i,n=this.Mh;if(!R(n))return null==(r=this._instance.persistence)||r.unregister(ft),void(null==(i=this._instance.persistence)||i.unregister(lt));var s=this._instance.get_property(ft),a=this._instance.get_property(lt),o=je(s,t),u=R(a)&&a!==n,l=S(a)&&s===t,h=u||l||!x(o),d=h?Le(t,n):o;h&&(d?this.Rh("sampled"):ze.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[ft]:Ue(t,d),[lt]:M(a)&&s===t?null:n})}ensureSamplingDecision(t){if(R(this.Mh)){var e=this._instance.get_property(ft);x(je(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(gt),null==(e=this._instance.persistence)||e.unregister(mt),null==(r=this._instance.persistence)||r.unregister(ft),null==(i=this._instance.persistence)||i.unregister(lt),null==(n=this._instance.persistence)||n.unregister(pt)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this.Ah)?void 0:e.triggerStatus(t))===Ft}stop(){var t;null==(t=this.Oh)||t.call(this),this.Oh=void 0,this.fh.stop(),this.dh.stop(),this.ph.stop()}}class He{constructor(t,e,r,i,n){this.Eh=[],this.Fh=new Map,this.Nh=!1,this._instance=t,this.dh=e,this.Rh=r,this.Lh=i,this.Th=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Dh(t.triggerGroups),this._instance.register_for_session({[It]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.dh.onConfig(t)):ze.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return At;if(t.urlTriggerMatching.urlBlocked)return Tt;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return Mt;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Et){var o=s.group.id,u=r.get(o);S(u)?L.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Ft&&(i=!0)}return n?Ct:i?xt:Mt}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Eh,triggerGroupSamplingResults:this.Fh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Eh)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;R(i)&&(M(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.dh.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Ph(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.Th(e))}),t)};for(var a of this.Eh)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Oh=t((t=>{var r;if(this.Nh)return ze.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Oh)||r.call(this),void(this.Oh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Ph(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(St);s.some((e=>!e.properties||0===e.properties.length||We(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.Th(n))}}),e)};for(var s of this.Eh)n(s)}catch(t){ze.error("Could not activate event trigger for trigger groups",t)}})),this.Oh}makeSamplingDecisions(t){for(var e of this.Eh){var r,i=e.group,n=i.id,s=i.sampleRate,a=bt+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(_(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=R(v)&&v!==s,u=c===t&&R(v)&&v===s&&x(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!x(u),m=p?Le(t+n,s):u;p&&this.Lh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Fh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Nh=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(ft),null==(e=this._instance.persistence)||e.unregister(lt),null==(r=this._instance.persistence)||r.unregister(pt),this.Eh)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(yt+o),null==(s=this._instance.persistence)||s.unregister(wt+o),null==(a=this._instance.persistence)||a.unregister(bt+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Eh){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Fh.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Eh)if(e.triggerStatus(t)===Ft)return!0;return!1}stop(){var t;null==(t=this.Oh)||t.call(this),this.Oh=void 0,this.Eh.forEach((t=>t.stop())),this.Eh=[],this.Fh.clear(),this.dh.stop()}Ph(t,e){var r=t.group.conditions.properties;return!r||0===r.length||We(r,e,this._instance.get_property(St))}Dh(t){var e=this;this.Eh.forEach((t=>t.stop())),this.Eh=[],this.Fh.clear();var r=function(t){var r=new qt(e._instance,t,((r,i)=>{e.Rh("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.Th()}));e.Eh.push(r)};for(var i of t)r(i)}}var Ge=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"];function Ve(t){return S(t)?void 0:Math.round(t)}function Ze(t){return _(t)?t.network_timing:t}var Je,Qe,Ke=943718.4,Xe="[SessionRecording]",Ye=D(Xe),tr=[d.MouseMove,d.MouseInteraction,d.Scroll,d.ViewportResize,d.Input,d.TouchMove,d.MediaInteraction,d.Drag],er=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function rr(){var t;return null==s||null==(t=s.__PosthogExtensions__)?void 0:t.rrweb}function ir(){var t;return null==(t=rr())?void 0:t.record}function nr(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,Vt())}}function sr(t){return Ee(function(t,e){void 0===e&&(e={});var r=Re(),i=t.length;r.p(t);var n=xe(t,e,Oe(e),8),s=n.length;return Ae(n,e),Te(n,s-8,r.d()),Te(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Kt(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new Kt(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return me(i,0,n)}(nr(t))))}function ar(t){return or.apply(this,arguments)}function or(){return or=o((function*(t){var e=nr(t),r=yield function(t,e,r){return p.apply(this,arguments)}(e,F.DEBUG,{rethrow:!0});return Ee(new Uint8Array(yield r.arrayBuffer()))})),or.apply(this,arguments)}var ur="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,lr=!1;function hr(t){return b(t)&&0===t.length?Je=null!=Je?Je:sr([]):sr(t)}function dr(t){return cr.apply(this,arguments)}function cr(){return(cr=o((function*(t){return b(t)&&0===t.length?Je||(Qe=null!=Qe?Qe:ar([]).then((t=>(Je=t,t))).catch((t=>{throw Je=void 0,Qe=void 0,t}))):ar(t)}))).apply(this,arguments)}function vr(t){return ur&&!lr&&function(t){return t.type===h.FullSnapshot||t.type===h.IncrementalSnapshot&&(t.data.source===d.Mutation||t.data.source===d.StyleSheetRule)}(t)}function fr(t){return{event:t,size:Jt(t)}}function pr(t,e){return u({},t,{data:e,cv:"2024-10"})}function mr(t,e){return u({},t,{cv:"2024-10",data:u({},t.data,e)})}function gr(t){try{if(t.type===h.FullSnapshot)return fr(pr(t,sr(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation)return fr(mr(t,{texts:hr(t.data.texts),attributes:hr(t.data.attributes),removes:hr(t.data.removes),adds:hr(t.data.adds)}));if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule)return fr(mr(t,{adds:t.data.adds?sr(t.data.adds):void 0,removes:t.data.removes?sr(t.data.removes):void 0}))}catch(t){Ye.error("could not compress event - will use uncompressed event",t)}return{event:t,size:Zt(t)}}function yr(){return(yr=o((function*(t){try{if(t.type===h.FullSnapshot)return fr(pr(t,yield ar(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation){var e=yield Promise.all([dr(t.data.texts),dr(t.data.attributes),dr(t.data.removes),dr(t.data.adds)]);return fr(mr(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule){var r=yield Promise.all([t.data.adds?ar(t.data.adds):void 0,t.data.removes?ar(t.data.removes):void 0]);return fr(mr(t,{adds:r[0],removes:r[1]}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===c})(e)&&(lr=!0),Ye.error("could not compress event asynchronously - trying synchronous compression",e),gr(t)}return{event:t,size:Zt(t)}}))).apply(this,arguments)}function wr(t,e){return t.type===h.Custom&&t.data.tag===e}function br(t){return wr(t,"sessionIdle")}function kr(t){return wr(t,"$session_ending")}function _r(t){return wr(t,"$session_starting")}class Sr{get sessionId(){return this.$r}get $h(){if(!this._instance.sessionManager)throw new Error(Xe+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Bh(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Wh(){return je(this._instance.get_property(ft),this.sessionId)}get Mh(){var t,e=null==(t=this.Tl)?void 0:t.sampleRate;return R(e)?e:null}get zh(){var t,e;return null!==(t=null==(e=this.Uh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.jh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.qh=void 0,this.Hh=Date.now(),this.Gh=!1,this.Vh=[],this.Zh="unknown",this.Jh=!1,this.Qh=!1,this.Kh=!1,this.Xh=!1,this.Yh=!1,this.kd=!1,this._d=!1,this.Sd=!1,this.Id=!1,this.Md=[],this.Cd=void 0,this.Rd=void 0,this.Td=[],this.Ad=0,this.Od=0,this.Ed=!1,this.Fd=void 0,this.Oh=void 0,this.Nd=void 0,this.Ld=void 0,this.Dd=void 0,this.Sr=(t,e,r)=>{var i,n,s,a;if(r&&(t!==this.$r||e!==this.Dr)){var o,u=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this.$r,h=this.Dr;if(u&&this.Lh("$session_ending",{currentSessionId:l,currentWindowId:h,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Hh,flushed_size:null==(o=this.Pd)?void 0:o.currentTrackedSize(l)}),null==(i=this._instance.persistence)||i.unregister(kt),this._d=!1,null==(n=rr())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.$d=void 0,null==(s=rr())||null==s.resetSnapshotCostState||s.resetSnapshotCostState(),this.Lh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.Bd(),!(!1===this.Zh&&this.isStarted||this.$r===t&&this.Dr===e)){var d=this.$r!==t&&!1!==this.Zh;this.Zh="unknown",this.Wd(d)}u&&this.Lh("$session_starting",{previousSessionId:l,previousWindowId:h,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Hh}),null==(a=this.Uh)||a.makeSamplingDecisions(t)}},this.zd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[pt])===this.$r},this.Ud=()=>{var t,e;if(0===this.O.data.length)return null;var r=null==(t=this.O.data[0])?void 0:t.timestamp,i=null==(e=this.O.data[this.O.data.length-1])?void 0:e.timestamp;return R(r)&&R(i)?i-r:null},this.jd=()=>{var t,e,r=this.zh;if(!R(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.qd;return R(i)&&i>=0&&r>i}if(this.zd())return!1;var n,s=this.Ud();return!!M(s)||r>s||(null==(n=this._instance.persistence)||n.register({[pt]:this.$r}),!1)},this.Hd=()=>{this.status!==xt?(this.Jh&&this.Qh&&!this.Kh&&(this.Jh=!1),this.Gd(),this.Vd()):this.Zd()},this.Jd=()=>{this.Lh("browser offline",{})},this.pa=()=>{this.Lh("browser online",{})},this.Ie=()=>{null!=r&&r.visibilityState&&this.Lh("window "+r.visibilityState,{})},this._instance=t;var e=this.$h.checkAndGetSessionAndWindowId(),i=e.windowId;this.$r=e.sessionId,this.Dr=i,this.ph=new Ut(this._instance),this.dh=new zt(this._instance),this.fh=new jt(this._instance),this.O=this.Zd(),this.$h.sessionTimeoutMs>this.Bh||Ye.warn("session_idle_threshold_ms ("+this.Bh+") is greater than the session timeout ("+this.$h.sessionTimeoutMs+"). Session will never be detected as idle"),this.Pd=new Ne(this._instance)}get Qd(){var t,e,r,i,n,s,a,o=null==(t=this.Tl)?void 0:t.masking,u={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},l=null!==(n=null==u?void 0:u.maskAllInputs)&&void 0!==n?n:null==o?void 0:o.maskAllInputs,h=null!==(s=null==u?void 0:u.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,d=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return S(l)&&S(h)&&S(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}Kd(){var t;if(!this.Sd){var e=null==(t=this.Tl)?void 0:t.masking;if(!C(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!S(i)&&i!==n}));0!==i.length&&(this.Sd=!0,Ye.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==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:e}))}}}get Xd(){var t;return A(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,D("canvas recording resolution scale"),1)}get Yd(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.Tl)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:A(h,0,12,D("canvas recording fps"),4),quality:A(d,0,1,D("canvas recording quality"),.4)}}get tc(){var t,e=!(null==(t=this.Tl)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get ec(){var t,e,r,i=null==(t=this.Tl)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=Ze(this._instance.config.capture_performance),u=Ze(null==i?void 0:i.capturePerformance),l=!!(x(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}rc(){var t,e,r=[],n=null==(t=s.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.tc&&r.push(n());var a=null==(e=s.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.ec&&k(a)&&(!W.includes(i.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(a(((t,e)=>{var r,i={payloadSizeLimitBytes:tt.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...tt.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...tt.payloadHostDenyList]},n=!1!==t.session_recording.recordHeaders&&e.recordHeaders,s=!1!==t.session_recording.recordBody&&e.recordBody,a=!1!==t.capture_performance&&e.recordPerformance,o=(r=Y(i),t=>(null!=t&&t.requestBody&&(t.requestBody=at(t.requestBody,t.requestHeaders,r,"Request")),null!=t&&t.responseBody&&(t.responseBody=at(t.responseBody,t.responseHeaders,r,"Response")),t)),l=e=>{return o(((t,e)=>{var r,i=z(t.name),n=0===e.indexOf("http")?null==(r=z(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&st.some((t=>0===s.indexOf(t)))))return t})((nt((r=e).requestHeaders),nt(r.responseHeaders),r),t.api_host));var r},h=k(t.session_recording.maskNetworkRequestFn);return h&&k(t.session_recording.maskCapturedNetworkRequestFn)&&L.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var r=t.session_recording.maskNetworkRequestFn({url:e.name});return u({},e,{name:null==r?void 0:r.url})}),i.maskRequestFn=k(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r,i=l(e);return i&&null!==(r=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:t=>function(t){if(!S(t))return t.requestBody=ot(t.requestBody,"Request"),t.responseBody=ot(t.responseBody,"Response"),t}(l(t)),u({},tt,i,{recordHeaders:n,recordBody:s,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.ec))):Ye.info("NetworkCapture not started because we are on localhost.")),r}ic(t){return this._instance.config.disable_capture_url_hashes?E(t):t}nc(t,e){void 0===e&&(e=!1);var r=e?E(t):this.ic(t),i=this._instance.config.mask_personal_data_properties?[...Ge,...this._instance.config.custom_personal_data_properties||[]]:[];return this.sc(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");b(d)&&(e.includes(d[0])?l.push(d[0]+"=<masked>"):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}sc(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}ac(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.Vh.length?this.Vh.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Ye.warn("could not emit queued rrweb event.",e,t),!1}}Lh(t,e){return this.ac(er((()=>ir().addCustomEvent(t,e))))}oc(){try{if(this._instance.config.capture_pageview||!t)return;var e=new URL(t.location.href),r=this.nc(e.origin+e.pathname+e.search);this.uc!==r&&(this.uc=r,this.Lh("$url_changed",{href:r}))}catch(t){}}lc(){if(this.Vh.length){var t=[...this.Vh];this.Vh=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.ac(t)}))}}xh(){return this.ac(er((()=>ir().takeFullSnapshot())))}get hc(){var t,e,r;if(null!=(t=this.Uh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return R(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}dc(){if(this.cc&&clearInterval(this.cc),!0!==this.Zh){var t=this.hc;t&&(this.cc=setInterval((()=>{this.xh()}),t))}}Th(t){"event"===t&&this.vc(),!this.dh.urlBlocked&&["sampled","active"].includes(this.status)&&this.dc()}fc(){this.dh.urlBlocked||(this.dh.urlBlocked=!0,clearInterval(this.cc),Ye.info("recording paused due to URL blocker"),this.Lh("recording paused",{reason:"url blocker"}))}mc(){this.dh.urlBlocked&&(this.dh.urlBlocked=!1,this.xh(),this.dc(),this.Lh("recording resumed",{reason:"left blocked url"}),Ye.info("recording resumed"))}gc(t,e){var r;if("event"===t&&this.vc(),!this.Gh&&null!=(r=this.Uh)&&r.hasPendingTriggers(this.sessionId)){this.Gh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?mt:gt]:this.sessionId}),null==(n=this.Uh)||n.updateActiveTriggers(this.sessionId),this.Th(),this.Vd(),this.Rh(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Gh=!1}}}get isStarted(){return!!this.qh}get Tl(){var t=this._instance.get_property(ut);if(t){var e;try{e=_(t)?t:JSON.parse(t)}catch(t){return void Ye.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Ye.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(ut))}return e}}yc(t,e,r){this._instance.get_property(t)&&(e(),r())}start(e){var r,i,n=this.Tl;if(n){this.isStarted||(this.Jh=!1!==this.Zh&&!this.Xh,this.Xh=!1,this.Qh=this.Jh,this.Kh=!1),this.Ed&&(this.wc(),this.Zd());var s=this.$h.checkAndGetSessionAndWindowId(),a=s.windowId;this.$r=s.sessionId,this.Dr=a,null==(r=this._instance.persistence)||r.unregister(kt),null!=n&&n.endpoint&&(this.jh=null==n?void 0:n.endpoint),this.Uh=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new He(this._instance,this.dh,this.Rh.bind(this),this.Lh.bind(this),this.Th.bind(this)):new qe(this._instance,this.dh,this.fh,this.ph,this.Rh.bind(this),this.xh.bind(this),this.Th.bind(this)),this.Uh.onRemoteConfig(n),null==(i=this.Oh)||i.call(this),this.Oh=this.Uh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.gc(t,e))),this.yc(ht,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ht)})),this.yc(dt,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(dt)})),this.yc(vt,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(vt)})),this.yc(ct,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ct)})),this.Uh.makeSamplingDecisions(this.sessionId),this.bc(),this.Yh||(B(t,"beforeunload",this.Hd),B(t,"offline",this.Jd),B(t,"online",this.pa),B(t,"visibilitychange",this.Ie),!this.Nd&&k(this.$h.onSessionId)&&(this.Nd=this.$h.onSessionId(this.Sr)),!this.Ld&&k(this.$h.on)?this.Ld=this.$h.on("forcedIdleReset",(()=>{this.Bd(),this.Zh="unknown",this.stop(),this.Dd=this.$h.onSessionId(((t,e,r)=>{var i;null==(i=this.Dd)||i.call(this),this.Dd=void 0,this.Sr(t,e,r)}))})):k(this.$h.on)||Ye.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),C(this.Fd)&&(this.Fd=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.nc(t.properties.$current_url):"";if(!e)return;this.Lh("$pageview",{href:e})}}catch(t){Ye.error("Could not add $pageview to rrweb session",t)}}))),this.status===Rt&&this.Rh(e||"recording_initialized"))}else Ye.info("remote config must be stored in persistence before recording can start")}kc(){var e,r,i,n,s,a;null==t||t.removeEventListener("beforeunload",this.Hd),null==t||t.removeEventListener("offline",this.Jd),null==t||t.removeEventListener("online",this.pa),null==t||t.removeEventListener("visibilitychange",this.Ie),clearInterval(this.cc),this._c(),null==(e=this.Fd)||e.call(this),this.Fd=void 0,null==(r=this.Oh)||r.call(this),this.Oh=void 0,null==(i=this.Nd)||i.call(this),this.Nd=void 0,null==(n=this.Ld)||n.call(this),this.Ld=void 0,null==(s=this.Dd)||s.call(this),this.Dd=void 0,null==(a=this.Uh)||a.stop(),this.Sc(),this.wc()}wc(){this.Od+=1,this.Td=[],this.Ad=0,this.Ic=void 0,this.Ed=!1}Sc(){var t,e;null==(t=this.Mc)||t.stop(),this.Vh=[],null==(e=this.qh)||e.call(this),this.qh=void 0}Cc(){if(!this.Ic||0===this.Ad)return!1;if(this.Ed)return!0;this.Ed=!0;var t=this.Od;return this._c(),this.Sc(),this.Ic.catch((()=>{})).then((()=>{t===this.Od&&(this.Ed=!1,this.Vd(),this.Zd(),this.kc(),Ye.info("stopped"))})).catch((()=>{this.Ed=!1,this.kc(),Ye.info("stopped")})),!0}stop(){this.Cc()||(this.Vd(),this.Zd(),this.kc(),Ye.info("stopped"))}Wd(t){this.stop(),this.start("session_id_changed"),this.Jh=t,this.Qh=!1}vc(){this.isStarted||(this.Xh=!0),this.Jh&&(this.Jh=!1,this.Qh=!1,this.Kh&&(this.Kh=!1,this.xh()),this.Rc())}discard(){this.Zd(),this.kc(),Ye.info("discarded")}xc(t,e,r,i,n){var s={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};this.status!==Mt?(this.Tc(t,i),this.Ac(s)):this.Zd()}Oc(){var t,e=null==(t=rr())||null==t.getLastSnapshotCost?void 0:t.getLastSnapshotCost();e&&(this.$d&&this.$d.durationMs>=e.durationMs||(this.$d=e),500>e.durationMs||Ye.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(e.durationMs),stylesheetMs:Math.round(e.stylesheetMs),nodeCount:e.nodeCount,cssRuleCount:e.cssRuleCount,deferredStylesheetCount:e.deferredStylesheetCount}))}Tc(t,e){t.type!==h.FullSnapshot?t.type===h.IncrementalSnapshot&&(S(this.Cd)||this.Cd===e||this.Rd===e||(this.Rd=e,Ye.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.xh())):this.Cd=e}Ec(t){t.counted&&t.generation===this.Od&&(this.Ad=Math.max(0,this.Ad-1)),t.counted=!1,this.Td=this.Td.filter((e=>e!==t))}Fc(t,e,r){t.processed||t.generation!==this.Od||(t.processed=!0,this.xc(t.event,e,r,t.targetSessionId,t.targetWindowId))}Nc(t){try{var e=t.compressionEnabled?gr(t.event):{event:t.event,size:Zt(t.event)};this.Fc(t,e.event,e.size)}finally{this.Ec(t)}}Gd(){[...this.Td].forEach((t=>{this.Nc(t)}))}Lc(t,e,r,i){var n=this,s={event:t,compressionEnabled:e,targetSessionId:r,targetWindowId:i,generation:this.Od,processed:!1,counted:!0};this.Td.push(s),this.Ad+=1;var a=function(){var r=o((function*(){try{if(s.processed)return;var r,i;try{var a=e?vr(t)?yield function(t){return yr.apply(this,arguments)}(t):gr(t):{event:t,size:Zt(t)};r=a.event,i=a.size}catch(e){Ye.error("could not process queued compression event - will use uncompressed event",e),r=t,i=Zt(t)}n.Fc(s,r,i)}finally{n.Ec(s)}}));return function(){return r.apply(this,arguments)}}();this.Ic=this.Ic?this.Ic.catch((()=>{})).then(a):a()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.lc(),t&&_(t))){if(t.type===h.Meta){var u=this.nc(t.data.href);if(this.uc=u,!u)return;t.data.href=u}else this.oc();if(null==(e=this.Uh)||e.checkUrlTriggers(this.sessionId,(()=>this.fc()),(()=>this.mc()),((t,e)=>this.gc(t,e))),!this.dh.urlBlocked||(l=t).type===h.Custom&&"recording paused"===l.data.tag){var l,d,c,v;t.type===h.FullSnapshot&&(null!=(d=rr())&&null!=d.wasMaxDepthReached&&d.wasMaxDepthReached()&&(this._d=!0),this.Oc(),this.dc(),null==(c=this.Mc)||c.reset(),null==(v=this._instance.persistence)||v.register_once({[kt]:t.timestamp},void 0)),t.type===h.FullSnapshot&&null!=(r=this.Uh)&&r.hasPendingTriggers(this.sessionId)&&this.Dc();var f=this.Mc?this.Mc.throttleMutations(t):t;if(f){var p=function(t){var e=t;if(e&&_(e)&&6===e.type&&_(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]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(f),m=function(t){return kr(t)?t.data.payload:null}(p),g=function(t){return _r(t)?t.data.payload:null}(p);if(m||g){var y=null!=m?m:g;null!=y&&y.lastActivityTimestamp&&(p.timestamp=y.lastActivityTimestamp)}else this.Pc(p);t.type===h.FullSnapshot&&(this.Md.push([this.$r,t.timestamp]),this.Md.length>6&&(this.Md=this.Md.slice(-6)));var w=null!==(i=null!==(n=null==m?void 0:m.currentSessionId)&&void 0!==n?n:null==g?void 0:g.nextSessionId)&&void 0!==i?i:this.$r,b=null!==(s=null!==(a=null==m?void 0:m.currentWindowId)&&void 0!==a?a:null==g?void 0:g.nextWindowId)&&void 0!==s?s:this.Dr;if(!0!==this.Zh||function(t){return br(t)||kr(t)||_r(t)}(p)){if(br(p)){var k=p.data.payload;k&&(p.timestamp=k.lastActivityTimestamp+k.threshold)}var S=null===(o=this._instance.config.session_recording.compress_events)||void 0===o||o;if(this.Ad>0||S&&vr(p))this.Lc(p,S,w,b);else{var I=S?gr(p):{event:p,size:Zt(p)};this.xc(p,I.event,I.size,w,b)}}}}}}get status(){return this.Uh?this.Uh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Wh,rrwebError:this.Yh,urlTriggerMatching:this.dh,eventTriggerMatching:this.fh,linkedFlagMatching:this.ph,remoteConfig:this.Tl}):Mt}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.ph.linkedFlagSeen=!0,this.xh(),this.vc(),this.Rh("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[ft]:this.sessionId,[lt]:null}),this.xh(),this.vc(),this.Rh("sampling_overridden")}overrideTrigger(t){this.gc(t),this.vc()}$c(){try{var e,r=null==t||null==(e=t.location)?void 0:e.href;if(!r)return;var i=this.nc(r);if(!i)return;return new URL(i).hostname||void 0}catch(t){return}}_c(){this.Bc&&(clearTimeout(this.Bc),this.Bc=void 0)}Rc(){this.Bc||(this.Bc=setTimeout((()=>{this.Vd()}),2e3))}Vd(){var t;if(this._c(),this.Jh)return this.O;null==(t=this.Uh)||t.ensureSamplingDecision(this.sessionId);var e=this.jd();if(this.status===xt||this.status===Tt||this.status===Mt||e)return this.Rc(),this.O;if(this.O.data.length>0){var r,i=this.$c();Qt(this.O).forEach((t=>{var e;null==(e=this.Pd)||e.trackSize(t.sessionId,t.size),this.Wc({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:F.LIB_NAME,$lib_version:F.LIB_VERSION,$snapshot_host:i})})),null==(r=this.Uh)||r.onFlushComplete()}return this.Zd()}Ac(t){var e,r=2+((null==(e=this.O)?void 0:e.data.length)||0),i=t.$session_id,n=this.O.sessionId!==i;(n||!0!==this.Zh&&!this.Jh&&this.O.size+t.$snapshot_bytes+r>Ke)&&(this.O=this.Vd(),n&&this.O.data.length>0&&(this.O=this.Zd()),this.O.sessionId=i,this.O.windowId=t.$window_id),this.Jh&&(this.Kh||this.O.size+t.$snapshot_bytes+r>Ke)?this.Kh||(this.Kh=!0,this.O=this.Zd()):(this.O.size+=t.$snapshot_bytes,this.O.data.push(t.$snapshot_data),this.O.sizes.push(t.$snapshot_bytes),!0===this.Zh||this.Jh||this.Rc())}Wc(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.jh),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get qd(){var t,e,r=null==(t=this.O)?void 0:t.data[(null==(e=this.O)?void 0:e.data.length)-1],i=this.$h.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}Dc(){if(!this.O||0===this.O.data.length)return this.Zd();for(var t=-1,e=this.O.data.length-1;e>=0;e--)if(this.O.data[e].type===h.Meta){t=e;break}return 0>t?this.Zd():(this.O.data=this.O.data.slice(t),this.O.sizes=this.O.sizes.slice(t),this.O.size=this.O.sizes.reduce(((t,e)=>t+e),0),this.O)}Zd(){return this.O={size:0,data:[],sizes:[],sessionId:this.$r,windowId:this.Dr},this.O}Rh(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Ye.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Lh("$recording_started",u({reason:t},e))}zc(t){var e;return 3===t.type&&-1!==tr.indexOf(null==(e=t.data)?void 0:e.source)}Pc(t){var e=this.zc(t);e||!0===this.Zh||t.timestamp-this.Hh>this.Bh&&(this.Zh=!0,clearInterval(this.cc),this.Lh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Hh,threshold:this.Bh,bufferLength:this.O.data.length,bufferSize:this.O.size}),this.Vd());var r=!1;if(e&&(this.Hh=t.timestamp,this.Zh)){var i="unknown"===this.Zh;this.Zh=!1,i||(this.Lh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}var n=this.$h.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.$r!==a,u=this.Dr!==s;if(this.Dr=s,this.$r=a,o||u){var l=o&&!1!==this.Zh;l&&(this.Zh="unknown"),this.Wd(l)}else e&&this.vc(),r&&this.dc()}Bd(){var t;null==(t=this.Uh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,r,i,n,s,a,o=this.$h.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.O.data.length,$sdk_debug_replay_internal_buffer_size:this.O.size,$sdk_debug_current_session_duration:this.qd,$sdk_debug_session_start:o.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this.Pd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Md,$snapshot_max_depth_exceeded:this._d,$sdk_debug_replay_slowest_full_snapshot_ms:Ve(null==(e=this.$d)?void 0:e.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Ve(null==(r=this.$d)?void 0:r.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(i=this.$d)?void 0:i.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(n=this.$d)?void 0:n.cssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==(s=this.$d)?void 0:s.deferredStylesheetCount,$sdk_debug_replay_slowest_mutation_batch_ms:Ve(null==(a=rr())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_rrweb_error:this.Yh,$sdk_debug_rrweb_attached:!!this.qh,$sdk_debug_rrweb_start_attempted:this.kd}}bc(){var t;if(!this.qh){this.kd=!0;var e,r,i,n={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,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:void 0,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(var a of Object.entries(s||{})){var o=a[0],l=a[1];if(o in n)if("maskInputOptions"===o)n.maskInputOptions=u({password:!0},l);else if("sampling"===o){var h=null!=l?l:{},d={};S(h.mousemove)||(d.mousemove=h.mousemove),S(h.mouseInteraction)||(d.mouseInteraction=h.mouseInteraction),n.sampling=d}else n[o]=l}this.Yd&&this.Yd.enabled&&(n.recordCanvas=!0,n.sampling=u({},n.sampling,{canvas:this.Yd.fps}),n.dataURLOptions={type:"image/webp",quality:this.Yd.quality},n.canvasResolutionScale=this.Xd,n.canvasMasking={configured:()=>{var t;return k(null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn)},regionsFn:t=>{var e,r=null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn;if(k(r))try{var i;return null!==(i=r(t))&&void 0!==i?i:null}catch(t){return this.Id||(this.Id=!0,Ye.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.Qd&&(n.maskAllInputs=null===(e=this.Qd.maskAllInputs)||void 0===e||e,n.maskTextSelector=null!==(r=this.Qd.maskTextSelector)&&void 0!==r?r:void 0,n.blockSelector=null!==(i=this.Qd.blockSelector)&&void 0!==i?i:void 0),this.Kd();var c=ir();if(c){this.Mc=null!==(t=this.Mc)&&void 0!==t?t:new Fe(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Ye.info(r,{node:e}),this.log(Xe+" "+r,"warn")}});var v=this.rc();if(this.qh=c(u({emit:t=>{this.onRRwebEmit(t)},plugins:v},n)),!this.qh)return this.Yh=!0,void Ye.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.Yh=!1,this.Hh=Date.now(),this.Zh=x(this.Zh)?this.Zh:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Tl),this.Lh("$session_options",{sessionRecordingOptions:n,activePlugins:v.map((t=>null==t?void 0:t.name))}),this.Lh("$posthog_config",{config:this._instance.config})}else Ye.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.Lh(t,e)}}var Ir,Mr=["type"],Cr=Object.defineProperty,Rr=(t,e,r)=>((t,e,r)=>e in t?Cr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),xr=(t=>(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))(xr||{}),Tr=(t=>(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))(Tr||{}),Ar=(t=>(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))(Ar||{}),Or=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Or||{}),Er=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Er||{}),Fr=(t=>(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))(Fr||{}),Nr=(t=>(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))(Nr||{});function Lr(t,e){return-1!==t.indexOf(e)}var Dr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Pr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},$r={};function Br(t){if($r[t])return $r[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in Dr?Dr[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in Pr?Pr[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return $r[t]=e.prototype,e.prototype;var o=document.createElement("iframe");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?(Lr(u=navigator.userAgent,"AppleWebKit")&&!Lr(u,"Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),$r[t]=d):r}catch(t){return r}finally{!l&&o.parentNode&&document.body.removeChild(o)}}var Wr={};function zr(t,e,r){var i,n=t+"."+String(r);if(Wr[n])return Wr[n].call(e);var s=Br(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(Wr[n]=a,a.call(e)):e[r]}var Ur={};function jr(t,e,r){var i=t+"."+String(r);if(Ur[i])return Ur[i].bind(e);var n=Br(t)[r];return"function"!=typeof n?e[r]:(Ur[i]=n,n.bind(e))}function qr(){return Br("MutationObserver").constructor}function Hr(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t[e];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else t[e]=n.next}}catch(t){return()=>{}}}var Gr={childNodes:t=>zr("Node",t,"childNodes"),parentNode:t=>zr("Node",t,"parentNode"),parentElement:t=>zr("Node",t,"parentElement"),textContent:t=>zr("Node",t,"textContent"),contains:(t,e)=>jr("Node",t,"contains")(e),getRootNode:t=>jr("Node",t,"getRootNode")(),host:t=>t&&"host"in t?zr("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?zr("Element",t,"shadowRoot"):null,querySelector:(t,e)=>jr("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>jr("Element",t,"querySelectorAll")(e),mutationObserver:qr,patch:Hr},Vr=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,deferredStylesheetCount:0});function Zr(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var Jr=0,Qr=0,Kr=Vr(),Xr=null,Yr=null,ti=[],ei={slowestBatchMs:0},ri=t=>t&&t>0?t:null,ii=32;function ni(t,e,r){var i=t.length;if(r>=ii)return i;for(var n=0;t.length>n;n++){var s=t[n];try{var a=s.cssRules;if(a&&a.length)i+=ni(a,e,r+1);else if(e&&s.styleSheet){var o=s.styleSheet;if(!e.has(o)){e.add(o);var u=o.rules||o.cssRules;u&&(i+=ni(u,e,r+1))}}}catch(t){}}return i}function si(t){return 0!==Jr&&null!==Yr&&(Kr.cssRuleCount>=Yr||Kr.cssRuleCount+function(t){try{var e=t&&(t.rules||t.cssRules);if(!e)return 0;var r=new WeakSet;return r.add(t),ni(e,r,0)}catch(t){return 0}}(t)>Yr)}function ai(t){return t.nodeType===t.ELEMENT_NODE}function oi(t){var e=t&&"host"in t&&"mode"in t&&Gr.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Gr.shadowRoot(e)===t)}function ui(t){return"[object ShadowRoot]"==={}.toString.call(t)}var li=0;function hi(t){var e,r,i=0===li,n=i?Zr():0;li+=1;try{var s=t.rules||t.cssRules;if(!s)return null;!function(t){0!==Jr&&(Kr.cssRuleCount+=ni(t,null,0))}(s);var a=t.href;return!a&&t.ownerNode&&(a=t.ownerNode.baseURI),(r=Array.from(s,(t=>di(t,a))).join("")).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),r}catch(t){return null}finally{li-=1,i&&(e=Zr()-n,Jr>0&&(Kr.stylesheetMs+=e))}}function di(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=hi(t.styleSheet)||function(t){var e=t.cssText;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return ki(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),e?ki(n,e):n}class ci{constructor(){Rr(this,"idNodeMap",new Map),Rr(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-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){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),ai(t)){var r=Gr.shadowRoot(t);r&&this.removeNodeFromMap(r),"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){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function vi(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&fi(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function fi(t){return t.toLowerCase()}var pi="__rrweb_original__";function mi(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?fi(e):null}catch(t){return null}}var gi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,yi=/^(?:[a-z+]+:)?\/\//i,wi=/^www\..*/i,bi=/^(data:)([^,]*),(.*)/i;function ki(t,e){return(t||"").replace(gi,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(yi.test(u)||wi.test(u))return"url("+l+u+l+")";if(bi.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var _i,Si,Ii="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",Mi=4096,Ci=1e5,Ri=10,xi=new Map,Ti=1,Ai=new RegExp("[^a-z0-9-_:]"),Oi=-2;function Ei(){return Ti++}var Fi=/^[^ \t\n\r\u000c]+/,Ni=/^[, \t\n\r\u000c]+/,Li=new WeakMap;function Di(t,e){return e&&""!==e.trim()?Pi(t,e):e}function Pi(t,e){var r=Li.get(t);if(r||(r=t.createElement("a"),Li.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function $i(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?Ii:t}(t,e.maxBase64ImageLength):t}function Bi(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=Di(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(Ci>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>Mi||t.naturalHeight>Mi)return e;var n=xi.get(e);if(n&&n.type===r&&n.quality===i)return n.result;try{var s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;var a=s.getContext("2d");if(!a)return e;a.drawImage(t,0,0);var o=s.toDataURL(r||"image/webp",null!=i?i:.4),u=e.length>o.length?o:e;if(xi.size>=Ri){var l=xi.keys().next().value;void 0!==l&&xi.delete(l)}return xi.set(e,{type:r,quality:i,result:u}),u}catch(t){return e}}(n,u,s.type,s.quality)),$i(l,s)}if("image"===e)return $i(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=Di(t,i);return"image"===e&&h.startsWith("data:")?$i(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(Ni),e.length>r;){var s=i(Fi);if(","===s.slice(-1))s=Di(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=Di(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?ki(i,Pi(t)):"object"===e&&"data"===r?Di(t,i):i:Di(t,i)}function Wi(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function zi(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&zi(Gr.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&zi(Gr.parentNode(t),e,r)}function Ui(t,e,r,i){var n;if(ai(t)){if(!Gr.childNodes(n=t).length)return!1}else{if(null===Gr.parentElement(t))return!1;n=Gr.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(zi(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}function ji(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var qi=new Map;function Hi(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function Gi(t){return null==t?"":t.toLowerCase()}var Vi=50,Zi=!1,Ji=!1;function Qi(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,v=void 0===c?{}:c,f=e.maskTextFn,p=e.maskInputFn,m=e.slimDOMOptions,g=e.dataURLOptions,y=void 0===g?{}:g,w=e.inlineImages,b=void 0!==w&&w,k=e.recordCanvas,_=void 0!==k&&k,S=e.canvasMaskingConfigured,I=e.onSerialize,M=e.onIframeLoad,C=e.iframeLoadTimeout,R=void 0===C?5e3:C,x=e.onIframeListenerRegistered,T=e.onStylesheetLoad,A=e.stylesheetLoadTimeout,O=void 0===A?5e3:A,E=e.keepIframeSrcFn,F=void 0===E?()=>!1:E,N=e.newlyAddedElement,L=void 0!==N&&N,D=e.depth,P=void 0===D?0:D,B=e.maxDepth,W=void 0===B?Vi:B,z=e.needsMask,U=e.preserveWhiteSpace,j=void 0===U||U;if(P>=W)return Ji=!0,Zi||(Zi=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=Ui(t,a,o,void 0===z)),Jr>0&&(Kr.nodeCount+=1);var q,H=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.canvasMaskingConfigured,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Nr.Document,childNodes:[],compatMode:t.compatMode}:{type:Nr.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Nr.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,a=e.doc,o=e.inlineStylesheet,u=e.maskInputOptions,l=void 0===u?{}:u,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.canvasMaskingConfigured,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=e.rootId,b=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,e.blockClass,e.blockSelector),k=function(t){if(t instanceof HTMLFormElement)return"form";var e=fi(t.tagName);return Ai.test(e)?"div":e}(t),_={},S=t.attributes.length,I=0;S>I;I++){var M=t.attributes[I];Wi(k,M.name)||(_[M.name]=Bi(a,k,fi(M.name),M.value,t,c))}if("link"===k&&o&&!b){var C=t.sheet;if(!C){var R=function(t){return t.href}(t);R&&!(C=Hi(a,R))&&R.includes(".css")&&(C=Hi(a,window.location.origin+"/"+R.replace(window.location.href,"")))}var x=null;C&&(si(C)?Jr>0&&ti.push(t):x=hi(C)),x&&(delete _.rel,delete _.href,_._cssText=x)}var T;if("style"===k&&t.sheet&&!(t.innerText||Gr.textContent(t)||"").trim().length){var A=hi(t.sheet);A&&(_._cssText=A)}if("input"===k||"textarea"===k||"select"===k){var O=t.value,E=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&O?_.value=vi({element:t,type:mi(t),tagName:k,value:O,maskInputOptions:l,maskInputFn:h}):E&&(_.checked=E)}if("option"===k&&(t.selected&&!l.select?_.selected=!0:delete _.selected),"dialog"===k&&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}if("canvas"===k&&f&&!(null==p?void 0:p()))if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((pi in n?n[pi]:n).call(e,r,i,Math.min(50,t.width-r),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)){var F=t.toDataURL(c.type,c.quality),N=a.createElement("canvas");N.width=t.width,N.height=t.height,F!==N.toDataURL(c.type,c.quality)&&(_.rr_dataURL=F)}if("img"===k&&v){_i||(_i=a.createElement("canvas"),Si=_i.getContext("2d"));var L=t,D=L.currentSrc||L.getAttribute("src")||"<unknown-src>",P=L.crossOrigin,B=()=>{ji(L,"load",B);try{_i.width=L.naturalWidth,_i.height=L.naturalHeight,Si.drawImage(L,0,0),_.rr_dataURL=_i.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==L.crossOrigin)return L.crossOrigin="anonymous",void(L.complete&&0!==L.naturalWidth?B():L.addEventListener("load",B));console.warn("Cannot inline img src="+D+"! Error: "+t)}"anonymous"===L.crossOrigin&&(P?_.crossOrigin=P:L.removeAttribute("crossorigin"))};L.complete&&0!==L.naturalWidth?B():L.addEventListener("load",B)}if("audio"===k||"video"===k){var W=_;W.rr_mediaState=t.paused?"paused":"played",W.rr_mediaCurrentTime=t.currentTime,W.rr_mediaPlaybackRate=t.playbackRate,W.rr_mediaMuted=t.muted,W.rr_mediaLoop=t.loop,W.rr_mediaVolume=t.volume}if(y||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),b){var z=t.getBoundingClientRect(),U=z.width,j=z.height,q=z.left,H=z.top,G=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);_={class:_.class,rr_width:U+"px",rr_height:j+"px",rr_left:Math.floor(q+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(H+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},G&&(_.rr_position=G.position||"static",G.transform&&"none"!==G.transform&&(_.rr_transform=G.transform),G.display&&G.display.startsWith("inline")&&(_.rr_display=G.display))}"iframe"!==k||m(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src);try{customElements.get(k)&&(s=!0)}catch(t){}return{type:Nr.Element,tagName:k,attributes:_,childNodes:[],isSVG:(T=t,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:b,rootId:w,isCustom:s}}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:c,inlineImages:v,recordCanvas:f,canvasMaskingConfigured:p,keepIframeSrcFn:m,newlyAddedElement:y,rootId:w});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=Gr.parentNode(t),o=a&&a.tagName,u=Gr.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(si(a.sheet));else if(null==(r=a.sheet)?void 0:r.cssRules){var d=hi(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=ki(u,Pi(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,Gr.parentElement(t)):u.replace(/[\S]/g,"*")),{type:Nr.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:w});case t.CDATA_SECTION_NODE:return{type:Nr.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:Nr.Comment,textContent:Gr.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,keepIframeSrcFn:F,newlyAddedElement:L});if(!H)return console.warn(t,"not serialized"),null;q=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===Nr.Comment)return!0;if(t.type===Nr.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,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Gi(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Gi(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Gi(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Gi(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Gi(t.attributes.property).match(/^(og|twitter|fb):/)||Gi(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Gi(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Gi(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(Gi(t.attributes.name))||Gi(t.attributes.property).match(/^article:/)||Gi(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(Gi(t.attributes.name)))return!0}}return!1}(H,m)||!j&&H.type===Nr.Text&&!H.isStyle&&!H.textContent.replace(/^\s+|\s+$/gm,"").length?Oi:Ei();var G=Object.assign(H,{id:q});if(i.add(t,G),q===Oi)return null;I&&I(t);var V=!l;if(G.type===Nr.Element){V=V&&!G.needBlock,delete G.needBlock;var Z=Gr.shadowRoot(t);Z&&ui(Z)&&(G.isShadowHost=!0)}if((G.type===Nr.Document||G.type===Nr.Element)&&V){m.headWhitespace&&G.type===Nr.Element&&"head"===G.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:M,iframeLoadTimeout:R,onIframeListenerRegistered:x,onStylesheetLoad:T,stylesheetLoadTimeout:O,keepIframeSrcFn:F,depth:P+1,maxDepth:W};if(G.type===Nr.Element&&"textarea"===G.tagName&&void 0!==G.attributes.value);else for(var Q of Array.from(Gr.childNodes(t))){var K=Qi(Q,J);K&&G.childNodes.push(K)}var X=null;if(ai(t)&&(X=Gr.shadowRoot(t)))for(var Y of Array.from(Gr.childNodes(X))){var tt=Qi(Y,J);tt&&(ui(X)&&(tt.isShadow=!0),G.childNodes.push(tt))}}var et=Gr.parentNode(t);if(et&&oi(et)&&ui(et)&&(G.isShadow=!0),G.type===Nr.Element&&"iframe"===G.tagName){var rt=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),ji(t,"load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?ji(t,"load",a):(o=!0,ji(t,"load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),ji(t,"load",a)}}return t.addEventListener("load",a),()=>{ji(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&M){var r=Qi(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:M,iframeLoadTimeout:R,onIframeListenerRegistered:x,onStylesheetLoad:T,stylesheetLoadTimeout:O,keepIframeSrcFn:F,depth:P+1,maxDepth:W});r&&M(t,r)}}),R);null==x||x(t,rt)}return G.type===Nr.Element&&"link"===G.tagName&&"stylesheet"===G.attributes.rel&&function(e,u,l){if(!qi.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,g=!1,w=()=>{if(!g){g=!0;try{(()=>{if(T){var e=Qi(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:M,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:O,keepIframeSrcFn:F,depth:P,maxDepth:W});e&&T(t,e)}})()}finally{qi.delete(e),c.abort()}}},k=setTimeout(w,l);c.signal.addEventListener("abort",(()=>clearTimeout(k)),{once:!0}),e.addEventListener("load",w,{signal:c.signal,once:!0}),qi.set(e,c)}}}(t,0,O),G}function Ki(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}class Xi{constructor(){Rr(this,"parentElement",null),Rr(this,"parentNode",null),Rr(this,"ownerDocument"),Rr(this,"firstChild",null),Rr(this,"lastChild",null),Rr(this,"previousSibling",null),Rr(this,"nextSibling",null),Rr(this,"ELEMENT_NODE",1),Rr(this,"TEXT_NODE",3),Rr(this,"nodeType"),Rr(this,"nodeName"),Rr(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof Xi))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.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 Yi(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>tn(r,t,e,i)}function tn(t,e,r,i){en((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function en(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var rn="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.",nn={map:{},getId(){return console.error(rn),-1},getNode(){return console.error(rn),null},removeNodeFromMap(){console.error(rn)},has(){return console.error(rn),!1},reset(){console.error(rn)}};function sn(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function an(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){if(setTimeout((()=>{try{r.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)}}}),()=>an(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(nn=new Proxy(nn,{get(t,e,r){return"map"===e&&console.error(rn),Reflect.get(t,e,r)}}));var on=Date.now;function un(t){var e,r,i,n,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=Gr.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.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=Gr.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function ln(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function hn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function dn(t){return t?t.nodeType===t.ELEMENT_NODE?t:Gr.parentElement(t):null}function cn(t,e,r,i){if(!t)return!1;var n=dn(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(zi(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function vn(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===Oi}function fn(t,e){if(oi(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=Gr.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||fn(i,e))}function pn(t){return Boolean(t.changedTouches)}function mn(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function gn(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function yn(t){return!!t&&(t instanceof Xi&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Gr.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(on=()=>(new Date).getTime());class wn{constructor(){Rr(this,"id",1),Rr(this,"styleIDMap",new WeakMap),Rr(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){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}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 bn(t){var e,r=null;return"getRootNode"in t&&(null==(e=Gr.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Gr.host(Gr.getRootNode(t))&&(r=Gr.host(Gr.getRootNode(t))),r}function kn(t){var e=t.ownerDocument;return!!e&&(Gr.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=bn(r);)r=e;return r}(t);return Gr.contains(e,r)}(t))}function _n(t){return"__ln"in t}class Sn{constructor(){Rr(this,"length",0),Rr(this,"head",null),Rr(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&_n(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&_n(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.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){var 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--)}}var In,Mn=(t,e)=>t+"@"+e;class Cn{constructor(){Rr(this,"frozen",!1),Rr(this,"locked",!1),Rr(this,"texts",[]),Rr(this,"attributes",[]),Rr(this,"attributeMap",new WeakMap),Rr(this,"removes",[]),Rr(this,"mapRemoves",[]),Rr(this,"movedMap",{}),Rr(this,"addedSet",new Set),Rr(this,"movedSet",new Set),Rr(this,"droppedSet",new Set),Rr(this,"removesSubTreeCache",new Set),Rr(this,"mutationCb"),Rr(this,"blockClass"),Rr(this,"blockSelector"),Rr(this,"maskTextClass"),Rr(this,"maskTextSelector"),Rr(this,"inlineStylesheet"),Rr(this,"maskInputOptions"),Rr(this,"maskTextFn"),Rr(this,"maskInputFn"),Rr(this,"keepIframeSrcFn"),Rr(this,"recordCanvas"),Rr(this,"canvasMaskingConfigured"),Rr(this,"inlineImages"),Rr(this,"slimDOMOptions"),Rr(this,"dataURLOptions"),Rr(this,"doc"),Rr(this,"mirror"),Rr(this,"iframeManager"),Rr(this,"stylesheetManager"),Rr(this,"shadowDomManager"),Rr(this,"canvasManager"),Rr(this,"processedNodeManager"),Rr(this,"unattachedDoc"),Rr(this,"canvasManagerReleased",!1),Rr(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),Rr(this,"emit",(()=>{if(!this.frozen&&!this.locked){var t,e=Zr();try{this.processBufferedMutations()}finally{(t=Zr()-e)>ei.slowestBatchMs&&(ei.slowestBatchMs=t)}}})),Rr(this,"processBufferedMutations",(()=>{for(var t=[],e=new Set,r=new Sn,i=t=>{for(var e=t,r=Oi;r===Oi;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=Gr.parentNode(n);if(s&&kn(n)&&"TEXTAREA"!==s.tagName){var a=oi(s)?this.mirror.getId(bn(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=Qi(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{mn(t,this.mirror)&&this.iframeManager.addIframe(t),gn(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),yn(n)&&this.shadowDomManager.addShadowRoot(Gr.shadowRoot(n),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)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)xn(this.removesSubTreeCache,s)&&!this.movedSet.has(Gr.parentNode(s))||n(s);for(var a of this.addedSet)Tn(this.droppedSet,a)||xn(this.removesSubTreeCache,a)?Tn(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(Gr.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var v=this.mirror.getId(Gr.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=Gr.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=Gr.host(f);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var m={texts:this.texts.map((t=>{var e=t.node,r=Gr.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var e=t.attributes;if("string"==typeof e.style){var r=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>r.length&&(r+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}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};(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(m))})),Rr(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),Rr(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(Gr.childNodes(t),(t=>Gr.textContent(t)||"")).join("");e.attributes.value=vi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:mi(t),value:r,maskInputFn:this.maskInputFn})})),Rr(this,"processMutation",(t=>{if(!vn(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=Gr.textContent(t.target);cn(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Ui(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,dn(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break;case"attributes":var r=t.target,i=t.attributeName,n=t.target.getAttribute(i);if("value"===i){var s=mi(r);n=vi({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(cn(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;var a=this.attributeMap.get(t.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(a||(this.attributes.push(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===r.tagName&&"password"===(t.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!Wi(r.tagName,i))if(a.attributes[i]=Bi(this.doc,fi(r.tagName),fi(i),n,r,this.dataURLOptions),"style"===i){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var u of(t.oldValue&&(o.style.cssText=t.oldValue),Array.from(r.style))){var l=r.style.getPropertyValue(u),h=r.style.getPropertyPriority(u);l!==o.style.getPropertyValue(u)||h!==o.style.getPropertyPriority(u)?a.styleDiff[u]=""===h?l:[l,h]:a._unchangedStyles[u]=[l,h]}for(var d of Array.from(o.style))""===r.style.getPropertyValue(d)&&(a.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(cn(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=>{var r=this.mirror.getId(e),i=oi(t.target)?this.mirror.getId(Gr.host(t.target)):this.mirror.getId(t.target);cn(t.target,this.blockClass,this.blockSelector,!1)||vn(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Rn(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||fn(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Mn(r,i)]?Rn(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!oi(t.target)||!ui(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),Gr.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),Rr(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(vn(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Mn(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);cn(t,this.blockClass,this.blockSelector,!1)||(Gr.childNodes(t).forEach((t=>this.genAdds(t))),yn(t)&&Gr.childNodes(Gr.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","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(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function Rn(t,e){t.delete(e),Gr.childNodes(e).forEach((e=>Rn(t,e)))}function xn(t,e,r){return 0!==t.size&&function(t,e,r){var i=Gr.parentNode(e);return!!i&&t.has(i)}(t,e)}function Tn(t,e){return 0!==t.size&&An(t,e)}function An(t,e){var r=Gr.parentNode(e);return!!r&&(!!t.has(r)||An(t,r))}var On=t=>In?function(){try{return t(...arguments)}catch(t){if(In&&!0===In(t))return;throw t}}:t,En=[];function Fn(t){try{if("composedPath"in t){var 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 Nn(t,e){var r=new Cn;En.push(r),r.init(t);var i=new(qr())(On(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),i.observe(e,n),{observer:i,buffer:r}}function Ln(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=Fn(t);if(a&&!cn(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=un(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[Yi("scroll",On(sn(On((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(Yi("scrollend",On(u),r)),()=>l.forEach((t=>t()))}function Dn(t,e){for(var r=En.length-1;r>=0;r--){var i=En[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),En.splice(r,1))}}}var Pn=["INPUT","TEXTAREA","SELECT"],$n=new WeakMap;function Bn(t){return function t(e,r){if(jn("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||jn("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||jn("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||jn("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function Wn(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function zn(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:Gr.host(e));var o="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),On((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function Un(t,e){void 0===e&&(e={});var r,i,n=t.doc.defaultView;if(!n)return()=>{};if(function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e),t.recordDOM){var s=Nn(t,t.doc);r=s.observer,i=s.buffer}var a,o,l,h,d,c,v,f,p,m=function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,u=[],l=sn(On((t=>{var r=Date.now()-s;e(u.map((t=>(t.timeOffset-=r,t))),t),u=[],s=null})),o),h=On(sn(On((t=>{var e=Fn(t),r=pn(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=on()),u.push({x:i,y:a,id:n.getId(e),timeOffset:on()-s}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?Tr.Drag:t instanceof MouseEvent?Tr.MouseMove:Tr.TouchMove)})),a,{trailing:!1})),d=[Yi("mousemove",h,i),Yi("touchmove",h,i),Yi("drag",h,i)];return On((()=>{d.forEach((t=>t()))}))}(t),g=function(t){var e=t.mouseInteractionCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling;if(!1===a.mouseInteraction)return()=>{};var o=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,l=[],h=null;return Object.keys(Ar).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t])).forEach((t=>{var a=fi(t),o=(t=>r=>{var a=Fn(r);if(!cn(a,n,s,!0)){var o=null,l=t;if("pointerType"in r){switch(r.pointerType){case"mouse":o=Or.Mouse;break;case"touch":o=Or.Touch;break;case"pen":o=Or.Pen}o===Or.Touch&&(Ar[t]===Ar.MouseDown?l="TouchStart":Ar[t]===Ar.MouseUp&&(l="TouchEnd"))}else pn(r)&&(o=Or.Touch);null!==o?(h=o,(l.startsWith("Touch")&&o===Or.Touch||l.startsWith("Mouse")&&o===Or.Mouse)&&(o=null)):Ar[t]===Ar.Click&&(o=h,h=null);var d=pn(r)?r.changedTouches[0]:r;if(d){var c=i.getId(a),v=d.clientX,f=d.clientY;On(e)(u({type:Ar[l],id:c,x:v,y:f},null!==o&&{pointerType:o}))}}})(t);if(window.PointerEvent)switch(Ar[t]){case Ar.MouseDown:case Ar.MouseUp:a=a.replace("mouse","pointer");break;case Ar.TouchStart:case Ar.TouchEnd:return}l.push(Yi(a,o,r))})),On((()=>{l.forEach((t=>t()))}))}(t),y=Ln(t),w=function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return Yi("resize",On(sn(On((()=>{var t=ln(),e=hn();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:n}),b=function(t){var e=t.inputCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.ignoreClass,o=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=Fn(t),i=t.isTrusted,u=r.defaultView;if(!e||!u||e instanceof u.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=Gr.parentElement(e)),e&&c&&Pn.indexOf(c)>=0&&!cn(e,n,s,!0)&&!(e.classList.contains(a)||o&&e.matches(o))){var f=e.value,p=!1,m=mi(e)||"";"radio"===m||"checkbox"===m?p=e.checked:(l[c.toLowerCase()]||l[m])&&(f=vi({element:e,maskInputOptions:l,tagName:c,type:m,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:i}:{text:f,isChecked:p});var g=e.name;"radio"===m&&g&&p&&r.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,r){var n=$n.get(t);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){$n.set(t,r);var s=i.getId(t);On(e)(u({},r,{id:s}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>Yi(t,On(c),r))),p=r.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&f.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=>an(t[0],t[1],{set(){On(c)({target:this,isTrusted:!1})}},!1,p)))),On((()=>{f.forEach((t=>t()))}))}(t),k=(o=(a=t).mediaInteractionCb,l=a.blockClass,h=a.blockSelector,d=a.mirror,c=a.sampling,v=a.doc,f=On((t=>sn(On((e=>{var r=Fn(e);if(r&&!cn(r,l,h,!0)){var i=r.currentTime,n=r.volume,s=r.muted,a=r.playbackRate,u=r.loop;o({type:t,id:d.getId(r),currentTime:i,volume:n,muted:s,playbackRate:a,loop:u})}})),c.media||500))),p=[Yi("play",f(Fr.Play),v),Yi("pause",f(Fr.Pause),v),Yi("seeked",f(Fr.Seeked),v),Yi("volumechange",f(Fr.VolumeChange),v),Yi("ratechange",f(Fr.RateChange),v)],On((()=>{p.forEach((t=>t()))}))),_=()=>{},S=()=>{},I=()=>{},M=()=>{};t.recordDOM&&(_=function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:On(((t,e,s)=>{var a=s[0],o=s[1],u=Wn(e,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:o}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var o,u,l=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:a}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replaceSync:a}),t.apply(e,s)}))}));var h={};qn("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(qn("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),qn("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),qn("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var e=t[0],s=t[1];d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:On(((t,e,s)=>{var a=s[0],o=s[1],u=Wn(e.parentStyleSheet,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:[...Bn(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e.parentStyleSheet,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:[...Bn(e),a]}]}),t.apply(e,s)}))})})),On((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=l,o&&(s.CSSStyleSheet.prototype.replace=o),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(h).forEach((t=>{var e=t[0],r=t[1];r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:n}),S=zn(t,t.doc),I=function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:On(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2];if(n.has(l))return o.apply(e,[l,h,d]);var c=Wn(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror),v=c.id,f=c.styleId;return(v&&-1!==v||f&&-1!==f)&&r({id:v,styleId:f,set:{property:l,value:h,priority:d},index:Bn(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:On(((t,e,a)=>{var o,l=a[0];if(n.has(l))return u.apply(e,[l]);var h=Wn(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror),d=h.id,c=h.styleId;return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:l},index:Bn(e.parentRule)}),t.apply(e,a)}))}),On((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:n}),t.collectFonts&&(M=function(t){var e=t.fontCb,r=t.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=Hr(r.fonts,"add",(function(t){return function(r){return setTimeout(On((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),On((()=>{n.forEach((t=>t()))}))}(t)));var C=function(t){var e=t.doc,r=t.mirror,i=t.blockClass,n=t.blockSelector,s=t.selectionCb,a=!0,o=On((()=>{var t=e.getSelection();if(!(!t||a&&(null==t?void 0:t.isCollapsed))){a=t.isCollapsed||!1;for(var o=[],u=t.rangeCount||0,l=0;u>l;l++){var h=t.getRangeAt(l),d=h.startContainer,c=h.startOffset,v=h.endContainer,f=h.endOffset;cn(d,i,n,!0)||cn(v,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(v),endOffset:f})}s({ranges:o})}}));return o(),Yi("selectionchange",o)}(t),R=function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?Hr(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t),x=[];for(var T of t.plugins)x.push(T.observer(T.callback,n,T.options));return On((()=>{if(i){i.destroy(),i.reset();var e=En.indexOf(i);-1!==e&&En.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect(),m(),g(),y(),w(),b(),k(),_(),S(),I(),M(),C(),R(),x.forEach((t=>t()))}))}function jn(t){return void 0!==window[t]}function qn(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class Hn{constructor(t){Rr(this,"iframeIdToRemoteIdMap",new WeakMap),Rr(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){var n=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=n.get(e);return a||(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i=r||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:i.get(e)||-1}getRemoteIds(t,e){var r=this.getRemoteIdToIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){var e=this.iframeIdToRemoteIdMap.get(t);return e||this.iframeIdToRemoteIdMap.set(t,e=new Map),e}getRemoteIdToIdMap(t){var e=this.iframeRemoteIdToIdMap.get(t);return e||this.iframeRemoteIdToIdMap.set(t,e=new Map),e}}class Gn{constructor(t){Rr(this,"iframes",new WeakMap),Rr(this,"crossOriginIframeMap",new WeakMap),Rr(this,"crossOriginIframeMirror",new Hn(Ei)),Rr(this,"crossOriginIframeStyleMirror"),Rr(this,"crossOriginIframeRootIdMap",new WeakMap),Rr(this,"mirror"),Rr(this,"mutationCb"),Rr(this,"wrappedEmit"),Rr(this,"loadListener"),Rr(this,"pageHideListener"),Rr(this,"stylesheetManager"),Rr(this,"recordCrossOriginIframes"),Rr(this,"messageHandler"),Rr(this,"nestedIframeListeners",new Map),Rr(this,"attachedWindows",new WeakMap),Rr(this,"attachedDocuments",new WeakMap),Rr(this,"attachedIframes",new Map),Rr(this,"loadListenerDisposers",new WeakMap),Rr(this,"iframeElementsById",new Map),Rr(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hn(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){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>en(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{tn(t.win,"pagehide",t.handler)})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);en((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}en((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.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){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case xr.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:xr.IncrementalSnapshot,data:{source:Tr.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case xr.Meta:case xr.Load:case xr.DomContentLoaded:return!1;case xr.Plugin:return e;case xr.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case xr.IncrementalSnapshot:switch(e.data.source){case Tr.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),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 Tr.Drag:case Tr.TouchMove:case Tr.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case Tr.ViewportResize:return!1;case Tr.MediaInteraction:case Tr.MouseInteraction:case Tr.Scroll:case Tr.CanvasMutation:case Tr.Input:return this.replaceIds(e.data,t,["id"]),e;case Tr.StyleSheetRule:case Tr.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Tr.Font:return e;case Tr.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case Tr.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}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===Nr.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(tn(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(tn(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{en((()=>this.mirror.removeNodeFromMap(t)))})),en((()=>Dn(r,s))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var r=t.content;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&tn(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{tn(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),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}}class Vn{constructor(t){Rr(this,"shadowDoms",new WeakSet),Rr(this,"mutationCb"),Rr(this,"scrollCb"),Rr(this,"bypassOptions"),Rr(this,"mirror"),Rr(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 r,i;if(ui(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var n=null!==(r=null==(i=Gr.host(t))?void 0:i.ownerDocument)&&void 0!==r?r:e,s=Nn(u({},this.bypassOptions,{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),a=s.observer,o=s.buffer;this.restoreHandlers.push({doc:n,handler(){a.disconnect(),o.destroy(),o.releaseCanvasManager();var t=En.indexOf(o);-1!==t&&En.splice(t,1)}}),this.restoreHandlers.push({doc:n,handler:Ln(u({},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(Gr.host(t))),this.restoreHandlers.push({doc:n,handler:zn({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){var r=this;this.restoreHandlers.push({doc:e,handler:Hr(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=Gr.shadowRoot(this);return s&&kn(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}var Zn="skip-frame";function Jn(t){if("object"!=typeof t||null===t)return!1;var e=t.y,r=t.width,i=t.height;return Number.isFinite(t.x)&&Number.isFinite(e)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var Qn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Xn=0;64>Xn;Xn++)Kn[Qn.charCodeAt(Xn)]=Xn;var Yn=new Map,ts=(t,e,r)=>{if(t&&(is(t,e)||"object"==typeof t)){var i=function(t,e){var r=Yn.get(t);return r||Yn.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function es(t,e,r,i){if(t instanceof Array)return t.map((t=>es(t,e,r,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){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=Qn[r[e]>>2],n+=Qn[(3&r[e])<<4|r[e+1]>>4],n+=Qn[(15&r[e+1])<<2|r[e+2]>>6],n+=Qn[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}return t instanceof DataView?{rr_type:t.constructor.name,args:[es(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[es(t.data,e,r,i),t.width,t.height]}:is(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ts(t,e,r)}:t}var rs=(t,e,r,i)=>t.map((t=>es(t,e,r,i))),is=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},ns=["webgl","webgl2"];function ss(t){return"nodeType"in t}function as(t,e,r,i){var n=[];try{if(i){var s=function(t,e,r){var i=t.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return Hr(i.prototype,"configure",(function(i){return function(n){var s=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!s||ss(s)&&cn(s,e,r,!0))return i.call(this,n);ss(s)&&!("__context"in s)&&(s.__context="webgpu");var a=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return i.call(this,null!==a&&n?u({},n,{usage:"number"==typeof n.usage?n.usage|a:a}):n)}}))}(t,e,r);s&&n.push(s)}var a=Hr(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(n){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(n),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!cn(this,e,r,!0)&&("__context"in this||(this.__context=s),i&&ns.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[n,...o])}}));n.push(a)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((t=>t()))}}function os(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=Hr(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(ts(d,s,this),"tagName"in this.canvas&&!cn(this.canvas,i,n,!0)){var c=rs(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=an(t,u,{set(t){r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var us,ls,hs,ds='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n',cs="undefined"!=typeof self&&self.Blob&&new Blob([ds],{type:"text/javascript;charset=utf-8"});function vs(t){var e;try{if(!(e=cs&&(self.URL||self.webkitURL).createObjectURL(cs)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(ds),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class fs{constructor(t){Rr(this,"pendingCanvasMutations",new Map),Rr(this,"rafStamps",{latestId:0,invokeId:null}),Rr(this,"mirror"),Rr(this,"mutationCb"),Rr(this,"resetObservers"),Rr(this,"frozen",!1),Rr(this,"locked",!1),Rr(this,"rafIdTimestamp",null),Rr(this,"rafIdFlush",null),Rr(this,"refCount",0),Rr(this,"torndown",!1),Rr(this,"resetFrameDedup",null),Rr(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)}));var e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,a=t.recordCanvas,o=t.dataURLOptions,u=t.resolutionScale,l=t.canvasMasking;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&"all"===r&&this.initCanvasMutationObserver(i,n,s,o),a&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:o,resolutionScale:u,canvasMasking:l})}onFullSnapshot(){var t;null==(t=this.resetFrameDedup)||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}initCanvasFPSObserver(t,e,r,i,n){var s=this;if("OffscreenCanvas"in e){var a,u="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,l=as(e,r,i,!0),h=new Map;try{a=new vs}catch(t){return}var d=!1;a.onerror=()=>{var t;d=!0,cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a),this.resetFrameDedup=null},this.resetFrameDedup=()=>{a.postMessage({resetFrameDedup:!0})},a.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:Er["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var c,v=1e3/t,f=0,p=t=>{var l,m;d||(f&&v>t-f||(f=t,(l=[],m=t=>{try{t.querySelectorAll("canvas").forEach((t=>{cn(t,r,i,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&m(t.shadowRoot)}))}catch(t){}},m(e.document),l).forEach(function(){var t=o((function*(t){var e,r,i=s.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var o=t.getContext(t.__context);if(null==(e=null==o?void 0:o.isContextLost)?void 0:e.call(o))return void h.set(i,!1);!1===(null==(r=null==o?void 0:o.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=function(t,e,r,i,n,s){if(t&&"function"==typeof t.regionsFn){var a;try{a=t.regionsFn(e)}catch(t){return Zn}if(void 0!==a){if(!Array.isArray(a)||!a.every(Jn))return Zn;var o=r/n,u=i/s;return a.filter((t=>t.width>0&&t.height>0)).map((t=>{var e=Math.floor(t.x*o),r=Math.floor(t.y*u);return{x:e,y:r,width:Math.ceil((t.x+t.width)*o)-e,height:Math.ceil((t.y+t.height)*u)-r}}))}}}(n.canvasMasking,t,c,v,l,d);if(f===Zn)return void h.set(i,!1);var p=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});a.postMessage({id:i,bitmap:p,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:n.dataURLOptions,maskRegions:f},[p])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),c=requestAnimationFrame(p))};c=requestAnimationFrame(p),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a),this.resetFrameDedup=null}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=as(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=Hr(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return cn(this.canvas,r,i,!0)||setTimeout((()=>{var r=rs(u,e,this,n);t(this.canvas,{type:Er["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(r){var u=an(e.CanvasRenderingContext2D.prototype,a,{set(e){t(this.canvas,{type:Er["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...os(e.WebGLRenderingContext.prototype,Er.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...os(e.WebGL2RenderingContext.prototype,Er.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,Mr)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class ps{constructor(t){Rr(this,"trackedLinkElements",new WeakSet),Rr(this,"mutationCb"),Rr(this,"adoptedStyleSheetCb"),Rr(this,"styleMirror",new wn),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}inlineDeferredLinkElement(t,e){if(-1!==e&&t.isConnected){var r=null;try{var i=t.sheet;i&&(r=hi(i))}catch(t){}r&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:r}}]})}}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;r.styleMirror.has(t)?e=r.styleMirror.getId(t):(e=r.styleMirror.add(t),n.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:di(e,t.href),index:r})))})),i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,qi.forEach((t=>t.abort())),qi.clear()}trackStylesheetInLinkElement(t){}}class ms{constructor(){Rr(this,"nodeMap",new WeakMap),Rr(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).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(){}}var gs=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var ys=document.createElement("iframe");document.body.appendChild(ys),Array.from=(null==(Ir=ys.contentWindow)?void 0:Ir.Array.from)||Array.from,document.body.removeChild(ys)}}catch(t){console.debug("Unable to override Array.from",t)}var ws=new ci,bs=new Set([Tr.Mutation,Tr.MediaInteraction,Tr.StyleSheetRule,Tr.CanvasMutation,Tr.Font,Tr.Log,Tr.StyleDeclaration,Tr.AdoptedStyleSheet]);function ks(t){var e=window;if("function"==typeof e.requestIdleCallback){var r=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null==(t=e.cancelIdleCallback)?void 0:t.call(e,r)}}}var i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function _s(t){var e;void 0===t&&(t={});var r=t,i=r.emit,n=r.checkoutEveryNms,s=r.checkoutEveryNth,a=r.blockClass,o=void 0===a?"rr-block":a,l=r.blockSelector,h=void 0===l?null:l,d=r.ignoreClass,c=void 0===d?"rr-ignore":d,v=r.ignoreSelector,f=void 0===v?null:v,p=r.maskTextClass,m=void 0===p?"rr-mask":p,g=r.maskTextSelector,y=void 0===g?null:g,w=r.inlineStylesheet,b=void 0===w||w,k=r.inlineStylesheetBudgetRules,_=void 0===k?1e4:k,S=r.maskAllInputs,I=r.maskInputOptions,M=r.slimDOMOptions,C=r.maskInputFn,R=r.maskTextFn,x=r.hooks,T=r.packFn,A=r.sampling,O=void 0===A?{}:A,E=r.dataURLOptions,F=void 0===E?{}:E,N=r.canvasResolutionScale,L=r.canvasMasking,D=r.mousemoveWait,P=r.recordDOM,B=void 0===P||P,W=r.recordCanvas,z=void 0!==W&&W,U=r.recordCrossOriginIframes,j=void 0!==U&&U,q=r.recordAfter,H=void 0===q?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":q,G=r.userTriggeredOnInput,V=void 0!==G&&G,Z=r.collectFonts,J=void 0!==Z&&Z,Q=r.inlineImages,K=void 0!==Q&&Q,X=r.plugins,Y=r.keepIframeSrcFn,tt=void 0===Y?()=>!1:Y,et=r.ignoreCSSAttributes,rt=void 0===et?new Set([]):et,it=r.attributeFilter;In=r.errorHandler;var nt=u({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},F),st=!j||window.parent===window,at=!1;if(!st)try{window.parent.document&&(at=!1)}catch(t){at=!0}if(st&&!i)throw new Error("emit function is required");if(!st&&!at)return()=>{};void 0!==D&&void 0===O.mousemove&&(O.mousemove=D),ws.reset();var ot,ut=!0===S?{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!==I?I:{password:!0},lt=Ki(void 0!==M&&M);!function(t){void 0===t&&(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)}();var ht,dt,ct=0,vt=new Map,ft=t=>{for(var e of X||[])e.eventProcessor&&(t=e.eventProcessor(t));return T&&!at&&(t=T(t)),t};us=(t,e)=>{var r,a=t;if(a.timestamp=on(),!(null==(r=En[0])?void 0:r.isFrozen())||a.type===xr.FullSnapshot||a.type===xr.IncrementalSnapshot&&bs.has(a.data.source)||En.forEach((t=>t.unfreeze())),st)null==i||i(ft(a),e);else if(at){var o={type:"rrweb",event:ft(a),origin:window.location.origin,isCheckout:e};window.parent.postMessage(o,"*")}if(a.type===xr.FullSnapshot)ot=a,ct=0;else if(a.type===xr.IncrementalSnapshot){if(a.data.source===Tr.Mutation&&a.data.isAttachIframe)return;ct++,(s&&ct>=s||n&&a.timestamp-ot.timestamp>n)&&ls(!0)}};var pt=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,r=new Set;if(t.adds.length>0)for(var i of t.adds){var n=ws.getNode(i.node.id);n&&"IFRAME"===n.nodeName&&r.add(n)}t.removes.forEach((t=>{var i=t.id;if(!e||!e.has(i)){var n=wt.getIframeElementById(i);n&&r.has(n)?wt.forgetIframeId(i):(null==ht||ht(i),wt.removeIframeById(i))}})),null==dt||dt(),wt.cleanupDetachedIframes()}us({type:xr.IncrementalSnapshot,data:u({source:Tr.Mutation},t)})},mt=t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.Scroll},t)}),gt=t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.CanvasMutation},t)}),yt=new ps({mutationCb:pt,adoptedStyleSheetCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.AdoptedStyleSheet},t)})}),wt=new Gn({mirror:ws,mutationCb:pt,stylesheetManager:yt,recordCrossOriginIframes:j,wrappedEmit:us});for(var bt of X||[])bt.getMirror&&bt.getMirror({nodeMirror:ws,crossOriginIframeMirror:wt.crossOriginIframeMirror,crossOriginIframeStyleMirror:wt.crossOriginIframeStyleMirror});var kt=new ms,_t=null==L?void 0:L.configured;hs=new fs({recordCanvas:z,mutationCb:gt,win:window,blockClass:o,blockSelector:h,mirror:ws,sampling:O.canvas,dataURLOptions:nt,resolutionScale:N,canvasMasking:L});var St=new Vn({mutationCb:pt,scrollCb:mt,bypassOptions:{blockClass:o,blockSelector:h,maskTextClass:m,maskTextSelector:y,inlineStylesheet:b,maskInputOptions:ut,dataURLOptions:nt,maskTextFn:R,maskInputFn:C,recordCanvas:z,canvasMaskingConfigured:_t,inlineImages:K,sampling:O,slimDOMOptions:lt,iframeManager:wt,stylesheetManager:yt,canvasManager:hs,keepIframeSrcFn:tt,processedNodeManager:kt,attributeFilter:it},mirror:ws});ls=function(t){if(void 0===t&&(t=!1),B){us({type:xr.Meta,data:{href:window.location.href,width:hn(),height:ln()}},t),null==e||e(),e=void 0,yt.reset(),St.init(),En.forEach((t=>t.lock()));var r,i,n=null;try{n=function(t,e){var r,i=e||{},n=i.mirror,s=void 0===n?new ci:n,a=i.blockClass,o=void 0===a?"rr-block":a,u=i.blockSelector,l=void 0===u?null:u,h=i.maskTextClass,d=void 0===h?"rr-mask":h,c=i.maskTextSelector,v=void 0===c?null:c,f=i.inlineStylesheet,p=void 0===f||f,m=i.inlineImages,g=void 0!==m&&m,y=i.recordCanvas,w=void 0!==y&&y,b=i.canvasMaskingConfigured,k=i.maskAllInputs,_=void 0!==k&&k,S=i.maskTextFn,I=i.maskInputFn,M=i.slimDOM,C=i.dataURLOptions,R=i.preserveWhiteSpace,x=i.onSerialize,T=i.onIframeLoad,A=i.iframeLoadTimeout,O=i.onIframeListenerRegistered,E=i.onStylesheetLoad,F=i.stylesheetLoadTimeout,N=i.keepIframeSrcFn,L=void 0===N?()=>!1:N,D=i.maxDepth,P=i.inlineStylesheetBudgetRules,B=!0===_?{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===_?{password:!0}:_,W=Ki(void 0!==M&&M);r=P,(Jr+=1)>1||(Kr=Vr(),ti=[],Yr=ri(r),Qr=Zr());try{return Qi(t,{doc:t,mirror:s,blockClass:o,blockSelector:l,maskTextClass:d,maskTextSelector:v,skipChild:!1,inlineStylesheet:p,maskInputOptions:B,maskTextFn:S,maskInputFn:I,slimDOMOptions:W,dataURLOptions:C,inlineImages:g,recordCanvas:w,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:x,onIframeLoad:T,iframeLoadTimeout:A,onIframeListenerRegistered:O,onStylesheetLoad:E,stylesheetLoadTimeout:F,keepIframeSrcFn:L,newlyAddedElement:!1,maxDepth:D})}finally{0===Jr?Xr||Vr():(Jr-=1)>0||(Kr.durationMs=Zr()-Qr,Kr.deferredStylesheetCount=ti.length,Yr=null,Xr=Kr)}}(document,{mirror:ws,blockClass:o,blockSelector:h,maskTextClass:m,maskTextSelector:y,inlineStylesheet:b,maskAllInputs:ut,inlineStylesheetBudgetRules:_,maskTextFn:R,maskInputFn:C,slimDOM:lt,dataURLOptions:nt,recordCanvas:z,canvasMaskingConfigured:_t,inlineImages:K,onSerialize(t){mn(t,ws)&&wt.addIframe(t),gn(t,ws)&&yt.trackLinkElement(t),yn(t)&&St.addShadowRoot(Gr.shadowRoot(t),document)},onIframeLoad(t,e){wt.attachIframe(t,e),St.observeAttachShadow(t)},onIframeListenerRegistered(t,e){wt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){yt.attachLinkElement(t,e)},keepIframeSrcFn:tt})}finally{r=ti,ti=[],i=r}if(!n)return console.warn("Failed to snapshot the document");us({type:xr.FullSnapshot,data:{node:n,initialOffset:un(window)}},t),En.forEach((t=>t.unlock())),hs.onFullSnapshot(),i.length&&(e=function(t,r,i){var n=!1,s=null,a=0,o=i=>{if(s=null,!n){var u=function(){var e=t[a];t[a]=null,a+=1,e&&en((()=>r.inlineDeferredLinkElement(e,ws.getId(e))))};do{u()}while(t.length>a&&i&&!i.didTimeout&&i.timeRemaining()>5);t.length>a?s=ks(o):e=void 0}};return s=ks(o),()=>{n=!0,null==s||s.cancel(),s=null}}(i,yt)),j&&wt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&yt.adoptStyleSheets(document.adoptedStyleSheets,ws.getId(document))}};try{var It=[];ht=t=>{var e=vt.get(t);e&&(e.forEach((t=>{en(t);var e=It.indexOf(t);-1!==e&&It.splice(e,1)})),vt.delete(t))},dt=()=>{for(var t of vt){var e=t[0],r=ws.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==ht||ht(e)}catch(t){null==ht||ht(e)}else null==ht||ht(e)}};var Mt=t=>{var e;return On(Un)({mutationCb:pt,mousemoveCb:(t,e)=>us({type:xr.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.MouseInteraction},t)}),scrollCb:mt,viewportResizeCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.ViewportResize},t)}),inputCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.Input},t)}),mediaInteractionCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.MediaInteraction},t)}),styleSheetRuleCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.StyleSheetRule},t)}),styleDeclarationCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.StyleDeclaration},t)}),canvasMutationCb:gt,fontCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.Font},t)}),selectionCb(t){us({type:xr.IncrementalSnapshot,data:u({source:Tr.Selection},t)})},customElementCb(t){us({type:xr.IncrementalSnapshot,data:u({source:Tr.CustomElement},t)})},blockClass:o,ignoreClass:c,ignoreSelector:f,maskTextClass:m,maskTextSelector:y,maskInputOptions:ut,inlineStylesheet:b,sampling:O,recordDOM:B,recordCanvas:z,canvasMaskingConfigured:_t,inlineImages:K,userTriggeredOnInput:V,collectFonts:J,doc:t,maskInputFn:C,maskTextFn:R,keepIframeSrcFn:tt,blockSelector:h,slimDOMOptions:lt,dataURLOptions:nt,mirror:ws,iframeManager:wt,stylesheetManager:yt,shadowDomManager:St,processedNodeManager:kt,canvasManager:hs,ignoreCSSAttributes:rt,attributeFilter:it,plugins:(null==(e=null==X?void 0:X.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>us({type:xr.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},x)};wt.addLoadListener((t=>{try{var e=ws.getId(t),r=Mt(t.contentDocument);if(It.push(r),-1!==e){var i=vt.get(e);i||vt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),wt.addPageHideListener((t=>{var e=ws.getId(t);null==ht||ht(e),Dn(t)}));var Ct=-1,Rt=t=>us({type:xr.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),xt=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?ws.getId(s):-1;a!==Ct&&(-1!==Ct&&Rt({id:Ct,enter:!1}),Ct=a,-1!==a&&Rt({id:a,enter:!0}))},Tt=()=>{ls(),It.push(Mt(document)),It.push(Yi("fullscreenchange",xt)),It.push(Yi("webkitfullscreenchange",xt)),It.push(Yi("mozfullscreenchange",xt)),It.push(Yi("MSFullscreenChange",xt)),gs=!0};return["interactive","complete"].includes(document.readyState)?Tt():(It.push(Yi("DOMContentLoaded",(()=>{us({type:xr.DomContentLoaded,data:{}}),"DOMContentLoaded"===H&&Tt()}))),It.push(Yi("load",(()=>{us({type:xr.Load,data:{}}),"load"===H&&Tt()}),window))),()=>{null==e||e(),e=void 0,It.forEach((t=>en(t))),kt.destroy(),wt.removeLoadListener(),wt.destroy(),vt.clear(),St.reset(),ws.reset(),gs=!1,In=void 0}}catch(t){console.warn(t)}}_s.addCustomEvent=(t,e)=>{if(!gs)throw new Error("please add custom event after start recording");us({type:xr.Custom,data:{tag:t,payload:e}})},_s.freezePage=()=>{En.forEach((t=>t.freeze()))},_s.takeFullSnapshot=t=>{if(!gs)throw new Error("please take full snapshot after start recording");ls(t)},_s.mirror=ws;var Ss=Object.defineProperty,Is=(t,e,r)=>((t,e,r)=>e in t?Ss(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Ms{constructor(t){Is(this,"fileName"),Is(this,"functionName"),Is(this,"lineNumber"),Is(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Cs=/(^|@)\S+:\d+/,Rs=/^\s*at .*(\S+:\d+|\(native\))/m,xs=/^(eval@)?(\[native code])?$/,Ts={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Rs)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var 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(Rs)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new Ms({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(xs)}),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 Ms({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Ms({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[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){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Ms({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Ms({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Cs)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Ms({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function As(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function Os(t){return Array.isArray(t)}function Es(t){return"object"==typeof t&&null!==t&&!Os(t)}function Fs(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(Es(t[i])&&Fs(t[i],e-1))return!0;return!1}function Ns(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Es(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||Es(a)&&Fs(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=Os(l)?As(l.length?l[0]:null):l}return o}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 Ls={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 Ds(t,e,r){var i,n=r?Object.assign({},Ls,r):Ls,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=Ts.parse(e.error).map((t=>t.toString())),s=[Ns(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[Ns("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Ns("Uncaught (in promise)",n.stringifyOptions),Ns(e.reason,n.stringifyOptions)]);var s=Ts.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h={next:l},d=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=Ts.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>Ns(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Ns("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=e[s];"function"==typeof t&&t.__rrweb_layer__;){var r=t.__rrweb_layer__;if(r.next===d)return void(r.next=h.next);t=r.next}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var Ps=t=>({name:"rrweb/console@1",observer:Ds,options:t}),$s=t=>"undefined"!=typeof Document&&t instanceof Document,Bs=()=>{};function Ws(t,e,r){try{if(!(e in t))return Bs;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return k(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e];k(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else t[e]=i.next}}catch(t){return Bs}}function zs(t,e){var r,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),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var Us=D("[Recorder]"),js=t=>"navigation"===t.entryType,qs=t=>"resource"===t.entryType;function Hs(t,e){return!!e&&(x(e)||e[t])}function Gs(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var Vs=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Zs(t){var e=t.type,r=t.recordBody,i=t.headers;function n(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Gs(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(Vs))return!1;if(x(r))return!0;if(b(r))return n(r);var s=r[e];return x(s)?s:n(s)}function Js(t,e,r,i,n,s){return Qs.apply(this,arguments)}function Qs(){return Qs=o((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return Us.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(qs(a=t[s])&&a.initiatorType===e&&(S(i)||a.startTime>=i)&&(S(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),Js(t,e,r,i,n,s+1))})),Qs.apply(this,arguments)}function Ks(t){var e=t.body,r=t.options,i=t.url;if(C(e))return null;var n=zs(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(I(e))return e;if($s(e))return e.textContent;if(T(e))return U(e);if(_(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var Xs=t=>!M(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Ys(t){var e=t.entry,r=t.method,i=t.status,n=t.networkRequest,s=t.isInitial,a=t.start,o=t.end,l=t.url,h=t.initiatorType;a=e?e.startTime:a,o=e?e.responseEnd:o;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(a||0)),v=[u({},e?e.toJSON():{name:l},{startTime:S(a)?void 0:Math.round(a),endTime:S(o)?void 0:Math.round(o),timeOrigin:d,timestamp:c,method:r,initiatorType:h||(e?e.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Xs(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var ta=["video/","audio/"];function ea(t){return _(t)&&k(t.getReader)&&k(t.tee)}var ra=500,ia="[SessionReplay] Timeout while trying to read body",na="[SessionReplay] Failed to read body";function sa(t){return na+": "+t}function aa(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function oa(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(ia)),ra);try{t.clone().text().then((t=>e(t)),(t=>e(sa(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(na)}}))}(t);var r=Y(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(aa(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(ia)),ra);try{o=t.clone()}catch(t){return void a(na)}var l=o.body;if(ea(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(na)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(aa(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(sa(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(sa(t))))}catch(t){a(na)}}))}(t,r)}function ua(){return(ua=o((function*(t){var e=t.r,r=t.options,i=zs(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):oa(e,r)}))).apply(this,arguments)}function la(){return(la=o((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=ta.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=zs(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return M(i)?oa(e,r):Promise.resolve(i)}))).apply(this,arguments)}var ha=null;function da(t,e,r){if(!("performance"in e))return()=>{};if(ha)return Us.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},tt,r):tt,n=e=>{var r=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var s=i.maskRequestFn(t);e||(n=!s),s&&r.push(s)}})),r.length>0&&t(u({},e,{requests:r}))},s=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>js(t)||qs(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>Ys({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>js(t)||qs(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>Ys({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(n,e,i),a=()=>{},l=()=>{};return(i.recordHeaders||i.recordBody)&&(a=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Hs("request",r.recordHeaders),n=Hs("response",r.recordHeaders),s=Ws(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},m={},g=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=d.send.bind(d);d.send=t=>(Zs({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=Ks({body:t,options:r,url:o})),c=e.performance.now(),y(t));var w=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",w),d.removeEventListener("abort",w),d.removeEventListener("timeout",w)},b=()=>{if(d.readyState===d.DONE){w(),v=e.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),Zs({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=Ks({body:d.response,options:r,url:o})),Js(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=Ys({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",w),d.addEventListener("abort",w),d.addEventListener("timeout",w)}catch(t){Us.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(n,e,i),l=function(t,e,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=Hs("request",r.recordHeaders),n=Hs("response",r.recordHeaders),s=Ws(e,"fetch",(s=>function(){var a=o((function*(a,o){var u,l;try{u=new Request(a,o)}catch(t){return Us.error("Failed to instrument fetch for network capture",t),s(a,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),i&&(c.requestHeaders=v),!ea(null==o?void 0:o.body)&&Zs({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(c.requestBody=yield function(t){return ua.apply(this,arguments)}({r:u,options:r,url:a}))}catch(t){Us.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),l=Gs(a)?yield s(u):yield s(a,o),d=e.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),n&&(c.responseHeaders=f),Zs({type:"response",headers:f,url:a,recordBody:r.recordBody})&&(c.responseBody=yield function(t){return la.apply(this,arguments)}({r:l,options:r,url:a})),l}finally{Js(e,"fetch",u.url,h,d).then((e=>{var r,i=Ys({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return a.apply(this,arguments)}}()));return()=>{s()}}(n,e,i)),ha=()=>{s(),a(),l(),ha=null}}var ca=t=>({name:"rrweb/network@1",observer:da,options:t});s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Ps,getRecordNetworkPlugin:ca},s.__PosthogExtensions__.rrweb={record:_s,version:"v2",wasMaxDepthReached:()=>Ji,resetMaxDepthState(){Ji=!1,Zi=!1},getLastSnapshotCost:()=>Xr,getMutationCost:()=>u({},ei),resetSnapshotCostState(){Jr=0,Qr=0,Kr=Vr(),Xr=null,Yr=null,ti=[],ei={slowestBatchMs:0}}},s.rrweb={record:_s,version:"v2"},s.rrwebConsoleRecord={getRecordConsolePlugin:Ps},s.getRecordNetworkPlugin=ca,s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.initSessionRecording=t=>new Sr(t)}();
1
+ !function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,r=null==e?void 0:e.document,i=null==e?void 0:e.location;null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;var n="undefined"!=typeof globalThis?globalThis:t;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});var s=null!=t?t:{};function a(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){a(s,i,n,o,u,"next",t)}function u(t){a(s,i,n,o,u,"throw",t)}o(void 0)}))}}function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},u.apply(null,arguments)}var l,h={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},d={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},c="NativeGzipValidationError",v=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=c,e},f=function(){var t=o((function*(t,e){18>t.size&&v("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&v("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(l)return l;l=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;l[t]=e>>>0}return l})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&v("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&v("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function p(){return p=o((function*(t,e,r){void 0===e&&(e=!0);try{var i=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),a=s.write(i).then((()=>s.close())).catch(function(){var t=o((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(n.readable).blob(),l=(yield Promise.all([u,a]))[0];return yield f(l,i),l}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),p.apply(this,arguments)}var m=function(t){return t.trim()},g=Object.prototype,y=g.hasOwnProperty,w=g.toString,b=Array.isArray||function(t){return"[object Array]"===w.call(t)},k=t=>"function"==typeof t,_=t=>t===Object(t)&&!b(t),S=t=>void 0===t,I=t=>"[object String]"==w.call(t),M=t=>null===t,C=t=>S(t)||M(t),R=t=>"[object Number]"==w.call(t)&&t==t,x=t=>"[object Boolean]"===w.call(t),T=t=>t instanceof FormData;function A(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),R(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):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: "+r+", fallback: "+n),A(n||r,e,r,i))}class O{constructor(t){this.tt={},this.et=t.et,this.it=A(t.bucketSize,0,100,t.rt),this.nt=A(t.refillRate,0,this.it,t.rt),this.st=A(t.refillInterval,0,864e5,t.rt)}ot(t,e){var r=Math.floor((e-t.lastAccess)/this.st);r>0&&(t.tokens=Math.min(t.tokens+r*this.nt,this.it),t.lastAccess=t.lastAccess+r*this.st)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.tt[i];return n?this.ot(n,r):this.tt[i]=n={tokens:this.it,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.et)||e.call(this,t)),0===n.tokens)}stop(){this.tt={}}}function E(t){return t?t.split("#")[0]:t}var F={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"},N=function(e,r){var i=(void 0===r?{}:r).debugEnabled,n={k(r){if(t&&(F.DEBUG||t.POSTHOG_DEBUG||i)&&!S(t.console)&&t.console){for(var n=("__rrweb_original__"in t.console[r]?t.console[r].__rrweb_original__:t.console[r]),s=arguments.length,a=new Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];n(e,...a)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("error",...e)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(t){n.error("You must initialize PostHog before calling "+t)},createLogger:(t,r)=>N(e+" "+t,r)};return n},L=N("[PostHog.js]"),D=L.createLogger;function P(t,e){if(!C(t))if(b(t))t.forEach(e);else if(T(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)y.call(t,r)&&e(t[r],r)}function B(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var W=["localhost","127.0.0.1"],z=t=>{var e=null==r?void 0:r.createElement("a");return S(e)?null:(e.href=t,e)},U=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return P(t,(function(t,e){S(t)||S(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)};function j(e){var r,i=null==t||null==(r=t.location)?void 0:r.href;return S(i)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!k(i))return e;try{var n=i(e);return I(n)&&n?n:e}catch(t){return L.error("Error in get_current_url, falling back to window.location.href",t),e}}(e,i)}var q=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}))$"),H=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,G=[16,15,14,13],V=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Z=/[0-9A-Za-z_]/;function J(t){for(var e=0,r=!1,i=t.length-1;i>=0;i--){var n=t.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),e+=n,r=!r}return e%10==0}var Q="[SessionRecording]",K="redacted",X=1e6;function Y(t){var e;return Math.min(X,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:X)}var tt={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:X,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},et=["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"],rt=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],it=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],nt=t=>{C(t)||P(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return et.includes(e)||it.some((t=>e.includes(t)))})(e)&&(t[e]=K)}))},st=["/s/","/e/","/i/"];function at(t,e,r,i){if(C(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return I(n)&&(n=parseInt(n)),n>r?Q+" "+i+" body too large to record ("+n+" bytes)":t}function ot(t,e){if(C(t))return t;var r=t;return function(t,e){if(C(t))return!1;if(I(t)){if(function(t){var e;for(H.lastIndex=0;e=H.exec(t);){var r=e[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of G){var a=n+s;if(i.length>=a){var o=i.slice(n,a);if(q.test(o)&&J(o))return!0}}}return!1}(t=m(t)))return!1;var r=function(t){var e;for(V.lastIndex=0;e=V.exec(t);){var r=e[1],i=e[3];if(!(r&&i&&Z.test(r)&&Z.test(i)))return!0}return!1}(t);if(r)return!1}return!0}(r)||(r=Q+" "+e+" body "+K),P(rt,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Q+" "+e+" body "+K+" as might contain: "+t)})),r}var ut="$session_recording_remote_config",lt="$replay_sample_rate",ht="$replay_override_sampling",dt="$replay_override_linked_flag",ct="$replay_override_url_trigger",vt="$replay_override_event_trigger",ft="$session_is_sampled",pt="$session_past_minimum_duration",mt="$session_recording_url_trigger_activated_session",gt="$session_recording_event_trigger_activated_session",yt="$posthog_sr_group_event_trigger_",wt="$posthog_sr_group_url_trigger_",bt="$posthog_sr_group_sampling_",kt="$debug_first_full_snapshot_timestamp",_t="$sess_rec_flush_size",St="$stored_person_properties",It="$sdk_debug_replay_remote_trigger_matching_config",Mt="disabled",Ct="sampled",Rt="active",xt="buffering",Tt="paused",At="rrweb_error",Ot="trigger",Et=Ot+"_activated",Ft=Ot+"_pending",Nt=Ot+"_"+Mt;function Lt(t,e,r,i,n,s){return 0===e?Nt:(null==t?void 0:t.get_property(r?i+r:n))===s?Et:Ft}function Dt(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}class Pt{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(Et)?Et:e.includes(Ft)?Ft:Nt}stop(){this.u.forEach((t=>t.stop()))}}class $t{constructor(t){this.u=t}triggerStatus(t){var e=new Set;for(var r of this.u)e.add(r.triggerStatus(t));switch(e.delete(Nt),e.size){case 0:return Nt;case 1:return Array.from(e)[0];default:return Ft}}stop(){this.u.forEach((t=>t.stop()))}}class Bt{triggerStatus(){return Et}stop(){}}var Wt=t=>"sessionRecording"in t;class zt{constructor(t,e){this.th=[],this.eh=[],this.rh=new Map,this.ih=new Map,this.nh="",this.urlBlocked=!1,this._instance=t,this.sh=e}onConfig(t){var e,r;this.th=(Wt(t)?_(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.eh=(Wt(t)?_(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.ah()}ah(){for(var t of(this.rh.clear(),this.ih.clear(),this.th))if("regex"===t.matching&&!this.rh.has(t.url))try{this.rh.set(t.url,new RegExp(t.url))}catch(e){L.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.eh)if("regex"===e.matching&&!this.ih.has(e.url))try{this.ih.set(e.url,new RegExp(e.url))}catch(t){L.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}oh(t){return Lt(this._instance,this.th.length,this.sh,wt,mt,t)}triggerStatus(t){var e=this.oh(t),r=e===Et?Et:e===Ft?Ft:Nt;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){var r=j(this._instance);if(r&&r!==this.nh){this.nh=r;var i=this.urlBlocked,n=Dt(r,this.eh,this.ih);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=j(this._instance);if(n&&n!==this.nh){this.nh=n;var s=this.urlBlocked,a=Dt(n,this.eh,this.ih);a&&!s?t():!a&&s&&e();var o=this.oh(i)===Et,u=Dt(n,this.th,this.rh);!o&&u&&r("url",n)}}stop(){this.nh=""}}class Ut{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.uh=()=>{},this._instance=t}triggerStatus(){var t=Ft;return C(this.linkedFlag)&&(t=Nt),this.linkedFlagSeen&&(t=Et),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(Wt(t)?_(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!C(this.linkedFlag)&&!this.linkedFlagSeen){var i=I(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=I(this.linkedFlag)?null:this.linkedFlag.variant;this.uh=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(_(r)&&i in r){var a=r[i];s=x(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.uh()}}class jt{constructor(t,e){this.lh=[],this._instance=t,this.sh=e}onConfig(t){var e;this.lh=(Wt(t)?_(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}hh(t){return Lt(this._instance,this.lh.length,this.sh,yt,gt,t)}triggerStatus(t){var e=this.hh(t),r=e===Et?Et:e===Ft?Ft:Nt;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.lh.length){var i=this.hh(r)===Et,n=this.lh.includes(t);!i&&n&&e("event",t)}}stop(){}}class qt{constructor(t,e,r){if(this._instance=t,this.group=e,this.dh=new zt(t,e.id),this.fh=new jt(t,e.id),this.ph=new Ut(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.dh.onConfig(n),this.fh.onConfig(n),this.ph.onConfig(n,r);var s=[this.fh,this.dh,this.ph];this.mh="any"===e.conditions.matchType?new Pt(s):new $t(s)}else this.mh=new Bt}triggerStatus(t){return this.mh.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.fh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.dh.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?wt+this.group.id:yt+this.group.id]:e})}stop(){this.dh.stop(),this.fh.stop(),this.ph.stop()}}function Ht(t){if(t.rrwebError)return At;if(!t.receivedFlags)return xt;if(!t.isRecordingEnabled)return Mt;if(t.urlTriggerMatching.urlBlocked)return Tt;var e=!0===t.isSampled,r=new Pt([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Ct:r===Et?Rt:r===Ft?xt:!1===t.isSampled?Mt:Rt}function Gt(t){if(t.rrwebError)return At;if(!t.receivedFlags)return xt;if(!t.isRecordingEnabled)return Mt;if(t.urlTriggerMatching.urlBlocked)return Tt;var e=new $t([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Nt,i=x(t.isSampled);return r&&e===Ft?xt:r&&e===Nt||i&&!t.isSampled?Mt:!0===t.isSampled?Ct:Rt}function Vt(){var t=[];return function(e,r){if(_(r)||b(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function Zt(t){var e=JSON.stringify(t,Vt());return e?new Blob([e]).size:0}function Jt(t){if(M(t))return 4;if(S(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(b(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=S(i)||M(i)?4:Jt(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];S(u)||(a||(s+=1),a=!1,s+=o.length+3+Jt(u))}return s;default:return 0}}function Qt(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[Qt({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Qt({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Kt=Uint8Array,Xt=Uint16Array,Yt=Uint32Array,te=new Kt([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]),ee=new Kt([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]),re=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ie=function(t,e){for(var r=new Xt(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Yt(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},ne=ie(te,2),se=ne[1];ne[0][28]=258,se[258]=28;for(var ae=ie(ee,0)[1],oe=new Xt(32768),ue=0;32768>ue;++ue){var le=(43690&ue)>>>1|(21845&ue)<<1;oe[ue]=((65280&(le=(61680&(le=(52428&le)>>>2|(13107&le)<<2))>>>4|(3855&le)<<4))>>>8|(255&le)<<8)>>>1}var he=function(t,e,r){for(var i=t.length,n=0,s=new Xt(e);i>n;++n)++s[t[n]-1];var a,o=new Xt(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new Xt(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)a[oe[d]>>>u]=l}else for(a=new Xt(i),n=0;i>n;++n)a[n]=oe[o[t[n]-1]++]>>>15-t[n];return a},de=new Kt(288);for(ue=0;144>ue;++ue)de[ue]=8;for(ue=144;256>ue;++ue)de[ue]=9;for(ue=256;280>ue;++ue)de[ue]=7;for(ue=280;288>ue;++ue)de[ue]=8;var ce=new Kt(32);for(ue=0;32>ue;++ue)ce[ue]=5;var ve=he(de,9,0),fe=he(ce,5,0),pe=function(t){return(t/8>>0)+(7&t&&1)},me=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof Xt?Xt:t instanceof Yt?Yt:Kt)(r-e);return i.set(t.subarray(e,r)),i},ge=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},ye=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},we=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Kt(0),0];if(1==n){var a=new Kt(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var v=new Xt(c+1),f=be(r[h-1],v,0);if(f>e){i=0;var p=0,m=f-e,g=1<<m;for(s.sort((function(t,e){return v[e.s]-v[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=v[y])break;p+=g-(1<<f-v[y]),v[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>v[w]?p-=1<<e-v[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;v[b]==e&&(--v[b],++p)}f=e}return[new Kt(v),f]},be=function(t,e,r){return-1==t.s?Math.max(be(t.l,e,r+1),be(t.r,e,r+1)):e[t.s]=r},ke=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Xt(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},_e=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},Se=function(t,e,r){var i=r.length,n=pe(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},Ie=function(t,e,r,i,n,s,a,o,u,l,h){ge(e,h++,r),++n[256];for(var d=we(n,15),c=d[0],v=d[1],f=we(s,15),p=f[0],m=f[1],g=ke(c),y=g[0],w=g[1],b=ke(p),k=b[0],_=b[1],S=new Xt(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;k.length>I;++I)S[31&k[I]]++;for(var M=we(S,7),C=M[0],R=M[1],x=19;x>4&&!C[re[x-1]];--x);var T,A,O,E,F=l+5<<3,N=_e(n,de)+_e(s,ce)+a,L=_e(n,c)+_e(s,p)+a+14+3*x+_e(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(N>=F&&L>=F)return Se(e,h,t.subarray(u,u+l));if(ge(e,h,1+(N>L)),h+=2,N>L){T=he(c,v,0),A=c,O=he(p,m,0),E=p;var D=he(C,R,0);for(ge(e,h,w-257),ge(e,h+5,_-1),ge(e,h+10,x-4),h+=14,I=0;x>I;++I)ge(e,h+3*I,C[re[I]]);h+=3*x;for(var P=[y,k],B=0;2>B;++B){var W=P[B];for(I=0;W.length>I;++I)ge(e,h,D[z=31&W[I]]),h+=C[z],z>15&&(ge(e,h,W[I]>>>5&127),h+=W[I]>>>12)}}else T=ve,A=de,O=fe,E=ce;for(I=0;o>I;++I)if(i[I]>255){var z;ye(e,h,T[257+(z=i[I]>>>18&31)]),h+=A[z+257],z>7&&(ge(e,h,i[I]>>>23&31),h+=te[z]);var U=31&i[I];ye(e,h,O[U]),h+=E[U],U>3&&(ye(e,h,i[I]>>>5&8191),h+=ee[U])}else ye(e,h,T[i[I]]),h+=A[i[I]];return ye(e,h,T[256]),h+A[256]},Me=new Yt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ce=function(){for(var t=new Yt(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),Re=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=Ce[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},xe=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new Kt(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=Se(u,l,t.subarray(h,d)):(u[h]=true,l=Se(u,l,t.subarray(h,a)))}else{for(var c=Me[e-1],v=c>>>13,f=8191&c,p=(1<<r)-1,m=new Xt(32768),g=new Xt(p+1),y=Math.ceil(r/3),w=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<w)&p},k=new Yt(25e3),_=new Xt(288),S=new Xt(32),I=0,M=0,C=(h=0,0),R=0,x=0;a>h;++h){var T=b(h),A=32767&h,O=g[T];if(m[A]=O,g[T]=A,h>=R){var E=a-h;if((I>7e3||C>24576)&&E>423){l=Ie(t,u,0,k,_,S,M,C,x,h-x,l),C=I=M=0,x=h;for(var F=0;286>F;++F)_[F]=0;for(F=0;30>F;++F)S[F]=0}var N=2,L=0,D=f,P=A-O&32767;if(E>2&&T==b(h-P))for(var B=Math.min(v,E)-1,W=Math.min(32767,h),z=Math.min(258,E);W>=P&&--D&&A!=O;){if(t[h+N]==t[h+N-P]){for(var U=0;z>U&&t[h+U]==t[h+U-P];++U);if(U>N){if(N=U,L=P,U>B)break;var j=Math.min(P,U-2),q=0;for(F=0;j>F;++F){var H=h-P+F+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,O=H)}}}P+=(A=O)-(O=m[A])+32768&32767}if(L){k[C++]=268435456|se[N]<<18|ae[L];var V=31&se[N],Z=31&ae[L];M+=te[V]+ee[Z],++_[257+V],++S[Z],R=h+N,++I}else k[C++]=t[h],++_[t[h]]}}l=Ie(t,u,true,k,_,S,M,C,x,h-x,l)}return me(o,0,i+pe(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Te=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Ae=function(t,e){var r=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&&Te(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},Oe=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Ee(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Fe{constructor(t,e){var r,i;void 0===e&&(e={}),this.gh={},this.yh=t=>{if(!this.gh[t]){var e,r;this.gh[t]=!0;var i=this.wh(t);null==(e=(r=this.bh).onBlockedNode)||e.call(r,t,i)}},this.kh=t=>{var e=this.wh(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.wh=t=>this._rrweb.mirror.getNode(t),this._h=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this._h(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var e=this.kh(t.id);return!this.To.consumeRateLimit(e[0])&&t})));var i=this._h(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.bh=e,this.To=new O({bucketSize:null!==(r=this.bh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.bh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,et:this.yh,rt:L})}reset(){this.gh={}}stop(){this.To.stop(),this.reset()}}F.DEBUG=!1,F.LIB_VERSION="1.412.1",F.LIB_NAME="web";class Ne{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.Sh=t.get_property.bind(t),this.Ih=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Ih(_t,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.Sh(_t);return _(e=r)&&I(e.sessionId)&&R(e.size)&&r.sessionId===t?r.size:0}}function Le(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100<A(100*e,0,100,L)}var De=function(t,e){if(!function(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}},Pe={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=>De(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!De(e,t))))),icontains:(t,e)=>e.map($e).some((e=>t.map($e).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map($e).every((e=>t.map($e).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r<parseFloat(t)))}))},$e=t=>t.toLowerCase(),Be=new Set(["is_not","not_icontains","not_regex"]);function We(t,e,r){return!t||0===t.length||t.every((t=>{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(S(n)||M(n))return Be.has(s);var a=Pe[s];return!!a&&!S(t.value)&&!M(t.value)&&a(b(t.value)?t.value.map(String):[String(t.value)],b(n)?n.map(String):[String(n)])}))}var ze=D("[SessionRecording]");function Ue(t,e){return e?t:"!"+t}function je(t,e){return t===e||t!=="!"+e&&null}class qe{constructor(t,e,r,i,n,s,a){this.Mh=null,this.Ch=Gt,this._instance=t,this.dh=e,this.fh=r,this.ph=i,this.Rh=n,this.xh=s,this.Th=a}onRemoteConfig(t){this.Mh=R(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ah=new Pt([this.fh,this.dh]),this.Ch=Ht):(this.Ah=new $t([this.fh,this.dh]),this.Ch=Gt),this._instance.register_for_session({[It]:t.triggerMatchType}),this.dh.onConfig(t),this.fh.onConfig(t),this.ph.onConfig(t,((t,e)=>{this.Rh("linked_flag_matched",{flag:t,variant:e}),this.Th()}))}getStatus(t){return this.Ch({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return R(r)?r:null}checkUrlTriggers(t,e,r,i){this.dh.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.fh.lh.length&&C(this.Oh))return this.Oh=t((t=>{try{this.fh.checkEventTriggerConditions(t.event,r,e)}catch(t){ze.error("Could not activate event trigger",t)}})),this.Oh}makeSamplingDecisions(t){var e,r,i,n=this.Mh;if(!R(n))return null==(r=this._instance.persistence)||r.unregister(ft),void(null==(i=this._instance.persistence)||i.unregister(lt));var s=this._instance.get_property(ft),a=this._instance.get_property(lt),o=je(s,t),u=R(a)&&a!==n,l=S(a)&&s===t,h=u||l||!x(o),d=h?Le(t,n):o;h&&(d?this.Rh("sampled"):ze.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[ft]:Ue(t,d),[lt]:M(a)&&s===t?null:n})}ensureSamplingDecision(t){if(R(this.Mh)){var e=this._instance.get_property(ft);x(je(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(gt),null==(e=this._instance.persistence)||e.unregister(mt),null==(r=this._instance.persistence)||r.unregister(ft),null==(i=this._instance.persistence)||i.unregister(lt),null==(n=this._instance.persistence)||n.unregister(pt)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this.Ah)?void 0:e.triggerStatus(t))===Ft}stop(){var t;null==(t=this.Oh)||t.call(this),this.Oh=void 0,this.fh.stop(),this.dh.stop(),this.ph.stop()}}class He{constructor(t,e,r,i,n){this.Eh=[],this.Fh=new Map,this.Nh=!1,this._instance=t,this.dh=e,this.Rh=r,this.Lh=i,this.Th=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Dh(t.triggerGroups),this._instance.register_for_session({[It]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.dh.onConfig(t)):ze.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return At;if(t.urlTriggerMatching.urlBlocked)return Tt;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return Mt;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Et){var o=s.group.id,u=r.get(o);S(u)?L.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Ft&&(i=!0)}return n?Ct:i?xt:Mt}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Eh,triggerGroupSamplingResults:this.Fh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Eh)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;R(i)&&(M(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.dh.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Ph(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.Th(e))}),t)};for(var a of this.Eh)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Oh=t((t=>{var r;if(this.Nh)return ze.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Oh)||r.call(this),void(this.Oh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Ph(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(St);s.some((e=>!e.properties||0===e.properties.length||We(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.Th(n))}}),e)};for(var s of this.Eh)n(s)}catch(t){ze.error("Could not activate event trigger for trigger groups",t)}})),this.Oh}makeSamplingDecisions(t){for(var e of this.Eh){var r,i=e.group,n=i.id,s=i.sampleRate,a=bt+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(_(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=R(v)&&v!==s,u=c===t&&R(v)&&v===s&&x(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!x(u),m=p?Le(t+n,s):u;p&&this.Lh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Fh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Nh=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(ft),null==(e=this._instance.persistence)||e.unregister(lt),null==(r=this._instance.persistence)||r.unregister(pt),this.Eh)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(yt+o),null==(s=this._instance.persistence)||s.unregister(wt+o),null==(a=this._instance.persistence)||a.unregister(bt+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Eh){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Fh.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Eh)if(e.triggerStatus(t)===Ft)return!0;return!1}stop(){var t;null==(t=this.Oh)||t.call(this),this.Oh=void 0,this.Eh.forEach((t=>t.stop())),this.Eh=[],this.Fh.clear(),this.dh.stop()}Ph(t,e){var r=t.group.conditions.properties;return!r||0===r.length||We(r,e,this._instance.get_property(St))}Dh(t){var e=this;this.Eh.forEach((t=>t.stop())),this.Eh=[],this.Fh.clear();var r=function(t){var r=new qt(e._instance,t,((r,i)=>{e.Rh("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.Th()}));e.Eh.push(r)};for(var i of t)r(i)}}var Ge=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"];function Ve(t){return S(t)?void 0:Math.round(t)}function Ze(t){return _(t)?t.network_timing:t}var Je,Qe,Ke=943718.4,Xe="[SessionRecording]",Ye=D(Xe),tr=[d.MouseMove,d.MouseInteraction,d.Scroll,d.ViewportResize,d.Input,d.TouchMove,d.MediaInteraction,d.Drag],er=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function rr(){var t;return null==s||null==(t=s.__PosthogExtensions__)?void 0:t.rrweb}function ir(){var t;return null==(t=rr())?void 0:t.record}function nr(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,Vt())}}function sr(t){return Ee(function(t,e){void 0===e&&(e={});var r=Re(),i=t.length;r.p(t);var n=xe(t,e,Oe(e),8),s=n.length;return Ae(n,e),Te(n,s-8,r.d()),Te(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Kt(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new Kt(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return me(i,0,n)}(nr(t))))}function ar(t){return or.apply(this,arguments)}function or(){return or=o((function*(t){var e=nr(t),r=yield function(t,e,r){return p.apply(this,arguments)}(e,F.DEBUG,{rethrow:!0});return Ee(new Uint8Array(yield r.arrayBuffer()))})),or.apply(this,arguments)}var ur="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,lr=!1;function hr(t){return b(t)&&0===t.length?Je=null!=Je?Je:sr([]):sr(t)}function dr(t){return cr.apply(this,arguments)}function cr(){return(cr=o((function*(t){return b(t)&&0===t.length?Je||(Qe=null!=Qe?Qe:ar([]).then((t=>(Je=t,t))).catch((t=>{throw Je=void 0,Qe=void 0,t}))):ar(t)}))).apply(this,arguments)}function vr(t){return ur&&!lr&&function(t){return t.type===h.FullSnapshot||t.type===h.IncrementalSnapshot&&(t.data.source===d.Mutation||t.data.source===d.StyleSheetRule)}(t)}function fr(t){return{event:t,size:Jt(t)}}function pr(t,e){return u({},t,{data:e,cv:"2024-10"})}function mr(t,e){return u({},t,{cv:"2024-10",data:u({},t.data,e)})}function gr(t){try{if(t.type===h.FullSnapshot)return fr(pr(t,sr(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation)return fr(mr(t,{texts:hr(t.data.texts),attributes:hr(t.data.attributes),removes:hr(t.data.removes),adds:hr(t.data.adds)}));if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule)return fr(mr(t,{adds:t.data.adds?sr(t.data.adds):void 0,removes:t.data.removes?sr(t.data.removes):void 0}))}catch(t){Ye.error("could not compress event - will use uncompressed event",t)}return{event:t,size:Zt(t)}}function yr(){return(yr=o((function*(t){try{if(t.type===h.FullSnapshot)return fr(pr(t,yield ar(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation){var e=yield Promise.all([dr(t.data.texts),dr(t.data.attributes),dr(t.data.removes),dr(t.data.adds)]);return fr(mr(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule){var r=yield Promise.all([t.data.adds?ar(t.data.adds):void 0,t.data.removes?ar(t.data.removes):void 0]);return fr(mr(t,{adds:r[0],removes:r[1]}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===c})(e)&&(lr=!0),Ye.error("could not compress event asynchronously - trying synchronous compression",e),gr(t)}return{event:t,size:Zt(t)}}))).apply(this,arguments)}function wr(t,e){return t.type===h.Custom&&t.data.tag===e}function br(t){return wr(t,"sessionIdle")}function kr(t){return wr(t,"$session_ending")}function _r(t){return wr(t,"$session_starting")}class Sr{get sessionId(){return this.$r}get $h(){if(!this._instance.sessionManager)throw new Error(Xe+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Bh(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Wh(){return je(this._instance.get_property(ft),this.sessionId)}get Mh(){var t,e=null==(t=this.Tl)?void 0:t.sampleRate;return R(e)?e:null}get zh(){var t,e;return null!==(t=null==(e=this.Uh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.jh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.qh=void 0,this.Hh=Date.now(),this.Gh=!1,this.Vh=[],this.Zh="unknown",this.Jh=!1,this.Qh=!1,this.Kh=!1,this.Xh=!1,this.Yh=!1,this.kd=!1,this._d=!1,this.Sd=!1,this.Id=!1,this.Md=[],this.Cd=void 0,this.Rd=void 0,this.Td=[],this.Ad=0,this.Od=0,this.Ed=!1,this.Fd=void 0,this.Oh=void 0,this.Nd=void 0,this.Ld=void 0,this.Dd=void 0,this.Sr=(t,e,r)=>{var i,n,s,a;if(r&&(t!==this.$r||e!==this.Dr)){var o,u=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this.$r,h=this.Dr;if(u&&this.Lh("$session_ending",{currentSessionId:l,currentWindowId:h,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Hh,flushed_size:null==(o=this.Pd)?void 0:o.currentTrackedSize(l)}),null==(i=this._instance.persistence)||i.unregister(kt),this._d=!1,null==(n=rr())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.$d=void 0,null==(s=rr())||null==s.resetSnapshotCostState||s.resetSnapshotCostState(),this.Lh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.Bd(),!(!1===this.Zh&&this.isStarted||this.$r===t&&this.Dr===e)){var d=this.$r!==t&&!1!==this.Zh;this.Zh="unknown",this.Wd(d)}u&&this.Lh("$session_starting",{previousSessionId:l,previousWindowId:h,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Hh}),null==(a=this.Uh)||a.makeSamplingDecisions(t)}},this.zd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[pt])===this.$r},this.Ud=()=>{var t,e;if(0===this.O.data.length)return null;var r=null==(t=this.O.data[0])?void 0:t.timestamp,i=null==(e=this.O.data[this.O.data.length-1])?void 0:e.timestamp;return R(r)&&R(i)?i-r:null},this.jd=()=>{var t,e,r=this.zh;if(!R(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.qd;return R(i)&&i>=0&&r>i}if(this.zd())return!1;var n,s=this.Ud();return!!M(s)||r>s||(null==(n=this._instance.persistence)||n.register({[pt]:this.$r}),!1)},this.Hd=()=>{this.status!==xt?(this.Jh&&this.Qh&&!this.Kh&&(this.Jh=!1),this.Gd(),this.Vd()):this.Zd()},this.Jd=()=>{this.Lh("browser offline",{})},this.pa=()=>{this.Lh("browser online",{})},this.Ie=()=>{null!=r&&r.visibilityState&&this.Lh("window "+r.visibilityState,{})},this._instance=t;var e=this.$h.checkAndGetSessionAndWindowId(),i=e.windowId;this.$r=e.sessionId,this.Dr=i,this.ph=new Ut(this._instance),this.dh=new zt(this._instance),this.fh=new jt(this._instance),this.O=this.Zd(),this.$h.sessionTimeoutMs>this.Bh||Ye.warn("session_idle_threshold_ms ("+this.Bh+") is greater than the session timeout ("+this.$h.sessionTimeoutMs+"). Session will never be detected as idle"),this.Pd=new Ne(this._instance)}get Qd(){var t,e,r,i,n,s,a,o=null==(t=this.Tl)?void 0:t.masking,u={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},l=null!==(n=null==u?void 0:u.maskAllInputs)&&void 0!==n?n:null==o?void 0:o.maskAllInputs,h=null!==(s=null==u?void 0:u.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,d=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return S(l)&&S(h)&&S(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}Kd(){var t;if(!this.Sd){var e=null==(t=this.Tl)?void 0:t.masking;if(!C(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!S(i)&&i!==n}));0!==i.length&&(this.Sd=!0,Ye.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==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:e}))}}}get Xd(){var t;return A(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,D("canvas recording resolution scale"),1)}get Yd(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.Tl)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:A(h,0,12,D("canvas recording fps"),4),quality:A(d,0,1,D("canvas recording quality"),.4)}}get tc(){var t,e=!(null==(t=this.Tl)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get ec(){var t,e,r,i=null==(t=this.Tl)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=Ze(this._instance.config.capture_performance),u=Ze(null==i?void 0:i.capturePerformance),l=!!(x(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}rc(){var t,e,r=[],n=null==(t=s.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.tc&&r.push(n());var a=null==(e=s.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.ec&&k(a)&&(!W.includes(i.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(a(((t,e)=>{var r,i={payloadSizeLimitBytes:tt.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...tt.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...tt.payloadHostDenyList]},n=!1!==t.session_recording.recordHeaders&&e.recordHeaders,s=!1!==t.session_recording.recordBody&&e.recordBody,a=!1!==t.capture_performance&&e.recordPerformance,o=(r=Y(i),t=>(null!=t&&t.requestBody&&(t.requestBody=at(t.requestBody,t.requestHeaders,r,"Request")),null!=t&&t.responseBody&&(t.responseBody=at(t.responseBody,t.responseHeaders,r,"Response")),t)),l=e=>{return o(((t,e)=>{var r,i=z(t.name),n=0===e.indexOf("http")?null==(r=z(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&st.some((t=>0===s.indexOf(t)))))return t})((nt((r=e).requestHeaders),nt(r.responseHeaders),r),t.api_host));var r},h=k(t.session_recording.maskNetworkRequestFn);return h&&k(t.session_recording.maskCapturedNetworkRequestFn)&&L.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var r=t.session_recording.maskNetworkRequestFn({url:e.name});return u({},e,{name:null==r?void 0:r.url})}),i.maskRequestFn=k(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r,i=l(e);return i&&null!==(r=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:t=>function(t){if(!S(t))return t.requestBody=ot(t.requestBody,"Request"),t.responseBody=ot(t.responseBody,"Response"),t}(l(t)),u({},tt,i,{recordHeaders:n,recordBody:s,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.ec))):Ye.info("NetworkCapture not started because we are on localhost.")),r}ic(t){return this._instance.config.disable_capture_url_hashes?E(t):t}nc(t,e){void 0===e&&(e=!1);var r=e?E(t):this.ic(t),i=this._instance.config.mask_personal_data_properties?[...Ge,...this._instance.config.custom_personal_data_properties||[]]:[];return this.sc(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");b(d)&&(e.includes(d[0])?l.push(d[0]+"=<masked>"):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}sc(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}ac(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.Vh.length?this.Vh.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Ye.warn("could not emit queued rrweb event.",e,t),!1}}Lh(t,e){return this.ac(er((()=>ir().addCustomEvent(t,e))))}oc(){try{if(this._instance.config.capture_pageview||!t)return;var e=new URL(t.location.href),r=this.nc(e.origin+e.pathname+e.search);this.uc!==r&&(this.uc=r,this.Lh("$url_changed",{href:r}))}catch(t){}}lc(){if(this.Vh.length){var t=[...this.Vh];this.Vh=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.ac(t)}))}}xh(){return this.ac(er((()=>ir().takeFullSnapshot())))}get hc(){var t,e,r;if(null!=(t=this.Uh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return R(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}dc(){if(this.cc&&clearInterval(this.cc),!0!==this.Zh){var t=this.hc;t&&(this.cc=setInterval((()=>{this.xh()}),t))}}Th(t){"event"===t&&this.vc(),!this.dh.urlBlocked&&["sampled","active"].includes(this.status)&&this.dc()}fc(){this.dh.urlBlocked||(this.dh.urlBlocked=!0,clearInterval(this.cc),Ye.info("recording paused due to URL blocker"),this.Lh("recording paused",{reason:"url blocker"}))}mc(){this.dh.urlBlocked&&(this.dh.urlBlocked=!1,this.xh(),this.dc(),this.Lh("recording resumed",{reason:"left blocked url"}),Ye.info("recording resumed"))}gc(t,e){var r;if("event"===t&&this.vc(),!this.Gh&&null!=(r=this.Uh)&&r.hasPendingTriggers(this.sessionId)){this.Gh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?mt:gt]:this.sessionId}),null==(n=this.Uh)||n.updateActiveTriggers(this.sessionId),this.Th(),this.Vd(),this.Rh(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Gh=!1}}}get isStarted(){return!!this.qh}get Tl(){var t=this._instance.get_property(ut);if(t){var e;try{e=_(t)?t:JSON.parse(t)}catch(t){return void Ye.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Ye.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(ut))}return e}}yc(t,e,r){this._instance.get_property(t)&&(e(),r())}start(e){var r,i,n=this.Tl;if(n){this.isStarted||(this.Jh=!1!==this.Zh&&!this.Xh,this.Xh=!1,this.Qh=this.Jh,this.Kh=!1),this.Ed&&(this.wc(),this.Zd());var s=this.$h.checkAndGetSessionAndWindowId(),a=s.windowId;this.$r=s.sessionId,this.Dr=a,null==(r=this._instance.persistence)||r.unregister(kt),null!=n&&n.endpoint&&(this.jh=null==n?void 0:n.endpoint),this.Uh=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new He(this._instance,this.dh,this.Rh.bind(this),this.Lh.bind(this),this.Th.bind(this)):new qe(this._instance,this.dh,this.fh,this.ph,this.Rh.bind(this),this.xh.bind(this),this.Th.bind(this)),this.Uh.onRemoteConfig(n),null==(i=this.Oh)||i.call(this),this.Oh=this.Uh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.gc(t,e))),this.yc(ht,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ht)})),this.yc(dt,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(dt)})),this.yc(vt,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(vt)})),this.yc(ct,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ct)})),this.Uh.makeSamplingDecisions(this.sessionId),this.bc(),this.Yh||(B(t,"beforeunload",this.Hd),B(t,"offline",this.Jd),B(t,"online",this.pa),B(t,"visibilitychange",this.Ie),!this.Nd&&k(this.$h.onSessionId)&&(this.Nd=this.$h.onSessionId(this.Sr)),!this.Ld&&k(this.$h.on)?this.Ld=this.$h.on("forcedIdleReset",(()=>{this.Bd(),this.Zh="unknown",this.stop(),this.Dd=this.$h.onSessionId(((t,e,r)=>{var i;null==(i=this.Dd)||i.call(this),this.Dd=void 0,this.Sr(t,e,r)}))})):k(this.$h.on)||Ye.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),C(this.Fd)&&(this.Fd=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.nc(t.properties.$current_url):"";if(!e)return;this.Lh("$pageview",{href:e})}}catch(t){Ye.error("Could not add $pageview to rrweb session",t)}}))),this.status===Rt&&this.Rh(e||"recording_initialized"))}else Ye.info("remote config must be stored in persistence before recording can start")}kc(){var e,r,i,n,s,a;null==t||t.removeEventListener("beforeunload",this.Hd),null==t||t.removeEventListener("offline",this.Jd),null==t||t.removeEventListener("online",this.pa),null==t||t.removeEventListener("visibilitychange",this.Ie),clearInterval(this.cc),this._c(),null==(e=this.Fd)||e.call(this),this.Fd=void 0,null==(r=this.Oh)||r.call(this),this.Oh=void 0,null==(i=this.Nd)||i.call(this),this.Nd=void 0,null==(n=this.Ld)||n.call(this),this.Ld=void 0,null==(s=this.Dd)||s.call(this),this.Dd=void 0,null==(a=this.Uh)||a.stop(),this.Sc(),this.wc()}wc(){this.Od+=1,this.Td=[],this.Ad=0,this.Ic=void 0,this.Ed=!1}Sc(){var t,e;null==(t=this.Mc)||t.stop(),this.Vh=[],null==(e=this.qh)||e.call(this),this.qh=void 0}Cc(){if(!this.Ic||0===this.Ad)return!1;if(this.Ed)return!0;this.Ed=!0;var t=this.Od;return this._c(),this.Sc(),this.Ic.catch((()=>{})).then((()=>{t===this.Od&&(this.Ed=!1,this.Vd(),this.Zd(),this.kc(),Ye.info("stopped"))})).catch((()=>{this.Ed=!1,this.kc(),Ye.info("stopped")})),!0}stop(){this.Cc()||(this.Vd(),this.Zd(),this.kc(),Ye.info("stopped"))}Wd(t){this.stop(),this.start("session_id_changed"),this.Jh=t,this.Qh=!1}vc(){this.isStarted||(this.Xh=!0),this.Jh&&(this.Jh=!1,this.Qh=!1,this.Kh&&(this.Kh=!1,this.xh()),this.Rc())}discard(){this.Zd(),this.kc(),Ye.info("discarded")}xc(t,e,r,i,n){var s={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};this.status!==Mt?(this.Tc(t,i),this.Ac(s)):this.Zd()}Oc(){var t,e=null==(t=rr())||null==t.getLastSnapshotCost?void 0:t.getLastSnapshotCost();e&&(this.$d&&this.$d.durationMs>=e.durationMs||(this.$d=e),500>e.durationMs||Ye.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(e.durationMs),stylesheetMs:Math.round(e.stylesheetMs),nodeCount:e.nodeCount,cssRuleCount:e.cssRuleCount,deferredStylesheetCount:e.deferredStylesheetCount}))}Tc(t,e){t.type!==h.FullSnapshot?t.type===h.IncrementalSnapshot&&(S(this.Cd)||this.Cd===e||this.Rd===e||(this.Rd=e,Ye.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.xh())):this.Cd=e}Ec(t){t.counted&&t.generation===this.Od&&(this.Ad=Math.max(0,this.Ad-1)),t.counted=!1,this.Td=this.Td.filter((e=>e!==t))}Fc(t,e,r){t.processed||t.generation!==this.Od||(t.processed=!0,this.xc(t.event,e,r,t.targetSessionId,t.targetWindowId))}Nc(t){try{var e=t.compressionEnabled?gr(t.event):{event:t.event,size:Zt(t.event)};this.Fc(t,e.event,e.size)}finally{this.Ec(t)}}Gd(){[...this.Td].forEach((t=>{this.Nc(t)}))}Lc(t,e,r,i){var n=this,s={event:t,compressionEnabled:e,targetSessionId:r,targetWindowId:i,generation:this.Od,processed:!1,counted:!0};this.Td.push(s),this.Ad+=1;var a=function(){var r=o((function*(){try{if(s.processed)return;var r,i;try{var a=e?vr(t)?yield function(t){return yr.apply(this,arguments)}(t):gr(t):{event:t,size:Zt(t)};r=a.event,i=a.size}catch(e){Ye.error("could not process queued compression event - will use uncompressed event",e),r=t,i=Zt(t)}n.Fc(s,r,i)}finally{n.Ec(s)}}));return function(){return r.apply(this,arguments)}}();this.Ic=this.Ic?this.Ic.catch((()=>{})).then(a):a()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.lc(),t&&_(t))){if(t.type===h.Meta){var u=this.nc(t.data.href);if(this.uc=u,!u)return;t.data.href=u}else this.oc();if(null==(e=this.Uh)||e.checkUrlTriggers(this.sessionId,(()=>this.fc()),(()=>this.mc()),((t,e)=>this.gc(t,e))),!this.dh.urlBlocked||(l=t).type===h.Custom&&"recording paused"===l.data.tag){var l,d,c,v;t.type===h.FullSnapshot&&(null!=(d=rr())&&null!=d.wasMaxDepthReached&&d.wasMaxDepthReached()&&(this._d=!0),this.Oc(),this.dc(),null==(c=this.Mc)||c.reset(),null==(v=this._instance.persistence)||v.register_once({[kt]:t.timestamp},void 0)),t.type===h.FullSnapshot&&null!=(r=this.Uh)&&r.hasPendingTriggers(this.sessionId)&&this.Dc();var f=this.Mc?this.Mc.throttleMutations(t):t;if(f){var p=function(t){var e=t;if(e&&_(e)&&6===e.type&&_(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]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(f),m=function(t){return kr(t)?t.data.payload:null}(p),g=function(t){return _r(t)?t.data.payload:null}(p);if(m||g){var y=null!=m?m:g;null!=y&&y.lastActivityTimestamp&&(p.timestamp=y.lastActivityTimestamp)}else this.Pc(p);t.type===h.FullSnapshot&&(this.Md.push([this.$r,t.timestamp]),this.Md.length>6&&(this.Md=this.Md.slice(-6)));var w=null!==(i=null!==(n=null==m?void 0:m.currentSessionId)&&void 0!==n?n:null==g?void 0:g.nextSessionId)&&void 0!==i?i:this.$r,b=null!==(s=null!==(a=null==m?void 0:m.currentWindowId)&&void 0!==a?a:null==g?void 0:g.nextWindowId)&&void 0!==s?s:this.Dr;if(!0!==this.Zh||function(t){return br(t)||kr(t)||_r(t)}(p)){if(br(p)){var k=p.data.payload;k&&(p.timestamp=k.lastActivityTimestamp+k.threshold)}var S=null===(o=this._instance.config.session_recording.compress_events)||void 0===o||o;if(this.Ad>0||S&&vr(p))this.Lc(p,S,w,b);else{var I=S?gr(p):{event:p,size:Zt(p)};this.xc(p,I.event,I.size,w,b)}}}}}}get status(){return this.Uh?this.Uh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Wh,rrwebError:this.Yh,urlTriggerMatching:this.dh,eventTriggerMatching:this.fh,linkedFlagMatching:this.ph,remoteConfig:this.Tl}):Mt}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.ph.linkedFlagSeen=!0,this.xh(),this.vc(),this.Rh("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[ft]:this.sessionId,[lt]:null}),this.xh(),this.vc(),this.Rh("sampling_overridden")}overrideTrigger(t){this.gc(t),this.vc()}$c(){try{var e,r=null==t||null==(e=t.location)?void 0:e.href;if(!r)return;var i=this.nc(r);if(!i)return;return new URL(i).hostname||void 0}catch(t){return}}_c(){this.Bc&&(clearTimeout(this.Bc),this.Bc=void 0)}Rc(){this.Bc||(this.Bc=setTimeout((()=>{this.Vd()}),2e3))}Vd(){var t;if(this._c(),this.Jh)return this.O;null==(t=this.Uh)||t.ensureSamplingDecision(this.sessionId);var e=this.jd();if(this.status===xt||this.status===Tt||this.status===Mt||e)return this.Rc(),this.O;if(this.O.data.length>0){var r,i=this.$c();Qt(this.O).forEach((t=>{var e;null==(e=this.Pd)||e.trackSize(t.sessionId,t.size),this.Wc({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:F.LIB_NAME,$lib_version:F.LIB_VERSION,$snapshot_host:i})})),null==(r=this.Uh)||r.onFlushComplete()}return this.Zd()}Ac(t){var e,r=2+((null==(e=this.O)?void 0:e.data.length)||0),i=t.$session_id,n=this.O.sessionId!==i;(n||!0!==this.Zh&&!this.Jh&&this.O.size+t.$snapshot_bytes+r>Ke)&&(this.O=this.Vd(),n&&this.O.data.length>0&&(this.O=this.Zd()),this.O.sessionId=i,this.O.windowId=t.$window_id),this.Jh&&(this.Kh||this.O.size+t.$snapshot_bytes+r>Ke)?this.Kh||(this.Kh=!0,this.O=this.Zd()):(this.O.size+=t.$snapshot_bytes,this.O.data.push(t.$snapshot_data),this.O.sizes.push(t.$snapshot_bytes),!0===this.Zh||this.Jh||this.Rc())}Wc(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.jh),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get qd(){var t,e,r=null==(t=this.O)?void 0:t.data[(null==(e=this.O)?void 0:e.data.length)-1],i=this.$h.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}Dc(){if(!this.O||0===this.O.data.length)return this.Zd();for(var t=-1,e=this.O.data.length-1;e>=0;e--)if(this.O.data[e].type===h.Meta){t=e;break}return 0>t?this.Zd():(this.O.data=this.O.data.slice(t),this.O.sizes=this.O.sizes.slice(t),this.O.size=this.O.sizes.reduce(((t,e)=>t+e),0),this.O)}Zd(){return this.O={size:0,data:[],sizes:[],sessionId:this.$r,windowId:this.Dr},this.O}Rh(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Ye.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Lh("$recording_started",u({reason:t},e))}zc(t){var e;return 3===t.type&&-1!==tr.indexOf(null==(e=t.data)?void 0:e.source)}Pc(t){var e=this.zc(t);e||!0===this.Zh||t.timestamp-this.Hh>this.Bh&&(this.Zh=!0,clearInterval(this.cc),this.Lh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Hh,threshold:this.Bh,bufferLength:this.O.data.length,bufferSize:this.O.size}),this.Vd());var r=!1;if(e&&(this.Hh=t.timestamp,this.Zh)){var i="unknown"===this.Zh;this.Zh=!1,i||(this.Lh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}var n=this.$h.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.$r!==a,u=this.Dr!==s;if(this.Dr=s,this.$r=a,o||u){var l=o&&!1!==this.Zh;l&&(this.Zh="unknown"),this.Wd(l)}else e&&this.vc(),r&&this.dc()}Bd(){var t;null==(t=this.Uh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,r,i,n,s,a,o=this.$h.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.O.data.length,$sdk_debug_replay_internal_buffer_size:this.O.size,$sdk_debug_current_session_duration:this.qd,$sdk_debug_session_start:o.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this.Pd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Md,$snapshot_max_depth_exceeded:this._d,$sdk_debug_replay_slowest_full_snapshot_ms:Ve(null==(e=this.$d)?void 0:e.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Ve(null==(r=this.$d)?void 0:r.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(i=this.$d)?void 0:i.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(n=this.$d)?void 0:n.cssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==(s=this.$d)?void 0:s.deferredStylesheetCount,$sdk_debug_replay_slowest_mutation_batch_ms:Ve(null==(a=rr())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_rrweb_error:this.Yh,$sdk_debug_rrweb_attached:!!this.qh,$sdk_debug_rrweb_start_attempted:this.kd}}bc(){var t;if(!this.qh){this.kd=!0;var e,r,i,n={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,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:void 0,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(var a of Object.entries(s||{})){var o=a[0],l=a[1];if(o in n)if("maskInputOptions"===o)n.maskInputOptions=u({password:!0},l);else if("sampling"===o){var h=null!=l?l:{},d={};S(h.mousemove)||(d.mousemove=h.mousemove),S(h.mouseInteraction)||(d.mouseInteraction=h.mouseInteraction),n.sampling=d}else n[o]=l}this.Yd&&this.Yd.enabled&&(n.recordCanvas=!0,n.sampling=u({},n.sampling,{canvas:this.Yd.fps}),n.dataURLOptions={type:"image/webp",quality:this.Yd.quality},n.canvasResolutionScale=this.Xd,n.canvasMasking={configured:()=>{var t;return k(null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn)},regionsFn:t=>{var e,r=null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn;if(k(r))try{var i;return null!==(i=r(t))&&void 0!==i?i:null}catch(t){return this.Id||(this.Id=!0,Ye.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.Qd&&(n.maskAllInputs=null===(e=this.Qd.maskAllInputs)||void 0===e||e,n.maskTextSelector=null!==(r=this.Qd.maskTextSelector)&&void 0!==r?r:void 0,n.blockSelector=null!==(i=this.Qd.blockSelector)&&void 0!==i?i:void 0),this.Kd();var c=ir();if(c){this.Mc=null!==(t=this.Mc)&&void 0!==t?t:new Fe(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Ye.info(r,{node:e}),this.log(Xe+" "+r,"warn")}});var v=this.rc();if(this.qh=c(u({emit:t=>{this.onRRwebEmit(t)},plugins:v},n)),!this.qh)return this.Yh=!0,void Ye.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.Yh=!1,this.Hh=Date.now(),this.Zh=x(this.Zh)?this.Zh:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Tl),this.Lh("$session_options",{sessionRecordingOptions:n,activePlugins:v.map((t=>null==t?void 0:t.name))}),this.Lh("$posthog_config",{config:this._instance.config})}else Ye.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.Lh(t,e)}}var Ir,Mr=["type"],Cr=Object.defineProperty,Rr=(t,e,r)=>((t,e,r)=>e in t?Cr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),xr=(t=>(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))(xr||{}),Tr=(t=>(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))(Tr||{}),Ar=(t=>(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))(Ar||{}),Or=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Or||{}),Er=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Er||{}),Fr=(t=>(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))(Fr||{}),Nr=(t=>(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))(Nr||{});function Lr(t,e){return-1!==t.indexOf(e)}var Dr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Pr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},$r={};function Br(t){if($r[t])return $r[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in Dr?Dr[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in Pr?Pr[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return $r[t]=e.prototype,e.prototype;var o=document.createElement("iframe");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?(Lr(u=navigator.userAgent,"AppleWebKit")&&!Lr(u,"Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),$r[t]=d):r}catch(t){return r}finally{!l&&o.parentNode&&document.body.removeChild(o)}}var Wr={};function zr(t,e,r){var i,n=t+"."+String(r);if(Wr[n])return Wr[n].call(e);var s=Br(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(Wr[n]=a,a.call(e)):e[r]}var Ur={};function jr(t,e,r){var i=t+"."+String(r);if(Ur[i])return Ur[i].bind(e);var n=Br(t)[r];return"function"!=typeof n?e[r]:(Ur[i]=n,n.bind(e))}function qr(){return Br("MutationObserver").constructor}function Hr(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t[e];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else t[e]=n.next}}catch(t){return()=>{}}}var Gr={childNodes:t=>zr("Node",t,"childNodes"),parentNode:t=>zr("Node",t,"parentNode"),parentElement:t=>zr("Node",t,"parentElement"),textContent:t=>zr("Node",t,"textContent"),contains:(t,e)=>jr("Node",t,"contains")(e),getRootNode:t=>jr("Node",t,"getRootNode")(),host:t=>t&&"host"in t?zr("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?zr("Element",t,"shadowRoot"):null,querySelector:(t,e)=>jr("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>jr("Element",t,"querySelectorAll")(e),mutationObserver:qr,patch:Hr},Vr=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,deferredStylesheetCount:0});function Zr(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var Jr=0,Qr=0,Kr=Vr(),Xr=null,Yr=null,ti=[],ei={slowestBatchMs:0},ri=t=>t&&t>0?t:null,ii=32;function ni(t,e,r){var i=t.length;if(r>=ii)return i;for(var n=0;t.length>n;n++){var s=t[n];try{var a=s.cssRules;if(a&&a.length)i+=ni(a,e,r+1);else if(e&&s.styleSheet){var o=s.styleSheet;if(!e.has(o)){e.add(o);var u=o.rules||o.cssRules;u&&(i+=ni(u,e,r+1))}}}catch(t){}}return i}function si(t){return 0!==Jr&&null!==Yr&&(Kr.cssRuleCount>=Yr||Kr.cssRuleCount+function(t){try{var e=t&&(t.rules||t.cssRules);if(!e)return 0;var r=new WeakSet;return r.add(t),ni(e,r,0)}catch(t){return 0}}(t)>Yr)}function ai(t){return t.nodeType===t.ELEMENT_NODE}function oi(t){var e=t&&"host"in t&&"mode"in t&&Gr.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Gr.shadowRoot(e)===t)}function ui(t){return"[object ShadowRoot]"==={}.toString.call(t)}var li=0;function hi(t){var e,r,i=0===li,n=i?Zr():0;li+=1;try{var s=t.rules||t.cssRules;if(!s)return null;!function(t){0!==Jr&&(Kr.cssRuleCount+=ni(t,null,0))}(s);var a=t.href;return!a&&t.ownerNode&&(a=t.ownerNode.baseURI),(r=Array.from(s,(t=>di(t,a))).join("")).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),r}catch(t){return null}finally{li-=1,i&&(e=Zr()-n,Jr>0&&(Kr.stylesheetMs+=e))}}function di(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=hi(t.styleSheet)||function(t){var e=t.cssText;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return ki(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),e?ki(n,e):n}class ci{constructor(){Rr(this,"idNodeMap",new Map),Rr(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-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){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),ai(t)){var r=Gr.shadowRoot(t);r&&this.removeNodeFromMap(r),"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){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function vi(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&fi(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function fi(t){return t.toLowerCase()}var pi="__rrweb_original__";function mi(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?fi(e):null}catch(t){return null}}var gi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,yi=/^(?:[a-z+]+:)?\/\//i,wi=/^www\..*/i,bi=/^(data:)([^,]*),(.*)/i;function ki(t,e){return(t||"").replace(gi,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(yi.test(u)||wi.test(u))return"url("+l+u+l+")";if(bi.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var _i,Si,Ii="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",Mi=4096,Ci=1e5,Ri=10,xi=new Map,Ti=1,Ai=new RegExp("[^a-z0-9-_:]"),Oi=-2;function Ei(){return Ti++}var Fi=/^[^ \t\n\r\u000c]+/,Ni=/^[, \t\n\r\u000c]+/,Li=new WeakMap;function Di(t,e){return e&&""!==e.trim()?Pi(t,e):e}function Pi(t,e){var r=Li.get(t);if(r||(r=t.createElement("a"),Li.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function $i(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?Ii:t}(t,e.maxBase64ImageLength):t}function Bi(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=Di(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(Ci>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>Mi||t.naturalHeight>Mi)return e;var n=xi.get(e);if(n&&n.type===r&&n.quality===i)return n.result;try{var s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;var a=s.getContext("2d");if(!a)return e;a.drawImage(t,0,0);var o=s.toDataURL(r||"image/webp",null!=i?i:.4),u=e.length>o.length?o:e;if(xi.size>=Ri){var l=xi.keys().next().value;void 0!==l&&xi.delete(l)}return xi.set(e,{type:r,quality:i,result:u}),u}catch(t){return e}}(n,u,s.type,s.quality)),$i(l,s)}if("image"===e)return $i(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=Di(t,i);return"image"===e&&h.startsWith("data:")?$i(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(Ni),e.length>r;){var s=i(Fi);if(","===s.slice(-1))s=Di(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=Di(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?ki(i,Pi(t)):"object"===e&&"data"===r?Di(t,i):i:Di(t,i)}function Wi(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function zi(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&zi(Gr.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&zi(Gr.parentNode(t),e,r)}function Ui(t,e,r,i){var n;if(ai(t)){if(!Gr.childNodes(n=t).length)return!1}else{if(null===Gr.parentElement(t))return!1;n=Gr.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(zi(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}function ji(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var qi=new Map;function Hi(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function Gi(t){return null==t?"":t.toLowerCase()}var Vi=50,Zi=!1,Ji=!1;function Qi(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,v=void 0===c?{}:c,f=e.maskTextFn,p=e.maskInputFn,m=e.slimDOMOptions,g=e.dataURLOptions,y=void 0===g?{}:g,w=e.inlineImages,b=void 0!==w&&w,k=e.recordCanvas,_=void 0!==k&&k,S=e.canvasMaskingConfigured,I=e.onSerialize,M=e.onIframeLoad,C=e.iframeLoadTimeout,R=void 0===C?5e3:C,x=e.onIframeListenerRegistered,T=e.onStylesheetLoad,A=e.stylesheetLoadTimeout,O=void 0===A?5e3:A,E=e.keepIframeSrcFn,F=void 0===E?()=>!1:E,N=e.newlyAddedElement,L=void 0!==N&&N,D=e.depth,P=void 0===D?0:D,B=e.maxDepth,W=void 0===B?Vi:B,z=e.needsMask,U=e.preserveWhiteSpace,j=void 0===U||U;if(P>=W)return Ji=!0,Zi||(Zi=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=Ui(t,a,o,void 0===z)),Jr>0&&(Kr.nodeCount+=1);var q,H=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.canvasMaskingConfigured,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Nr.Document,childNodes:[],compatMode:t.compatMode}:{type:Nr.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Nr.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,a=e.doc,o=e.inlineStylesheet,u=e.maskInputOptions,l=void 0===u?{}:u,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.canvasMaskingConfigured,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=e.rootId,b=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,e.blockClass,e.blockSelector),k=function(t){if(t instanceof HTMLFormElement)return"form";var e=fi(t.tagName);return Ai.test(e)?"div":e}(t),_={},S=t.attributes.length,I=0;S>I;I++){var M=t.attributes[I];Wi(k,M.name)||(_[M.name]=Bi(a,k,fi(M.name),M.value,t,c))}if("link"===k&&o&&!b){var C=t.sheet;if(!C){var R=function(t){return t.href}(t);R&&!(C=Hi(a,R))&&R.includes(".css")&&(C=Hi(a,window.location.origin+"/"+R.replace(window.location.href,"")))}var x=null;C&&(si(C)?Jr>0&&ti.push(t):x=hi(C)),x&&(delete _.rel,delete _.href,_._cssText=x)}var T;if("style"===k&&t.sheet&&!(t.innerText||Gr.textContent(t)||"").trim().length){var A=hi(t.sheet);A&&(_._cssText=A)}if("input"===k||"textarea"===k||"select"===k){var O=t.value,E=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&O?_.value=vi({element:t,type:mi(t),tagName:k,value:O,maskInputOptions:l,maskInputFn:h}):E&&(_.checked=E)}if("option"===k&&(t.selected&&!l.select?_.selected=!0:delete _.selected),"dialog"===k&&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}if("canvas"===k&&f&&!(null==p?void 0:p()))if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((pi in n?n[pi]:n).call(e,r,i,Math.min(50,t.width-r),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)){var F=t.toDataURL(c.type,c.quality),N=a.createElement("canvas");N.width=t.width,N.height=t.height,F!==N.toDataURL(c.type,c.quality)&&(_.rr_dataURL=F)}if("img"===k&&v){_i||(_i=a.createElement("canvas"),Si=_i.getContext("2d"));var L=t,D=L.currentSrc||L.getAttribute("src")||"<unknown-src>",P=L.crossOrigin,B=()=>{ji(L,"load",B);try{_i.width=L.naturalWidth,_i.height=L.naturalHeight,Si.drawImage(L,0,0),_.rr_dataURL=_i.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==L.crossOrigin)return L.crossOrigin="anonymous",void(L.complete&&0!==L.naturalWidth?B():L.addEventListener("load",B));console.warn("Cannot inline img src="+D+"! Error: "+t)}"anonymous"===L.crossOrigin&&(P?_.crossOrigin=P:L.removeAttribute("crossorigin"))};L.complete&&0!==L.naturalWidth?B():L.addEventListener("load",B)}if("audio"===k||"video"===k){var W=_;W.rr_mediaState=t.paused?"paused":"played",W.rr_mediaCurrentTime=t.currentTime,W.rr_mediaPlaybackRate=t.playbackRate,W.rr_mediaMuted=t.muted,W.rr_mediaLoop=t.loop,W.rr_mediaVolume=t.volume}if(y||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),b){var z=t.getBoundingClientRect(),U=z.width,j=z.height,q=z.left,H=z.top,G=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);_={class:_.class,rr_width:U+"px",rr_height:j+"px",rr_left:Math.floor(q+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(H+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},G&&(_.rr_position=G.position||"static",G.transform&&"none"!==G.transform&&(_.rr_transform=G.transform),G.display&&G.display.startsWith("inline")&&(_.rr_display=G.display))}"iframe"!==k||m(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src);try{customElements.get(k)&&(s=!0)}catch(t){}return{type:Nr.Element,tagName:k,attributes:_,childNodes:[],isSVG:(T=t,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:b,rootId:w,isCustom:s}}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:c,inlineImages:v,recordCanvas:f,canvasMaskingConfigured:p,keepIframeSrcFn:m,newlyAddedElement:y,rootId:w});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=Gr.parentNode(t),o=a&&a.tagName,u=Gr.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(si(a.sheet));else if(null==(r=a.sheet)?void 0:r.cssRules){var d=hi(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=ki(u,Pi(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,Gr.parentElement(t)):u.replace(/[\S]/g,"*")),{type:Nr.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:w});case t.CDATA_SECTION_NODE:return{type:Nr.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:Nr.Comment,textContent:Gr.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,keepIframeSrcFn:F,newlyAddedElement:L});if(!H)return console.warn(t,"not serialized"),null;q=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===Nr.Comment)return!0;if(t.type===Nr.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,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Gi(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Gi(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Gi(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Gi(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Gi(t.attributes.property).match(/^(og|twitter|fb):/)||Gi(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Gi(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Gi(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(Gi(t.attributes.name))||Gi(t.attributes.property).match(/^article:/)||Gi(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(Gi(t.attributes.name)))return!0}}return!1}(H,m)||!j&&H.type===Nr.Text&&!H.isStyle&&!H.textContent.replace(/^\s+|\s+$/gm,"").length?Oi:Ei();var G=Object.assign(H,{id:q});if(i.add(t,G),q===Oi)return null;I&&I(t);var V=!l;if(G.type===Nr.Element){V=V&&!G.needBlock,delete G.needBlock;var Z=Gr.shadowRoot(t);Z&&ui(Z)&&(G.isShadowHost=!0)}if((G.type===Nr.Document||G.type===Nr.Element)&&V){m.headWhitespace&&G.type===Nr.Element&&"head"===G.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:M,iframeLoadTimeout:R,onIframeListenerRegistered:x,onStylesheetLoad:T,stylesheetLoadTimeout:O,keepIframeSrcFn:F,depth:P+1,maxDepth:W};if(G.type===Nr.Element&&"textarea"===G.tagName&&void 0!==G.attributes.value);else for(var Q of Array.from(Gr.childNodes(t))){var K=Qi(Q,J);K&&G.childNodes.push(K)}var X=null;if(ai(t)&&(X=Gr.shadowRoot(t)))for(var Y of Array.from(Gr.childNodes(X))){var tt=Qi(Y,J);tt&&(ui(X)&&(tt.isShadow=!0),G.childNodes.push(tt))}}var et=Gr.parentNode(t);if(et&&oi(et)&&ui(et)&&(G.isShadow=!0),G.type===Nr.Element&&"iframe"===G.tagName){var rt=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),ji(t,"load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?ji(t,"load",a):(o=!0,ji(t,"load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),ji(t,"load",a)}}return t.addEventListener("load",a),()=>{ji(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&M){var r=Qi(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:M,iframeLoadTimeout:R,onIframeListenerRegistered:x,onStylesheetLoad:T,stylesheetLoadTimeout:O,keepIframeSrcFn:F,depth:P+1,maxDepth:W});r&&M(t,r)}}),R);null==x||x(t,rt)}return G.type===Nr.Element&&"link"===G.tagName&&"stylesheet"===G.attributes.rel&&function(e,u,l){if(!qi.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,g=!1,w=()=>{if(!g){g=!0;try{(()=>{if(T){var e=Qi(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:S,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:M,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:O,keepIframeSrcFn:F,depth:P,maxDepth:W});e&&T(t,e)}})()}finally{qi.delete(e),c.abort()}}},k=setTimeout(w,l);c.signal.addEventListener("abort",(()=>clearTimeout(k)),{once:!0}),e.addEventListener("load",w,{signal:c.signal,once:!0}),qi.set(e,c)}}}(t,0,O),G}function Ki(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}class Xi{constructor(){Rr(this,"parentElement",null),Rr(this,"parentNode",null),Rr(this,"ownerDocument"),Rr(this,"firstChild",null),Rr(this,"lastChild",null),Rr(this,"previousSibling",null),Rr(this,"nextSibling",null),Rr(this,"ELEMENT_NODE",1),Rr(this,"TEXT_NODE",3),Rr(this,"nodeType"),Rr(this,"nodeName"),Rr(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof Xi))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.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 Yi(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>tn(r,t,e,i)}function tn(t,e,r,i){en((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function en(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var rn="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.",nn={map:{},getId(){return console.error(rn),-1},getNode(){return console.error(rn),null},removeNodeFromMap(){console.error(rn)},has(){return console.error(rn),!1},reset(){console.error(rn)}};function sn(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function an(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){if(setTimeout((()=>{try{r.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)}}}),()=>an(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(nn=new Proxy(nn,{get(t,e,r){return"map"===e&&console.error(rn),Reflect.get(t,e,r)}}));var on=Date.now;function un(t){var e,r,i,n,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=Gr.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.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=Gr.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function ln(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function hn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function dn(t){return t?t.nodeType===t.ELEMENT_NODE?t:Gr.parentElement(t):null}function cn(t,e,r,i){if(!t)return!1;var n=dn(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(zi(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function vn(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===Oi}function fn(t,e){if(oi(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=Gr.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||fn(i,e))}function pn(t){return Boolean(t.changedTouches)}function mn(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function gn(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function yn(t){return!!t&&(t instanceof Xi&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Gr.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(on=()=>(new Date).getTime());class wn{constructor(){Rr(this,"id",1),Rr(this,"styleIDMap",new WeakMap),Rr(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){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}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 bn(t){var e,r=null;return"getRootNode"in t&&(null==(e=Gr.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Gr.host(Gr.getRootNode(t))&&(r=Gr.host(Gr.getRootNode(t))),r}function kn(t){var e=t.ownerDocument;return!!e&&(Gr.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=bn(r);)r=e;return r}(t);return Gr.contains(e,r)}(t))}function _n(t){return"__ln"in t}class Sn{constructor(){Rr(this,"length",0),Rr(this,"head",null),Rr(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&_n(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&_n(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.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){var 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--)}}var In,Mn=(t,e)=>t+"@"+e;class Cn{constructor(){Rr(this,"frozen",!1),Rr(this,"locked",!1),Rr(this,"texts",[]),Rr(this,"attributes",[]),Rr(this,"attributeMap",new WeakMap),Rr(this,"removes",[]),Rr(this,"mapRemoves",[]),Rr(this,"movedMap",{}),Rr(this,"addedSet",new Set),Rr(this,"movedSet",new Set),Rr(this,"droppedSet",new Set),Rr(this,"removesSubTreeCache",new Set),Rr(this,"mutationCb"),Rr(this,"blockClass"),Rr(this,"blockSelector"),Rr(this,"maskTextClass"),Rr(this,"maskTextSelector"),Rr(this,"inlineStylesheet"),Rr(this,"maskInputOptions"),Rr(this,"maskTextFn"),Rr(this,"maskInputFn"),Rr(this,"keepIframeSrcFn"),Rr(this,"recordCanvas"),Rr(this,"canvasMaskingConfigured"),Rr(this,"inlineImages"),Rr(this,"slimDOMOptions"),Rr(this,"dataURLOptions"),Rr(this,"doc"),Rr(this,"mirror"),Rr(this,"iframeManager"),Rr(this,"stylesheetManager"),Rr(this,"shadowDomManager"),Rr(this,"canvasManager"),Rr(this,"processedNodeManager"),Rr(this,"unattachedDoc"),Rr(this,"canvasManagerReleased",!1),Rr(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),Rr(this,"emit",(()=>{if(!this.frozen&&!this.locked){var t,e=Zr();try{this.processBufferedMutations()}finally{(t=Zr()-e)>ei.slowestBatchMs&&(ei.slowestBatchMs=t)}}})),Rr(this,"processBufferedMutations",(()=>{for(var t=[],e=new Set,r=new Sn,i=t=>{for(var e=t,r=Oi;r===Oi;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=Gr.parentNode(n);if(s&&kn(n)&&"TEXTAREA"!==s.tagName){var a=oi(s)?this.mirror.getId(bn(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=Qi(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{mn(t,this.mirror)&&this.iframeManager.addIframe(t),gn(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),yn(n)&&this.shadowDomManager.addShadowRoot(Gr.shadowRoot(n),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)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)xn(this.removesSubTreeCache,s)&&!this.movedSet.has(Gr.parentNode(s))||n(s);for(var a of this.addedSet)Tn(this.droppedSet,a)||xn(this.removesSubTreeCache,a)?Tn(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(Gr.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var v=this.mirror.getId(Gr.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=Gr.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=Gr.host(f);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var m={texts:this.texts.map((t=>{var e=t.node,r=Gr.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var e=t.attributes;if("string"==typeof e.style){var r=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>r.length&&(r+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}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};(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(m))})),Rr(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),Rr(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(Gr.childNodes(t),(t=>Gr.textContent(t)||"")).join("");e.attributes.value=vi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:mi(t),value:r,maskInputFn:this.maskInputFn})})),Rr(this,"processMutation",(t=>{if(!vn(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=Gr.textContent(t.target);cn(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Ui(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,dn(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break;case"attributes":var r=t.target,i=t.attributeName,n=t.target.getAttribute(i);if("value"===i){var s=mi(r);n=vi({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(cn(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;var a=this.attributeMap.get(t.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(a||(this.attributes.push(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===r.tagName&&"password"===(t.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!Wi(r.tagName,i))if(a.attributes[i]=Bi(this.doc,fi(r.tagName),fi(i),n,r,this.dataURLOptions),"style"===i){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var u of(t.oldValue&&(o.style.cssText=t.oldValue),Array.from(r.style))){var l=r.style.getPropertyValue(u),h=r.style.getPropertyPriority(u);l!==o.style.getPropertyValue(u)||h!==o.style.getPropertyPriority(u)?a.styleDiff[u]=""===h?l:[l,h]:a._unchangedStyles[u]=[l,h]}for(var d of Array.from(o.style))""===r.style.getPropertyValue(d)&&(a.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(cn(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=>{var r=this.mirror.getId(e),i=oi(t.target)?this.mirror.getId(Gr.host(t.target)):this.mirror.getId(t.target);cn(t.target,this.blockClass,this.blockSelector,!1)||vn(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Rn(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||fn(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Mn(r,i)]?Rn(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!oi(t.target)||!ui(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),Gr.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),Rr(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(vn(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Mn(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);cn(t,this.blockClass,this.blockSelector,!1)||(Gr.childNodes(t).forEach((t=>this.genAdds(t))),yn(t)&&Gr.childNodes(Gr.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","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(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function Rn(t,e){t.delete(e),Gr.childNodes(e).forEach((e=>Rn(t,e)))}function xn(t,e,r){return 0!==t.size&&function(t,e,r){var i=Gr.parentNode(e);return!!i&&t.has(i)}(t,e)}function Tn(t,e){return 0!==t.size&&An(t,e)}function An(t,e){var r=Gr.parentNode(e);return!!r&&(!!t.has(r)||An(t,r))}var On=t=>In?function(){try{return t(...arguments)}catch(t){if(In&&!0===In(t))return;throw t}}:t,En=[];function Fn(t){try{if("composedPath"in t){var 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 Nn(t,e){var r=new Cn;En.push(r),r.init(t);var i=new(qr())(On(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),i.observe(e,n),{observer:i,buffer:r}}function Ln(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=Fn(t);if(a&&!cn(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=un(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[Yi("scroll",On(sn(On((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(Yi("scrollend",On(u),r)),()=>l.forEach((t=>t()))}function Dn(t,e){for(var r=En.length-1;r>=0;r--){var i=En[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),En.splice(r,1))}}}var Pn=["INPUT","TEXTAREA","SELECT"],$n=new WeakMap;function Bn(t){return function t(e,r){if(jn("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||jn("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||jn("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||jn("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function Wn(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function zn(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:Gr.host(e));var o="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),On((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function Un(t,e){void 0===e&&(e={});var r,i,n=t.doc.defaultView;if(!n)return()=>{};if(function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e),t.recordDOM){var s=Nn(t,t.doc);r=s.observer,i=s.buffer}var a,o,l,h,d,c,v,f,p,m=function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,u=[],l=sn(On((t=>{var r=Date.now()-s;e(u.map((t=>(t.timeOffset-=r,t))),t),u=[],s=null})),o),h=On(sn(On((t=>{var e=Fn(t),r=pn(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=on()),u.push({x:i,y:a,id:n.getId(e),timeOffset:on()-s}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?Tr.Drag:t instanceof MouseEvent?Tr.MouseMove:Tr.TouchMove)})),a,{trailing:!1})),d=[Yi("mousemove",h,i),Yi("touchmove",h,i),Yi("drag",h,i)];return On((()=>{d.forEach((t=>t()))}))}(t),g=function(t){var e=t.mouseInteractionCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling;if(!1===a.mouseInteraction)return()=>{};var o=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,l=[],h=null;return Object.keys(Ar).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t])).forEach((t=>{var a=fi(t),o=(t=>r=>{var a=Fn(r);if(!cn(a,n,s,!0)){var o=null,l=t;if("pointerType"in r){switch(r.pointerType){case"mouse":o=Or.Mouse;break;case"touch":o=Or.Touch;break;case"pen":o=Or.Pen}o===Or.Touch&&(Ar[t]===Ar.MouseDown?l="TouchStart":Ar[t]===Ar.MouseUp&&(l="TouchEnd"))}else pn(r)&&(o=Or.Touch);null!==o?(h=o,(l.startsWith("Touch")&&o===Or.Touch||l.startsWith("Mouse")&&o===Or.Mouse)&&(o=null)):Ar[t]===Ar.Click&&(o=h,h=null);var d=pn(r)?r.changedTouches[0]:r;if(d){var c=i.getId(a),v=d.clientX,f=d.clientY;On(e)(u({type:Ar[l],id:c,x:v,y:f},null!==o&&{pointerType:o}))}}})(t);if(window.PointerEvent)switch(Ar[t]){case Ar.MouseDown:case Ar.MouseUp:a=a.replace("mouse","pointer");break;case Ar.TouchStart:case Ar.TouchEnd:return}l.push(Yi(a,o,r))})),On((()=>{l.forEach((t=>t()))}))}(t),y=Ln(t),w=function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return Yi("resize",On(sn(On((()=>{var t=ln(),e=hn();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:n}),b=function(t){var e=t.inputCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.ignoreClass,o=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=Fn(t),i=t.isTrusted,u=r.defaultView;if(!e||!u||e instanceof u.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=Gr.parentElement(e)),e&&c&&Pn.indexOf(c)>=0&&!cn(e,n,s,!0)&&!(e.classList.contains(a)||o&&e.matches(o))){var f=e.value,p=!1,m=mi(e)||"";"radio"===m||"checkbox"===m?p=e.checked:(l[c.toLowerCase()]||l[m])&&(f=vi({element:e,maskInputOptions:l,tagName:c,type:m,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:i}:{text:f,isChecked:p});var g=e.name;"radio"===m&&g&&p&&r.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,r){var n=$n.get(t);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){$n.set(t,r);var s=i.getId(t);On(e)(u({},r,{id:s}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>Yi(t,On(c),r))),p=r.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&f.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=>an(t[0],t[1],{set(){On(c)({target:this,isTrusted:!1})}},!1,p)))),On((()=>{f.forEach((t=>t()))}))}(t),k=(o=(a=t).mediaInteractionCb,l=a.blockClass,h=a.blockSelector,d=a.mirror,c=a.sampling,v=a.doc,f=On((t=>sn(On((e=>{var r=Fn(e);if(r&&!cn(r,l,h,!0)){var i=r.currentTime,n=r.volume,s=r.muted,a=r.playbackRate,u=r.loop;o({type:t,id:d.getId(r),currentTime:i,volume:n,muted:s,playbackRate:a,loop:u})}})),c.media||500))),p=[Yi("play",f(Fr.Play),v),Yi("pause",f(Fr.Pause),v),Yi("seeked",f(Fr.Seeked),v),Yi("volumechange",f(Fr.VolumeChange),v),Yi("ratechange",f(Fr.RateChange),v)],On((()=>{p.forEach((t=>t()))}))),_=()=>{},S=()=>{},I=()=>{},M=()=>{};t.recordDOM&&(_=function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:On(((t,e,s)=>{var a=s[0],o=s[1],u=Wn(e,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:o}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var o,u,l=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:a}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replaceSync:a}),t.apply(e,s)}))}));var h={};qn("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(qn("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),qn("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),qn("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var e=t[0],s=t[1];d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:On(((t,e,s)=>{var a=s[0],o=s[1],u=Wn(e.parentStyleSheet,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:[...Bn(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:On(((t,e,s)=>{var a=s[0],o=Wn(e.parentStyleSheet,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:[...Bn(e),a]}]}),t.apply(e,s)}))})})),On((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=l,o&&(s.CSSStyleSheet.prototype.replace=o),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(h).forEach((t=>{var e=t[0],r=t[1];r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:n}),S=zn(t,t.doc),I=function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:On(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2];if(n.has(l))return o.apply(e,[l,h,d]);var c=Wn(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror),v=c.id,f=c.styleId;return(v&&-1!==v||f&&-1!==f)&&r({id:v,styleId:f,set:{property:l,value:h,priority:d},index:Bn(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:On(((t,e,a)=>{var o,l=a[0];if(n.has(l))return u.apply(e,[l]);var h=Wn(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror),d=h.id,c=h.styleId;return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:l},index:Bn(e.parentRule)}),t.apply(e,a)}))}),On((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:n}),t.collectFonts&&(M=function(t){var e=t.fontCb,r=t.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=Hr(r.fonts,"add",(function(t){return function(r){return setTimeout(On((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),On((()=>{n.forEach((t=>t()))}))}(t)));var C=function(t){var e=t.doc,r=t.mirror,i=t.blockClass,n=t.blockSelector,s=t.selectionCb,a=!0,o=On((()=>{var t=e.getSelection();if(!(!t||a&&(null==t?void 0:t.isCollapsed))){a=t.isCollapsed||!1;for(var o=[],u=t.rangeCount||0,l=0;u>l;l++){var h=t.getRangeAt(l),d=h.startContainer,c=h.startOffset,v=h.endContainer,f=h.endOffset;cn(d,i,n,!0)||cn(v,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(v),endOffset:f})}s({ranges:o})}}));return o(),Yi("selectionchange",o)}(t),R=function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?Hr(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t),x=[];for(var T of t.plugins)x.push(T.observer(T.callback,n,T.options));return On((()=>{if(i){i.destroy(),i.reset();var e=En.indexOf(i);-1!==e&&En.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect(),m(),g(),y(),w(),b(),k(),_(),S(),I(),M(),C(),R(),x.forEach((t=>t()))}))}function jn(t){return void 0!==window[t]}function qn(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class Hn{constructor(t){Rr(this,"iframeIdToRemoteIdMap",new WeakMap),Rr(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){var n=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=n.get(e);return a||(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i=r||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:i.get(e)||-1}getRemoteIds(t,e){var r=this.getRemoteIdToIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){var e=this.iframeIdToRemoteIdMap.get(t);return e||this.iframeIdToRemoteIdMap.set(t,e=new Map),e}getRemoteIdToIdMap(t){var e=this.iframeRemoteIdToIdMap.get(t);return e||this.iframeRemoteIdToIdMap.set(t,e=new Map),e}}class Gn{constructor(t){Rr(this,"iframes",new WeakMap),Rr(this,"crossOriginIframeMap",new WeakMap),Rr(this,"crossOriginIframeMirror",new Hn(Ei)),Rr(this,"crossOriginIframeStyleMirror"),Rr(this,"crossOriginIframeRootIdMap",new WeakMap),Rr(this,"mirror"),Rr(this,"mutationCb"),Rr(this,"wrappedEmit"),Rr(this,"loadListener"),Rr(this,"pageHideListener"),Rr(this,"stylesheetManager"),Rr(this,"recordCrossOriginIframes"),Rr(this,"messageHandler"),Rr(this,"nestedIframeListeners",new Map),Rr(this,"attachedWindows",new WeakMap),Rr(this,"attachedDocuments",new WeakMap),Rr(this,"attachedIframes",new Map),Rr(this,"loadListenerDisposers",new WeakMap),Rr(this,"iframeElementsById",new Map),Rr(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hn(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){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>en(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{tn(t.win,"pagehide",t.handler)})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);en((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}en((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.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){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case xr.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:xr.IncrementalSnapshot,data:{source:Tr.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case xr.Meta:case xr.Load:case xr.DomContentLoaded:return!1;case xr.Plugin:return e;case xr.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case xr.IncrementalSnapshot:switch(e.data.source){case Tr.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),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 Tr.Drag:case Tr.TouchMove:case Tr.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case Tr.ViewportResize:return!1;case Tr.MediaInteraction:case Tr.MouseInteraction:case Tr.Scroll:case Tr.CanvasMutation:case Tr.Input:return this.replaceIds(e.data,t,["id"]),e;case Tr.StyleSheetRule:case Tr.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Tr.Font:return e;case Tr.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case Tr.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}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===Nr.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(tn(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(tn(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{en((()=>this.mirror.removeNodeFromMap(t)))})),en((()=>Dn(r,s))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var r=t.content;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&tn(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{tn(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),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}}class Vn{constructor(t){Rr(this,"shadowDoms",new WeakSet),Rr(this,"mutationCb"),Rr(this,"scrollCb"),Rr(this,"bypassOptions"),Rr(this,"mirror"),Rr(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 r,i;if(ui(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var n=null!==(r=null==(i=Gr.host(t))?void 0:i.ownerDocument)&&void 0!==r?r:e,s=Nn(u({},this.bypassOptions,{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),a=s.observer,o=s.buffer;this.restoreHandlers.push({doc:n,handler(){a.disconnect(),o.destroy(),o.releaseCanvasManager();var t=En.indexOf(o);-1!==t&&En.splice(t,1)}}),this.restoreHandlers.push({doc:n,handler:Ln(u({},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(Gr.host(t))),this.restoreHandlers.push({doc:n,handler:zn({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){var r=this;this.restoreHandlers.push({doc:e,handler:Hr(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=Gr.shadowRoot(this);return s&&kn(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}var Zn="skip-frame";function Jn(t){if("object"!=typeof t||null===t)return!1;var e=t.y,r=t.width,i=t.height;return Number.isFinite(t.x)&&Number.isFinite(e)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var Qn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Xn=0;64>Xn;Xn++)Kn[Qn.charCodeAt(Xn)]=Xn;var Yn=new Map,ts=(t,e,r)=>{if(t&&(is(t,e)||"object"==typeof t)){var i=function(t,e){var r=Yn.get(t);return r||Yn.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function es(t,e,r,i){if(t instanceof Array)return t.map((t=>es(t,e,r,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){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=Qn[r[e]>>2],n+=Qn[(3&r[e])<<4|r[e+1]>>4],n+=Qn[(15&r[e+1])<<2|r[e+2]>>6],n+=Qn[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}return t instanceof DataView?{rr_type:t.constructor.name,args:[es(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[es(t.data,e,r,i),t.width,t.height]}:is(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ts(t,e,r)}:t}var rs=(t,e,r,i)=>t.map((t=>es(t,e,r,i))),is=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},ns=["webgl","webgl2"];function ss(t){return"nodeType"in t}function as(t,e,r,i){var n=[];try{if(i){var s=function(t,e,r){var i=t.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return Hr(i.prototype,"configure",(function(i){return function(n){var s=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!s||ss(s)&&cn(s,e,r,!0))return i.call(this,n);ss(s)&&!("__context"in s)&&(s.__context="webgpu");var a=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return i.call(this,null!==a&&n?u({},n,{usage:"number"==typeof n.usage?n.usage|a:a}):n)}}))}(t,e,r);s&&n.push(s)}var a=Hr(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(n){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(n),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!cn(this,e,r,!0)&&("__context"in this||(this.__context=s),i&&ns.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[n,...o])}}));n.push(a)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((t=>t()))}}function os(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=Hr(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(ts(d,s,this),"tagName"in this.canvas&&!cn(this.canvas,i,n,!0)){var c=rs(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=an(t,u,{set(t){r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var us,ls,hs,ds='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n',cs="undefined"!=typeof self&&self.Blob&&new Blob([ds],{type:"text/javascript;charset=utf-8"});function vs(t){var e;try{if(!(e=cs&&(self.URL||self.webkitURL).createObjectURL(cs)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(ds),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class fs{constructor(t){Rr(this,"pendingCanvasMutations",new Map),Rr(this,"rafStamps",{latestId:0,invokeId:null}),Rr(this,"mirror"),Rr(this,"mutationCb"),Rr(this,"resetObservers"),Rr(this,"frozen",!1),Rr(this,"locked",!1),Rr(this,"rafIdTimestamp",null),Rr(this,"rafIdFlush",null),Rr(this,"refCount",0),Rr(this,"torndown",!1),Rr(this,"resetFrameDedup",null),Rr(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)}));var e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,a=t.recordCanvas,o=t.dataURLOptions,u=t.resolutionScale,l=t.canvasMasking;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&"all"===r&&this.initCanvasMutationObserver(i,n,s,o),a&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:o,resolutionScale:u,canvasMasking:l})}onFullSnapshot(){var t;null==(t=this.resetFrameDedup)||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}initCanvasFPSObserver(t,e,r,i,n){var s=this;if("OffscreenCanvas"in e){var a,u="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,l=as(e,r,i,!0),h=new Map;try{a=new vs}catch(t){return}var d=!1;a.onerror=()=>{var t;d=!0,cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a),this.resetFrameDedup=null},this.resetFrameDedup=()=>{a.postMessage({resetFrameDedup:!0})},a.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:Er["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var c,v=1e3/t,f=0,p=t=>{var l,m;d||(f&&v>t-f||(f=t,(l=[],m=t=>{try{t.querySelectorAll("canvas").forEach((t=>{cn(t,r,i,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&m(t.shadowRoot)}))}catch(t){}},m(e.document),l).forEach(function(){var t=o((function*(t){var e,r,i=s.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var o=t.getContext(t.__context);if(null==(e=null==o?void 0:o.isContextLost)?void 0:e.call(o))return void h.set(i,!1);!1===(null==(r=null==o?void 0:o.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=function(t,e,r,i,n,s){if(t&&"function"==typeof t.regionsFn){var a;try{a=t.regionsFn(e)}catch(t){return Zn}if(void 0!==a){if(!Array.isArray(a)||!a.every(Jn))return Zn;var o=r/n,u=i/s;return a.filter((t=>t.width>0&&t.height>0)).map((t=>{var e=Math.floor(t.x*o),r=Math.floor(t.y*u);return{x:e,y:r,width:Math.ceil((t.x+t.width)*o)-e,height:Math.ceil((t.y+t.height)*u)-r}}))}}}(n.canvasMasking,t,c,v,l,d);if(f===Zn)return void h.set(i,!1);var p=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});a.postMessage({id:i,bitmap:p,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:n.dataURLOptions,maskRegions:f},[p])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),c=requestAnimationFrame(p))};c=requestAnimationFrame(p),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a),this.resetFrameDedup=null}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=as(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=Hr(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return cn(this.canvas,r,i,!0)||setTimeout((()=>{var r=rs(u,e,this,n);t(this.canvas,{type:Er["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(r){var u=an(e.CanvasRenderingContext2D.prototype,a,{set(e){t(this.canvas,{type:Er["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...os(e.WebGLRenderingContext.prototype,Er.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...os(e.WebGL2RenderingContext.prototype,Er.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,Mr)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class ps{constructor(t){Rr(this,"trackedLinkElements",new WeakSet),Rr(this,"mutationCb"),Rr(this,"adoptedStyleSheetCb"),Rr(this,"styleMirror",new wn),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}inlineDeferredLinkElement(t,e){if(-1!==e&&t.isConnected){var r=null;try{var i=t.sheet;i&&(r=hi(i))}catch(t){}r&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:r}}]})}}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;r.styleMirror.has(t)?e=r.styleMirror.getId(t):(e=r.styleMirror.add(t),n.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:di(e,t.href),index:r})))})),i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,qi.forEach((t=>t.abort())),qi.clear()}trackStylesheetInLinkElement(t){}}class ms{constructor(){Rr(this,"nodeMap",new WeakMap),Rr(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).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(){}}var gs=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var ys=document.createElement("iframe");document.body.appendChild(ys),Array.from=(null==(Ir=ys.contentWindow)?void 0:Ir.Array.from)||Array.from,document.body.removeChild(ys)}}catch(t){console.debug("Unable to override Array.from",t)}var ws=new ci,bs=new Set([Tr.Mutation,Tr.MediaInteraction,Tr.StyleSheetRule,Tr.CanvasMutation,Tr.Font,Tr.Log,Tr.StyleDeclaration,Tr.AdoptedStyleSheet]);function ks(t){var e=window;if("function"==typeof e.requestIdleCallback){var r=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null==(t=e.cancelIdleCallback)?void 0:t.call(e,r)}}}var i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function _s(t){var e;void 0===t&&(t={});var r=t,i=r.emit,n=r.checkoutEveryNms,s=r.checkoutEveryNth,a=r.blockClass,o=void 0===a?"rr-block":a,l=r.blockSelector,h=void 0===l?null:l,d=r.ignoreClass,c=void 0===d?"rr-ignore":d,v=r.ignoreSelector,f=void 0===v?null:v,p=r.maskTextClass,m=void 0===p?"rr-mask":p,g=r.maskTextSelector,y=void 0===g?null:g,w=r.inlineStylesheet,b=void 0===w||w,k=r.inlineStylesheetBudgetRules,_=void 0===k?1e4:k,S=r.maskAllInputs,I=r.maskInputOptions,M=r.slimDOMOptions,C=r.maskInputFn,R=r.maskTextFn,x=r.hooks,T=r.packFn,A=r.sampling,O=void 0===A?{}:A,E=r.dataURLOptions,F=void 0===E?{}:E,N=r.canvasResolutionScale,L=r.canvasMasking,D=r.mousemoveWait,P=r.recordDOM,B=void 0===P||P,W=r.recordCanvas,z=void 0!==W&&W,U=r.recordCrossOriginIframes,j=void 0!==U&&U,q=r.recordAfter,H=void 0===q?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":q,G=r.userTriggeredOnInput,V=void 0!==G&&G,Z=r.collectFonts,J=void 0!==Z&&Z,Q=r.inlineImages,K=void 0!==Q&&Q,X=r.plugins,Y=r.keepIframeSrcFn,tt=void 0===Y?()=>!1:Y,et=r.ignoreCSSAttributes,rt=void 0===et?new Set([]):et,it=r.attributeFilter;In=r.errorHandler;var nt=u({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},F),st=!j||window.parent===window,at=!1;if(!st)try{window.parent.document&&(at=!1)}catch(t){at=!0}if(st&&!i)throw new Error("emit function is required");if(!st&&!at)return()=>{};void 0!==D&&void 0===O.mousemove&&(O.mousemove=D),ws.reset();var ot,ut=!0===S?{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!==I?I:{password:!0},lt=Ki(void 0!==M&&M);!function(t){void 0===t&&(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)}();var ht,dt,ct=0,vt=new Map,ft=t=>{for(var e of X||[])e.eventProcessor&&(t=e.eventProcessor(t));return T&&!at&&(t=T(t)),t};us=(t,e)=>{var r,a=t;if(a.timestamp=on(),!(null==(r=En[0])?void 0:r.isFrozen())||a.type===xr.FullSnapshot||a.type===xr.IncrementalSnapshot&&bs.has(a.data.source)||En.forEach((t=>t.unfreeze())),st)null==i||i(ft(a),e);else if(at){var o={type:"rrweb",event:ft(a),origin:window.location.origin,isCheckout:e};window.parent.postMessage(o,"*")}if(a.type===xr.FullSnapshot)ot=a,ct=0;else if(a.type===xr.IncrementalSnapshot){if(a.data.source===Tr.Mutation&&a.data.isAttachIframe)return;ct++,(s&&ct>=s||n&&a.timestamp-ot.timestamp>n)&&ls(!0)}};var pt=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,r=new Set;if(t.adds.length>0)for(var i of t.adds){var n=ws.getNode(i.node.id);n&&"IFRAME"===n.nodeName&&r.add(n)}t.removes.forEach((t=>{var i=t.id;if(!e||!e.has(i)){var n=wt.getIframeElementById(i);n&&r.has(n)?wt.forgetIframeId(i):(null==ht||ht(i),wt.removeIframeById(i))}})),null==dt||dt(),wt.cleanupDetachedIframes()}us({type:xr.IncrementalSnapshot,data:u({source:Tr.Mutation},t)})},mt=t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.Scroll},t)}),gt=t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.CanvasMutation},t)}),yt=new ps({mutationCb:pt,adoptedStyleSheetCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.AdoptedStyleSheet},t)})}),wt=new Gn({mirror:ws,mutationCb:pt,stylesheetManager:yt,recordCrossOriginIframes:j,wrappedEmit:us});for(var bt of X||[])bt.getMirror&&bt.getMirror({nodeMirror:ws,crossOriginIframeMirror:wt.crossOriginIframeMirror,crossOriginIframeStyleMirror:wt.crossOriginIframeStyleMirror});var kt=new ms,_t=null==L?void 0:L.configured;hs=new fs({recordCanvas:z,mutationCb:gt,win:window,blockClass:o,blockSelector:h,mirror:ws,sampling:O.canvas,dataURLOptions:nt,resolutionScale:N,canvasMasking:L});var St=new Vn({mutationCb:pt,scrollCb:mt,bypassOptions:{blockClass:o,blockSelector:h,maskTextClass:m,maskTextSelector:y,inlineStylesheet:b,maskInputOptions:ut,dataURLOptions:nt,maskTextFn:R,maskInputFn:C,recordCanvas:z,canvasMaskingConfigured:_t,inlineImages:K,sampling:O,slimDOMOptions:lt,iframeManager:wt,stylesheetManager:yt,canvasManager:hs,keepIframeSrcFn:tt,processedNodeManager:kt,attributeFilter:it},mirror:ws});ls=function(t){if(void 0===t&&(t=!1),B){us({type:xr.Meta,data:{href:window.location.href,width:hn(),height:ln()}},t),null==e||e(),e=void 0,yt.reset(),St.init(),En.forEach((t=>t.lock()));var r,i,n=null;try{n=function(t,e){var r,i=e||{},n=i.mirror,s=void 0===n?new ci:n,a=i.blockClass,o=void 0===a?"rr-block":a,u=i.blockSelector,l=void 0===u?null:u,h=i.maskTextClass,d=void 0===h?"rr-mask":h,c=i.maskTextSelector,v=void 0===c?null:c,f=i.inlineStylesheet,p=void 0===f||f,m=i.inlineImages,g=void 0!==m&&m,y=i.recordCanvas,w=void 0!==y&&y,b=i.canvasMaskingConfigured,k=i.maskAllInputs,_=void 0!==k&&k,S=i.maskTextFn,I=i.maskInputFn,M=i.slimDOM,C=i.dataURLOptions,R=i.preserveWhiteSpace,x=i.onSerialize,T=i.onIframeLoad,A=i.iframeLoadTimeout,O=i.onIframeListenerRegistered,E=i.onStylesheetLoad,F=i.stylesheetLoadTimeout,N=i.keepIframeSrcFn,L=void 0===N?()=>!1:N,D=i.maxDepth,P=i.inlineStylesheetBudgetRules,B=!0===_?{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===_?{password:!0}:_,W=Ki(void 0!==M&&M);r=P,(Jr+=1)>1||(Kr=Vr(),ti=[],Yr=ri(r),Qr=Zr());try{return Qi(t,{doc:t,mirror:s,blockClass:o,blockSelector:l,maskTextClass:d,maskTextSelector:v,skipChild:!1,inlineStylesheet:p,maskInputOptions:B,maskTextFn:S,maskInputFn:I,slimDOMOptions:W,dataURLOptions:C,inlineImages:g,recordCanvas:w,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:x,onIframeLoad:T,iframeLoadTimeout:A,onIframeListenerRegistered:O,onStylesheetLoad:E,stylesheetLoadTimeout:F,keepIframeSrcFn:L,newlyAddedElement:!1,maxDepth:D})}finally{0===Jr?Xr||Vr():(Jr-=1)>0||(Kr.durationMs=Zr()-Qr,Kr.deferredStylesheetCount=ti.length,Yr=null,Xr=Kr)}}(document,{mirror:ws,blockClass:o,blockSelector:h,maskTextClass:m,maskTextSelector:y,inlineStylesheet:b,maskAllInputs:ut,inlineStylesheetBudgetRules:_,maskTextFn:R,maskInputFn:C,slimDOM:lt,dataURLOptions:nt,recordCanvas:z,canvasMaskingConfigured:_t,inlineImages:K,onSerialize(t){mn(t,ws)&&wt.addIframe(t),gn(t,ws)&&yt.trackLinkElement(t),yn(t)&&St.addShadowRoot(Gr.shadowRoot(t),document)},onIframeLoad(t,e){wt.attachIframe(t,e),St.observeAttachShadow(t)},onIframeListenerRegistered(t,e){wt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){yt.attachLinkElement(t,e)},keepIframeSrcFn:tt})}finally{r=ti,ti=[],i=r}if(!n)return console.warn("Failed to snapshot the document");us({type:xr.FullSnapshot,data:{node:n,initialOffset:un(window)}},t),En.forEach((t=>t.unlock())),hs.onFullSnapshot(),i.length&&(e=function(t,r,i){var n=!1,s=null,a=0,o=i=>{if(s=null,!n){var u=function(){var e=t[a];t[a]=null,a+=1,e&&en((()=>r.inlineDeferredLinkElement(e,ws.getId(e))))};do{u()}while(t.length>a&&i&&!i.didTimeout&&i.timeRemaining()>5);t.length>a?s=ks(o):e=void 0}};return s=ks(o),()=>{n=!0,null==s||s.cancel(),s=null}}(i,yt)),j&&wt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&yt.adoptStyleSheets(document.adoptedStyleSheets,ws.getId(document))}};try{var It=[];ht=t=>{var e=vt.get(t);e&&(e.forEach((t=>{en(t);var e=It.indexOf(t);-1!==e&&It.splice(e,1)})),vt.delete(t))},dt=()=>{for(var t of vt){var e=t[0],r=ws.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==ht||ht(e)}catch(t){null==ht||ht(e)}else null==ht||ht(e)}};var Mt=t=>{var e;return On(Un)({mutationCb:pt,mousemoveCb:(t,e)=>us({type:xr.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.MouseInteraction},t)}),scrollCb:mt,viewportResizeCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.ViewportResize},t)}),inputCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.Input},t)}),mediaInteractionCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.MediaInteraction},t)}),styleSheetRuleCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.StyleSheetRule},t)}),styleDeclarationCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.StyleDeclaration},t)}),canvasMutationCb:gt,fontCb:t=>us({type:xr.IncrementalSnapshot,data:u({source:Tr.Font},t)}),selectionCb(t){us({type:xr.IncrementalSnapshot,data:u({source:Tr.Selection},t)})},customElementCb(t){us({type:xr.IncrementalSnapshot,data:u({source:Tr.CustomElement},t)})},blockClass:o,ignoreClass:c,ignoreSelector:f,maskTextClass:m,maskTextSelector:y,maskInputOptions:ut,inlineStylesheet:b,sampling:O,recordDOM:B,recordCanvas:z,canvasMaskingConfigured:_t,inlineImages:K,userTriggeredOnInput:V,collectFonts:J,doc:t,maskInputFn:C,maskTextFn:R,keepIframeSrcFn:tt,blockSelector:h,slimDOMOptions:lt,dataURLOptions:nt,mirror:ws,iframeManager:wt,stylesheetManager:yt,shadowDomManager:St,processedNodeManager:kt,canvasManager:hs,ignoreCSSAttributes:rt,attributeFilter:it,plugins:(null==(e=null==X?void 0:X.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>us({type:xr.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},x)};wt.addLoadListener((t=>{try{var e=ws.getId(t),r=Mt(t.contentDocument);if(It.push(r),-1!==e){var i=vt.get(e);i||vt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),wt.addPageHideListener((t=>{var e=ws.getId(t);null==ht||ht(e),Dn(t)}));var Ct=-1,Rt=t=>us({type:xr.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),xt=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?ws.getId(s):-1;a!==Ct&&(-1!==Ct&&Rt({id:Ct,enter:!1}),Ct=a,-1!==a&&Rt({id:a,enter:!0}))},Tt=()=>{ls(),It.push(Mt(document)),It.push(Yi("fullscreenchange",xt)),It.push(Yi("webkitfullscreenchange",xt)),It.push(Yi("mozfullscreenchange",xt)),It.push(Yi("MSFullscreenChange",xt)),gs=!0};return["interactive","complete"].includes(document.readyState)?Tt():(It.push(Yi("DOMContentLoaded",(()=>{us({type:xr.DomContentLoaded,data:{}}),"DOMContentLoaded"===H&&Tt()}))),It.push(Yi("load",(()=>{us({type:xr.Load,data:{}}),"load"===H&&Tt()}),window))),()=>{null==e||e(),e=void 0,It.forEach((t=>en(t))),kt.destroy(),wt.removeLoadListener(),wt.destroy(),vt.clear(),St.reset(),ws.reset(),gs=!1,In=void 0}}catch(t){console.warn(t)}}_s.addCustomEvent=(t,e)=>{if(!gs)throw new Error("please add custom event after start recording");us({type:xr.Custom,data:{tag:t,payload:e}})},_s.freezePage=()=>{En.forEach((t=>t.freeze()))},_s.takeFullSnapshot=t=>{if(!gs)throw new Error("please take full snapshot after start recording");ls(t)},_s.mirror=ws;var Ss=Object.defineProperty,Is=(t,e,r)=>((t,e,r)=>e in t?Ss(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Ms{constructor(t){Is(this,"fileName"),Is(this,"functionName"),Is(this,"lineNumber"),Is(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Cs=/(^|@)\S+:\d+/,Rs=/^\s*at .*(\S+:\d+|\(native\))/m,xs=/^(eval@)?(\[native code])?$/,Ts={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Rs)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var 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(Rs)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new Ms({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(xs)}),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 Ms({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Ms({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[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){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Ms({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Ms({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Cs)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Ms({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function As(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function Os(t){return Array.isArray(t)}function Es(t){return"object"==typeof t&&null!==t&&!Os(t)}function Fs(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(Es(t[i])&&Fs(t[i],e-1))return!0;return!1}function Ns(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Es(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||Es(a)&&Fs(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=Os(l)?As(l.length?l[0]:null):l}return o}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 Ls={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 Ds(t,e,r){var i,n=r?Object.assign({},Ls,r):Ls,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=Ts.parse(e.error).map((t=>t.toString())),s=[Ns(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[Ns("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Ns("Uncaught (in promise)",n.stringifyOptions),Ns(e.reason,n.stringifyOptions)]);var s=Ts.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h={next:l},d=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=Ts.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>Ns(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Ns("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=e[s];"function"==typeof t&&t.__rrweb_layer__;){var r=t.__rrweb_layer__;if(r.next===d)return void(r.next=h.next);t=r.next}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var Ps=t=>({name:"rrweb/console@1",observer:Ds,options:t}),$s=t=>"undefined"!=typeof Document&&t instanceof Document,Bs=()=>{};function Ws(t,e,r){try{if(!(e in t))return Bs;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return k(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e];k(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else t[e]=i.next}}catch(t){return Bs}}function zs(t,e){var r,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),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var Us=D("[Recorder]"),js=t=>"navigation"===t.entryType,qs=t=>"resource"===t.entryType;function Hs(t,e){return!!e&&(x(e)||e[t])}function Gs(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var Vs=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Zs(t){var e=t.type,r=t.recordBody,i=t.headers;function n(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Gs(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(Vs))return!1;if(x(r))return!0;if(b(r))return n(r);var s=r[e];return x(s)?s:n(s)}function Js(t,e,r,i,n,s){return Qs.apply(this,arguments)}function Qs(){return Qs=o((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return Us.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(qs(a=t[s])&&a.initiatorType===e&&(S(i)||a.startTime>=i)&&(S(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),Js(t,e,r,i,n,s+1))})),Qs.apply(this,arguments)}function Ks(t){var e=t.body,r=t.options,i=t.url;if(C(e))return null;var n=zs(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(I(e))return e;if($s(e))return e.textContent;if(T(e))return U(e);if(_(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var Xs=t=>!M(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Ys(t){var e=t.entry,r=t.method,i=t.status,n=t.networkRequest,s=t.isInitial,a=t.start,o=t.end,l=t.url,h=t.initiatorType;a=e?e.startTime:a,o=e?e.responseEnd:o;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(a||0)),v=[u({},e?e.toJSON():{name:l},{startTime:S(a)?void 0:Math.round(a),endTime:S(o)?void 0:Math.round(o),timeOrigin:d,timestamp:c,method:r,initiatorType:h||(e?e.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Xs(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var ta=["video/","audio/"];function ea(t){return _(t)&&k(t.getReader)&&k(t.tee)}var ra=500,ia="[SessionReplay] Timeout while trying to read body",na="[SessionReplay] Failed to read body";function sa(t){return na+": "+t}function aa(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function oa(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(ia)),ra);try{t.clone().text().then((t=>e(t)),(t=>e(sa(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(na)}}))}(t);var r=Y(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(aa(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(ia)),ra);try{o=t.clone()}catch(t){return void a(na)}var l=o.body;if(ea(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(na)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(aa(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(sa(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(sa(t))))}catch(t){a(na)}}))}(t,r)}function ua(){return(ua=o((function*(t){var e=t.r,r=t.options,i=zs(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):oa(e,r)}))).apply(this,arguments)}function la(){return(la=o((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=ta.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=zs(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return M(i)?oa(e,r):Promise.resolve(i)}))).apply(this,arguments)}var ha=null;function da(t,e,r){if(!("performance"in e))return()=>{};if(ha)return Us.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},tt,r):tt,n=e=>{var r=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var s=i.maskRequestFn(t);e||(n=!s),s&&r.push(s)}})),r.length>0&&t(u({},e,{requests:r}))},s=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>js(t)||qs(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>Ys({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>js(t)||qs(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>Ys({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(n,e,i),a=()=>{},l=()=>{};return(i.recordHeaders||i.recordBody)&&(a=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Hs("request",r.recordHeaders),n=Hs("response",r.recordHeaders),s=Ws(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},m={},g=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=d.send.bind(d);d.send=t=>(Zs({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=Ks({body:t,options:r,url:o})),c=e.performance.now(),y(t));var w=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",w),d.removeEventListener("abort",w),d.removeEventListener("timeout",w)},b=()=>{if(d.readyState===d.DONE){w(),v=e.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),Zs({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=Ks({body:d.response,options:r,url:o})),Js(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=Ys({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",w),d.addEventListener("abort",w),d.addEventListener("timeout",w)}catch(t){Us.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(n,e,i),l=function(t,e,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=Hs("request",r.recordHeaders),n=Hs("response",r.recordHeaders),s=Ws(e,"fetch",(s=>function(){var a=o((function*(a,o){var u,l;try{u=new Request(a,o)}catch(t){return Us.error("Failed to instrument fetch for network capture",t),s(a,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),i&&(c.requestHeaders=v),!ea(null==o?void 0:o.body)&&Zs({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(c.requestBody=yield function(t){return ua.apply(this,arguments)}({r:u,options:r,url:a}))}catch(t){Us.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),l=Gs(a)?yield s(u):yield s(a,o),d=e.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),n&&(c.responseHeaders=f),Zs({type:"response",headers:f,url:a,recordBody:r.recordBody})&&(c.responseBody=yield function(t){return la.apply(this,arguments)}({r:l,options:r,url:a})),l}finally{Js(e,"fetch",u.url,h,d).then((e=>{var r,i=Ys({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return a.apply(this,arguments)}}()));return()=>{s()}}(n,e,i)),ha=()=>{s(),a(),l(),ha=null}}var ca=t=>({name:"rrweb/network@1",observer:da,options:t});s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Ps,getRecordNetworkPlugin:ca},s.__PosthogExtensions__.rrweb={record:_s,version:"v2",wasMaxDepthReached:()=>Ji,resetMaxDepthState(){Ji=!1,Zi=!1},getLastSnapshotCost:()=>Xr,getMutationCost:()=>u({},ei),resetSnapshotCostState(){Jr=0,Qr=0,Kr=Vr(),Xr=null,Yr=null,ti=[],ei={slowestBatchMs:0}}},s.rrweb={record:_s,version:"v2"},s.rrwebConsoleRecord={getRecordConsolePlugin:Ps},s.getRecordNetworkPlugin=ca,s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.initSessionRecording=t=>new Sr(t)}();
2
2
  //# sourceMappingURL=lazy-recorder.js.map