@statsig/js-client 0.0.1-beta.23 → 0.0.1-beta.25
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},r=null!=(r=null!=(r=null!=(r=e.__STATSIG__)?r:n.__STATSIG__)?r:i.__STATSIG__)?r:{};e.__STATSIG__=r,n.__STATSIG__=r,i.__STATSIG__=r},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var s=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),r=n(780),o=n(104),a=n(283),l=n(296),u=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,o.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.m(t))?(this.p(t,e),this.h[t]):null)}getDataAsync(n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(r=null==t?void 0:t.data)?r:null,i),e=this._(i);return t&&this.p(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.S(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.p(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.p(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}O(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.j(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(r.Log.debug("No response returned for latest value"),null)})}T(){return null!=this.l?this.l:(r.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,l.getUserStorageKey)(this.T(),t);return`${a.DataAdapterCachePrefix}.${this.o}.`+t}p(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}m(t){var e=null==(e=u.Storage.getItemSync)?void 0:e.call(u.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}S(t,e){return s(this,void 0,void 0,function*(){yield u.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,u.getObjectFromStorage)(this.v))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield u.Storage.removeItem(e[0])),yield(0,u.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),r="undefined"!=typeof performance&&void 0!==performance.mark;let s=[];e.captureDiagnostics=function(t,e){o.mark(t+":start"),e=e();const n=()=>{o.mark(t+":end"),(t+":end").startsWith("initialize:")&&o.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class o{static mark(t,e){r&&(t=performance.mark(t,{detail:e}),s.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:s,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),s=[]}}e.Diagnostics=o},512:function(t,a,e){var n=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.ErrorBoundary=a.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(972);a.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";a.ErrorBoundary=class{constructor(t){this.l=t,this.A=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.D(e,t,n)):i}catch(t){return this.D(e,t,n),null}}logError(t,e){this.D(t,e)}D(r,s,o){try{i.Log.warn("Caught error in "+r,{error:s});n(this,void 0,void 0,function*(){var t,e=null!=s?s:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.A.has(i)||(this.A.add(i),t=l.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:r,exception:i,info:n},t)),yield fetch(a.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=o&&o({name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const r=n(832),s=n(780),o=n(876),a=n(972),l=n(444),u=n(412),c=n(84),h=n(408),d="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.M=e,this.N=n,this.P=i,this.C=[],this.G={},this.F={},this.R=!1,this.L=Date.now(),this.U=!0===(null==i?void 0:i.disableLogging),this.V=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.J=setInterval(()=>this.K(),n),this.q=(0,c.$)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",d),this.B=(0,c.$)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",d),h.VisibilityChangeObserver.add(this),this.W()}setLoggingDisabled(t){this.U=t}enqueue(t){this.H(t)&&(this.Y(t),this.X(),this.C.length>this.V)&&this.K()}incrementNonExposureCount(t){var e=null!=(e=this.F[t])?e:0;this.F[t]=e+1}reset(){this.G={}}onVisibilityChanged(t){"background"===t&&this.K()}shutdown(){return i(this,void 0,void 0,function*(){this.J&&(clearInterval(this.J),this.J=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Z(),0!==this.C.length&&(t=this.C,this.C=[],yield this.tt(t))})}X(){this.R||(this.R=!0,200<Date.now()-this.L)||setTimeout(()=>this.K(),200)}H(t){if((0,o.isExposureEvent)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.G[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.G).length&&(this.G={}),this.G[t]=n}return!0}K(){this.flush().catch(()=>{})}tt(t){return i(this,void 0,void 0,function*(){if(this.U)this.et(t);else try{(!h.VisibilityChangeObserver.isCurrentlyVisible()&&this.N.isBeaconSupported()?yield this.nt(t):yield this.it(t)).success?this.M({name:"logs_flushed",events:t}):this.et(t)}catch(t){s.Log.warn("Failed to flush events.")}})}it(e){return i(this,void 0,void 0,function*(){var t=yield this.N.post({sdkKey:this.l,data:{events:e},url:this.q,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,u.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}nt(t){return i(this,void 0,void 0,function*(){return{success:yield this.N.beacon({sdkKey:this.l,data:{events:t},url:this.B})}})}et(t){for(;500<t.length;)t.shift();var e=this.ot();(0,l.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}W(){const e=this.ot();i(this,void 0,void 0,function*(){var t=yield(0,l.getObjectFromStorage)(e);t&&(yield l.Storage.removeItem(e),yield this.tt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}ot(){return"statsig.failed_logs."+(0,r.DJB2)(this.l)}Y(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var{sdkType:e,sdkVersion:n}=a.StatsigMetadataProvider.get();this.C.push(Object.assign(Object.assign({},t),{statsigMetadata:{sdkType:e,sdkVersion:n}}))}Z(){0!==Object.keys(this.F).length&&(this.Y({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.F)}}),this.F={})}}},832:(t,e)=>{function n(e){let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const r={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),r[t]=e});return r}(t)))}},284:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const s=n(280),o=n(688);function c(t,e,n,i){var r=i instanceof o.StatsigClientBase?i.rt.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),r)}function h(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var r;const s=i;for(const o of function(t){const e=new Set;let n=h(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(s))if("constructor"!==o){const a=s[o];s[o]=function(...t){return c(n,o,()=>a.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=h(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const u=null==(r=null===s||void 0===s?void 0:s.constructor)?void 0:r[l];(null===s||void 0===s?void 0:s.constructor)[l]=function(...t){return c(n,s.constructor.name+"."+l,()=>u.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var r=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const d=n(280),f=n(780),s=n(612),o=n(604),a=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.M=e,this.ut=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return r(this,void 0,void 0,function*(){var t=yield this.lt(e);return this.ct(Object.assign({method:"POST",body:t},e))})}get(t){return r(this,void 0,void 0,function*(){return this.ct(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return r(this,void 0,void 0,function*(){var t=yield this.dt(n),e=yield this.lt(n);return navigator.sendBeacon(t,e)})}ct(c){var h;return r(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const r=new AbortController;var t,s,o,a=setTimeout(()=>r.abort(`Timeout of ${this.ut}ms expired.`),this.ut),l=yield this.dt(c);let u=null;try{if(u=yield fetch(l,{method:e,body:n,headers:Object.assign({},c.headers),signal:r.signal}),clearTimeout(a),u.ok)return o=yield u.text(),d.Diagnostics.mark("_sendRequest:response-received",{status:u.status,contentLength:u.headers.get("content-length")}),{body:o,code:u.status};throw t=yield u.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",s}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(r,t);return d.Diagnostics.mark("_sendRequest:error",{error:n,status:null===u||void 0===u?void 0:u.status,contentLength:null===u||void 0===u?void 0:u.headers.get("content-length")}),!i||i<=0?(null!=(h=this.M)&&h.call(this,{name:"error",error:t}),f.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.ct(Object.assign(Object.assign({},c),{retries:i-1}))}})}dt(e){return r(this,void 0,void 0,function*(){var t=a.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}lt(i){return r(this,void 0,void 0,function*(){var t=i["data"],e=yield o.StableID.get(i.sdkKey),n=yield s.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},a.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.ht(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.ht(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}ht(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:function(t,o,e){var n=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(o,"__esModule",{value:!0}),o.SessionID=void 0;const i=e(832),a=e(780),l=e(444),u=e(556),c={},h={},d={};function f(t){return"statsig.session_id."+(0,i.DJB2)(t)}o.SessionID={get:t=>n(void 0,void 0,void 0,function*(){return null!=d[t]?d[t]:d[t]=o.SessionID.we(t)}),we:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();let i=!1;if(null==e){let t=yield function(t){t=f(t);return(0,l.getObjectFromStorage)(t)}(s);null==t&&(t={sessionID:(0,u.getUUID)(),startTime:n,lastUpdate:n},i=!0),e=t,c[s]=e}var t=null!=(t=h[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,u.getUUID)(),e.startTime=n,i=!0),e.lastUpdate=n,e),r=s;return r=f(s),(0,l.setObjectInStorage)(r,n).catch(()=>{a.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=o.SessionID.xe(t,t.idleTimeoutID,18e5),i&&(t.ageTimeoutID=o.SessionID.xe(t,t.ageTimeoutID,144e5)),c[s]=e,h[s]=t,d[s]=null,e.sessionID}),Te:(t,e)=>{var n=null!=(n=h[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,h[e]=n},xe:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const r=n(832),s=n(780),o=n(444),a=n(556),l={};function u(t){return"statsig.stable_id."+(0,r.DJB2)(t)}function c(t,e){e=u(e);(0,o.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=u(t);return(0,o.getObjectFromStorage)(t)}(e).then(t=>{return null!=t||c(t=(0,a.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const s=n(512),o=n(728),a=n(780),l=n(612),u=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.vt={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&u.StableID.setOverride(i.overrideStableID,t),a.Log.level=null!=(r=null==i?void 0:i.logLevel)?r:a.LogLevel.Warn,this.ft=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this._t=new o.EventLogger(t,this.rt.bind(this),n,i),l.SessionID.Te(()=>{this.rt({name:"session_expired"})},t),this.u=new s.ErrorBoundary(t);var r,n=null!=(r=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?r:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this._t.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,c.Storage.setDisabled(t.disableStorage))}flush(){return this._t.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.rt({name:"pre_shutdown"}),yield this._t.shutdown()})}on(t,e){this.vt[t]||(this.vt[t]=[]),this.vt[t].push(e)}off(t,e){this.vt[t]&&-1!==(e=this.vt[t].indexOf(e))&&this.vt[t].splice(e,1)}rt(e){var t;const n=t=>{try{t(e)}catch(t){a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this.vt[e.name]&&this.vt[e.name].forEach(t=>n(t)),null!=(t=this.vt["*"])&&t.forEach(n)}gt(t,e){this.loadingStatus=t,this.rt({name:"values_updated",status:t,values:e})}yt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this._t.incrementNonExposureCount(t):this._t.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function l(t,e,n,i,r){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:r,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(t,e){return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createConfigExposure=function(t,e){return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createLayerParameterExposure=function(t,e,n){var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",a=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",a=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},a)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=void 0;let n={sdkVersion:"0.0.1-beta.25",sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.makeLayer=e.makeDynamicConfig=e.makeFeatureGate=void 0;const r="default";e.makeFeatureGate=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.makeDynamicConfig=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}},e.makeLayer=function(t,e,n,i){return{name:t,details:e,getValue:null!=i?i:()=>{},ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,bt:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}}},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const r={},s={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=r[t])?t:null},getItem(t){return Promise.resolve(null!=(t=r[t])?t:null)},setItem(t,e){return r[t]=e,Promise.resolve()},removeItem(t){return delete r[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(r))}};let o=null;try{"undefined"!=typeof window&&"localStorage"in window&&(o={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let a=null!==o&&void 0!==o?o:s,l=a;e.Storage={getProviderName:()=>l.getProviderName(),getItem:t=>l.getItem(t),setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=l.getItemSync)?void 0:e.call(l,t))?e:null},setProvider:t=>{a=t,l=t},setDisabled:t=>{l=t?s:a}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield l.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield l.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.typedJsonParse=void 0;const r=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error(n),null}},556:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.$=void 0,e.$=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.wt}static add(t){this.vt.push(t)}static remove(t){t=this.vt.indexOf(t);-1!==t&&this.vt.splice(t,1)}static notify(e){e!==this.wt&&(this.wt=e,this.vt.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).vt=[],n.wt="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),o=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780)),a=(Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return o.Log}}),n(444));Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return a.Storage}});var l=n(556);r(n(496),e),r(n(856),e),r(n(320),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(284),e),r(n(780),e),r(n(104),e),r(n(188),e),r(n(264),e),r(n(612),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:o.Log,getUUID:l.getUUID,Storage:a.Storage})},920:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoInit=void 0;const o=n(464);e.AutoInit=class{static attempt(e){var n;if("undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript){var i=document.currentScript.getAttribute("src"),r=null==(r=null===window||void 0===window?void 0:window.location)?void 0:r.href;if(i&&r){let t=null;try{var s=new URL(i,r).searchParams;t=null!=(n=s.get("sdkkey"))?n:s.get("sdkKey")}catch(t){o.Log.error("Invalid source URL")}t&&e({sdkKey:t})}}}}},96:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveDeltasResponse=void 0;const i=n(464);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=Object.assign(Object.assign(Object.assign({},t),n),{feature_gates:Object.assign(Object.assign({},t.feature_gates),n.feature_gates),layer_configs:Object.assign(Object.assign({},t.layer_configs),n.layer_configs),dynamic_configs:Object.assign(Object.assign({},t.dynamic_configs),n.dynamic_configs)}),r((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.Ot=null,this.St=null,this.jt="Uninitialized",this.Tt=0,this.It=0}getValues(){return this.Ot?(0,i.typedJsonParse)(this.Ot,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.St=null,this.Ot=null,this.jt="Loading",this.Tt=0,this.It=0}finalize(){this.St||(this.jt="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.Ot=t.data,this.Tt=e.time,this.It=t.receivedAt,this.jt=t.source,this.St=e)}getGate(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.feature_gates[t])?e:null;return this.At(t)}getConfig(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.dynamic_configs[t])?e:null;return this.At(t)}getLayer(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.layer_configs[t])?e:null;return this.At(t)}At(t){return{evaluation:t,details:this.xt(null==t)}}xt(t){return"Uninitialized"===this.jt||"NoValues"===this.jt?{reason:this.jt}:{reason:this.jt+":"+(t?"Unrecognized":"Recognized"),lcut:this.Tt,receivedAt:this.It}}}},400:function(t,e,n){var s=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const o=n(464),a=n(96);class i extends o.NetworkCore{constructor(t,e){super(t,e),this.Dt=(0,o.$)(null==t?void 0:t.initializeUrl,null==t?void 0:t.api,"/initialize","https://api.statsig.com/v1")}fetchEvaluations(n,i,r){return s(this,void 0,void 0,function*(){var t=i?(0,o.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=Object.assign(Object.assign({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Mt(n,t,e)})}Mt(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Dt,data:i,retries:2});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,a.resolveDeltasResponse)(n,t.body))?t:this.Mt(e,n,Object.assign(Object.assign(Object.assign({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var i=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const o=n(464),r=n(536),s=n(400),a=n(364);n(807);class l extends o.StatsigClientBase{constructor(t,e,n=null){var i=new s.default(n,t=>{this.rt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,i,n),(0,o.monitorClass)(this.u,this),(0,o.monitorClass)(this.u,i),this.Et=new r.default,this.Nt=e}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}initializeSync(){this.updateUserSync(this.Nt)}initializeAsync(){return this.updateUserAsync(this.Nt)}updateUserSync(t){this.kt(t);t=this.dataAdapter.getDataSync(this.Nt);this.Et.setValuesFromDataAdapter(t),this.Et.finalize(),this.gt("Ready",t),this.Pt(null!=t?t:null,this.Nt)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.kt(n);var t=this.Nt,e=this.dataAdapter.getDataSync(t);this.gt("Loading",e),this.Et.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.Nt&&this.Et.setValuesFromDataAdapter(e),this.Et.finalize(),this.gt("Ready",e)})}checkGate(t,e){return this.getFeatureGate(t,e).value}getContext(){return{sdkKey:this.l,options:this.P,values:this.Et.getValues(),user:JSON.parse(JSON.stringify(this.Nt))}}getAsyncContext(){return i(this,void 0,void 0,function*(){return Object.assign(Object.assign({},this.getContext()),{sessionID:yield o.SessionID.get(this.l),stableID:yield o.StableID.get(this.l)})})}getFeatureGate(t,e){var n=(0,o.DJB2)(t),{evaluation:n,details:i}=this.Et.getGate(n),i=(0,o.makeFeatureGate)(t,i,n),r=null==(r=null==(n=this.ft)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.Nt,e),n=null!=r?r:i;return this.yt(t,(0,o.createGateExposure)(this.Nt,n),e),this.rt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.Ct("dynamic_config",t,e);return this.rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.Ct("experiment",t,e);return this.rt({name:"experiment_evaluation",experiment:t}),t}getLayer(n,i){var t=(0,o.DJB2)(n),{evaluation:t,details:e}=this.Et.getLayer(t),e=(0,o.makeLayer)(n,e,t),r=null==(r=null==(t=this.ft)?void 0:t.getLayerOverride)?void 0:r.call(t,e,this.Nt,i);const s=null!=r?r:e;return this.rt({name:"layer_evaluation",layer:s}),Object.assign(Object.assign({},s),{getValue:t=>{var e;return t in s.bt&&(e=(0,o.createLayerParameterExposure)(this.Nt,s,t),this.yt(n,e,i),null!=(e=s.bt[t]))?e:null}})}logEvent(t){this._t.enqueue(Object.assign(Object.assign({},t),{user:this.Nt,time:Date.now()}))}Pt(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{o.Log.error("An error occurred after update.",t)})}kt(t){this._t.reset(),this.Et.reset(),this.Nt=(0,o.normalizeUser)(t,this.P.environment)}Ct(t,e,n){var i=(0,o.DJB2)(e),{evaluation:i,details:r}=this.Et.getConfig(i),r=(0,o.makeDynamicConfig)(e,r,i),i="experiment"===t?null==(t=null==(i=this.ft)?void 0:i.getExperimentOverride)?void 0:t.call(i,r,this.Nt,n):null==(i=null==(t=this.ft)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,r,this.Nt,n),t=null!=i?i:r;return this.yt(e,(0,o.createConfigExposure)(this.Nt,t),n),t}}e.default=l},364:function(t,e,n){var r=this&&this.__awaiter||function(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})},i=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigEvaluationsDataAdapter=void 0,n(464));const s=n(400);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.N=null}attach(t,e){super.attach(t,e),this.N=new s.default(null!=e?e:{})}j(e,n){var i;return r(this,void 0,void 0,function*(){var t=yield null==(i=this.N)?void 0:i.fetchEvaluations(this.T(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=o},807:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SDK_TYPE=void 0;n=n(464);e.SDK_TYPE="javascript-client",n.StatsigMetadataProvider.add({sdkType:e.SDK_TYPE})},208:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const r=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return r.StatsigEvaluationsDataAdapter}}),n(807),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:r.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__},152:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SessionReplay=void 0;const r=n(464),i=n(884);e.SessionReplay=class{constructor(t){this.Gt=t,this.Yt=null,this.Qt=[],this.ke="",this.Zt=new i.SessionReplayClient,this.Gt.on("pre_shutdown",()=>this.Xt()),this.Gt.on("values_updated",()=>this.te()),this.Gt.on("session_expired",()=>{this.Zt.stop(),r.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Ce(this.ke),this.Gt.getAsyncContext().then(t=>{this.ke=t.sessionID}).catch(t=>{r.Log.error(t)})}),this.Gt.getAsyncContext().then(t=>{this.ke=t.sessionID,this.te()}).catch(t=>{r.Log.error(t)})}ee(t,e){this.Yt=e,this.Qt.push(t);t=JSON.stringify(this.Qt);2048<t.length&&this.ie(t,e)}te(){this.Xt();var t=this.Gt.getContext().values;!0!==(null==t?void 0:t.can_record_session)||(t=null!=(t=t.session_recording_rate)?t:0,Math.random()>=t)?this.Xt():(r.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Zt.record((t,e)=>this.ee(t,e)))}Xt(){var t;this.Zt.stop(),r.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.Qt.length&&null!=this.Yt&&(t=JSON.stringify(this.Qt),this.ie(t,this.Yt))}Ce(t){var e,n,i;0!==this.Qt.length&&null!=this.Yt&&(e=this.Yt,n=JSON.stringify(this.Qt),i=r.StatsigMetadataProvider.get()["sdkVersion"],this.Gt.logEvent({eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(e.startTime),session_end_ts:String(e.endTime),clicks_captured_cumulative:String(e.clickCount),rrweb_events:n,session_replay_sdk_version:i}}))}ie(e,n){const i=r.StatsigMetadataProvider.get()["sdkVersion"];this.Gt.getAsyncContext().then(t=>{this.Gt.logEvent({eventName:"statsig::session_recording",value:t.sessionID,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:e,session_replay_sdk_version:i}})}).catch(t=>{r.Log.error(t)}),this.Qt=[]}}},884:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SessionReplayClient=void 0;const i=n(704);e.SessionReplayClient=class{constructor(){this.ne=null,this.re=null,this.se=0}record(n,t){"undefined"==typeof window||(this.ne=null,this.re=null,this.se=0,this.oe=t,this.ae)||(this.ae=(0,i.record)({emit:t=>{var e;null==this.ne&&(this.ne=t.timestamp),this.re=t.timestamp,(e=t).type===i.EventType.IncrementalSnapshot&&e.data.source===i.IncrementalSource.MouseInteraction&&e.data.type===i.MouseInteractions.Click&&this.se++,n(t,{startTime:this.ne,endTime:this.re,clickCount:this.se}),144e5<this.re-this.ne&&(null!=(e=this.ae)&&e.call(this),this.oe)&&this.oe()}}))}stop(){this.ae&&(this.ae(),this.ae=void 0)}}},392:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SessionReplay=e.SessionReplayClient=void 0;const i=n(152),r=(Object.defineProperty(e,"SessionReplay",{enumerable:!0,get:function(){return i.SessionReplay}}),n(884));Object.defineProperty(e,"SessionReplayClient",{enumerable:!0,get:function(){return r.SessionReplayClient}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:r.SessionReplayClient,SessionReplay:i.SessionReplay})},156:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoCapture=void 0;const i=n(464),r=n(76);e.AutoCapture=class{constructor(t){this.Gt=t,this.Ft=Date.now(),this.Rt=0,"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.Lt()):this.Lt()}Ut(){var t;"undefined"!=typeof window&&"undefined"!=typeof document&&(t=t=>{this.Vt(t||window.event)},(0,r.registerEventHandler)(document,"click",t),(0,r.registerEventHandler)(document,"submit",t),(0,r.registerEventHandler)(window,"error",t),(0,r.registerEventHandler)(window,"beforeunload",()=>this.Jt()),(0,r.registerEventHandler)(window,"scroll",()=>this.Kt()))}Vt(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.qt(t):(e=(0,r.getTargetNode)(t))&&(0,r.shouldLogEvent)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.gatherEventData)(e),this.zt(n,t,e))}Lt(){this.Ut(),this.$t(),this.Bt()}qt(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.zt("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}$t(){setTimeout(()=>{var t=(0,r.getSafeUrl)();this.Wt("page_view",(0,r.getSanitizedPageUrl)(),{title:null===document||void 0===document?void 0:document.title,queryParams:Object.fromEntries(t.searchParams)})},1)}Bt(){"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.getEntriesByName&&setTimeout(()=>{var t={},e=window.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),window.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.zt("performance",(0,r.getSanitizedPageUrl)(),t)},1)}Jt(){this.Wt("page_view_end",(0,r.getSanitizedPageUrl)(),{scrollDepth:this.Rt,pageViewLength:Date.now()-this.Ft})}zt(t,e,n){e={eventName:"auto_capture::"+t,value:e,metadata:Object.assign({sessionId:(0,r.getWebSessionId)(this.Gt.getContext().sdkKey),page_url:(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||""},n)};this.Gt.logEvent(e),i.Log.debug("Enqueued Event",e)}Wt(t,e,n){this.zt(t,e,n),this.Gt.flush().catch(t=>{i.Log.error(t)})}Kt(){var t=document.body.scrollHeight||1;this.Rt=Math.max(this.Rt,Math.min(100,Math.round((window.scrollY+window.innerHeight)/t*100)))}}},76:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.registerEventHandler=e.getSanitizedPageUrl=e.getWebSessionId=e.getSafeUrl=e.shouldLogEvent=e.getTargetNode=e.gatherEventData=void 0;const r=n(464),s={};function o(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.gatherEventData=function(t){var e=t.tagName.toLowerCase(),n={},i=e,r=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),o(t));return r&&(n.href=r.getAttribute("href")),{value:i,metadata:n}},e.getTargetNode=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.shouldLogEvent=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(o(e))return!0}return!1}},e.getSafeUrl=function(){var t=(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.getWebSessionId=function(t){var e=function(t){if(window&&window.localStorage)return window.localStorage.getItem(t);return s[t]}(t="statsig.web_analytics.session."+(0,r.DJB2)(t)),n=Date.now();let i=e?(0,r.typedJsonParse)(e,"lastAccessedTime","Failed to parse WebSession"):null;return(i=!i||144e5<n-i.startTime||6e5<n-i.lastAccessedTime?(e=Date.now(),{id:(0,r.getUUID)(),startTime:e,lastAccessedTime:e}):i).lastAccessedTime=n,e=t,n=JSON.stringify(i),window&&window.localStorage?window.localStorage.setItem(e,n):(s[e]=n,r.Log.error("Statsig Web AutoCapture: No window.localStorage")),i.id},e.getSanitizedPageUrl=function(){var t;return(null==(t=null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)?void 0:t.split(/[?#]/)[0])||""},e.registerEventHandler=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoCapture=void 0;const i=n(156);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture}),e.default=__STATSIG__},704:(s,t,e)=>{e.r(t),e.d(t,{EventType:()=>Q,IncrementalSource:()=>Z,MouseInteractions:()=>h,PLUGIN_NAME:()=>Vn,Replayer:()=>sr,ReplayerEvents:()=>v,addCustomEvent:()=>Je,canvasMutation:()=>ti,freezePage:()=>qe,getRecordConsolePlugin:()=>zn,getReplayConsolePlugin:()=>Yn,mirror:()=>jt,pack:()=>Rn,record:()=>n,unpack:()=>Nn,utils:()=>o});var z,o={},t=(e.r(o),e.d(o,{StyleSheetMirror:()=>Zt,ue:()=>jt,closestElementOfNode:()=>Ut,getBaseDimension:()=>Yt,getNestedRule:()=>Kt,getPositionsAndIndex:()=>Xt,getRootShadowHost:()=>ee,getShadowHost:()=>te,getWindowHeight:()=>Ft,getWindowScroll:()=>Lt,getWindowWidth:()=>Pt,hasShadowRoot:()=>X,hookSetter:()=>Nt,inDom:()=>ie,isAncestorRemoved:()=>$t,isBlocked:()=>L,isIgnored:()=>Wt,isSerialized:()=>Gt,isSerializedIframe:()=>Jt,isSerializedStylesheet:()=>qt,iterateResolveTree:()=>Ht,legacy_isTouchEvent:()=>Bt,nowTimestamp:()=>Dt,on:()=>K,patch:()=>D,polyfill:()=>Vt,queueToResolveTrees:()=>zt,shadowHostInDom:()=>ne,throttle:()=>Rt,uniqueTextMutations:()=>Qt}),{});function $(t){return t.nodeType===t.ELEMENT_NODE}function B(t){var e=null==t?void 0:t.host;return Boolean((null==e?void 0:e.shadowRoot)===t)}function V(t){return"[object ShadowRoot]"===Object.prototype.toString.call(t)}function Y(t){try{var e=t.rules||t.cssRules;return e?n=(n=Array.from(e,a).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")?n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;"):n:null}catch(t){return null}var n}function a(t){let e;if("styleSheet"in t)try{e=Y(t.styleSheet)||((i=(n=t).cssText).split('"').length<3?i:(i=["@import",`url(${JSON.stringify(n.href)})`],""===n.layerName?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"))}catch(t){}else if("selectorText"in t&&t.selectorText.includes(":"))return t.cssText.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2");var n,i;return e||t.cssText}e.r(t),e.d(t,{default:()=>Pi}),(e=z=z||{})[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment";class st{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){return t&&null!=(t=null==(t=this.getMeta(t))?void 0:t.id)?t:-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);this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){var n=e.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,e)}replace(t,e){var n=this.getNode(t);n&&(n=this.nodeMetaMap.get(n))&&this.nodeMetaMap.set(e,n),this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function l(){return new st}function ot({element:t,maskInputOptions:e,tagName:n,type:i,value:r,maskInputFn:s}){let o=r||"";r=i&&H(i);return o=e[n.toLowerCase()]||r&&e[r]?s?s(o,t):"*".repeat(o.length):o}function H(t){return t.toLowerCase()}const at="__rrweb_original__";function lt(t){var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?H(e):null}function ut(t,e){let n;try{n=new URL(t,null!=e?e:window.location.href)}catch(t){return null}t=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!=(e=null==t?void 0:t[1])?e:null}let ct=1;const ht=new RegExp("[^a-z0-9-_:]"),dt=-2;function u(){return ct++}let ft,vt;const c=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,w=/^(?:[a-z+]+:)?\/\//i,S=/^www\..*/i,_=/^(data:)([^,]*),(.*)/i;function pt(t,l){return(t||"").replace(c,(t,e,n,i,r,s)=>{n=n||r||s,r=e||i||"";if(!n)return t;if(w.test(n)||S.test(n))return`url(${r}${n}${r})`;if(_.test(n))return`url(${r}${n}${r})`;if("/"===n[0])return`url(${r}${function(t){let e="";return e=(e=-1<t.indexOf("//")?t.split("/").slice(0,3).join("/"):t.split("/")[0]).split("?")[0]}(l)+n}${r})`;var o=l.split("/"),s=n.split("/");o.pop();for(const a of s)"."!==a&&(".."===a?o.pop():o.push(a));return`url(${r}${o.join("/")}${r})`})}const O=/^[^ \t\n\r\u000c]+/,T=/^[, \t\n\r\u000c]+/;function I(i,r){if(""===r.trim())return r;let s=0;function t(t){var t=t.exec(r.substring(s));return t?(t=t[0],s+=t.length,t):""}for(var o=[];t(T),!(s>=r.length);){let n=t(O);if(","===n.slice(-1))n=C(i,n.substring(0,n.length-1)),o.push(n);else{let t="",e=(n=C(i,n),!1);for(;;){var a=r.charAt(s);if(""===a){o.push((n+t).trim());break}if(e)")"===a&&(e=!1);else{if(","===a){s+=1,o.push((n+t).trim());break}"("===a&&(e=!0)}t+=a,s+=1}}}return o.join(", ")}function C(t,e){return e&&""!==e.trim()?((t=t.createElement("a")).href=e,t.href):e}function mt(){var t=document.createElement("a");return t.href="",t.href}function yt(t,e,n,i){return i&&("src"!==n&&("href"!==n||"use"===e&&"#"===i[0])&&("xlink:href"!==n||"#"===i[0])&&("background"!==n||"table"!==e&&"td"!==e&&"th"!==e)?"srcset"===n?I(t,i):"style"===n?pt(i,mt()):"object"===e&&"data"===n?C(t,i):i:C(t,i))}function gt(t,e){return("video"===t||"audio"===t)&&"autoplay"===e}function E(e,n,t){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!t&&E(e.parentNode,n,t);for(let t=e.classList.length;t--;){var i=e.classList[t];if(n.test(i))return!0}return!!t&&E(e.parentNode,n,t)}function bt(t,e,n,i){try{var r=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(null===r)return!1;if("string"==typeof e){if(i){if(r.closest("."+e))return!0}else if(r.classList.contains(e))return!0}else if(E(r,e,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(t){}return!1}function wt(n,t){var i,r,e,{doc:s,mirror:t,blockClass:o,blockSelector:a,needsMask:l,inlineStylesheet:u,maskInputOptions:c={},maskTextFn:L,maskInputFn:F,dataURLOptions:P={},inlineImages:U,recordCanvas:G,keepIframeSrcFn:W,newlyAddedElement:$=!1}=t,h=function(t,e){if(!e.hasNode(t))return;e=e.getId(t);return 1===e?void 0:e}(s,t);switch(n.nodeType){case n.DOCUMENT_NODE:return"CSS1Compat"!==n.compatMode?{type:z.Document,childNodes:[],compatMode:n.compatMode}:{type:z.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:z.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:h};case n.ELEMENT_NODE:{var d=n;var f={doc:s,blockClass:o,blockSelector:a,inlineStylesheet:u,maskInputOptions:c,maskInputFn:F,dataURLOptions:P,inlineImages:U,recordCanvas:G,keepIframeSrcFn:W,newlyAddedElement:$,rootId:h};const{doc:b,blockClass:w,blockSelector:S,inlineStylesheet:_,maskInputOptions:O={},maskInputFn:k,dataURLOptions:T={},inlineImages:I,recordCanvas:C,keepIframeSrcFn:E,newlyAddedElement:x=!1,rootId:M}=f,A=function(e,n,t){try{if("string"==typeof n){if(e.classList.contains(n))return!0}else for(let t=e.classList.length;t--;){var i=e.classList[t];if(n.test(i))return!0}if(t)return e.matches(t)}catch(t){}return!1}(d,w,S),j=function(t){return t instanceof HTMLFormElement?"form":(t=H(t.tagName),ht.test(t)?"div":t)}(d);let e={};var B=d.attributes.length;for(let t=0;t<B;t++){var v=d.attributes[t];gt(j,v.name,v.value)||(e[v.name]=yt(b,j,H(v.name),v.value))}if("link"===j&&_){f=Array.from(b.styleSheets).find(t=>t.href===d.href);let t=null;(t=f?Y(f):t)&&(delete e.rel,delete e.href,e.le=pt(t,f.href))}"style"===j&&d.sheet&&!(d.innerText||d.textContent||"").trim().length&&(f=Y(d.sheet))&&(e.le=pt(f,mt()));"input"!==j&&"textarea"!==j&&"select"!==j||(f=d.value,i=d.checked,"radio"!==e.type&&"checkbox"!==e.type&&"submit"!==e.type&&"button"!==e.type&&f?e.value=ot({element:d,type:lt(d),tagName:j,value:f,maskInputOptions:O,maskInputFn:k}):i&&(e.checked=i));"option"===j&&(d.selected&&!O.select?e.selected=!0:delete e.selected);"canvas"===j&&C&&("2d"===d.__context?function(n){var i=n.getContext("2d");if(i)for(let e=0;e<n.width;e+=50)for(let t=0;t<n.height;t+=50){var r=i.getImageData,r=at in r?r[at]:r;if(new Uint32Array(r.call(i,e,t,Math.min(50,n.width-e),Math.min(50,n.height-t)).data.buffer).some(t=>0!==t))return}return 1}(d)||(e.rr_dataURL=d.toDataURL(T.type,T.quality)):"__context"in d||(f=d.toDataURL(T.type,T.quality),(i=document.createElement("canvas")).width=d.width,i.height=d.height,r=i.toDataURL(T.type,T.quality),f!==r&&(e.rr_dataURL=f)));if("img"===j&&I){ft||(ft=b.createElement("canvas"),vt=ft.getContext("2d"));const R=d,N=R.crossOrigin,D=(R.crossOrigin="anonymous",()=>{R.removeEventListener("load",D);try{ft.width=R.naturalWidth,ft.height=R.naturalHeight,vt.drawImage(R,0,0),e.rr_dataURL=ft.toDataURL(T.type,T.quality)}catch(t){console.warn(`Cannot inline img src=${R.currentSrc}! Error: `+t)}N?e.crossOrigin=N:R.removeAttribute("crossorigin")});R.complete&&0!==R.naturalWidth?D():R.addEventListener("load",D)}"audio"!==j&&"video"!==j||(e.rr_mediaState=d.paused?"paused":"played",e.rr_mediaCurrentTime=d.currentTime);x||(d.scrollLeft&&(e.rr_scrollLeft=d.scrollLeft),d.scrollTop&&(e.rr_scrollTop=d.scrollTop));A&&({width:r,height:f}=d.getBoundingClientRect(),e={class:e.class,rr_width:r+"px",rr_height:f+"px"});"iframe"!==j||E(e.src)||(d.contentDocument||(e.rr_src=e.src),delete e.src);let t;try{customElements.get(j)&&(t=!0)}catch(t){}return{type:z.Element,tagName:j,attributes:e,childNodes:[],isSVG:function(t){return Boolean("svg"===t.tagName||t.ownerSVGElement)}(d)||void 0,needBlock:A,rootId:M,isCustom:t};return}case n.TEXT_NODE:{f=n;var p={needsMask:l,maskTextFn:L,rootId:h};var{needsMask:p,maskTextFn:m,rootId:V}=p,y=f.parentNode&&f.parentNode.tagName;let t=f.textContent;var g="STYLE"===y||void 0,y="SCRIPT"===y||void 0;if(g&&t){try{f.nextSibling||f.previousSibling||null!=(e=f.parentNode.sheet)&&e.cssRules&&(t=Y(f.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,f)}t=pt(t,mt())}y&&(t="SCRIPT_PLACEHOLDER");!g&&!y&&t&&p&&(t=m?m(t,f.parentElement):t.replace(/[\S]/g,"*"));return{type:z.Text,textContent:t||"",isStyle:g,rootId:V};return}case n.CDATA_SECTION_NODE:return{type:z.CDATA,textContent:"",rootId:h};case n.COMMENT_NODE:return{type:z.Comment,textContent:n.textContent||"",rootId:h};default:return!1}}function N(t){return null==t?"":t.toLowerCase()}function St(e,t){const{doc:n,mirror:i,blockClass:r,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:d,slimDOMOptions:f,dataURLOptions:v={},inlineImages:p=!1,recordCanvas:m=!1,onSerialize:y,onIframeLoad:g,iframeLoadTimeout:b=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:S=5e3,keepIframeSrcFn:_=()=>!1,newlyAddedElement:O=!1}=t;let k=t["needsMask"],{preserveWhiteSpace:T=!0}=t;!k&&e.childNodes&&(t=void 0===k,k=bt(e,o,a,t));t=wt(e,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:k,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,dataURLOptions:v,inlineImages:p,recordCanvas:m,keepIframeSrcFn:_,newlyAddedElement:O});if(!t)return console.warn(e,"not serialized"),null;let I;I=i.hasNode(e)?i.getId(e):!function(t,e){if(e.comment&&t.type===z.Comment)return 1;if(t.type===z.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel||"modulepreload"===t.attributes.rel)&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===ut(t.attributes.href)))return 1;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(N(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===N(t.attributes.name)||"icon"===N(t.attributes.rel)||"apple-touch-icon"===N(t.attributes.rel)||"shortcut icon"===N(t.attributes.rel))))return 1;if("meta"===t.tagName){if(e.headMetaDescKeywords&&N(t.attributes.name).match(/^description|keywords$/))return 1;if(e.headMetaSocial&&(N(t.attributes.property).match(/^(og|twitter|fb):/)||N(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===N(t.attributes.name)))return 1;if(e.headMetaRobots&&("robots"===N(t.attributes.name)||"googlebot"===N(t.attributes.name)||"bingbot"===N(t.attributes.name)))return 1;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return 1;if(e.headMetaAuthorship&&("author"===N(t.attributes.name)||"generator"===N(t.attributes.name)||"framework"===N(t.attributes.name)||"publisher"===N(t.attributes.name)||"progid"===N(t.attributes.name)||N(t.attributes.property).match(/^article:/)||N(t.attributes.property).match(/^product:/)))return 1;if(e.headMetaVerification&&("google-site-verification"===N(t.attributes.name)||"yandex-verification"===N(t.attributes.name)||"csrf-token"===N(t.attributes.name)||"p:domain_verify"===N(t.attributes.name)||"verify-v1"===N(t.attributes.name)||"verification"===N(t.attributes.name)||"shopify-checkout-api-token"===N(t.attributes.name)))return 1}}}(t,f)&&(T||t.type!==z.Text||t.isStyle||t.textContent.replace(/^\s+|\s+$/gm,"").length)?ct++:dt;var C=Object.assign(t,{id:I});if(i.add(e,C),I===dt)return null;y&&y(e);let E=!l;if(C.type===z.Element&&(E=E&&!C.needBlock,delete C.needBlock,t=e.shadowRoot)&&V(t)&&(C.isShadowHost=!0),(C.type===z.Document||C.type===z.Element)&&E){f.headWhitespace&&C.type===z.Element&&"head"===C.tagName&&(T=!1);var x={doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:k,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,slimDOMOptions:f,dataURLOptions:v,inlineImages:p,recordCanvas:m,preserveWhiteSpace:T,onSerialize:y,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:_};if(C.type!==z.Element||"textarea"!==C.tagName||void 0===C.attributes.value)for(const j of Array.from(e.childNodes)){var M=St(j,x);M&&C.childNodes.push(M)}if($(e)&&e.shadowRoot)for(const R of Array.from(e.shadowRoot.childNodes)){var A=St(R,x);A&&(V(e.shadowRoot)&&(A.isShadow=!0),C.childNodes.push(A))}}return e.parentNode&&B(e.parentNode)&&V(e.parentNode)&&(C.isShadow=!0),C.type===z.Element&&"iframe"===C.tagName&&function(n,i,r){var s=n.contentWindow;if(s){let t=!1,e;try{e=s.document.readyState}catch(t){return}if("complete"!==e){const o=setTimeout(()=>{t||(i(),t=!0)},r);void n.addEventListener("load",()=>{clearTimeout(o),t=!0,i()})}else{r="about:blank";if(s.location.href!==r||n.src===r||""===n.src)return setTimeout(i,0),n.addEventListener("load",i);n.addEventListener("load",i)}}}(e,()=>{var t=e.contentDocument;t&&g&&(t=St(t,{doc:t,mirror:i,blockClass:r,blockSelector:s,needsMask:k,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,slimDOMOptions:f,dataURLOptions:v,inlineImages:p,recordCanvas:m,preserveWhiteSpace:T,onSerialize:y,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:_}))&&g(e,t)},b),C.type===z.Element&&"link"===C.tagName&&"string"==typeof C.attributes.rel&&("stylesheet"===C.attributes.rel||"preload"===C.attributes.rel&&"string"==typeof C.attributes.href&&"css"===ut(C.attributes.href))&&function(t,e,n){let i=!1,r;try{r=t.sheet}catch(t){return}if(!r){const s=setTimeout(()=>{i||(e(),i=!0)},n);t.addEventListener("load",()=>{clearTimeout(s),i=!0,e()})}}(e,()=>{var t;w&&(t=St(e,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:k,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,slimDOMOptions:f,dataURLOptions:v,inlineImages:p,recordCanvas:m,preserveWhiteSpace:T,onSerialize:y,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:_}))&&w(e,t)},S),C}const x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function M(r,n={}){let i=1,s=1;function o(t){var e=t.match(/\n/g),e=(e&&(i+=e.length),t.lastIndexOf("\n"));s=-1===e?s+t.length:t.length-e}function a(){const e={line:i,column:s};return t=>(t.position=new l(e),p(),t)}class l{constructor(t){this.start=t,this.end={line:i,column:s},this.source=n.source}}l.prototype.content=r;const u=[];function c(t){var e=new Error(`${n.source||""}:${i}:${s}: `+t);if(e.reason=t,e.filename=n.source,e.line=i,e.column=s,e.source=r,!n.silent)throw e;u.push(e)}function h(){return v(/^{\s*/)}function d(){return v(/^}/)}function f(){let t;var e,n,i=[];for(p(),m(i);r.length&&"}"!==r.charAt(0)&&(t=function(){if("@"===r[0])return function(){var e=a();var n=v(/^@([-\w]+)?keyframes\s*/);if(n){var i=n[1];if(!(n=v(/^([-\w]+)\s*/)))return c("@keyframes missing name");var r,n=n[1];if(!h())return c("@keyframes missing '{'");let t=m();for(;r=function(){var t;var e=[],n=a();for(;t=v(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)e.push(t[1]),v(/^,\s*/);if(e.length)return n({type:"keyframe",values:e,declarations:w()})}();)t.push(r),t=t.concat(m());return d()?e({type:"keyframes",name:n,vendor:i,keyframes:t}):c("@keyframes missing '}'")}}()||function(){var t=a(),e=v(/^@media *([^{]+)/);var n;if(e)return e=k(e[1]),h()?(n=m().concat(f()),d()?t({type:"media",media:e,rules:n}):c("@media missing '}'")):c("@media missing '{'")}()||function(){var t=a(),e=v(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(e)return t({type:"custom-media",name:k(e[1]),media:k(e[2])})}()||function(){var t=a(),e=v(/^@supports *([^{]+)/);var n;if(e)return e=k(e[1]),h()?(n=m().concat(f()),d()?t({type:"supports",supports:e,rules:n}):c("@supports missing '}'")):c("@supports missing '{'")}()||S()||_()||O()||function(){var t=a(),e=v(/^@([-\w]+)?document *([^{]+)/);var n,i;if(e)return n=k(e[1]),e=k(e[2]),h()?(i=m().concat(f()),d()?t({type:"document",document:e,vendor:n,rules:i}):c("@document missing '}'")):c("@document missing '{'")}()||function(){var e=a(),n=v(/^@page */);if(n){var i,n=g()||[];if(!h())return c("@page missing '{'");let t=m();for(;i=b();)t.push(i),t=t.concat(m());return d()?e({type:"page",selectors:n,declarations:t}):c("@page missing '}'")}}()||function(){var t=a(),e=v(/^@host\s*/);if(e)return h()?(e=m().concat(f()),d()?t({type:"host",rules:e}):c("@host missing '}'")):c("@host missing '{'")}()||function(){var e=a(),t=v(/^@font-face\s*/);if(t){if(!h())return c("@font-face missing '{'");let t=m();for(var n;n=b();)t.push(n),t=t.concat(m());return d()?e({type:"font-face",declarations:t}):c("@font-face missing '}'")}}()}()||(n=e=void 0,e=a(),(n=g())?(m(),e({type:"rule",selectors:n,declarations:w()})):c("selector missing")));)t&&(i.push(t),m(i));return i}function v(t){var e,t=t.exec(r);if(t)return o(e=t[0]),r=r.slice(e.length),t}function p(){v(/^\s*/)}function m(t=[]){for(var e;e=y();)e&&t.push(e),y();return t}function y(){var e,n=a();if("/"===r.charAt(0)&&"*"===r.charAt(1)){let t=2;for(;""!==r.charAt(t)&&("*"!==r.charAt(t)||"/"!==r.charAt(t+1));)++t;return(t+=2,""===r.charAt(t-1))?c("End of comment missing"):(e=r.slice(2,t-2),s+=2,o(e),r=r.slice(t),s+=2,n({type:"comment",comment:e}))}}function g(){var t=v(/^([^{]+)/);if(t)return k(t[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,t=>t.replace(/,/g,"")).split(/\s*(?![^(]*\)),\s*/).map(t=>t.replace(/\u200C/g,","))}function b(){var t,e=a(),n=v(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(n)return n=k(n[0]),v(/^:\s*/)?(t=v(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),e=e({type:"declaration",property:n.replace(x,""),value:t?k(t[0]).replace(x,""):""}),v(/^[;\s]*/),e):c("property missing ':'")}function w(){var t,e=[];if(!h())return c("missing '{'");for(m(e);t=b();)!1!==t&&(e.push(t),m(e)),b();return d()?e:c("missing '}'")}const S=t("import"),_=t("charset"),O=t("namespace");function t(i){const r=new RegExp("^@"+i+"\\s*([^;]+);");return()=>{var t,e=a(),n=v(r);if(n)return(t={type:i})[i]=n[1].trim(),e(t)}}return function e(t,n){const i=t&&"string"==typeof t.type;const r=i?t:n;for(const s of Object.keys(t)){const o=t[s];Array.isArray(o)?o.forEach(t=>{e(t,r)}):o&&"object"==typeof o&&e(o,r)}i&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:n||null});return t}((e=f(),{type:"stylesheet",stylesheet:{source:n.source,rules:e,parsingErrors:u}}));var e}function k(t){return t?t.replace(/^\s+|\s+$/g,""):""}const A={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function j(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const R=/(max|min)-device-(width|height)/,_t=new RegExp(R.source,"g"),Ot=/([^\\]):hover/,kt=new RegExp(Ot.source,"g");function Tt(t,e){var n=null==e?void 0:e.stylesWithHoverClass.get(t);if(n)return n;var n=M(t,{silent:!0});if(!n.stylesheet)return t;const i=[],r=[];!function t(e){"selectors"in e&&e.selectors&&e.selectors.forEach(t=>{Ot.test(t)&&i.push(t)}),"media"in e&&e.media&&R.test(e.media)&&r.push(e.media),"rules"in e&&e.rules&&e.rules.forEach(t)}(n.stylesheet);let s=t;return 0<i.length&&(n=new RegExp(i.filter((t,e)=>i.indexOf(t)===e).sort((t,e)=>e.length-t.length).map(t=>j(t)).join("|"),"g"),s=s.replace(n,t=>{var e=t.replace(kt,"$1.\\:hover");return t+", "+e})),0<r.length&&(n=new RegExp(r.filter((t,e)=>r.indexOf(t)===e).sort((t,e)=>e.length-t.length).map(t=>j(t)).join("|"),"g"),s=s.replace(n,t=>t.replace(_t,"$1-$2"))),null!=e&&e.stylesWithHoverClass.set(t,s),s}function It(){return{stylesWithHoverClass:new Map}}function Ct(n,t){var i,{doc:r,hackCss:s,cache:o}=t;switch(n.type){case z.Document:return r.implementation.createDocument(null,"",null);case z.DocumentType:return r.implementation.createDocumentType(n.name||"html",n.publicId,n.systemId);case z.Element:{var a=function(t){let e=A[t.tagName]||t.tagName;return e="link"===e&&t.attributes.le?"style":e}(n);let e;e=n.isSVG?r.createElementNS("http://www.w3.org/2000/svg",a):(n.isCustom&&null!=(i=r.defaultView)&&i.customElements&&!r.defaultView.customElements.get(n.tagName)&&r.defaultView.customElements.define(n.tagName,class extends r.defaultView.HTMLElement{}),r.createElement(a));var l={};for(const f in n.attributes)if(Object.prototype.hasOwnProperty.call(n.attributes,f)){let t=n.attributes[f];if(("option"!==a||"selected"!==f||!1!==t)&&null!==t)if(!0===t&&(t=""),f.startsWith("rr_"))l[f]=t;else{var u="textarea"===a&&"value"===f,c="style"===a&&"_cssText"===f;if(c&&s&&"string"==typeof t&&(t=Tt(t,o)),(u||c)&&"string"==typeof t)e.appendChild(r.createTextNode(t)),n.childNodes=[];else try{n.isSVG&&"xlink:href"===f?e.setAttributeNS("http://www.w3.org/1999/xlink",f,t.toString()):"onload"===f||"onclick"===f||"onmouse"===f.substring(0,7)?e.setAttribute("_"+f,t.toString()):"meta"===a&&"Content-Security-Policy"===n.attributes["http-equiv"]&&"content"===f?e.setAttribute("csp-content",t.toString()):"link"===a&&("preload"===n.attributes.rel||"modulepreload"===n.attributes.rel)&&"script"===n.attributes.as||"link"===a&&"prefetch"===n.attributes.rel&&"string"==typeof n.attributes.href&&n.attributes.href.endsWith(".js")||("img"===a&&n.attributes.srcset&&n.attributes.rr_dataURL?e.setAttribute("rrweb-original-srcset",n.attributes.srcset):e.setAttribute(f,t.toString()))}catch(t){}}}for(const v in l){var h,d=l[v];if("canvas"===a&&"rr_dataURL"===v){const p=document.createElement("img");p.onload=()=>{var t=e.getContext("2d");t&&t.drawImage(p,0,0,p.width,p.height)},p.src=d.toString(),e.RRNodeType&&(e.rr_dataURL=d.toString())}else"img"!==a||"rr_dataURL"!==v||(h=e).currentSrc.startsWith("data:")||(h.setAttribute("rrweb-original-src",n.attributes.src),h.src=d.toString());if("rr_width"===v)e.style.width=d.toString();else if("rr_height"===v)e.style.height=d.toString();else if("rr_mediaCurrentTime"===v&&"number"==typeof d)e.currentTime=d;else if("rr_mediaState"===v)switch(d){case"played":e.play().catch(t=>console.warn("media playback error",t));break;case"paused":e.pause()}}if(n.isShadowHost)if(e.shadowRoot)for(;e.shadowRoot.firstChild;)e.shadowRoot.removeChild(e.shadowRoot.firstChild);else e.attachShadow({mode:"open"});return e}case z.Text:return r.createTextNode(n.isStyle&&s?Tt(n.textContent,o):n.textContent);case z.CDATA:return r.createCDATASection(n.textContent);case z.Comment:return r.createComment(n.textContent);default:return null}}function Et(t,e){var n,{doc:i,mirror:r,skipChild:e=!1,hackCss:s=!0,afterAppend:o,cache:a}=e;if(r.has(t.id)){var l=r.getNode(t.id),l=r.getMeta(l);if(n=t,(l=l)&&n&&l.type===n.type&&(l.type===z.Document?l.compatMode===n.compatMode:l.type===z.DocumentType?l.name===n.name&&l.publicId===n.publicId&&l.systemId===n.systemId:l.type===z.Comment||l.type===z.Text||l.type===z.CDATA?l.textContent===n.textContent:l.type===z.Element&&l.tagName===n.tagName&&JSON.stringify(l.attributes)===JSON.stringify(n.attributes)&&l.isSVG===n.isSVG&&l.needBlock===n.needBlock))return r.getNode(t.id)}let u=Ct(t,{doc:i,hackCss:s,cache:a});if(!u)return null;if(t.rootId&&r.getNode(t.rootId)!==i&&r.replace(t.rootId,i),t.type===z.Document&&(i.close(),i.open(),"BackCompat"===t.compatMode&&t.childNodes&&t.childNodes[0].type!==z.DocumentType&&(t.childNodes[0].type===z.Element&&"xmlns"in t.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===t.childNodes[0].attributes.xmlns?i.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):i.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=i),r.add(u,t),(t.type===z.Document||t.type===z.Element)&&!e)for(const d of t.childNodes){var c=Et(d,{doc:i,mirror:r,skipChild:!1,hackCss:s,afterAppend:o,cache:a});if(c){if(d.isShadow&&$(u)&&u.shadowRoot)u.shadowRoot.appendChild(c);else if(t.type===z.Document&&d.type==z.Element){var h=c;let e=null;h.childNodes.forEach(t=>{"BODY"===t.nodeName&&(e=t)}),e?(h.removeChild(e),u.appendChild(c),h.appendChild(e)):u.appendChild(c)}else u.appendChild(c);o&&o(c,d.id)}else console.warn("Failed to rebuild",d)}return u}function xt(t,e){for(const i of t.getIds())t.has(i)&&(n=t.getNode(i),e(n));var n}function Mt(t,e){const{doc:n,onVisit:s,hackCss:i=!0,afterAppend:r,cache:o,mirror:a=new st}=e;Et(t,{doc:n,mirror:a,skipChild:!1,hackCss:i,afterAppend:r,cache:o});xt(a,t=>{s&&s(t);var e=a.getMeta(t);if((null==e?void 0:e.type)===z.Element){var n,i=t;for(const r in e.attributes)Object.prototype.hasOwnProperty.call(e.attributes,r)&&r.startsWith("rr_")&&(n=e.attributes[r],"rr_scrollLeft"===r&&(i.scrollLeft=n),"rr_scrollTop"===r)&&(i.scrollTop=n)}})}function K(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>n.removeEventListener(t,e,i)}const At="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let jt={map:{},getId(){return console.error(At),-1},getNode(){return console.error(At),null},removeNodeFromMap(){console.error(At)},has(){return console.error(At),!1},reset(){console.error(At)}};function Rt(r,s,o={}){let a=null,l=0;return function(...t){var e=Date.now(),n=(l||!1!==o.leading||(l=e),s-(e-l));const i=this;n<=0||s<n?(a&&(clearTimeout(a),a=null),l=e,r.apply(i,t)):a||!1===o.trailing||(a=setTimeout(()=>{l=!1===o.leading?0:Date.now(),a=null,r.apply(i,t)},n))}}function Nt(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e);return r.Object.defineProperty(t,e,i?n:{set(t){setTimeout(()=>{n.set.call(this,t)},0),s&&s.set&&s.set.call(this,t)}}),()=>Nt(t,e,s||{},!0)}function D(t,e,n){try{if(!(e in t))return()=>{};const r=t[e];var i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch(t){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(jt=new Proxy(jt,{get(t,e,n){return"map"===e&&console.error(At),Reflect.get(t,e,n)}}));let Dt=Date.now;function Lt(t){var e,n=t.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:(null==n?void 0:n.documentElement.scrollLeft)||(null==(e=null==(e=null==n?void 0:n.body)?void 0:e.parentElement)?void 0:e.scrollLeft)||(null==(e=null==n?void 0:n.body)?void 0:e.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==(t=null==(e=null==n?void 0:n.body)?void 0:e.parentElement)?void 0:t.scrollTop)||(null==(e=null==n?void 0:n.body)?void 0:e.scrollTop)||0}}function Ft(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Pt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ut(t){return t?t.nodeType===t.ELEMENT_NODE?t:t.parentElement:null}function L(t,e,n,i){if(t){t=Ut(t);if(t){try{if("string"==typeof e){if(t.classList.contains(e))return!0;if(i&&null!==t.closest("."+e))return!0}else if(E(t,e,i))return!0}catch(t){}if(n){if(t.matches(n))return!0;if(i&&null!==t.closest(n))return!0}}}return!1}function Gt(t,e){return-1!==e.getId(t)}function Wt(t,e){return e.getId(t)===dt}function $t(t,e){var n;return!B(t)&&(n=e.getId(t),!e.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||$t(t.parentNode,e)))}function Bt(t){return Boolean(t.changedTouches)}function Vt(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let e=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1})}function zt(t){const n={};var e=(t,e)=>{e={value:t,parent:e,children:[]};return n[t.node.id]=e},i=[];for(const a of t){var r,{nextId:s,parentId:o}=a;s&&s in n?(s=n[s]).parent?(r=s.parent.children.indexOf(s),s.parent.children.splice(r,0,e(a,s.parent))):(r=i.indexOf(s),i.splice(r,0,e(a,null))):o in n?(s=n[o]).children.push(e(a,s)):i.push(e(a,null))}return i}function Ht(e,n){n(e.value);for(let t=e.children.length-1;0<=t;t--)Ht(e.children[t],n)}function Jt(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function qt(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Yt(t,e){var n,t=null==(t=null==(t=t.ownerDocument)?void 0:t.defaultView)?void 0:t.frameElement;return t&&t!==e?(n=t.getBoundingClientRect(),e=Yt(t,e),t=n.height/t.clientHeight,{x:n.x*e.relativeScale+e.x,y:n.y*e.relativeScale+e.y,relativeScale:t,absoluteScale:e.absoluteScale*t}):{x:0,y:0,relativeScale:1,absoluteScale:1}}function X(t){return Boolean(null==t?void 0:t.shadowRoot)}function Kt(t,e){t=t[e[0]];return 1===e.length?t:Kt(t.cssRules[e[1]].cssRules,e.slice(2))}function Xt(t){var t=[...t],e=t.pop();return{positions:t,index:e}}function Qt(e){var n=new Set,i=[];for(let t=e.length;t--;){var r=e[t];n.has(r.id)||(i.push(r),n.add(r.id))}return i}/[1-9][0-9]{12}/.test(Date.now().toString())||(Dt=()=>(new Date).getTime());class Zt{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return null!=(t=this.styleIDMap.get(t))?t:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let n;return n=void 0===e?this.id++:e,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function te(t){var e;let n=null;return n=(null==(e=null==(e=t.getRootNode)?void 0:e.call(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host?t.getRootNode().host:n}function ee(t){let e=t;for(var n;n=te(e);)e=n;return e}function ne(t){var e=t.ownerDocument;return!!e&&(t=ee(t),e.contains(t))}function ie(t){var e=t.ownerDocument;return!!e&&(e.contains(t)||ne(t))}var Q=(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))(Q||{}),Z=(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))(Z||{}),h=(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))(h||{}),d=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(d||{}),f=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(f||{}),v=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t.Destroy="destroy",t))(v||{});function re(t){return"__ln"in t}class se{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let t=0;t<e;t++)n=(null===n||void 0===n?void 0:n.next)||null;return n}addNode(t){var e,n={value:t,previous:null,next:null};t.__ln=n,t.previousSibling&&re(t.previousSibling)?(e=t.previousSibling.__ln.next,n.next=e,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,e&&(e.previous=n)):t.nextSibling&&re(t.nextSibling)&&t.nextSibling.__ln.previous?(e=t.nextSibling.__ln.previous,n.previous=e,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,e&&(e.next=n)):(this.head&&(this.head.previous=n),n.next=this.head,this.head=n),null===n.next&&(this.tail=n),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--)}}class oe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(!this.frozen&&!this.locked){const l=[],u=new Set,c=new se,h=t=>{let e=t,n=dt;for(;n===dt;)e=e&&e.nextSibling,n=e&&this.mirror.getId(e);return n};for(var n,i,r=e=>{var t,n,i;if(e.parentNode&&ie(e)&&"TEXTAREA"!==e.parentNode.tagName)return t=B(e.parentNode)?this.mirror.getId(te(e)):this.mirror.getId(e.parentNode),n=h(e),-1===t||-1===n?c.addNode(e):void((i=St(e,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:t=>{Jt(t,this.mirror)&&this.iframeManager.addIframe(t),qt(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),X(e)&&this.shadowDomManager.addShadowRoot(e.shadowRoot,this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}}))&&(l.push({parentId:t,nextId:n,node:i}),u.add(i.id)))};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const d of this.movedSet)le(this.removes,d,this.mirror)&&!this.movedSet.has(d.parentNode)||r(d);for(const f of this.addedSet)!ue(this.droppedSet,f)&&!le(this.removes,f,this.mirror)||ue(this.movedSet,f)?r(f):this.droppedSet.add(f);let t=null;for(;c.length;){let e=null;if(!(e=t&&(n=this.mirror.getId(t.value.parentNode),i=h(t.value),-1!==n)&&-1!==i?t:e)){let t=c.tail;for(;t;){var s=t;if(t=t.previous,s){var o=this.mirror.getId(s.value.parentNode),a=h(s.value);if(-1!==a){if(-1!==o){e=s;break}a=s.value;if(a.parentNode&&a.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){o=a.parentNode.host;if(-1!==this.mirror.getId(o)){e=s;break}}}}}}if(!e){for(;c.head;)c.removeNode(c.head.value);break}t=e.previous,c.removeNode(e.value),r(e.value)}var e={texts:this.texts.map(t=>{var e=t.node;return"TEXTAREA"===e.parentNode.tagName&&this.genTextAreaValueMutation(e.parentNode),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!u.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.map(t=>{var e,n,i=t["attributes"];return"string"==typeof i.style&&(e=JSON.stringify(t.styleDiff),n=JSON.stringify(t.Ee),e.length<i.style.length)&&(e+n).split("var(").length===i.style.split("var(").length&&(i.style=t.styleDiff),{id:this.mirror.getId(t.node),attributes:i}}).filter(t=>!u.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:l};(e.texts.length||e.attributes.length||e.removes.length||e.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.movedMap={},this.mutationCb(e))}},this.genTextAreaValueMutation=t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},Ee:{}},this.attributes.push(e),this.attributeMap.set(t,e)),e.attributes.value=Array.from(t.childNodes,t=>t.textContent||"").join("")},this.processMutation=i=>{if(!Wt(i.target,this.mirror))switch(i.type){case"characterData":var r=i.target.textContent;L(i.target,this.blockClass,this.blockSelector,!1)||r===i.oldValue||this.texts.push({value:bt(i.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Ut(i.target)):r.replace(/[\S]/g,"*"):r,node:i.target});break;case"attributes":{var s=i.target;let t=i.attributeName,e=i.target.getAttribute(t);if("value"===t&&(r=lt(s),e=ot({element:s,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:r,value:e,maskInputFn:this.maskInputFn})),L(i.target,this.blockClass,this.blockSelector,!1)||e===i.oldValue)return;let n=this.attributeMap.get(i.target);if("IFRAME"===s.tagName&&"src"===t&&!this.keepIframeSrcFn(e)){if(s.contentDocument)return;t="rr_src"}if(n||(n={node:i.target,attributes:{},styleDiff:{},Ee:{}},this.attributes.push(n),this.attributeMap.set(i.target,n)),"type"===t&&"INPUT"===s.tagName&&"password"===(i.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!gt(s.tagName,t)&&(n.attributes[t]=yt(this.doc,H(s.tagName),H(t),e),"style"===t)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");i.oldValue&&o.setAttribute("style",i.oldValue);for(const u of Array.from(s.style)){var a=s.style.getPropertyValue(u),l=s.style.getPropertyPriority(u);a!==o.style.getPropertyValue(u)||l!==o.style.getPropertyPriority(u)?n.styleDiff[u]=""===l?a:[a,l]:n.Ee[u]=[a,l]}for(const c of Array.from(o.style))""===s.style.getPropertyValue(c)&&(n.styleDiff[c]=!1)}break}case"childList":L(i.target,this.blockClass,this.blockSelector,!0)||("TEXTAREA"!==i.target.tagName?(i.addedNodes.forEach(t=>this.genAdds(t,i.target)),i.removedNodes.forEach(t=>{var e=this.mirror.getId(t),n=B(i.target)?this.mirror.getId(i.target.host):this.mirror.getId(i.target);L(i.target,this.blockClass,this.blockSelector,!1)||Wt(t,this.mirror)||!Gt(t,this.mirror)||(this.addedSet.has(t)?(ae(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(i.target)&&-1===e||$t(i.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[e+"@"+n]?ae(this.movedSet,t):this.removes.push({parentId:n,id:e,isShadow:!(!B(i.target)||!V(i.target))||void 0})),this.mapRemoves.push(t))})):this.genTextAreaValueMutation(i.target))}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Wt(e,this.mirror))return;this.movedSet.add(e);let t=null;(t=n&&this.mirror.hasNode(n)?this.mirror.getId(n):t)&&-1!==t&&(this.movedMap[this.mirror.getId(e)+"@"+t]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);L(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),X(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ae(e,t){e.delete(t),t.childNodes.forEach(t=>ae(e,t))}function le(t,e,n){return 0!==t.length&&function t(e,n,i){const r=n["parentNode"];if(!r)return!1;const s=i.getId(r);if(e.some(t=>t.id===s))return!0;return t(e,r,i)}(t,e,n)}function ue(t,e){return 0!==t.size&&function t(e,n){const i=n["parentNode"];if(!i)return!1;if(e.has(i))return!0;return t(e,i)}(t,e)}let ce;const tt=e=>{return ce?(...t)=>{try{return e(...t)}catch(t){if(!ce||!0!==ce(t))throw t}}:e},et=[];function he(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 de(t,e){var n=new oe;et.push(n),n.init(t);let i=window.MutationObserver||window.__rrMutationObserver;var r=null==(r=null==(t=null===window||void 0===window?void 0:window.Zone)?void 0:t.__symbol__)?void 0:r.call(t,"MutationObserver"),t=new(i=r&&window[r]?window[r]:i)(tt(n.processMutations.bind(n)));return t.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function fe({mouseInteractionCb:o,doc:i,mirror:a,blockClass:l,blockSelector:u,sampling:t}){if(!1===t.mouseInteraction)return()=>{};const e=!0===t.mouseInteraction||void 0===t.mouseInteraction?{}:t.mouseInteraction,r=[];let c=null;return Object.keys(h).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==e[t]).forEach(t=>{let e=H(t);s=t;var s,n=n=>{var i=he(n);if(!L(i,l,u,!0)){let t=null,e=s;if("pointerType"in n){switch(n.pointerType){case"mouse":t=d.Mouse;break;case"touch":t=d.Touch;break;case"pen":t=d.Pen}t===d.Touch?h[s]===h.MouseDown?e="TouchStart":h[s]===h.MouseUp&&(e="TouchEnd"):(t,d.Pen)}else Bt(n)&&(t=d.Touch);null!==t?(c=t,(e.startsWith("Touch")&&t===d.Touch||e.startsWith("Mouse")&&t===d.Mouse)&&(t=null)):h[s]===h.Click&&(t=c,c=null);var r,n=Bt(n)?n.changedTouches[0]:n;n&&(i=a.getId(i),{clientX:n,clientY:r}=n,tt(o)(Object.assign({type:h[e],id:i,x:n,y:r},null!==t&&{pointerType:t})))}};if(window.PointerEvent)switch(h[t]){case h.MouseDown:case h.MouseUp:e=e.replace("mouse","pointer");break;case h.TouchStart:case h.TouchEnd:return}r.push(K(e,n,i))}),tt(()=>{r.forEach(t=>t())})}function ve({scrollCb:i,doc:r,mirror:s,blockClass:o,blockSelector:a,sampling:t}){return K("scroll",tt(Rt(tt(t=>{var e,n,t=he(t);t&&!L(t,o,a,!0)&&(e=s.getId(t),t===r&&r.defaultView?(n=Lt(r.defaultView),i({id:e,x:n.left,y:n.top})):i({id:e,x:t.scrollLeft,y:t.scrollTop}))}),t.scroll||100)),r)}const pe=["INPUT","TEXTAREA","SELECT"],me=new WeakMap;function ye(t){var e,n;return t=t,e=[],we("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||we("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||we("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||we("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule?(n=Array.from(t.parentRule.cssRules).indexOf(t),e.unshift(n)):t.parentStyleSheet&&(n=Array.from(t.parentStyleSheet.cssRules).indexOf(t),e.unshift(n)),e}function F(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function ge({mirror:t,stylesheetManager:n},e){let i=null;i="#document"===e.nodeName?t.getId(e):t.getId(e.host);t="#document"===e.nodeName?null==(t=e.defaultView)?void 0:t.Document:null==(t=null==(t=e.ownerDocument)?void 0:t.defaultView)?void 0:t.ShadowRoot;const r=null!=t&&t.prototype?Object.getOwnPropertyDescriptor(null==t?void 0:t.prototype,"adoptedStyleSheets"):void 0;return null!==i&&-1!==i&&t&&r?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:r.configurable,enumerable:r.enumerable,get(){var t;return null==(t=r.get)?void 0:t.call(this)},set(t){var e=null==(e=r.set)?void 0:e.call(this,t);if(null!==i&&-1!==i)try{n.adoptStyleSheets(t,i)}catch(t){}return e}}),tt(()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:r.configurable,enumerable:r.enumerable,get:r.get,set:r.set})})):()=>{}}function be(t,e={}){var r,n=t.doc.defaultView;if(!n)return()=>{};{var i=t,s=e;const{mutationCb:w,mousemoveCb:S,mouseInteractionCb:_,scrollCb:O,viewportResizeCb:k,inputCb:T,mediaInteractionCb:I,styleSheetRuleCb:C,styleDeclarationCb:E,canvasMutationCb:x,fontCb:M,selectionCb:A,customElementCb:j}=i;i.mutationCb=(...t)=>{s.mutation&&s.mutation(...t),w(...t)},i.mousemoveCb=(...t)=>{s.mousemove&&s.mousemove(...t),S(...t)},i.mouseInteractionCb=(...t)=>{s.mouseInteraction&&s.mouseInteraction(...t),_(...t)},i.scrollCb=(...t)=>{s.scroll&&s.scroll(...t),O(...t)},i.viewportResizeCb=(...t)=>{s.viewportResize&&s.viewportResize(...t),k(...t)},i.inputCb=(...t)=>{s.input&&s.input(...t),T(...t)},i.mediaInteractionCb=(...t)=>{s.mediaInteaction&&s.mediaInteaction(...t),I(...t)},i.styleSheetRuleCb=(...t)=>{s.styleSheetRule&&s.styleSheetRule(...t),C(...t)},i.styleDeclarationCb=(...t)=>{s.styleDeclaration&&s.styleDeclaration(...t),E(...t)},i.canvasMutationCb=(...t)=>{s.canvasMutation&&s.canvasMutation(...t),x(...t)},i.fontCb=(...t)=>{s.font&&s.font(...t),M(...t)},i.selectionCb=(...t)=>{s.selection&&s.selection(...t),A(...t)},i.customElementCb=(...t)=>{s.customElement&&s.customElement(...t),j(...t)}}let o;t.recordDOM&&(o=de(t,t.doc));const a=function({mousemoveCb:n,sampling:t,doc:e,mirror:r}){if(!1===t.mousemove)return()=>{};var i="number"==typeof t.mousemove?t.mousemove:50,t="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s=[],o;const a=Rt(tt(t=>{const e=Date.now()-o;n(s.map(t=>(t.timeOffset-=e,t)),t),s=[],o=null}),t),l=[K("mousemove",t=tt(Rt(tt(t=>{var e=he(t),{clientX:n,clientY:i}=Bt(t)?t.changedTouches[0]:t;o=o||Dt(),s.push({x:n,y:i,id:r.getId(e),timeOffset:Dt()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?Z.Drag:t instanceof MouseEvent?Z.MouseMove:Z.TouchMove)}),i,{trailing:!1})),e),K("touchmove",t,e),K("drag",t,e)];return tt(()=>{l.forEach(t=>t())})}(t),l=fe(t),u=ve(t),c=function({viewportResizeCb:n},{win:t}){let i=-1,r=-1;return K("resize",tt(Rt(tt(()=>{var t=Ft(),e=Pt();i===t&&r===e||(n({width:Number(e),height:Number(t)}),i=t,r=e)}),200)),t)}(t,{win:n}),h=function({inputCb:i,doc:o,mirror:r,blockClass:t,blockSelector:n,ignoreClass:a,ignoreSelector:l,maskInputOptions:u,maskInputFn:c,sampling:e,userTriggeredOnInput:h}){function s(e){let i=he(e);var e=e.isTrusted,r=i&&i.tagName;if((i=i&&"OPTION"===r?i.parentElement:i)&&r&&!(pe.indexOf(r)<0)&&!L(i,t,n,!0)&&!(i.classList.contains(a)||l&&i.matches(l))){let t=i.value,n=!1;var s=lt(i)||"",r=("radio"===s||"checkbox"===s?n=i.checked:(u[r.toLowerCase()]||u[s])&&(t=ot({element:i,maskInputOptions:u,tagName:r,type:s,value:t,maskInputFn:c})),d(i,h?{text:t,isChecked:n,userTriggered:e}:{text:t,isChecked:n}),i.name);"radio"===s&&r&&n&&o.querySelectorAll(`input[type="radio"][name="${r}"]`).forEach(t=>{var e;t!==i&&(e=t.value,d(t,h?{text:e,isChecked:!n,userTriggered:!1}:{text:e,isChecked:!n}))})}}function d(t,e){var n=me.get(t);n&&n.text===e.text&&n.isChecked===e.isChecked||(me.set(t,e),n=r.getId(t),tt(i)(Object.assign(Object.assign({},e),{id:n})))}var f;const v=("last"===e.input?["change"]:["input","change"]).map(t=>K(t,tt(s),o)),p=o.defaultView;return p?(e=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),f=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]],e&&e.set&&v.push(...f.map(t=>Nt(t[0],t[1],{set(){tt(s)({target:this,isTrusted:!1})}},!1,p))),tt(()=>{v.forEach(t=>t())})):()=>{v.forEach(t=>t())}}(t),d=function({mediaInteractionCb:o,blockClass:a,blockSelector:l,mirror:u,sampling:t,doc:e}){var n=tt(s=>Rt(tt(t=>{var e,n,i,r,t=he(t);t&&!L(t,a,l,!0)&&({currentTime:e,volume:n,muted:i,playbackRate:r}=t,o({type:s,id:u.getId(t),currentTime:e,volume:n,muted:i,playbackRate:r}))}),t.media||500));const i=[K("play",n(0),e),K("pause",n(1),e),K("seeked",n(2),e),K("volumechange",n(3),e),K("ratechange",n(4),e)];return tt(()=>{i.forEach(t=>t())})}(t);let f=()=>{},v=()=>{},p=()=>{},m=()=>{};t.recordDOM&&(f=function({styleSheetRuleCb:a,mirror:l,stylesheetManager:u},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const e=t.CSSStyleSheet.prototype.insertRule,n=(t.CSSStyleSheet.prototype.insertRule=new Proxy(e,{apply:tt((t,e,n)=>{var[i,r]=n,{id:s,styleId:o}=F(e,l,u.styleMirror);return(s&&-1!==s||o&&-1!==o)&&a({id:s,styleId:o,adds:[{rule:i,index:r}]}),t.apply(e,n)})}),t.CSSStyleSheet.prototype.deleteRule);t.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:tt((t,e,n)=>{var[i]=n,{id:r,styleId:s}=F(e,l,u.styleMirror);return(r&&-1!==r||s&&-1!==s)&&a({id:r,styleId:s,removes:[{index:i}]}),t.apply(e,n)})});let i;t.CSSStyleSheet.prototype.replace&&(i=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:tt((t,e,n)=>{var[i]=n,{id:r,styleId:s}=F(e,l,u.styleMirror);return(r&&-1!==r||s&&-1!==s)&&a({id:r,styleId:s,replace:i}),t.apply(e,n)})}));let r;t.CSSStyleSheet.prototype.replaceSync&&(r=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(r,{apply:tt((t,e,n)=>{var[i]=n,{id:r,styleId:s}=F(e,l,u.styleMirror);return(r&&-1!==r||s&&-1!==s)&&a({id:r,styleId:s,replaceSync:i}),t.apply(e,n)})}));const s={},o=(Se("CSSGroupingRule")?s.CSSGroupingRule=t.CSSGroupingRule:(Se("CSSMediaRule")&&(s.CSSMediaRule=t.CSSMediaRule),Se("CSSConditionRule")&&(s.CSSConditionRule=t.CSSConditionRule),Se("CSSSupportsRule")&&(s.CSSSupportsRule=t.CSSSupportsRule)),{});return Object.entries(s).forEach(([t,e])=>{o[t]={insertRule:e.prototype.insertRule,deleteRule:e.prototype.deleteRule},e.prototype.insertRule=new Proxy(o[t].insertRule,{apply:tt((t,e,n)=>{var[i,r]=n,{id:s,styleId:o}=F(e.parentStyleSheet,l,u.styleMirror);return(s&&-1!==s||o&&-1!==o)&&a({id:s,styleId:o,adds:[{rule:i,index:[...ye(e),r||0]}]}),t.apply(e,n)})}),e.prototype.deleteRule=new Proxy(o[t].deleteRule,{apply:tt((t,e,n)=>{var[i]=n,{id:r,styleId:s}=F(e.parentStyleSheet,l,u.styleMirror);return(r&&-1!==r||s&&-1!==s)&&a({id:r,styleId:s,removes:[{index:[...ye(e),i]}]}),t.apply(e,n)})})}),tt(()=>{t.CSSStyleSheet.prototype.insertRule=e,t.CSSStyleSheet.prototype.deleteRule=n,i&&(t.CSSStyleSheet.prototype.replace=i),r&&(t.CSSStyleSheet.prototype.replaceSync=r),Object.entries(s).forEach(([t,e])=>{e.prototype.insertRule=o[t].insertRule,e.prototype.deleteRule=o[t].deleteRule})})}(t,{win:n}),v=ge(t,t.doc),p=function({styleDeclarationCb:l,mirror:u,ignoreCSSAttributes:c,stylesheetManager:h},{win:t}){const d=t.CSSStyleDeclaration.prototype.setProperty,o=(t.CSSStyleDeclaration.prototype.setProperty=new Proxy(d,{apply:tt((t,e,n)=>{var i,r,[s,o,a]=n;return c.has(s)?d.apply(e,[s,o,a]):({id:i,styleId:r}=F(null==(i=e.parentRule)?void 0:i.parentStyleSheet,u,h.styleMirror),(i&&-1!==i||r&&-1!==r)&&l({id:i,styleId:r,set:{property:s,value:o,priority:a},index:ye(e.parentRule)}),t.apply(e,n))})}),t.CSSStyleDeclaration.prototype.removeProperty);return t.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:tt((t,e,n)=>{var i,r,[s]=n;return c.has(s)?o.apply(e,[s]):({id:i,styleId:r}=F(null==(i=e.parentRule)?void 0:i.parentStyleSheet,u,h.styleMirror),(i&&-1!==i||r&&-1!==r)&&l({id:i,styleId:r,remove:{property:s},index:ye(e.parentRule)}),t.apply(e,n))})}),tt(()=>{t.CSSStyleDeclaration.prototype.setProperty=d,t.CSSStyleDeclaration.prototype.removeProperty=o})}(t,{win:n}),t.collectFonts)&&(m=function({fontCb:n,doc:t}){const e=t.defaultView;if(!e)return()=>{};const i=[],r=new WeakMap,s=e.FontFace;return e.FontFace=function(t,e,n){var i=new s(t,e,n);return r.set(i,{family:t,buffer:"string"!=typeof e,descriptors:n,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i},t=D(t.fonts,"add",function(t){return function(e){return setTimeout(tt(()=>{var t=r.get(e);t&&(n(t),r.delete(e))}),0),t.apply(this,[e])}}),i.push(()=>{e.FontFace=s}),i.push(t),tt(()=>{i.forEach(t=>t())})}(t));const y=function(t){const{doc:l,mirror:u,blockClass:c,blockSelector:h,selectionCb:d}=t;let f=!0;return(t=tt(()=>{var e=l.getSelection();if(!(!e||f&&null!=e&&e.isCollapsed)){f=e.isCollapsed||!1;var n=[],i=e.rangeCount||0;for(let t=0;t<i;t++){var{startContainer:r,startOffset:s,endContainer:o,endOffset:a}=e.getRangeAt(t);L(r,c,h,!0)||L(o,c,h,!0)||n.push({start:u.getId(r),startOffset:s,end:u.getId(o),endOffset:a})}d({ranges:n})}}))(),K("selectionchange",t)}(t),g=({doc:e,customElementCb:r}=[t][0],(e=e.defaultView)&&e.customElements?D(e.customElements,"define",function(i){return function(e,t,n){try{r({define:{name:e}})}catch(t){console.warn("Custom element callback failed for "+e)}return i.apply(this,[e,t,n])}}):()=>{}),b=[];for(const R of t.plugins)b.push(R.observer(R.callback,n,R.options));return tt(()=>{et.forEach(t=>t.reset()),null!==o&&void 0!==o&&o.disconnect(),a(),l(),u(),c(),h(),d(),f(),v(),p(),m(),y(),g(),b.forEach(t=>t())})}function we(t){return void 0!==window[t]}function Se(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class _e{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,e,n,i){n=n||this.getIdToRemoteIdMap(t),i=i||this.getRemoteIdToIdMap(t);let r=n.get(e);return r||(r=this.generateIdFn(),n.set(e,r),i.set(r,e)),r}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,i))}getRemoteId(t,e,n){n=n||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:n.get(e)||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(t){t?(this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)):(this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap)}getIdToRemoteIdMap(t){let e=this.iframeIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeIdToRemoteIdMap.set(t,e)),e}getRemoteIdToIdMap(t){let e=this.iframeRemoteIdToIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToIdMap.set(t,e)),e}}class Oe{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new _e(u),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new _e(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,e){this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null!=(e=this.loadListener)&&e.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&0<t.contentDocument.adoptedStyleSheets.length&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){var e=t;"rrweb"===e.data.type&&e.origin===e.data.origin&&t.source&&(t=(t=this.crossOriginIframeMap.get(t.source))&&this.transformCrossOriginEvent(t,e.data.event))&&this.wrappedEmit(t,e.data.isCheckout)}transformCrossOriginEvent(n,t){var e;switch(t.type){case Q.FullSnapshot:this.crossOriginIframeMirror.reset(n),this.crossOriginIframeStyleMirror.reset(n),this.replaceIdOnNode(t.data.node,n);var i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(n,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:Q.IncrementalSnapshot,data:{source:Z.Mutation,adds:[{parentId:this.mirror.getId(n),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Q.Meta:case Q.Load:case Q.DomContentLoaded:return!1;case Q.Plugin:return t;case Q.Custom:return this.replaceIds(t.data.payload,n,["id","parentId","previousId","nextId"]),t;case Q.IncrementalSnapshot:switch(t.data.source){case Z.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,n,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,n);var e=this.crossOriginIframeRootIdMap.get(n);e&&this.patchRootIdOnNode(t.node,e)}),t.data.removes.forEach(t=>{this.replaceIds(t,n,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,n,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,n,["id"])}),t;case Z.Drag:case Z.TouchMove:case Z.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,n,["id"])}),t;case Z.ViewportResize:return!1;case Z.MediaInteraction:case Z.MouseInteraction:case Z.Scroll:case Z.CanvasMutation:case Z.Input:return this.replaceIds(t.data,n,["id"]),t;case Z.StyleSheetRule:case Z.StyleDeclaration:return this.replaceIds(t.data,n,["id"]),this.replaceStyleIds(t.data,n,["styleId"]),t;case Z.Font:return t;case Z.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,n,["start","end"])}),t;case Z.AdoptedStyleSheet:return this.replaceIds(t.data,n,["id"]),this.replaceStyleIds(t.data,n,["styleIds"]),null!=(e=t.data.styles)&&e.forEach(t=>{this.replaceStyleIds(t,n,["styleId"])}),t}}return!1}replace(t,e,n,i){for(const r of i)!Array.isArray(e[r])&&"number"!=typeof e[r]||(Array.isArray(e[r])?e[r]=t.getIds(n,e[r]):e[r]=t.getId(n,e[r]));return e}replaceIds(t,e,n){return this.replace(this.crossOriginIframeMirror,t,e,n)}replaceStyleIds(t,e,n){return this.replace(this.crossOriginIframeStyleMirror,t,e,n)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===z.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}}class ke{constructor(t){this.shadowDoms=new WeakSet,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){if(V(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);const n=de(Object.assign(Object.assign({},this.bypassOptions),{doc:e,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(ve(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&0<t.adoptedStyleSheets.length&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(ge({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){const i=this;this.restoreHandlers.push(D(t.prototype,"attachShadow",function(e){return function(t){t=e.call(this,t);return this.shadowRoot&&ie(this)&&i.addShadowRoot(this.shadowRoot,n),t}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}function p(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})}for(var Te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ie="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ce=0;Ce<Te.length;Ce++)Ie[Te.charCodeAt(Ce)]=Ce;function Ee(t){for(var e=new Uint8Array(t),n=e.length,i="",r=0;r<n;r+=3)i=(i=(i=(i+=Te[e[r]>>2])+Te[(3&e[r])<<4|e[r+1]>>4])+Te[(15&e[r+1])<<2|e[r+2]>>6])+Te[63&e[r+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function xe(t){for(var e,n,i,r,s=.75*t.length,o=t.length,a=0,s=("="===t[t.length-1]&&(s--,"="===t[t.length-2])&&s--,new ArrayBuffer(s)),l=new Uint8Array(s),u=0;u<o;u+=4)e=Ie[t.charCodeAt(u)],n=Ie[t.charCodeAt(u+1)],i=Ie[t.charCodeAt(u+2)],r=Ie[t.charCodeAt(u+3)],l[a++]=e<<2|n>>4,l[a++]=(15&n)<<4|i>>2,l[a++]=(3&i)<<6|63&r;return s}const Me=new Map;const Ae=(e,n,i)=>{if(e&&(Re(e,n)||"object"==typeof e)){n=function(t,e){let n=Me.get(t);return n||(n=new Map,Me.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}(i,e.constructor.name);let t=n.indexOf(e);return-1===t&&(t=n.length,n.push(e)),t}};const je=(t,e,n)=>t.map(t=>function e(t,n,i){var r;return t instanceof Array?t.map(t=>e(t,n,i)):null===t?t: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?{rr_type:t.constructor.name,args:[Object.values(t)]}:t instanceof ArrayBuffer?{rr_type:t.constructor.name,base64:Ee(t)}:t instanceof DataView?{rr_type:t.constructor.name,args:[e(t.buffer,n,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?(r=t.src,{rr_type:t.constructor.name,src:r}):t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL()}:t instanceof ImageData?{rr_type:t.constructor.name,args:[e(t.data,n,i),t.width,t.height]}:Re(t,n)||"object"==typeof t?{rr_type:t.constructor.name,index:Ae(t,n,i)}:t}(t,e,n)),Re=(e,n)=>{var t=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof n[t]);return Boolean(t.find(t=>e instanceof n[t]))};function Ne(t,r,s,o){const e=[];try{var n=D(t.HTMLCanvasElement.prototype,"getContext",function(i){return function(t,...e){var n;return L(this,r,s,!0)||(n="experimental-webgl"===(n=t)?"webgl":n,"__context"in this||(this.__context=n),o&&["webgl","webgl2"].includes(n)&&(e[0]&&"object"==typeof e[0]?(n=e[0]).preserveDrawingBuffer||(n.preserveDrawingBuffer=!0):e.splice(0,1,{preserveDrawingBuffer:!0}))),i.apply(this,[t,...e])}});e.push(n)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{e.forEach(t=>t())}}function De(e,i,r,s,o,t,a){var n,l=[];for(const c of Object.getOwnPropertyNames(e))if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{"function"==typeof e[c]&&(n=D(e,c,function(n){return function(...t){var e=n.apply(this,t);return Ae(e,a,this),"tagName"in this.canvas&&!L(this.canvas,s,o,!0)&&(t=je(t,a,this),t={type:i,property:c,args:t},r(this.canvas,t)),e}}),l.push(n))}catch(t){var u=Nt(e,c,{set(t){r(this.canvas,{type:i,property:c,args:[t],setter:!0})}});l.push(u)}return l}function Le(t,e){t=function(t,e){for(var e=void 0===e?null:e,n=t.toString().split("\n"),i=(n.pop(),n.shift(),n[0].search(/\S/)),r=/(['"])__worker_loader_strict__(['"])/g,s=0,o=n.length;s<o;++s)n[s]=n[s].substring(i).replace(r,"$1use strict$2")+"\n";return e&&n.push("//# sourceMappingURL="+e+"\n"),n}(t,e),e=new Blob(t,{type:"application/javascript"});return URL.createObjectURL(e)}Pe=null;var Fe,Pe,Ue,Ge=function(t){return Ue=Ue||Le(Fe,Pe),new Worker(Ue,t)};class We{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,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{sampling:e="all",win:n,blockClass:i,blockSelector:r,recordCanvas:s,dataURLOptions:o}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&"all"===e&&this.initCanvasMutationObserver(n,i,r),s&&"number"==typeof e&&this.initCanvasFPSObserver(e,n,i,r,{dataURLOptions:o})}initCanvasFPSObserver(t,n,i,r,s){const e=Ne(n,i,r,!0),o=new Map,a=new Ge,l=(a.onmessage=t=>{var e,n,i,r=t.data["id"];o.set(r,!1),"base64"in t.data&&({base64:t,type:e,width:n,height:i}=t.data,this.mutationCb({id:r,type:f["2D"],commands:[{property:"clearRect",args:[0,0,n,i]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:t}],type:e}]},0,0]}]}))},1e3/t);let u=0,c;const h=()=>{const e=[];return n.document.querySelectorAll("canvas").forEach(t=>{L(t,i,r,!0)||e.push(t)}),e},d=t=>{c=(u&&t-u<l||(u=t,h().forEach(i=>p(this,void 0,void 0,function*(){var t,e,n=this.mirror.getId(i);o.get(n)||(o.set(n,!0),["webgl","webgl2"].includes(i.__context)&&!1===(null==(e=null==(t=i.getContext(i.__context))?void 0:t.getContextAttributes())?void 0:e.preserveDrawingBuffer)&&t.clear(t.COLOR_BUFFER_BIT),e=yield createImageBitmap(i),a.postMessage({id:n,bitmap:e,width:i.width,height:i.height,dataURLOptions:s.dataURLOptions},[e]))}))),requestAnimationFrame(d))};c=requestAnimationFrame(d),this.resetObservers=()=>{e(),cancelAnimationFrame(c)}}initCanvasMutationObserver(t,e,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Ne(t,e,n,!1),r=function(n,i,r,s){const e=[];var t;for(const a of Object.getOwnPropertyNames(i.CanvasRenderingContext2D.prototype))try{"function"==typeof i.CanvasRenderingContext2D.prototype[a]&&(t=D(i.CanvasRenderingContext2D.prototype,a,function(t){return function(...e){return L(this.canvas,r,s,!0)||setTimeout(()=>{var t=je(e,i,this);n(this.canvas,{type:f["2D"],property:a,args:t})},0),t.apply(this,e)}}),e.push(t))}catch(t){var o=Nt(i.CanvasRenderingContext2D.prototype,a,{set(t){n(this.canvas,{type:f["2D"],property:a,args:[t],setter:!0})}});e.push(o)}return()=>{e.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n),s=function(t,e,n,i){const r=[];return r.push(...De(e.WebGLRenderingContext.prototype,f.WebGL,t,n,i,0,e)),void 0!==e.WebGL2RenderingContext&&r.push(...De(e.WebGL2RenderingContext.prototype,f.WebGL2,t,n,i,0,e)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n,this.mirror);this.resetObservers=()=>{i(),r(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{var n=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){var n,i;this.frozen||this.locked||(i=this.pendingCanvasMutations.get(t))&&-1!==e&&(n=i.map(t=>{var e=t,n=["type"],i={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&n.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)n.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]]);return i}),i=i[0]["type"],this.mutationCb({id:e,type:i,commands:n}),this.pendingCanvasMutations.delete(t))}}class $e{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Zt,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"le"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0!==t.length){var n={id:e,styleIds:[]},i=[];for(const r of t){let t;this.styleMirror.has(r)?t=this.styleMirror.getId(r):(t=this.styleMirror.add(r),i.push({styleId:t,rules:Array.from(r.rules||CSSRule,(t,e)=>({rule:a(t),index:e}))})),n.styleIds.push(t)}0<i.length&&(n.styles=i),this.adoptedStyleSheetCb(n)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Be{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,e){t=this.nodeMap.get(t);return t&&Array.from(t).some(t=>t!==e)}add(t,e){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function nt(t){return Object.assign(Object.assign({},t),{timestamp:Dt()})}let it,Ve,ze,He=!(Fe=function(){{function l(t,o,a,l){return new(a=a||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})}for(var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),e=0;e<s.length;e++)t[s.charCodeAt(e)]=e;function u(t){for(var e=new Uint8Array(t),n=e.length,i="",r=0;r<n;r+=3)i=(i=(i=(i+=s[e[r]>>2])+s[(3&e[r])<<4|e[r+1]>>4])+s[(15&e[r+1])<<2|e[r+2]>>6])+s[63&e[r+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}const c=new Map,h=new Map,d=self;d.onmessage=function(a){return l(this,void 0,void 0,function*(){var t,e,n,i,r,s,o;return"OffscreenCanvas"in globalThis?({id:t,bitmap:o,width:e,height:n,dataURLOptions:s}=a.data,i=function(n,i,r){return l(this,void 0,void 0,function*(){var t=n+"-"+i;if("OffscreenCanvas"in globalThis){if(h.has(t))return h.get(t);var e=new OffscreenCanvas(n,i);e.getContext("2d");e=yield(yield e.convertToBlob(r)).arrayBuffer(),e=u(e);return h.set(t,e),e}return""})}(e,n,s),(r=new OffscreenCanvas(e,n)).getContext("2d").drawImage(o,0,0),o.close(),r=(o=yield r.convertToBlob(s)).type,s=yield o.arrayBuffer(),o=u(s),c.has(t)||(yield i)!==o?c.get(t)===o?d.postMessage({id:t}):(d.postMessage({id:t,type:r,base64:o,width:e,height:n}),void c.set(t,o)):(c.set(t,o),d.postMessage({id:t}))):d.postMessage({id:a.data.id})})}}});const rt=l();function n(t={}){const{emit:i,checkoutEveryNms:r,checkoutEveryNth:s,blockClass:n="rr-block",blockSelector:o=null,ignoreClass:L="rr-ignore",ignoreSelector:F=null,maskTextClass:a="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:P,maskInputOptions:e,slimDOMOptions:c,maskInputFn:h,maskTextFn:d,hooks:U,packFn:f,sampling:v={},dataURLOptions:p={},mousemoveWait:m,recordDOM:y=!0,recordCanvas:g=!1,recordCrossOriginIframes:G=!1,recordAfter:W="DOMContentLoaded"===t.recordAfter?t.recordAfter:"load",userTriggeredOnInput:$=!1,collectFonts:B=!1,inlineImages:b=!1,plugins:w,keepIframeSrcFn:S=()=>!1,ignoreCSSAttributes:V=new Set([]),errorHandler:z}=t;t=z,ce=t;const _=!G||window.parent===window;let O=!1;if(!_)try{window.parent.document&&(O=!1)}catch(t){O=!0}if(_&&!i)throw new Error("emit function is required");void 0!==m&&void 0===v.mousemove&&(v.mousemove=m),rt.reset();const k=!0===P?{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!==e?e:{password:!0},T=!0===c||"all"===c?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===c,headMetaDescKeywords:"all"===c}:c||{};Vt();let H,I=0;const J=t=>{for(const e of w||[])e.eventProcessor&&(t=e.eventProcessor(t));return t=f&&!O?f(t):t},C=(it=(t,e)=>{var n;null==(n=et[0])||!n.isFrozen()||t.type===Q.FullSnapshot||t.type===Q.IncrementalSnapshot&&t.data.source===Z.Mutation||et.forEach(t=>t.unfreeze()),_?null!==i&&void 0!==i&&i(J(t),e):O&&(n={type:"rrweb",event:J(t),origin:window.location.origin,isCheckout:e},window.parent.postMessage(n,"*")),t.type===Q.FullSnapshot?(H=t,I=0):t.type!==Q.IncrementalSnapshot||t.data.source===Z.Mutation&&t.data.isAttachIframe||(I++,e=s&&I>=s,n=r&&t.timestamp-H.timestamp>r,(e||n)&&Ve(!0))},t=>{it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.Mutation},t)}))}),q=t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.Scroll},t)})),Y=t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.CanvasMutation},t)}));const E=new $e({mutationCb:C,adoptedStyleSheetCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.AdoptedStyleSheet},t)}))}),x=new Oe({mirror:rt,mutationCb:C,stylesheetManager:E,recordCrossOriginIframes:G,wrappedEmit:it});for(const j of w||[])j.getMirror&&j.getMirror({nodeMirror:rt,crossOriginIframeMirror:x.crossOriginIframeMirror,crossOriginIframeStyleMirror:x.crossOriginIframeStyleMirror});const M=new Be,A=(ze=new We({recordCanvas:g,mutationCb:Y,win:window,blockClass:n,blockSelector:o,mirror:rt,sampling:v.canvas,dataURLOptions:p}),new ke({mutationCb:C,scrollCb:q,bypassOptions:{blockClass:n,blockSelector:o,maskTextClass:a,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:k,dataURLOptions:p,maskTextFn:d,maskInputFn:h,recordCanvas:g,inlineImages:b,sampling:v,slimDOMOptions:T,iframeManager:x,stylesheetManager:E,canvasManager:ze,keepIframeSrcFn:S,processedNodeManager:M},mirror:rt}));Ve=(t=!1)=>{if(y){it(nt({type:Q.Meta,data:{href:window.location.href,width:Pt(),height:Ft()}}),t),E.reset(),A.init(),et.forEach(t=>t.lock());var e=function(t,e){var{mirror:e=new st,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:r="rr-mask",maskTextSelector:s=null,inlineStylesheet:o=!0,inlineImages:a=!1,recordCanvas:l=!1,maskAllInputs:u=!1,maskTextFn:c,maskInputFn:h,slimDOM:d=!1,dataURLOptions:f,preserveWhiteSpace:v,onSerialize:p,onIframeLoad:m,iframeLoadTimeout:y,onStylesheetLoad:g,stylesheetLoadTimeout:b,keepIframeSrcFn:w=()=>!1}=e||{};return St(t,{doc:t,mirror:e,blockClass:n,blockSelector:i,maskTextClass:r,maskTextSelector:s,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===u?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===u?{password:!0}:u,maskTextFn:c,maskInputFn:h,slimDOMOptions:!0===d||"all"===d?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===d,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===d?{}:d,dataURLOptions:f,inlineImages:a,recordCanvas:l,preserveWhiteSpace:v,onSerialize:p,onIframeLoad:m,iframeLoadTimeout:y,onStylesheetLoad:g,stylesheetLoadTimeout:b,keepIframeSrcFn:w,newlyAddedElement:!1})}(document,{mirror:rt,blockClass:n,blockSelector:o,maskTextClass:a,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:k,maskTextFn:d,slimDOM:T,dataURLOptions:p,recordCanvas:g,inlineImages:b,onSerialize:t=>{Jt(t,rt)&&x.addIframe(t),qt(t,rt)&&E.trackLinkElement(t),X(t)&&A.addShadowRoot(t.shadowRoot,document)},onIframeLoad:(t,e)=>{x.attachIframe(t,e),A.observeAttachShadow(t)},onStylesheetLoad:(t,e)=>{E.attachLinkElement(t,e)},keepIframeSrcFn:S});if(!e)return console.warn("Failed to snapshot the document");it(nt({type:Q.FullSnapshot,data:{node:e,initialOffset:Lt(window)}}),t),et.forEach(t=>t.unlock()),document.adoptedStyleSheets&&0<document.adoptedStyleSheets.length&&E.adoptStyleSheets(document.adoptedStyleSheets,rt.getId(document))}};try{const R=[],N=t=>{return tt(be)({mutationCb:C,mousemoveCb:(t,e)=>it(nt({type:Q.IncrementalSnapshot,data:{source:e,positions:t}})),mouseInteractionCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.MouseInteraction},t)})),scrollCb:q,viewportResizeCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.ViewportResize},t)})),inputCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.Input},t)})),mediaInteractionCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.MediaInteraction},t)})),styleSheetRuleCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.StyleSheetRule},t)})),styleDeclarationCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.StyleDeclaration},t)})),canvasMutationCb:Y,fontCb:t=>it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.Font},t)})),selectionCb:t=>{it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.Selection},t)}))},customElementCb:t=>{it(nt({type:Q.IncrementalSnapshot,data:Object.assign({source:Z.CustomElement},t)}))},blockClass:n,ignoreClass:L,ignoreSelector:F,maskTextClass:a,maskTextSelector:l,maskInputOptions:k,inlineStylesheet:u,sampling:v,recordDOM:y,recordCanvas:g,inlineImages:b,userTriggeredOnInput:$,collectFonts:B,doc:t,maskInputFn:h,maskTextFn:d,keepIframeSrcFn:S,blockSelector:o,slimDOMOptions:T,dataURLOptions:p,mirror:rt,iframeManager:x,stylesheetManager:E,shadowDomManager:A,processedNodeManager:M,canvasManager:ze,ignoreCSSAttributes:V,plugins:(null==(t=null===w||void 0===w?void 0:w.filter(t=>t.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>it(nt({type:Q.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},U)},D=(x.addLoadListener(t=>{try{R.push(N(t.contentDocument))}catch(t){console.warn(t)}}),()=>{Ve(),R.push(N(document)),He=!0});return"interactive"===document.readyState||"complete"===document.readyState?D():(R.push(K("DOMContentLoaded",()=>{it(nt({type:Q.DomContentLoaded,data:{}})),"DOMContentLoaded"===W&&D()})),R.push(K("load",()=>{it(nt({type:Q.Load,data:{}})),"load"===W&&D()},window))),()=>{R.forEach(t=>t()),M.destroy(),He=!1,ce=void 0}}catch(t){console.warn(t)}}n.addCustomEvent=(t,e)=>{if(!He)throw new Error("please add custom event after start recording");it(nt({type:Q.Custom,data:{tag:t,payload:e}}))},n.freezePage=()=>{et.forEach(t=>t.freeze())},n.takeFullSnapshot=t=>{if(!He)throw new Error("please take full snapshot after start recording");Ve(t)},n.mirror=rt;const Je=n["addCustomEvent"],qe=n["freezePage"];for(var J=Uint8Array,q=Uint16Array,Ye=Uint32Array,Ke=new J([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]),Xe=new J([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]),Qe=new J([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t=function(t,e){for(var n=new q(31),i=0;i<31;++i)n[i]=e+=1<<t[i-1];for(var r=new Ye(n[30]),i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return[n,r]},e=t(Ke,2),Ze=e[0],tn=e[1],e=(Ze[28]=258,tn[258]=28,t(Xe,0)),en=e[0],nn=e[1],rn=new q(32768),i=0;i<32768;++i){var sn=(43690&i)>>>1|(21845&i)<<1;rn[i]=((65280&(sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4))>>>8|(255&sn)<<8)>>>1}for(var P=function(t,e,n){for(var i=t.length,r=0,s=new q(e);r<i;++r)++s[t[r]-1];var o=new q(e);for(r=0;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;if(n){for(var a=new q(1<<e),l=15-e,r=0;r<i;++r)if(t[r])for(var u=r<<4|t[r],c=e-t[r],h=o[t[r]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)a[rn[h]>>>l]=u}else for(a=new q(i),r=0;r<i;++r)a[r]=rn[o[t[r]-1]++]>>>15-t[r];return a},U=new J(288),i=0;i<144;++i)U[i]=8;for(i=144;i<256;++i)U[i]=9;for(i=256;i<280;++i)U[i]=7;for(i=280;i<288;++i)U[i]=8;for(var on=new J(32),i=0;i<32;++i)on[i]=5;function an(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e}function G(t,e,n){var i=e/8>>0;return(t[i]|t[1+i]<<8)>>>(7&e)&n}function ln(t,e){var n=e/8>>0;return(t[n]|t[1+n]<<8|t[2+n]<<16)>>>(7&e)}function un(t){return(t/8>>0)+(7&t&&1)}function W(t,e,n){var i=e/8>>0;t[i]|=n<<=7&e,t[1+i]|=n>>>8}function cn(t,e,n){var i=e/8>>0;t[i]|=n<<=7&e,t[1+i]|=n>>>8,t[2+i]|=n>>>16}function hn(t,e){for(var n=[],i=0;i<t.length;++i)t[i]&&n.push({s:i,f:t[i]});var r=n.length,s=n.slice();if(!r)return[new J(0),0];if(1==r)return(p=new J(n[0].s+1))[n[0].s]=1,[p,1];n.sort(function(t,e){return t.f-e.f}),n.push({s:-1,f:25001});var o=n[0],a=n[1],l=0,u=1,c=2;for(n[0]={s:-1,f:o.f+a.f,l:o,r:a};u!=r-1;)o=n[n[l].f<n[c].f?l++:c++],a=n[l!=u&&n[l].f<n[c].f?l++:c++],n[u++]={s:-1,f:o.f+a.f,l:o,r:a};for(var h=s[0].s,i=1;i<r;++i)s[i].s>h&&(h=s[i].s);var d=new q(h+1),f=On(n[u-1],d,0);if(e<f){var i=0,v=0,p=f-e,m=1<<p;for(s.sort(function(t,e){return d[e.s]-d[t.s]||t.f-e.f});i<r;++i){var y=s[i].s;if(!(d[y]>e))break;v+=m-(1<<f-d[y]),d[y]=e}for(v>>>=p;0<v;){var g=s[i].s;d[g]<e?v-=1<<e-d[g]++-1:++i}for(;0<=i&&v;--i){var b=s[i].s;d[b]==e&&(--d[b],++v)}f=e}return[new J(d),f]}function dn(t){for(var e=t.length;e&&!t[--e];);for(var n=new q(++e),i=0,r=t[0],s=1,o=function(t){n[i++]=t},a=1;a<=e;++a)if(t[a]==r&&a!=e)++s;else{if(!r&&2<s){for(;138<s;s-=138)o(32754);2<s&&(o(10<s?s-11<<5|28690:s-3<<5|12305),s=0)}else if(3<s){for(o(r),--s;6<s;s-=6)o(8304);2<s&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=t[a]}return[n.subarray(0,i),e]}function fn(t,e){for(var n=0,i=0;i<e.length;++i)n+=t[i]*e[i];return n}function vn(t,e,n){var i=n.length,r=un(e+2);t[r]=255&i,t[r+1]=i>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<i;++s)t[r+s+4]=n[s];return 8*(r+4+i)}function pn(t,e,n,i,r,s,o,a,l,u,c){W(e,c++,n),++r[256];for(var h=(n=hn(r,15))[0],n=n[1],d=(f=hn(s,15))[0],f=f[1],v=(p=dn(h))[0],p=p[1],m=(y=dn(d))[0],y=y[1],g=new q(19),b=0;b<v.length;++b)g[31&v[b]]++;for(b=0;b<m.length;++b)g[31&m[b]]++;for(var w=(S=hn(g,7))[0],S=S[1],_=19;4<_&&!w[Qe[_-1]];--_);var O=u+5<<3,k=fn(r,U)+fn(s,on)+o,r=fn(r,h)+fn(s,d)+o+14+3*_+fn(g,w)+(2*g[16]+3*g[17]+7*g[18]);if(O<=k&&O<=r)return vn(e,c,t.subarray(l,l+u));if(W(e,c,1+(r<k)),c+=2,r<k){var T=P(h,n,0),I=h,C=P(d,f,0),E=d,x=P(w,S,0);W(e,c,p-257),W(e,c+5,y-1),W(e,c+10,_-4),c+=14;for(b=0;b<_;++b)W(e,c+3*b,w[Qe[b]]);c+=3*_;for(var M=[v,m],A=0;A<2;++A)for(var j=M[A],b=0;b<j.length;++b){var R=31&j[b];W(e,c,x[R]),c+=w[R],15<R&&(W(e,c,j[b]>>>5&127),c+=j[b]>>>12)}}else T=yn,I=U,C=bn,E=on;for(var N,b=0;b<a;++b)255<i[b]?(R=i[b]>>>18&31,cn(e,c,T[R+257]),c+=I[R+257],7<R&&(W(e,c,i[b]>>>23&31),c+=Ke[R]),N=31&i[b],cn(e,c,C[N]),c+=E[N],3<N&&(cn(e,c,i[b]>>>5&8191),c+=Xe[N])):(cn(e,c,T[i[b]]),c+=I[i[b]]);return cn(e,c,T[256]),c+I[256]}var m,y,mn,yn=P(U,9,0),gn=P(U,9,1),bn=P(on,5,0),wn=P(on,5,1),Sn=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof q?q:t instanceof Ye?Ye:J)(n-e);return i.set(t.subarray(e,n)),i},_n=function(t,n,e){function i(t){var e=n.length;e<t&&((e=new J(Math.max(2*e,t))).set(n),n=e)}var r=t.length,s=!n||e,o=!e||e.i,a=(e=e||{},n=n||new J(3*r),e.f||0),l=e.p||0,u=e.b||0,c=e.l,h=e.d,d=e.m,f=e.n,v=8*r;do{if(!c){e.f=a=G(t,l,1);var p=G(t,l+1,3);if(l+=3,!p){var m=t[(T=un(l)+4)-4]|t[T-3]<<8,y=T+m;if(r<y){if(o)throw"unexpected EOF";break}s&&i(u+m),n.set(t.subarray(T,y),u),e.b=u+=m,e.p=l=8*y;continue}if(1==p)c=gn,h=wn,d=9,f=5;else{if(2!=p)throw"invalid block type";for(var m=G(t,l,31)+257,g=G(t,l+10,15)+4,b=m+G(t,l+5,31)+1,w=(l+=14,new J(b)),S=new J(19),_=0;_<g;++_)S[Qe[_]]=G(t,l+3*_,7);l+=3*g;var y=an(S),O=(1<<y)-1;if(!o&&v<l+b*(y+7))break;for(var k=P(S,y,1),_=0;_<b;){var T,I=k[G(t,l,O)];if(l+=15&I,(T=I>>>4)<16)w[_++]=T;else{var C=0,E=0;for(16==T?(E=3+G(t,l,3),l+=2,C=w[_-1]):17==T?(E=3+G(t,l,7),l+=3):18==T&&(E=11+G(t,l,127),l+=7);E--;)w[_++]=C}}var p=w.subarray(0,m),x=w.subarray(m),d=an(p),f=an(x),c=P(p,d,1),h=P(x,f,1)}if(v<l)throw"unexpected EOF"}s&&i(u+131072);for(var M=(1<<d)-1,L=(1<<f)-1,F=d+f+18;o||l+F<v;){var A=(C=c[ln(t,l)&M])>>>4;if(v<(l+=15&C))throw"unexpected EOF";if(!C)throw"invalid length/literal";if(A<256)n[u++]=A;else{if(256==A){c=null;break}var j=A-254,A=(264<A&&(N=Ke[_=A-257],j=G(t,l,(1<<N)-1)+Ze[_],l+=N),h[ln(t,l)&L]),R=A>>>4;if(!A)throw"invalid distance";l+=15&A;var N,x=en[R];if(3<R&&(N=Xe[R],x+=ln(t,l)&(1<<N)-1,l+=N),v<l)throw"unexpected EOF";s&&i(u+131072);for(var D=u+j;u<D;u+=4)n[u]=n[u-x],n[u+1]=n[u+1-x],n[u+2]=n[u+2-x],n[u+3]=n[u+3-x];u=D}}e.l=c,e.p=l,e.b=u,c&&(a=1,e.m=d,e.d=h,e.n=f)}while(!a);return u==n.length?n:Sn(n,0,u)},On=function(t,e,n){return-1==t.s?Math.max(On(t.l,e,n+1),On(t.r,e,n+1)):e[t.s]=n},kn=new Ye([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tn=new J(0),In=function(){var o=1,a=0;return{p:function(t){for(var e=o,n=a,i=t.length,r=0;r!=i;){for(var s=Math.min(r+5552,i);r<s;++r)n+=e+=t[r];e%=65521,n%=65521}o=e,a=n},d:function(){return(o>>>8<<16|(255&a)<<8|a>>>8)+2*((255&o)<<23)}}},Cn=function(t,e,n,i,L){var r=t,s=null==e.level?6:e.level,t=null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,e=n,n=i,o=!L,a=r.length,i=new J(e+a+5*(1+Math.floor(a/7e3))+n),l=i.subarray(e,i.length-n),u=0;if(!s||a<8)for(var c=0;c<=a;c+=65535)var h=c+65535,u=h<a?vn(l,u,r.subarray(c,h)):(l[c]=o,vn(l,u,r.subarray(c,a)));else{for(var s=kn[s-1],F=s>>>13,P=8191&s,d=(1<<t)-1,f=new q(32768),v=new q(1+d),p=Math.ceil(t/3),U=2*p,m=function(t){return(r[t]^r[t+1]<<p^r[t+2]<<U)&d},y=new Ye(25e3),g=new q(288),b=new q(32),w=0,S=0,c=0,_=0,O=0,k=0;c<a;++c){var T=m(c),I=32767&c,C=v[T];if(f[I]=C,v[T]=I,O<=c){var E=a-c;if((7e3<w||24576<_)&&423<E){u=pn(r,l,0,y,g,b,S,_,k,c-k,u);for(var _=w=S=0,k=c,x=0;x<286;++x)g[x]=0;for(x=0;x<30;++x)b[x]=0}var M=2,A=0,G=P,j=I-C&32767;if(2<E&&T==m(c-j))for(var W=Math.min(F,E)-1,$=Math.min(32767,c),B=Math.min(258,E);j<=$&&--G&&I!=C;){if(r[c+M]==r[c+M-j]){for(var R=0;R<B&&r[c+R]==r[c+R-j];++R);if(M<R){if(A=j,W<(M=R))break;for(var V=Math.min(j,R-2),N=0,x=0;x<V;++x){var D=c-j+x+32768&32767,z=D-f[D]+32768&32767;N<z&&(N=z,C=D)}}}j+=(I=C)-(C=f[I])+32768&32767}A?(y[_++]=268435456|tn[M]<<18|nn[A],T=31&tn[M],E=31&nn[A],S+=Ke[T]+Xe[E],++g[257+T],++b[E],O=c+M,++w):(y[_++]=r[c],++g[r[c]])}}u=pn(r,l,o,y,g,b,S,_,k,c-k,u),o||(u=vn(l,u,Tn))}return Sn(i,0,e+un(u)+n)},En=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},xn=function(t,e){e=e.level,e=0==e?0:e<6?1:9==e?3:2;t[0]=120,t[1]=e<<6|(e?32-2*e:1)},Mn=function(t){if(8!=(15&t[0])||7<t[0]>>>4||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function An(t,e){var n=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new J(t.length+(t.length>>>1)),r=0,s=function(t){i[r++]=t},o=0;o<n;++o){r+5>i.length&&((a=new J(r+8+(n-o<<1))).set(i),i=a);var a=t.charCodeAt(o);a<128||e?s(a):(a<2048?s(192|a>>>6):(55295<a&&a<57344?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++o))>>>18),s(128|a>>>12&63)):s(224|a>>>12),s(128|a>>>6&63)),s(128|63&a))}return Sn(i,0,r)}function jn(t,e){var n="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var i=0;i<t.length;){var r=t[i++];r<128||e?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&t[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&t[i++])<<6|63&t[i++]):(r=((15&r)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}const Rn=t=>{var e,n,t=Object.assign(Object.assign({},t),{v:"v1"});return jn((t=An(JSON.stringify(t)),void 0===e&&(e={}),(n=In()).p(t),t=Cn(t,e,2,4),xn(t,e),En(t,t.length-4,n.d()),t),!0)},Nn=t=>{if("string"!=typeof t)return t;try{var e=JSON.parse(t);if(e.timestamp)return e}catch(t){}try{var n=JSON.parse(jn((i=An(t,!0),_n((Mn(i),i.subarray(2,-4)),r))));if("v1"===n.v)return n;throw new Error(`These events were packed with packer ${n.v} which is incompatible with current packer v1.`)}catch(t){throw console.error(t),new Error("Unknown data format.")}var i,r};class Dn{constructor(t){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}}const Ln=/(^|@)\S+:\d+/,Fn=/^\s*at .*(\S+:\d+|\(native\))/m,Pn=/^(eval@)?(\[native code])?$/,Un={parse:function(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Fn)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):(console.warn("[console-record-plugin]: Failed to parse error object:",t),[]):[]},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(e)return[e[1],e[2]||void 0,e[3]||void 0];throw new Error("Cannot parse given url: "+t)},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(t){return!!t.match(Fn)},this).map(function(t){let e=(t=-1<t.indexOf("(eval ")?t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""):t).replace(/^\s+/,"").replace(/\(eval code/g,"(");var t=e.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(e=t?e.replace(t[0],""):e).split(/\s+/).slice(1),t=this.extractLocation(t?t[1]:n.pop()),n=n.join(" ")||void 0,i=-1<["eval","<anonymous>"].indexOf(t[0])?void 0:t[0];return new Dn({functionName:n,fileName:i,lineNumber:t[1],columnNumber:t[2]})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(t){return!t.match(Pn)},this).map(function(t){var e,n;return-1===(t=-1<t.indexOf(" > eval")?t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1"):t).indexOf("@")&&-1===t.indexOf(":")?new Dn({functionName:t}):(n=(n=t.match(e=/((.*".+"[^@]*)?[^@]*)(?:@)/))&&n[1]?n[1]:void 0,t=this.extractLocation(t.replace(e,"")),new Dn({functionName:n,fileName:t[0],lineNumber:t[1],columnNumber:t[2]}))},this)},parseOpera:function(t){return!t.stacktrace||-1<t.message.indexOf("\n")&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){var n=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),r=[];for(let t=2,e=i.length;t<e;t+=2){var s=n.exec(i[t]);s&&r.push(new Dn({fileName:s[2],lineNumber:parseFloat(s[1])}))}return r},parseOpera10:function(t){var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),r=[];for(let t=0,e=i.length;t<e;t+=2){var s=n.exec(i[t]);s&&r.push(new Dn({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return r},parseOpera11:function(t){return t.stack.split("\n").filter(function(t){return!!t.match(Ln)&&!t.match(/^Error created at/)},this).map(function(t){var t=t.split("@"),e=this.extractLocation(t.pop()),t=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Dn({functionName:t,fileName:e[0],lineNumber:e[1],columnNumber:e[2]})},this)}};function Gn(t){return"[object Object]"===Object.prototype.toString.call(t)}function Wn(t,e){const o={numOfKeysLimit:50,depthOfLimit:4},a=(Object.assign(o,e),[]),l=[];return JSON.stringify(t,function(t,e){if(0<a.length?(~(n=a.indexOf(this))?a.splice(n+1):a.push(this),~n?l.splice(n,1/0,t):l.push(t),~a.indexOf(e)&&(e=a[0]===e?"[Circular ~]":"[Circular ~."+l.slice(0,a.indexOf(e)).join(".")+"]")):a.push(e),null===e)return e;if(void 0===e)return"undefined";if(function(t){if(Gn(t)&&Object.keys(t).length>o.numOfKeysLimit)return 1;if("function"==typeof t)return 1;if(Gn(t)&&function t(e,n){if(0===n)return 1;for(const i of Object.keys(e))if(Gn(e[i])&&t(e[i],n-1))return 1}(t,o.depthOfLimit))return 1;return}(e)){var n=e;let t=n.toString();o.stringLengthLimit&&t.length>o.stringLengthLimit&&(t=t.slice(0,o.stringLengthLimit)+"...");return t}if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var i={};for(const s in e){var r=e[s];Array.isArray(r)?i[s]=function(t){if(!t||!t.outerHTML)return"";let n="";for(;t.parentElement;){let e=t.localName;if(!e)break;e=e.toLowerCase();var i=t.parentElement,r=[];if(i.children&&0<i.children.length)for(let t=0;t<i.children.length;t++){var s=i.children[t];s.localName&&s.localName.toLowerCase&&s.localName.toLowerCase()===e&&r.push(s)}1<r.length&&(e+=`:eq(${r.indexOf(t)})`),n=e+(n?">"+n:""),t=i}return n}(r.length?r[0]:null):i[s]=r}return i}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})}const $n={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 Bn(s,t,e){const o=e?Object.assign({},$n,e):$n;e=o.logger;if(!e)return()=>{};let n,a=(n="string"==typeof e?t[e]:e,0),l=!1;const i=[];if(o.level.includes("error")){const r=t=>{var e=t.message,t=t.error,t=Un.parse(t).map(t=>t.toString()),e=[Wn(e,o.stringifyOptions)];s({level:"error",trace:t,payload:e})},u=(t.addEventListener("error",r),i.push(()=>{t.removeEventListener("error",r)}),t=>{let e,n;n=t.reason instanceof Error?[Wn(`Uncaught (in promise) ${(e=t.reason).name}: `+e.message,o.stringifyOptions)]:(e=new Error,[Wn("Uncaught (in promise)",o.stringifyOptions),Wn(t.reason,o.stringifyOptions)]);t=Un.parse(e).map(t=>t.toString());s({level:"error",trace:t,payload:n})});t.addEventListener("unhandledrejection",u),i.push(()=>{t.removeEventListener("unhandledrejection",u)})}for(const c of o.level)i.push(function(t,r){return t[r]?D(t,r,i=>(...e)=>{if(i.apply(this,e),!l){l=!0;try{var t=Un.parse(new Error).map(t=>t.toString()).splice(1),n=e.map(t=>Wn(t,o.stringifyOptions));++a<o.lengthThreshold?s({level:r,trace:t,payload:n}):a===o.lengthThreshold&&s({level:"warn",trace:[],payload:[Wn("The number of log records reached the threshold.")]})}catch(t){i("rrweb logger error:",t,...e)}finally{l=!1}}}):()=>{}}(n,c));return()=>{i.forEach(t=>t())}}const Vn="rrweb/console@1",zn=t=>({name:Vn,observer:Bn,options:t}),Hn="__rrweb_original__",Jn={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class qn{constructor(t){this.config=Object.assign(Jn,t)}getConsoleLogger(){var t={};for(const e of this.config.level)"trace"===e?t[e]=t=>{(console.log[Hn]||console.log)(...t.payload.map(t=>JSON.parse(t)),this.formatMessage(t))}:t[e]=t=>{(console[e][Hn]||console[e])(...t.payload.map(t=>JSON.parse(t)),this.formatMessage(t))};return t}formatMessage(t){var e;return 0===t.trace.length?"":(e="\n\tat ")+t.trace.join(e)}}const Yn=t=>{const r=(null==t?void 0:t.replayLogger)||new qn(t).getConsoleLogger();return{handler(t,e,n){let i=null;if(t.type===Q.IncrementalSnapshot&&t.data.source===Z.Log?i=t.data:t.type===Q.Plugin&&t.data.plugin===Vn&&(i=t.data.payload),i)try{"function"==typeof r[i.level]&&r[i.level](i)}catch(t){n.replayer.config.showWarning&&console.warn(t)}}}},Kn=new Map;function Xn(t,e){let n=Kn.get(t);return n||(n=new Map,Kn.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}function g(i,r,s){return n=>p(this,void 0,void 0,function*(){if(n&&"object"==typeof n&&"rr_type"in n){var t,e;if(s&&(s.isUnchanged=!1),"ImageBitmap"===n.rr_type&&"args"in n)return t=yield g(i,r,s)(n.args),yield createImageBitmap.apply(null,t);if("index"in n)return s||null===r?n:({rr_type:t,index:e}=n,Xn(r,t)[e]);if("args"in n)return{rr_type:t,args:e}=n,new window[t](...yield Promise.all(e.map(g(i,r,s))));if("base64"in n)return xe(n.base64);if("src"in n)return i.get(n.src)||((t=new Image).src=n.src,i.set(n.src,t),t);if("data"in n&&"Blob"===n.rr_type)return e=yield Promise.all(n.data.map(g(i,r,s))),new Blob(e,{type:n.type})}else if(Array.isArray(n))return yield Promise.all(n.map(g(i,r,s)));return n})}const Qn=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Zn({mutation:a,target:l,type:u,imageMap:c,errorHandler:h}){return p(this,void 0,void 0,function*(){try{var t,e,n,i=function(t,e){try{return e===f.WebGL?t.getContext("webgl")||t.getContext("experimental-webgl"):t.getContext("webgl2")}catch(t){return null}}(l,u);i&&(a.setter?i[a.property]=a.args[0]:(t=i[a.property],e=yield Promise.all(a.args.map(g(c,i))),n=t.apply(i,e),r=i,null!=(s=n)&&s.constructor&&(o=s.constructor.name,Qn.includes(o))&&!(r=Xn(r,o)).includes(s)&&r.push(s),0))}catch(t){h(a,t)}var r,s,o})}function ti({event:n,mutation:i,target:r,imageMap:s,canvasEventMap:o,errorHandler:a}){return p(this,void 0,void 0,function*(){try{var t=o.get(n)||i,e="commands"in t?t.commands:[t];if([f.WebGL,f.WebGL2].includes(i.type))for(let t=0;t<e.length;t++)yield Zn({mutation:e[t],type:i.type,target:r,imageMap:s,errorHandler:a});else yield function({event:r,mutations:s,target:e,imageMap:o,errorHandler:a}){return p(this,void 0,void 0,function*(){const i=e.getContext("2d");var t;i?(t=s.map(t=>p(this,void 0,void 0,function*(){return Promise.all(t.args.map(g(o,i)))})),(yield Promise.all(t)).forEach((t,e)=>{e=s[e];try{if(e.setter)return void(i[e.property]=e.args[0]);var n=i[e.property];"drawImage"===e.property&&"string"==typeof e.args[0]?(o.get(r),n.apply(i,e.args)):n.apply(i,t)}catch(t){a(e,t)}})):a(s[0],new Error("Canvas context is null"))})}({event:n,mutations:e,target:r,imageMap:s,errorHandler:a})}catch(t){a(i,t)}})}(t=m=m||{})[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";class ei{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){return t&&null!=(t=null==(t=this.getMeta(t))?void 0:t.id)?t:-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);this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){var n=e.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,e)}replace(t,e){var n=this.getNode(t);n&&(n=this.nodeMetaMap.get(n))&&this.nodeMetaMap.set(e,n),this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ni(t){var e=[];for(const r in t){var n,i=t[r];"string"==typeof i&&(n=ai(r),e.push(n+`: ${i};`))}return e.join(" ")}const ii=/-([a-z])/g,ri=/^--[a-zA-Z0-9-]+$/,si=t=>ri.test(t)?t:t.replace(ii,(t,e)=>e?e.toUpperCase():""),oi=/\B([A-Z])/g,ai=t=>t.replace(oi,"-$1").toLowerCase();class r{constructor(){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=y.ELEMENT_NODE,this.TEXT_NODE=y.TEXT_NODE}get childNodes(){var t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(t instanceof r&&t.ownerDocument===this.ownerDocument){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 li(t){return class extends t{constructor(t,e,n){super(),this.nodeType=y.DOCUMENT_TYPE_NODE,this.RRNodeType=m.DocumentType,this.name=t,this.publicId=e,this.systemId=n,this.nodeName=t,this.textContent=null}toString(){return"RRDocumentType"}}}function ui(t){return class extends t{constructor(t){super(),this.nodeType=y.ELEMENT_NODE,this.RRNodeType=m.Element,this.attributes={},this.shadowRoot=null,this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(t){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(t))}get classList(){return new fi(this.attributes.class,t=>{this.attributes.class=t})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const i=this.attributes.style?function(t){const e={},n=/:(.+)/;return t.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach(function(t){t&&1<(t=t.split(n)).length&&(e[si(t[0].trim())]=t[1].trim())}),e}(this.attributes.style):{},r=/\B([A-Z])/g;return i.setProperty=(t,e,n)=>{r.test(t)||(t=si(t),e?i[t]=e:delete i[t],"important"===n&&(i[t]+=" !important"),this.attributes.style=ni(i))},i.removeProperty=t=>{var e;return r.test(t)?"":(t=si(t),e=i[t]||"",delete i[t],this.attributes.style=ni(i),e)},i}getAttribute(t){return this.attributes[t]||null}setAttribute(t,e){this.attributes[t]=e}setAttributeNS(t,e,n){this.setAttribute(e,n)}removeAttribute(t){delete this.attributes[t]}appendChild(t){return vi(this,t)}insertBefore(t,e){return pi(this,t,e)}removeChild(t){return mi(this,t)}attachShadow(t){var e=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=e}dispatchEvent(t){return!0}toString(){let t="";for(const e in this.attributes)t+=`${e}="${this.attributes[e]}" `;return this.tagName+" "+t}}}function ci(t){return class extends t{constructor(t){super(),this.nodeType=y.TEXT_NODE,this.nodeName="#text",this.RRNodeType=m.Text,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return"RRText text="+JSON.stringify(this.data)}}}function hi(t){return class extends t{constructor(t){super(),this.nodeType=y.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=m.Comment,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return"RRComment text="+JSON.stringify(this.data)}}}function di(t){return class extends t{constructor(t){super(),this.nodeName="#cdata-section",this.nodeType=y.CDATA_SECTION_NODE,this.RRNodeType=m.CDATA,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return"RRCDATASection data="+JSON.stringify(this.data)}}}class fi{constructor(t,e){this.classes=[],this.add=(...t)=>{for(const n of t){var e=String(n);0<=this.classes.indexOf(e)||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter(t=>-1===e.indexOf(t)),this.onChange&&this.onChange(this.classes.join(" "))},t&&(t=t.trim().split(/\s+/),this.classes.push(...t)),this.onChange=e}}function vi(t,e){return e.parentNode&&e.parentNode.removeChild(e),t.lastChild?(t.lastChild.nextSibling=e).previousSibling=t.lastChild:(t.firstChild=e).previousSibling=null,(t.lastChild=e).nextSibling=null,e.parentNode=t,e.parentElement=t,e.ownerDocument=t.ownerDocument,e}function pi(t,e,n){if(!n)return vi(t,e);if(n.parentNode!==t)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e!==n&&(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=n.previousSibling,(n.previousSibling=e).nextSibling=n,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,e.parentElement=t,e.parentNode=t,e.ownerDocument=t.ownerDocument),e}function mi(t,e){if(e.parentNode!==t)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:t.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:t.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}(e=y=y||{})[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";const yi={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},gi={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let b=null;function bi(t,e,n,i=e.mirror||e.ownerDocument.mirror){t=function(t,e,n,i){var r;n.afterAppend&&!b&&(b=new WeakSet,setTimeout(()=>{b=null},0));{var s;_i(t,e)||(s=Si(e,n.mirror,i),null!=(r=t.parentNode)&&r.replaceChild(s,t),t=s)}switch(e.RRNodeType){case m.Document:Oi(t,e,n.mirror,i)||(a=i.getMeta(e))&&(n.mirror.removeNodeFromMap(t),t.close(),t.open(),n.mirror.add(t,a),null!==b)&&void 0!==b&&b.add(t);break;case m.Element:var o,a=t,l=e;"IFRAME"===l.tagName&&(o=t.contentDocument)&&bi(o,e.contentDocument,n,i),l.shadowRoot&&(a.shadowRoot||a.attachShadow({mode:"open"}),wi(a.shadowRoot,l.shadowRoot,n,i)),!function(e,t,n){var i=e.attributes,r=t.attributes;for(const l in r){var s=r[l],o=n.getMeta(t);if(null!=o&&o.isSVG&&yi[l])e.setAttributeNS(yi[l],l,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===l){const u=document.createElement("img");u.src=s,u.onload=()=>{var t=e.getContext("2d");t&&t.drawImage(u,0,0,u.width,u.height)}}else"IFRAME"===t.tagName&&"srcdoc"===l||e.setAttribute(l,s)}for(var{name:a}of Array.from(i))a in r||e.removeAttribute(a);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(a,l,i)}return t}(t,e,n,i),wi(t,e,n,i);var r=t,s=e,o=n;switch(s.RRNodeType){case m.Document:var a=s.scrollData;a&&o.applyScroll(a,!0);break;case m.Element:{const h=r;var l=s;switch(l.scrollData&&o.applyScroll(l.scrollData,!0),l.inputData&&o.applyInput(l.inputData),l.tagName){case"AUDIO":case"VIDEO":var u=r,c=l;void 0!==c.paused&&(c.paused?u.pause():u.play()),void 0!==c.muted&&(u.muted=c.muted),void 0!==c.volume&&(u.volume=c.volume),void 0!==c.currentTime&&(u.currentTime=c.currentTime),void 0!==c.playbackRate&&(u.playbackRate=c.playbackRate);break;case"CANVAS":u=s;if(null!==u.rr_dataURL){const d=document.createElement("img");d.onload=()=>{var t=h.getContext("2d");t&&t.drawImage(d,0,0,d.width,d.height)},d.src=u.rr_dataURL}u.canvasMutations.forEach(t=>o.applyCanvas(t.event,t.mutation,r));break;case"STYLE":{const f=h.sheet;f&&s.rules.forEach(t=>o.applyStyleSheetMutation(t,f));break}}break}case m.Text:case m.Comment:case m.CDATA:r.textContent!==s.data&&(r.textContent=s.data)}null!==b&&void 0!==b&&b.has(r)&&(b.delete(r),null!=(i=o.afterAppend))&&i.call(o,r,o.mirror.getId(r))}function wi(d,f,v,p){var m=Array.from(d.childNodes),y=f.childNodes;if(0!==m.length||0!==y.length){let t=0,n=m.length-1,e=0,i=y.length-1,r=m[t],s=m[n],o=y[e],a=y[i],l=void 0,u;for(;t<=n&&e<=i;)if(void 0===r)r=m[++t];else if(void 0===s)s=m[--n];else if(Oi(r,o,v.mirror,p))r=m[++t],o=y[++e];else if(Oi(s,a,v.mirror,p))s=m[--n],a=y[--i];else if(Oi(r,a,v.mirror,p)){try{d.insertBefore(r,s.nextSibling)}catch(t){console.warn(t)}r=m[++t],a=y[--i]}else{if(Oi(s,o,v.mirror,p)){try{d.insertBefore(s,r)}catch(t){console.warn(t)}s=m[--n]}else{if(!l){l={};for(let e=t;e<=n;e++){const t=m[e];t&&v.mirror.hasNode(t)&&(l[v.mirror.getId(t)]=e)}}var g=m[u=l[p.getId(o)]];if(void 0!==u&&g&&Oi(g,o,v.mirror,p)){try{d.insertBefore(g,r)}catch(t){console.warn(t)}m[u]=void 0}else{g=Si(o,v.mirror,p);"#document"===d.nodeName&&r&&(g.nodeType===g.DOCUMENT_TYPE_NODE&&r.nodeType===r.DOCUMENT_TYPE_NODE||g.nodeType===g.ELEMENT_NODE&&r.nodeType===r.ELEMENT_NODE)&&(d.removeChild(r),v.mirror.removeNodeFromMap(r),r=m[++t]);try{d.insertBefore(g,r||null)}catch(t){console.warn(t)}}}o=y[++e]}if(t>n){var b=y[i+1];let t=null;for(b&&(t=v.mirror.getNode(p.getId(b)));e<=i;++e){var w=Si(y[e],v.mirror,p);try{d.insertBefore(w,t)}catch(t){console.warn(t)}}}else if(e>i)for(;t<=n;t++){var S=m[t];if(S&&S.parentNode===d)try{d.removeChild(S),v.mirror.removeNodeFromMap(S)}catch(t){console.warn(t)}}let c=d.firstChild,h=f.firstChild;for(;null!==c&&null!==h;)bi(c,h,v,p),c=c.nextSibling,h=h.nextSibling}}function Si(t,e,n){var i=n.getId(t),r=n.getMeta(t);let s=null;if(null===(s=-1<i?e.getNode(i):s)||!_i(s,t)){switch(t.RRNodeType){case m.Document:s=new Document;break;case m.DocumentType:s=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case m.Element:var o=t.tagName.toLowerCase(),o=gi[o]||o;s=r&&"isSVG"in r&&null!=r&&r.isSVG?document.createElementNS(yi.svg,o):document.createElement(t.tagName);break;case m.Text:s=document.createTextNode(t.data);break;case m.Comment:s=document.createComment(t.data);break;case m.CDATA:s=document.createCDATASection(t.data)}r&&e.add(s,Object.assign({},r));try{null!==b&&void 0!==b&&b.add(s)}catch(t){}}return s}function _i(t,e){return t.nodeType===e.nodeType&&(t.nodeType!==t.ELEMENT_NODE||t.tagName.toUpperCase()===e.tagName)}function Oi(t,e,n,i){n=n.getId(t),i=i.getId(e);return-1!==n&&n===i&&_i(t,e)}class ki extends(t=r,class or extends t{constructor(...t){super(t),this.nodeType=y.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=m.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find(t=>t.RRNodeType===m.Element&&"HTML"===t.tagName)||null}get body(){var t;return(null==(t=this.documentElement)?void 0:t.childNodes.find(t=>t.RRNodeType===m.Element&&"BODY"===t.tagName))||null}get head(){var t;return(null==(t=this.documentElement)?void 0:t.childNodes.find(t=>t.RRNodeType===m.Element&&"HEAD"===t.tagName))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const e=t.RRNodeType;if(e!==m.Element&&e!==m.DocumentType||!this.childNodes.some(t=>t.RRNodeType===e))return(t=vi(this,t)).parentElement=null,t;throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${e===m.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`)}insertBefore(t,e){const n=t.RRNodeType;if(n!==m.Element&&n!==m.DocumentType||!this.childNodes.some(t=>t.RRNodeType===n))return(t=pi(this,t,e)).parentElement=null,t;throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${n===m.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`)}removeChild(t){return mi(this,t)}open(){this.firstChild=null,this.lastChild=null}close(){}write(t){let e;'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===t?e="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===t&&(e="-//W3C//DTD HTML 4.0 Transitional//EN"),e&&(t=this.createDocumentType("html",e,""),this.open(),this.appendChild(t))}createDocument(t,e,n){return new or}createDocumentType(t,e,n){t=new(li(r))(t,e,n);return t.ownerDocument=this,t}createElement(t){t=new(ui(r))(t);return t.ownerDocument=this,t}createElementNS(t,e){return this.createElement(e)}createTextNode(t){t=new(ci(r))(t);return t.ownerDocument=this,t}createComment(t){t=new(hi(r))(t);return t.ownerDocument=this,t}createCDATASection(t){t=new(di(r))(t);return t.ownerDocument=this,t}toString(){return"RRDocument"}}){get unserializedId(){return this.ce--}constructor(t){super(),this.UNSERIALIZED_STARTING_ID=-2,this.ce=this.UNSERIALIZED_STARTING_ID,this.mirror=new Li,this.scrollData=null,t&&(this.mirror=t)}createDocument(t,e,n){return new ki}createDocumentType(t,e,n){t=new Ti(t,e,n);return t.ownerDocument=this,t}createElement(t){var e=t.toUpperCase();let n;switch(e){case"AUDIO":case"VIDEO":n=new Ci(e);break;case"IFRAME":n=new Mi(e,this.mirror);break;case"CANVAS":n=new Ei(e);break;case"STYLE":n=new xi(e);break;default:n=new Ii(e)}return n.ownerDocument=this,n}createComment(t){t=new ji(t);return t.ownerDocument=this,t}createCDATASection(t){t=new Ri(t);return t.ownerDocument=this,t}createTextNode(t){t=new Ai(t);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this.ce=this.UNSERIALIZED_STARTING_ID}}const Ti=li(r);class Ii extends ui(r){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class Ci extends(e=Ii,class extends e{attachShadow(t){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}){}class Ei extends Ii{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class xi extends Ii{constructor(){super(...arguments),this.rules=[]}}class Mi extends Ii{constructor(t,e){super(t),this.contentDocument=new ki,this.contentDocument.mirror=e}}const Ai=ci(r),ji=hi(r),Ri=di(r);function Ni(t,e,n,i){let r;switch(t.nodeType){case y.DOCUMENT_NODE:i&&"IFRAME"===i.nodeName?r=i.contentDocument:(r=e).compatMode=t.compatMode;break;case y.DOCUMENT_TYPE_NODE:r=e.createDocumentType(t.name,t.publicId,t.systemId);break;case y.ELEMENT_NODE:var s,o,a=t,l=(l=a)instanceof HTMLFormElement?"FORM":l.tagName.toUpperCase(),u=r=e.createElement(l);for({name:s,value:o}of Array.from(a.attributes))u.attributes[s]=o;a.scrollLeft&&(u.scrollLeft=a.scrollLeft),a.scrollTop&&(u.scrollTop=a.scrollTop);break;case y.TEXT_NODE:r=e.createTextNode(t.textContent||"");break;case y.CDATA_SECTION_NODE:r=e.createCDATASection(t.data);break;case y.COMMENT_NODE:r=e.createComment(t.textContent||"");break;case y.DOCUMENT_FRAGMENT_NODE:r=i.attachShadow({mode:"open"});break;default:return null}var l;let c=n.getMeta(t);return e instanceof ki&&(c||(c=Fi(r,e.unserializedId),n.add(t,c)),e.mirror.add(r,Object.assign({},c))),r}function Di(t,r=new ei,s=new ki){!function e(t,n){const i=Ni(t,s,r,n);null!==i&&("IFRAME"!==(null==n?void 0:n.nodeName)&&t.nodeType!==y.DOCUMENT_FRAGMENT_NODE&&(null!=n&&n.appendChild(i),i.parentNode=n,i.parentElement=n),"IFRAME"===t.nodeName?(n=t.contentDocument)&&e(n,i):t.nodeType!==y.DOCUMENT_NODE&&t.nodeType!==y.ELEMENT_NODE&&t.nodeType!==y.DOCUMENT_FRAGMENT_NODE||(t.nodeType===y.ELEMENT_NODE&&t.shadowRoot&&e(t.shadowRoot,i),t.childNodes.forEach(t=>e(t,i))))}(t,null)}class Li{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){return t&&null!=(t=null==(t=this.getMeta(t))?void 0:t.id)?t:-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);this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){var n=e.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,e)}replace(t,e){var n=this.getNode(t);n&&(n=this.nodeMetaMap.get(n))&&this.nodeMetaMap.set(e,n),this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Fi(t,e){switch(t.RRNodeType){case m.Document:return{id:e,type:t.RRNodeType,childNodes:[]};case m.DocumentType:return{id:e,type:t.RRNodeType,name:t.name,publicId:t.publicId,systemId:t.systemId};case m.Element:return{id:e,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case m.Text:case m.Comment:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case m.CDATA:return{id:e,type:t.RRNodeType,textContent:""}}}function Pi(i){return{all:i=i||new Map,on:function(t,e){var n=i.get(t);n?n.push(e):i.set(t,[e])},off:function(t,e){var n=i.get(t);n&&(e?n.splice(n.indexOf(e)>>>0,1):i.set(t,[]))},emit:function(e,n){var t=i.get(e);t&&t.slice().map(function(t){t(n)}),(t=i.get("*"))&&t.slice().map(function(t){t(e,n)})}}}function Ui(l=window,u=document){if(!("scrollBehavior"in u.documentElement.style&&!0!==l.__forceSmoothScrollPolyfill__)){var t,e=l.HTMLElement||l.Element;const d=468,f={scroll:l.scroll||l.scrollTo,scrollBy:l.scrollBy,elementScroll:e.prototype.scroll||c,scrollIntoView:e.prototype.scrollIntoView},v=l.performance&&l.performance.now?l.performance.now.bind(l.performance):Date.now,n=(t=l.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(t)?1:0);function c(t,e){this.scrollLeft=t,this.scrollTop=e}function i(t){if(null===t||"object"!=typeof t||void 0===t.behavior||"auto"===t.behavior||"instant"===t.behavior)return!0;if("object"==typeof t&&"smooth"===t.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+t.behavior+" is not a valid value for enumeration ScrollBehavior.")}function r(t,e){return"Y"===e?t.clientHeight+n<t.scrollHeight:"X"===e?t.clientWidth+n<t.scrollWidth:void 0}function s(t,e){t=l.getComputedStyle(t,null)["overflow"+e];return"auto"===t||"scroll"===t}function o(t){for(;t!==u.body&&!1===(n=void 0,n=r(e=t,"Y")&&s(e,"Y"),e=r(e,"X")&&s(e,"X"),n||e);)t=t.parentNode||t.host;var e,n;return t}function h(t){var e=v(),e=1<(e=(e-t.startTime)/d)?1:e,e=.5*(1-Math.cos(Math.PI*e)),n=t.startX+(t.x-t.startX)*e,e=t.startY+(t.y-t.startY)*e;t.method.call(t.scrollable,n,e),n===t.x&&e===t.y||l.requestAnimationFrame(h.bind(l,t))}function a(t,e,n){let i,r,s,o;var a=v();o=t===u.body?(i=l,r=l.scrollX||l.pageXOffset,s=l.scrollY||l.pageYOffset,f.scroll):(i=t,r=t.scrollLeft,s=t.scrollTop,c),h({scrollable:i,method:o,startTime:a,startX:r,startY:s,x:e,y:n})}l.scroll=l.scrollTo=function(){void 0!==arguments[0]&&(!0===i(arguments[0])?f.scroll.call(l,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:l.scrollX||l.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:l.scrollY||l.pageYOffset):a.call(l,u.body,void 0!==arguments[0].left?~~arguments[0].left:l.scrollX||l.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:l.scrollY||l.pageYOffset))},l.scrollBy=function(){void 0!==arguments[0]&&(i(arguments[0])?f.scrollBy.call(l,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):a.call(l,u.body,~~arguments[0].left+(l.scrollX||l.pageXOffset),~~arguments[0].top+(l.scrollY||l.pageYOffset)))},e.prototype.scroll=e.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0===i(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");f.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}else{var t=arguments[0].left,e=arguments[0].top;a.call(this,this,void 0===t?this.scrollLeft:~~t,void 0===e?this.scrollTop:~~e)}},e.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0===i(arguments[0])?f.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop):this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}))},e.prototype.scrollIntoView=function(){var t,e,n;!0===i(arguments[0])?f.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]):(e=(t=o(this)).getBoundingClientRect(),n=this.getBoundingClientRect(),t!==u.body?(a.call(this,t,t.scrollLeft+n.left-e.left,t.scrollTop+n.top-e.top),"fixed"!==l.getComputedStyle(t).position&&l.scrollBy({left:e.left,top:e.top,behavior:"smooth"})):l.scrollBy({left:n.left,top:n.top,behavior:"smooth"}))}}}class Gi{constructor(t=[],e){this.timeOffset=0,this.raf=null,this.actions=t,this.speed=e.speed}addAction(t){var e,n=!0===this.raf;!this.actions.length||this.actions[this.actions.length-1].delay<=t.delay?this.actions.push(t):(e=this.findActionIndex(t),this.actions.splice(e,0,t)),n&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){var t=performance.now();for(this.timeOffset+=(t-this.lastTimestamp)*this.speed,this.lastTimestamp=t;this.actions.length;){var e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}0<this.actions.length?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(!0!==this.raf&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(t){this.speed=t}isActive(){return null!==this.raf}findActionIndex(t){let e=0,n=this.actions.length-1;for(;e<=n;){var i=Math.floor((e+n)/2);if(this.actions[i].delay<t.delay)e=i+1;else{if(!(this.actions[i].delay>t.delay))return i+1;n=i-1}}return e}}function Wi(t,e){var n;t.type===Q.IncrementalSnapshot&&t.data.source===Z.MouseMove&&t.data.positions&&t.data.positions.length?(n=t.data.positions[0].timeOffset,n=t.timestamp+n,t.delay=n-e):(t.delay=t.timestamp-e,t.delay)}function $i(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),o=[];try{for(;(void 0===e||0<e--)&&!(i=s.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}(t=mn=mn||{})[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped";var Bi={type:"xstate.init"};function Vi(t){return void 0===t?[]:[].concat(t)}function zi(t){return{type:"xstate.assign",assignment:t}}function Hi(t,e){return"string"==typeof(t="string"==typeof t&&e&&e[t]?e[t]:t)?{type:t}:"function"==typeof t?{type:t.name,exec:t}:t}function Ji(e){return function(t){return e===t}}function qi(t){return"string"==typeof t?{type:t}:t}function Yi(t,e){return{value:t,context:e,actions:[],changed:!1,matches:Ji(t)}}function Ki(t,e,i){var r=e,s=!1;return[t.filter(function(e){var n;return"xstate.assign"!==e.type||(s=!0,n=Object.assign({},r),"function"==typeof e.assignment?n=e.assignment(r,i):Object.keys(e.assignment).forEach(function(t){n[t]="function"==typeof e.assignment[t]?e.assignment[t](r,i):e.assignment[t]}),r=n,!1)}),r,s]}function Xi(T,e){void 0===e&&(e={});var t=$i(Ki(Vi(T.states[T.initial].entry).map(function(t){return Hi(t,e.actions)}),T.context,Bi),2),n=t[0],t=t[1],I={config:T,P:e,initialState:{value:T.initial,actions:n,context:t,matches:Ji(T.initial)},transition:function(t,e){var n,i,t="string"==typeof t?{value:t,context:T.context}:t,r=t.value,s=t.context,o=qi(e),a=T.states[r];if(a.on){t=Vi(a.on[o.type]);try{for(var l=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&i>=t.length?void 0:t)&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),u=l.next();!u.done;u=l.next()){var c=u.value;if(void 0===c)return Yi(r,s);var h,d,f,v,p,m="string"==typeof c?{target:c}:c,y=m.target,g=m.actions,b=void 0===g?[]:g,w=m.cond,S=void 0===w?function(){return!0}:w,_=void 0===y,O=null!=y?y:r,k=T.states[O];if(S(s,o))return d=(h=$i(Ki((_?Vi(b):[].concat(a.exit,b,k.entry).filter(function(t){return t})).map(function(t){return Hi(t,I.P.actions)}),s,o),3))[0],f=h[1],v=h[2],{value:p=null!=y?y:r,context:f,actions:d,changed:y!==r||0<d.length||v,matches:Ji(p)}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}return Yi(r,s)}};return I}var Qi=function(e,n){return e.actions.forEach(function(t){t=t.exec;return t&&t(e.context,n)})};function Zi(e){var n=e.initialState,i=mn.NotStarted,r=new Set,s={he:e,send:function(t){i===mn.Running&&(n=e.transition(n,t),Qi(n,qi(t)),r.forEach(function(t){return t(n)}))},subscribe:function(t){return r.add(t),t(n),{unsubscribe:function(){return r.delete(t)}}},start:function(t){return t&&(t="object"==typeof t?t:{context:e.config.context,value:t},n={value:t.value,actions:[],context:t.context,matches:Ji(t.value)}),i=mn.Running,Qi(n,Bi),s},stop:function(){return i=mn.Stopped,r.clear(),s},get state(){return n},get status(){return i}};return s}function tr(t,{getCastFn:c,applyEventsSynchronously:h,emitter:d}){return Zi(Xi({id:"player",context:t,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:zi({lastPlayedEvent:(t,e)=>"CAST_EVENT"===e.type?e.payload.event:t.lastPlayedEvent}),recordTimeOffset:zi((t,e)=>{let n=t.timeOffset;return"payload"in e&&"timeOffset"in e.payload&&(n=e.payload.timeOffset),Object.assign(Object.assign({},t),{timeOffset:n,baselineTime:t.events[0].timestamp+n})}),play(t){var e,{timer:n,events:t,baselineTime:i,lastPlayedEvent:r}=t;n.clear();for(const a of t)Wi(a,i);t=function(e,n){for(let t=e.length-1;0<=t;t--){var i=e[t];if(i.type===Q.Meta&&i.timestamp<=n)return e.slice(t)}return e}(t,i);let s=null==r?void 0:r.timestamp;i<((s=(null==r?void 0:r.type)===Q.IncrementalSnapshot&&r.data.source===Z.MouseMove?r.timestamp+(null==(e=r.data.positions[0])?void 0:e.timeOffset):s)||0)&&d.emit(v.PlayBack);var o=new Array;for(const l of t)if(!(s&&s<i&&(l.timestamp<=s||l===r)))if(l.timestamp<i)o.push(l);else{const u=c(l,!1);n.addAction({doAction:()=>{u()},delay:l.delay})}h(o),d.emit(v.Flush),n.start()},pause(t){t.timer.clear()},resetLastPlayedEvent:zi(t=>Object.assign(Object.assign({},t),{lastPlayedEvent:null})),startLive:zi({baselineTime:(t,e)=>(t.timer.start(),"TO_LIVE"===e.type&&e.payload.baselineTime?e.payload.baselineTime:Date.now())}),addEvent:zi((t,e)=>{var{baselineTime:i,timer:r,events:s}=t;if("ADD_EVENT"===e.type){var o=e.payload["event"];Wi(o,i);let n=s.length-1;if(!s[n]||s[n].timestamp<=o.timestamp)s.push(o);else{let t=-1,e=0;for(;e<=n;){var a=Math.floor((e+n)/2);s[a].timestamp<=o.timestamp?e=a+1:n=a-1}-1===t&&(t=e),s.splice(t,0,o)}e=o.timestamp<i;const l=c(o,e);e?l():r.isActive()&&r.addAction({doAction:()=>{l()},delay:o.delay})}return Object.assign(Object.assign({},t),{events:s})})}}))}const er=Pi,nr="[replayer]",ir={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function rr(t){return t.type==Q.IncrementalSnapshot&&(t.data.source==Z.TouchMove||t.data.source==Z.MouseInteraction&&t.data.type==h.TouchStart)}class sr{get timer(){return this.service.state.context.timer}constructor(t,e){if(this.usingVirtualDom=!1,this.virtualDom=new ki,this.mouseTail=null,this.tailPositions=[],this.emitter=er(),this.legacy_missingNodeRetryMap={},this.cache=It(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=l(),this.styleMirror=new Zt,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=t=>{this.iframe.style.display="inherit";for(const e of[this.mouseTail,this.iframe])e&&(e.setAttribute("width",String(t.width)),e.setAttribute("height",String(t.height)))},this.applyEventsSynchronously=t=>{for(const e of t){switch(e.type){case Q.DomContentLoaded:case Q.Load:case Q.Custom:continue;case Q.FullSnapshot:case Q.Meta:case Q.Plugin:case Q.IncrementalSnapshot:}this.getCastFn(e,!0)()}},this.getCastFn=(n,i=!1)=>{let r;switch(n.type){case Q.DomContentLoaded:case Q.Load:break;case Q.Custom:r=()=>{this.emitter.emit(v.CustomEvent,n)};break;case Q.Meta:r=()=>this.emitter.emit(v.Resize,{width:n.data.width,height:n.data.height});break;case Q.FullSnapshot:r=()=>{var t;if(this.firstFullSnapshot){if(this.firstFullSnapshot===n)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(n,i),null!=(t=this.iframe.contentWindow)&&t.scrollTo(n.data.initialOffset),this.styleMirror.reset()};break;case Q.IncrementalSnapshot:r=()=>{if(this.applyIncremental(n,i),!i&&(n===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive)&&!this.nextUserInteractionEvent){for(const e of this.service.state.context.events)if(!(e.timestamp<=n.timestamp)&&this.isUserInteraction(e)){e.delay-n.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=e);break}var t;this.nextUserInteractionEvent&&(t=this.nextUserInteractionEvent.delay-n.delay,t={speed:Math.min(Math.round(t/5e3),this.config.maxSpeed)},this.speedService.send({type:"FAST_FORWARD",payload:t}),this.emitter.emit(v.SkipStart,t))}}}return()=>{r&&r();for(const t of this.config.plugins||[])t.handler&&t.handler(n,i,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:n}});const e=this.service.state.context.events.length-1;if(!this.config.liveMode&&n===this.service.state.context.events[e]){let t=50;n.type===Q.IncrementalSnapshot&&n.data.source===Z.MouseMove&&n.data.positions.length&&(t+=Math.max(0,-n.data.positions[0].timeOffset)),setTimeout(()=>{e<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(v.Finish))},t)}this.emitter.emit(v.EventCast,n)}},(null==e||!e.liveMode)&&t.length<2)throw new Error("Replayer need at least 2 events.");var n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:ir,useVirtualDom:!0,logger:console};this.config=Object.assign({},n,e),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(v.Resize,this.handleResize),this.setupDom();for(const r of this.config.plugins||[])r.getMirror&&r.getMirror({nodeMirror:this.mirror});this.emitter.on(v.Flush,()=>{if(this.usingVirtualDom){var t={mirror:this.mirror,applyCanvas:(t,e,n)=>{ti({event:t,mutation:e,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(t,e)=>{t.source===Z.StyleSheetRule?this.applyStyleSheetRule(t,e):t.source===Z.StyleDeclaration&&this.applyStyleDeclaration(t,e)},afterAppend:(t,e)=>{for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(t,{id:e,replayer:this})}};if(this.iframe.contentDocument)try{bi(this.iframe.contentDocument,this.virtualDom,t,this.virtualDom.mirror)}catch(t){console.warn(t)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const s in this.legacy_missingNodeRetryMap)try{var e=this.legacy_missingNodeRetryMap[s],n=Si(e.node,this.mirror,this.virtualDom.mirror);bi(n,e.node,t,this.virtualDom.mirror),e.node=n}catch(t){this.warn(t)}this.constructedStyleMutations.forEach(t=>{this.applyStyleSheetMutation(t)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(t=>{this.applyAdoptedStyleSheet(t)}),this.adoptedStyleSheets=[]}var i,r;this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent&&([i,r]=this.lastMouseDownEvent,i.dispatchEvent(r)),this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(v.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()});n=new Gi([],{speed:this.config.speed}),this.service=tr({events:t.map(t=>e&&e.unpackFn?e.unpackFn(t):t).sort((t,e)=>t.timestamp-e.timestamp),timer:n,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(t=>{this.emitter.emit(v.StateChange,{player:t})}),this.speedService=Zi(Xi({id:"speed",context:{normalSpeed:-1,timer:n},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(t,e)=>{"payload"in e&&t.timer.setSpeed(e.payload.speed)},recordSpeed:zi({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe(t=>{this.emitter.emit(v.StateChange,{speed:t})}),t=this.service.state.context.events.find(t=>t.type===Q.Meta);const i=this.service.state.context.events.find(t=>t.type===Q.FullSnapshot);if(t){const{width:s,height:o}=t.data;setTimeout(()=>{this.emitter.emit(v.Resize,{width:s,height:o})},0)}i&&setTimeout(()=>{var t;this.firstFullSnapshot||(this.firstFullSnapshot=i,this.rebuildFullSnapshot(i),null!=(t=this.iframe.contentWindow)&&t.scrollTo(i.data.initialOffset))},1),this.service.state.context.events.find(rr)&&this.mouse.classList.add("touch-device")}on(t,e){return this.emitter.on(t,e),this}off(t,e){return this.emitter.off(t,e),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){var t=this.service.state.context.events[0],e=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:t.timestamp,endTime:e.timestamp,totalTime:e.timestamp-t.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){var{baselineTime:t,events:e}=this.service.state.context;return t-e[0].timestamp}getMirror(){return this.mirror}play(t=0){this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:t}}),null!=(t=null==(t=this.iframe.contentDocument)?void 0:t.getElementsByTagName("html")[0])&&t.classList.remove("rrweb-paused"),this.emitter.emit(v.Start)}pause(t){void 0===t&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof t&&(this.play(t),this.service.send({type:"PAUSE"})),null!=(t=null==(t=this.iframe.contentDocument)?void 0:t.getElementsByTagName("html")[0])&&t.classList.add("rrweb-paused"),this.emitter.emit(v.Pause)}resume(t=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(t),this.emitter.emit(v.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(v.Destroy)}startLive(t){this.service.send({type:"TO_LIVE",payload:{baselineTime:t}})}addEvent(t){const e=this.config.unpackFn?this.config.unpackFn(t):t;rr(e)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:e}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=It()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");var t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Ui(this.iframe.contentWindow,this.iframe.contentDocument),Vt(this.iframe.contentWindow))}rebuildFullSnapshot(t,e=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const i=[];var n=(t,e)=>{this.collectIframeAndAttachDocument(i,t);for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(t,{id:e,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),Mt(t.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,t.data.node.id);for(const{mutationInQueue:s,builtNode:o}of i)this.attachDocumentToIframe(s,o),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==s);var{documentElement:n,head:r}=this.iframe.contentDocument;this.insertStyleRules(n,r),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(v.FullsnapshotRebuilded,t),e||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(t,e){var n,i=[`.${this.config.blockClass} { background: currentColor }`,"noscript { display: none !important; }"].concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){var r=this.virtualDom.createElement("style");this.virtualDom.mirror.add(r,Fi(r,this.virtualDom.unserializedId)),t.insertBefore(r,e),r.rules.push({source:Z.StyleSheetRule,adds:i.map((t,e)=>({rule:t,index:e}))})}else{var s=document.createElement("style");t.insertBefore(s,e);for(let t=0;t<i.length;t++)null!=(n=s.sheet)&&n.insertRule(i[t],t)}}attachDocumentToIframe(t,s){const o=(this.usingVirtualDom?this.virtualDom:this).mirror,a=[];var e=(t,e)=>{this.collectIframeAndAttachDocument(a,t);var n,i=o.getMeta(t);if((null==i?void 0:i.type)===z.Element&&"HTML"===(null==i?void 0:i.tagName.toUpperCase())&&({documentElement:i,head:n}=s.contentDocument,this.insertStyleRules(i,n)),!this.usingVirtualDom)for(const r of this.config.plugins||[])r.onBuild&&r.onBuild(t,{id:e,replayer:this})};Et(t.node,{doc:s.contentDocument,mirror:o,hackCss:!0,skipChild:!1,afterAppend:e,cache:this.cache}),e(s.contentDocument,t.node.id);for(const{mutationInQueue:n,builtNode:i}of a)this.attachDocumentToIframe(n,i),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==n)}collectIframeAndAttachDocument(t,e){var n;Jt(e,this.mirror)&&(n=this.newDocumentQueue.find(t=>t.parentId===this.mirror.getId(e)))&&t.push({mutationInQueue:n,builtNode:e})}waitForStylesheetLoad(){var t=null==(t=this.iframe.contentDocument)?void 0:t.head;if(t){const i=new Set;let e,n=this.service.state;const r=()=>{n=this.service.state},s=(this.emitter.on(v.Start,r),this.emitter.on(v.Pause,r),()=>{this.emitter.off(v.Start,r),this.emitter.off(v.Pause,r)});t.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{t.sheet||(i.add(t),t.addEventListener("load",()=>{i.delete(t),0===i.size&&-1!==e&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(v.LoadStylesheetEnd),e&&clearTimeout(e),s())}))}),0<i.size&&(this.service.send({type:"PAUSE"}),this.emitter.emit(v.LoadStylesheetStart),e=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),e=-1,s()},this.config.loadTimeout))}}preloadAllImages(){return p(this,void 0,void 0,function*(){this.service.state;var t=()=>{this.service.state},e=(this.emitter.on(v.Start,t),this.emitter.on(v.Pause,t),[]);for(const n of this.service.state.context.events)n.type===Q.IncrementalSnapshot&&n.data.source===Z.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(n.data,n)),("commands"in n.data?n.data.commands:[n.data]).forEach(t=>{this.preloadImages(t,n)}));return Promise.all(e)})}preloadImages(t,e){var n;"drawImage"!==t.property||"string"!=typeof t.args[0]||this.imageMap.has(e)||(null!=(e=null==(n=(e=document.createElement("canvas")).getContext("2d"))?void 0:n.createImageData(e.width,e.height))&&e.data,JSON.parse(t.args[0]),null!=n&&n.putImageData(e,0,0))}deserializeAndPreloadCanvasEvents(e,i){return p(this,void 0,void 0,function*(){if(!this.canvasEventMap.has(i)){const n={isUnchanged:!0};var t;"commands"in e?(t=yield Promise.all(e.commands.map(e=>p(this,void 0,void 0,function*(){var t=yield Promise.all(e.args.map(g(this.imageMap,null,n)));return Object.assign(Object.assign({},e),{args:t})}))),!1===n.isUnchanged&&this.canvasEventMap.set(i,Object.assign(Object.assign({},e),{commands:t}))):(t=yield Promise.all(e.args.map(g(this.imageMap,null,n))),!1===n.isUnchanged&&this.canvasEventMap.set(i,Object.assign(Object.assign({},e),{args:t})))}})}applyIncremental(n,i){var t;const r=n["data"];switch(r.source){case Z.Mutation:try{this.applyMutation(r,i)}catch(t){this.warn("Exception in mutation "+(t.message||t),r)}break;case Z.Drag:case Z.TouchMove:case Z.MouseMove:i?(a=r.positions[r.positions.length-1],this.mousePos={x:a.x,y:a.y,id:a.id,debugData:r}):(r.positions.forEach(t=>{var e={doAction:()=>{this.moveAndHover(t.x,t.y,t.id,i,r)},delay:t.timeOffset+n.timestamp-this.service.state.context.baselineTime};this.timer.addAction(e)}),this.timer.addAction({doAction(){},delay:n.delay-(null==(a=r.positions[0])?void 0:a.timeOffset)}));break;case Z.MouseInteraction:if(-1!==r.id){var e=new Event(H(h[r.type])),s=this.mirror.getNode(r.id);if(!s)return this.debugNodeNotFound(r,r.id);this.emitter.emit(v.MouseInteraction,{type:r.type,target:s});var o=this.config["triggerFocus"];switch(r.type){case h.Blur:"blur"in s&&s.blur();break;case h.Focus:o&&s.focus&&s.focus({preventScroll:!0});break;case h.Click:case h.TouchStart:case h.TouchEnd:case h.MouseDown:case h.MouseUp:i?(r.type===h.TouchStart?this.touchActive=!0:r.type===h.TouchEnd&&(this.touchActive=!1),r.type===h.MouseDown?this.lastMouseDownEvent=[s,e]:r.type===h.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:r.x||0,y:r.y||0,id:r.id,debugData:r}):(r.type===h.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(r.x||0,r.y||0,r.id,i,r),r.type===h.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):r.type===h.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):r.type===h.TouchEnd?this.mouse.classList.remove("touch-active"):s.dispatchEvent(e));break;case h.TouchCancel:i?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:s.dispatchEvent(e)}}break;case Z.Scroll:if(-1!==r.id)if(this.usingVirtualDom){var a=this.virtualDom.mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);a.scrollData=r}else this.applyScroll(r,i);break;case Z.ViewportResize:this.emitter.emit(v.Resize,{width:r.width,height:r.height});break;case Z.Input:if(-1!==r.id)if(this.usingVirtualDom){var a=this.virtualDom.mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);a.inputData=r}else this.applyInput(r);break;case Z.MediaInteraction:a=(this.usingVirtualDom?this.virtualDom:this).mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);try{void 0!==r.currentTime&&(a.currentTime=r.currentTime),void 0!==r.volume&&(a.volume=r.volume),void 0!==r.muted&&(a.muted=r.muted),1===r.type&&a.pause(),0===r.type&&a.play(),4===r.type&&(a.playbackRate=r.playbackRate)}catch(t){this.warn("Failed to replay media interactions: "+(t.message||t))}break;case Z.StyleSheetRule:case Z.StyleDeclaration:this.usingVirtualDom?r.styleId?this.constructedStyleMutations.push(r):r.id&&null!=(a=this.virtualDom.mirror.getNode(r.id))&&a.rules.push(r):this.applyStyleSheetMutation(r);break;case Z.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){a=this.virtualDom.mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);a.canvasMutations.push({event:n,mutation:r})}else{a=this.mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);ti({event:n,mutation:r,target:a,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case Z.Font:try{var l=new FontFace(r.family,r.buffer?new Uint8Array(JSON.parse(r.fontSource)):r.fontSource,r.descriptors);null!=(t=this.iframe.contentDocument)&&t.fonts.add(l)}catch(t){this.warn(t)}break;case Z.Selection:i?this.lastSelectionData=r:this.applySelection(r);break;case Z.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(r):this.applyAdoptedStyleSheet(r)}}applyMutation(p,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,Di(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const o in this.legacy_missingNodeRetryMap)try{var e=this.legacy_missingNodeRetryMap[o],n=Ni(e.node,this.virtualDom,this.mirror);n&&(e.node=n)}catch(t){this.warn(t)}const m=(this.usingVirtualDom?this.virtualDom:this).mirror,h=(p.removes=p.removes.filter(t=>!!m.getNode(t.id)||(this.warnNodeNotFound(p,t.id),!1)),p.removes.forEach(t=>{var n,i=m.getNode(t.id);if(i){let e=m.getNode(t.parentId);if(!e)return this.warnNodeNotFound(p,t.parentId);if(t.isShadow&&X(e)&&(e=e.shadowRoot),m.removeNodeFromMap(i),e)try{e.removeChild(i),this.usingVirtualDom&&"#text"===i.nodeName&&"STYLE"===e.nodeName&&0<(null==(n=e.rules)?void 0:n.length)&&(e.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",e,i,p)}}}),Object.assign({},this.legacy_missingNodeRetryMap)),d=[],f=t=>{let e=null;return t.nextId&&(e=m.getNode(t.nextId)),null!==t.nextId&&void 0!==t.nextId&&-1!==t.nextId&&!e},i=t=>{var e;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let n=m.getNode(t.parentId);if(!n)return(t.node.type===z.Document?this.newDocumentQueue:d).push(t);t.node.isShadow&&(n=(X(n)||n.attachShadow({mode:"open"}),n.shadowRoot));let i=null,r=null;if(t.previousId&&(i=m.getNode(t.previousId)),t.nextId&&(r=m.getNode(t.nextId)),f(t))return d.push(t);if(!t.node.rootId||m.getNode(t.node.rootId)){var s=t.node.rootId?m.getNode(t.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Jt(n,m))this.attachDocumentToIframe(t,n);else{var o=(t,e)=>{if(!this.usingVirtualDom)for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(t,{id:e,replayer:this})},s=Et(t.node,{doc:s,mirror:m,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:o});if(-1===t.previousId||-1===t.nextId)h[t.node.id]={node:s,mutation:t};else{var a=m.getMeta(n);if(a&&a.type===z.Element&&"textarea"===a.tagName&&t.node.type===z.Text)for(const l of Array.isArray(n.childNodes)?n.childNodes:Array.from(n.childNodes))l.nodeType===n.TEXT_NODE&&n.removeChild(l);else(null==a?void 0:a.type)===z.Document&&(a=n,t.node.type===z.DocumentType&&(null==(e=a.childNodes[0])?void 0:e.nodeType)===Node.DOCUMENT_TYPE_NODE&&a.removeChild(a.childNodes[0]),"HTML"===s.nodeName)&&a.documentElement&&a.removeChild(a.documentElement);if(i&&i.nextSibling&&i.nextSibling.parentNode?n.insertBefore(s,i.nextSibling):r&&r.parentNode?n.contains(r)?n.insertBefore(s,r):n.insertBefore(s,null):n.appendChild(s),o(s,t.node.id),this.usingVirtualDom&&"#text"===s.nodeName&&"STYLE"===n.nodeName&&0<(null==(e=n.rules)?void 0:e.length)&&(n.rules=[]),Jt(s,this.mirror)){const u=this.mirror.getId(s),c=this.newDocumentQueue.find(t=>t.parentId===u);c&&(this.attachDocumentToIframe(c,s),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==c))}(t.previousId||t.nextId)&&this.legacy_resolveMissingNode(h,n,s,t)}}}};p.adds.forEach(t=>{i(t)});for(var r=Date.now();d.length;){var s=zt(d);if(d.length=0,500<Date.now()-r){this.warn("Timeout in the loop, please check the resolve tree data:",s);break}for(const a of s)m.getNode(a.value.parentId)?Ht(a,t=>{i(t)}):this.debug("Drop resolve tree since there is no parent for the root node.",a)}Object.keys(h).length&&Object.assign(this.legacy_missingNodeRetryMap,h),Qt(p.texts).forEach(e=>{var t,n=m.getNode(e.id);if(!n)return p.removes.find(t=>t.id===e.id)?void 0:this.warnNodeNotFound(p,e.id);n.textContent=e.value,this.usingVirtualDom&&0<(null==(t=null==(n=n.parentNode)?void 0:n.rules)?void 0:t.length)&&(n.rules=[])}),p.attributes.forEach(e=>{var t,n=m.getNode(e.id);if(!n)return p.removes.find(t=>t.id===e.id)?void 0:this.warnNodeNotFound(p,e.id);for(const d in e.attributes)if("string"==typeof d){var i=e.attributes[d];if(null===i)n.removeAttribute(d);else if("string"==typeof i)try{if("_cssText"===d&&("LINK"===n.nodeName||"STYLE"===n.nodeName))try{var r=m.getMeta(n),s=(Object.assign(r.attributes,e.attributes),Et(r,{doc:n.ownerDocument,mirror:m,skipChild:!0,hackCss:!0,cache:this.cache})),o=n.nextSibling,a=n.parentNode;if(s&&a){a.removeChild(n),a.insertBefore(s,o),m.replace(e.id,s);break}}catch(t){}if("value"===d&&"TEXTAREA"===n.nodeName){const f=n;f.childNodes.forEach(t=>f.removeChild(t));var l=null==(t=n.ownerDocument)?void 0:t.createTextNode(i);l&&f.appendChild(l)}else n.setAttribute(d,i)}catch(t){this.warn("An error occurred may due to the checkout feature.",t)}else if("style"===d){var u,c=i,h=n;for(const v in c)!1===c[v]?h.style.removeProperty(v):c[v]instanceof Array?(u=c[v],h.style.setProperty(v,u[0],u[1])):(u=c[v],h.style.setProperty(v,u))}}})}applyScroll(t,e){var n,i=this.mirror.getNode(t.id);if(!i)return this.debugNodeNotFound(t,t.id);var r=this.mirror.getMeta(i);if(i===this.iframe.contentDocument)null!=(n=this.iframe.contentWindow)&&n.scrollTo({top:t.y,left:t.x,behavior:e?"auto":"smooth"});else if((null==r?void 0:r.type)===z.Document)null!=(n=i.defaultView)&&n.scrollTo({top:t.y,left:t.x,behavior:e?"auto":"smooth"});else try{i.scrollTo({top:t.y,left:t.x,behavior:e?"auto":"smooth"})}catch(t){}}applyInput(t){var e=this.mirror.getNode(t.id);if(!e)return this.debugNodeNotFound(t,t.id);try{e.checked=t.isChecked,e.value=t.text}catch(t){}}applySelection(t){try{const s=new Set;var e=t.ranges.map(({start:t,startOffset:e,end:n,endOffset:i})=>{var r,t=this.mirror.getNode(t),n=this.mirror.getNode(n);if(t&&n)return(r=new Range).setStart(t,e),r.setEnd(n,i),(n=null==(e=t.ownerDocument)?void 0:e.getSelection())&&s.add(n),{range:r,selection:n}});s.forEach(t=>t.removeAllRanges()),e.forEach(t=>{var e;return t&&(null==(e=t.selection)?void 0:e.addRange(t.range))})}catch(t){}}applyStyleSheetMutation(t){var e;let n=null;t.styleId?n=this.styleMirror.getStyle(t.styleId):t.id&&(n=(null==(e=this.mirror.getNode(t.id))?void 0:e.sheet)||null),n&&(t.source===Z.StyleSheetRule?this.applyStyleSheetRule(t,n):t.source===Z.StyleDeclaration&&this.applyStyleDeclaration(t,n))}applyStyleSheetRule(t,s){var e,n,i;if(null!=(e=t.adds)&&e.forEach(({rule:t,index:e})=>{try{var n,i,r;Array.isArray(e)?({positions:n,index:i}=Xt(e),Kt(s.cssRules,n).insertRule(t,i)):(r=void 0===e?void 0:Math.min(e,s.cssRules.length),null!=s&&s.insertRule(t,r))}catch(t){}}),null!=(e=t.removes)&&e.forEach(({index:t})=>{try{var e,n;Array.isArray(t)?({positions:e,index:n}=Xt(t),Kt(s.cssRules,e).deleteRule(n||0)):null!=s&&s.deleteRule(t)}catch(t){}}),t.replace)try{null!=(n=s.replace)&&n.call(s,t.replace)}catch(t){}if(t.replaceSync)try{null!=(i=s.replaceSync)&&i.call(s,t.replaceSync)}catch(t){}}applyStyleDeclaration(t,e){t.set&&Kt(e.rules,t.index).style.setProperty(t.set.property,t.set.value,t.set.priority),t.remove&&Kt(e.rules,t.index).style.removeProperty(t.remove.property)}applyAdoptedStyleSheet(t){var e;const r=this.mirror.getNode(t.id);if(r){null!=(e=t.styles)&&e.forEach(t=>{var e,n;let i=null;if(X(r)?i=(null==(e=r.ownerDocument)?void 0:e.defaultView)||null:"#document"===r.nodeName&&(i=r.defaultView),i)try{n=new i.CSSStyleSheet,this.styleMirror.add(n,t.styleId),this.applyStyleSheetRule({source:Z.StyleSheetRule,adds:t.rules},n)}catch(t){}});const s=10;let i=0;const o=(t,e)=>{var n=e.map(t=>this.styleMirror.getStyle(t)).filter(t=>null!==t);X(t)?t.shadowRoot.adoptedStyleSheets=n:"#document"===t.nodeName&&(t.adoptedStyleSheets=n),n.length!==e.length&&i<s&&(setTimeout(()=>o(t,e),0+100*i),i++)};o(r,t.styleIds)}}legacy_resolveMissingNode(t,e,n,i){var r,{previousId:i,nextId:s}=i,i=i&&t[i],s=s&&t[s];i&&({node:i,mutation:r}=i,e.insertBefore(i,n),delete t[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],r.previousId||r.nextId)&&this.legacy_resolveMissingNode(t,e,i,r),s&&({node:i,mutation:r}=s,e.insertBefore(i,n.nextSibling),delete t[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],r.previousId||r.nextId)&&this.legacy_resolveMissingNode(t,e,i,r)}moveAndHover(t,e,n,i,r){var s=this.mirror.getNode(n);if(!s)return this.debugNodeNotFound(r,n);r=Yt(s,this.iframe),n=t*r.absoluteScale+r.x,t=e*r.absoluteScale+r.y;this.mouse.style.left=n+"px",this.mouse.style.top=t+"px",i||this.drawMouseTail({x:n,y:t}),this.hoverElements(s)}drawMouseTail(e){if(this.mouseTail){const{lineCap:t,lineWidth:n,strokeStyle:i,duration:r}=!0===this.config.mouseTail?ir:Object.assign({},ir,this.config.mouseTail),s=()=>{if(this.mouseTail){const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=n,e.lineCap=t,e.strokeStyle=i,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(t=>e.lineTo(t.x,t.y)),e.stroke())}};this.tailPositions.push(e),s(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(t=>t!==e),s()},r/this.speedService.state.context.timer.speed)}}hoverElements(t){var e;null!=(e=this.lastHoveredRootNode||this.iframe.contentDocument)&&e.querySelectorAll(".\\:hover").forEach(t=>{t.classList.remove(":hover")}),this.lastHoveredRootNode=t.getRootNode();let n=t;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(t){return t.type===Q.IncrementalSnapshot&&t.data.source>Z.Mutation&&t.data.source<=Z.Input}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(v.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(t,e){this.warn(`Node with id '${e}' not found. `,t)}warnCanvasMutationFailed(t,e){this.warn("Has error on canvas update",e,"canvas mutation:",t)}debugNodeNotFound(t,e){this.debug(`Node with id '${e}' not found. `,t)}warn(...t){this.config.showWarning&&this.config.logger.warn(nr,...t)}debug(...t){this.config.showDebug&&this.config.logger.log(nr,...t)}}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var t={};{var e=t;const o=r(464),a=r(208),l=r(392),u=r(824);var s=r(920);e.default=__STATSIG__,s.AutoInit.attempt(({sdkKey:t})=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t];let n=null;n=(n=e instanceof a.StatsigClient?e:n)||new a.StatsigClient(t,{userID:""}),new l.SessionReplay(n),new u.AutoCapture(n),n.initializeAsync().catch(t=>{o.Log.error(t)})})}return t.default})());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},o=null!=(o=null!=(o=null!=(o=e.__STATSIG__)?o:n.__STATSIG__)?o:i.__STATSIG__)?o:{};e.__STATSIG__=o,n.__STATSIG__=o,i.__STATSIG__=o},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var r=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),o=n(780),s=n(104),u=n(283),l=n(296),a=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,s.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.m(t))?(this.p(t,e),this.h[t]):null)}getDataAsync(n,i){var o;return r(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(o=null==t?void 0:t.data)?o:null,i),e=this._(i);return t&&this.p(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.S(e,t)),t})}prefetchData(n){return r(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.p(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.p(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}O(n,i){return r(this,void 0,void 0,function*(){var t,e=yield this.j(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(o.Log.debug("No response returned for latest value"),null)})}T(){return null!=this.l?this.l:(o.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,l.getUserStorageKey)(this.T(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}p(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}m(t){var e=null==(e=a.Storage.getItemSync)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}S(t,e){return r(this,void 0,void 0,function*(){yield a.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.getObjectFromStorage)(this.v))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield a.Storage.removeItem(e[0])),yield(0,a.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),o="undefined"!=typeof performance&&void 0!==performance.mark;let r=[];e.captureDiagnostics=function(t,e){s.mark(t+":start"),e=e();const n=()=>{s.mark(t+":end"),(t+":end").startsWith("initialize:")&&s.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class s{static mark(t,e){o&&(t=performance.mark(t,{detail:e}),r.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:r,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),r=[]}}e.Diagnostics=s},512:function(t,u,e){var n=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.A=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.D(e,t,n)):i}catch(t){return this.D(e,t,n),null}}logError(t,e){this.D(t,e)}D(o,r,s){try{i.Log.warn("Caught error in "+o,{error:r});n(this,void 0,void 0,function*(){var t,e=null!=r?r:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.A.has(i)||(this.A.add(i),t=l.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:o,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=s&&s({name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const o=n(832),r=n(780),s=n(876),u=n(972),l=n(444),a=n(412),c=n(84),d=n(408),h="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.M=e,this.N=n,this.P=i,this.C=[],this.G={},this.F={},this.R=!1,this.L=Date.now(),this.U=!0===(null==i?void 0:i.disableLogging),this.V=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.J=setInterval(()=>this.K(),n),this.q=(0,c.$)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",h),this.B=(0,c.$)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",h),d.VisibilityChangeObserver.add(this),this.W()}setLoggingDisabled(t){this.U=t}enqueue(t){this.H(t)&&(this.Y(t),this.X(),this.C.length>this.V)&&this.K()}incrementNonExposureCount(t){var e=null!=(e=this.F[t])?e:0;this.F[t]=e+1}reset(){this.G={}}onVisibilityChanged(t){"background"===t&&this.K()}shutdown(){return i(this,void 0,void 0,function*(){this.J&&(clearInterval(this.J),this.J=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Z(),0!==this.C.length&&(t=this.C,this.C=[],yield this.tt(t))})}X(){this.R||(this.R=!0,200<Date.now()-this.L)||setTimeout(()=>this.K(),200)}H(t){if((0,s.isExposureEvent)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.G[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.G).length&&(this.G={}),this.G[t]=n}return!0}K(){this.flush().catch(()=>{})}tt(t){return i(this,void 0,void 0,function*(){if(this.U)this.et(t);else try{(!d.VisibilityChangeObserver.isCurrentlyVisible()&&this.N.isBeaconSupported()?yield this.nt(t):yield this.it(t)).success?this.M({name:"logs_flushed",events:t}):this.et(t)}catch(t){r.Log.warn("Failed to flush events.")}})}it(e){return i(this,void 0,void 0,function*(){var t=yield this.N.post({sdkKey:this.l,data:{events:e},url:this.q,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,a.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}nt(t){return i(this,void 0,void 0,function*(){return{success:yield this.N.beacon({sdkKey:this.l,data:{events:t},url:this.B})}})}et(t){for(;500<t.length;)t.shift();var e=this.ot();(0,l.setObjectInStorage)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}W(){const e=this.ot();i(this,void 0,void 0,function*(){var t=yield(0,l.getObjectFromStorage)(e);t&&(yield l.Storage.removeItem(e),yield this.tt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}ot(){return"statsig.failed_logs."+(0,o.DJB2)(this.l)}Y(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var{sdkType:e,sdkVersion:n}=u.StatsigMetadataProvider.get();this.C.push(Object.assign(Object.assign({},t),{statsigMetadata:{sdkType:e,sdkVersion:n}}))}Z(){0!==Object.keys(this.F).length&&(this.Y({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.F)}}),this.F={})}}},832:(t,e)=>{function n(e){let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const o={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),o[t]=e});return o}(t)))}},664:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.LogLevel=void 0,(o=i||(e.LogLevel=i={}))[o.None=0]="None",o[o.Error=1]="Error",o[o.Warn=2]="Warn",o[o.Info=3]="Info",o[o.Debug=4]="Debug";class r{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=r).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const r=n(280),s=n(688);function c(t,e,n,i){var o=i instanceof s.StatsigClientBase?i.rt.bind(i):void 0;return t.capture(e,()=>(0,r.captureDiagnostics)(e,()=>n.apply(i)),o)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var o;const r=i;for(const s of function(t){const e=new Set;let n=d(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(r))if("constructor"!==s){const u=r[s];r[s]=function(...t){return c(n,s,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(r)){const a=null==(o=null===r||void 0===r?void 0:r.constructor)?void 0:o[l];(null===r||void 0===r?void 0:r.constructor)[l]=function(...t){return c(n,r.constructor.name+"."+l,()=>a.apply(r.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var o=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),r=n(612),s=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.M=e,this.ut=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return o(this,void 0,void 0,function*(){var t=yield this.lt(e);return this.ct(Object.assign({method:"POST",body:t},e))})}get(t){return o(this,void 0,void 0,function*(){return this.ct(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return o(this,void 0,void 0,function*(){var t=yield this.dt(n),e=yield this.lt(n);return navigator.sendBeacon(t,e)})}ct(c){var d;return o(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const o=new AbortController;var t,r,s,u=setTimeout(()=>o.abort(`Timeout of ${this.ut}ms expired.`),this.ut),l=yield this.dt(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:Object.assign({},c.headers),signal:o.signal}),clearTimeout(u),a.ok)return s=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:s,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(r=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",r}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(o,t);return h.Diagnostics.mark("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.M)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.ct(Object.assign(Object.assign({},c),{retries:i-1}))}})}dt(e){return o(this,void 0,void 0,function*(){var t=u.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}lt(i){return o(this,void 0,void 0,function*(){var t=i["data"],e=yield s.StableID.get(i.sdkKey),n=yield r.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.ht(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.ht(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}ht(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:function(t,s,e){var n=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(s,"__esModule",{value:!0}),s.SessionID=void 0;const i=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}s.SessionID={get:t=>n(void 0,void 0,void 0,function*(){return null!=h[t]?h[t]:h[t]=s.SessionID.we(t)}),we:r=>n(void 0,void 0,void 0,function*(){let e=c[r];var n=Date.now();let i=!1;if(null==e){let t=yield function(t){t=v(t);return(0,l.getObjectFromStorage)(t)}(r);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n},i=!0),e=t,c[r]=e}var t=null!=(t=d[r])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n,i=!0),e.lastUpdate=n,e),o=r;return o=v(r),(0,l.setObjectInStorage)(o,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=s.SessionID.xe(t,t.idleTimeoutID,18e5),i&&(t.ageTimeoutID=s.SessionID.xe(t,t.ageTimeoutID,144e5)),c[r]=e,d[r]=t,h[r]=null,e.sessionID}),Te:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},xe:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const o=n(832),r=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.DJB2)(t)}function c(t,e){e=a(e);(0,s.setObjectInStorage)(e,t).catch(()=>{r.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,s.getObjectFromStorage)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const r=n(512),s=n(728),u=n(780),l=n(612),a=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.vt={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(o=null==i?void 0:i.logLevel)?o:u.LogLevel.Warn,this.ft=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this._t=new s.EventLogger(t,this.rt.bind(this),n,i),l.SessionID.Te(()=>{this.rt({name:"session_expired"})},t),this.u=new r.ErrorBoundary(t);var o,n=null!=(o=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?o:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this._t.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,c.Storage.setDisabled(t.disableStorage))}flush(){return this._t.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.rt({name:"pre_shutdown"}),yield this._t.shutdown()})}on(t,e){this.vt[t]||(this.vt[t]=[]),this.vt[t].push(e)}off(t,e){this.vt[t]&&-1!==(e=this.vt[t].indexOf(e))&&this.vt[t].splice(e,1)}rt(e){var t;const n=t=>{try{t(e)}catch(t){u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this.vt[e.name]&&this.vt[e.name].forEach(t=>n(t)),null!=(t=this.vt["*"])&&t.forEach(n)}gt(t,e){this.loadingStatus=t,this.rt({name:"values_updated",status:t,values:e})}yt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this._t.incrementNonExposureCount(t):this._t.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function l(t,e,n,i,o){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:o,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(t,e){return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createConfigExposure=function(t,e){return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createLayerParameterExposure=function(t,e,n){var i,o=e.__evaluation,r=!0===(null==(r=null==o?void 0:o.explicit_parameters)?void 0:r.includes(n));let s="",u=null!=(i=null==o?void 0:o.undelegated_secondary_exposures)?i:[];return r&&(s=null!=(i=o.allocated_experiment_name)?i:"",u=o.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)},u)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=void 0;let n={sdkVersion:"0.0.1-beta.25",sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.makeLayer=e.makeDynamicConfig=e.makeFeatureGate=void 0;const o="default";e.makeFeatureGate=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.makeDynamicConfig=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,value:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}},e.makeLayer=function(t,e,n,i){return{name:t,details:e,getValue:null!=i?i:()=>{},ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,bt:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}}},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const o={},r={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=o[t])?t:null},getItem(t){return Promise.resolve(null!=(t=o[t])?t:null)},setItem(t,e){return o[t]=e,Promise.resolve()},removeItem(t){return delete o[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(o))}};let s=null;try{"undefined"!=typeof window&&"localStorage"in window&&(s={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==s&&void 0!==s?s:r,l=u;e.Storage={getProviderName:()=>l.getProviderName(),getItem:t=>l.getItem(t),setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=l.getItemSync)?void 0:e.call(l,t))?e:null},setProvider:t=>{u=t,l=t},setDisabled:t=>{l=t?r:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield l.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield l.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.typedJsonParse=void 0;const o=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return o.Log.error(n),null}},556:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.$=void 0,e.$=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.wt}static add(t){this.vt.push(t)}static remove(t){t=this.vt.indexOf(t);-1!==t&&this.vt.splice(t,1)}static notify(e){e!==this.wt&&(this.wt=e,this.vt.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).vt=[],n.wt="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const r=n(728),s=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return r.EventLogger}}),n(780)),u=(Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return s.Log}}),n(444));Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return u.Storage}});var l=n(556);o(n(496),e),o(n(856),e),o(n(320),e),o(n(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(664),e),o(n(780),e),o(n(104),e),o(n(188),e),o(n(264),e),o(n(612),e),o(n(604),e),o(n(688),e),o(n(808),e),o(n(283),e),o(n(876),e),o(n(972),e),o(n(384),e),o(n(136),e),o(n(296),e),o(n(444),e),o(n(412),e),o(n(84),e),o(n(539),e),o(n(556),e),o(n(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:r.EventLogger,Log:s.Log,getUUID:l.getUUID,Storage:u.Storage})},920:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoInit=void 0;const s=n(464);e.AutoInit=class{static attempt(e){var n;if("undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript){var i=document.currentScript.getAttribute("src"),o=null==(o=null===window||void 0===window?void 0:window.location)?void 0:o.href;if(i&&o){let t=null;try{var r=new URL(i,o).searchParams;t=null!=(n=r.get("sdkkey"))?n:r.get("sdkKey")}catch(t){s.Log.error("Invalid source URL")}t&&e({sdkKey:t})}}}}},96:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveDeltasResponse=void 0;const i=n(464);function o(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=Object.assign(Object.assign(Object.assign({},t),n),{feature_gates:Object.assign(Object.assign({},t.feature_gates),n.feature_gates),layer_configs:Object.assign(Object.assign({},t.layer_configs),n.layer_configs),dynamic_configs:Object.assign(Object.assign({},t.dynamic_configs),n.dynamic_configs)}),o((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,o(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,o(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.Ot=null,this.St=null,this.jt="Uninitialized",this.Tt=0,this.It=0}getValues(){return this.Ot?(0,i.typedJsonParse)(this.Ot,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.St=null,this.Ot=null,this.jt="Loading",this.Tt=0,this.It=0}finalize(){this.St||(this.jt="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.Ot=t.data,this.Tt=e.time,this.It=t.receivedAt,this.jt=t.source,this.St=e)}getGate(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.feature_gates[t])?e:null;return this.At(t)}getConfig(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.dynamic_configs[t])?e:null;return this.At(t)}getLayer(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.layer_configs[t])?e:null;return this.At(t)}At(t){return{evaluation:t,details:this.xt(null==t)}}xt(t){return"Uninitialized"===this.jt||"NoValues"===this.jt?{reason:this.jt}:{reason:this.jt+":"+(t?"Unrecognized":"Recognized"),lcut:this.Tt,receivedAt:this.It}}}},400:function(t,e,n){var r=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const s=n(464),u=n(96);class i extends s.NetworkCore{constructor(t,e){super(t,e),this.Dt=(0,s.$)(null==t?void 0:t.initializeUrl,null==t?void 0:t.api,"/initialize","https://api.statsig.com/v1")}fetchEvaluations(n,i,o){return r(this,void 0,void 0,function*(){var t=i?(0,s.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=Object.assign(Object.assign({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Mt(n,t,e)})}Mt(e,n,i){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Dt,data:i,retries:2});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.Mt(e,n,Object.assign(Object.assign(Object.assign({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const s=n(464),o=n(536),r=n(400),u=n(364);n(807);class l extends s.StatsigClientBase{constructor(t,e,n=null){var i=new r.default(n,t=>{this.rt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new u.StatsigEvaluationsDataAdapter,i,n),(0,s.monitorClass)(this.u,this),(0,s.monitorClass)(this.u,i),this.Et=new o.default,this.Nt=e}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}initializeSync(){this.updateUserSync(this.Nt)}initializeAsync(){return this.updateUserAsync(this.Nt)}updateUserSync(t){this.kt(t);t=this.dataAdapter.getDataSync(this.Nt);this.Et.setValuesFromDataAdapter(t),this.Et.finalize(),this.gt("Ready",t),this.Pt(null!=t?t:null,this.Nt)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.kt(n);var t=this.Nt,e=this.dataAdapter.getDataSync(t);this.gt("Loading",e),this.Et.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.Nt&&this.Et.setValuesFromDataAdapter(e),this.Et.finalize(),this.gt("Ready",e)})}checkGate(t,e){return this.getFeatureGate(t,e).value}getContext(){return{sdkKey:this.l,options:this.P,values:this.Et.getValues(),user:JSON.parse(JSON.stringify(this.Nt))}}getAsyncContext(){return i(this,void 0,void 0,function*(){return Object.assign(Object.assign({},this.getContext()),{sessionID:yield s.SessionID.get(this.l),stableID:yield s.StableID.get(this.l)})})}getFeatureGate(t,e){var n=(0,s.DJB2)(t),{evaluation:n,details:i}=this.Et.getGate(n),i=(0,s.makeFeatureGate)(t,i,n),o=null==(o=null==(n=this.ft)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.Nt,e),n=null!=o?o:i;return this.yt(t,(0,s.createGateExposure)(this.Nt,n),e),this.rt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.Ct("dynamic_config",t,e);return this.rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.Ct("experiment",t,e);return this.rt({name:"experiment_evaluation",experiment:t}),t}getLayer(n,i){var t=(0,s.DJB2)(n),{evaluation:t,details:e}=this.Et.getLayer(t),e=(0,s.makeLayer)(n,e,t),o=null==(o=null==(t=this.ft)?void 0:t.getLayerOverride)?void 0:o.call(t,e,this.Nt,i);const r=null!=o?o:e;return this.rt({name:"layer_evaluation",layer:r}),Object.assign(Object.assign({},r),{getValue:t=>{var e;return t in r.bt&&(e=(0,s.createLayerParameterExposure)(this.Nt,r,t),this.yt(n,e,i),null!=(e=r.bt[t]))?e:null}})}logEvent(t){this._t.enqueue(Object.assign(Object.assign({},t),{user:this.Nt,time:Date.now()}))}Pt(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{s.Log.error("An error occurred after update.",t)})}kt(t){this._t.reset(),this.Et.reset(),this.Nt=(0,s.normalizeUser)(t,this.P.environment)}Ct(t,e,n){var i=(0,s.DJB2)(e),{evaluation:i,details:o}=this.Et.getConfig(i),o=(0,s.makeDynamicConfig)(e,o,i),i="experiment"===t?null==(t=null==(i=this.ft)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.Nt,n):null==(i=null==(t=this.ft)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.Nt,n),t=null!=i?i:o;return this.yt(e,(0,s.createConfigExposure)(this.Nt,t),n),t}}e.default=l},364:function(t,e,n){var o=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})},i=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigEvaluationsDataAdapter=void 0,n(464));const r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.N=null}attach(t,e){super.attach(t,e),this.N=new r.default(null!=e?e:{})}j(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.N)?void 0:i.fetchEvaluations(this.T(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=s},807:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SDK_TYPE=void 0;n=n(464);e.SDK_TYPE="javascript-client",n.StatsigMetadataProvider.add({sdkType:e.SDK_TYPE})},208:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const o=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return o.StatsigEvaluationsDataAdapter}}),n(807),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__},156:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoCapture=void 0;const i=n(464),o=n(76);e.AutoCapture=class{constructor(t){this.Gt=t,this.Ft=Date.now(),this.Rt=0,"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.Lt()):this.Lt()}Ut(){var t;"undefined"!=typeof window&&"undefined"!=typeof document&&(t=t=>{this.Vt(t||window.event)},(0,o.registerEventHandler)(document,"click",t),(0,o.registerEventHandler)(document,"submit",t),(0,o.registerEventHandler)(window,"error",t),(0,o.registerEventHandler)(window,"beforeunload",()=>this.Jt()),(0,o.registerEventHandler)(window,"scroll",()=>this.Kt()))}Vt(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.qt(t):(e=(0,o.getTargetNode)(t))&&(0,o.shouldLogEvent)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,o.gatherEventData)(e),this.zt(n,t,e))}Lt(){this.Ut(),this.$t(),this.Bt()}qt(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.zt("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}$t(){setTimeout(()=>{var t=(0,o.getSafeUrl)();this.Wt("page_view",(0,o.getSanitizedPageUrl)(),{title:null===document||void 0===document?void 0:document.title,queryParams:Object.fromEntries(t.searchParams)})},1)}Bt(){"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.getEntriesByName&&setTimeout(()=>{var t={},e=window.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),window.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.zt("performance",(0,o.getSanitizedPageUrl)(),t)},1)}Jt(){this.Wt("page_view_end",(0,o.getSanitizedPageUrl)(),{scrollDepth:this.Rt,pageViewLength:Date.now()-this.Ft})}zt(t,e,n){e={eventName:"auto_capture::"+t,value:e,metadata:Object.assign({sessionId:(0,o.getWebSessionId)(this.Gt.getContext().sdkKey),page_url:(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||""},n)};this.Gt.logEvent(e),i.Log.debug("Enqueued Event",e)}Wt(t,e,n){this.zt(t,e,n),this.Gt.flush().catch(t=>{i.Log.error(t)})}Kt(){var t=document.body.scrollHeight||1;this.Rt=Math.max(this.Rt,Math.min(100,Math.round((window.scrollY+window.innerHeight)/t*100)))}}},76:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.registerEventHandler=e.getSanitizedPageUrl=e.getWebSessionId=e.getSafeUrl=e.shouldLogEvent=e.getTargetNode=e.gatherEventData=void 0;const o=n(464),r={};function s(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.gatherEventData=function(t){var e=t.tagName.toLowerCase(),n={},i=e,o=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(o=t.getAttribute("method"))?o:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),s(t));return o&&(n.href=o.getAttribute("href")),{value:i,metadata:n}},e.getTargetNode=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.shouldLogEvent=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(s(e))return!0}return!1}},e.getSafeUrl=function(){var t=(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.getWebSessionId=function(t){var e=function(t){if(window&&window.localStorage)return window.localStorage.getItem(t);return r[t]}(t="statsig.web_analytics.session."+(0,o.DJB2)(t)),n=Date.now();let i=e?(0,o.typedJsonParse)(e,"lastAccessedTime","Failed to parse WebSession"):null;return(i=!i||144e5<n-i.startTime||6e5<n-i.lastAccessedTime?(e=Date.now(),{id:(0,o.getUUID)(),startTime:e,lastAccessedTime:e}):i).lastAccessedTime=n,e=t,n=JSON.stringify(i),window&&window.localStorage?window.localStorage.setItem(e,n):(r[e]=n,o.Log.error("Statsig Web AutoCapture: No window.localStorage")),i.id},e.getSanitizedPageUrl=function(){var t;return(null==(t=null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)?void 0:t.split(/[?#]/)[0])||""},e.registerEventHandler=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoCapture=void 0;const i=n(156);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture}),e.default=__STATSIG__}},i={};function o(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,o)),e.exports}o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const s=o(464),u=o(208),l=o(824);var r=o(920);e.default=__STATSIG__,r.AutoInit.attempt(({sdkKey:t})=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t];let n=null;n=(n=e instanceof u.StatsigClient?e:n)||new u.StatsigClient(t,{userID:""}),new l.AutoCapture(n),n.initializeAsync().catch(t=>{s.Log.error(t)})})}return t.default})());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},o=null!=(o=null!=(o=null!=(o=e.__STATSIG__)?o:n.__STATSIG__)?o:i.__STATSIG__)?o:{};e.__STATSIG__=o,n.__STATSIG__=o,i.__STATSIG__=o},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),o=n(780),r=n(104),u=n(283),l=n(296),a=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,r.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.m(t))?(this.p(t,e),this.h[t]):null)}getDataAsync(n,i){var o;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(o=null==t?void 0:t.data)?o:null,i),e=this._(i);return t&&this.p(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.S(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.p(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.p(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}O(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.j(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(o.Log.debug("No response returned for latest value"),null)})}T(){return null!=this.l?this.l:(o.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,l.getUserStorageKey)(this.T(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}p(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}m(t){var e=null==(e=a.Storage.getItemSync)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}S(t,e){return s(this,void 0,void 0,function*(){yield a.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.getObjectFromStorage)(this.v))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield a.Storage.removeItem(e[0])),yield(0,a.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),o="undefined"!=typeof performance&&void 0!==performance.mark;let s=[];e.captureDiagnostics=function(t,e){r.mark(t+":start"),e=e();const n=()=>{r.mark(t+":end"),(t+":end").startsWith("initialize:")&&r.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class r{static mark(t,e){o&&(t=performance.mark(t,{detail:e}),s.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:s,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),s=[]}}e.Diagnostics=r},512:function(t,u,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.A=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.D(e,t,n)):i}catch(t){return this.D(e,t,n),null}}logError(t,e){this.D(t,e)}D(o,s,r){try{i.Log.warn("Caught error in "+o,{error:s});n(this,void 0,void 0,function*(){var t,e=null!=s?s:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.A.has(i)||(this.A.add(i),t=l.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:o,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=r&&r({name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const o=n(832),s=n(780),r=n(876),u=n(972),l=n(444),a=n(412),c=n(84),d=n(408),h="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.M=e,this.N=n,this.P=i,this.C=[],this.G={},this.F={},this.R=!1,this.L=Date.now(),this.U=!0===(null==i?void 0:i.disableLogging),this.V=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.J=setInterval(()=>this.K(),n),this.q=(0,c.$)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",h),this.B=(0,c.$)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",h),d.VisibilityChangeObserver.add(this),this.W()}setLoggingDisabled(t){this.U=t}enqueue(t){this.H(t)&&(this.Y(t),this.X(),this.C.length>this.V)&&this.K()}incrementNonExposureCount(t){var e=null!=(e=this.F[t])?e:0;this.F[t]=e+1}reset(){this.G={}}onVisibilityChanged(t){"background"===t&&this.K()}shutdown(){return i(this,void 0,void 0,function*(){this.J&&(clearInterval(this.J),this.J=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Z(),0!==this.C.length&&(t=this.C,this.C=[],yield this.tt(t))})}X(){this.R||(this.R=!0,200<Date.now()-this.L)||setTimeout(()=>this.K(),200)}H(t){if((0,r.isExposureEvent)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.G[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.G).length&&(this.G={}),this.G[t]=n}return!0}K(){this.flush().catch(()=>{})}tt(t){return i(this,void 0,void 0,function*(){if(this.U)this.et(t);else try{(!d.VisibilityChangeObserver.isCurrentlyVisible()&&this.N.isBeaconSupported()?yield this.nt(t):yield this.it(t)).success?this.M({name:"logs_flushed",events:t}):this.et(t)}catch(t){s.Log.warn("Failed to flush events.")}})}it(e){return i(this,void 0,void 0,function*(){var t=yield this.N.post({sdkKey:this.l,data:{events:e},url:this.q,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,a.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}nt(t){return i(this,void 0,void 0,function*(){return{success:yield this.N.beacon({sdkKey:this.l,data:{events:t},url:this.B})}})}et(t){for(;500<t.length;)t.shift();var e=this.ot();(0,l.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}W(){const e=this.ot();i(this,void 0,void 0,function*(){var t=yield(0,l.getObjectFromStorage)(e);t&&(yield l.Storage.removeItem(e),yield this.tt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}ot(){return"statsig.failed_logs."+(0,o.DJB2)(this.l)}Y(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var{sdkType:e,sdkVersion:n}=u.StatsigMetadataProvider.get();this.C.push(Object.assign(Object.assign({},t),{statsigMetadata:{sdkType:e,sdkVersion:n}}))}Z(){0!==Object.keys(this.F).length&&(this.Y({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.F)}}),this.F={})}}},832:(t,e)=>{function n(e){let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const o={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),o[t]=e});return o}(t)))}},664:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.LogLevel=void 0,(o=i||(e.LogLevel=i={}))[o.None=0]="None",o[o.Error=1]="Error",o[o.Warn=2]="Warn",o[o.Info=3]="Info",o[o.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const s=n(280),r=n(688);function c(t,e,n,i){var o=i instanceof r.StatsigClientBase?i.rt.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),o)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var o;const s=i;for(const r of function(t){const e=new Set;let n=d(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(s))if("constructor"!==r){const u=s[r];s[r]=function(...t){return c(n,r,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const a=null==(o=null===s||void 0===s?void 0:s.constructor)?void 0:o[l];(null===s||void 0===s?void 0:s.constructor)[l]=function(...t){return c(n,s.constructor.name+"."+l,()=>a.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),s=n(612),r=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.M=e,this.ut=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return o(this,void 0,void 0,function*(){var t=yield this.lt(e);return this.ct(Object.assign({method:"POST",body:t},e))})}get(t){return o(this,void 0,void 0,function*(){return this.ct(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return o(this,void 0,void 0,function*(){var t=yield this.dt(n),e=yield this.lt(n);return navigator.sendBeacon(t,e)})}ct(c){var d;return o(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const o=new AbortController;var t,s,r,u=setTimeout(()=>o.abort(`Timeout of ${this.ut}ms expired.`),this.ut),l=yield this.dt(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:Object.assign({},c.headers),signal:o.signal}),clearTimeout(u),a.ok)return r=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:r,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",s}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(o,t);return h.Diagnostics.mark("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.M)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.ct(Object.assign(Object.assign({},c),{retries:i-1}))}})}dt(e){return o(this,void 0,void 0,function*(){var t=u.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}lt(i){return o(this,void 0,void 0,function*(){var t=i["data"],e=yield r.StableID.get(i.sdkKey),n=yield s.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.ht(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.ht(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}ht(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:function(t,r,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const i=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}r.SessionID={get:t=>n(void 0,void 0,void 0,function*(){return null!=h[t]?h[t]:h[t]=r.SessionID.we(t)}),we:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();let i=!1;if(null==e){let t=yield function(t){t=v(t);return(0,l.getObjectFromStorage)(t)}(s);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n},i=!0),e=t,c[s]=e}var t=null!=(t=d[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n,i=!0),e.lastUpdate=n,e),o=s;return o=v(s),(0,l.setObjectInStorage)(o,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.xe(t,t.idleTimeoutID,18e5),i&&(t.ageTimeoutID=r.SessionID.xe(t,t.ageTimeoutID,144e5)),c[s]=e,d[s]=t,h[s]=null,e.sessionID}),Te:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},xe:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const o=n(832),s=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.DJB2)(t)}function c(t,e){e=a(e);(0,r.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.getObjectFromStorage)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const s=n(512),r=n(728),u=n(780),l=n(612),a=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.vt={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(o=null==i?void 0:i.logLevel)?o:u.LogLevel.Warn,this.ft=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this._t=new r.EventLogger(t,this.rt.bind(this),n,i),l.SessionID.Te(()=>{this.rt({name:"session_expired"})},t),this.u=new s.ErrorBoundary(t);var o,n=null!=(o=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?o:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this._t.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,c.Storage.setDisabled(t.disableStorage))}flush(){return this._t.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.rt({name:"pre_shutdown"}),yield this._t.shutdown()})}on(t,e){this.vt[t]||(this.vt[t]=[]),this.vt[t].push(e)}off(t,e){this.vt[t]&&-1!==(e=this.vt[t].indexOf(e))&&this.vt[t].splice(e,1)}rt(e){var t;const n=t=>{try{t(e)}catch(t){u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this.vt[e.name]&&this.vt[e.name].forEach(t=>n(t)),null!=(t=this.vt["*"])&&t.forEach(n)}gt(t,e){this.loadingStatus=t,this.rt({name:"values_updated",status:t,values:e})}yt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this._t.incrementNonExposureCount(t):this._t.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function l(t,e,n,i,o){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:o,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(t,e){return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createConfigExposure=function(t,e){return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createLayerParameterExposure=function(t,e,n){var i,o=e.__evaluation,s=!0===(null==(s=null==o?void 0:o.explicit_parameters)?void 0:s.includes(n));let r="",u=null!=(i=null==o?void 0:o.undelegated_secondary_exposures)?i:[];return s&&(r=null!=(i=o.allocated_experiment_name)?i:"",u=o.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)},u)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=void 0;let n={sdkVersion:"0.0.1-beta.25",sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.makeLayer=e.makeDynamicConfig=e.makeFeatureGate=void 0;const o="default";e.makeFeatureGate=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.makeDynamicConfig=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,value:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}},e.makeLayer=function(t,e,n,i){return{name:t,details:e,getValue:null!=i?i:()=>{},ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,bt:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}}},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const o={},s={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=o[t])?t:null},getItem(t){return Promise.resolve(null!=(t=o[t])?t:null)},setItem(t,e){return o[t]=e,Promise.resolve()},removeItem(t){return delete o[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(o))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:s,l=u;e.Storage={getProviderName:()=>l.getProviderName(),getItem:t=>l.getItem(t),setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=l.getItemSync)?void 0:e.call(l,t))?e:null},setProvider:t=>{u=t,l=t},setDisabled:t=>{l=t?s:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield l.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield l.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.typedJsonParse=void 0;const o=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return o.Log.error(n),null}},556:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.$=void 0,e.$=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.wt}static add(t){this.vt.push(t)}static remove(t){t=this.vt.indexOf(t);-1!==t&&this.vt.splice(t,1)}static notify(e){e!==this.wt&&(this.wt=e,this.vt.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).vt=[],n.wt="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780)),u=(Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}}),n(444));Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return u.Storage}});var l=n(556);o(n(496),e),o(n(856),e),o(n(320),e),o(n(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(664),e),o(n(780),e),o(n(104),e),o(n(188),e),o(n(264),e),o(n(612),e),o(n(604),e),o(n(688),e),o(n(808),e),o(n(283),e),o(n(876),e),o(n(972),e),o(n(384),e),o(n(136),e),o(n(296),e),o(n(444),e),o(n(412),e),o(n(84),e),o(n(539),e),o(n(556),e),o(n(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:r.Log,getUUID:l.getUUID,Storage:u.Storage})},696:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(208),e),e.default=__STATSIG__},96:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveDeltasResponse=void 0;const i=n(464);function o(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=Object.assign(Object.assign(Object.assign({},t),n),{feature_gates:Object.assign(Object.assign({},t.feature_gates),n.feature_gates),layer_configs:Object.assign(Object.assign({},t.layer_configs),n.layer_configs),dynamic_configs:Object.assign(Object.assign({},t.dynamic_configs),n.dynamic_configs)}),o((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,o(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,o(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.Ot=null,this.St=null,this.jt="Uninitialized",this.Tt=0,this.It=0}getValues(){return this.Ot?(0,i.typedJsonParse)(this.Ot,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.St=null,this.Ot=null,this.jt="Loading",this.Tt=0,this.It=0}finalize(){this.St||(this.jt="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.Ot=t.data,this.Tt=e.time,this.It=t.receivedAt,this.jt=t.source,this.St=e)}getGate(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.feature_gates[t])?e:null;return this.At(t)}getConfig(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.dynamic_configs[t])?e:null;return this.At(t)}getLayer(t){var e,t=null!=(e=null==(e=this.St)?void 0:e.layer_configs[t])?e:null;return this.At(t)}At(t){return{evaluation:t,details:this.xt(null==t)}}xt(t){return"Uninitialized"===this.jt||"NoValues"===this.jt?{reason:this.jt}:{reason:this.jt+":"+(t?"Unrecognized":"Recognized"),lcut:this.Tt,receivedAt:this.It}}}},400:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464),u=n(96);class i extends r.NetworkCore{constructor(t,e){super(t,e),this.Dt=(0,r.$)(null==t?void 0:t.initializeUrl,null==t?void 0:t.api,"/initialize","https://api.statsig.com/v1")}fetchEvaluations(n,i,o){return s(this,void 0,void 0,function*(){var t=i?(0,r.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=Object.assign(Object.assign({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Mt(n,t,e)})}Mt(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Dt,data:i,retries:2});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.Mt(e,n,Object.assign(Object.assign(Object.assign({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464),o=n(536),s=n(400),u=n(364);n(807);class l extends r.StatsigClientBase{constructor(t,e,n=null){var i=new s.default(n,t=>{this.rt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new u.StatsigEvaluationsDataAdapter,i,n),(0,r.monitorClass)(this.u,this),(0,r.monitorClass)(this.u,i),this.Et=new o.default,this.Nt=e}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}initializeSync(){this.updateUserSync(this.Nt)}initializeAsync(){return this.updateUserAsync(this.Nt)}updateUserSync(t){this.kt(t);t=this.dataAdapter.getDataSync(this.Nt);this.Et.setValuesFromDataAdapter(t),this.Et.finalize(),this.gt("Ready",t),this.Pt(null!=t?t:null,this.Nt)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.kt(n);var t=this.Nt,e=this.dataAdapter.getDataSync(t);this.gt("Loading",e),this.Et.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.Nt&&this.Et.setValuesFromDataAdapter(e),this.Et.finalize(),this.gt("Ready",e)})}checkGate(t,e){return this.getFeatureGate(t,e).value}getContext(){return{sdkKey:this.l,options:this.P,values:this.Et.getValues(),user:JSON.parse(JSON.stringify(this.Nt))}}getAsyncContext(){return i(this,void 0,void 0,function*(){return Object.assign(Object.assign({},this.getContext()),{sessionID:yield r.SessionID.get(this.l),stableID:yield r.StableID.get(this.l)})})}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.Et.getGate(n),i=(0,r.makeFeatureGate)(t,i,n),o=null==(o=null==(n=this.ft)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.Nt,e),n=null!=o?o:i;return this.yt(t,(0,r.createGateExposure)(this.Nt,n),e),this.rt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.Ct("dynamic_config",t,e);return this.rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.Ct("experiment",t,e);return this.rt({name:"experiment_evaluation",experiment:t}),t}getLayer(n,i){var t=(0,r.DJB2)(n),{evaluation:t,details:e}=this.Et.getLayer(t),e=(0,r.makeLayer)(n,e,t),o=null==(o=null==(t=this.ft)?void 0:t.getLayerOverride)?void 0:o.call(t,e,this.Nt,i);const s=null!=o?o:e;return this.rt({name:"layer_evaluation",layer:s}),Object.assign(Object.assign({},s),{getValue:t=>{var e;return t in s.bt&&(e=(0,r.createLayerParameterExposure)(this.Nt,s,t),this.yt(n,e,i),null!=(e=s.bt[t]))?e:null}})}logEvent(t){this._t.enqueue(Object.assign(Object.assign({},t),{user:this.Nt,time:Date.now()}))}Pt(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}kt(t){this._t.reset(),this.Et.reset(),this.Nt=(0,r.normalizeUser)(t,this.P.environment)}Ct(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:o}=this.Et.getConfig(i),o=(0,r.makeDynamicConfig)(e,o,i),i="experiment"===t?null==(t=null==(i=this.ft)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.Nt,n):null==(i=null==(t=this.ft)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.Nt,n),t=null!=i?i:o;return this.yt(e,(0,r.createConfigExposure)(this.Nt,t),n),t}}e.default=l},364:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})},i=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigEvaluationsDataAdapter=void 0,n(464));const s=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.N=null}attach(t,e){super.attach(t,e),this.N=new s.default(null!=e?e:{})}j(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.N)?void 0:i.fetchEvaluations(this.T(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},807:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SDK_TYPE=void 0;n=n(464);e.SDK_TYPE="javascript-client",n.StatsigMetadataProvider.add({sdkType:e.SDK_TYPE})},208:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const o=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return o.StatsigEvaluationsDataAdapter}}),n(807),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__}},i={};function o(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,o)),e.exports}return o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o(696).default})());
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/js-client",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.25",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@statsig/client-core": "0.0.1-beta.
|
|
5
|
+
"@statsig/client-core": "0.0.1-beta.25"
|
|
6
6
|
},
|
|
7
7
|
"jsdelivr": "./build/statsig-js-client.min.js",
|
|
8
8
|
"type": "commonjs",
|
package/src/StatsigClient.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { DynamicConfig, DynamicConfigEvaluationOptions, EvaluationsDataAdapter, Experiment, ExperimentEvaluationOptions, FeatureGate, FeatureGateEvaluationOptions, Layer, LayerEvaluationOptions, PrecomputedEvaluationsContext, PrecomputedEvaluationsInterface, StatsigClientBase, StatsigEvent, StatsigUser } from '@statsig/client-core';
|
|
1
|
+
import { DynamicConfig, DynamicConfigEvaluationOptions, EvaluationsDataAdapter, Experiment, ExperimentEvaluationOptions, FeatureGate, FeatureGateEvaluationOptions, Layer, LayerEvaluationOptions, PrecomputedEvaluationsAsyncContext, PrecomputedEvaluationsContext, PrecomputedEvaluationsInterface, StatsigClientBase, StatsigEvent, StatsigUser } from '@statsig/client-core';
|
|
2
2
|
import './StatsigMetadataAdditions';
|
|
3
3
|
import type { StatsigOptions } from './StatsigOptions';
|
|
4
4
|
export default class StatsigClient extends StatsigClientBase<EvaluationsDataAdapter> implements PrecomputedEvaluationsInterface {
|
|
5
5
|
private _store;
|
|
6
6
|
private _user;
|
|
7
7
|
constructor(sdkKey: string, user: StatsigUser, options?: StatsigOptions | null);
|
|
8
|
+
static instance(sdkKey?: string): StatsigClient | undefined;
|
|
8
9
|
initializeSync(): void;
|
|
9
10
|
initializeAsync(): Promise<void>;
|
|
10
11
|
updateUserSync(user: StatsigUser): void;
|
|
11
12
|
updateUserAsync(user: StatsigUser): Promise<void>;
|
|
12
13
|
checkGate(name: string, options?: FeatureGateEvaluationOptions): boolean;
|
|
13
14
|
getContext(): PrecomputedEvaluationsContext;
|
|
15
|
+
getAsyncContext(): Promise<PrecomputedEvaluationsAsyncContext>;
|
|
14
16
|
getFeatureGate(name: string, options?: FeatureGateEvaluationOptions): FeatureGate;
|
|
15
17
|
getDynamicConfig(name: string, options?: DynamicConfigEvaluationOptions): DynamicConfig;
|
|
16
18
|
getExperiment(name: string, options?: ExperimentEvaluationOptions): Experiment;
|
package/src/StatsigClient.js
CHANGED
|
@@ -26,6 +26,14 @@ class StatsigClient extends client_core_1.StatsigClientBase {
|
|
|
26
26
|
this._store = new EvaluationStore_1.default();
|
|
27
27
|
this._user = user;
|
|
28
28
|
}
|
|
29
|
+
static instance(sdkKey) {
|
|
30
|
+
var _a;
|
|
31
|
+
__STATSIG__ = __STATSIG__ !== null && __STATSIG__ !== void 0 ? __STATSIG__ : {};
|
|
32
|
+
if (sdkKey == null) {
|
|
33
|
+
return __STATSIG__.lastInstance;
|
|
34
|
+
}
|
|
35
|
+
return (_a = __STATSIG__.instances) === null || _a === void 0 ? void 0 : _a[sdkKey];
|
|
36
|
+
}
|
|
29
37
|
initializeSync() {
|
|
30
38
|
this.updateUserSync(this._user);
|
|
31
39
|
}
|
|
@@ -63,11 +71,15 @@ class StatsigClient extends client_core_1.StatsigClientBase {
|
|
|
63
71
|
return {
|
|
64
72
|
sdkKey: this._sdkKey,
|
|
65
73
|
options: this._options,
|
|
66
|
-
sessionID: client_core_1.SessionID.get(this._sdkKey),
|
|
67
74
|
values: this._store.getValues(),
|
|
68
75
|
user: JSON.parse(JSON.stringify(this._user)),
|
|
69
76
|
};
|
|
70
77
|
}
|
|
78
|
+
getAsyncContext() {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
return Object.assign(Object.assign({}, this.getContext()), { sessionID: yield client_core_1.SessionID.get(this._sdkKey), stableID: yield client_core_1.StableID.get(this._sdkKey) });
|
|
81
|
+
});
|
|
82
|
+
}
|
|
71
83
|
getFeatureGate(name, options) {
|
|
72
84
|
var _a, _b;
|
|
73
85
|
const hash = (0, client_core_1.DJB2)(name);
|