@statsig/js-client 3.5.0 → 3.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0;const s=e(7512);i.o=()=>__STATSIG__||u,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},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),l=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*(){l.Storage.isReady()||(yield l.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,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,l)&&(t=r.data);var e=yield this.N(t,l,o);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,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.T(l);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=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,l.F)(this.O))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.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=o(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function o(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 l(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=>{l(t,s({},i,"overall"))},mn:(t,e,i)=>{l(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{l(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{l(t,s(e,"end","initialize","network_request"))},yn:t=>{l(t,s({},i,"initialize","process"))},On:(t,e)=>{l(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.kn=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",l=["i","e","d"],o=200;e.kn=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.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,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e,i=l||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:l,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)(o.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:l,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),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(1881),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.ki=new h.UrlConfiguration(o.Endpoint.Di,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}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):(l.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return l.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},urlConfig:this.ki,retries:3,isCompressable:!0,params:{[o.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){l.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(()=>{l.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));l.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 l=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,l.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=e.Endpoint=void 0,e.Endpoint={Qe:"initialize",Di:"rgstr",Ai:"download_config_specs"},e.NetworkDefault={[e.Endpoint.Di]:"https://prodregistryv2.org/v1",[e.Endpoint.Qe]:"https://featureassets.org/v1",[e.Endpoint.Ai]:"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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const o=i(1845),y=i(8962),m=i(7512),S=i(7410),n=i(308),u=i(5902),a=i(6830),c=i(4143),h=i(9122),O=i(2636),d=i(8e3),j=i(2397),w=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.En=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.En),this.En.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return l(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.An("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.An("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.An("GET",t);return this.Pt(t)}Pt(g){var b,p;return l(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),l=yield this.Gt(g);let o=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).urlConfig.endpoint===S.Endpoint.Qe&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),k(g,o,s,d),this.En.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(k(g,o,s,"",t),yield this.En.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,i,a));return _&&(g.fallbackUrl=this.En.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!n||n<s||!w.has(null!=(p=null===o||void 0===o?void 0:o.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 ${l}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return l(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();const e=$P({[S.NetworkParam.SdkKey]:n.sdkKey,[S.NetworkParam.SdkType]:u.SDKType.Y(n.sdkKey),[S.NetworkParam.SdkVersion]:d.SDK_VERSION,[S.NetworkParam.Time]:String(Date.now()),[S.NetworkParam.SessionID]:c.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 l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=h.StableID.get(t),n=c.SessionID.get(t),t=u.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(e,i){var t,n,s=(0,a.Lt)();if(this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[S.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}An(t,e){var i=this.En.getActiveFallbackUrl(e.sdkKey,e.urlConfig);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 k(t,e,i,n,s){t.urlConfig.endpoint===S.Endpoint.Qe&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.Mn=e.NetworkFallbackResolver=void 0;const o=i(8809),n=i(1406),r=i(7512),l=i(4534);function a(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,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.Rn=null,this.Wt=null,this.Ei={},this.Cn=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i=null==(i=this.Rn)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.Rn),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.Rn;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.Rn=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.Rn=n,h(t,this.Rn),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.Mi(n):n.fallbackUrls,!!(e=this.Ri(null==(l=this.Rn)?void 0:l[n.endpoint],t))&&(this.Fn(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Fn(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.Rn)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.Rn)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.Rn=$P($P({},this.Rn),{[e]:i}),h(t,this.Rn)}Mi(r){var l;return u(this,void 0,void 0,function*(){var t=this.Ei[r.endpoint];if(t&&Date.now()<t)return null;this.Ei[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.kn)(null!=(l=this.Cn)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}Ri(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.Mn=a},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),l=i(4534),o=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,l.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.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),l=i(8023),o={};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==o[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=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 o.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,l.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.firstInstance||(i.firstInstance=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 s="statsig::config_exposure",r="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===r||t===s,e.ee=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),u(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.te=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),u(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Zt=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),u("statsig::layer_exposure",t,e.details,o,l)};const l=(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.5.0";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 l=i(7512),o=i(6634),s="default";function r(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({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.le)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.ue=function(t,e,i){return r(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({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.ie=u},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 l=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:r,u=o;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=>{o=t,u=t},Bt:t=>{u=t?r:o}},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)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(7410),r={[s.Endpoint.Qe]:"i",[s.Endpoint.Di]:"e",[s.Endpoint.Ai]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},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 l=n,o=!1;e.Ot=()=>l===n,e.Ut=()=>o,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(o=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{o=!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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(7410),e),s(i(7023),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(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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 l=r.currentScript.getAttribute("src"),o=null==(t=s.location)?void 0:t.href;if(l&&o){var u=new URL(l,o).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 l=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(7262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.xi=new o.UrlConfiguration(o.Endpoint.Qe,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.xi,data:n,retries:2,isStatsigEncodable:!0,priority:s});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,l,o,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=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.o)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.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 o.default(t),this.Ie=(0,l.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=(l.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&&(l.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),l.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),l.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:l.StatsigSession.get(this.S),stableID:l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,l.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 l.Storage.isReady()||(yield l.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=>{l.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,l.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&l.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 l 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=l},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 d=i(6914),s=i(759),r=i(1807),v=1048576;function l(t,e){new o(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){l(t,this.options)}},e.runStatsigSessionReplay=l;class o{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,d.Mt)()||((t=(0,d.o)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.Re=this.Ne(),this.Ce=new s.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(),d.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,d.lt)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof o&&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;var i,e=(0,r.Ii)(t,10485760);10485760<e?d.Log.warn(`SessionReplay event is too large (~${e} bytes) and will not be logged`,t):(i=(0,r.Ii)(this.Ee,10240),this.Ee.push(t),i+e<10240||((0,d.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()||(d.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(),d.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.Ee.length&&null!=this.ke&&this.qe()}Ue(e){0!==this.Ee.length&&null!=this.ke&&(e=(0,d.Ut)()?"is_leaving_page":e,this.Re.then(t=>this.ze(t,e)).catch(t=>{this.Wt.logError("SR::flush",t)}))}ze(e,i){var n=this.ke;if(null!==n&&0!==this.Ee.length){var s,r,l,o=JSON.stringify(this.Ee),u=function(e){var i=[];for(let t=0;t<e.length;t+=v)i.push(e.slice(t,t+v));return i}(o),a=1<u.length?(0,d.getUUID)():null;for(let t=0;t<u.length;t++){var c=u[t],h=function(t,e,i,n){n={session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:t,rrweb_payload_size:String(e.length),session_replay_sdk_version:d.SDK_VERSION};return{eventName:"statsig::session_recording",value:i,metadata:n}}(c,o,e,n);null!=a&&(s=h.metadata,r=t,l=u.length,c=c.length,s.sliced_id=a,s.slice_index=String(r),s.slice_count=String(l),s.slice_byte_size=String(c)),i&&(h.metadata[i]="true"),this.De.logEvent(h),null!=a&&this.De.flush().catch(t=>{d.Log.error(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=o},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}}},1807:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.Ii=void 0;o.Ii=(e,i)=>{let n=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((n=(n+=r.length)+("object"==typeof l&&null!==l?(0,o.Ii)(l,i)+2:String(l).length+1))>=i)return n}return n}},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 l(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){r(t)}},e.runStatsigAutoCapture=r;class l{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,l;if(!this.In[t]){var o=this.ci();try{var u=$P({sessionID:o.data.sessionID,page_url:null!=(l=null==(r=null==(s=(0,c.Lt)())?void 0:s.location)?void 0:r.href)?l:""},i),a=(null!=n&&n.addNewSessionMetadata&&(u.isNewSession=String(this.hi(o))),{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=l},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 l(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 o(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=l,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")),o(t));return s&&(i.href=s.getAttribute("href")),"button"!==e&&!s||(i.content=(t.textContent||"").trim(),e=l(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(o(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){}o=r,l=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(o),o=o.searchParams.get("yahoo"===l?"p":"q")||"";var l={searchEngine:l,searchQuery:o},o=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({},l),o),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==(l=null==i?void 0:i.screen)?void 0:l.width)||"unknown",screen_height:(null==(o=null==i?void 0:i.screen)?void 0:o.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 l=s(3447),o=s(1964);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new l.SessionReplay(t),new o.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)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(7512);i.l=()=>__STATSIG__||u,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},2137:(t,e,i)=>{$Q(e),e.o=e.u=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.u=n,e.o=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),l=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.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,r.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,r.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(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)})}A(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(r,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.N(r,l)&&(t=r.data);var e=yield this.R(t,l,o);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,s),this.U(e,s),s})}C(){return null!=this.O?this.O:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}};class n{constructor(){this.K={}}get(t,e){var t=this.K[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=o(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(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 l(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={q:t=>n.get(t),B:t=>{l(t,s({},i,"overall"))},V:(t,e,i)=>{l(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{l(t,s(e,i,"initialize","network_request"))},$:(t,e)=>{l(t,s(e,"end","initialize","network_request"))},W:t=>{l(t,s({},i,"initialize","process"))},H:(t,e)=>{l(t,s(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(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.X(n)}},tt(t,e,i,n){var s=r.Diagnostics.q(i);null==s||s.length<=0||(r.Diagnostics.Y(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.et=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",l=["i","e","d"],o=200;e.et=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.ErrorBoundary=class{constructor(t,e,i){this.O=t,this.m=e,this.nt=i,this.it=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.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e,i=l||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.it.has(s)||(this.it.add(s),null!=(t=null==(t=this.m)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.nt)&&t.call(this,{name:"error",error:l,tag:r}):(t=u.SDKType.lt(this.O),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.m)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.nt)&&n.call(this,{name:"error",error:l,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),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(1881),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,u.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return n(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,u.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(t){var e,i;return n(this,void 0,void 0,function*(){if(this.bt)return this.Nt(t),!1;try{return((0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(i=null==(e=this.m)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.Pt(t):yield this.Ct(t)).success?(this.nt({name:"logs_flushed",events:t}),!0):(l.Log.warn("Failed to flush events."),this.Nt(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return n(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.O].Et!==e?clearInterval(e):_.ot(this.O)},t);this.Et=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Lt=r.Kt=r.h=void 0;const l=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.Kt=(t,e)=>(0,r.h)(JSON.stringify((0,r.Lt)(t,e)));r.Lt=(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,l.zt)(e)?s[t]=e:s[t]=(0,r.Lt)(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=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const o=i(1845),y=i(8962),m=i(7512),S=i(7410),n=i(308),u=i(5902),a=i(6830),c=i(4143),h=i(9122),O=i(2636),d=i(8e3),j=i(2397),w=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.Vt=1e4,this.Jt={},this.m={},this.$t=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return l(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(g){var b,p;return l(this,void 0,void 0,function*(){if(!T(g))return null;if(this.Jt.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.Vt}ms expired.`)},this.Vt),l=yield this.Xt(g);let o=null;var u,a=(0,j.Rt)();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).urlConfig.endpoint===S.Endpoint.qt&&y.Diagnostics.J(_.sdkKey,{attempt:u}),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),I(g,o,s,d),this.Wt.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(I(g,o,s,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,i,a));return _&&(g.fallbackUrl=this.Wt.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!n||n<s||!w.has(null!=(p=null===o||void 0===o?void 0:o.status)?p:500)?(null!=(p=this.nt)&&p.call(this,{name:"error",error:t,tag:O.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${l}.`,i,t),null):this.Zt($P($P({},g),{retries:n,attempt:s+1}))}})}Xt(n){var s;return l(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();const e=$P({[S.NetworkParam.SdkKey]:n.sdkKey,[S.NetworkParam.SdkType]:u.SDKType.lt(n.sdkKey),[S.NetworkParam.SdkVersion]:d.SDK_VERSION,[S.NetworkParam.Time]:String(Date.now()),[S.NetworkParam.SessionID]:c.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(s,r){return l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=h.StableID.get(t),n=c.SessionID.get(t),t=u.SDKType.lt(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,s=(0,a.te)();if(this.m.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[S.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);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 I(t,e,i,n,s){t.urlConfig.endpoint===S.Endpoint.qt&&y.Diagnostics.$(t.sdkKey,y.Diagnostics.Z(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=i(8809),n=i(1406),r=i(7512),l=i(4534);function a(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,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ne=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(r){var l;return u(this,void 0,void 0,function*(){var t=this.ie[r.endpoint];if(t&&Date.now()<t)return null;this.ie[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(l=this.re)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.ee=a},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={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?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),l=i(4534),o=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.o)(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,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.L)(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),l=i(8023),o={};function u(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=u(e);try{(0,r.L)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=u(t);return(0,r.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=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.ve=null,this.fe={};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._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.pe=new u.EventLogger(t,r,i,n),this.$t=new o.ErrorBoundary(t,n,r),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),s=t,r=this,(0,c.kt)()||(i=(0,l.l)(),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.firstInstance||(i.firstInstance=r),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[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.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.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.Oe=e.je=e.Se=e.xt=void 0;const s="statsig::config_exposure",r="statsig::gate_exposure",u="statsig::layer_exposure",a=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.xt=({eventName:t})=>t===r||t===s||t===u,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),a(u,t,e.details,o,l)};const l=(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.6.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.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(7512),o=i(6634),s="default";function r(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({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Me)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return r(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=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.ke=function(t,e,i,n){return $P($P({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.we=u},1812:(t,e)=>{$Q(e)},8578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(1406),s=i(7512);e.T=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.Kt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=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 l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:r,u=o;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.ge(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),ge:t=>{o=t,u=t},_e:t=>{u=t?r:o}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(7512);e.P=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.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=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)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(7410),r={[s.Endpoint.qt]:"i",[s.Endpoint.jt]:"e",[s.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(6830);const n="foreground",s="background",r=[];let l=n,o=!1;e.xe=()=>l===n,e.Rt=()=>o,e.It=t=>{r.unshift(t)};e.Ae=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(o=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(s)),(0,i.he)("beforeunload",()=>{o=!0,(0,e.Ae)(s)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(7410),e),s(i(7023),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(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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.te)(),r=(0,v.de)();if(s&&r&&r.currentScript){var l=r.currentScript.getAttribute("src"),o=null==(t=s.location)?void 0:t.href;if(l&&o){var u=new URL(l,o).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.te)();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.Gt)()||"",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.Ne=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(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.Kt)({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.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,s.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source)&&i.user&&this.ze(e,i),!0)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=s.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(7262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new o.UrlConfiguration(o.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.P)(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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,retries:2,isStatsigEncodable:!0,priority:s});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.Ne)(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.$e=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.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,l,o,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(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=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(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 o.default(t),this.He=(0,l.T)(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.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){this.Xe(t);t=this.dataAdapter.getDataSync(this.He),this.We.setValues(t,this.He),this.Qe(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Xe(i);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.He){let t=!1;null!=e&&(l.Diagnostics.W(this.O),t=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:t})),this.Qe(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.V(this.O,t,this.We.getCurrentSourceDetails()),l.Diagnostics.tt(this.He,this.pe,this.O,this.m)}})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,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,l.Ie)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.He,i);const r=(0,l.Te)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.ye(e,(0,l.Oe)(this.He,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.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.$e)(this,i,e)}}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return s(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=(0,l.T)(t,this.m);t=null==(t=this.He.customIDs)?void 0:t.stableID;t&&l.StableID.setOverride(t,this.O)}}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 l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(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)}R(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.ht)?void 0:s.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},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 d=i(6914),s=i(759),r=i(1807),v=1048576;function l(t,e){new o(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){l(t,this.options)}},e.runStatsigSessionReplay=l;class o{constructor(t,e){this.tn=t,this.m=e,this.ti=null,this.ei=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.$t=t,this.$t.wrap(this),(0,d.kt)()||((t=(0,d.l)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.ii=this.ni(),this.si=new s.SessionReplayClient,this.tn.$on("pre_shutdown",()=>this.ri()),this.tn.$on("values_updated",()=>{var t;return this.li(null==(t=this.m)?void 0:t.forceRecording)}),this.tn.on("session_expired",()=>{this.si.stop(),d.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.oi("session_expired"),this.ii=this.ni()}),this.ui(),this.li(null==(t=this.m)?void 0:t.forceRecording)}ui(){const i=this.tn.getContext()["sdkKey"];(0,d.It)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof o&&e.ai(t)})}forceStartRecording(){this.li(!0)}ai(t){"background"===t&&(this.oi(),this.tn.flush().catch(t=>{this.$t.logError("SR::visibility",t)}))}ci(t,e){this.ti=e;var i,e=(0,r.hi)(t,10485760);10485760<e?d.Log.warn(`SessionReplay event is too large (~${e} bytes) and will not be logged`,t):(i=(0,r.hi)(this.ei,10240),this.ei.push(t),i+e<10240||((0,d.xe)()?this.di():this.oi()))}li(t=!1){var e=this.tn.getContext().values;t||!0===(null==e?void 0:e.can_record_session)?this.si.isRecording()||(d.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.si.record((t,e)=>this.ci(t,e),null!=(e=null==(t=this.m)?void 0:t.rrwebConfig)?e:{})):this.ri()}ri(){this.si.stop(),d.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.ei.length&&null!=this.ti&&this.di()}oi(e){0!==this.ei.length&&null!=this.ti&&(e=(0,d.Rt)()?"is_leaving_page":e,this.ii.then(t=>this.vi(t,e)).catch(t=>{this.$t.logError("SR::flush",t)}))}vi(e,i){var n=this.ti;if(null!==n&&0!==this.ei.length){var s,r,l,o=JSON.stringify(this.ei),u=function(e){var i=[];for(let t=0;t<e.length;t+=v)i.push(e.slice(t,t+v));return i}(o),a=1<u.length?(0,d.getUUID)():null;for(let t=0;t<u.length;t++){var c=u[t],h=function(t,e,i,n){n={session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:t,rrweb_payload_size:String(e.length),session_replay_sdk_version:d.SDK_VERSION};return{eventName:"statsig::session_recording",value:i,metadata:n}}(c,o,e,n);null!=a&&(s=h.metadata,r=t,l=u.length,c=c.length,s.sliced_id=a,s.slice_index=String(r),s.slice_count=String(l),s.slice_byte_size=String(c)),i&&(h.metadata[i]="true"),this.tn.logEvent(h),null!=a&&this.tn.flush().catch(t=>{d.Log.error(t)})}this.ei=[]}}di(){this.ii=this.ni(),this.oi()}ni(){return n(this,void 0,void 0,function*(){return this.tn.getContext().session.data.sessionID})}}e.SessionReplay=o},759:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(3331),s=i(6914);e.SessionReplayClient=class{constructor(){this.fi=null,this._i=null,this.gi=0}record(i,t,e){null==(0,s.de)()||(this.fi=null,this._i=null,this.gi=0,this.bi=e,this.pi)||(this.pi=(e=t=>{var e;null==this.fi&&(this.fi=t.timestamp),this._i=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.gi++,i(t,{startTime:this.fi,endTime:this._i,clickCount:this.gi}),144e5<this._i-this.fi&&(null!=(e=this.pi)&&e.call(this),this.bi)&&this.bi()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.pi&&(this.pi(),this.pi=void 0)}isRecording(){return null!=this.pi}}},1807:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.hi=void 0;o.hi=(e,i)=>{let n=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((n=(n+=r.length)+("object"==typeof l&&null!==l?(0,o.hi)(l,i)+2:String(l).length+1))>=i)return n}return n}},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(5423),s=i(6325),r=i(6901),l={submit:n.AutoCaptureEventName.FORM_SUBMIT,click:n.AutoCaptureEventName.CLICK};function o(t,e){return new u(t,e)}e.StatsigAutoCapturePlugin=class{constructor(t){this.m=t,this.__plugin="auto-capture"}bind(t){o(t,this.m)}},e.runStatsigAutoCapture=o;class u{constructor(t,e){this.tn=t,this.en=Date.now(),this.nn=0,this.rn={},this.sn=null;var{sdkKey:t,errorBoundary:i,values:n}=t.getContext(),n=(this.rn=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.$t=i,this.$t.wrap(this),this.ln=null==e?void 0:e.eventFilterFunc,(0,c.de)());(0,c.kt)()||((e=null!=(i=(__STATSIG__=(0,c.l)()).acInstances)?i:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.qt()):this.qt()}un(){const e=(0,c.te)();var t,i=(0,c.de)();e&&i&&(t=t=>{this.an(t||e.event)},(0,s.cn)(i,"click",t),(0,s.cn)(i,"submit",t),(0,s.cn)(e,"error",t),(0,s.cn)(e,"beforeunload",()=>this.hn()),(0,s.cn)(e,"scroll",()=>this.dn()))}vn(){var t=(0,c.te)(),e=(0,c.de)();t&&e&&((0,s.cn)(t,"popstate",()=>this.fn()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,s])=>{t.apply(e,[i,n,s]),this.fn()}}),this.fn())}an(t){var e,i=null==(i=t.type)?void 0:i.toLowerCase();"error"===i&&t instanceof ErrorEvent?this._n(t):(e=(0,s.gn)(t))&&(0,s.St)(t,e)&&(t=l[i])&&({value:i,metadata:e}=(0,s.pn)(e),this.bn(t,i,e))}qt(){this.un(),this.vn(),this.mn(),this.yn()}_n(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.bn(n.AutoCaptureEventName.ERROR,t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}mn(){var t=this.On();try{this.jn(t)&&this.bn(n.AutoCaptureEventName.SESSION_START,(0,s.Sn)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.$t.logError("AC::logSession",t)}}fn(){var t=(0,s.wn)(),e=this.sn;e&&t.href===e.href||(this.sn=t,e=(0,r.Tn)(t),this.bn(n.AutoCaptureEventName.PAGE_VIEW,(0,s.Sn)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}yn(){const i=(0,c.te)();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,s.kn)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.bn(n.AutoCaptureEventName.PERFORMANCE,(0,s.Sn)(),t)},1)}hn(){this.bn(n.AutoCaptureEventName.PAGE_VIEW_END,(0,s.Sn)(),{scrollDepth:this.nn,pageViewLength:Date.now()-this.en},{flushImmediately:!0})}bn(t,e,i,n){var s,r,l,o=t.slice("auto_capture::".length);if(!this.rn[t]&&!this.rn[o]){o=this.On();try{var u=$P({sessionID:o.data.sessionID,page_url:null!=(l=null==(r=null==(s=(0,c.te)())?void 0:s.location)?void 0:r.href)?l:""},i),a=(null!=n&&n.addNewSessionMetadata&&(u.isNewSession=String(this.jn(o))),{eventName:t,value:e,metadata:u});this.ln&&!this.ln(a)||(this.tn.logEvent(a),null!=n&&n.flushImmediately&&this.tn.flush().catch(t=>{c.Log.error(t)}))}catch(t){this.$t.logError("AC::enqueue",t)}}}dn(){var t=null!=(t=null==(t=(0,c.de)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.te)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.nn=Math.max(this.nn,Math.min(100,Math.round((i+e)/t*100)))}jn(t){return Math.abs(t.data.startTime-Date.now())<1e3}On(){return this.tn.getContext().session}}e.AutoCapture=u},5423:(t,e)=>{$Q(e),e.AutoCaptureEventName=void 0,e.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click"}},6325:(t,e,i)=>{$Q(e),e.kn=e.cn=e.Sn=e.wn=e.St=e.gn=e.pn=e.In=void 0;const r=i(6914);function l(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 o(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.In=l,e.pn=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,r.Gt)()||"",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")),o(t));return s&&(i.href=s.getAttribute("href")),"button"!==e&&!s||(i.content=(t.textContent||"").trim(),e=l(s||t),$P(i,e)),{value:n,metadata:i}},e.gn=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.St=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(o(e))return!0}return!1}},e.wn=function(){var t=null!=(t=null==(t=null==(t=(0,r.te)())?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.Sn=function(){return(0,r.Gt)()||""},e.cn=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.kn=function(){var t=(0,r.te)();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.Tn=void 0;const a=i(6914);e.Tn=function(t){var e=(0,a.de)(),i=(0,a.te)();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){}o=r,l=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(o),o=o.searchParams.get("yahoo"===l?"p":"q")||"";var l={searchEngine:l,searchQuery:o},o=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({},l),o),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==(l=null==i?void 0:i.screen)?void 0:l.width)||"unknown",screen_height:(null==(o=null==i?void 0:i.screen)?void 0:o.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 l=s(3447),o=s(1964);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new l.SessionReplay(t),new o.AutoCapture(t)})}return t.default})());
|
|
@@ -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,o=>(()=>{"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=o},1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0;const s=e(7512);i.o=()=>__STATSIG__||u,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},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),l=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*(){l.Storage.isReady()||(yield l.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,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,l)&&(t=r.data);var e=yield this.N(t,l,o);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,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.T(l);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=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,l.F)(this.O))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.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=o(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function o(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 l(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=>{l(t,s({},i,"overall"))},mn:(t,e,i)=>{l(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{l(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{l(t,s(e,"end","initialize","network_request"))},yn:t=>{l(t,s({},i,"initialize","process"))},On:(t,e)=>{l(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.kn=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",l=["i","e","d"],o=200;e.kn=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.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,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e,i=l||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:l,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)(o.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:l,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),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(1881),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.ki=new h.UrlConfiguration(o.Endpoint.Di,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}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):(l.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return l.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},urlConfig:this.ki,retries:3,isCompressable:!0,params:{[o.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){l.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(()=>{l.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));l.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 l=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,l.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=e.Endpoint=void 0,e.Endpoint={Qe:"initialize",Di:"rgstr",Ai:"download_config_specs"},e.NetworkDefault={[e.Endpoint.Di]:"https://prodregistryv2.org/v1",[e.Endpoint.Qe]:"https://featureassets.org/v1",[e.Endpoint.Ai]:"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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const o=i(1845),y=i(8962),m=i(7512),S=i(7410),n=i(308),u=i(5902),a=i(6830),c=i(4143),h=i(9122),O=i(2636),d=i(8e3),j=i(2397),w=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.En=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.En),this.En.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return l(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.An("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.An("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.An("GET",t);return this.Pt(t)}Pt(g){var b,p;return l(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),l=yield this.Gt(g);let o=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).urlConfig.endpoint===S.Endpoint.Qe&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),I(g,o,s,d),this.En.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(I(g,o,s,"",t),yield this.En.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,i,a));return _&&(g.fallbackUrl=this.En.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!n||n<s||!w.has(null!=(p=null===o||void 0===o?void 0:o.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 ${l}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return l(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();const e=$P({[S.NetworkParam.SdkKey]:n.sdkKey,[S.NetworkParam.SdkType]:u.SDKType.Y(n.sdkKey),[S.NetworkParam.SdkVersion]:d.SDK_VERSION,[S.NetworkParam.Time]:String(Date.now()),[S.NetworkParam.SessionID]:c.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 l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=h.StableID.get(t),n=c.SessionID.get(t),t=u.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(e,i){var t,n,s=(0,a.Lt)();if(this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[S.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}An(t,e){var i=this.En.getActiveFallbackUrl(e.sdkKey,e.urlConfig);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 I(t,e,i,n,s){t.urlConfig.endpoint===S.Endpoint.Qe&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.Mn=e.NetworkFallbackResolver=void 0;const o=i(8809),n=i(1406),r=i(7512),l=i(4534);function a(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,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.Rn=null,this.Wt=null,this.Ei={},this.Cn=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i=null==(i=this.Rn)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.Rn),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.Rn;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.Rn=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.Rn=n,h(t,this.Rn),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.Mi(n):n.fallbackUrls,!!(e=this.Ri(null==(l=this.Rn)?void 0:l[n.endpoint],t))&&(this.Fn(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Fn(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.Rn)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.Rn)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.Rn=$P($P({},this.Rn),{[e]:i}),h(t,this.Rn)}Mi(r){var l;return u(this,void 0,void 0,function*(){var t=this.Ei[r.endpoint];if(t&&Date.now()<t)return null;this.Ei[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.kn)(null!=(l=this.Cn)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}Ri(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.Mn=a},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),l=i(4534),o=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,l.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.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),l=i(8023),o={};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==o[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=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 o.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,l.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.firstInstance||(i.firstInstance=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 s="statsig::config_exposure",r="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===r||t===s,e.ee=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),u(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.te=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),u(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Zt=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),u("statsig::layer_exposure",t,e.details,o,l)};const l=(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.5.0";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 l=i(7512),o=i(6634),s="default";function r(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({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.le)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.ue=function(t,e,i){return r(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({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.ie=u},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 l=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:r,u=o;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=>{o=t,u=t},Bt:t=>{u=t?r:o}},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)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(7410),r={[s.Endpoint.Qe]:"i",[s.Endpoint.Di]:"e",[s.Endpoint.Ai]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},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 l=n,o=!1;e.Ot=()=>l===n,e.Ut=()=>o,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(o=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{o=!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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(7410),e),s(i(7023),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(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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 l=r.currentScript.getAttribute("src"),o=null==(t=s.location)?void 0:t.href;if(l&&o){var u=new URL(l,o).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 l=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(7262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.xi=new o.UrlConfiguration(o.Endpoint.Qe,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.xi,data:n,retries:2,isStatsigEncodable:!0,priority:s});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,l,o,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=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.o)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.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 o.default(t),this.Ie=(0,l.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=(l.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&&(l.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),l.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),l.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:l.StatsigSession.get(this.S),stableID:l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,l.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 l.Storage.isReady()||(yield l.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=>{l.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,l.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&l.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 l 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=l},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 d=i(6914),s=i(759),r=i(1807),v=1048576;function l(t,e){new o(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){l(t,this.options)}},e.runStatsigSessionReplay=l;class o{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,d.Mt)()||((t=(0,d.o)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.Re=this.Ne(),this.Ce=new s.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(),d.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,d.lt)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof o&&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;var i,e=(0,r.Ii)(t,10485760);10485760<e?d.Log.warn(`SessionReplay event is too large (~${e} bytes) and will not be logged`,t):(i=(0,r.Ii)(this.Ee,10240),this.Ee.push(t),i+e<10240||((0,d.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()||(d.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(),d.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.Ee.length&&null!=this.ke&&this.qe()}Ue(e){0!==this.Ee.length&&null!=this.ke&&(e=(0,d.Ut)()?"is_leaving_page":e,this.Re.then(t=>this.ze(t,e)).catch(t=>{this.Wt.logError("SR::flush",t)}))}ze(e,i){var n=this.ke;if(null!==n&&0!==this.Ee.length){var s,r,l,o=JSON.stringify(this.Ee),u=function(e){var i=[];for(let t=0;t<e.length;t+=v)i.push(e.slice(t,t+v));return i}(o),a=1<u.length?(0,d.getUUID)():null;for(let t=0;t<u.length;t++){var c=u[t],h=function(t,e,i,n){n={session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:t,rrweb_payload_size:String(e.length),session_replay_sdk_version:d.SDK_VERSION};return{eventName:"statsig::session_recording",value:i,metadata:n}}(c,o,e,n);null!=a&&(s=h.metadata,r=t,l=u.length,c=c.length,s.sliced_id=a,s.slice_index=String(r),s.slice_count=String(l),s.slice_byte_size=String(c)),i&&(h.metadata[i]="true"),this.De.logEvent(h),null!=a&&this.De.flush().catch(t=>{d.Log.error(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=o},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}}},1807:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.Ii=void 0;o.Ii=(e,i)=>{let n=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((n=(n+=r.length)+("object"==typeof l&&null!==l?(0,o.Ii)(l,i)+2:String(l).length+1))>=i)return n}return n}},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 l=s(3447);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new l.SessionReplay(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,o=>(()=>{"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=o},1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(7512);i.l=()=>__STATSIG__||u,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},2137:(t,e,i)=>{$Q(e),e.o=e.u=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.u=n,e.o=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),l=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.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,r.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,r.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(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)})}A(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(r,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.N(r,l)&&(t=r.data);var e=yield this.R(t,l,o);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,s),this.U(e,s),s})}C(){return null!=this.O?this.O:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}};class n{constructor(){this.K={}}get(t,e){var t=this.K[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=o(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(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 l(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={q:t=>n.get(t),B:t=>{l(t,s({},i,"overall"))},V:(t,e,i)=>{l(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{l(t,s(e,i,"initialize","network_request"))},$:(t,e)=>{l(t,s(e,"end","initialize","network_request"))},W:t=>{l(t,s({},i,"initialize","process"))},H:(t,e)=>{l(t,s(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(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.X(n)}},tt(t,e,i,n){var s=r.Diagnostics.q(i);null==s||s.length<=0||(r.Diagnostics.Y(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.et=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",l=["i","e","d"],o=200;e.et=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.ErrorBoundary=class{constructor(t,e,i){this.O=t,this.m=e,this.nt=i,this.it=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.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e,i=l||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.it.has(s)||(this.it.add(s),null!=(t=null==(t=this.m)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.nt)&&t.call(this,{name:"error",error:l,tag:r}):(t=u.SDKType.lt(this.O),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.m)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.nt)&&n.call(this,{name:"error",error:l,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),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(1881),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,u.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return n(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,u.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(t){var e,i;return n(this,void 0,void 0,function*(){if(this.bt)return this.Nt(t),!1;try{return((0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(i=null==(e=this.m)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.Pt(t):yield this.Ct(t)).success?(this.nt({name:"logs_flushed",events:t}),!0):(l.Log.warn("Failed to flush events."),this.Nt(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return n(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.O].Et!==e?clearInterval(e):_.ot(this.O)},t);this.Et=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Lt=r.Kt=r.h=void 0;const l=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.Kt=(t,e)=>(0,r.h)(JSON.stringify((0,r.Lt)(t,e)));r.Lt=(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,l.zt)(e)?s[t]=e:s[t]=(0,r.Lt)(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=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const o=i(1845),y=i(8962),m=i(7512),S=i(7410),n=i(308),u=i(5902),a=i(6830),c=i(4143),h=i(9122),O=i(2636),d=i(8e3),j=i(2397),w=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.Vt=1e4,this.Jt={},this.m={},this.$t=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return l(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(g){var b,p;return l(this,void 0,void 0,function*(){if(!T(g))return null;if(this.Jt.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.Vt}ms expired.`)},this.Vt),l=yield this.Xt(g);let o=null;var u,a=(0,j.Rt)();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).urlConfig.endpoint===S.Endpoint.qt&&y.Diagnostics.J(_.sdkKey,{attempt:u}),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),I(g,o,s,d),this.Wt.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(I(g,o,s,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,i,a));return _&&(g.fallbackUrl=this.Wt.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!n||n<s||!w.has(null!=(p=null===o||void 0===o?void 0:o.status)?p:500)?(null!=(p=this.nt)&&p.call(this,{name:"error",error:t,tag:O.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${l}.`,i,t),null):this.Zt($P($P({},g),{retries:n,attempt:s+1}))}})}Xt(n){var s;return l(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();const e=$P({[S.NetworkParam.SdkKey]:n.sdkKey,[S.NetworkParam.SdkType]:u.SDKType.lt(n.sdkKey),[S.NetworkParam.SdkVersion]:d.SDK_VERSION,[S.NetworkParam.Time]:String(Date.now()),[S.NetworkParam.SessionID]:c.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(s,r){return l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=h.StableID.get(t),n=c.SessionID.get(t),t=u.SDKType.lt(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,s=(0,a.te)();if(this.m.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[S.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);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 I(t,e,i,n,s){t.urlConfig.endpoint===S.Endpoint.qt&&y.Diagnostics.$(t.sdkKey,y.Diagnostics.Z(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=i(8809),n=i(1406),r=i(7512),l=i(4534);function a(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,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ne=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(r){var l;return u(this,void 0,void 0,function*(){var t=this.ie[r.endpoint];if(t&&Date.now()<t)return null;this.ie[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(l=this.re)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.ee=a},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={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?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),l=i(4534),o=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.o)(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,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.L)(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),l=i(8023),o={};function u(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=u(e);try{(0,r.L)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=u(t);return(0,r.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=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.ve=null,this.fe={};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._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.pe=new u.EventLogger(t,r,i,n),this.$t=new o.ErrorBoundary(t,n,r),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),s=t,r=this,(0,c.kt)()||(i=(0,l.l)(),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.firstInstance||(i.firstInstance=r),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[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.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.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.Oe=e.je=e.Se=e.xt=void 0;const s="statsig::config_exposure",r="statsig::gate_exposure",u="statsig::layer_exposure",a=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.xt=({eventName:t})=>t===r||t===s||t===u,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),a(u,t,e.details,o,l)};const l=(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.6.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.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(7512),o=i(6634),s="default";function r(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({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Me)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return r(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=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.ke=function(t,e,i,n){return $P($P({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.we=u},1812:(t,e)=>{$Q(e)},8578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(1406),s=i(7512);e.T=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.Kt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=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 l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:r,u=o;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.ge(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),ge:t=>{o=t,u=t},_e:t=>{u=t?r:o}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(7512);e.P=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.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=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)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(7410),r={[s.Endpoint.qt]:"i",[s.Endpoint.jt]:"e",[s.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(6830);const n="foreground",s="background",r=[];let l=n,o=!1;e.xe=()=>l===n,e.Rt=()=>o,e.It=t=>{r.unshift(t)};e.Ae=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(o=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(s)),(0,i.he)("beforeunload",()=>{o=!0,(0,e.Ae)(s)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(7410),e),s(i(7023),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(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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.te)(),r=(0,v.de)();if(s&&r&&r.currentScript){var l=r.currentScript.getAttribute("src"),o=null==(t=s.location)?void 0:t.href;if(l&&o){var u=new URL(l,o).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.te)();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.Gt)()||"",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.Ne=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(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.Kt)({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.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,s.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source)&&i.user&&this.ze(e,i),!0)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=s.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(7262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new o.UrlConfiguration(o.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.P)(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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,retries:2,isStatsigEncodable:!0,priority:s});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.Ne)(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.$e=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.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,l,o,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(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=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),r=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(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 o.default(t),this.He=(0,l.T)(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.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){this.Xe(t);t=this.dataAdapter.getDataSync(this.He),this.We.setValues(t,this.He),this.Qe(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Xe(i);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.He){let t=!1;null!=e&&(l.Diagnostics.W(this.O),t=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:t})),this.Qe(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.V(this.O,t,this.We.getCurrentSourceDetails()),l.Diagnostics.tt(this.He,this.pe,this.O,this.m)}})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,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,l.Ie)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.He,i);const r=(0,l.Te)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.ye(e,(0,l.Oe)(this.He,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.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.$e)(this,i,e)}}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return s(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=(0,l.T)(t,this.m);t=null==(t=this.He.customIDs)?void 0:t.stableID;t&&l.StableID.setOverride(t,this.O)}}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 l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(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)}R(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.ht)?void 0:s.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},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 d=i(6914),s=i(759),r=i(1807),v=1048576;function l(t,e){new o(t,e)}e.StatsigSessionReplayPlugin=class{constructor(t){this.options=t,this.__plugin="session-replay"}bind(t){l(t,this.options)}},e.runStatsigSessionReplay=l;class o{constructor(t,e){this.tn=t,this.m=e,this.ti=null,this.ei=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.$t=t,this.$t.wrap(this),(0,d.kt)()||((t=(0,d.l)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.ii=this.ni(),this.si=new s.SessionReplayClient,this.tn.$on("pre_shutdown",()=>this.ri()),this.tn.$on("values_updated",()=>{var t;return this.li(null==(t=this.m)?void 0:t.forceRecording)}),this.tn.on("session_expired",()=>{this.si.stop(),d.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.oi("session_expired"),this.ii=this.ni()}),this.ui(),this.li(null==(t=this.m)?void 0:t.forceRecording)}ui(){const i=this.tn.getContext()["sdkKey"];(0,d.It)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof o&&e.ai(t)})}forceStartRecording(){this.li(!0)}ai(t){"background"===t&&(this.oi(),this.tn.flush().catch(t=>{this.$t.logError("SR::visibility",t)}))}ci(t,e){this.ti=e;var i,e=(0,r.hi)(t,10485760);10485760<e?d.Log.warn(`SessionReplay event is too large (~${e} bytes) and will not be logged`,t):(i=(0,r.hi)(this.ei,10240),this.ei.push(t),i+e<10240||((0,d.xe)()?this.di():this.oi()))}li(t=!1){var e=this.tn.getContext().values;t||!0===(null==e?void 0:e.can_record_session)?this.si.isRecording()||(d.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.si.record((t,e)=>this.ci(t,e),null!=(e=null==(t=this.m)?void 0:t.rrwebConfig)?e:{})):this.ri()}ri(){this.si.stop(),d.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.ei.length&&null!=this.ti&&this.di()}oi(e){0!==this.ei.length&&null!=this.ti&&(e=(0,d.Rt)()?"is_leaving_page":e,this.ii.then(t=>this.vi(t,e)).catch(t=>{this.$t.logError("SR::flush",t)}))}vi(e,i){var n=this.ti;if(null!==n&&0!==this.ei.length){var s,r,l,o=JSON.stringify(this.ei),u=function(e){var i=[];for(let t=0;t<e.length;t+=v)i.push(e.slice(t,t+v));return i}(o),a=1<u.length?(0,d.getUUID)():null;for(let t=0;t<u.length;t++){var c=u[t],h=function(t,e,i,n){n={session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:t,rrweb_payload_size:String(e.length),session_replay_sdk_version:d.SDK_VERSION};return{eventName:"statsig::session_recording",value:i,metadata:n}}(c,o,e,n);null!=a&&(s=h.metadata,r=t,l=u.length,c=c.length,s.sliced_id=a,s.slice_index=String(r),s.slice_count=String(l),s.slice_byte_size=String(c)),i&&(h.metadata[i]="true"),this.tn.logEvent(h),null!=a&&this.tn.flush().catch(t=>{d.Log.error(t)})}this.ei=[]}}di(){this.ii=this.ni(),this.oi()}ni(){return n(this,void 0,void 0,function*(){return this.tn.getContext().session.data.sessionID})}}e.SessionReplay=o},759:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(3331),s=i(6914);e.SessionReplayClient=class{constructor(){this.fi=null,this._i=null,this.gi=0}record(i,t,e){null==(0,s.de)()||(this.fi=null,this._i=null,this.gi=0,this.bi=e,this.pi)||(this.pi=(e=t=>{var e;null==this.fi&&(this.fi=t.timestamp),this._i=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.gi++,i(t,{startTime:this.fi,endTime:this._i,clickCount:this.gi}),144e5<this._i-this.fi&&(null!=(e=this.pi)&&e.call(this),this.bi)&&this.bi()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.pi&&(this.pi(),this.pi=void 0)}isRecording(){return null!=this.pi}}},1807:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.hi=void 0;o.hi=(e,i)=>{let n=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((n=(n+=r.length)+("object"==typeof l&&null!==l?(0,o.hi)(l,i)+2:String(l).length+1))>=i)return n}return n}},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 l=s(3447);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new l.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)=>{var i;$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0;const r=e(7512);n.o=()=>__STATSIG__||u,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&r.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var s="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=l[s])?i:e[s])?i:o[s])?i:{instance:n.t};l[s]=u,e[s]=u,o[s]=u},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),l=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*(){l.Storage.isReady()||(yield l.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,l,o){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,l)&&(t=s.data);var e=yield this.N(t,l,o);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,l);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,l)}e=this.T(l);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=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,l.F)(this.O))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.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=o(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function o(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 l(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=>{l(t,r({},n,"overall"))},mn:(t,e,n)=>{l(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},bn:(t,e)=>{l(t,r(e,n,"initialize","network_request"))},pn:(t,e)=>{l(t,r(e,"end","initialize","network_request"))},yn:t=>{l(t,r({},n,"initialize","process"))},On:(t,e)=>{l(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.kn=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",l=["i","e","d"],o=200;e.kn=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var n=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const i=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.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,l){try{i.Log.warn("Caught error in "+s,{error:l});n(this,void 0,void 0,function*(){var t,e,n=l||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:l,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)(o.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:l,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),l=n(7512),o=n(7410),u=n(6830),a=n(1637),c=n(4534),h=n(1881),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.ki=new h.UrlConfiguration(o.Endpoint.Di,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}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):(l.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return l.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},urlConfig:this.ki,retries:3,isCompressable:!0,params:{[o.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){l.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(()=>{l.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));l.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 l=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,l.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=e.Endpoint=void 0,e.Endpoint={Qe:"initialize",Di:"rgstr",Ai:"download_config_specs"},e.NetworkDefault={[e.Endpoint.Di]:"https://prodregistryv2.org/v1",[e.Endpoint.Qe]:"https://featureassets.org/v1",[e.Endpoint.Ai]:"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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const o=n(1845),m=n(8962),y=n(7512),O=n(7410),i=n(308),u=n(5902),a=n(6830),c=n(4143),h=n(9122),j=n(2636),d=n(8e3),S=n(2397),w=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.En=new i.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.En),this.En.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return l(this,void 0,void 0,function*(){var t,e,n;return!!T(i)&&(e=this.An("POST",i),t=yield this.Nt(e,i.data),e=yield this.Gt(e),(n=navigator).sendBeacon.bind(n)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.An("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.An("GET",t);return this.Pt(t)}Pt(g){var p,b;return l(this,void 0,void 0,function*(){if(!T(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),l=yield this.Gt(g);let o=null;var u,a=(0,S.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).urlConfig.endpoint===O.Endpoint.Qe&&m.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(p=this.Rt.networkOverrideFunc)?p:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),k(g,o,r,d),this.En.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(k(g,o,r,"",t),yield this.En.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,n,a));return _&&(g.fallbackUrl=this.En.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!i||i<r||!w.has(null!=(b=null===o||void 0===o?void 0:o.status)?b:500)?(null!=(b=this.B)&&b.call(this,{name:"error",error:t,tag:j.ErrorTag.NetworkError,requestArgs:g}),y.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.Pt($P($P({},g),{retries:i,attempt:r+1}))}})}Gt(i){var r;return l(this,void 0,void 0,function*(){var t=null!=(r=i.fallbackUrl)?r:i.urlConfig.getUrl();const e=$P({[O.NetworkParam.SdkKey]:i.sdkKey,[O.NetworkParam.SdkType]:u.SDKType.Y(i.sdkKey),[O.NetworkParam.SdkVersion]:d.SDK_VERSION,[O.NetworkParam.Time]:String(Date.now()),[O.NetworkParam.SessionID]:c.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 l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,n=h.StableID.get(t),i=c.SessionID.get(t),t=u.SDKType.Y(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:t,fallbackUrl:e})}))})}Ct(e,n){var t,i,r=(0,a.Lt)();if(this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==r||!r.btoa)return n;try{var s=null!=(t=r.btoa(n).split("").reverse().join(""))?t:n;return e.params=$P($P({},null!=(i=e.params)?i:{}),{[O.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return y.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),n}}An(t,e){var n=this.En.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:n})}};const T=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1);function k(t,e,n,i,r){t.urlConfig.endpoint===O.Endpoint.Qe&&m.Diagnostics.pn(t.sdkKey,m.Diagnostics.wn(e,n,i,r))}},308:function(t,e,n){var u=this&&this.__awaiter||$A();$Q(e),e.Mn=e.NetworkFallbackResolver=void 0;const o=n(8809),i=n(1406),s=n(7512),l=n(4534);function a(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,i.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.Rn=null,this.Wt=null,this.Ei={},this.Cn=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var n=null==(n=this.Rn)?void 0:n[e.endpoint];n&&(n.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.Rn),{[e.endpoint]:n})))}getActiveFallbackUrl(t,e){var n;let i=this.Rn;null==i&&(i=null!=(r=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return s.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.Rn=i);var r=i[e.endpoint];return!r||Date.now()>(null!=(n=r.expiryTime)?n:0)?(delete i[e.endpoint],this.Rn=i,h(t,this.Rn),null):r.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(n,i,r,s){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(r,s)?(t=null==i.customUrl&&null==i.fallbackUrls?yield this.Mi(i):i.fallbackUrls,!!(e=this.Ri(null==(l=this.Rn)?void 0:l[i.endpoint],t))&&(this.Fn(n,i.endpoint,e),!0)):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Fn(t,e,n){var n={url:n,expiryTime:Date.now()+6048e5,previous:[]},i=null==(i=this.Rn)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.Rn)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.Rn=$P($P({},this.Rn),{[e]:n}),h(t,this.Rn)}Mi(s){var l;return u(this,void 0,void 0,function*(){var t=this.Ei[s.endpoint];if(t&&Date.now()<t)return null;this.Ei[s.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.kn)(null!=(l=this.Cn)?l:fetch),n=d(s.defaultUrl);for(const r of t)if(r.startsWith(s.endpointDnsKey+"=")){var i=r.split("=");if(1<i.length){let t=i[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+n)}}return e})}Ri(t,e){var n;if(null==e)return null;var i=new Set(null!=(n=null==t?void 0:t.previous)?n:[]),r=null==t?void 0:t.url;let s=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!i.has(o)&&l!==r){s=l;break}}return s}},e.Mn=a},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),l=n(4534),o=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,l.F)(t)}(t);var n=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,l.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),l=n(8023),o={};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==o[e]){let t=function(t){t=u(t);return(0,s.F)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const l=n(1845),o=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 o.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,l.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.firstInstance||(n.firstInstance=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 r="statsig::config_exposure",s="statsig::gate_exposure",u=(t,e,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===s||t===r,e.ee=(t,e)=>{var n,i={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(i.configVersion=e.__evaluation.version),u(s,t,e.details,i,null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[])},e.te=(t,e)=>{var n,i={config:e.name,ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(i.configVersion=e.__evaluation.version),null!=(null==(n=e.__evaluation)?void 0:n.passed)&&(i.rulePassed=String(e.__evaluation.passed)),u(r,t,e.details,i,null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[])};e.Zt=(t,e,n)=>{var i=e.__evaluation,r=!0===(null==(r=null==i?void 0:i.explicit_parameters)?void 0:r.includes(n));let s="",l=null!=(o=null==i?void 0:i.undelegated_secondary_exposures)?o:[];r&&(s=null!=(o=i.allocated_experiment_name)?o:"",l=i.secondary_exposures);var o={config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(o.configVersion=e.__evaluation.version),u("statsig::layer_exposure",t,e.details,o,l)};const l=(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.5.0";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 l=n(7512),o=n(6634),r="default";function s(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({},s(t,e,n,i)),{get:u(t,null==n?void 0:n.value)})}function u(i,r,s){return(t,e)=>{var n=null!=(n=null==r?void 0:r[t])?n:null;return null==n?null!=e?e:null:null==e||(0,o.le)(n,e)?(null!=s&&s(t),n):(l.Log.warn(`Parameter type mismatch. '${i}.${t}' was found to be type '${typeof n}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.ue=function(t,e,n){return s(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({},s(t,e,n,void 0)),{get:u(t,null==n?void 0:n.value,i),groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(t=null==n?void 0:n.value)?t:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:u(t.name,n,i)})},e.ie=u},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 l=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:s,u=o;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=>{o=t,u=t},Bt:t=>{u=t?s:o}},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)})}},1881:(t,e,n)=>{$Q(e),e.UrlConfiguration=void 0;const r=n(7410),s={[r.Endpoint.Qe]:"i",[r.Endpoint.Di]:"e",[r.Endpoint.Ai]:"d"};e.UrlConfiguration=class{constructor(t,e,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=s[t],e&&(this.customUrl=e),!e&&n&&(this.customUrl=n+"/"+t),i&&(this.fallbackUrls=i);e=r.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},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 l=i,o=!1;e.Ot=()=>l===i,e.Ut=()=>o,e.lt=t=>{s.unshift(t)};e.ve=e=>{e!==l&&(l=e,s.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(o=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(r)),(0,n.zt)("beforeunload",()=>{o=!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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(7410),e),r(n(7023),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(1098),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(1881),e),r(n(8023),e),r(n(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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 l=s.currentScript.getAttribute("src"),o=null==(t=r.location)?void 0:t.href;if(l&&o){var u=new URL(l,o).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 l=this&&this.__awaiter||$A();$Q(e);const o=n(6914),u=n(7262);class i extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.xi=new o.UrlConfiguration(o.Endpoint.Qe,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(n,i,r,s){return l(this,void 0,void 0,function*(){var t=i?(0,o.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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.xi,data:i,retries:2,isStatsigEncodable:!0,priority:r});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),p={disableExposureLog:!0};function b(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,l,o,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,b(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,m(c=(o=v).getDynamicConfig(h.config_name,p).get(h.param_name),u)?u:(b(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,m(l=(c=v).getExperiment(u.experiment_name,p).get(u.param_name),a)?a:(b(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,i=e,r=_,m(s=(n=v).getLayer(l.layer_name,p).get(l.param_name),i)?i:(b(r)&&n.getLayer(l.layer_name).get(l.param_name),s);default:return e}}}},8198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const l=n(6914),o=n(4845),u=n(8448),s=n(3583),a=n(4131);class i extends l.StatsigClientBase{static instance(t){var e=(0,l.o)().instance(t);return e instanceof i?e:(l.Log.warn((0,l.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){l.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 o.default(t),this.Ie=(0,l.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=(l.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&&(l.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),l.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),l.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:l.StatsigSession.get(this.S),stableID:l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Xt(e,(0,l.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 l.Storage.isReady()||(yield l.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=>{l.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,l.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&l.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 l 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=l},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 l(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){s(t)}},e.runStatsigAutoCapture=s;class l{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,l;if(!this.In[t]){var o=this.ci();try{var u=$P({sessionID:o.data.sessionID,page_url:null!=(l=null==(s=null==(r=(0,c.Lt)())?void 0:r.location)?void 0:s.href)?l:""},n),a=(null!=i&&i.addNewSessionMetadata&&(u.isNewSession=String(this.hi(o))),{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=l},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 l(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 o(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=l,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")),o(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim(),e=l(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(o(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){}o=s,l=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(o),o=o.searchParams.get("yahoo"===l?"p":"q")||"";var l={searchEngine:l,searchQuery:o},o=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({},l),o),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==(l=null==n?void 0:n.screen)?void 0:l.width)||"unknown",screen_height:(null==(o=null==n?void 0:n.screen)?void 0:o.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 l=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new l.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)=>{var i;$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.l=void 0;const r=e(7512);n.l=()=>__STATSIG__||u,n.i=t=>(0,n.l)()[t];n.t=t=>{var e=(0,n.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&r.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var s="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=l[s])?i:e[s])?i:o[s])?i:{instance:n.t};l[s]=u,e[s]=u,o[s]=u},2137:(t,e,n)=>{$Q(e),e.o=e.u=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.u=i,e.o=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),l=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.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new i}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,s.T)(t,this.m),e=this.k(t),n=this.S.get(e,t);return n||((n=this.I(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,s.T)(e,this.m),n=this.k(e);this.S.add(n,h("Bootstrap",t,null,e))}D(e,n,i){return r(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.M(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)})}A(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.T)(n,this.m),e=this.k(t),t=yield this.D(null,t,i);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(s,l,o){return r(this,void 0,void 0,function*(){let t=null;s&&this.N(s,l)&&(t=s.data);var e=yield this.R(t,l,o);if(!e)return u.Log.debug("No response returned for latest value"),null;var n=(0,c.P)(e,"has_updates","Response"),i=this.C(),i=a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=h("Network",e,i,l);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,l)}e=this.k(l);return this.S.add(e,r),this.U(e,r),r})}C(){return null!=this.O?this.O:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}};class i{constructor(){this.K={}}get(t,e){var t=this.K[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=o(this.K,9);n&&delete this.K[n],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(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 l(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={q:t=>i.get(t),B:t=>{l(t,r({},n,"overall"))},V:(t,e,n)=>{l(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},J:(t,e)=>{l(t,r(e,n,"initialize","network_request"))},$:(t,e)=>{l(t,r(e,"end","initialize","network_request"))},W:t=>{l(t,r({},n,"initialize","process"))},H:(t,e)=>{l(t,r(e,"end","initialize","process"))},Y:t=>{i.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(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.X(i)}},tt(t,e,n,i){var r=s.Diagnostics.q(n);null==r||r.length<=0||(s.Diagnostics.Y(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.et=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",l=["i","e","d"],o=200;e.et=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var n=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const i=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.ErrorBoundary=class{constructor(t,e,n){this.O=t,this.m=e,this.nt=n,this.it=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.rt(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}rt(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.st(e,t)):n}catch(t){return this.st(e,t),null}}st(s,l){try{i.Log.warn("Caught error in "+s,{error:l});n(this,void 0,void 0,function*(){var t,e,n=l||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.it.has(r)||(this.it.add(r),null!=(t=null==(t=this.m)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.nt)&&t.call(this,{name:"error",error:l,tag:s}):(t=u.SDKType.lt(this.O),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.m)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.nt)&&i.call(this,{name:"error",error:l,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),l=n(7512),o=n(7410),u=n(6830),a=n(1637),c=n(4534),h=n(1881),d=n(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,n,i){this.O=t,this.nt=e,this.ht=n,this.m=i,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==i?void 0:i.disableLogging),this.yt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;e=null==i?void 0:i.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,u.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return i(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,u.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.u)(this.O,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID,n.allocatedExperiment,n.parameterName,String(n.isExplicitParameter),n.reason].join("|"),e=this.vt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=n}return!0}At(t){var e,n;return i(this,void 0,void 0,function*(){if(this.bt)return this.Nt(t),!1;try{return((0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(n=null==(e=this.m)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.Pt(t):yield this.Ct(t)).success?(this.nt({name:"logs_flushed",events:t}),!0):(l.Log.warn("Failed to flush events."),this.Nt(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}Pt(t){return i(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const n=this.o();i(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(n);t&&(e===f.Startup&&c.Storage.removeItem(n),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(n)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.Ft(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));l.Log.debug("Enqueued Event:",n),this.dt.push(n)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.O].Et!==e?clearInterval(e):_.ot(this.O)},t);this.Et=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.Lt=s.Kt=s.h=void 0;const l=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.Kt=(t,e)=>(0,s.h)(JSON.stringify((0,s.Lt)(t,e)));s.Lt=(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,l.zt)(e)?r[t]=e:r[t]=(0,s.Lt)(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=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const o=n(1845),m=n(8962),y=n(7512),O=n(7410),i=n(308),u=n(5902),a=n(6830),c=n(4143),h=n(9122),j=n(2636),d=n(8e3),S=n(2397),w=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.Vt=1e4,this.Jt={},this.m={},this.$t=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new i.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return l(this,void 0,void 0,function*(){var t,e,n;return!!T(i)&&(e=this.Ht("POST",i),t=yield this.Yt(e,i.data),e=yield this.Xt(e),(n=navigator).sendBeacon.bind(n)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(g){var p,b;return l(this,void 0,void 0,function*(){if(!T(g))return null;if(this.Jt.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.Vt}ms expired.`)},this.Vt),l=yield this.Xt(g);let o=null;var u,a=(0,S.Rt)();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).urlConfig.endpoint===O.Endpoint.qt&&m.Diagnostics.J(_.sdkKey,{attempt:u}),null!=(p=this.Jt.networkOverrideFunc)?p:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),k(g,o,r,d),this.Wt.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(k(g,o,r,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,n,a));return _&&(g.fallbackUrl=this.Wt.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!i||i<r||!w.has(null!=(b=null===o||void 0===o?void 0:o.status)?b:500)?(null!=(b=this.nt)&&b.call(this,{name:"error",error:t,tag:j.ErrorTag.NetworkError,requestArgs:g}),y.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.Zt($P($P({},g),{retries:i,attempt:r+1}))}})}Xt(i){var r;return l(this,void 0,void 0,function*(){var t=null!=(r=i.fallbackUrl)?r:i.urlConfig.getUrl();const e=$P({[O.NetworkParam.SdkKey]:i.sdkKey,[O.NetworkParam.SdkType]:u.SDKType.lt(i.sdkKey),[O.NetworkParam.SdkVersion]:d.SDK_VERSION,[O.NetworkParam.Time]:String(Date.now()),[O.NetworkParam.SessionID]:c.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Yt(r,s){return l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,n=h.StableID.get(t),i=c.SessionID.get(t),t=u.SDKType.lt(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:t,fallbackUrl:e})}))})}Qt(e,n){var t,i,r=(0,a.te)();if(this.m.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==r||!r.btoa)return n;try{var s=null!=(t=r.btoa(n).split("").reverse().join(""))?t:n;return e.params=$P($P({},null!=(i=e.params)?i:{}),{[O.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return y.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),n}}Ht(t,e){var n=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:n})}};const T=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1);function k(t,e,n,i,r){t.urlConfig.endpoint===O.Endpoint.qt&&m.Diagnostics.$(t.sdkKey,m.Diagnostics.Z(e,n,i,r))}},308:function(t,e,n){var u=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=n(8809),i=n(1406),s=n(7512),l=n(4534);function a(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,i.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var n=null==(n=this.ne)?void 0:n[e.endpoint];n&&(n.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:n})))}getActiveFallbackUrl(t,e){var n;let i=this.ne;null==i&&(i=null!=(r=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return s.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.ne=i);var r=i[e.endpoint];return!r||Date.now()>(null!=(n=r.expiryTime)?n:0)?(delete i[e.endpoint],this.ne=i,h(t,this.ne),null):r.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(n,i,r,s){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(r,s)?(t=null==i.customUrl&&null==i.fallbackUrls?yield this.se(i):i.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[i.endpoint],t))&&(this.oe(n,i.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,n){var n={url:n,expiryTime:Date.now()+6048e5,previous:[]},i=null==(i=this.ne)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.ne)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.ne=$P($P({},this.ne),{[e]:n}),h(t,this.ne)}se(s){var l;return u(this,void 0,void 0,function*(){var t=this.ie[s.endpoint];if(t&&Date.now()<t)return null;this.ie[s.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(l=this.re)?l:fetch),n=d(s.defaultUrl);for(const r of t)if(r.startsWith(s.endpointDnsKey+"=")){var i=r.split("=");if(1<i.length){let t=i[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+n)}}return e})}le(t,e){var n;if(null==e)return null;var i=new Set(null!=(n=null==t?void 0:t.previous)?n:[]),r=null==t?void 0:t.url;let s=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!i.has(o)&&l!==r){s=l;break}}return s}},e.ee=a},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={lt:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},ue(t,e){n[t]=e},ae(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.Gt=i.ce=i.he=i.kt=i.de=i.te=void 0;i.te=()=>"undefined"!=typeof window?window:null,i.de=()=>{var t=(0,i.te)();return null!=(t=null==t?void 0:t.document)?t:null},i.kt=()=>{var t;return null===(0,i.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.he=(t,e)=>{var n=(0,i.te)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.ce=(t,e)=>{var n=(0,i.de)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.Gt=()=>{var t;try{return null==(t=(0,i.te)())?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),l=n(4534),o=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.o)(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,l.G)(t)}(t);var n=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,l.L)(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),l=n(8023),o={};function u(t){return"statsig.stable_id."+(0,i.o)(t)}function a(t,e){e=u(e);try{(0,s.L)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=u(t);return(0,s.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const l=n(1845),o=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.ve=null,this.fe={};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._e(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&d.Storage.ge(i.storageProvider),this.O=t,this.m=null!=i?i:{},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.pe=new u.EventLogger(t,s,n,i),this.$t=new o.ErrorBoundary(t,i,s),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),n.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.storageProvider=d.Storage,this.be(),r=t,s=this,(0,c.kt)()||(n=(0,l.l)(),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.firstInstance||(n.firstInstance=s),n.instances=e,__STATSIG__=n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[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.$t.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.fe[n.name]&&this.fe[n.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.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.Oe=e.je=e.Se=e.xt=void 0;const r="statsig::config_exposure",s="statsig::gate_exposure",u="statsig::layer_exposure",a=(t,e,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(n,i),secondaryExposures:r,time:Date.now()});e.xt=({eventName:t})=>t===s||t===r||t===u,e.Se=(t,e)=>{var n,i={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(i.configVersion=e.__evaluation.version),a(s,t,e.details,i,null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[])},e.je=(t,e)=>{var n,i={config:e.name,ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(i.configVersion=e.__evaluation.version),null!=(null==(n=e.__evaluation)?void 0:n.passed)&&(i.rulePassed=String(e.__evaluation.passed)),a(r,t,e.details,i,null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[])};e.Oe=(t,e,n)=>{var i=e.__evaluation,r=!0===(null==(r=null==i?void 0:i.explicit_parameters)?void 0:r.includes(n));let s="",l=null!=(o=null==i?void 0:i.undelegated_secondary_exposures)?o:[];r&&(s=null!=(o=i.allocated_experiment_name)?o:"",l=i.secondary_exposures);var o={config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(o.configVersion=e.__evaluation.version),a(u,t,e.details,o,l)};const l=(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.6.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.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=n(7512),o=n(6634),r="default";function s(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({},s(t,e,n,i)),{get:u(t,null==n?void 0:n.value)})}function u(i,r,s){return(t,e)=>{var n=null!=(n=null==r?void 0:r[t])?n:null;return null==n?null!=e?e:null:null==e||(0,o.Me)(n,e)?(null!=s&&s(t),n):(l.Log.warn(`Parameter type mismatch. '${i}.${t}' was found to be type '${typeof n}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.De=i,e.Ie=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.ke=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:u(t,null==n?void 0:n.value,i),groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(t=null==n?void 0:n.value)?t:{}})},e.Te=function(t,e,n,i){return $P($P($P({},t),e),{get:u(t.name,n,i)})},e.we=u},1812:(t,e)=>{$Q(e)},8578:(t,e,n)=>{$Q(e),e.v=e.T=void 0;const i=n(1406),r=n(7512);e.T=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.Kt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.L=n.G=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 l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:s,u=o;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.ge(s),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),ge:t=>{o=t,u=t},_e:t=>{u=t?s:o}},n.G=function(t){return t=n.Storage.getItem(t),JSON.parse(null!=t?t:"null")},n.L=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.P=void 0;const r=n(7512);e.P=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.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=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)})}},1881:(t,e,n)=>{$Q(e),e.UrlConfiguration=void 0;const r=n(7410),s={[r.Endpoint.qt]:"i",[r.Endpoint.jt]:"e",[r.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=s[t],e&&(this.customUrl=e),!e&&n&&(this.customUrl=n+"/"+t),i&&(this.fallbackUrls=i);e=r.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,n)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;n=n(6830);const i="foreground",r="background",s=[];let l=i,o=!1;e.xe=()=>l===i,e.Rt=()=>o,e.It=t=>{s.unshift(t)};e.Ae=e=>{e!==l&&(l=e,s.forEach(t=>t(e)))},(0,n.he)("focus",()=>{(o=!1,e.Ae)(i)}),(0,n.he)("blur",()=>(0,e.Ae)(r)),(0,n.he)("beforeunload",()=>{o=!0,(0,e.Ae)(r)}),(0,n.ce)("visibilitychange",()=>{(0,e.Ae)("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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(7410),e),r(n(7023),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(1098),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(1881),e),r(n(8023),e),r(n(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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.te)(),s=(0,v.de)();if(r&&s&&s.currentScript){var l=s.currentScript.getAttribute("src"),o=null==(t=r.location)?void 0:t.href;if(l&&o){var u=new URL(l,o).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.te)();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.Gt)()||"",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.Ne=void 0;const i=n(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var n;return(e=(0,i.P)(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.Kt)({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.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,r.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var n;return!!t&&null!=(n=(0,r.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==n?void 0:n.has_updates)&&(this.Re=t.data,this.Ue=n.time,this.Fe=t.receivedAt,this.Pe=n,this.Ge=this.Ke(t.source,n),t.source)&&n.user&&this.ze(e,n),!0)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let n=null;return{result:n=t?t[e]||t[(0,r.h)(e)]:n,details:this.Be(null==n)}}ze(t,e){var n,i=r.StableID.get(this.O);(null==(n=t.customIDs)?void 0:n.stableID)!==i?this.Le.add("StableIDMismatch"):"user"in e&&(n=e.user,(0,r.v)(t)!==(0,r.v)(n))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let n=e.reason;var i=null!=(i=e.warnings)?i:[],t=("Bootstrap"===this.Ce&&0<i.length&&(n+=i[0]),"Uninitialized"!==n&&"NoValues"!==n&&(n=n+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(i=this.Ge)?i:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:n})}}},8448:function(t,e,n){var l=this&&this.__awaiter||$A();$Q(e);const o=n(6914),u=n(7262);class i extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new o.UrlConfiguration(o.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(n,i,r,s){return l(this,void 0,void 0,function*(){var t=i?(0,o.P)(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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:i,retries:2,isStatsigEncodable:!0,priority:r});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.Ne)(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.$e=void 0;const g=n(6914),p={disableExposureLog:!0};function b(t){return null==t||!1===t.disableExposureLog}function m(t,e){return null!=e&&!(0,g.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,l,o,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(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,b(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,m(c=(o=v).getDynamicConfig(h.config_name,p).get(h.param_name),u)?u:(b(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,m(l=(c=v).getExperiment(u.experiment_name,p).get(u.param_name),a)?a:(b(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,i=e,r=_,m(s=(n=v).getLayer(l.layer_name,p).get(l.param_name),i)?i:(b(r)&&n.getLayer(l.layer_name).get(l.param_name),s);default:return e}}}},8198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const l=n(6914),o=n(4845),u=n(8448),s=n(3583),a=n(4131);class i extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof i?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){l.SDKType.ue(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 o.default(t),this.He=(0,l.T)(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.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){this.Xe(t);t=this.dataAdapter.getDataSync(this.He),this.We.setValues(t,this.He),this.Qe(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Xe(n);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.He){let t=!1;null!=e&&(l.Diagnostics.W(this.O),t=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:t})),this.Qe(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.V(this.O,t,this.We.getCurrentSourceDetails()),l.Diagnostics.tt(this.He,this.pe,this.O,this.m)}})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.We.getGate(t),i=(0,l.Ee)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.He,e),n=null!=r?r:i;return this.ye(t,(0,l.Se)(this.He,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.We.getConfig(t),i=(0,l.De)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.He,e),n=null!=r?r:i;return this.ye(t,(0,l.je)(this.He,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,l.Ie)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.He,e),n=null!=r?r:i;return this.ye(t,(0,l.je)(this.He,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.We.getLayer(e),i=(0,l.ke)(e,i,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.He,n);const s=(0,l.Te)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.ye(e,(0,l.Oe)(this.He,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.pe.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,s.$e)(this,n,e)}}logEvent(t,e,n){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return r(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=(0,l.T)(t,this.m);t=null==(t=this.He.customIDs)?void 0:t.stableID;t&&l.StableID.setOverride(t,this.O)}}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 l extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.D(t,(0,i.T)(e,this.m),n)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,i.P)(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)}R(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.ht)?void 0:r.fetchEvaluations(this.C(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}k(t){t=(0,i.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=l},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(5423),r=n(6325),s=n(6901),l={submit:i.AutoCaptureEventName.FORM_SUBMIT,click:i.AutoCaptureEventName.CLICK};function o(t,e){return new u(t,e)}e.StatsigAutoCapturePlugin=class{constructor(t){this.m=t,this.__plugin="auto-capture"}bind(t){o(t,this.m)}},e.runStatsigAutoCapture=o;class u{constructor(t,e){this.tn=t,this.en=Date.now(),this.nn=0,this.rn={},this.sn=null;var{sdkKey:t,errorBoundary:n,values:i}=t.getContext(),i=(this.rn=null!=(i=null==(i=null==i?void 0:i.auto_capture_settings)?void 0:i.disabled_events)?i:{},this.$t=n,this.$t.wrap(this),this.ln=null==e?void 0:e.eventFilterFunc,(0,c.de)());(0,c.kt)()||((e=null!=(n=(__STATSIG__=(0,c.l)()).acInstances)?n:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.qt()):this.qt()}un(){const e=(0,c.te)();var t,n=(0,c.de)();e&&n&&(t=t=>{this.an(t||e.event)},(0,r.cn)(n,"click",t),(0,r.cn)(n,"submit",t),(0,r.cn)(e,"error",t),(0,r.cn)(e,"beforeunload",()=>this.hn()),(0,r.cn)(e,"scroll",()=>this.dn()))}vn(){var t=(0,c.te)(),e=(0,c.de)();t&&e&&((0,r.cn)(t,"popstate",()=>this.fn()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[n,i,r])=>{t.apply(e,[n,i,r]),this.fn()}}),this.fn())}an(t){var e,n=null==(n=t.type)?void 0:n.toLowerCase();"error"===n&&t instanceof ErrorEvent?this._n(t):(e=(0,r.gn)(t))&&(0,r.St)(t,e)&&(t=l[n])&&({value:n,metadata:e}=(0,r.pn)(e),this.bn(t,n,e))}qt(){this.un(),this.vn(),this.mn(),this.yn()}_n(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.bn(i.AutoCaptureEventName.ERROR,t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}mn(){var t=this.On();try{this.jn(t)&&this.bn(i.AutoCaptureEventName.SESSION_START,(0,r.Sn)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.$t.logError("AC::logSession",t)}}fn(){var t=(0,r.wn)(),e=this.sn;e&&t.href===e.href||(this.sn=t,e=(0,s.Tn)(t),this.bn(i.AutoCaptureEventName.PAGE_VIEW,(0,r.Sn)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}yn(){const n=(0,c.te)();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,r.kn)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.bn(i.AutoCaptureEventName.PERFORMANCE,(0,r.Sn)(),t)},1)}hn(){this.bn(i.AutoCaptureEventName.PAGE_VIEW_END,(0,r.Sn)(),{scrollDepth:this.nn,pageViewLength:Date.now()-this.en},{flushImmediately:!0})}bn(t,e,n,i){var r,s,l,o=t.slice("auto_capture::".length);if(!this.rn[t]&&!this.rn[o]){o=this.On();try{var u=$P({sessionID:o.data.sessionID,page_url:null!=(l=null==(s=null==(r=(0,c.te)())?void 0:r.location)?void 0:s.href)?l:""},n),a=(null!=i&&i.addNewSessionMetadata&&(u.isNewSession=String(this.jn(o))),{eventName:t,value:e,metadata:u});this.ln&&!this.ln(a)||(this.tn.logEvent(a),null!=i&&i.flushImmediately&&this.tn.flush().catch(t=>{c.Log.error(t)}))}catch(t){this.$t.logError("AC::enqueue",t)}}}dn(){var t=null!=(t=null==(t=(0,c.de)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.te)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.nn=Math.max(this.nn,Math.min(100,Math.round((n+e)/t*100)))}jn(t){return Math.abs(t.data.startTime-Date.now())<1e3}On(){return this.tn.getContext().session}}e.AutoCapture=u},5423:(t,e)=>{$Q(e),e.AutoCaptureEventName=void 0,e.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click"}},6325:(t,e,n)=>{$Q(e),e.kn=e.cn=e.Sn=e.wn=e.St=e.gn=e.pn=e.In=void 0;const s=n(6914);function l(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 o(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.In=l,e.pn=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.Gt)()||"",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")),o(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim(),e=l(r||t),$P(n,e)),{value:i,metadata:n}},e.gn=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.St=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(o(e))return!0}return!1}},e.wn=function(){var t=null!=(t=null==(t=null==(t=(0,s.te)())?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.Sn=function(){return(0,s.Gt)()||""},e.cn=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)},e.kn=function(){var t=(0,s.te)();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.Tn=void 0;const a=n(6914);e.Tn=function(t){var e=(0,a.de)(),n=(0,a.te)();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){}o=s,l=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(o),o=o.searchParams.get("yahoo"===l?"p":"q")||"";var l={searchEngine:l,searchQuery:o},o=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({},l),o),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==(l=null==n?void 0:n.screen)?void 0:l.width)||"unknown",screen_height:(null==(o=null==n?void 0:n.screen)?void 0:o.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 l=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new l.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)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0;const s=e(512);i.o=()=>__STATSIG__||u,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},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),l=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*(){l.Storage.isReady()||(yield l.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,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,l)&&(t=r.data);var e=yield this.N(t,l,o);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,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.T(l);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=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,l.F)(this.O))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.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=o(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function o(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 l(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=>{l(t,s({},i,"overall"))},mn:(t,e,i)=>{l(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{l(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{l(t,s(e,"end","initialize","network_request"))},yn:t=>{l(t,s({},i,"initialize","process"))},On:(t,e)=>{l(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.kn=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",l=["i","e","d"],o=200;e.kn=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(512),u=e(902),a=e(0),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.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,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e,i=l||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:l,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)(o.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:l,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),l=i(512),o=i(410),u=i(830),a=i(637),c=i(534),h=i(881),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.ki=new h.UrlConfiguration(o.Endpoint.Di,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}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):(l.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return l.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},urlConfig:this.ki,retries:3,isCompressable:!0,params:{[o.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){l.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(()=>{l.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));l.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 l=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,l.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=e.Endpoint=void 0,e.Endpoint={Qe:"initialize",Di:"rgstr",Ai:"download_config_specs"},e.NetworkDefault={[e.Endpoint.Di]:"https://prodregistryv2.org/v1",[e.Endpoint.Qe]:"https://featureassets.org/v1",[e.Endpoint.Ai]:"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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),y=i(962),m=i(512),O=i(410),n=i(308),u=i(902),a=i(830),c=i(143),h=i(122),j=i(636),d=i(0),S=i(397),w=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.En=new n.NetworkFallbackResolver(this.p)}setErrorBoundary(t){this.Wt=t,this.Wt.wrap(this),this.Wt.wrap(this.En),this.En.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return l(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.An("POST",n),t=yield this.Nt(e,n.data),e=yield this.Gt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.An("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.An("GET",t);return this.Pt(t)}Pt(g){var b,p;return l(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),l=yield this.Gt(g);let o=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).urlConfig.endpoint===O.Endpoint.Qe&&y.Diagnostics.bn(_.sdkKey,{attempt:u}),null!=(b=this.Rt.networkOverrideFunc)?b:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),k(g,o,s,d),this.En.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(k(g,o,s,"",t),yield this.En.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,i,a));return _&&(g.fallbackUrl=this.En.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!n||n<s||!w.has(null!=(p=null===o||void 0===o?void 0:o.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t,tag:j.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${l}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return l(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();const e=$P({[O.NetworkParam.SdkKey]:n.sdkKey,[O.NetworkParam.SdkType]:u.SDKType.Y(n.sdkKey),[O.NetworkParam.SdkVersion]:d.SDK_VERSION,[O.NetworkParam.Time]:String(Date.now()),[O.NetworkParam.SessionID]:c.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 l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=h.StableID.get(t),n=c.SessionID.get(t),t=u.SDKType.Y(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Ct(e,i){var t,n,s=(0,a.Lt)();if(this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[O.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}An(t,e){var i=this.En.getActiveFallbackUrl(e.sdkKey,e.urlConfig);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 k(t,e,i,n,s){t.urlConfig.endpoint===O.Endpoint.Qe&&y.Diagnostics.pn(t.sdkKey,y.Diagnostics.wn(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.Mn=e.NetworkFallbackResolver=void 0;const o=i(809),n=i(406),r=i(512),l=i(534);function a(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,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.Rn=null,this.Wt=null,this.Ei={},this.Cn=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.Wt=t}tryBumpExpiryTime(t,e){var i=null==(i=this.Rn)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.Rn),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.Rn;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.Rn=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.Rn=n,h(t,this.Rn),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.Mi(n):n.fallbackUrls,!!(e=this.Ri(null==(l=this.Rn)?void 0:l[n.endpoint],t))&&(this.Fn(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.Wt)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}Fn(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.Rn)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.Rn)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.Rn=$P($P({},this.Rn),{[e]:i}),h(t,this.Rn)}Mi(r){var l;return u(this,void 0,void 0,function*(){var t=this.Ei[r.endpoint];if(t&&Date.now()<t)return null;this.Ei[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.kn)(null!=(l=this.Cn)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}Ri(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.Mn=a},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),l=i(534),o=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,l.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.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),l=i(23),o={};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==o[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const l=i(845),o=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 o.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,l.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.firstInstance||(i.firstInstance=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 s="statsig::config_exposure",r="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===r||t===s,e.ee=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),u(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.te=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),u(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Zt=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),u("statsig::layer_exposure",t,e.details,o,l)};const l=(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.5.0";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 l=i(512),o=i(634),s="default";function r(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({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.le)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.ue=function(t,e,i){return r(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({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.ie=u},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 l=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:r,u=o;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=>{o=t,u=t},Bt:t=>{u=t?r:o}},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)})}},881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(410),r={[s.Endpoint.Qe]:"i",[s.Endpoint.Di]:"e",[s.Endpoint.Ai]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},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 l=n,o=!1;e.Ot=()=>l===n,e.Ut=()=>o,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(o=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{o=!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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(410),e),s(i(404),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(98),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(881),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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 l=this&&this.__awaiter||$A();$Q(e);const o=i(914),u=i(262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.xi=new o.UrlConfiguration(o.Endpoint.Qe,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.xi,data:n,retries:2,isStatsigEncodable:!0,priority:s});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,l,o,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=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(914),o=i(226),u=i(448),r=i(583),a=i(131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.o)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.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 o.default(t),this.Ie=(0,l.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=(l.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&&(l.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),l.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),l.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:l.StatsigSession.get(this.S),stableID:l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.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,l.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,l.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 l.Storage.isReady()||(yield l.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=>{l.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,l.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&l.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 l 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=l},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)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(512);i.l=()=>__STATSIG__||u,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},137:(t,e,i)=>{$Q(e),e.o=e.u=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.u=n,e.o=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),l=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.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,r.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,r.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(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)})}A(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(r,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.N(r,l)&&(t=r.data);var e=yield this.R(t,l,o);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,s),this.U(e,s),s})}C(){return null!=this.O?this.O:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}};class n{constructor(){this.K={}}get(t,e){var t=this.K[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=o(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(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 l(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={q:t=>n.get(t),B:t=>{l(t,s({},i,"overall"))},V:(t,e,i)=>{l(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{l(t,s(e,i,"initialize","network_request"))},$:(t,e)=>{l(t,s(e,"end","initialize","network_request"))},W:t=>{l(t,s({},i,"initialize","process"))},H:(t,e)=>{l(t,s(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(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.X(n)}},tt(t,e,i,n){var s=r.Diagnostics.q(i);null==s||s.length<=0||(r.Diagnostics.Y(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.et=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",l=["i","e","d"],o=200;e.et=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<o&&"="===String.fromCharCode(t)&&l.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,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(512),u=e(902),a=e(0),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");o.ErrorBoundary=class{constructor(t,e,i){this.O=t,this.m=e,this.nt=i,this.it=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.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e,i=l||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.it.has(s)||(this.it.add(s),null!=(t=null==(t=this.m)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.nt)&&t.call(this,{name:"error",error:l,tag:r}):(t=u.SDKType.lt(this.O),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.m)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.nt)&&n.call(this,{name:"error",error:l,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),l=i(512),o=i(410),u=i(830),a=i(637),c=i(534),h=i(881),d=i(397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,u.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return n(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,u.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(t){var e,i;return n(this,void 0,void 0,function*(){if(this.bt)return this.Nt(t),!1;try{return((0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(i=null==(e=this.m)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.Pt(t):yield this.Ct(t)).success?(this.nt({name:"logs_flushed",events:t}),!0):(l.Log.warn("Failed to flush events."),this.Nt(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return n(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.O].Et!==e?clearInterval(e):_.ot(this.O)},t);this.Et=e}}e.EventLogger=_},406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Lt=r.Kt=r.h=void 0;const l=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.Kt=(t,e)=>(0,r.h)(JSON.stringify((0,r.Lt)(t,e)));r.Lt=(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,l.zt)(e)?s[t]=e:s[t]=(0,r.Lt)(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=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/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 l=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),y=i(962),m=i(512),O=i(410),n=i(308),u=i(902),a=i(830),c=i(143),h=i(122),j=i(636),d=i(0),S=i(397),w=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.Vt=1e4,this.Jt={},this.m={},this.$t=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return l(this,void 0,void 0,function*(){var t,e,i;return!!T(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return l(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(g){var b,p;return l(this,void 0,void 0,function*(){if(!T(g))return null;if(this.Jt.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.Vt}ms expired.`)},this.Vt),l=yield this.Xt(g);let o=null;var u,a=(0,S.Rt)();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).urlConfig.endpoint===O.Endpoint.qt&&y.Diagnostics.J(_.sdkKey,{attempt:u}),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(o=yield f(l,v),clearTimeout(t),o.ok)return d=yield o.text(),k(g,o,s,d),this.Wt.tryBumpExpiryTime(g.sdkKey,g.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${l} `+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),_=(k(g,o,s,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(g.sdkKey,g.urlConfig,i,a));return _&&(g.fallbackUrl=this.Wt.getActiveFallbackUrl(g.sdkKey,g.urlConfig)),!n||n<s||!w.has(null!=(p=null===o||void 0===o?void 0:o.status)?p:500)?(null!=(p=this.nt)&&p.call(this,{name:"error",error:t,tag:j.ErrorTag.NetworkError,requestArgs:g}),m.Log.error(`A networking error occured during ${e} request to ${l}.`,i,t),null):this.Zt($P($P({},g),{retries:n,attempt:s+1}))}})}Xt(n){var s;return l(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();const e=$P({[O.NetworkParam.SdkKey]:n.sdkKey,[O.NetworkParam.SdkType]:u.SDKType.lt(n.sdkKey),[O.NetworkParam.SdkVersion]:d.SDK_VERSION,[O.NetworkParam.Time]:String(Date.now()),[O.NetworkParam.SessionID]:c.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(s,r){return l(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=h.StableID.get(t),n=c.SessionID.get(t),t=u.SDKType.lt(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,s=(0,a.te)();if(this.m.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[O.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);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 k(t,e,i,n,s){t.urlConfig.endpoint===O.Endpoint.qt&&y.Diagnostics.$(t.sdkKey,y.Diagnostics.Z(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=i(809),n=i(406),r=i(512),l=i(534);function a(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,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ne=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(r){var l;return u(this,void 0,void 0,function*(){var t=this.ie[r.endpoint];if(t&&Date.now()<t)return null;this.ie[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(l=this.re)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.ee=a},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={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?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),l=i(534),o=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.o)(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,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.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,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.L)(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),l=i(23),o={};function u(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=u(e);try{(0,r.L)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=u(t);return(0,r.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const l=i(845),o=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.ve=null,this.fe={};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._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.pe=new u.EventLogger(t,r,i,n),this.$t=new o.ErrorBoundary(t,n,r),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),s=t,r=this,(0,c.kt)()||(i=(0,l.l)(),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.firstInstance||(i.firstInstance=r),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[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.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.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.Oe=e.je=e.Se=e.xt=void 0;const s="statsig::config_exposure",r="statsig::gate_exposure",u="statsig::layer_exposure",a=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.xt=({eventName:t})=>t===r||t===s||t===u,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),a(u,t,e.details,o,l)};const l=(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.6.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.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(512),o=i(634),s="default";function r(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({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Me)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return r(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=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.ke=function(t,e,i,n){return $P($P({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.we=u},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(406),s=i(512);e.T=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.Kt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=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 l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={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 o=null!==l&&void 0!==l?l:r,u=o;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.ge(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),ge:t=>{o=t,u=t},_e:t=>{u=t?r:o}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(512);e.P=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.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=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)})}},881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(410),r={[s.Endpoint.qt]:"i",[s.Endpoint.jt]:"e",[s.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(830);const n="foreground",s="background",r=[];let l=n,o=!1;e.xe=()=>l===n,e.Rt=()=>o,e.It=t=>{r.unshift(t)};e.Ae=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(o=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(s)),(0,i.he)("beforeunload",()=>{o=!0,(0,e.Ae)(s)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("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),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.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(410),e),s(i(404),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(98),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(881),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.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.Ne=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(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.Kt)({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.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,s.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source)&&i.user&&this.ze(e,i),!0)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=s.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const o=i(914),u=i(262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new o.UrlConfiguration(o.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.P)(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 l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,retries:2,isStatsigEncodable:!0,priority:s});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.Ne)(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.$e=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.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,l,o,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(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=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(914),o=i(226),u=i(448),r=i(583),a=i(131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(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 o.default(t),this.He=(0,l.T)(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.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){this.Xe(t);t=this.dataAdapter.getDataSync(this.He),this.We.setValues(t,this.He),this.Qe(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Xe(i);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.He){let t=!1;null!=e&&(l.Diagnostics.W(this.O),t=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:t})),this.Qe(e),t||this.$emt({name:"initialization_failure"}),l.Diagnostics.V(this.O,t,this.We.getCurrentSourceDetails()),l.Diagnostics.tt(this.He,this.pe,this.O,this.m)}})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,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,l.Ie)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.He,i);const r=(0,l.Te)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.ye(e,(0,l.Oe)(this.He,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.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.$e)(this,i,e)}}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return s(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=(0,l.T)(t,this.m);t=null==(t=this.He.customIDs)?void 0:t.stableID;t&&l.StableID.setOverride(t,this.O)}}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 l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(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)}R(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.ht)?void 0:s.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},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