@statsig/js-client 3.3.0-beta.1 → 3.3.0-beta.3

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.
@@ -5,4 +5,4 @@ or you can use record.mirror to access the mirror instance during recording.`;le
5
5
  `;return r&&o.push("//# sourceMappingURL="+r+`
6
6
  `),o}function an(e,t){var r=sn(e,t),n=new Blob(r,{type:"application/javascript"});return URL.createObjectURL(n)}function ln(e,t){var r;return function(o){return r=r||an(e,t),new Worker(r,o)}}var cn=ln(function(){(function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256),r=0;r<e.length;r++)t[e.charCodeAt(r)]=r;var n=function(s){var c=new Uint8Array(s),d,p=c.length,h="";for(d=0;d<p;d+=3)h+=e[c[d]>>2],h+=e[(c[d]&3)<<4|c[d+1]>>4],h+=e[(c[d+1]&15)<<2|c[d+2]>>6],h+=e[c[d+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,a=new Map;async function l(s,c,d){const p=`${s}-${c}`;if("OffscreenCanvas"in globalThis){if(a.has(p))return a.get(p);const h=new OffscreenCanvas(s,c);h.getContext("2d");const m=await(await h.convertToBlob(d)).arrayBuffer(),f=n(m);return a.set(p,f),f}else return""}const i=self;i.onmessage=async function(s){if("OffscreenCanvas"in globalThis){const{id:c,bitmap:d,width:p,height:h,dataURLOptions:m}=s.data,f=l(p,h,m),u=new OffscreenCanvas(p,h);u.getContext("2d").drawImage(d,0,0),d.close();const y=await u.convertToBlob(m),S=y.type,b=await y.arrayBuffer(),g=n(b);if(!o.has(c)&&await f===g)return o.set(c,g),i.postMessage({id:c});if(o.get(c)===g)return i.postMessage({id:c});i.postMessage({id:c,type:S,base64:g,width:p,height:h}),o.set(c,g)}else return i.postMessage({id:s.data.id})}})()},null),Ft=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,pn=(e,t)=>{var r={};for(var n in e)dn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ft)for(var n of Ft(e))t.indexOf(n)<0&&un.call(e,n)&&(r[n]=e[n]);return r},hn=(e,t,r)=>new Promise((n,o)=>{var a=s=>{try{i(r.next(s))}catch(c){o(c)}},l=s=>{try{i(r.throw(s))}catch(c){o(c)}},i=s=>s.done?n(s.value):Promise.resolve(s.value).then(a,l);i((r=r.apply(e,t)).next())});class mn{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(s,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(c)};const{sampling:r="all",win:n,blockClass:o,blockSelector:a,recordCanvas:l,dataURLOptions:i}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,l&&r==="all"&&this.initCanvasMutationObserver(n,o,a),l&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,a,{dataURLOptions:i})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,o,a){const l=Dt(r,n,o,!0),i=new Map,s=new cn;s.onmessage=f=>{const{id:u}=f.data;if(i.set(u,!1),!("base64"in f.data))return;const{base64:y,type:S,width:b,height:g}=f.data;this.mutationCb({id:u,type:ae["2D"],commands:[{property:"clearRect",args:[0,0,b,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:S}]},0,0]}]})};const c=1e3/t;let d=0,p;const h=()=>{const f=[];return r.document.querySelectorAll("canvas").forEach(u=>{F(u,n,o,!0)||f.push(u)}),f},m=f=>{if(d&&f-d<c){p=requestAnimationFrame(m);return}d=f,h().forEach(u=>hn(this,null,function*(){var y;const S=this.mirror.getId(u);if(i.get(S))return;if(i.set(S,!0),["webgl","webgl2"].includes(u.__context)){const g=u.getContext(u.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(u);s.postMessage({id:S,bitmap:b,width:u.width,height:u.height,dataURLOptions:a.dataURLOptions},[b])})),p=requestAnimationFrame(m)};p=requestAnimationFrame(m),this.resetObservers=()=>{l(),cancelAnimationFrame(p)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Dt(t,r,n,!1),a=rn(this.processMutation.bind(this),t,r,n),l=on(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{o(),a(),l()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const o=n.map(l=>pn(l,["type"])),{type:a}=n[0];this.mutationCb({id:r,type:a,commands:o}),this.pendingCanvasMutations.delete(t)}}class fn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new br,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},o=[];for(const a of t){let l;this.styleMirror.has(a)?l=this.styleMirror.getId(a):(l=this.styleMirror.add(a),o.push({styleId:l,rules:Array.from(a.rules||CSSRule,(i,s)=>({rule:Ge(i),index:s}))})),n.styleIds.push(l)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class yn{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}var gn=Object.defineProperty,Sn=Object.defineProperties,bn=Object.getOwnPropertyDescriptors,_t=Object.getOwnPropertySymbols,vn=Object.prototype.hasOwnProperty,In=Object.prototype.propertyIsEnumerable,Pt=(e,t,r)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))vn.call(t,r)&&Pt(e,r,t[r]);if(_t)for(var r of _t(t))In.call(t,r)&&Pt(e,r,t[r]);return e},Mn=(e,t)=>Sn(e,bn(t));function N(e){return Mn($({},e),{timestamp:Me()})}let E,Ee,Ue,Re=!1;const j=Xt();function ye(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:p,maskInputOptions:h,slimDOMOptions:m,maskInputFn:f,maskTextFn:u,hooks:y,packFn:S,sampling:b={},dataURLOptions:g={},mousemoveWait:v,recordDOM:R=!0,recordCanvas:D=!1,recordCrossOriginIframes:V=!1,recordAfter:U=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:B=!1,inlineImages:X=!1,plugins:k,keepIframeSrcFn:Z=()=>!1,ignoreCSSAttributes:W=new Set([]),errorHandler:J}=e;kr(J);const G=V?window.parent===window:!0;let xe=!1;if(!G)try{window.parent.document&&(xe=!1)}catch{xe=!0}if(G&&!t)throw new Error("emit function is required");v!==void 0&&b.mousemove===void 0&&(b.mousemove=v),j.reset();const je=p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:h!==void 0?h:{password:!0},ze=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};Sr();let $t,Be=0;const Wt=I=>{for(const H of k||[])H.eventProcessor&&(I=H.eventProcessor(I));return S&&!xe&&(I=S(I)),I};E=(I,H)=>{var x;if(((x=Q[0])==null?void 0:x.isFrozen())&&I.type!==C.FullSnapshot&&!(I.type===C.IncrementalSnapshot&&I.data.source===M.Mutation)&&Q.forEach(_=>_.unfreeze()),G)t?.(Wt(I),H);else if(xe){const _={type:"rrweb",event:Wt(I),origin:window.location.origin,isCheckout:H};window.parent.postMessage(_,"*")}if(I.type===C.FullSnapshot)$t=I,Be=0;else if(I.type===C.IncrementalSnapshot){if(I.data.source===M.Mutation&&I.data.isAttachIframe)return;Be++;const _=n&&Be>=n,ce=r&&I.timestamp-$t.timestamp>r;(_||ce)&&Ee(!0)}};const Le=I=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.Mutation},I)}))},Ut=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Scroll},I)})),jt=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.CanvasMutation},I)})),wn=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.AdoptedStyleSheet},I)})),ee=new fn({mutationCb:Le,adoptedStyleSheetCb:wn}),te=new Gr({mirror:j,mutationCb:Le,stylesheetManager:ee,recordCrossOriginIframes:V,wrappedEmit:E});for(const I of k||[])I.getMirror&&I.getMirror({nodeMirror:j,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const He=new yn;Ue=new mn({recordCanvas:D,mutationCb:jt,win:window,blockClass:o,blockSelector:a,mirror:j,sampling:b.canvas,dataURLOptions:g});const Ne=new Qr({mutationCb:Le,scrollCb:Ut,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:s,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:je,dataURLOptions:g,maskTextFn:u,maskInputFn:f,recordCanvas:D,inlineImages:X,sampling:b,slimDOMOptions:ze,iframeManager:te,stylesheetManager:ee,canvasManager:Ue,keepIframeSrcFn:Z,processedNodeManager:He},mirror:j});Ee=(I=!1)=>{if(!R)return;E(N({type:C.Meta,data:{href:window.location.href,width:ot(),height:nt()}}),I),ee.reset(),Ne.init(),Q.forEach(x=>x.lock());const H=yr(document,{mirror:j,blockClass:o,blockSelector:a,maskTextClass:s,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:je,maskTextFn:u,slimDOM:ze,dataURLOptions:g,recordCanvas:D,inlineImages:X,onSerialize:x=>{it(x,j)&&te.addIframe(x),lt(x,j)&&ee.trackLinkElement(x),$e(x)&&Ne.addShadowRoot(x.shadowRoot,document)},onIframeLoad:(x,_)=>{te.attachIframe(x,_),Ne.observeAttachShadow(x)},onStylesheetLoad:(x,_)=>{ee.attachLinkElement(x,_)},keepIframeSrcFn:Z});if(!H)return console.warn("Failed to snapshot the document");E(N({type:C.FullSnapshot,data:{node:H,initialOffset:rt(window)}}),I),Q.forEach(x=>x.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,j.getId(document))};try{const I=[],H=_=>{var ce;return w(Vr)({mutationCb:Le,mousemoveCb:(T,Ve)=>E(N({type:C.IncrementalSnapshot,data:{source:Ve,positions:T}})),mouseInteractionCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.MouseInteraction},T)})),scrollCb:Ut,viewportResizeCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.ViewportResize},T)})),inputCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Input},T)})),mediaInteractionCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.MediaInteraction},T)})),styleSheetRuleCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.StyleSheetRule},T)})),styleDeclarationCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.StyleDeclaration},T)})),canvasMutationCb:jt,fontCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Font},T)})),selectionCb:T=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.Selection},T)}))},customElementCb:T=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.CustomElement},T)}))},blockClass:o,ignoreClass:l,ignoreSelector:i,maskTextClass:s,maskTextSelector:c,maskInputOptions:je,inlineStylesheet:d,sampling:b,recordDOM:R,recordCanvas:D,inlineImages:X,userTriggeredOnInput:z,collectFonts:B,doc:_,maskInputFn:f,maskTextFn:u,keepIframeSrcFn:Z,blockSelector:a,slimDOMOptions:ze,dataURLOptions:g,mirror:j,iframeManager:te,stylesheetManager:ee,shadowDomManager:Ne,processedNodeManager:He,canvasManager:Ue,ignoreCSSAttributes:W,plugins:((ce=k?.filter(T=>T.observer))==null?void 0:ce.map(T=>({observer:T.observer,options:T.options,callback:Ve=>E(N({type:C.Plugin,data:{plugin:T.name,payload:Ve}}))})))||[]},y)};te.addLoadListener(_=>{try{I.push(H(_.contentDocument))}catch(ce){console.warn(ce)}});const x=()=>{Ee(),I.push(H(document)),Re=!0};return document.readyState==="interactive"||document.readyState==="complete"?x():(I.push(A("DOMContentLoaded",()=>{E(N({type:C.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&x()})),I.push(A("load",()=>{E(N({type:C.Load,data:{}})),U==="load"&&x()},window))),()=>{I.forEach(_=>_()),He.destroy(),Re=!1,Or()}}catch(I){console.warn(I)}}return ye.addCustomEvent=(e,t)=>{if(!Re)throw new Error("please add custom event after start recording");E(N({type:C.Custom,data:{tag:e,payload:t}}))},ye.freezePage=()=>{Q.forEach(e=>e.freeze())},ye.takeFullSnapshot=e=>{if(!Re)throw new Error("please take full snapshot after start recording");Ee(e)},ye.mirror=j,ye}();
7
7
 
8
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("rrwebRecord")):"function"==typeof define&&define.amd?define(["rrwebRecord"],e):"object"==typeof exports?exports.Statsig=e(require("rrwebRecord")):t.Statsig=e(t.rrwebRecord)}(this,u=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var i={3331:t=>{t.exports=u},1845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||l,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=l,e[s]=l,o[s]=l},2137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),o=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,l){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),this.G(e,s),s})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class n{constructor(){this.V={}}get(t,e){var t=this.V[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=l(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,l,e){var i=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),o=i(7512),l=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(9638),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),y=i(8962),m=i(7512),u=i(7410),n=i(308),a=i(5902),c=i(6830),h=i(4143),d=i(9122),v=i(8e3),S=i(2397),O=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return o(this,void 0,void 0,function*(){var t,e,i;return!!j(n)&&(e=this.Nn("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!j(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=g,s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,S.Ut)();try{var c,h,d,v={method:e,body:i,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:a},f=(u=s,(_=g).isInitialize&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),w(g,l,s,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var i=function(t,e){if(null!=t&&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"Unknown Error"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),_=(w(g,l,s,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,i,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!n||n<s||!O.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return o(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s,r){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=d.StableID.get(t),n=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var i,n,s=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var i=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:i})}};const j=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1);function w(t,e,i,n,s){t.isInitialize&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const a=i(8809),s=i(1406),o=i(7512),r=i(7410),l=i(4534);function u(t){for(const e in r.NetworkDefault)if(t.startsWith(r.NetworkDefault[e]))return!0;return!1}function v(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,s.h)(t)}function f(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function _(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i,e=_(e);e&&(i=null==(i=this.Un)?void 0:i[e])&&(i.expiryTime=Date.now()+6048e5,f(t,$P($P({},this.Un),{[e]:i})))}getFallbackUrl(t,e){var i=_(e);if(!u(e)||!i)return null;let n=this.Un;null==n&&(n=null!=(r=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.Un=n);var s,r=n[i];return!r||Date.now()>(null!=(s=r.expiryTime)?s:0)?(delete n[i],this.Un=n,f(t,this.Un),null):(s=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),r.url?`https://${r.url}/`+s:null)}tryFetchUpdatedFallbackInfo(r,o,l,u){var a,c,h,d;return n(this,void 0,void 0,function*(){try{var t,e,i,n,s=_(o);return v(l,u)&&s?!!(t=yield this.Gn(s))&&(e={url:t,expiryTime:Date.now()+6048e5,previous:[]},(i=null==(a=this.Un)?void 0:a[s])&&e.previous.push(...i.previous),10<e.previous.length&&(e.previous=[]),null!=(n=null==(h=null==(c=this.Un)?void 0:c[s])?void 0:h.url)&&e.previous.push(n),this.Un=$P($P({},this.Un),{[s]:e}),f(r,this.Un),!0):!1}catch(t){return null!=(d=this.Wt)&&d.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Gn(l){var u;return n(this,void 0,void 0,function*(){var t=yield(0,a.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),i=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let n=null;for(const o of t){var[s,r]=o.split("=");if(r&&s===l){let t=r;if(r.endsWith("/")&&(t=r.slice(0,-1)),!e.has(r)&&t!==i){n=t;break}}}return n})}},e.Cn=u,e.Pn=v},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),r=i(7512),o=i(4534),l=i(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,l.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),s=i(7512),r=i(4534),o=i(8023),l={};function u(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=u(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const o=i(1845),l=i(5542),u=i(7770),a=i(7512),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new u.EventLogger(t,r,i,n),this.Wt=new l.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),i.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e)},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return u(n,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.te=(t,e)=>{return u(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",l=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",l=s.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},l)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(6634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:l(null==i?void 0:i.value)})}function l(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:l(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:l(i,n)})},e.ie=l},1812:(t,e)=>{$Q(e)},8578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(1406),s=i(7512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:r,u=l;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?r:l}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(7512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},2397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(6830);const n="foreground",s="background",r=[];let o=n,l=!1;e.Ot=()=>o===n,e.Ut=()=>l,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(l=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{l=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(1845);const r=i(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7023),e),s(i(7410),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(1098),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(9638),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},2016:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const v=i(6914),f=i(2018);function _(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,v.Lt)(),r=(0,v.Jt)();if(s&&r&&r.currentScript){var o=r.currentScript.getAttribute("src"),l=null==(t=s.location)?void 0:t.href;if(o&&l){var u=new URL(o,l).searchParams,a=null!=(i=_("sdkKey",u))?i:_("apiKey",u);if(a){var c={},h=_("proxy",u),d=(h&&(c.networkConfig={api:h}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const l=i(6914),u=i(7262);class n extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,l.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});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==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,y(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(6914),l=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new l.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=r.default,s(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__},8788:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.SessionReplay=e.runStatsigSessionReplay=e.StatsigSessionReplayPlugin=void 0;const s=i(6914),r=i(759);function o(t,e){new l(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){o(t,this.options)}},e.runStatsigSessionReplay=o;class l{constructor(t,e){this.De=t,this.p=e,this.ke=null,this.Ee=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.Wt=t,this.Wt.wrap(this),(0,s.Mt)()||((t=(0,s.o)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.Re=this.Ne(),this.Ce=new r.SessionReplayClient,this.De.$on("pre_shutdown",()=>this.Pe()),this.De.$on("values_updated",()=>{var t;return this.Ge(null==(t=this.p)?void 0:t.forceRecording)}),this.De.on("session_expired",()=>{this.Ce.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Ue("session_expired"),this.Re=this.Ne()}),this.Le(),this.Ge(null==(t=this.p)?void 0:t.forceRecording)}Le(){const i=this.De.getContext()["sdkKey"];(0,s.lt)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof l&&e.Ke(t)})}forceStartRecording(){this.Ge(!0)}Ke(t){"background"===t&&(this.Ue(),this.De.flush().catch(t=>{this.Wt.logError("SR::visibility",t)}))}Fe(t,e){this.ke=e,this.Ee.push(t),2048<JSON.stringify(this.Ee).length&&((0,s.Ot)()?this.qe():this.Ue())}Ge(t=!1){var e=this.De.getContext().values;t||!0===(null==e?void 0:e.can_record_session)?this.Ce.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Ce.record((t,e)=>this.Fe(t,e),null!=(e=null==(t=this.p)?void 0:t.rrwebConfig)?e:{})):this.Pe()}Pe(){this.Ce.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.Ee.length&&null!=this.ke&&this.qe()}Ue(e){0!==this.Ee.length&&null!=this.ke&&(e=(0,s.Ut)()?"is_leaving_page":e,this.Re.then(t=>this.ze(t,e)).catch(t=>{this.Wt.logError("SR::flush",t)}))}ze(t,e){var i,n=this.ke;null!==n&&0!==this.Ee.length&&(i=JSON.stringify(this.Ee),t={eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:i,rrweb_payload_size:String(i.length),session_replay_sdk_version:s.SDK_VERSION}},e&&(t.metadata[e]="true"),this.De.logEvent(t),this.Ee=[])}qe(){this.Re=this.Ne(),this.Ue()}Ne(){return n(this,void 0,void 0,function*(){return this.De.getContext().session.data.sessionID})}}e.SessionReplay=l},759:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(3331),s=i(6914);e.SessionReplayClient=class{constructor(){this.Je=null,this.Ve=null,this.Be=0}record(i,t,e){null==(0,s.Jt)()||(this.Je=null,this.Ve=null,this.Be=0,this.$e=e,this.He)||(this.He=(e=t=>{var e;null==this.Je&&(this.Je=t.timestamp),this.Ve=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.Be++,i(t,{startTime:this.Je,endTime:this.Ve,clickCount:this.Be}),144e5<this.Ve-this.Je&&(null!=(e=this.He)&&e.call(this),this.$e)&&this.$e()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.He&&(this.He(),this.He=void 0)}isRecording(){return null!=this.He}}},3447:(t,e,i)=>{$Q(e),e.StatsigSessionReplayPlugin=e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(8788),s=($Q2(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),$Q2(e,"StatsigSessionReplayPlugin",{enumerable:!0,get:function(){return n.StatsigSessionReplayPlugin}}),$Q2(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(759));$Q2(e,"SessionReplayClient",{enumerable:!0,get:function(){return s.SessionReplayClient}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:s.SessionReplayClient,SessionReplay:n.SessionReplay,runStatsigSessionReplay:n.runStatsigSessionReplay,StatsigSessionReplayPlugin:n.StatsigSessionReplayPlugin})},4535:(t,e,i)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=i(6914),n=i(6325),s=i(6901);function r(t){return new o(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){r(t)}},e.runStatsigAutoCapture=r;class o{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.In={},this.Si=null;var{sdkKey:t,errorBoundary:e,values:i}=t.getContext(),i=(this.In=null!=(i=null==(i=null==i?void 0:i.auto_capture_settings)?void 0:i.disabled_events)?i:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,i=(0,c.Jt)();e&&i&&(t=t=>{this.Ze(t||e.event)},(0,n.ti)(i,"click",t),(0,n.ti)(i,"submit",t),(0,n.ti)(e,"error",t),(0,n.ti)(e,"beforeunload",()=>this.ei()),(0,n.ti)(e,"scroll",()=>this.ii()))}Oi(){var t=(0,c.Lt)(),e=(0,c.Jt)();t&&e&&((0,n.ti)(t,"popstate",()=>this.ji()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,s])=>{t.apply(e,[i,n,s]),this.ji()}}),this.ji())}Ze(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.ni(t):(e=(0,n.si)(t))&&(0,n.dt)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,n.ri)(e),this.oi(i,t,e))}Qe(){this.Xe(),this.Oi(),this.ui(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,n.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}ji(){var t=(0,n.vi)(),e=this.Si;e&&t.href===e.href||(this.Si=t,e=(0,s.fi)(t),this.oi("page_view",(0,n.di)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}ai(){const i=(0,c.Lt)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.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),i.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,n.gi)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.oi("performance",(0,n.di)(),t)},1)}ei(){this.oi("page_view_end",(0,n.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,i,n){var s,r,o;if(!this.In[t]){var l=this.ci();try{var u=$P({sessionID:l.data.sessionID,page_url:null!=(o=null==(r=null==(s=(0,c.Lt)())?void 0:s.location)?void 0:r.href)?o:""},i),a=(null!=n&&n.addNewSessionMetadata&&(u.isNewSession=String(this.hi(l))),{eventName:"auto_capture::"+t,value:e,metadata:u});this.De.logEvent(a),null!=n&&n.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((i+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=o},6325:(t,e,i)=>{$Q(e),e.gi=e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const r=i(6914);function o(t){var e={};if(t){var i=null==t?void 0:t.dataset;if(i)for(const n in i)e["data-"+n]=i[n]||""}return e}function l(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,r.At)()||"",s=("form"===(i.tagName=e)&&(i.action=t.getAttribute("action"),i.method=null!=(s=t.getAttribute("method"))?s:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),l(t));return s&&(i.href=s.getAttribute("href")),"button"!==e&&!s||(i.content=(t.textContent||"").trim(),e=o(s||t),$P(i,e)),{value:n,metadata:i}},e.si=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.dt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(l(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,r.Lt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.di=function(){return(0,r.At)()||""},e.ti=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.gi=function(){var t=(0,r.Lt)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,i)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return n.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture,StatsigAutoCapturePlugin:n.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,i)=>{$Q(e),e.fi=void 0;const a=i(6914);e.fi=function(t){var e=(0,a.Jt)(),i=(0,a.Lt)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,s=(null==e?void 0:e.referrer)||"";let r=new URL("empty:");if(s)try{r=new URL(s||"empty:")}catch(t){}l=r,o=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(l),l=l.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:l},l=function(t){const i=t.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=i.get(t);e&&(n[t]=e)}),n}(t);const u={};return t.searchParams.forEach((t,e)=>{u[e]=t}),$P($P($P($P({},o),l),u),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:s,screen_width:(null==(o=null==i?void 0:i.screen)?void 0:o.width)||"unknown",screen_height:(null==(l=null==i?void 0:i.screen)?void 0:l.height)||"unknown",viewport_width:(null==i?void 0:i.innerWidth)||"unknown",viewport_height:(null==i?void 0:i.innerHeight)||"unknown"})}}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}s.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 o=s(3447),l=s(1964);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new o.SessionReplay(t),new l.AutoCapture(t)})}return t.default})());
8
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("rrwebRecord")):"function"==typeof define&&define.amd?define(["rrwebRecord"],e):"object"==typeof exports?exports.Statsig=e(require("rrwebRecord")):t.Statsig=e(t.rrwebRecord)}(this,u=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var i={3331:t=>{t.exports=u},1845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||l,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=l,e[s]=l,o[s]=l},2137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),o=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,l){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),this.G(e,s),s})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class n{constructor(){this.V={}}get(t,e){var t=this.V[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=l(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,l,e){var i=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o,tag:r}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),o=i(7512),l=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(9638),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),y=i(8962),m=i(7512),u=i(7410),n=i(308),a=i(5902),c=i(6830),h=i(4143),d=i(9122),S=i(2636),v=i(8e3),O=i(2397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return o(this,void 0,void 0,function*(){var t,e,i;return!!w(n)&&(e=this.Nn("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!w(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=g,s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,O.Ut)();try{var c,h,d,v={method:e,body:i,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:a},f=(u=s,(_=g).isInitialize&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),T(g,l,s,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var i=function(t,e){if(null!=t&&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"Unknown Error"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),_=(T(g,l,s,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,i,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!n||n<s||!j.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t,tag:S.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return o(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s,r){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=d.StableID.get(t),n=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var i,n,s=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var i=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:i})}};const w=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1);function T(t,e,i,n,s){t.isInitialize&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var a=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const c=i(8809),n=i(1406),o=i(7512),s=i(7410),l=i(4534);function u(t){for(const e in s.NetworkDefault)if(t.startsWith(s.NetworkDefault[e]))return!0;return!1}function h(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function d(t){return"statsig.network_fallback."+(0,n.h)(t)}function v(t,e){t=d(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function f(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.Di={},this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i,e=f(e);e&&(i=null==(i=this.Un)?void 0:i[e])&&(i.expiryTime=Date.now()+6048e5,v(t,$P($P({},this.Un),{[e]:i})))}getFallbackUrl(t,e){var i=f(e);if(!u(e)||!i)return null;let n=this.Un;null==n&&(n=null!=(r=function(t){t=d(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.Un=n);var s,r=n[i];return!r||Date.now()>(null!=(s=r.expiryTime)?s:0)?(delete n[i],this.Un=n,v(t,this.Un),null):(s=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),r.url?`https://${r.url}/`+s:null)}tryFetchUpdatedFallbackInfo(i,n,s,r){var o;return a(this,void 0,void 0,function*(){try{var t=f(n);if(!h(s,r)||!t)return!1;if(this.Di[t]&&Date.now()<this.Di[t])return!1;this.Di[t]=Date.now()+144e5;var e=yield this.Gn(t);return e?(this.Ii(i,t,e),!0):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Ii(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.Un)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.Un)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.Un=$P($P({},this.Un),{[e]:i}),v(t,this.Un)}Gn(l){var u;return a(this,void 0,void 0,function*(){var t=yield(0,c.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),i=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let n=null;for(const o of t){var[s,r]=o.split("=");if(r&&s===l){let t=r;if(r.endsWith("/")&&(t=r.slice(0,-1)),!e.has(r)&&t!==i){n=t;break}}}return n})}},e.Cn=u,e.Pn=h},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),r=i(7512),o=i(4534),l=i(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,l.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),s=i(7512),r=i(4534),o=i(8023),l={};function u(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=u(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const o=i(1845),l=i(5542),u=i(7770),a=i(7512),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new u.EventLogger(t,r,i,n),this.Wt=new l.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),i.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return u(n,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.te=(t,e)=>{return u(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",l=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",l=s.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},l)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.3";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(6634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:l(null==i?void 0:i.value)})}function l(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:l(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:l(i,n)})},e.ie=l},1812:(t,e)=>{$Q(e)},8578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(1406),s=i(7512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:r,u=l;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?r:l}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(7512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},2397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(6830);const n="foreground",s="background",r=[];let o=n,l=!1;e.Ot=()=>o===n,e.Ut=()=>l,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(l=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{l=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(1845);const r=i(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7023),e),s(i(7410),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(1098),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(9638),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},2016:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const v=i(6914),f=i(2018);function _(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,v.Lt)(),r=(0,v.Jt)();if(s&&r&&r.currentScript){var o=r.currentScript.getAttribute("src"),l=null==(t=s.location)?void 0:t.href;if(o&&l){var u=new URL(o,l).searchParams,a=null!=(i=_("sdkKey",u))?i:_("apiKey",u);if(a){var c={},h=_("proxy",u),d=(h&&(c.networkConfig={api:h}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const l=i(6914),u=i(7262);class n extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,l.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});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==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,y(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(6914),l=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new l.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=r.default,s(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__},8788:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.SessionReplay=e.runStatsigSessionReplay=e.StatsigSessionReplayPlugin=void 0;const s=i(6914),r=i(759);function o(t,e){new l(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){o(t,this.options)}},e.runStatsigSessionReplay=o;class l{constructor(t,e){this.De=t,this.p=e,this.ke=null,this.Ee=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.Wt=t,this.Wt.wrap(this),(0,s.Mt)()||((t=(0,s.o)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.Re=this.Ne(),this.Ce=new r.SessionReplayClient,this.De.$on("pre_shutdown",()=>this.Pe()),this.De.$on("values_updated",()=>{var t;return this.Ge(null==(t=this.p)?void 0:t.forceRecording)}),this.De.on("session_expired",()=>{this.Ce.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Ue("session_expired"),this.Re=this.Ne()}),this.Le(),this.Ge(null==(t=this.p)?void 0:t.forceRecording)}Le(){const i=this.De.getContext()["sdkKey"];(0,s.lt)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof l&&e.Ke(t)})}forceStartRecording(){this.Ge(!0)}Ke(t){"background"===t&&(this.Ue(),this.De.flush().catch(t=>{this.Wt.logError("SR::visibility",t)}))}Fe(t,e){this.ke=e,this.Ee.push(t),2048<JSON.stringify(this.Ee).length&&((0,s.Ot)()?this.qe():this.Ue())}Ge(t=!1){var e=this.De.getContext().values;t||!0===(null==e?void 0:e.can_record_session)?this.Ce.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Ce.record((t,e)=>this.Fe(t,e),null!=(e=null==(t=this.p)?void 0:t.rrwebConfig)?e:{})):this.Pe()}Pe(){this.Ce.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.Ee.length&&null!=this.ke&&this.qe()}Ue(e){0!==this.Ee.length&&null!=this.ke&&(e=(0,s.Ut)()?"is_leaving_page":e,this.Re.then(t=>this.ze(t,e)).catch(t=>{this.Wt.logError("SR::flush",t)}))}ze(t,e){var i,n=this.ke;null!==n&&0!==this.Ee.length&&(i=JSON.stringify(this.Ee),t={eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:i,rrweb_payload_size:String(i.length),session_replay_sdk_version:s.SDK_VERSION}},e&&(t.metadata[e]="true"),this.De.logEvent(t),this.Ee=[])}qe(){this.Re=this.Ne(),this.Ue()}Ne(){return n(this,void 0,void 0,function*(){return this.De.getContext().session.data.sessionID})}}e.SessionReplay=l},759:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(3331),s=i(6914);e.SessionReplayClient=class{constructor(){this.Je=null,this.Ve=null,this.Be=0}record(i,t,e){null==(0,s.Jt)()||(this.Je=null,this.Ve=null,this.Be=0,this.$e=e,this.He)||(this.He=(e=t=>{var e;null==this.Je&&(this.Je=t.timestamp),this.Ve=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.Be++,i(t,{startTime:this.Je,endTime:this.Ve,clickCount:this.Be}),144e5<this.Ve-this.Je&&(null!=(e=this.He)&&e.call(this),this.$e)&&this.$e()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.He&&(this.He(),this.He=void 0)}isRecording(){return null!=this.He}}},3447:(t,e,i)=>{$Q(e),e.StatsigSessionReplayPlugin=e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(8788),s=($Q2(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),$Q2(e,"StatsigSessionReplayPlugin",{enumerable:!0,get:function(){return n.StatsigSessionReplayPlugin}}),$Q2(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(759));$Q2(e,"SessionReplayClient",{enumerable:!0,get:function(){return s.SessionReplayClient}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:s.SessionReplayClient,SessionReplay:n.SessionReplay,runStatsigSessionReplay:n.runStatsigSessionReplay,StatsigSessionReplayPlugin:n.StatsigSessionReplayPlugin})},4535:(t,e,i)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=i(6914),n=i(6325),s=i(6901);function r(t){return new o(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){r(t)}},e.runStatsigAutoCapture=r;class o{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.In={},this.Si=null;var{sdkKey:t,errorBoundary:e,values:i}=t.getContext(),i=(this.In=null!=(i=null==(i=null==i?void 0:i.auto_capture_settings)?void 0:i.disabled_events)?i:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,i=(0,c.Jt)();e&&i&&(t=t=>{this.Ze(t||e.event)},(0,n.ti)(i,"click",t),(0,n.ti)(i,"submit",t),(0,n.ti)(e,"error",t),(0,n.ti)(e,"beforeunload",()=>this.ei()),(0,n.ti)(e,"scroll",()=>this.ii()))}Oi(){var t=(0,c.Lt)(),e=(0,c.Jt)();t&&e&&((0,n.ti)(t,"popstate",()=>this.ji()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,s])=>{t.apply(e,[i,n,s]),this.ji()}}),this.ji())}Ze(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.ni(t):(e=(0,n.si)(t))&&(0,n.dt)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,n.ri)(e),this.oi(i,t,e))}Qe(){this.Xe(),this.Oi(),this.ui(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,n.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}ji(){var t=(0,n.vi)(),e=this.Si;e&&t.href===e.href||(this.Si=t,e=(0,s.fi)(t),this.oi("page_view",(0,n.di)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}ai(){const i=(0,c.Lt)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.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),i.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,n.gi)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.oi("performance",(0,n.di)(),t)},1)}ei(){this.oi("page_view_end",(0,n.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,i,n){var s,r,o;if(!this.In[t]){var l=this.ci();try{var u=$P({sessionID:l.data.sessionID,page_url:null!=(o=null==(r=null==(s=(0,c.Lt)())?void 0:s.location)?void 0:r.href)?o:""},i),a=(null!=n&&n.addNewSessionMetadata&&(u.isNewSession=String(this.hi(l))),{eventName:"auto_capture::"+t,value:e,metadata:u});this.De.logEvent(a),null!=n&&n.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((i+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=o},6325:(t,e,i)=>{$Q(e),e.gi=e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const r=i(6914);function o(t){var e={};if(t){var i=null==t?void 0:t.dataset;if(i)for(const n in i)e["data-"+n]=i[n]||""}return e}function l(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,r.At)()||"",s=("form"===(i.tagName=e)&&(i.action=t.getAttribute("action"),i.method=null!=(s=t.getAttribute("method"))?s:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),l(t));return s&&(i.href=s.getAttribute("href")),"button"!==e&&!s||(i.content=(t.textContent||"").trim(),e=o(s||t),$P(i,e)),{value:n,metadata:i}},e.si=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.dt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(l(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,r.Lt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.di=function(){return(0,r.At)()||""},e.ti=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.gi=function(){var t=(0,r.Lt)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,i)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return n.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture,StatsigAutoCapturePlugin:n.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,i)=>{$Q(e),e.fi=void 0;const a=i(6914);e.fi=function(t){var e=(0,a.Jt)(),i=(0,a.Lt)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,s=(null==e?void 0:e.referrer)||"";let r=new URL("empty:");if(s)try{r=new URL(s||"empty:")}catch(t){}l=r,o=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(l),l=l.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:l},l=function(t){const i=t.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=i.get(t);e&&(n[t]=e)}),n}(t);const u={};return t.searchParams.forEach((t,e)=>{u[e]=t}),$P($P($P($P({},o),l),u),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:s,screen_width:(null==(o=null==i?void 0:i.screen)?void 0:o.width)||"unknown",screen_height:(null==(l=null==i?void 0:i.screen)?void 0:l.height)||"unknown",viewport_width:(null==i?void 0:i.innerWidth)||"unknown",viewport_height:(null==i?void 0:i.innerHeight)||"unknown"})}}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}s.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 o=s(3447),l=s(1964);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new o.SessionReplay(t),new l.AutoCapture(t)})}return t.default})());
@@ -0,0 +1,8 @@
1
+ var rrwebRecord=function(){"use strict";var L;(function(e){e[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"})(L||(L={}));function zt(e){return e.nodeType===e.ELEMENT_NODE}function de(e){const t=e?.host;return Boolean(t?.shadowRoot===e)}function ue(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Bt(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Ht(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function ge(e){try{const t=e.rules||e.cssRules;return t?Bt(Array.from(t,Ge).join("")):null}catch{return null}}function Ge(e){let t;if(Gt(e))try{t=ge(e.styleSheet)||Ht(e)}catch{}else if(qt(e)&&e.selectorText.includes(":"))return Vt(e.cssText);return t||e.cssText}function Vt(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Gt(e){return"styleSheet"in e}function qt(e){return"selectorText"in e}class qe{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){var r;if(!t)return-1;const n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){const n=this.getNode(t);if(n){const o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Xt(){return new qe}function De({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:a}){let l=o||"";const i=n&&K(n);return(t[r.toLowerCase()]||i&&t[i])&&(a?l=a(l,e):l="*".repeat(l.length)),l}function K(e){return e.toLowerCase()}const Xe="__rrweb_original__";function Yt(e){const t=e.getContext("2d");if(!t)return!0;const r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){const a=t.getImageData,l=Xe in a?a[Xe]:a;if(new Uint32Array(l.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(i=>i!==0))return!1}return!0}function Ae(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?K(t):null}function Ye(e,t){var r;let n;try{n=new URL(e,t??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,a=n.pathname.match(o);return(r=a?.[1])!==null&&r!==void 0?r:null}let Jt=1;const Kt=new RegExp("[^a-z0-9-_:]"),pe=-2;function Je(){return Jt++}function Qt(e){if(e instanceof HTMLFormElement)return"form";const t=K(e.tagName);return Kt.test(t)?"div":t}function Zt(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let re,Ke;const er=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,tr=/^(?:[a-z+]+:)?\/\//i,rr=/^www\..*/i,nr=/^(data:)([^,]*),(.*)/i;function Se(e,t){return(e||"").replace(er,(r,n,o,a,l,i)=>{const s=o||l||i,c=n||a||"";if(!s)return r;if(tr.test(s)||rr.test(s))return`url(${c}${s}${c})`;if(nr.test(s))return`url(${c}${s}${c})`;if(s[0]==="/")return`url(${c}${Zt(t)+s}${c})`;const d=t.split("/"),p=s.split("/");d.pop();for(const h of p)h!=="."&&(h===".."?d.pop():d.push(h));return`url(${c}${d.join("/")}${c})`})}const or=/^[^ \t\n\r\u000c]+/,sr=/^[, \t\n\r\u000c]+/;function ar(e,t){if(t.trim()==="")return t;let r=0;function n(a){let l;const i=a.exec(t.substring(r));return i?(l=i[0],r+=l.length,l):""}const o=[];for(;n(sr),!(r>=t.length);){let a=n(or);if(a.slice(-1)===",")a=be(e,a.substring(0,a.length-1)),o.push(a);else{let l="";a=be(e,a);let i=!1;for(;;){const s=t.charAt(r);if(s===""){o.push((a+l).trim());break}else if(i)s===")"&&(i=!1);else if(s===","){r+=1,o.push((a+l).trim());break}else s==="("&&(i=!0);l+=s,r+=1}}}return o.join(", ")}function be(e,t){if(!t||t.trim()==="")return t;const r=e.createElement("a");return r.href=t,r.href}function ir(e){return Boolean(e.tagName==="svg"||e.ownerSVGElement)}function Fe(){const e=document.createElement("a");return e.href="",e.href}function Qe(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?be(e,n):r==="srcset"?ar(e,n):r==="style"?Se(n,Fe()):t==="object"&&r==="data"?be(e,n):n)}function Ze(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function lr(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const o=e.classList[n];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function ve(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ve(e.parentNode,t,r):!1;for(let n=e.classList.length;n--;){const o=e.classList[n];if(t.test(o))return!0}return r?ve(e.parentNode,t,r):!1}function et(e,t,r,n){try{const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(o===null)return!1;if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(ve(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}}catch{}return!1}function cr(e,t,r){const n=e.contentWindow;if(!n)return;let o=!1,a;try{a=n.document.readyState}catch{return}if(a!=="complete"){const i=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),o=!0,t()});return}const l="about:blank";if(n.location.href!==l||e.src===l||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function dr(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;const a=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),n=!0,t()})}function ur(e,t){const{doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:l,inlineStylesheet:i,maskInputOptions:s={},maskTextFn:c,maskInputFn:d,dataURLOptions:p={},inlineImages:h,recordCanvas:m,keepIframeSrcFn:f,newlyAddedElement:u=!1}=t,y=pr(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:L.Document,childNodes:[],compatMode:e.compatMode}:{type:L.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:L.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return mr(e,{doc:r,blockClass:o,blockSelector:a,inlineStylesheet:i,maskInputOptions:s,maskInputFn:d,dataURLOptions:p,inlineImages:h,recordCanvas:m,keepIframeSrcFn:f,newlyAddedElement:u,rootId:y});case e.TEXT_NODE:return hr(e,{needsMask:l,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:L.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:L.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function pr(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return r===1?void 0:r}function hr(e,t){var r;const{needsMask:n,maskTextFn:o,rootId:a}=t,l=e.parentNode&&e.parentNode.tagName;let i=e.textContent;const s=l==="STYLE"?!0:void 0,c=l==="SCRIPT"?!0:void 0;if(s&&i){try{e.nextSibling||e.previousSibling||!((r=e.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(i=ge(e.parentNode.sheet))}catch(d){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${d}`,e)}i=Se(i,Fe())}return c&&(i="SCRIPT_PLACEHOLDER"),!s&&!c&&i&&n&&(i=o?o(i,e.parentElement):i.replace(/[\S]/g,"*")),{type:L.Text,textContent:i||"",isStyle:s,rootId:a}}function mr(e,t){const{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:a,maskInputOptions:l={},maskInputFn:i,dataURLOptions:s={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:p,newlyAddedElement:h=!1,rootId:m}=t,f=lr(e,n,o),u=Qt(e);let y={};const S=e.attributes.length;for(let g=0;g<S;g++){const v=e.attributes[g];Ze(u,v.name,v.value)||(y[v.name]=Qe(r,u,K(v.name),v.value))}if(u==="link"&&a){const g=Array.from(r.styleSheets).find(R=>R.href===e.href);let v=null;g&&(v=ge(g)),v&&(delete y.rel,delete y.href,y._cssText=Se(v,g.href))}if(u==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const g=ge(e.sheet);g&&(y._cssText=Se(g,Fe()))}if(u==="input"||u==="textarea"||u==="select"){const g=e.value,v=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=De({element:e,type:Ae(e),tagName:u,value:g,maskInputOptions:l,maskInputFn:i}):v&&(y.checked=v)}if(u==="option"&&(e.selected&&!l.select?y.selected=!0:delete y.selected),u==="canvas"&&d){if(e.__context==="2d")Yt(e)||(y.rr_dataURL=e.toDataURL(s.type,s.quality));else if(!("__context"in e)){const g=e.toDataURL(s.type,s.quality),v=document.createElement("canvas");v.width=e.width,v.height=e.height;const R=v.toDataURL(s.type,s.quality);g!==R&&(y.rr_dataURL=g)}}if(u==="img"&&c){re||(re=r.createElement("canvas"),Ke=re.getContext("2d"));const g=e,v=g.crossOrigin;g.crossOrigin="anonymous";const R=()=>{g.removeEventListener("load",R);try{re.width=g.naturalWidth,re.height=g.naturalHeight,Ke.drawImage(g,0,0),y.rr_dataURL=re.toDataURL(s.type,s.quality)}catch(D){console.warn(`Cannot inline img src=${g.currentSrc}! Error: ${D}`)}v?y.crossOrigin=v:g.removeAttribute("crossorigin")};g.complete&&g.naturalWidth!==0?R():g.addEventListener("load",R)}if((u==="audio"||u==="video")&&(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime),h||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),f){const{width:g,height:v}=e.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${v}px`}}u==="iframe"&&!p(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let b;try{customElements.get(u)&&(b=!0)}catch{}return{type:L.Element,tagName:u,attributes:y,childNodes:[],isSVG:ir(e)||void 0,needBlock:f,rootId:m,isCustom:b}}function O(e){return e==null?"":e.toLowerCase()}function fr(e,t){return!!(t.comment&&e.type===L.Comment||e.type===L.Element&&(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ye(e.attributes.href)==="js")||t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(O(e.attributes.name).match(/^msapplication-tile(image|color)$/)||O(e.attributes.name)==="application-name"||O(e.attributes.rel)==="icon"||O(e.attributes.rel)==="apple-touch-icon"||O(e.attributes.rel)==="shortcut icon"))||e.tagName==="meta"&&(t.headMetaDescKeywords&&O(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(O(e.attributes.property).match(/^(og|twitter|fb):/)||O(e.attributes.name).match(/^(og|twitter):/)||O(e.attributes.name)==="pinterest")||t.headMetaRobots&&(O(e.attributes.name)==="robots"||O(e.attributes.name)==="googlebot"||O(e.attributes.name)==="bingbot")||t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0||t.headMetaAuthorship&&(O(e.attributes.name)==="author"||O(e.attributes.name)==="generator"||O(e.attributes.name)==="framework"||O(e.attributes.name)==="publisher"||O(e.attributes.name)==="progid"||O(e.attributes.property).match(/^article:/)||O(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(O(e.attributes.name)==="google-site-verification"||O(e.attributes.name)==="yandex-verification"||O(e.attributes.name)==="csrf-token"||O(e.attributes.name)==="p:domain_verify"||O(e.attributes.name)==="verify-v1"||O(e.attributes.name)==="verification"||O(e.attributes.name)==="shopify-checkout-api-token"))))}function ne(e,t){const{doc:r,mirror:n,blockClass:o,blockSelector:a,maskTextClass:l,maskTextSelector:i,skipChild:s=!1,inlineStylesheet:c=!0,maskInputOptions:d={},maskTextFn:p,maskInputFn:h,slimDOMOptions:m,dataURLOptions:f={},inlineImages:u=!1,recordCanvas:y=!1,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:g=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:D=()=>!1,newlyAddedElement:V=!1}=t;let{needsMask:U}=t,{preserveWhiteSpace:z=!0}=t;!U&&e.childNodes&&(U=et(e,l,i,U===void 0));const B=ur(e,{doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:U,inlineStylesheet:c,maskInputOptions:d,maskTextFn:p,maskInputFn:h,dataURLOptions:f,inlineImages:u,recordCanvas:y,keepIframeSrcFn:D,newlyAddedElement:V});if(!B)return console.warn(e,"not serialized"),null;let X;n.hasNode(e)?X=n.getId(e):fr(B,m)||!z&&B.type===L.Text&&!B.isStyle&&!B.textContent.replace(/^\s+|\s+$/gm,"").length?X=pe:X=Je();const k=Object.assign(B,{id:X});if(n.add(e,k),X===pe)return null;S&&S(e);let Z=!s;if(k.type===L.Element){Z=Z&&!k.needBlock,delete k.needBlock;const W=e.shadowRoot;W&&ue(W)&&(k.isShadowHost=!0)}if((k.type===L.Document||k.type===L.Element)&&Z){m.headWhitespace&&k.type===L.Element&&k.tagName==="head"&&(z=!1);const W={doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:U,maskTextClass:l,maskTextSelector:i,skipChild:s,inlineStylesheet:c,maskInputOptions:d,maskTextFn:p,maskInputFn:h,slimDOMOptions:m,dataURLOptions:f,inlineImages:u,recordCanvas:y,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:g,onStylesheetLoad:v,stylesheetLoadTimeout:R,keepIframeSrcFn:D};if(!(k.type===L.Element&&k.tagName==="textarea"&&k.attributes.value!==void 0))for(const J of Array.from(e.childNodes)){const G=ne(J,W);G&&k.childNodes.push(G)}if(zt(e)&&e.shadowRoot)for(const J of Array.from(e.shadowRoot.childNodes)){const G=ne(J,W);G&&(ue(e.shadowRoot)&&(G.isShadow=!0),k.childNodes.push(G))}}return e.parentNode&&de(e.parentNode)&&ue(e.parentNode)&&(k.isShadow=!0),k.type===L.Element&&k.tagName==="iframe"&&cr(e,()=>{const W=e.contentDocument;if(W&&b){const J=ne(W,{doc:W,mirror:n,blockClass:o,blockSelector:a,needsMask:U,maskTextClass:l,maskTextSelector:i,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:p,maskInputFn:h,slimDOMOptions:m,dataURLOptions:f,inlineImages:u,recordCanvas:y,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:g,onStylesheetLoad:v,stylesheetLoadTimeout:R,keepIframeSrcFn:D});J&&b(e,J)}},g),k.type===L.Element&&k.tagName==="link"&&typeof k.attributes.rel=="string"&&(k.attributes.rel==="stylesheet"||k.attributes.rel==="preload"&&typeof k.attributes.href=="string"&&Ye(k.attributes.href)==="css")&&dr(e,()=>{if(v){const W=ne(e,{doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:U,maskTextClass:l,maskTextSelector:i,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:p,maskInputFn:h,slimDOMOptions:m,dataURLOptions:f,inlineImages:u,recordCanvas:y,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:g,onStylesheetLoad:v,stylesheetLoadTimeout:R,keepIframeSrcFn:D});W&&v(e,W)}},R),k}function yr(e,t){const{mirror:r=new qe,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:a="rr-mask",maskTextSelector:l=null,inlineStylesheet:i=!0,inlineImages:s=!1,recordCanvas:c=!1,maskAllInputs:d=!1,maskTextFn:p,maskInputFn:h,slimDOM:m=!1,dataURLOptions:f,preserveWhiteSpace:u,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:R=()=>!1}=t||{};return ne(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:i,maskInputOptions:d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:d===!1?{password:!0}:d,maskTextFn:p,maskInputFn:h,slimDOMOptions:m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:m==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:m===!1?{}:m,dataURLOptions:f,inlineImages:s,recordCanvas:c,preserveWhiteSpace:u,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:R,newlyAddedElement:!1})}function A(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const oe=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`;let tt={map:{},getId(){return console.error(oe),-1},getNode(){return console.error(oe),null},removeNodeFromMap(){console.error(oe)},has(){return console.error(oe),!1},reset(){console.error(oe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(tt=new Proxy(tt,{get(e,t,r){return t==="map"&&console.error(oe),Reflect.get(e,t,r)}}));function he(e,t,r={}){let n=null,o=0;return function(...a){const l=Date.now();!o&&r.leading===!1&&(o=l);const i=t-(l-o),s=this;i<=0||i>t?(n&&(clearTimeout(n),n=null),o=l,e.apply(s,a)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(s,a)},i))}}function Ie(e,t,r,n,o=window){const a=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(l){setTimeout(()=>{r.set.call(this,l)},0),a&&a.set&&a.set.call(this,l)}}),()=>Ie(e,t,a||{},!0)}function se(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}let Me=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Me=()=>new Date().getTime());function rt(e){var t,r,n,o,a,l;const i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i?.documentElement.scrollLeft||((r=(t=i?.body)==null?void 0:t.parentElement)==null?void 0:r.scrollLeft)||((n=i?.body)==null?void 0:n.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:i?.documentElement.scrollTop||((a=(o=i?.body)==null?void 0:o.parentElement)==null?void 0:a.scrollTop)||((l=i?.body)==null?void 0:l.scrollTop)||0}}function nt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ot(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function st(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function F(e,t,r,n){if(!e)return!1;const o=st(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(ve(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function gr(e,t){return t.getId(e)!==-1}function _e(e,t){return t.getId(e)===pe}function at(e,t){if(de(e))return!1;const r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?at(e.parentNode,t):!0:!0}function Pe(e){return Boolean(e.changedTouches)}function Sr(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function it(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function lt(e,t){return Boolean(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function $e(e){return Boolean(e?.shadowRoot)}class br{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var r;return(r=this.styleIDMap.get(t))!=null?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,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 ct(e){var t,r;let n=null;return((r=(t=e.getRootNode)==null?void 0:t.call(e))==null?void 0:r.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(n=e.getRootNode().host),n}function vr(e){let t=e,r;for(;r=ct(t);)t=r;return t}function Ir(e){const t=e.ownerDocument;if(!t)return!1;const r=vr(e);return t.contains(r)}function dt(e){const t=e.ownerDocument;return t?t.contains(e)||Ir(e):!1}var C=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(C||{}),M=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(M||{}),P=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(P||{}),q=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(q||{}),ae=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ae||{}),ie=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ie||{}),Mr=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(Mr||{});function ut(e){return"__ln"in e}class wr{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&ut(t.previousSibling)){const n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&ut(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;!this.head||(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const pt=(e,t)=>`${e}@${t}`;class Cr{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)return;const t=[],r=new Set,n=new wr,o=s=>{let c=s,d=pe;for(;d===pe;)c=c&&c.nextSibling,d=c&&this.mirror.getId(c);return d},a=s=>{if(!s.parentNode||!dt(s)||s.parentNode.tagName==="TEXTAREA")return;const c=de(s.parentNode)?this.mirror.getId(ct(s)):this.mirror.getId(s.parentNode),d=o(s);if(c===-1||d===-1)return n.addNode(s);const p=ne(s,{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:h=>{it(h,this.mirror)&&this.iframeManager.addIframe(h),lt(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),$e(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(h,m)=>{this.iframeManager.attachIframe(h,m),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,m)=>{this.stylesheetManager.attachLinkElement(h,m)}});p&&(t.push({parentId:c,nextId:d,node:p}),r.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const s of this.movedSet)ht(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||a(s);for(const s of this.addedSet)!ft(this.droppedSet,s)&&!ht(this.removes,s,this.mirror)||ft(this.movedSet,s)?a(s):this.droppedSet.add(s);let l=null;for(;n.length;){let s=null;if(l){const c=this.mirror.getId(l.value.parentNode),d=o(l.value);c!==-1&&d!==-1&&(s=l)}if(!s){let c=n.tail;for(;c;){const d=c;if(c=c.previous,d){const p=this.mirror.getId(d.value.parentNode);if(o(d.value)===-1)continue;if(p!==-1){s=d;break}else{const h=d.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const m=h.parentNode.host;if(this.mirror.getId(m)!==-1){s=d;break}}}}}}if(!s){for(;n.head;)n.removeNode(n.head.value);break}l=s.previous,n.removeNode(s.value),a(s.value)}const i={texts:this.texts.map(s=>{const c=s.node;return c.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c.parentNode),{id:this.mirror.getId(c),value:s.value}}).filter(s=>!r.has(s.id)).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>{const{attributes:c}=s;if(typeof c.style=="string"){const d=JSON.stringify(s.styleDiff),p=JSON.stringify(s._unchangedStyles);d.length<c.style.length&&(d+p).split("var(").length===c.style.split("var(").length&&(c.style=s.styleDiff)}return{id:this.mirror.getId(s.node),attributes:c}}).filter(s=>!r.has(s.id)).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:t};!i.texts.length&&!i.attributes.length&&!i.removes.length&&!i.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(i))},this.genTextAreaValueMutation=t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r)),r.attributes.value=Array.from(t.childNodes,n=>n.textContent||"").join("")},this.processMutation=t=>{if(!_e(t.target,this.mirror))switch(t.type){case"characterData":{const r=t.target.textContent;!F(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:et(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,st(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let n=t.attributeName,o=t.target.getAttribute(n);if(n==="value"){const l=Ae(r);o=De({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:l,value:o,maskInputFn:this.maskInputFn})}if(F(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Ze(r.tagName,n)&&(a.attributes[n]=Qe(this.doc,K(r.tagName),K(n),o),n==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const l=this.unattachedDoc.createElement("span");t.oldValue&&l.setAttribute("style",t.oldValue);for(const i of Array.from(r.style)){const s=r.style.getPropertyValue(i),c=r.style.getPropertyPriority(i);s!==l.style.getPropertyValue(i)||c!==l.style.getPropertyPriority(i)?c===""?a.styleDiff[i]=s:a.styleDiff[i]=[s,c]:a._unchangedStyles[i]=[s,c]}for(const i of Array.from(l.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}break}case"childList":{if(F(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const n=this.mirror.getId(r),o=de(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);F(t.target,this.blockClass,this.blockSelector,!1)||_e(r,this.mirror)||!gr(r,this.mirror)||(this.addedSet.has(r)?(We(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||at(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[pt(n,o)]?We(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:de(t.target)&&ue(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(_e(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[pt(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);F(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(n=>this.genAdds(n)),$e(t)&&t.shadowRoot.childNodes.forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 We(e,t){e.delete(t),t.childNodes.forEach(r=>We(e,r))}function ht(e,t,r){return e.length===0?!1:mt(e,t,r)}function mt(e,t,r){const{parentNode:n}=t;if(!n)return!1;const o=r.getId(n);return e.some(a=>a.id===o)?!0:mt(e,n,r)}function ft(e,t){return e.size===0?!1:yt(e,t)}function yt(e,t){const{parentNode:r}=t;return r?e.has(r)?!0:yt(e,r):!1}let me;function kr(e){me=e}function Or(){me=void 0}const w=e=>me?(...t)=>{try{return e(...t)}catch(r){if(me&&me(r)===!0)return;throw r}}:e;var Tr=Object.defineProperty,Er=Object.defineProperties,Rr=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,St=(e,t,r)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bt=(e,t)=>{for(var r in t||(t={}))xr.call(t,r)&&St(e,r,t[r]);if(gt)for(var r of gt(t))Lr.call(t,r)&&St(e,r,t[r]);return e},Nr=(e,t)=>Er(e,Rr(t));const Q=[];function fe(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function vt(e,t){var r,n;const o=new Cr;Q.push(o),o.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const l=(n=(r=window?.Zone)==null?void 0:r.__symbol__)==null?void 0:n.call(r,"MutationObserver");l&&window[l]&&(a=window[l]);const i=new a(w(o.processMutations.bind(o)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Dr({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};const o=typeof t.mousemove=="number"?t.mousemove:50,a=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let l=[],i;const s=he(w(p=>{const h=Date.now()-i;e(l.map(m=>(m.timeOffset-=h,m)),p),l=[],i=null}),a),c=w(he(w(p=>{const h=fe(p),{clientX:m,clientY:f}=Pe(p)?p.changedTouches[0]:p;i||(i=Me()),l.push({x:m,y:f,id:n.getId(h),timeOffset:Me()-i}),s(typeof DragEvent<"u"&&p instanceof DragEvent?M.Drag:p instanceof MouseEvent?M.MouseMove:M.TouchMove)}),o,{trailing:!1})),d=[A("mousemove",c,r),A("touchmove",c,r),A("drag",c,r)];return w(()=>{d.forEach(p=>p())})}function Ar({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const l=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,i=[];let s=null;const c=d=>p=>{const h=fe(p);if(F(h,n,o,!0))return;let m=null,f=d;if("pointerType"in p){switch(p.pointerType){case"mouse":m=q.Mouse;break;case"touch":m=q.Touch;break;case"pen":m=q.Pen;break}m===q.Touch?P[d]===P.MouseDown?f="TouchStart":P[d]===P.MouseUp&&(f="TouchEnd"):q.Pen}else Pe(p)&&(m=q.Touch);m!==null?(s=m,(f.startsWith("Touch")&&m===q.Touch||f.startsWith("Mouse")&&m===q.Mouse)&&(m=null)):P[d]===P.Click&&(m=s,s=null);const u=Pe(p)?p.changedTouches[0]:p;if(!u)return;const y=r.getId(h),{clientX:S,clientY:b}=u;w(e)(bt({type:P[f],id:y,x:S,y:b},m!==null&&{pointerType:m}))};return Object.keys(P).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&l[d]!==!1).forEach(d=>{let p=K(d);const h=c(d);if(window.PointerEvent)switch(P[d]){case P.MouseDown:case P.MouseUp:p=p.replace("mouse","pointer");break;case P.TouchStart:case P.TouchEnd:return}i.push(A(p,h,t))}),w(()=>{i.forEach(d=>d())})}function It({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:a}){const l=w(he(w(i=>{const s=fe(i);if(!s||F(s,n,o,!0))return;const c=r.getId(s);if(s===t&&t.defaultView){const d=rt(t.defaultView);e({id:c,x:d.left,y:d.top})}else e({id:c,x:s.scrollLeft,y:s.scrollTop})}),a.scroll||100));return A("scroll",l,t)}function Fr({viewportResizeCb:e},{win:t}){let r=-1,n=-1;const o=w(he(w(()=>{const a=nt(),l=ot();(r!==a||n!==l)&&(e({width:Number(l),height:Number(a)}),r=a,n=l)}),200));return A("resize",o,t)}const _r=["INPUT","TEXTAREA","SELECT"],Mt=new WeakMap;function Pr({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:a,ignoreSelector:l,maskInputOptions:i,maskInputFn:s,sampling:c,userTriggeredOnInput:d}){function p(S){let b=fe(S);const g=S.isTrusted,v=b&&b.tagName;if(b&&v==="OPTION"&&(b=b.parentElement),!b||!v||_r.indexOf(v)<0||F(b,n,o,!0)||b.classList.contains(a)||l&&b.matches(l))return;let R=b.value,D=!1;const V=Ae(b)||"";V==="radio"||V==="checkbox"?D=b.checked:(i[v.toLowerCase()]||i[V])&&(R=De({element:b,maskInputOptions:i,tagName:v,type:V,value:R,maskInputFn:s})),h(b,d?{text:R,isChecked:D,userTriggered:g}:{text:R,isChecked:D});const U=b.name;V==="radio"&&U&&D&&t.querySelectorAll(`input[type="radio"][name="${U}"]`).forEach(z=>{if(z!==b){const B=z.value;h(z,d?{text:B,isChecked:!D,userTriggered:!1}:{text:B,isChecked:!D})}})}function h(S,b){const g=Mt.get(S);if(!g||g.text!==b.text||g.isChecked!==b.isChecked){Mt.set(S,b);const v=r.getId(S);w(e)(Nr(bt({},b),{id:v}))}}const m=(c.input==="last"?["change"]:["input","change"]).map(S=>A(S,w(p),t)),f=t.defaultView;if(!f)return()=>{m.forEach(S=>S())};const u=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),y=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return u&&u.set&&m.push(...y.map(S=>Ie(S[0],S[1],{set(){w(p)({target:this,isTrusted:!1})}},!1,f))),w(()=>{m.forEach(S=>S())})}function we(e){const t=[];function r(n,o){if(Ce("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ce("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ce("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ce("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a)}else if(n.parentStyleSheet){const a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a)}return o}return r(e,t)}function Y(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function $r({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:w((d,p,h)=>{const[m,f]=h,{id:u,styleId:y}=Y(p,t,r.styleMirror);return(u&&u!==-1||y&&y!==-1)&&e({id:u,styleId:y,adds:[{rule:m,index:f}]}),d.apply(p,h)})});const a=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:w((d,p,h)=>{const[m]=h,{id:f,styleId:u}=Y(p,t,r.styleMirror);return(f&&f!==-1||u&&u!==-1)&&e({id:f,styleId:u,removes:[{index:m}]}),d.apply(p,h)})});let l;n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:w((d,p,h)=>{const[m]=h,{id:f,styleId:u}=Y(p,t,r.styleMirror);return(f&&f!==-1||u&&u!==-1)&&e({id:f,styleId:u,replace:m}),d.apply(p,h)})}));let i;n.CSSStyleSheet.prototype.replaceSync&&(i=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(i,{apply:w((d,p,h)=>{const[m]=h,{id:f,styleId:u}=Y(p,t,r.styleMirror);return(f&&f!==-1||u&&u!==-1)&&e({id:f,styleId:u,replaceSync:m}),d.apply(p,h)})}));const s={};ke("CSSGroupingRule")?s.CSSGroupingRule=n.CSSGroupingRule:(ke("CSSMediaRule")&&(s.CSSMediaRule=n.CSSMediaRule),ke("CSSConditionRule")&&(s.CSSConditionRule=n.CSSConditionRule),ke("CSSSupportsRule")&&(s.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(s).forEach(([d,p])=>{c[d]={insertRule:p.prototype.insertRule,deleteRule:p.prototype.deleteRule},p.prototype.insertRule=new Proxy(c[d].insertRule,{apply:w((h,m,f)=>{const[u,y]=f,{id:S,styleId:b}=Y(m.parentStyleSheet,t,r.styleMirror);return(S&&S!==-1||b&&b!==-1)&&e({id:S,styleId:b,adds:[{rule:u,index:[...we(m),y||0]}]}),h.apply(m,f)})}),p.prototype.deleteRule=new Proxy(c[d].deleteRule,{apply:w((h,m,f)=>{const[u]=f,{id:y,styleId:S}=Y(m.parentStyleSheet,t,r.styleMirror);return(y&&y!==-1||S&&S!==-1)&&e({id:y,styleId:S,removes:[{index:[...we(m),u]}]}),h.apply(m,f)})})}),w(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=a,l&&(n.CSSStyleSheet.prototype.replace=l),i&&(n.CSSStyleSheet.prototype.replaceSync=i),Object.entries(s).forEach(([d,p])=>{p.prototype.insertRule=c[d].insertRule,p.prototype.deleteRule=c[d].deleteRule})})}function wt({mirror:e,stylesheetManager:t},r){var n,o,a;let l=null;r.nodeName==="#document"?l=e.getId(r):l=e.getId(r.host);const i=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(a=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:a.ShadowRoot,s=i!=null&&i.prototype?Object.getOwnPropertyDescriptor(i?.prototype,"adoptedStyleSheets"):void 0;return l===null||l===-1||!i||!s?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){var c;return(c=s.get)==null?void 0:c.call(this)},set(c){var d;const p=(d=s.set)==null?void 0:d.call(this,c);if(l!==null&&l!==-1)try{t.adoptStyleSheets(c,l)}catch{}return p}}),w(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function Wr({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){const a=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:w((i,s,c)=>{var d;const[p,h,m]=c;if(r.has(p))return a.apply(s,[p,h,m]);const{id:f,styleId:u}=Y((d=s.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||u&&u!==-1)&&e({id:f,styleId:u,set:{property:p,value:h,priority:m},index:we(s.parentRule)}),i.apply(s,c)})});const l=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:w((i,s,c)=>{var d;const[p]=c;if(r.has(p))return l.apply(s,[p]);const{id:h,styleId:m}=Y((d=s.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,remove:{property:p},index:we(s.parentRule)}),i.apply(s,c)})}),w(()=>{o.CSSStyleDeclaration.prototype.setProperty=a,o.CSSStyleDeclaration.prototype.removeProperty=l})}function Ur({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:a}){const l=w(s=>he(w(c=>{const d=fe(c);if(!d||F(d,t,r,!0))return;const{currentTime:p,volume:h,muted:m,playbackRate:f}=d;e({type:s,id:n.getId(d),currentTime:p,volume:h,muted:m,playbackRate:f})}),o.media||500)),i=[A("play",l(ie.Play),a),A("pause",l(ie.Pause),a),A("seeked",l(ie.Seeked),a),A("volumechange",l(ie.VolumeChange),a),A("ratechange",l(ie.RateChange),a)];return w(()=>{i.forEach(s=>s())})}function jr({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],o=new WeakMap,a=r.FontFace;r.FontFace=function(i,s,c){const d=new a(i,s,c);return o.set(d,{family:i,buffer:typeof s!="string",descriptors:c,fontSource:typeof s=="string"?s:JSON.stringify(Array.from(new Uint8Array(s)))}),d};const l=se(t.fonts,"add",function(i){return function(s){return setTimeout(w(()=>{const c=o.get(s);c&&(e(c),o.delete(s))}),0),i.apply(this,[s])}});return n.push(()=>{r.FontFace=a}),n.push(l),w(()=>{n.forEach(i=>i())})}function zr(e){const{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:a}=e;let l=!0;const i=w(()=>{const s=t.getSelection();if(!s||l&&s?.isCollapsed)return;l=s.isCollapsed||!1;const c=[],d=s.rangeCount||0;for(let p=0;p<d;p++){const h=s.getRangeAt(p),{startContainer:m,startOffset:f,endContainer:u,endOffset:y}=h;F(m,n,o,!0)||F(u,n,o,!0)||c.push({start:r.getId(m),startOffset:f,end:r.getId(u),endOffset:y})}a({ranges:c})});return i(),A("selectionchange",i)}function Br({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:se(r.customElements,"define",function(n){return function(o,a,l){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return n.apply(this,[o,a,l])}})}function Hr(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:a,viewportResizeCb:l,inputCb:i,mediaInteractionCb:s,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:p,fontCb:h,selectionCb:m,customElementCb:f}=e;e.mutationCb=(...u)=>{t.mutation&&t.mutation(...u),r(...u)},e.mousemoveCb=(...u)=>{t.mousemove&&t.mousemove(...u),n(...u)},e.mouseInteractionCb=(...u)=>{t.mouseInteraction&&t.mouseInteraction(...u),o(...u)},e.scrollCb=(...u)=>{t.scroll&&t.scroll(...u),a(...u)},e.viewportResizeCb=(...u)=>{t.viewportResize&&t.viewportResize(...u),l(...u)},e.inputCb=(...u)=>{t.input&&t.input(...u),i(...u)},e.mediaInteractionCb=(...u)=>{t.mediaInteaction&&t.mediaInteaction(...u),s(...u)},e.styleSheetRuleCb=(...u)=>{t.styleSheetRule&&t.styleSheetRule(...u),c(...u)},e.styleDeclarationCb=(...u)=>{t.styleDeclaration&&t.styleDeclaration(...u),d(...u)},e.canvasMutationCb=(...u)=>{t.canvasMutation&&t.canvasMutation(...u),p(...u)},e.fontCb=(...u)=>{t.font&&t.font(...u),h(...u)},e.selectionCb=(...u)=>{t.selection&&t.selection(...u),m(...u)},e.customElementCb=(...u)=>{t.customElement&&t.customElement(...u),f(...u)}}function Vr(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};Hr(e,t);let n;e.recordDOM&&(n=vt(e,e.doc));const o=Dr(e),a=Ar(e),l=It(e),i=Fr(e,{win:r}),s=Pr(e),c=Ur(e);let d=()=>{},p=()=>{},h=()=>{},m=()=>{};e.recordDOM&&(d=$r(e,{win:r}),p=wt(e,e.doc),h=Wr(e,{win:r}),e.collectFonts&&(m=jr(e)));const f=zr(e),u=Br(e),y=[];for(const S of e.plugins)y.push(S.observer(S.callback,r,S.options));return w(()=>{Q.forEach(S=>S.reset()),n?.disconnect(),o(),a(),l(),i(),s(),c(),d(),p(),h(),m(),f(),u(),y.forEach(S=>S())})}function Ce(e){return typeof window[e]<"u"}function ke(e){return Boolean(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Ct{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,r,n,o){const a=n||this.getIdToRemoteIdMap(t),l=o||this.getRemoteIdToIdMap(t);let i=a.get(r);return i||(i=this.generateIdFn(),a.set(r,i),l.set(i,r)),i}getIds(t,r){const n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(a=>this.getId(t,a,n,o))}getRemoteId(t,r,n){const o=n||this.getRemoteIdToIdMap(t);return typeof r!="number"?r:o.get(r)||-1}getRemoteIds(t,r){const n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Gr{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ct(Je),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ct(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,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const o=this.transformCrossOriginEvent(n,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case C.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:C.IncrementalSnapshot,data:{source:M.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case C.Meta:case C.Load:case C.DomContentLoaded:return!1;case C.Plugin:return r;case C.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case C.IncrementalSnapshot:switch(r.data.source){case M.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);const a=this.crossOriginIframeRootIdMap.get(t);a&&this.patchRootIdOnNode(o.node,a)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case M.Drag:case M.TouchMove:case M.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case M.ViewportResize:return!1;case M.MediaInteraction:case M.MouseInteraction:case M.Scroll:case M.CanvasMutation:case M.Input:return this.replaceIds(r.data,t,["id"]),r;case M.StyleSheetRule:case M.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case M.Font:return r;case M.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case M.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(const a of o)!Array.isArray(r[a])&&typeof r[a]!="number"||(Array.isArray(r[a])?r[a]=t.getIds(n,r[a]):r[a]=t.getId(n,r[a]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==L.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}}var qr=Object.defineProperty,Xr=Object.defineProperties,Yr=Object.getOwnPropertyDescriptors,kt=Object.getOwnPropertySymbols,Jr=Object.prototype.hasOwnProperty,Kr=Object.prototype.propertyIsEnumerable,Ot=(e,t,r)=>t in e?qr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Tt=(e,t)=>{for(var r in t||(t={}))Jr.call(t,r)&&Ot(e,r,t[r]);if(kt)for(var r of kt(t))Kr.call(t,r)&&Ot(e,r,t[r]);return e},Et=(e,t)=>Xr(e,Yr(t));class Qr{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,r){if(!ue(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const n=vt(Et(Tt({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(It(Et(Tt({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(wt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const n=this;this.restoreHandlers.push(se(t.prototype,"attachShadow",function(o){return function(a){const l=o.call(this,a);return this.shadowRoot&&dt(this)&&n.addShadowRoot(this.shadowRoot,r),l}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Oe=0;Oe<le.length;Oe++)Zr[le.charCodeAt(Oe)]=Oe;var en=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=le[t[r]>>2],o+=le[(t[r]&3)<<4|t[r+1]>>4],o+=le[(t[r+1]&15)<<2|t[r+2]>>6],o+=le[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const Rt=new Map;function tn(e,t){let r=Rt.get(e);return r||(r=new Map,Rt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const xt=(e,t,r)=>{if(!e||!(Nt(e,t)||typeof e=="object"))return;const n=e.constructor.name,o=tn(r,n);let a=o.indexOf(e);return a===-1&&(a=o.length,o.push(e)),a};function Te(e,t,r){if(e instanceof Array)return e.map(n=>Te(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const n=e.constructor.name,o=en(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Te(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){const n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Te(e.data,t,r),e.width,e.height]};if(Nt(e,t)||typeof e=="object"){const n=e.constructor.name,o=xt(e,t,r);return{rr_type:n,index:o}}}}return e}const Lt=(e,t,r)=>e.map(n=>Te(n,t,r)),Nt=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof t[n]=="function");return Boolean(r.find(n=>e instanceof t[n]))};function rn(e,t,r,n){const o=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const l of a)try{if(typeof t.CanvasRenderingContext2D.prototype[l]!="function")continue;const i=se(t.CanvasRenderingContext2D.prototype,l,function(s){return function(...c){return F(this.canvas,r,n,!0)||setTimeout(()=>{const d=Lt(c,t,this);e(this.canvas,{type:ae["2D"],property:l,args:d})},0),s.apply(this,c)}});o.push(i)}catch{const s=Ie(t.CanvasRenderingContext2D.prototype,l,{set(c){e(this.canvas,{type:ae["2D"],property:l,args:[c],setter:!0})}});o.push(s)}return()=>{o.forEach(l=>l())}}function nn(e){return e==="experimental-webgl"?"webgl":e}function Dt(e,t,r,n){const o=[];try{const a=se(e.HTMLCanvasElement.prototype,"getContext",function(l){return function(i,...s){if(!F(this,t,r,!0)){const c=nn(i);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(s[0]&&typeof s[0]=="object"){const d=s[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return l.apply(this,[i,...s])}});o.push(a)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(a=>a())}}function At(e,t,r,n,o,a,l){const i=[],s=Object.getOwnPropertyNames(e);for(const c of s)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof e[c]!="function")continue;const d=se(e,c,function(p){return function(...h){const m=p.apply(this,h);if(xt(m,l,this),"tagName"in this.canvas&&!F(this.canvas,n,o,!0)){const f=Lt(h,l,this),u={type:t,property:c,args:f};r(this.canvas,u)}return m}});i.push(d)}catch{const p=Ie(e,c,{set(h){r(this.canvas,{type:t,property:c,args:[h],setter:!0})}});i.push(p)}return i}function on(e,t,r,n,o){const a=[];return a.push(...At(t.WebGLRenderingContext.prototype,ae.WebGL,e,r,n,o,t)),typeof t.WebGL2RenderingContext<"u"&&a.push(...At(t.WebGL2RenderingContext.prototype,ae.WebGL2,e,r,n,o,t)),()=>{a.forEach(l=>l())}}function sn(e,t){var r=t===void 0?null:t,n=e.toString(),o=n.split(`
4
+ `);o.pop(),o.shift();for(var a=o[0].search(/\S/),l=/(['"])__worker_loader_strict__(['"])/g,i=0,s=o.length;i<s;++i)o[i]=o[i].substring(a).replace(l,"$1use strict$2")+`
5
+ `;return r&&o.push("//# sourceMappingURL="+r+`
6
+ `),o}function an(e,t){var r=sn(e,t),n=new Blob(r,{type:"application/javascript"});return URL.createObjectURL(n)}function ln(e,t){var r;return function(o){return r=r||an(e,t),new Worker(r,o)}}var cn=ln(function(){(function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256),r=0;r<e.length;r++)t[e.charCodeAt(r)]=r;var n=function(s){var c=new Uint8Array(s),d,p=c.length,h="";for(d=0;d<p;d+=3)h+=e[c[d]>>2],h+=e[(c[d]&3)<<4|c[d+1]>>4],h+=e[(c[d+1]&15)<<2|c[d+2]>>6],h+=e[c[d+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,a=new Map;async function l(s,c,d){const p=`${s}-${c}`;if("OffscreenCanvas"in globalThis){if(a.has(p))return a.get(p);const h=new OffscreenCanvas(s,c);h.getContext("2d");const m=await(await h.convertToBlob(d)).arrayBuffer(),f=n(m);return a.set(p,f),f}else return""}const i=self;i.onmessage=async function(s){if("OffscreenCanvas"in globalThis){const{id:c,bitmap:d,width:p,height:h,dataURLOptions:m}=s.data,f=l(p,h,m),u=new OffscreenCanvas(p,h);u.getContext("2d").drawImage(d,0,0),d.close();const y=await u.convertToBlob(m),S=y.type,b=await y.arrayBuffer(),g=n(b);if(!o.has(c)&&await f===g)return o.set(c,g),i.postMessage({id:c});if(o.get(c)===g)return i.postMessage({id:c});i.postMessage({id:c,type:S,base64:g,width:p,height:h}),o.set(c,g)}else return i.postMessage({id:s.data.id})}})()},null),Ft=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,pn=(e,t)=>{var r={};for(var n in e)dn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ft)for(var n of Ft(e))t.indexOf(n)<0&&un.call(e,n)&&(r[n]=e[n]);return r},hn=(e,t,r)=>new Promise((n,o)=>{var a=s=>{try{i(r.next(s))}catch(c){o(c)}},l=s=>{try{i(r.throw(s))}catch(c){o(c)}},i=s=>s.done?n(s.value):Promise.resolve(s.value).then(a,l);i((r=r.apply(e,t)).next())});class mn{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(s,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(c)};const{sampling:r="all",win:n,blockClass:o,blockSelector:a,recordCanvas:l,dataURLOptions:i}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,l&&r==="all"&&this.initCanvasMutationObserver(n,o,a),l&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,a,{dataURLOptions:i})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,o,a){const l=Dt(r,n,o,!0),i=new Map,s=new cn;s.onmessage=f=>{const{id:u}=f.data;if(i.set(u,!1),!("base64"in f.data))return;const{base64:y,type:S,width:b,height:g}=f.data;this.mutationCb({id:u,type:ae["2D"],commands:[{property:"clearRect",args:[0,0,b,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:S}]},0,0]}]})};const c=1e3/t;let d=0,p;const h=()=>{const f=[];return r.document.querySelectorAll("canvas").forEach(u=>{F(u,n,o,!0)||f.push(u)}),f},m=f=>{if(d&&f-d<c){p=requestAnimationFrame(m);return}d=f,h().forEach(u=>hn(this,null,function*(){var y;const S=this.mirror.getId(u);if(i.get(S))return;if(i.set(S,!0),["webgl","webgl2"].includes(u.__context)){const g=u.getContext(u.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(u);s.postMessage({id:S,bitmap:b,width:u.width,height:u.height,dataURLOptions:a.dataURLOptions},[b])})),p=requestAnimationFrame(m)};p=requestAnimationFrame(m),this.resetObservers=()=>{l(),cancelAnimationFrame(p)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Dt(t,r,n,!1),a=rn(this.processMutation.bind(this),t,r,n),l=on(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{o(),a(),l()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const o=n.map(l=>pn(l,["type"])),{type:a}=n[0];this.mutationCb({id:r,type:a,commands:o}),this.pendingCanvasMutations.delete(t)}}class fn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new br,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},o=[];for(const a of t){let l;this.styleMirror.has(a)?l=this.styleMirror.getId(a):(l=this.styleMirror.add(a),o.push({styleId:l,rules:Array.from(a.rules||CSSRule,(i,s)=>({rule:Ge(i),index:s}))})),n.styleIds.push(l)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class yn{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}var gn=Object.defineProperty,Sn=Object.defineProperties,bn=Object.getOwnPropertyDescriptors,_t=Object.getOwnPropertySymbols,vn=Object.prototype.hasOwnProperty,In=Object.prototype.propertyIsEnumerable,Pt=(e,t,r)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))vn.call(t,r)&&Pt(e,r,t[r]);if(_t)for(var r of _t(t))In.call(t,r)&&Pt(e,r,t[r]);return e},Mn=(e,t)=>Sn(e,bn(t));function N(e){return Mn($({},e),{timestamp:Me()})}let E,Ee,Ue,Re=!1;const j=Xt();function ye(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:p,maskInputOptions:h,slimDOMOptions:m,maskInputFn:f,maskTextFn:u,hooks:y,packFn:S,sampling:b={},dataURLOptions:g={},mousemoveWait:v,recordDOM:R=!0,recordCanvas:D=!1,recordCrossOriginIframes:V=!1,recordAfter:U=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:B=!1,inlineImages:X=!1,plugins:k,keepIframeSrcFn:Z=()=>!1,ignoreCSSAttributes:W=new Set([]),errorHandler:J}=e;kr(J);const G=V?window.parent===window:!0;let xe=!1;if(!G)try{window.parent.document&&(xe=!1)}catch{xe=!0}if(G&&!t)throw new Error("emit function is required");v!==void 0&&b.mousemove===void 0&&(b.mousemove=v),j.reset();const je=p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:h!==void 0?h:{password:!0},ze=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};Sr();let $t,Be=0;const Wt=I=>{for(const H of k||[])H.eventProcessor&&(I=H.eventProcessor(I));return S&&!xe&&(I=S(I)),I};E=(I,H)=>{var x;if(((x=Q[0])==null?void 0:x.isFrozen())&&I.type!==C.FullSnapshot&&!(I.type===C.IncrementalSnapshot&&I.data.source===M.Mutation)&&Q.forEach(_=>_.unfreeze()),G)t?.(Wt(I),H);else if(xe){const _={type:"rrweb",event:Wt(I),origin:window.location.origin,isCheckout:H};window.parent.postMessage(_,"*")}if(I.type===C.FullSnapshot)$t=I,Be=0;else if(I.type===C.IncrementalSnapshot){if(I.data.source===M.Mutation&&I.data.isAttachIframe)return;Be++;const _=n&&Be>=n,ce=r&&I.timestamp-$t.timestamp>r;(_||ce)&&Ee(!0)}};const Le=I=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.Mutation},I)}))},Ut=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Scroll},I)})),jt=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.CanvasMutation},I)})),wn=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.AdoptedStyleSheet},I)})),ee=new fn({mutationCb:Le,adoptedStyleSheetCb:wn}),te=new Gr({mirror:j,mutationCb:Le,stylesheetManager:ee,recordCrossOriginIframes:V,wrappedEmit:E});for(const I of k||[])I.getMirror&&I.getMirror({nodeMirror:j,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const He=new yn;Ue=new mn({recordCanvas:D,mutationCb:jt,win:window,blockClass:o,blockSelector:a,mirror:j,sampling:b.canvas,dataURLOptions:g});const Ne=new Qr({mutationCb:Le,scrollCb:Ut,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:s,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:je,dataURLOptions:g,maskTextFn:u,maskInputFn:f,recordCanvas:D,inlineImages:X,sampling:b,slimDOMOptions:ze,iframeManager:te,stylesheetManager:ee,canvasManager:Ue,keepIframeSrcFn:Z,processedNodeManager:He},mirror:j});Ee=(I=!1)=>{if(!R)return;E(N({type:C.Meta,data:{href:window.location.href,width:ot(),height:nt()}}),I),ee.reset(),Ne.init(),Q.forEach(x=>x.lock());const H=yr(document,{mirror:j,blockClass:o,blockSelector:a,maskTextClass:s,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:je,maskTextFn:u,slimDOM:ze,dataURLOptions:g,recordCanvas:D,inlineImages:X,onSerialize:x=>{it(x,j)&&te.addIframe(x),lt(x,j)&&ee.trackLinkElement(x),$e(x)&&Ne.addShadowRoot(x.shadowRoot,document)},onIframeLoad:(x,_)=>{te.attachIframe(x,_),Ne.observeAttachShadow(x)},onStylesheetLoad:(x,_)=>{ee.attachLinkElement(x,_)},keepIframeSrcFn:Z});if(!H)return console.warn("Failed to snapshot the document");E(N({type:C.FullSnapshot,data:{node:H,initialOffset:rt(window)}}),I),Q.forEach(x=>x.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,j.getId(document))};try{const I=[],H=_=>{var ce;return w(Vr)({mutationCb:Le,mousemoveCb:(T,Ve)=>E(N({type:C.IncrementalSnapshot,data:{source:Ve,positions:T}})),mouseInteractionCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.MouseInteraction},T)})),scrollCb:Ut,viewportResizeCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.ViewportResize},T)})),inputCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Input},T)})),mediaInteractionCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.MediaInteraction},T)})),styleSheetRuleCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.StyleSheetRule},T)})),styleDeclarationCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.StyleDeclaration},T)})),canvasMutationCb:jt,fontCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Font},T)})),selectionCb:T=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.Selection},T)}))},customElementCb:T=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.CustomElement},T)}))},blockClass:o,ignoreClass:l,ignoreSelector:i,maskTextClass:s,maskTextSelector:c,maskInputOptions:je,inlineStylesheet:d,sampling:b,recordDOM:R,recordCanvas:D,inlineImages:X,userTriggeredOnInput:z,collectFonts:B,doc:_,maskInputFn:f,maskTextFn:u,keepIframeSrcFn:Z,blockSelector:a,slimDOMOptions:ze,dataURLOptions:g,mirror:j,iframeManager:te,stylesheetManager:ee,shadowDomManager:Ne,processedNodeManager:He,canvasManager:Ue,ignoreCSSAttributes:W,plugins:((ce=k?.filter(T=>T.observer))==null?void 0:ce.map(T=>({observer:T.observer,options:T.options,callback:Ve=>E(N({type:C.Plugin,data:{plugin:T.name,payload:Ve}}))})))||[]},y)};te.addLoadListener(_=>{try{I.push(H(_.contentDocument))}catch(ce){console.warn(ce)}});const x=()=>{Ee(),I.push(H(document)),Re=!0};return document.readyState==="interactive"||document.readyState==="complete"?x():(I.push(A("DOMContentLoaded",()=>{E(N({type:C.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&x()})),I.push(A("load",()=>{E(N({type:C.Load,data:{}})),U==="load"&&x()},window))),()=>{I.forEach(_=>_()),He.destroy(),Re=!1,Or()}}catch(I){console.warn(I)}}return ye.addCustomEvent=(e,t)=>{if(!Re)throw new Error("please add custom event after start recording");E(N({type:C.Custom,data:{tag:e,payload:t}}))},ye.freezePage=()=>{Q.forEach(e=>e.freeze())},ye.takeFullSnapshot=e=>{if(!Re)throw new Error("please take full snapshot after start recording");Ee(e)},ye.mirror=j,ye}();
7
+
8
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("rrwebRecord")):"function"==typeof define&&define.amd?define(["rrwebRecord"],e):"object"==typeof exports?exports.Statsig=e(require("rrwebRecord")):t.Statsig=e(t.rrwebRecord)}(this,l=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var i={3331:t=>{t.exports=l},1845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||l,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=l,e[s]=l,o[s]=l},2137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),o=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,l){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),this.G(e,s),s})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class n{constructor(){this.V={}}get(t,e){var t=this.V[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=l(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,l,e){var i=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o,tag:r}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),o=i(7512),l=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(9638),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),y=i(8962),m=i(7512),u=i(7410),n=i(308),a=i(5902),c=i(6830),h=i(4143),d=i(9122),O=i(2636),v=i(8e3),S=i(2397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return o(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.Nn("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!T(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=g,s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,S.Ut)();try{var c,h,d,v={method:e,body:i,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:a},f=(u=s,(_=g).isInitialize&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),w(g,l,s,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var i=function(t,e){if(null!=t&&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"Unknown Error"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),_=(w(g,l,s,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,i,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!n||n<s||!j.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t,tag:O.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return o(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s,r){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=d.StableID.get(t),n=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var i,n,s=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var i=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:i})}};const T=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1);function w(t,e,i,n,s){t.isInitialize&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var a=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const c=i(8809),n=i(1406),o=i(7512),s=i(7410),l=i(4534);function u(t){for(const e in s.NetworkDefault)if(t.startsWith(s.NetworkDefault[e]))return!0;return!1}function h(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function d(t){return"statsig.network_fallback."+(0,n.h)(t)}function v(t,e){t=d(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function f(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.Di={},this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i,e=f(e);e&&(i=null==(i=this.Un)?void 0:i[e])&&(i.expiryTime=Date.now()+6048e5,v(t,$P($P({},this.Un),{[e]:i})))}getFallbackUrl(t,e){var i=f(e);if(!u(e)||!i)return null;let n=this.Un;null==n&&(n=null!=(r=function(t){t=d(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.Un=n);var s,r=n[i];return!r||Date.now()>(null!=(s=r.expiryTime)?s:0)?(delete n[i],this.Un=n,v(t,this.Un),null):(s=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),r.url?`https://${r.url}/`+s:null)}tryFetchUpdatedFallbackInfo(i,n,s,r){var o;return a(this,void 0,void 0,function*(){try{var t=f(n);if(!h(s,r)||!t)return!1;if(this.Di[t]&&Date.now()<this.Di[t])return!1;this.Di[t]=Date.now()+144e5;var e=yield this.Gn(t);return e?(this.Ii(i,t,e),!0):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Ii(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.Un)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.Un)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.Un=$P($P({},this.Un),{[e]:i}),v(t,this.Un)}Gn(l){var u;return a(this,void 0,void 0,function*(){var t=yield(0,c.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),i=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let n=null;for(const o of t){var[s,r]=o.split("=");if(r&&s===l){let t=r;if(r.endsWith("/")&&(t=r.slice(0,-1)),!e.has(r)&&t!==i){n=t;break}}}return n})}},e.Cn=u,e.Pn=h},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),r=i(7512),o=i(4534),l=i(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,l.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),s=i(7512),r=i(4534),o=i(8023),l={};function u(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=u(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const o=i(1845),l=i(5542),u=i(7770),a=i(7512),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new u.EventLogger(t,r,i,n),this.Wt=new l.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),i.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return u(n,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.te=(t,e)=>{return u(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",l=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",l=s.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},l)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.3";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(6634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:l(null==i?void 0:i.value)})}function l(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:l(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:l(i,n)})},e.ie=l},1812:(t,e)=>{$Q(e)},8578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(1406),s=i(7512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:r,u=l;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?r:l}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(7512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},2397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(6830);const n="foreground",s="background",r=[];let o=n,l=!1;e.Ot=()=>o===n,e.Ut=()=>l,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(l=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{l=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(1845);const r=i(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7023),e),s(i(7410),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(1098),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(9638),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},2016:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const v=i(6914),f=i(2018);function _(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,v.Lt)(),r=(0,v.Jt)();if(s&&r&&r.currentScript){var o=r.currentScript.getAttribute("src"),l=null==(t=s.location)?void 0:t.href;if(o&&l){var u=new URL(o,l).searchParams,a=null!=(i=_("sdkKey",u))?i:_("apiKey",u);if(a){var c={},h=_("proxy",u),d=(h&&(c.networkConfig={api:h}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const l=i(6914),u=i(7262);class n extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,l.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});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==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,y(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(6914),l=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new l.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=r.default,s(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__},8788:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.SessionReplay=e.runStatsigSessionReplay=e.StatsigSessionReplayPlugin=void 0;const s=i(6914),r=i(759);function o(t,e){new l(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){o(t,this.options)}},e.runStatsigSessionReplay=o;class l{constructor(t,e){this.De=t,this.p=e,this.ke=null,this.Ee=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.Wt=t,this.Wt.wrap(this),(0,s.Mt)()||((t=(0,s.o)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.Re=this.Ne(),this.Ce=new r.SessionReplayClient,this.De.$on("pre_shutdown",()=>this.Pe()),this.De.$on("values_updated",()=>{var t;return this.Ge(null==(t=this.p)?void 0:t.forceRecording)}),this.De.on("session_expired",()=>{this.Ce.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Ue("session_expired"),this.Re=this.Ne()}),this.Le(),this.Ge(null==(t=this.p)?void 0:t.forceRecording)}Le(){const i=this.De.getContext()["sdkKey"];(0,s.lt)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof l&&e.Ke(t)})}forceStartRecording(){this.Ge(!0)}Ke(t){"background"===t&&(this.Ue(),this.De.flush().catch(t=>{this.Wt.logError("SR::visibility",t)}))}Fe(t,e){this.ke=e,this.Ee.push(t),2048<JSON.stringify(this.Ee).length&&((0,s.Ot)()?this.qe():this.Ue())}Ge(t=!1){var e=this.De.getContext().values;t||!0===(null==e?void 0:e.can_record_session)?this.Ce.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Ce.record((t,e)=>this.Fe(t,e),null!=(e=null==(t=this.p)?void 0:t.rrwebConfig)?e:{})):this.Pe()}Pe(){this.Ce.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.Ee.length&&null!=this.ke&&this.qe()}Ue(e){0!==this.Ee.length&&null!=this.ke&&(e=(0,s.Ut)()?"is_leaving_page":e,this.Re.then(t=>this.ze(t,e)).catch(t=>{this.Wt.logError("SR::flush",t)}))}ze(t,e){var i,n=this.ke;null!==n&&0!==this.Ee.length&&(i=JSON.stringify(this.Ee),t={eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:i,rrweb_payload_size:String(i.length),session_replay_sdk_version:s.SDK_VERSION}},e&&(t.metadata[e]="true"),this.De.logEvent(t),this.Ee=[])}qe(){this.Re=this.Ne(),this.Ue()}Ne(){return n(this,void 0,void 0,function*(){return this.De.getContext().session.data.sessionID})}}e.SessionReplay=l},759:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(3331),s=i(6914);e.SessionReplayClient=class{constructor(){this.Je=null,this.Ve=null,this.Be=0}record(i,t,e){null==(0,s.Jt)()||(this.Je=null,this.Ve=null,this.Be=0,this.$e=e,this.He)||(this.He=(e=t=>{var e;null==this.Je&&(this.Je=t.timestamp),this.Ve=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.Be++,i(t,{startTime:this.Je,endTime:this.Ve,clickCount:this.Be}),144e5<this.Ve-this.Je&&(null!=(e=this.He)&&e.call(this),this.$e)&&this.$e()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.He&&(this.He(),this.He=void 0)}isRecording(){return null!=this.He}}},3447:(t,e,i)=>{$Q(e),e.StatsigSessionReplayPlugin=e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(8788),s=($Q2(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),$Q2(e,"StatsigSessionReplayPlugin",{enumerable:!0,get:function(){return n.StatsigSessionReplayPlugin}}),$Q2(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(759));$Q2(e,"SessionReplayClient",{enumerable:!0,get:function(){return s.SessionReplayClient}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:s.SessionReplayClient,SessionReplay:n.SessionReplay,runStatsigSessionReplay:n.runStatsigSessionReplay,StatsigSessionReplayPlugin:n.StatsigSessionReplayPlugin})}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}s.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 o=s(3447);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new o.SessionReplay(t)})}return t.default})());
@@ -1 +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 $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var n={1845:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||l,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(i=null!=(i=null!=(i=s[r])?i:e[r])?i:o[r])?i:{instance:n.t};s[r]=l,e[r]=l,o[r]=l},2137:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const r=n(1406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=n(7512),a=n(9122),s=n(8578),o=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,s.A)(t,this.p),e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,s.A)(e,this.p),n=this.T(e);this.j.add(n,h("Bootstrap",t,null,e))}M(e,n,i){return r(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.D(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.A)(n,this.p),e=this.T(t),t=yield this.M(null,t,i);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(s,o,l){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,o)&&(t=s.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=h("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,r),this.G(e,r),r})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=l(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},8962:(t,s)=>{$Q2(s,"__esModule",{value:!0}),s.Diagnostics=void 0;const i=new Map,n="start";function r(t,e,n,i){return $P({key:n,action:e,step:i,timestamp:Date.now()},t)}function o(t,e){var n=null!=(n=i.get(t))?n:[];n.push(e),i.set(t,n)}function e(t,e){if(e in t)return t[e]}s.Diagnostics={_n:t=>i.get(t),gn:t=>{o(t,r({},n,"overall"))},mn:(t,e,n)=>{o(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},bn:(t,e)=>{o(t,r(e,n,"initialize","network_request"))},pn:(t,e)=>{o(t,r(e,"end","initialize","network_request"))},yn:t=>{o(t,r({},n,"initialize","process"))},On:(t,e)=>{o(t,r(e,"end","initialize","process"))},jn:t=>{i.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,n,i){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===n.includes('"is_delta":true')||void 0,attempt:e,error:s.Diagnostics.Sn(i)}},Tn(t,e,n,i){var r=s.Diagnostics._n(n);null==r||r.length<=0||(s.Diagnostics.jn(n),n=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:i}),e.enqueue(n))}}},8809:function(t,e){var n=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const r=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),s="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return n(this,void 0,void 0,function*(){var n=yield e(s,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:r});if(n.ok){var t,n=yield n.arrayBuffer(),n=new Uint8Array(n);{var i=n,n=i.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(i[e-1])));if(-1===n)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=n-1;t<i.length;t++)e+=String.fromCharCode(i[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,l,e){var n=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const i=e(7512),u=e(5902),a=e(8e3),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(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)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.$.has(r)||(this.$.add(r),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.p)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(2137),s=n(1406),o=n(7512),l=n(7410),u=n(6830),a=n(1637),c=n(4534),h=n(9638),d=n(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,n,i){this.S=t,this.B=e,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;e=null==i?void 0:i.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return i(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.l)(this.S,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const n=this.u();i(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(n);t&&(e===f.Startup&&c.Storage.removeItem(n),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(n)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,s.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.xt=s.Dt=s.h=void 0;const o=e(6634);s.h=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)},s.Dt=(t,e)=>(0,s.h)(JSON.stringify((0,s.xt)(t,e)));s.xt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.kt)(e)?r[t]=e:r[t]=(0,s.xt)(e,null!=i?i-1:i)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function n(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...n(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...n(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...n(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...n(t))}}(e.Log=i).level=e.LogLevel.Warn},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const l=n(1845),m=n(8962),y=n(7512),u=n(7410),i=n(308),a=n(5902),c=n(6830),h=n(4143),d=n(9122),v=n(8e3),O=n(2397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new i.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return o(this,void 0,void 0,function*(){var t,e,n;return!!S(i)&&(e=this.Nn("POST",i),t=yield this.Nt(e,i.data),e=yield this.Gt(e),(n=navigator).sendBeacon.bind(n)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!S(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i,attempt:r}=g,r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,O.Ut)();try{var c,h,d,v={method:e,body:n,headers:$P({},g.headers),signal:null===s||void 0===s?void 0:s.signal,priority:g.priority,keepalive:a},f=(u=r,(_=g).isInitialize&&m.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),w(g,l,r,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var n=function(t,e){if(null!=t&&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"Unknown Error"}(s,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s),_=(w(g,l,r,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,n,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!i||i<r||!j.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Pt($P($P({},g),{retries:i,attempt:r+1}))}})}Gt(i){var r;return o(this,void 0,void 0,function*(){var t=null!=(r=i.fallbackUrl)?r:i.url;const e=$P({[u.NetworkParam.SdkKey]:i.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(i.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Nt(r,s){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,n=d.StableID.get(t),i=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var n,i,r=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==r||!r.btoa)return e;try{var s=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var n=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:n})}};const S=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1);function w(t,e,n,i,r){t.isInitialize&&m.Diagnostics.pn(t.sdkKey,m.Diagnostics.wn(e,n,i,r))}},308:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const a=n(8809),r=n(1406),o=n(7512),s=n(7410),l=n(4534);function u(t){for(const e in s.NetworkDefault)if(t.startsWith(s.NetworkDefault[e]))return!0;return!1}function v(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,r.h)(t)}function f(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function _(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var n,e=_(e);e&&(n=null==(n=this.Un)?void 0:n[e])&&(n.expiryTime=Date.now()+6048e5,f(t,$P($P({},this.Un),{[e]:n})))}getFallbackUrl(t,e){var n=_(e);if(!u(e)||!n)return null;let i=this.Un;null==i&&(i=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.Un=i);var r,s=i[n];return!s||Date.now()>(null!=(r=s.expiryTime)?r:0)?(delete i[n],this.Un=i,f(t,this.Un),null):(r=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),s.url?`https://${s.url}/`+r:null)}tryFetchUpdatedFallbackInfo(s,o,l,u){var a,c,h,d;return i(this,void 0,void 0,function*(){try{var t,e,n,i,r=_(o);return v(l,u)&&r?!!(t=yield this.Gn(r))&&(e={url:t,expiryTime:Date.now()+6048e5,previous:[]},(n=null==(a=this.Un)?void 0:a[r])&&e.previous.push(...n.previous),10<e.previous.length&&(e.previous=[]),null!=(i=null==(h=null==(c=this.Un)?void 0:c[r])?void 0:h.url)&&e.previous.push(i),this.Un=$P($P({},this.Un),{[r]:e}),f(s,this.Un),!0):!1}catch(t){return null!=(d=this.Wt)&&d.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Gn(l){var u;return i(this,void 0,void 0,function*(){var t=yield(0,a.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),n=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let i=null;for(const o of t){var[r,s]=o.split("=");if(s&&r===l){let t=s;if(s.endsWith("/")&&(t=s.slice(0,-1)),!e.has(s)&&t!==n){i=t;break}}}return i})}},e.Cn=u,e.Pn=v},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Kt(t,e){n[t]=e},Ft(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.qt=i.zt=i.Mt=i.Jt=i.Lt=void 0;i.Lt=()=>"undefined"!=typeof window?window:null,i.Jt=()=>{var t=(0,i.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.zt=(t,e)=>{var n=(0,i.Lt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.qt=(t,e)=>{var n=(0,i.Jt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(2137),s=n(7512),o=n(4534),l=n(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var n=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>u}(n)||function({startTime:t}){return Date.now()-t>a}(n))&&(n.sessionID=(0,l.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,o.J)(r,i)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=h(n,u),t.ageTimeoutID=h(n,a-e),t},overrideInitialSessionID:(t,e)=>{var n;c[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},9122:(t,e,n)=>{$Q(e),e.StableID=void 0;const i=n(2137),r=n(7512),s=n(4534),o=n(8023),l={};function u(t){return"statsig.stable_id."+(0,i.u)(t)}function a(t,e){e=u(e);try{(0,s.J)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,s.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const o=n(1845),l=n(5542),u=n(7770),a=n(7512),c=n(6830),h=n(4143),d=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Bt(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&d.Storage.de(i.storageProvider),this.S=t,this.p=null!=i?i:{},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Ht=new u.EventLogger(t,s,n,i),this.Wt=new l.ErrorBoundary(t,i,s),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),n.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.storageProvider=d.Storage,this.Yt(),r=t,s=this,(0,c.Mt)()||(n=(0,o.o)(),e=null!=(e=n.instances)?e:{},s=s,null!=e[r]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[r]=s,n.lastInstance=s,n.instances=e,__STATSIG__=n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Vt[n.name]&&this.Vt[n.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e)},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",u=(t,e,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.ee=(t,e)=>{return u(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.te=(t,e)=>{return u(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(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="",l=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",l=r.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},l)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.1";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const s=n(6634),r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},o(t,e,n,i)),{get:l(null==n?void 0:n.value)})}function l(i,r){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||(0,s.le)(n,e))?(null!=r&&r(t),n):null!=e?e:null}}e.ue=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:l(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:l(n,i)})},e.ie=l},1812:(t,e)=>{$Q(e)},8578:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(1406),r=n(7512);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(n.statsigEnvironment=e.environment),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,i.Dt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0;var i=e(7512),e=e(6830);const r={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>r[t]||null,setItem:(t,e)=>{r[t]=e},removeItem:t=>{delete r[t]},getAllKeys:()=>Object.keys(r)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:s,u=l;n.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.de(s),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?s:l}},n.F=function(t){return t=n.Storage.getItem(t),JSON.parse(null!=t?t:"null")},n.J=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.C=void 0;const r=n(7512);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(e)}},8023:(t,e)=>{$Q(e),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)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},2397:(t,e,n)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;n=n(6830);const i="foreground",r="background",s=[];let o=i,l=!1;e.Ot=()=>o===i,e.Ut=()=>l,e.lt=t=>{s.unshift(t)};e.ve=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(l=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(r)),(0,n.zt)("beforeunload",()=>{l=!0,(0,e.ve)(r)}),(0,n.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?i:r)})},6914: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]}}),$Q2(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)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,n(1845);const s=n(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=n(8e3);const a=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(n(1845),e),r(n(2137),e),r(n(6427),e),r(n(694),e),r(n(8962),e),r(n(3539),e),r(n(5542),e),r(n(2922),e),r(n(2417),e),r(n(1406),e),r(n(1333),e),r(n(7512),e),r(n(7023),e),r(n(7410),e),r(n(1405),e),r(n(1361),e),r(n(6830),e),r(n(5902),e),r(n(4143),e),r(n(9122),e),r(n(1375),e),r(n(2636),e),r(n(3206),e),r(n(1637),e),r(n(8e3),e),r(n(586),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(1098),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(9638),e),r(n(8023),e),r(n(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},2016:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const v=n(6914),f=n(2018);function _(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,v.Lt)(),s=(0,v.Jt)();if(r&&s&&s.currentScript){var o=s.currentScript.getAttribute("src"),l=null==(t=r.location)?void 0:t.href;if(o&&l){var u=new URL(o,l).searchParams,a=null!=(n=_("sdkKey",u))?n:_("apiKey",u);if(a){var c={},h=_("proxy",u),d=(h&&(c.networkConfig={api:h}),null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var n=(e="object"!=typeof e?{}:e).custom||{},i=e.customIDs||{};return $P($P({},e),{customIDs:$P({},i),custom:$P($P({},n),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(i=t.navigator)?void 0:i.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,n)=>{$Q(e),e.fe=void 0;const i=n(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},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.Dt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs},2))===e.checksumV2?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,n)=>{$Q(e);const r=n(6914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,r.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var n;return!!t&&null!=(n=(0,r.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==n?void 0:n.has_updates)&&(this._e=t.data,this.ye=n.time,this.me=t.receivedAt,this.ge=n,this.bi=this.pi(t.source,n),t.source)&&n.user&&this.yi(e,n),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let n=null;return{result:n=t?t[e]||t[(0,r.h)(e)]:n,details:this.Se(null==n)}}yi(t,e){var n,i=r.StableID.get(this.S);(null==(n=t.customIDs)?void 0:n.stableID)!==i?this.mi.add("StableIDMismatch"):"user"in e&&(n=e.user,(0,r.v)(t)!==(0,r.v)(n))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let n=e.reason;var i=null!=(i=e.warnings)?i:[],t=("Bootstrap"===this.be&&0<i.length&&(n+=i[0]),"Uninitialized"!==n&&"NoValues"!==n&&(n=n+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(i=this.bi)?i:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:n})}}},8448:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const l=n(6914),u=n(7262);class i extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,s){return o(this,void 0,void 0,function*(){var t=i?(0,l.C)(i,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(n,t,e,r)})}je(e,n,i,r){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:i,retries:2,isStatsigEncodable:!0,priority:r,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==i.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(n,t.body))?t:this.je(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},3583:(t,e,n)=>{$Q(e),e.Te=void 0;const g=n(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function m(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,m(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,m(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,i=e,r=_,m(s=(n=v).getLayer(o.layer_name,b).get(o.param_name),i)?i:(p(r)&&n.getLayer(o.layer_name).get(o.param_name),s);default:return e}}}},8198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const o=n(6914),l=n(4845),u=n(8448),s=n(3583),a=n(4131);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Kt(t,"javascript-client");var i,r=new u.default(n,t=>{this.$emt(t)}),r=(super(t,null!=(i=null==n?void 0:n.dataAdapter)?i:new a.StatsigEvaluationsDataAdapter,r,n),this.we=new l.default(t),this.Ie=(0,o.A)(e,n),null!=(i=null==n?void 0:n.plugins)?i:[]);for(const s of r)s.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Ae(n);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.we.getGate(t),i=(0,o.ue)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.ee)(this.Ie,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.oe)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.re)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.we.getLayer(e),i=(0,o.se)(e,i,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.Ie,n);const s=(0,o.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}getParameterStore(t,e){var{result:n,details:i}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,s.Te)(this,n,e)}}logEvent(t,e,n){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return r(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},4131:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(6914),r=n(8448);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,(0,i.A)(e,this.p),n)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.X)?void 0:r.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018: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]}}),$Q2(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)},s=($Q(e),e.StatsigClient=void 0,n(8198));e.StatsigClient=s.default,r(n(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:s.default}),e.default=__STATSIG__},4535:(t,e,n)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=n(6914),i=n(6325),r=n(6901);function s(t){return new o(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){s(t)}},e.runStatsigAutoCapture=s;class o{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.In={},this.Si=null;var{sdkKey:t,errorBoundary:e,values:n}=t.getContext(),n=(this.In=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,n=(0,c.Jt)();e&&n&&(t=t=>{this.Ze(t||e.event)},(0,i.ti)(n,"click",t),(0,i.ti)(n,"submit",t),(0,i.ti)(e,"error",t),(0,i.ti)(e,"beforeunload",()=>this.ei()),(0,i.ti)(e,"scroll",()=>this.ii()))}Oi(){var t=(0,c.Lt)(),e=(0,c.Jt)();t&&e&&((0,i.ti)(t,"popstate",()=>this.ji()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[n,i,r])=>{t.apply(e,[n,i,r]),this.ji()}}),this.ji())}Ze(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.ni(t):(e=(0,i.si)(t))&&(0,i.dt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,i.ri)(e),this.oi(n,t,e))}Qe(){this.Xe(),this.Oi(),this.ui(),this.ai()}ni(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.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,i.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}ji(){var t=(0,i.vi)(),e=this.Si;e&&t.href===e.href||(this.Si=t,e=(0,r.fi)(t),this.oi("page_view",(0,i.di)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}ai(){const n=(0,c.Lt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.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),n.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,i.gi)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.oi("performance",(0,i.di)(),t)},1)}ei(){this.oi("page_view_end",(0,i.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,n,i){var r,s,o;if(!this.In[t]){var l=this.ci();try{var u=$P({sessionID:l.data.sessionID,page_url:null!=(o=null==(s=null==(r=(0,c.Lt)())?void 0:r.location)?void 0:s.href)?o:""},n),a=(null!=i&&i.addNewSessionMetadata&&(u.isNewSession=String(this.hi(l))),{eventName:"auto_capture::"+t,value:e,metadata:u});this.De.logEvent(a),null!=i&&i.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((n+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=o},6325:(t,e,n)=>{$Q(e),e.gi=e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const s=n(6914);function o(t){var e={};if(t){var n=null==t?void 0:t.dataset;if(n)for(const i in n)e["data-"+i]=n[i]||""}return e}function l(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.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.At)()||"",r=("form"===(n.tagName=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")),l(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim(),e=o(r||t),$P(n,e)),{value:i,metadata:n}},e.si=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.dt=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(l(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,s.Lt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.di=function(){return(0,s.At)()||""},e.ti=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)},e.gi=function(){var t=(0,s.Lt)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,n)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return i.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture,StatsigAutoCapturePlugin:i.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,n)=>{$Q(e),e.fi=void 0;const a=n(6914);e.fi=function(t){var e=(0,a.Jt)(),n=(0,a.Lt)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,r=(null==e?void 0:e.referrer)||"";let s=new URL("empty:");if(r)try{s=new URL(r||"empty:")}catch(t){}l=s,o=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(l),l=l.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:l},l=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const u={};return t.searchParams.forEach((t,e)=>{u[e]=t}),$P($P($P($P({},o),l),u),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:r,screen_width:(null==(o=null==n?void 0:n.screen)?void 0:o.width)||"unknown",screen_height:(null==(l=null==n?void 0:n.screen)?void 0:l.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},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.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 o=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})());
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 $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var n={1845:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||l,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(i=null!=(i=null!=(i=s[r])?i:e[r])?i:o[r])?i:{instance:n.t};s[r]=l,e[r]=l,o[r]=l},2137:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const r=n(1406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=n(7512),a=n(9122),s=n(8578),o=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,s.A)(t,this.p),e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,s.A)(e,this.p),n=this.T(e);this.j.add(n,h("Bootstrap",t,null,e))}M(e,n,i){return r(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.D(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.A)(n,this.p),e=this.T(t),t=yield this.M(null,t,i);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(s,o,l){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,o)&&(t=s.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=h("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,r),this.G(e,r),r})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=l(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},8962:(t,s)=>{$Q2(s,"__esModule",{value:!0}),s.Diagnostics=void 0;const i=new Map,n="start";function r(t,e,n,i){return $P({key:n,action:e,step:i,timestamp:Date.now()},t)}function o(t,e){var n=null!=(n=i.get(t))?n:[];n.push(e),i.set(t,n)}function e(t,e){if(e in t)return t[e]}s.Diagnostics={_n:t=>i.get(t),gn:t=>{o(t,r({},n,"overall"))},mn:(t,e,n)=>{o(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},bn:(t,e)=>{o(t,r(e,n,"initialize","network_request"))},pn:(t,e)=>{o(t,r(e,"end","initialize","network_request"))},yn:t=>{o(t,r({},n,"initialize","process"))},On:(t,e)=>{o(t,r(e,"end","initialize","process"))},jn:t=>{i.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,n,i){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===n.includes('"is_delta":true')||void 0,attempt:e,error:s.Diagnostics.Sn(i)}},Tn(t,e,n,i){var r=s.Diagnostics._n(n);null==r||r.length<=0||(s.Diagnostics.jn(n),n=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:i}),e.enqueue(n))}}},8809:function(t,e){var n=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const r=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),s="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return n(this,void 0,void 0,function*(){var n=yield e(s,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:r});if(n.ok){var t,n=yield n.arrayBuffer(),n=new Uint8Array(n);{var i=n,n=i.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(i[e-1])));if(-1===n)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=n-1;t<i.length;t++)e+=String.fromCharCode(i[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,l,e){var n=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const i=e(7512),u=e(5902),a=e(8e3),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(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)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.$.has(r)||(this.$.add(r),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o,tag:s}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.p)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o,tag:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(2137),s=n(1406),o=n(7512),l=n(7410),u=n(6830),a=n(1637),c=n(4534),h=n(9638),d=n(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,n,i){this.S=t,this.B=e,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;e=null==i?void 0:i.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return i(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.l)(this.S,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const n=this.u();i(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(n);t&&(e===f.Startup&&c.Storage.removeItem(n),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(n)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,s.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.xt=s.Dt=s.h=void 0;const o=e(6634);s.h=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)},s.Dt=(t,e)=>(0,s.h)(JSON.stringify((0,s.xt)(t,e)));s.xt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.kt)(e)?r[t]=e:r[t]=(0,s.xt)(e,null!=i?i-1:i)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function n(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...n(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...n(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...n(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...n(t))}}(e.Log=i).level=e.LogLevel.Warn},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const l=n(1845),m=n(8962),y=n(7512),u=n(7410),i=n(308),a=n(5902),c=n(6830),h=n(4143),d=n(9122),O=n(2636),v=n(8e3),j=n(2397),S=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new i.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return o(this,void 0,void 0,function*(){var t,e,n;return!!w(i)&&(e=this.Nn("POST",i),t=yield this.Nt(e,i.data),e=yield this.Gt(e),(n=navigator).sendBeacon.bind(n)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!w(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i,attempt:r}=g,r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,j.Ut)();try{var c,h,d,v={method:e,body:n,headers:$P({},g.headers),signal:null===s||void 0===s?void 0:s.signal,priority:g.priority,keepalive:a},f=(u=r,(_=g).isInitialize&&m.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),T(g,l,r,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var n=function(t,e){if(null!=t&&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"Unknown Error"}(s,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s),_=(T(g,l,r,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,n,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!i||i<r||!S.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t,tag:O.ErrorTag.NetworkError,requestArgs:g}),y.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Pt($P($P({},g),{retries:i,attempt:r+1}))}})}Gt(i){var r;return o(this,void 0,void 0,function*(){var t=null!=(r=i.fallbackUrl)?r:i.url;const e=$P({[u.NetworkParam.SdkKey]:i.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(i.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Nt(r,s){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,n=d.StableID.get(t),i=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var n,i,r=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==r||!r.btoa)return e;try{var s=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var n=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:n})}};const w=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1);function T(t,e,n,i,r){t.isInitialize&&m.Diagnostics.pn(t.sdkKey,m.Diagnostics.wn(e,n,i,r))}},308:function(t,e,n){var a=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const c=n(8809),i=n(1406),o=n(7512),r=n(7410),l=n(4534);function u(t){for(const e in r.NetworkDefault)if(t.startsWith(r.NetworkDefault[e]))return!0;return!1}function h(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function d(t){return"statsig.network_fallback."+(0,i.h)(t)}function v(t,e){t=d(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function f(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.Di={},this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var n,e=f(e);e&&(n=null==(n=this.Un)?void 0:n[e])&&(n.expiryTime=Date.now()+6048e5,v(t,$P($P({},this.Un),{[e]:n})))}getFallbackUrl(t,e){var n=f(e);if(!u(e)||!n)return null;let i=this.Un;null==i&&(i=null!=(s=function(t){t=d(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.Un=i);var r,s=i[n];return!s||Date.now()>(null!=(r=s.expiryTime)?r:0)?(delete i[n],this.Un=i,v(t,this.Un),null):(r=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),s.url?`https://${s.url}/`+r:null)}tryFetchUpdatedFallbackInfo(n,i,r,s){var o;return a(this,void 0,void 0,function*(){try{var t=f(i);if(!h(r,s)||!t)return!1;if(this.Di[t]&&Date.now()<this.Di[t])return!1;this.Di[t]=Date.now()+144e5;var e=yield this.Gn(t);return e?(this.Ii(n,t,e),!0):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Ii(t,e,n){var n={url:n,expiryTime:Date.now()+6048e5,previous:[]},i=null==(i=this.Un)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.Un)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.Un=$P($P({},this.Un),{[e]:n}),v(t,this.Un)}Gn(l){var u;return a(this,void 0,void 0,function*(){var t=yield(0,c.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),n=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let i=null;for(const o of t){var[r,s]=o.split("=");if(s&&r===l){let t=s;if(s.endsWith("/")&&(t=s.slice(0,-1)),!e.has(s)&&t!==n){i=t;break}}}return i})}},e.Cn=u,e.Pn=h},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Kt(t,e){n[t]=e},Ft(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.qt=i.zt=i.Mt=i.Jt=i.Lt=void 0;i.Lt=()=>"undefined"!=typeof window?window:null,i.Jt=()=>{var t=(0,i.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.zt=(t,e)=>{var n=(0,i.Lt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.qt=(t,e)=>{var n=(0,i.Jt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(2137),s=n(7512),o=n(4534),l=n(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var n=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>u}(n)||function({startTime:t}){return Date.now()-t>a}(n))&&(n.sessionID=(0,l.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,o.J)(r,i)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=h(n,u),t.ageTimeoutID=h(n,a-e),t},overrideInitialSessionID:(t,e)=>{var n;c[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},9122:(t,e,n)=>{$Q(e),e.StableID=void 0;const i=n(2137),r=n(7512),s=n(4534),o=n(8023),l={};function u(t){return"statsig.stable_id."+(0,i.u)(t)}function a(t,e){e=u(e);try{(0,s.J)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,s.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const o=n(1845),l=n(5542),u=n(7770),a=n(7512),c=n(6830),h=n(4143),d=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Bt(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&d.Storage.de(i.storageProvider),this.S=t,this.p=null!=i?i:{},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Ht=new u.EventLogger(t,s,n,i),this.Wt=new l.ErrorBoundary(t,i,s),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),n.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.storageProvider=d.Storage,this.Yt(),r=t,s=this,(0,c.Mt)()||(n=(0,o.o)(),e=null!=(e=n.instances)?e:{},s=s,null!=e[r]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[r]=s,n.lastInstance=s,n.instances=e,__STATSIG__=n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Vt[n.name]&&this.Vt[n.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",u=(t,e,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.ee=(t,e)=>{return u(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.te=(t,e)=>{return u(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(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="",l=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",l=r.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},l)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.3";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const s=n(6634),r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},o(t,e,n,i)),{get:l(null==n?void 0:n.value)})}function l(i,r){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||(0,s.le)(n,e))?(null!=r&&r(t),n):null!=e?e:null}}e.ue=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:l(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:l(n,i)})},e.ie=l},1812:(t,e)=>{$Q(e)},8578:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(1406),r=n(7512);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(n.statsigEnvironment=e.environment),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,i.Dt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0;var i=e(7512),e=e(6830);const r={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>r[t]||null,setItem:(t,e)=>{r[t]=e},removeItem:t=>{delete r[t]},getAllKeys:()=>Object.keys(r)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:s,u=l;n.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.de(s),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?s:l}},n.F=function(t){return t=n.Storage.getItem(t),JSON.parse(null!=t?t:"null")},n.J=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.C=void 0;const r=n(7512);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(e)}},8023:(t,e)=>{$Q(e),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)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},2397:(t,e,n)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;n=n(6830);const i="foreground",r="background",s=[];let o=i,l=!1;e.Ot=()=>o===i,e.Ut=()=>l,e.lt=t=>{s.unshift(t)};e.ve=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(l=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(r)),(0,n.zt)("beforeunload",()=>{l=!0,(0,e.ve)(r)}),(0,n.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?i:r)})},6914: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]}}),$Q2(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)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,n(1845);const s=n(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=n(8e3);const a=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(n(1845),e),r(n(2137),e),r(n(6427),e),r(n(694),e),r(n(8962),e),r(n(3539),e),r(n(5542),e),r(n(2922),e),r(n(2417),e),r(n(1406),e),r(n(1333),e),r(n(7512),e),r(n(7023),e),r(n(7410),e),r(n(1405),e),r(n(1361),e),r(n(6830),e),r(n(5902),e),r(n(4143),e),r(n(9122),e),r(n(1375),e),r(n(2636),e),r(n(3206),e),r(n(1637),e),r(n(8e3),e),r(n(586),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(1098),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(9638),e),r(n(8023),e),r(n(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},2016:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const v=n(6914),f=n(2018);function _(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,v.Lt)(),s=(0,v.Jt)();if(r&&s&&s.currentScript){var o=s.currentScript.getAttribute("src"),l=null==(t=r.location)?void 0:t.href;if(o&&l){var u=new URL(o,l).searchParams,a=null!=(n=_("sdkKey",u))?n:_("apiKey",u);if(a){var c={},h=_("proxy",u),d=(h&&(c.networkConfig={api:h}),null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var n=(e="object"!=typeof e?{}:e).custom||{},i=e.customIDs||{};return $P($P({},e),{customIDs:$P({},i),custom:$P($P({},n),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(i=t.navigator)?void 0:i.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,n)=>{$Q(e),e.fe=void 0;const i=n(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},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.Dt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs},2))===e.checksumV2?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,n)=>{$Q(e);const r=n(6914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,r.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var n;return!!t&&null!=(n=(0,r.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==n?void 0:n.has_updates)&&(this._e=t.data,this.ye=n.time,this.me=t.receivedAt,this.ge=n,this.bi=this.pi(t.source,n),t.source)&&n.user&&this.yi(e,n),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let n=null;return{result:n=t?t[e]||t[(0,r.h)(e)]:n,details:this.Se(null==n)}}yi(t,e){var n,i=r.StableID.get(this.S);(null==(n=t.customIDs)?void 0:n.stableID)!==i?this.mi.add("StableIDMismatch"):"user"in e&&(n=e.user,(0,r.v)(t)!==(0,r.v)(n))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let n=e.reason;var i=null!=(i=e.warnings)?i:[],t=("Bootstrap"===this.be&&0<i.length&&(n+=i[0]),"Uninitialized"!==n&&"NoValues"!==n&&(n=n+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(i=this.bi)?i:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:n})}}},8448:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const l=n(6914),u=n(7262);class i extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,s){return o(this,void 0,void 0,function*(){var t=i?(0,l.C)(i,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(n,t,e,r)})}je(e,n,i,r){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:i,retries:2,isStatsigEncodable:!0,priority:r,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==i.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(n,t.body))?t:this.je(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},3583:(t,e,n)=>{$Q(e),e.Te=void 0;const g=n(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function m(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,m(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,m(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,i=e,r=_,m(s=(n=v).getLayer(o.layer_name,b).get(o.param_name),i)?i:(p(r)&&n.getLayer(o.layer_name).get(o.param_name),s);default:return e}}}},8198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const o=n(6914),l=n(4845),u=n(8448),s=n(3583),a=n(4131);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Kt(t,"javascript-client");var i,r=new u.default(n,t=>{this.$emt(t)}),r=(super(t,null!=(i=null==n?void 0:n.dataAdapter)?i:new a.StatsigEvaluationsDataAdapter,r,n),this.we=new l.default(t),this.Ie=(0,o.A)(e,n),null!=(i=null==n?void 0:n.plugins)?i:[]);for(const s of r)s.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Ae(n);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.we.getGate(t),i=(0,o.ue)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.ee)(this.Ie,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.oe)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.re)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.we.getLayer(e),i=(0,o.se)(e,i,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.Ie,n);const s=(0,o.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}getParameterStore(t,e){var{result:n,details:i}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,s.Te)(this,n,e)}}logEvent(t,e,n){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return r(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},4131:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(6914),r=n(8448);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,(0,i.A)(e,this.p),n)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.X)?void 0:r.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018: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]}}),$Q2(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)},s=($Q(e),e.StatsigClient=void 0,n(8198));e.StatsigClient=s.default,r(n(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:s.default}),e.default=__STATSIG__},4535:(t,e,n)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=n(6914),i=n(6325),r=n(6901);function s(t){return new o(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){s(t)}},e.runStatsigAutoCapture=s;class o{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.In={},this.Si=null;var{sdkKey:t,errorBoundary:e,values:n}=t.getContext(),n=(this.In=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,n=(0,c.Jt)();e&&n&&(t=t=>{this.Ze(t||e.event)},(0,i.ti)(n,"click",t),(0,i.ti)(n,"submit",t),(0,i.ti)(e,"error",t),(0,i.ti)(e,"beforeunload",()=>this.ei()),(0,i.ti)(e,"scroll",()=>this.ii()))}Oi(){var t=(0,c.Lt)(),e=(0,c.Jt)();t&&e&&((0,i.ti)(t,"popstate",()=>this.ji()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[n,i,r])=>{t.apply(e,[n,i,r]),this.ji()}}),this.ji())}Ze(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.ni(t):(e=(0,i.si)(t))&&(0,i.dt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,i.ri)(e),this.oi(n,t,e))}Qe(){this.Xe(),this.Oi(),this.ui(),this.ai()}ni(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.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,i.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}ji(){var t=(0,i.vi)(),e=this.Si;e&&t.href===e.href||(this.Si=t,e=(0,r.fi)(t),this.oi("page_view",(0,i.di)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}ai(){const n=(0,c.Lt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.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),n.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,i.gi)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.oi("performance",(0,i.di)(),t)},1)}ei(){this.oi("page_view_end",(0,i.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,n,i){var r,s,o;if(!this.In[t]){var l=this.ci();try{var u=$P({sessionID:l.data.sessionID,page_url:null!=(o=null==(s=null==(r=(0,c.Lt)())?void 0:r.location)?void 0:s.href)?o:""},n),a=(null!=i&&i.addNewSessionMetadata&&(u.isNewSession=String(this.hi(l))),{eventName:"auto_capture::"+t,value:e,metadata:u});this.De.logEvent(a),null!=i&&i.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((n+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=o},6325:(t,e,n)=>{$Q(e),e.gi=e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const s=n(6914);function o(t){var e={};if(t){var n=null==t?void 0:t.dataset;if(n)for(const i in n)e["data-"+i]=n[i]||""}return e}function l(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.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.At)()||"",r=("form"===(n.tagName=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")),l(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim(),e=o(r||t),$P(n,e)),{value:i,metadata:n}},e.si=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.dt=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(l(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,s.Lt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.di=function(){return(0,s.At)()||""},e.ti=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)},e.gi=function(){var t=(0,s.Lt)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,n)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return i.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture,StatsigAutoCapturePlugin:i.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,n)=>{$Q(e),e.fi=void 0;const a=n(6914);e.fi=function(t){var e=(0,a.Jt)(),n=(0,a.Lt)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,r=(null==e?void 0:e.referrer)||"";let s=new URL("empty:");if(r)try{s=new URL(r||"empty:")}catch(t){}l=s,o=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(l),l=l.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:l},l=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const u={};return t.searchParams.forEach((t,e)=>{u[e]=t}),$P($P($P($P({},o),l),u),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:r,screen_width:(null==(o=null==n?void 0:n.screen)?void 0:o.width)||"unknown",screen_height:(null==(l=null==n?void 0:n.screen)?void 0:l.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},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.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 o=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})());
@@ -1 +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 $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var i={845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||l,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=l,e[s]=l,o[s]=l},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(512),a=i(122),r=i(578),o=i(534),c=i(401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,l){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),this.G(e,s),s})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class n{constructor(){this.V={}}get(t,e){var t=this.V[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=l(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},539:(t,e)=>{$Q(e)},542:function(t,l,e){var i=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const n=e(512),u=e(902),a=e(0),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(137),r=i(406),o=i(512),l=i(410),u=i(830),a=i(637),c=i(534),h=i(638),d=i(397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},404:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const l=i(845),y=i(962),m=i(512),u=i(410),n=i(308),a=i(902),c=i(830),h=i(143),d=i(122),v=i(0),O=i(397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return o(this,void 0,void 0,function*(){var t,e,i;return!!S(n)&&(e=this.Nn("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!S(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=g,s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,O.Ut)();try{var c,h,d,v={method:e,body:i,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:a},f=(u=s,(_=g).isInitialize&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),w(g,l,s,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var i=function(t,e){if(null!=t&&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"Unknown Error"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),_=(w(g,l,s,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,i,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!n||n<s||!j.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return o(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s,r){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=d.StableID.get(t),n=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var i,n,s=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var i=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:i})}};const S=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1);function w(t,e,i,n,s){t.isInitialize&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const a=i(809),s=i(406),o=i(512),r=i(410),l=i(534);function u(t){for(const e in r.NetworkDefault)if(t.startsWith(r.NetworkDefault[e]))return!0;return!1}function v(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,s.h)(t)}function f(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function _(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i,e=_(e);e&&(i=null==(i=this.Un)?void 0:i[e])&&(i.expiryTime=Date.now()+6048e5,f(t,$P($P({},this.Un),{[e]:i})))}getFallbackUrl(t,e){var i=_(e);if(!u(e)||!i)return null;let n=this.Un;null==n&&(n=null!=(r=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.Un=n);var s,r=n[i];return!r||Date.now()>(null!=(s=r.expiryTime)?s:0)?(delete n[i],this.Un=n,f(t,this.Un),null):(s=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),r.url?`https://${r.url}/`+s:null)}tryFetchUpdatedFallbackInfo(r,o,l,u){var a,c,h,d;return n(this,void 0,void 0,function*(){try{var t,e,i,n,s=_(o);return v(l,u)&&s?!!(t=yield this.Gn(s))&&(e={url:t,expiryTime:Date.now()+6048e5,previous:[]},(i=null==(a=this.Un)?void 0:a[s])&&e.previous.push(...i.previous),10<e.previous.length&&(e.previous=[]),null!=(n=null==(h=null==(c=this.Un)?void 0:c[s])?void 0:h.url)&&e.previous.push(n),this.Un=$P($P({},this.Un),{[s]:e}),f(r,this.Un),!0):!1}catch(t){return null!=(d=this.Wt)&&d.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Gn(l){var u;return n(this,void 0,void 0,function*(){var t=yield(0,a.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),i=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let n=null;for(const o of t){var[s,r]=o.split("=");if(r&&s===l){let t=r;if(r.endsWith("/")&&(t=r.slice(0,-1)),!e.has(r)&&t!==i){n=t;break}}}return n})}},e.Cn=u,e.Pn=v},405:(t,e)=>{$Q(e)},361:(t,e)=>{$Q(e)},902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),l=i(23),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,l.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),l={};function u(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=u(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),l=i(542),u=i(770),a=i(512),c=i(830),h=i(143),d=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new u.EventLogger(t,r,i,n),this.Wt=new l.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),i.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},636:(t,e)=>{$Q(e)},206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return u(n,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.te=(t,e)=>{return u(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",l=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",l=s.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},l)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},98:(t,e)=>{$Q(e)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:l(null==i?void 0:i.value)})}function l(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:l(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:l(i,n)})},e.ie=l},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:r,u=l;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?r:l}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},23:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,l=!1;e.Ot=()=>o===n,e.Ut=()=>l,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(l=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{l=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(98),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},296:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),s(i(18),e),e.default=__STATSIG__},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,i)=>{$Q(e);const s=i(914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const l=i(914),u=i(262);class n extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,l.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});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==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,y(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),l=i(226),u=i(448),r=i(583),a=i(131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new l.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},18:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(198));e.StatsigClient=r.default,s(i(914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(296).default})());
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 $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((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())})});var i={845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||l,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=l,e[s]=l,o[s]=l},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(512),a=i(122),r=i(578),o=i(534),c=i(401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,l){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),this.G(e,s),s})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};class n{constructor(){this.V={}}get(t,e){var t=this.V[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=l(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.Rn=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",o=["i","e","d"],l=200;e.Rn=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<l&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},539:(t,e)=>{$Q(e)},542:function(t,l,e){var i=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const n=e(512),u=e(902),a=e(0),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o,tag:r}):(t=u.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(137),r=i(406),o=i(512),l=i(410),u=i(830),a=i(637),c=i(534),h=i(638),d=i(397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,u.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,u.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return((0,d.Ut)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?(this.B({name:"logs_flushed",events:t}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},404:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const l=i(845),y=i(962),m=i(512),u=i(410),n=i(308),a=i(902),c=i(830),h=i(143),d=i(122),O=i(636),v=i(0),j=i(397),S=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.Wt=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Fn=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.Fn),this.Fn.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return o(this,void 0,void 0,function*(){var t,e,i;return!!w(n)&&(e=this.Nn("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return o(this,void 0,void 0,function*(){var t=this.Nn("POST",e);return t.body=yield this.Nt(t,e.data),e.isStatsigEncodable&&(t.body=this.Ct(t,t.body)),this.Pt(t)})}get(t){t=this.Nn("GET",t);return this.Pt(t)}Pt(g){var b,p;return o(this,void 0,void 0,function*(){if(!w(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=g,s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=yield this.Gt(g);let l=null;var u,a=(0,j.Ut)();try{var c,h,d,v={method:e,body:i,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:a},f=(u=s,(_=g).isInitialize&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(l=yield f(o,v),clearTimeout(t),l.ok)return d=yield l.text(),T(g,l,s,d),this.Fn.tryBumpExpiryTime(g.sdkKey,o),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var i=function(t,e){if(null!=t&&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"Unknown Error"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),_=(T(g,l,s,"",t),yield this.Fn.tryFetchUpdatedFallbackInfo(g.sdkKey,o,i,a));return _&&(g.fallbackUrl=this.Fn.getFallbackUrl(g.sdkKey,g.url)),!n||n<s||!S.has(null!=(p=null===l||void 0===l?void 0:l.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t,tag:O.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return o(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:a.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:v.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:h.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s,r){return o(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=d.StableID.get(t),n=h.SessionID.get(t),t=a.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},v.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(t,e){var i,n,s=(0,c.Lt)();if(this.p.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}Nn(t,e){var i=this.Fn.getFallbackUrl(e.sdkKey,e.url);return $P($P({},e),{method:t,fallbackUrl:i})}};const w=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1);function T(t,e,i,n,s){t.isInitialize&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var a=this&&this.__awaiter||$A();$Q(e),e.Pn=e.Cn=e.NetworkFallbackResolver=void 0;const c=i(809),n=i(406),o=i(512),s=i(410),l=i(534);function u(t){for(const e in s.NetworkDefault)if(t.startsWith(s.NetworkDefault[e]))return!0;return!1}function h(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function d(t){return"statsig.network_fallback."+(0,n.h)(t)}function v(t,e){t=d(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function f(t){return t.includes("initialize")?"i":t.includes("rgstr")?"e":t.includes("download_config_specs")?"d":null}e.NetworkFallbackResolver=class{constructor(t){this.Un=null,this.Wt=null,this.Di={},this.An=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i,e=f(e);e&&(i=null==(i=this.Un)?void 0:i[e])&&(i.expiryTime=Date.now()+6048e5,v(t,$P($P({},this.Un),{[e]:i})))}getFallbackUrl(t,e){var i=f(e);if(!u(e)||!i)return null;let n=this.Un;null==n&&(n=null!=(r=function(t){t=d(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return o.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.Un=n);var s,r=n[i];return!r||Date.now()>(null!=(s=r.expiryTime)?s:0)?(delete n[i],this.Un=n,v(t,this.Un),null):(s=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),r.url?`https://${r.url}/`+s:null)}tryFetchUpdatedFallbackInfo(i,n,s,r){var o;return a(this,void 0,void 0,function*(){try{var t=f(n);if(!h(s,r)||!t)return!1;if(this.Di[t]&&Date.now()<this.Di[t])return!1;this.Di[t]=Date.now()+144e5;var e=yield this.Gn(t);return e?(this.Ii(i,t,e),!0):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Ii(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.Un)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.Un)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.Un=$P($P({},this.Un),{[e]:i}),v(t,this.Un)}Gn(l){var u;return a(this,void 0,void 0,function*(){var t=yield(0,c.Rn)(null!=(u=this.An)?u:fetch);if(0===t.length)return null;var e=new Set(null!=(u=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.previous)?u:[]),i=null==(u=null==(u=this.Un)?void 0:u[l])?void 0:u.url;let n=null;for(const o of t){var[s,r]=o.split("=");if(r&&s===l){let t=r;if(r.endsWith("/")&&(t=r.slice(0,-1)),!e.has(r)&&t!==i){n=t;break}}}return n})}},e.Cn=u,e.Pn=h},405:(t,e)=>{$Q(e)},361:(t,e)=>{$Q(e)},902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),l=i(23),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,l.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),l={};function u(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=u(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),l=i(542),u=i(770),a=i(512),c=i(830),h=i(143),d=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new u.EventLogger(t,r,i,n),this.Wt=new l.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(e),this.Wt.wrap(this.Ht),i.setErrorBoundary(this.Wt),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return u(n,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.te=(t,e)=>{return u(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",l=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",l=s.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},l)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.3.0-beta.3";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},98:(t,e)=>{$Q(e)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:l(null==i?void 0:i.value)})}function l(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:l(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:l(i,n)})},e.ie=l},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:r,u=l;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?r:l}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},23:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,l=!1;e.Ot=()=>o===n,e.Ut=()=>l,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(l=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{l=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(98),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},296:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),s(i(18),e),e.default=__STATSIG__},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,i)=>{$Q(e);const s=i(914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const l=i(914),u=i(262);class n extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,l.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});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==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,l,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(l=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&l.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,l=_,y(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),l=i(226),u=i(448),r=i(583),a=i(131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new l.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},18:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(198));e.StatsigClient=r.default,s(i(914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(296).default})());
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@statsig/js-client",
3
- "version": "3.3.0-beta.1",
3
+ "version": "3.3.0-beta.3",
4
4
  "dependencies": {
5
- "@statsig/client-core": "3.3.0-beta.1"
5
+ "@statsig/client-core": "3.3.0-beta.3"
6
6
  },
7
7
  "jsdelivr": "./build/statsig-js-client.min.js",
8
8
  "type": "commonjs",