@statsig/js-client 1.1.0 → 1.1.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.
package/README.md
CHANGED
|
@@ -28,19 +28,21 @@ Read through the [Documentation](https://docs.statsig.com/client/javascript-sdk?
|
|
|
28
28
|
|
|
29
29
|
Clients
|
|
30
30
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
31
|
+
- Precomputed Evaluations (Recommended) [[npm](https://www.npmjs.com/package/@statsig/js-client)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/js-client)]
|
|
32
|
+
- On Device Evaluations [[npm](https://www.npmjs.com/package/@statsig/js-on-device-eval-client)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/js-on-device-eval-client)]
|
|
33
33
|
|
|
34
34
|
Product Bundles
|
|
35
35
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
36
|
+
- Session Replay [[npm](https://www.npmjs.com/package/@statsig/session-replay)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/session-replay)]
|
|
37
|
+
- Web Analytics [[npm](https://www.npmjs.com/package/@statsig/web-analytics)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/web-analytics)]
|
|
38
38
|
|
|
39
39
|
Framework Specific Bindings
|
|
40
40
|
|
|
41
|
-
- [
|
|
42
|
-
|
|
43
|
-
-
|
|
41
|
+
- React [[npm](https://www.npmjs.com/package/@statsig/react-bindings)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/react-bindings)]
|
|
42
|
+
|
|
43
|
+
- React Native [[npm](https://www.npmjs.com/package/@statsig/react-native-bindings)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/react-native-bindings)]
|
|
44
|
+
|
|
45
|
+
- React Native (Expo) [[npm](https://www.npmjs.com/package/@statsig/expo-bindings)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/expo-bindings)]
|
|
44
46
|
|
|
45
47
|
## Community
|
|
46
48
|
|
|
@@ -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,l=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var i={8352:t=>{t.exports=l},5496:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.dn=i.i=void 0,i.i=()=>__STATSIG__||u,i.dn=t=>(0,i.i)()[t];i.t=t=>{var e=(0,i.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:e[s])?n:r[s])?n:{instance:i.t};o[s]=u,e[s]=u,r[s]=u},1707:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(7832);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.oi)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.oi)("k:"+t)}},5856:(t,e)=>{$Q(e)},2320:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(6780),a=i(1604),o=i(6296),r=i(3444),c=i(2412);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,o.vn)(n)}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),i=this.S.get(e,t);return i||((i=this.O(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,o.T)(e,null==(e=this.v)?void 0:e.environment),i=this.m(e);this.S.add(i,h("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.S.merge(t)}I(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.A(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(i,n){return s(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.I(null,i,n);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,r,u){return s(this,void 0,void 0,function*(){let t=null;o&&this.fn(o,r)&&(t=o.data);var e=yield this.D(t,r,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.ui)(e,"has_updates","Response"),n=this.G(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,r);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,r)}e=this.m(r);return this.S.add(e,s),yield this.k(e,s),s})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=r.Storage.N)?void 0:e.call(r.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return s(this,void 0,void 0,function*(){yield r.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,r.P)(this.p))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield r.Storage.F(e)),yield(0,r.U)(this.p,t)})}};class n{constructor(){this.ii={}}get(t,e){var t=this.ii[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.ii,9);i&&delete this.ii[i],this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),t)}}function u(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})}},4280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},8512:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(6780),l=e(7360),a=e(6972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this._=t,this.v=e,this.K=i,this.L=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.ci(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.q(e,t)):i}catch(t){return this.q(e,t),null}}q(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=r||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.L.has(s)||(this.L.add(s),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:r}):(t=l.SDKType.J(this._),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:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.v)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.K)&&n.call(this,{name:"error",error:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},6788:(t,e)=>{$Q(e)},6728:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(7832),o=i(6780),r=i(7716),u=i(6048),l=i(1876),a=i(3444),c=i(84),h=i(100),d={},v=t=>{null!=(t=d[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,i,n){this._=e,this.K=t,this.V=i,this.v=n,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(d[e]=this).X=!0===(null==n?void 0:n.disableLogging),this.Z=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null==n?void 0:n.networkConfig;this.et=(0,c.it)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",r.NetworkDefault.eventsApi),(0,h.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return n(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},i=t.metadata||{},t=[t.eventName,e.userID,i.gate,i.config,i.ruleID].join("|"),e=this.$[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=i}return!0}dt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,h._t)()&&this.V.isBeaconSupported()&&null==(null==(i=null==(e=this.v)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[r.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();n(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.bt(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.B.push(i)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{d[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},7832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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)};e.li=t=>(0,e.oi)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];!Array.isArray(e)&&e instanceof Object&&(e=s(e)),n[t]=e}),n}},9664:(t,e)=>{$Q(e)},6780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},7716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},3188:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(5496);const u=i(5496),_=i(4280),g=i(6780),l=i(7716),o=i(7360),a=i(6048),c=i(8612),h=i(1604),d=i(6972),b=i(100);e.NetworkCore=class{constructor(t,e){this.K=e,this.St=1e4,this.ri={},this.v={},t&&(this.v=t),this.v.networkConfig&&(this.ri=this.v.networkConfig),this.ri.networkTimeoutMs&&(this.St=this.ri.networkTimeoutMs)}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield this.hn(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!y(n)&&(t=yield this.Ot(n),t=yield this.hn(n,t),e=yield this.wt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}jt(d){var v,f;return r(this,void 0,void 0,function*(){if(!y(d))return null;if(this.ri.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n}=d;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(d),r=null,u=(0,b.ti)();try{var l,a,c,h={method:e,body:i,headers:$P({},d.headers),signal:null===s||void 0===s?void 0:s.signal,priority:d.priority,keepalive:u},r=yield(null!=(v=this.ri.networkOverrideFunc)?v:fetch)(o,h);if(clearTimeout(t),r.ok)return c=yield r.text(),_.Diagnostics.mark(),{body:c,code:r.status};throw l=yield r.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){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"}(s,t);return _.Diagnostics.mark(),!n||n<=0?(null!=(f=this.K)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.jt($P($P({},d),{retries:n-1}))}})}wt(i){return r(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:i.sdkKey,[l.NetworkParam.SdkType]:o.SDKType.J(i.sdkKey),[l.NetworkParam.SdkVersion]:d.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return i.url+(t?"?"+t:"")})}Ot(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield h.StableID.get(e),n=yield c.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Tt(t,e){var i,n,s=(0,a.It)();if(!t.isStatsigEncodable||this.v.disableStatsigEncoding||null!=(0,u.dn)("no-encode")||null==s||!s.btoa)return e;try{var o=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),o}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}hn(n,s){var o;return r(this,void 0,void 0,function*(){var t,e,i;return!n.isCompressable||this.v.disableCompression||null!=(0,u.dn)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder?s:(t=(new TextEncoder).encode(s),(i=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(g.Log.error),i.close().catch(g.Log.error),n.params=$P($P({},null!=(o=n.params)?o:{}),{[l.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer())})}};const y=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},4264:(t,e)=>{$Q(e)},7360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={J:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},Mt(t){n&&"-react"!==n||(n="-"+t)}}},6048:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.yt=n.xt=n.Dt=n.Et=n.kt=n.It=void 0;n.It=()=>"undefined"!=typeof window?window:null,n.kt=()=>{var t=(0,n.It)();return null!=(t=null==t?void 0:t.document)?t:null},n.Et=()=>null!=(0,n.kt)(),n.Dt=(t,e)=>{var i=(0,n.It)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.xt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.yt=()=>{var t;try{return null==(t=(0,n.It)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},8612:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(1707),u=i(6780),l=i(3444),a=i(3556),c=18e5,h=144e5,d={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>r(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>r(void 0,void 0,void 0,function*(){null==d[o]&&(d[o]=function(i){return r(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.P)(t)}(i);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:i}})}(o));var t=yield d[o],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>h}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;return s=f(s),(0,l.U)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,h-e),t})}},1604:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=i(1707),o=i(6780),r=i(3444),u=i(3556),l={};function a(t){return"statsig.stable_id."+(0,s.o)(t)}function c(t,e){e=a(e);(0,r.U)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},7688:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(5496);const r=i(5496),u=i(8512),l=i(6728),a=i(6780),c=i(6048),h=i(3444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&h.Storage.Nt(!0),this._=t,this.v=null!=n?n:{},this.Rt=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Pt=new l.EventLogger(t,o,i,n),this.Ct=new u.ErrorBoundary(t,n,o),this.Ct.wrap(this),this.Ct.wrap(i),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(i=null!=(o=(s=(0,r.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,h.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Gt[i.name]&&this.Gt[i.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.enqueue(e)}}},5808:(t,e)=>{$Q(e)},6283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1876:(t,e)=>{$Q(e),e.Lt=e.qt=e.Jt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Jt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Lt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},6972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.1.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},3384:(t,e)=>{$Q(e)},6396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.$t=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.Bt=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.zt=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.Vt=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},9136:(t,e)=>{$Q(e)},6296:(t,e,i)=>{$Q(e),e.vn=e.T=void 0;const n=i(7832),s=i(6780);e.T=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{}}},e.vn=function(t){return t?(0,n.li)(t):null}},3444:function(t,i,e){var n=this&&this.__awaiter||$A(),s=($Q2(i,"__esModule",{value:!0}),i.U=i.P=i.Storage=void 0,e(6780)),e=e(6048);const o={},r=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>r(o[t]||null),C:(t,e)=>(o[t]=e,r()),F:t=>(delete o[t],r()),Yt:()=>r(Object.keys(o))};let l=null;try{const d=(0,e.It)();d&&d.localStorage&&"function"==typeof d.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>d.localStorage.getItem(t),Wt:t=>r(d.localStorage.getItem(t)),C:(t,e)=>(d.localStorage.setItem(t,e),r()),F:t=>(d.localStorage.removeItem(t),r()),Yt:()=>r(Object.keys(d.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function h(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.Qt(u),null;throw t}}i.Storage={Ht:()=>c.Ht(),Wt:t=>n(void 0,void 0,void 0,function*(){return h(()=>c.Wt(t))}),N:t=>h(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},i.P=function(e){return n(this,void 0,void 0,function*(){var t=yield i.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},i.U=function(t,e){return n(this,void 0,void 0,function*(){yield i.Storage.C(t,JSON.stringify(e))})}},2412:(t,e,i)=>{$Q(e),e.ui=void 0;const s=i(6780);e.ui=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}},3556:(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)})}},84:(t,e)=>{$Q(e),e.it=void 0,e.it=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},1539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;i=i(6048);const n="foreground",s="background",o=[];let r=n,u=!1;e._t=()=>r===n,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>{(u=!1,e.Xt)(n)}),(0,i.Dt)("blur",()=>(0,e.Xt)(s)),(0,i.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(s)}),(0,i.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?n:s)})},4464: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.Log=e.Storage=e.EventLogger=void 0,i(5496);const o=i(6728),r=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(6780));$Q2(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(6972);const l=i(3444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(i(5496),e),s(i(1707),e),s(i(5856),e),s(i(2320),e),s(i(184),e),s(i(8512),e),s(i(500),e),s(i(6788),e),s(i(7832),e),s(i(9664),e),s(i(6780),e),s(i(3188),e),s(i(7716),e),s(i(4264),e),s(i(6048),e),s(i(7360),e),s(i(8612),e),s(i(1604),e),s(i(7688),e),s(i(5808),e),s(i(6283),e),s(i(1876),e),s(i(6972),e),s(i(3384),e),s(i(6396),e),s(i(9136),e),s(i(6296),e),s(i(3444),e),s(i(2412),e),s(i(84),e),s(i(1539),e),s(i(3556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:r.Log,SDK_VERSION:u.SDK_VERSION})},9920:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const h=i(4464),d=i(5208);function v(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,h.It)(),o=(0,h.kt)();if(s&&o&&o.currentScript){var r=o.currentScript.getAttribute("src"),u=null==(t=s.location)?void 0:t.href;if(r&&u){var l=new URL(r,u).searchParams,a=null!=(i=v("sdkKey",l))?i:v("apiKey",l);if(a){var c=null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a];let t=null;(t=c instanceof d.StatsigClient?c:t)||(t=new d.StatsigClient(a,function(){var t=(0,h.It)();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,h.yt)()||"",language:null==(n=t.navigator)?void 0:n.language})})}())).initializeAsync().catch(t=>{h.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){h.Log.error("AutoInit failed",t)}}}},3096:(t,e,i)=>{$Q(e),e.ai=void 0;const n=i(4464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var i;return(e=(0,n.ui)(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.li)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},1536:(t,e,i)=>{$Q(e);const n=i(4464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,n.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,n.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},9400:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const u=i(4464),l=i(3096);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,o){return r(this,void 0,void 0,function*(){var t=n?(0,u.ui)(n,"has_updates","InitializeResponse"):null;let e={user:o,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.ue(i,t,e,s)})}ue(e,i,n,s){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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!=(o=null==t?void 0:t.body)?o:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(i,t.body))?t:this.ue(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},4520:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const r=i(4464),o=i(1536),u=i(9400),l=i(5364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn((0,r.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.ce(i);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this._),stableID:yield r.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.oi)(t),{evaluation:i,details:n}=this.le.getGate(i),n=(0,r.$t)(t,n,i),s=null==(s=null==(i=this.Rt)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ae,e),i=null!=s?s:n;return this.Kt(t,(0,r.Jt)(this.ae,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.oi)(e),{evaluation:t,details:n}=this.le.getLayer(t),n=(0,r.zt)(e,n,t),s=null==(s=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ae,i);const o=(0,r.Vt)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Kt(e,(0,r.Lt)(this.ae,o,t),i)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,r.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&r.StableID.setOverride(t,this._)}ve(t,e,i){var n=(0,r.oi)(e),{evaluation:n,details:s}=this.le.getConfig(n),s=(0,r.Bt)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Rt)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.ae,i):null==(n=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.ae,i),t=null!=n?n:s;return this.Kt(e,(0,r.qt)(this.ae,t),i),t}}e.default=n},5364:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(4464),s=i(9400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.I(t,e,i)}prefetchData(t,e){return this.M(t,e)}setData(t){var e=(0,n.ui)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}D(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield null==(s=this.V)?void 0:s.fetchEvaluations(this.G(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}m(t){t=(0,n.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.h}.`+t}fn(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.vn)(e)}}e.StatsigEvaluationsDataAdapter=r},5208:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(4520);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.default}),e.default=__STATSIG__},2152:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.SessionReplay=e.runStatsigSessionReplay=void 0;const s=i(4464),o=i(8264);e.runStatsigSessionReplay=function(t,e){new r(t,e)};class r{constructor(t,e){this._e=t,this.v=e,this.fe=null,this.ge=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.Ct=t,this.Ct.wrap(this),(0,s.Et)()&&((t=(0,s.i)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.be=this.ye(),this.Se=new o.SessionReplayClient,this._e.$on("pre_shutdown",()=>this.pe()),this._e.$on("values_updated",()=>this.me()),this._e.on("session_expired",()=>{this.Se.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Oe("session_expired"),this.be=this.ye()}),this.je(),this.me()}je(){const i=this._e.getContext()["sdkKey"];(0,s.st)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof r&&e.Te(t)})}Te(t){"background"===t&&(this.Oe(),this._e.flush().catch(t=>{this.Ct.logError("SR::visibility",t)}))}we(t,e){this.fe=e,this.ge.push(t),2048<JSON.stringify(this.ge).length&&((0,s._t)()?this.Ie():this.Oe())}me(){var t=this._e.getContext().values;!0!==(null==t?void 0:t.can_record_session)?this.pe():this.Se.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Se.record((t,e)=>this.we(t,e),null!=(t=null==(t=this.v)?void 0:t.rrwebConfig)?t:{}))}pe(){this.Se.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.ge.length&&null!=this.fe&&this.Ie()}Oe(e){0!==this.ge.length&&null!=this.fe&&(e=(0,s.ti)()?"is_leaving_page":e,this.be.then(t=>this.Ae(t,e)).catch(t=>{this.Ct.logError("SR::flush",t)}))}Ae(t,e){var i,n=this.fe;null!==n&&0!==this.ge.length&&(i=JSON.stringify(this.ge),t={eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:i,session_replay_sdk_version:s.SDK_VERSION}},e&&(t.metadata[e]="true"),this._e.logEvent(t),this.ge=[])}Ie(){this.be=this.ye(),this.Oe()}ye(){return n(this,void 0,void 0,function*(){return this._e.getAsyncContext().then(t=>t.session.data.sessionID)})}}e.SessionReplay=r},8264:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(8352),s=i(4464);e.SessionReplayClient=class{constructor(){this.Me=null,this.xe=null,this.De=0}record(i,t,e){null==(0,s.kt)()||(this.Me=null,this.xe=null,this.De=0,this.Ee=e,this.ke)||(this.ke=(e=t=>{var e;null==this.Me&&(this.Me=t.timestamp),this.xe=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.De++,i(t,{startTime:this.Me,endTime:this.xe,clickCount:this.De}),144e5<this.xe-this.Me&&(null!=(e=this.ke)&&e.call(this),this.Ee)&&this.Ee()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.ke&&(this.ke(),this.ke=void 0)}isRecording(){return null!=this.ke}}},8392:(t,e,i)=>{$Q(e),e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(2152),s=($Q2(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),$Q2(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(8264));$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})},5536:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const r=i(4464),s=i(3076),o=i(7724);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this._e=t,this.Ge=Date.now(),this.Ne=0;var e,{sdkKey:t,errorBoundary:i}=t.getContext(),i=(this.Ct=i,this.Ct.wrap(this),(0,r.kt)());(0,r.Et)()&&((e=null!=(e=(__STATSIG__=(0,r.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.Ce()):this.Ce()}Re(){const e=(0,r.It)();var t,i=(0,r.kt)();e&&i&&(t=t=>{this.Pe(t||e.event)},(0,s.Fe)(i,"click",t),(0,s.Fe)(i,"submit",t),(0,s.Fe)(e,"error",t),(0,s.Fe)(e,"beforeunload",()=>this.Ue()),(0,s.Fe)(e,"scroll",()=>this.Ke()))}Pe(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.Le(t):(e=(0,s.qe)(t))&&(0,s.ot)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,s.Je)(e),this.Ve(i,t,e))}Ce(){this.Re(),this.ze(),this.Be()}Le(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.Ve("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}ze(){setTimeout(()=>{var t=(0,s.$e)(),t=(0,o.cn)(t);this.Ve("page_view",(0,s.He)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}Be(){const i=(0,r.It)();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&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Ve("performance",(0,s.He)(),t)},1)}Ue(){this.Ve("page_view_end",(0,s.He)(),{scrollDepth:this.Ne,pageViewLength:Date.now()-this.Ge},{flushImmediately:!0})}Ve(i,n,s,o){this.We().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,r.It)())?void 0:e.location)?void 0:e.href)?e:""},s),t=(null!=o&&o.addNewSessionMetadata&&(e.isNewSession=String(Math.abs(t.data.startTime-Date.now())<1e3)),{eventName:"auto_capture::"+i,value:n,metadata:e});this._e.logEvent(t),null!=o&&o.flushImmediately&&this._e.flush().catch(t=>{r.Log.error(t)})}).catch(t=>{this.Ct.logError("AC::enqueue",t)})}Ke(){var t=null!=(t=null==(t=(0,r.kt)())?void 0:t.body.scrollHeight)?t:1,e=(0,r.It)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ne=Math.max(this.Ne,Math.min(100,Math.round((i+e)/t*100)))}We(){return n(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).session})}}e.AutoCapture=u},3076:(t,e,i)=>{$Q(e),e.Fe=e.He=e.$e=e.ot=e.qe=e.Je=void 0;const n=i(4464);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.Je=function(t){var e=t.tagName.toLowerCase(),i={},n=e,s=("form"===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")),"button"===e&&(i.content=(t.textContent||"").trim()),o(t));return s&&(i.href=s.getAttribute("href")),{value:n,metadata:i}},e.qe=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.ot=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.$e=function(){var t=null!=(t=null==(t=null==(t=(0,n.It)())?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.He=function(){return(0,n.yt)()||""},e.Fe=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)}},6824:(t,e,i)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(5536);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$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}),e.default=__STATSIG__},7724:(t,e,i)=>{$Q(e),e.cn=void 0;const a=i(4464);e.cn=function(t){var e=(0,a.kt)(),i=(0,a.It)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,s=(null==e?void 0:e.referrer)||"";let o=new URL("empty:");if(s)try{o=new URL(s||"empty:")}catch(t){}u=o,r=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(u),u=u.searchParams.get("yahoo"===r?"p":"q")||"";var r={searchEngine:r,searchQuery:u},u=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 l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},r),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",referrer:s,screen_width:(null==(t=null==i?void 0:i.screen)?void 0:t.width)||"unknown",screen_height:(null==(r=null==i?void 0:i.screen)?void 0:r.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 r=s(8392),u=s(6824);var o=s(9920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new r.SessionReplay(t),new u.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,l=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var i={8352:t=>{t.exports=l},5496:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.dn=i.i=void 0,i.i=()=>__STATSIG__||u,i.dn=t=>(0,i.i)()[t];i.t=t=>{var e=(0,i.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:e[s])?n:r[s])?n:{instance:i.t};o[s]=u,e[s]=u,r[s]=u},1707:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(7832);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.oi)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.oi)("k:"+t)}},5856:(t,e)=>{$Q(e)},2320:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(6780),a=i(1604),o=i(6296),r=i(3444),c=i(2412);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,o.vn)(n)}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),i=this.S.get(e,t);return i||((i=this.O(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,o.T)(e,null==(e=this.v)?void 0:e.environment),i=this.m(e);this.S.add(i,h("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.S.merge(t)}I(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.A(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(i,n){return s(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.I(null,i,n);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,r,u){return s(this,void 0,void 0,function*(){let t=null;o&&this.fn(o,r)&&(t=o.data);var e=yield this.D(t,r,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.ui)(e,"has_updates","Response"),n=this.G(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,r);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,r)}e=this.m(r);return this.S.add(e,s),yield this.k(e,s),s})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=r.Storage.N)?void 0:e.call(r.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return s(this,void 0,void 0,function*(){yield r.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,r.P)(this.p))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield r.Storage.F(e)),yield(0,r.U)(this.p,t)})}};class n{constructor(){this.ii={}}get(t,e){var t=this.ii[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.ii,9);i&&delete this.ii[i],this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),t)}}function u(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})}},4280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},8512:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(6780),l=e(7360),a=e(6972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this._=t,this.v=e,this.K=i,this.L=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.ci(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.q(e,t)):i}catch(t){return this.q(e,t),null}}q(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=r||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.L.has(s)||(this.L.add(s),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:r}):(t=l.SDKType.J(this._),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:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.v)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.K)&&n.call(this,{name:"error",error:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},6788:(t,e)=>{$Q(e)},6728:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(7832),o=i(6780),r=i(7716),u=i(6048),l=i(1876),a=i(3444),c=i(84),h=i(100),d={},v=t=>{null!=(t=d[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,i,n){this._=e,this.K=t,this.V=i,this.v=n,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(d[e]=this).X=!0===(null==n?void 0:n.disableLogging),this.Z=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null==n?void 0:n.networkConfig;this.et=(0,c.it)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",r.NetworkDefault.eventsApi),(0,h.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return n(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},i=t.metadata||{},t=[t.eventName,e.userID,i.gate,i.config,i.ruleID].join("|"),e=this.$[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=i}return!0}dt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,h._t)()&&this.V.isBeaconSupported()&&null==(null==(i=null==(e=this.v)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[r.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();n(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.bt(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.B.push(i)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{d[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},7832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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)};e.li=t=>(0,e.oi)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];!Array.isArray(e)&&e instanceof Object&&(e=s(e)),n[t]=e}),n}},9664:(t,e)=>{$Q(e)},6780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},7716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},3188:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(5496);const u=i(5496),_=i(4280),g=i(6780),l=i(7716),o=i(7360),a=i(6048),c=i(8612),h=i(1604),d=i(6972),b=i(100);e.NetworkCore=class{constructor(t,e){this.K=e,this.St=1e4,this.ri={},this.v={},t&&(this.v=t),this.v.networkConfig&&(this.ri=this.v.networkConfig),this.ri.networkTimeoutMs&&(this.St=this.ri.networkTimeoutMs)}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield this.hn(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!y(n)&&(t=yield this.Ot(n),t=yield this.hn(n,t),e=yield this.wt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}jt(d){var v,f;return r(this,void 0,void 0,function*(){if(!y(d))return null;if(this.ri.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n}=d;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(d),r=null,u=(0,b.ti)();try{var l,a,c,h={method:e,body:i,headers:$P({},d.headers),signal:null===s||void 0===s?void 0:s.signal,priority:d.priority,keepalive:u},r=yield(null!=(v=this.ri.networkOverrideFunc)?v:fetch)(o,h);if(clearTimeout(t),r.ok)return c=yield r.text(),_.Diagnostics.mark(),{body:c,code:r.status};throw l=yield r.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){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"}(s,t);return _.Diagnostics.mark(),!n||n<=0?(null!=(f=this.K)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.jt($P($P({},d),{retries:n-1}))}})}wt(i){return r(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:i.sdkKey,[l.NetworkParam.SdkType]:o.SDKType.J(i.sdkKey),[l.NetworkParam.SdkVersion]:d.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return i.url+(t?"?"+t:"")})}Ot(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield h.StableID.get(e),n=yield c.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Tt(t,e){var i,n,s=(0,a.It)();if(!t.isStatsigEncodable||this.v.disableStatsigEncoding||null!=(0,u.dn)("no-encode")||null==s||!s.btoa)return e;try{var o=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),o}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}hn(n,s){var o;return r(this,void 0,void 0,function*(){var t,e,i;return!n.isCompressable||this.v.disableCompression||null!=(0,u.dn)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder?s:(t=(new TextEncoder).encode(s),(i=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(g.Log.error),i.close().catch(g.Log.error),n.params=$P($P({},null!=(o=n.params)?o:{}),{[l.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer())})}};const y=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},4264:(t,e)=>{$Q(e)},7360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={J:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},Mt(t){n&&"-react"!==n||(n="-"+t)}}},6048:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.yt=n.xt=n.Dt=n.Et=n.kt=n.It=void 0;n.It=()=>"undefined"!=typeof window?window:null,n.kt=()=>{var t=(0,n.It)();return null!=(t=null==t?void 0:t.document)?t:null},n.Et=()=>null!=(0,n.kt)(),n.Dt=(t,e)=>{var i=(0,n.It)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.xt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.yt=()=>{var t;try{return null==(t=(0,n.It)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},8612:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(1707),u=i(6780),l=i(3444),a=i(3556),c=18e5,h=144e5,d={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>r(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>r(void 0,void 0,void 0,function*(){null==d[o]&&(d[o]=function(i){return r(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.P)(t)}(i);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:i}})}(o));var t=yield d[o],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>h}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;return s=f(s),(0,l.U)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,h-e),t})}},1604:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=i(1707),o=i(6780),r=i(3444),u=i(3556),l={};function a(t){return"statsig.stable_id."+(0,s.o)(t)}function c(t,e){e=a(e);(0,r.U)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},7688:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(5496);const r=i(5496),u=i(8512),l=i(6728),a=i(6780),c=i(6048),h=i(3444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&h.Storage.Nt(!0),this._=t,this.v=null!=n?n:{},this.Rt=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Pt=new l.EventLogger(t,o,i,n),this.Ct=new u.ErrorBoundary(t,n,o),this.Ct.wrap(this),this.Ct.wrap(i),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(i=null!=(o=(s=(0,r.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,h.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Gt[i.name]&&this.Gt[i.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.enqueue(e)}}},5808:(t,e)=>{$Q(e)},6283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1876:(t,e)=>{$Q(e),e.Lt=e.qt=e.Jt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Jt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Lt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},6972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.1.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},3384:(t,e)=>{$Q(e)},6396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.$t=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.Bt=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.zt=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.Vt=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},9136:(t,e)=>{$Q(e)},6296:(t,e,i)=>{$Q(e),e.vn=e.T=void 0;const n=i(7832),s=i(6780);e.T=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{}}},e.vn=function(t){return t?(0,n.li)(t):null}},3444:function(t,i,e){var n=this&&this.__awaiter||$A(),s=($Q2(i,"__esModule",{value:!0}),i.U=i.P=i.Storage=void 0,e(6780)),e=e(6048);const o={},r=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>r(o[t]||null),C:(t,e)=>(o[t]=e,r()),F:t=>(delete o[t],r()),Yt:()=>r(Object.keys(o))};let l=null;try{const d=(0,e.It)();d&&d.localStorage&&"function"==typeof d.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>d.localStorage.getItem(t),Wt:t=>r(d.localStorage.getItem(t)),C:(t,e)=>(d.localStorage.setItem(t,e),r()),F:t=>(d.localStorage.removeItem(t),r()),Yt:()=>r(Object.keys(d.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function h(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.Qt(u),null;throw t}}i.Storage={Ht:()=>c.Ht(),Wt:t=>n(void 0,void 0,void 0,function*(){return h(()=>c.Wt(t))}),N:t=>h(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},i.P=function(e){return n(this,void 0,void 0,function*(){var t=yield i.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},i.U=function(t,e){return n(this,void 0,void 0,function*(){yield i.Storage.C(t,JSON.stringify(e))})}},2412:(t,e,i)=>{$Q(e),e.ui=void 0;const s=i(6780);e.ui=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}},3556:(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)})}},84:(t,e)=>{$Q(e),e.it=void 0,e.it=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},1539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;i=i(6048);const n="foreground",s="background",o=[];let r=n,u=!1;e._t=()=>r===n,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>{(u=!1,e.Xt)(n)}),(0,i.Dt)("blur",()=>(0,e.Xt)(s)),(0,i.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(s)}),(0,i.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?n:s)})},4464: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.Log=e.Storage=e.EventLogger=void 0,i(5496);const o=i(6728),r=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(6780));$Q2(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(6972);const l=i(3444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(i(5496),e),s(i(1707),e),s(i(5856),e),s(i(2320),e),s(i(184),e),s(i(8512),e),s(i(500),e),s(i(6788),e),s(i(7832),e),s(i(9664),e),s(i(6780),e),s(i(3188),e),s(i(7716),e),s(i(4264),e),s(i(6048),e),s(i(7360),e),s(i(8612),e),s(i(1604),e),s(i(7688),e),s(i(5808),e),s(i(6283),e),s(i(1876),e),s(i(6972),e),s(i(3384),e),s(i(6396),e),s(i(9136),e),s(i(6296),e),s(i(3444),e),s(i(2412),e),s(i(84),e),s(i(1539),e),s(i(3556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:r.Log,SDK_VERSION:u.SDK_VERSION})},9920:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const h=i(4464),d=i(5208);function v(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,h.It)(),o=(0,h.kt)();if(s&&o&&o.currentScript){var r=o.currentScript.getAttribute("src"),u=null==(t=s.location)?void 0:t.href;if(r&&u){var l=new URL(r,u).searchParams,a=null!=(i=v("sdkKey",l))?i:v("apiKey",l);if(a){var c=null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a];let t=null;(t=c instanceof d.StatsigClient?c:t)||(t=new d.StatsigClient(a,function(){var t=(0,h.It)();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,h.yt)()||"",language:null==(n=t.navigator)?void 0:n.language})})}())).initializeAsync().catch(t=>{h.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){h.Log.error("AutoInit failed",t)}}}},3096:(t,e,i)=>{$Q(e),e.ai=void 0;const n=i(4464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var i;return(e=(0,n.ui)(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.li)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},1536:(t,e,i)=>{$Q(e);const n=i(4464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,n.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,n.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},9400:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const u=i(4464),l=i(3096);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,o){return r(this,void 0,void 0,function*(){var t=n?(0,u.ui)(n,"has_updates","InitializeResponse"):null;let e={user:o,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.ue(i,t,e,s)})}ue(e,i,n,s){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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!=(o=null==t?void 0:t.body)?o:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(i,t.body))?t:this.ue(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},4520:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const r=i(4464),o=i(1536),u=i(9400),l=i(5364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn((0,r.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.ce(i);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this._),stableID:yield r.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.oi)(t),{evaluation:i,details:n}=this.le.getGate(i),n=(0,r.$t)(t,n,i),s=null==(s=null==(i=this.Rt)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ae,e),i=null!=s?s:n;return this.Kt(t,(0,r.Jt)(this.ae,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.oi)(e),{evaluation:t,details:n}=this.le.getLayer(t),n=(0,r.zt)(e,n,t),s=null==(s=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ae,i);const o=(0,r.Vt)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Kt(e,(0,r.Lt)(this.ae,o,t),i)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,r.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&r.StableID.setOverride(t,this._)}ve(t,e,i){var n=(0,r.oi)(e),{evaluation:n,details:s}=this.le.getConfig(n),s=(0,r.Bt)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Rt)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.ae,i):null==(n=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.ae,i),t=null!=n?n:s;return this.Kt(e,(0,r.qt)(this.ae,t),i),t}}e.default=n},5364:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(4464),s=i(9400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.I(t,e,i)}prefetchData(t,e){return this.M(t,e)}setData(t){var e=(0,n.ui)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}D(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield null==(s=this.V)?void 0:s.fetchEvaluations(this.G(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}m(t){t=(0,n.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.h}.`+t}fn(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.vn)(e)}}e.StatsigEvaluationsDataAdapter=r},5208:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(4520);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.default}),e.default=__STATSIG__},2152:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.SessionReplay=e.runStatsigSessionReplay=void 0;const s=i(4464),o=i(8264);e.runStatsigSessionReplay=function(t,e){new r(t,e)};class r{constructor(t,e){this._e=t,this.v=e,this.fe=null,this.ge=[];var{sdkKey:e,errorBoundary:t}=t.getContext();this.Ct=t,this.Ct.wrap(this),(0,s.Et)()&&((t=(0,s.i)()).srInstances=$P($P({},t.srInstances),{[e]:this})),this.be=this.ye(),this.Se=new o.SessionReplayClient,this._e.$on("pre_shutdown",()=>this.pe()),this._e.$on("values_updated",()=>this.me()),this._e.on("session_expired",()=>{this.Se.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Oe("session_expired"),this.be=this.ye()}),this.je(),this.me()}je(){const i=this._e.getContext()["sdkKey"];(0,s.st)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof r&&e.Te(t)})}Te(t){"background"===t&&(this.Oe(),this._e.flush().catch(t=>{this.Ct.logError("SR::visibility",t)}))}we(t,e){this.fe=e,this.ge.push(t),2048<JSON.stringify(this.ge).length&&((0,s._t)()?this.Ie():this.Oe())}me(){var t=this._e.getContext().values;!0!==(null==t?void 0:t.can_record_session)?this.pe():this.Se.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Se.record((t,e)=>this.we(t,e),null!=(t=null==(t=this.v)?void 0:t.rrwebConfig)?t:{}))}pe(){this.Se.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.ge.length&&null!=this.fe&&this.Ie()}Oe(e){0!==this.ge.length&&null!=this.fe&&(e=(0,s.ti)()?"is_leaving_page":e,this.be.then(t=>this.Ae(t,e)).catch(t=>{this.Ct.logError("SR::flush",t)}))}Ae(t,e){var i,n=this.fe;null!==n&&0!==this.ge.length&&(i=JSON.stringify(this.ge),t={eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:i,session_replay_sdk_version:s.SDK_VERSION}},e&&(t.metadata[e]="true"),this._e.logEvent(t),this.ge=[])}Ie(){this.be=this.ye(),this.Oe()}ye(){return n(this,void 0,void 0,function*(){return this._e.getAsyncContext().then(t=>t.session.data.sessionID)})}}e.SessionReplay=r},8264:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(8352),s=i(4464);e.SessionReplayClient=class{constructor(){this.Me=null,this.xe=null,this.De=0}record(i,t,e){null==(0,s.kt)()||(this.Me=null,this.xe=null,this.De=0,this.Ee=e,this.ke)||(this.ke=(e=t=>{var e;null==this.Me&&(this.Me=t.timestamp),this.xe=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.De++,i(t,{startTime:this.Me,endTime:this.xe,clickCount:this.De}),144e5<this.xe-this.Me&&(null!=(e=this.ke)&&e.call(this),this.Ee)&&this.Ee()},t=t,("function"==typeof n?n:n.record)($P($P({},t),{emit:e}))))}stop(){this.ke&&(this.ke(),this.ke=void 0)}isRecording(){return null!=this.ke}}},8392:(t,e,i)=>{$Q(e),e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(2152),s=($Q2(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),$Q2(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(8264));$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})},5536:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const r=i(4464),s=i(3076),o=i(7724);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this._e=t,this.Ge=Date.now(),this.Ne=0;var e,{sdkKey:t,errorBoundary:i}=t.getContext(),i=(this.Ct=i,this.Ct.wrap(this),(0,r.kt)());(0,r.Et)()&&((e=null!=(e=(__STATSIG__=(0,r.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.Ce()):this.Ce()}Re(){const e=(0,r.It)();var t,i=(0,r.kt)();e&&i&&(t=t=>{this.Pe(t||e.event)},(0,s.Fe)(i,"click",t),(0,s.Fe)(i,"submit",t),(0,s.Fe)(e,"error",t),(0,s.Fe)(e,"beforeunload",()=>this.Ue()),(0,s.Fe)(e,"scroll",()=>this.Ke()))}Pe(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.Le(t):(e=(0,s.qe)(t))&&(0,s.ot)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,s.Je)(e),this.Ve(i,t,e))}Ce(){this.Re(),this.ze(),this.Be()}Le(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.Ve("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}ze(){setTimeout(()=>{var t=(0,s.$e)(),t=(0,o.cn)(t);this.Ve("page_view",(0,s.He)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}Be(){const i=(0,r.It)();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&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Ve("performance",(0,s.He)(),t)},1)}Ue(){this.Ve("page_view_end",(0,s.He)(),{scrollDepth:this.Ne,pageViewLength:Date.now()-this.Ge},{flushImmediately:!0})}Ve(i,n,s,o){this.We().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,r.It)())?void 0:e.location)?void 0:e.href)?e:""},s),t=(null!=o&&o.addNewSessionMetadata&&(e.isNewSession=String(Math.abs(t.data.startTime-Date.now())<1e3)),{eventName:"auto_capture::"+i,value:n,metadata:e});this._e.logEvent(t),null!=o&&o.flushImmediately&&this._e.flush().catch(t=>{r.Log.error(t)})}).catch(t=>{this.Ct.logError("AC::enqueue",t)})}Ke(){var t=null!=(t=null==(t=(0,r.kt)())?void 0:t.body.scrollHeight)?t:1,e=(0,r.It)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ne=Math.max(this.Ne,Math.min(100,Math.round((i+e)/t*100)))}We(){return n(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).session})}}e.AutoCapture=u},3076:(t,e,i)=>{$Q(e),e.Fe=e.He=e.$e=e.ot=e.qe=e.Je=void 0;const n=i(4464);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.Je=function(t){var e=t.tagName.toLowerCase(),i={},n=e,s=("form"===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")),"button"===e&&(i.content=(t.textContent||"").trim()),o(t));return s&&(i.href=s.getAttribute("href")),{value:n,metadata:i}},e.qe=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.ot=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.$e=function(){var t=null!=(t=null==(t=null==(t=(0,n.It)())?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.He=function(){return(0,n.yt)()||""},e.Fe=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)}},6824:(t,e,i)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(5536);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$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}),e.default=__STATSIG__},7724:(t,e,i)=>{$Q(e),e.cn=void 0;const a=i(4464);e.cn=function(t){var e=(0,a.kt)(),i=(0,a.It)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,s=(null==e?void 0:e.referrer)||"";let o=new URL("empty:");if(s)try{o=new URL(s||"empty:")}catch(t){}u=o,r=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(u),u=u.searchParams.get("yahoo"===r?"p":"q")||"";var r={searchEngine:r,searchQuery:u},u=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 l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},r),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",referrer:s,screen_width:(null==(t=null==i?void 0:i.screen)?void 0:t.width)||"unknown",screen_height:(null==(r=null==i?void 0:i.screen)?void 0:r.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 r=s(8392),u=s(6824);var o=s(9920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new r.SessionReplay(t),new u.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 n={496:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.dn=n.i=void 0,n.i=()=>__STATSIG__||u,n.dn=t=>(0,n.i)()[t];n.t=t=>{var e=(0,n.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},s="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[r])?i:e[r])?i:s[r])?i:{instance:n.t};o[r]=u,e[r]=u,s[r]=u},707:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const r=n(832);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.oi)(e.join("|"))}e.u=i,e.o=function(t,e,n){return e?i(t,e,n):(0,r.oi)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(780),a=n(604),o=n(296),s=n(444),c=n(412);function d(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,o.vn)(i)}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new i}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),n=this.S.get(e,t);return n||((n=this.O(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,o.T)(e,null==(e=this.v)?void 0:e.environment),n=this.m(e);this.S.add(n,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.S.merge(t)}I(e,n,i){return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.A(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(n,i){return r(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.I(null,n,i);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,s,u){return r(this,void 0,void 0,function*(){let t=null;o&&this.fn(o,s)&&(t=o.data);var e=yield this.D(t,s,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.ui)(e,"has_updates","Response"),i=this.G(),i=yield a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=d("Network",e,i,s);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=d("NetworkNotModified",t,i,s)}e=this.m(s);return this.S.add(e,r),yield this.k(e,r),r})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=s.Storage.N)?void 0:e.call(s.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return r(this,void 0,void 0,function*(){yield s.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,s.P)(this.p))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield s.Storage.F(e)),yield(0,s.U)(this.p,t)})}};class i{constructor(){this.ii={}}get(t,e){var t=this.ii[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.ii,9);n&&delete this.ii[n],this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),t)}}function u(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})}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this._=t,this.v=e,this.K=n,this.L=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.ci(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.q(e,t)):n}catch(t){return this.q(e,t),null}}q(o,s){try{i.Log.warn("Caught error in "+o,{error:s});n(this,void 0,void 0,function*(){var t,e,n=s||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.L.has(r)||(this.L.add(r),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:s}):(t=l.SDKType.J(this._),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:o,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.v)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.K)&&i.call(this,{name:"error",error:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(832),o=n(780),s=n(716),u=n(48),l=n(876),a=n(444),c=n(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this._=e,this.K=t,this.V=n,this.v=i,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==i?void 0:i.disableLogging),this.Z=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.et=(0,c.it)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return i(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.$[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=n}return!0}dt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(n=null==(e=this.v)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[s.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();i(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.bt(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.B.push(n)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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)};e.li=t=>(0,e.oi)(JSON.stringify(r(t)));const r=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];!Array.isArray(e)&&e instanceof Object&&(e=r(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class o{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=o).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},188:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const u=n(496),_=n(280),g=n(780),l=n(716),o=n(360),a=n(48),c=n(612),d=n(604),h=n(972),y=n(100);e.NetworkCore=class{constructor(t,e){this.K=e,this.St=1e4,this.ri={},this.v={},t&&(this.v=t),this.v.networkConfig&&(this.ri=this.v.networkConfig),this.ri.networkTimeoutMs&&(this.St=this.ri.networkTimeoutMs)}post(e){return s(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield this.hn(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return s(this,void 0,void 0,function*(){var t,e,n;return!!b(i)&&(t=yield this.Ot(i),t=yield this.hn(i,t),e=yield this.wt(i),(n=navigator).sendBeacon.bind(n)(e,t))})}jt(h){var v,f;return s(this,void 0,void 0,function*(){if(!b(h))return null;if(this.ri.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===r||void 0===r?void 0:r.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(h),s=null,u=(0,y.ti)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===r||void 0===r?void 0:r.signal,priority:h.priority,keepalive:u},s=yield(null!=(v=this.ri.networkOverrideFunc)?v:fetch)(o,d);if(clearTimeout(t),s.ok)return c=yield s.text(),_.Diagnostics.mark(),{body:c,code:s.status};throw l=yield s.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){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"}(r,t);return _.Diagnostics.mark(),!i||i<=0?(null!=(f=this.K)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.jt($P($P({},h),{retries:i-1}))}})}wt(n){return s(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:n.sdkKey,[l.NetworkParam.SdkType]:o.SDKType.J(n.sdkKey),[l.NetworkParam.SdkVersion]:h.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return n.url+(t?"?"+t:"")})}Ot(r){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield d.StableID.get(e),i=yield c.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Tt(t,e){var n,i,r=(0,a.It)();if(!t.isStatsigEncodable||this.v.disableStatsigEncoding||null!=(0,u.dn)("no-encode")||null==r||!r.btoa)return e;try{var o=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),o}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}hn(i,r){var o;return s(this,void 0,void 0,function*(){var t,e,n;return!i.isCompressable||this.v.disableCompression||null!=(0,u.dn)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder?r:(t=(new TextEncoder).encode(r),(n=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(g.Log.error),n.close().catch(g.Log.error),i.params=$P($P({},null!=(o=i.params)?o:{}),{[l.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer())})}};const b=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={J:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.yt=i.xt=i.Dt=i.Et=i.kt=i.It=void 0;i.It=()=>"undefined"!=typeof window?window:null,i.kt=()=>{var t=(0,i.It)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.kt)(),i.Dt=(t,e)=>{var n=(0,i.It)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.yt=()=>{var t;try{return null==(t=(0,i.It)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(707),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,i.o)(t)}e.SessionID={get:t=>s(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>s(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(n){return s(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.P)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(o));var t=yield h[o],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;return r=f(r),(0,l.U)(r,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t})}},604:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const r=n(707),o=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.o)(t)}function c(t,e){e=a(e);(0,s.U)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,s.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(496);const s=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var r,o=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Nt(!0),this._=t,this.v=null!=i?i:{},this.Rt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Pt=new l.EventLogger(t,o,n,i),this.Ct=new u.ErrorBoundary(t,i,o),this.Ct.wrap(this),this.Ct.wrap(n),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(n=null!=(o=(r=(0,s.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,d.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Lt=e.qt=e.Jt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:o(n,i),secondaryExposures:r,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Jt=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Lt=(t,e,n)=>{var i,r=e.__evaluation,o=!0===(null==(o=null==r?void 0:r.explicit_parameters)?void 0:o.includes(n));let s="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return o&&(s=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.1.0";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=void 0;const r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function s(o,s){return(t,e)=>{var n,i,r=null!=(r=null==o?void 0:o[t])?r:null;return null==r||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(r)!==i(n))?null!=e?e:null:(null!=s&&s(t),r)}}e.$t=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=function(t,e,n){return $P($P({},o(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:s(null==n?void 0:n.value)})},e.zt=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:s(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),e.vn=e.T=void 0;const i=n(832),r=n(780);e.T=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{}}},e.vn=function(t){return t?(0,i.li)(t):null}},444:function(t,n,e){var i=this&&this.__awaiter||$A(),r=($Q2(n,"__esModule",{value:!0}),n.U=n.P=n.Storage=void 0,e(780)),e=e(48);const o={},s=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>s(o[t]||null),C:(t,e)=>(o[t]=e,s()),F:t=>(delete o[t],s()),Yt:()=>s(Object.keys(o))};let l=null;try{const h=(0,e.It)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>h.localStorage.getItem(t),Wt:t=>s(h.localStorage.getItem(t)),C:(t,e)=>(h.localStorage.setItem(t,e),s()),F:t=>(h.localStorage.removeItem(t),s()),Yt:()=>s(Object.keys(h.localStorage))})}catch(t){r.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Qt(u),null;throw t}}n.Storage={Ht:()=>c.Ht(),Wt:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.Wt(t))}),N:t=>d(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},n.P=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},n.U=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.C(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.ui=void 0;const r=n(780);e.ui=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}},556:(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)})}},84:(t,e)=>{$Q(e),e.it=void 0,e.it=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;n=n(48);const i="foreground",r="background",o=[];let s=i,u=!1;e._t=()=>s===i,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==s&&(s=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>{(u=!1,e.Xt)(i)}),(0,n.Dt)("blur",()=>(0,e.Xt)(r)),(0,n.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(r)}),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?i:r)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$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.Log=e.Storage=e.EventLogger=void 0,n(496);const o=n(728),s=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));$Q2(e,"Log",{enumerable:!0,get:function(){return s.Log}});var u=n(972);const l=n(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),r(n(496),e),r(n(707),e),r(n(856),e),r(n(320),e),r(n(184),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(664),e),r(n(780),e),r(n(188),e),r(n(716),e),r(n(264),e),r(n(48),e),r(n(360),e),r(n(612),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(396),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:s.Log,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);function v(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,d.It)(),o=(0,d.kt)();if(r&&o&&o.currentScript){var s=o.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(s&&u){var l=new URL(s,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,function(){var t=(0,d.It)();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,d.yt)()||"",language:null==(i=t.navigator)?void 0:i.language})})}())).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.ai=void 0;const i=n(464);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var n;return(e=(0,i.ui)(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.li)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,i.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},400:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e);const u=n(464),l=n(96);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,o){return s(this,void 0,void 0,function*(){var t=i?(0,u.ui)(i,"has_updates","InitializeResponse"):null;let e={user:o,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.ue(n,t,e,r)})}ue(e,n,i,r){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(n,t.body))?t:this.ue(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},520:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const s=n(464),o=n(156),u=n(400),l=n(364);class i extends s.StatsigClientBase{static instance(t){var e=(0,s.i)().instance(t);return e instanceof i?e:(s.Log.warn((0,s.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){s.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return r(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this._),stableID:yield s.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.oi)(t),{evaluation:n,details:i}=this.le.getGate(n),i=(0,s.$t)(t,i,n),r=null==(r=null==(n=this.Rt)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.ae,e),n=null!=r?r:i;return this.Kt(t,(0,s.Jt)(this.ae,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,s.oi)(e),{evaluation:t,details:i}=this.le.getLayer(t),i=(0,s.zt)(e,i,t),r=null==(r=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.ae,n);const o=(0,s.Vt)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Kt(e,(0,s.Lt)(this.ae,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{s.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,s.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&s.StableID.setOverride(t,this._)}ve(t,e,n){var i=(0,s.oi)(e),{evaluation:i,details:r}=this.le.getConfig(i),r=(0,s.Bt)(e,r,i),i="experiment"===t?null==(t=null==(i=this.Rt)?void 0:i.getExperimentOverride)?void 0:t.call(i,r,this.ae,n):null==(i=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,r,this.ae,n),t=null!=i?i:r;return this.Kt(e,(0,s.qt)(this.ae,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.I(t,e,n)}prefetchData(t,e){return this.M(t,e)}setData(t){var e=(0,i.ui)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}D(e,n,i){var r;return o(this,void 0,void 0,function*(){var t=yield null==(r=this.V)?void 0:r.fetchEvaluations(this.G(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}m(t){t=(0,i.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.h}.`+t}fn(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.vn)(e)}}e.StatsigEvaluationsDataAdapter=s},208:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(520);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const s=n(464),r=n(76),o=n(724);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this._e=t,this.Ge=Date.now(),this.Ne=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.Ct=n,this.Ct.wrap(this),(0,s.kt)());(0,s.Et)()&&((e=null!=(e=(__STATSIG__=(0,s.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Ce()):this.Ce()}Re(){const e=(0,s.It)();var t,n=(0,s.kt)();e&&n&&(t=t=>{this.Pe(t||e.event)},(0,r.Fe)(n,"click",t),(0,r.Fe)(n,"submit",t),(0,r.Fe)(e,"error",t),(0,r.Fe)(e,"beforeunload",()=>this.Ue()),(0,r.Fe)(e,"scroll",()=>this.Ke()))}Pe(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Le(t):(e=(0,r.qe)(t))&&(0,r.ot)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.Je)(e),this.Ve(n,t,e))}Ce(){this.Re(),this.ze(),this.Be()}Le(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.Ve("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ze(){setTimeout(()=>{var t=(0,r.$e)(),t=(0,o.cn)(t);this.Ve("page_view",(0,r.He)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}Be(){const n=(0,s.It)();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&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Ve("performance",(0,r.He)(),t)},1)}Ue(){this.Ve("page_view_end",(0,r.He)(),{scrollDepth:this.Ne,pageViewLength:Date.now()-this.Ge},{flushImmediately:!0})}Ve(n,i,r,o){this.We().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,s.It)())?void 0:e.location)?void 0:e.href)?e:""},r),t=(null!=o&&o.addNewSessionMetadata&&(e.isNewSession=String(Math.abs(t.data.startTime-Date.now())<1e3)),{eventName:"auto_capture::"+n,value:i,metadata:e});this._e.logEvent(t),null!=o&&o.flushImmediately&&this._e.flush().catch(t=>{s.Log.error(t)})}).catch(t=>{this.Ct.logError("AC::enqueue",t)})}Ke(){var t=null!=(t=null==(t=(0,s.kt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.It)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ne=Math.max(this.Ne,Math.min(100,Math.round((n+e)/t*100)))}We(){return i(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).session})}}e.AutoCapture=u},76:(t,e,n)=>{$Q(e),e.Fe=e.He=e.$e=e.ot=e.qe=e.Je=void 0;const i=n(464);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.Je=function(t){var e=t.tagName.toLowerCase(),n={},i=e,r=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),o(t));return r&&(n.href=r.getAttribute("href")),{value:i,metadata:n}},e.qe=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.ot=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.$e=function(){var t=null!=(t=null==(t=null==(t=(0,i.It)())?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.He=function(){return(0,i.yt)()||""},e.Fe=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$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}),e.default=__STATSIG__},724:(t,e,n)=>{$Q(e),e.cn=void 0;const a=n(464);e.cn=function(t){var e=(0,a.kt)(),n=(0,a.It)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,r=(null==e?void 0:e.referrer)||"";let o=new URL("empty:");if(r)try{o=new URL(r||"empty:")}catch(t){}u=o,s=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===s?"p":"q")||"";var s={searchEngine:s,searchQuery:u},u=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 l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},s),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",referrer:r,screen_width:(null==(t=null==n?void 0:n.screen)?void 0:t.width)||"unknown",screen_height:(null==(s=null==n?void 0:n.screen)?void 0:s.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 s=r(824);var o=r(920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new s.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={496:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.dn=n.i=void 0,n.i=()=>__STATSIG__||u,n.dn=t=>(0,n.i)()[t];n.t=t=>{var e=(0,n.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},s="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[r])?i:e[r])?i:s[r])?i:{instance:n.t};o[r]=u,e[r]=u,s[r]=u},707:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const r=n(832);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.oi)(e.join("|"))}e.u=i,e.o=function(t,e,n){return e?i(t,e,n):(0,r.oi)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(780),a=n(604),o=n(296),s=n(444),c=n(412);function d(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,o.vn)(i)}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new i}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),n=this.S.get(e,t);return n||((n=this.O(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,o.T)(e,null==(e=this.v)?void 0:e.environment),n=this.m(e);this.S.add(n,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.S.merge(t)}I(e,n,i){return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.A(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(n,i){return r(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.I(null,n,i);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,s,u){return r(this,void 0,void 0,function*(){let t=null;o&&this.fn(o,s)&&(t=o.data);var e=yield this.D(t,s,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.ui)(e,"has_updates","Response"),i=this.G(),i=yield a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=d("Network",e,i,s);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=d("NetworkNotModified",t,i,s)}e=this.m(s);return this.S.add(e,r),yield this.k(e,r),r})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=s.Storage.N)?void 0:e.call(s.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return r(this,void 0,void 0,function*(){yield s.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,s.P)(this.p))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield s.Storage.F(e)),yield(0,s.U)(this.p,t)})}};class i{constructor(){this.ii={}}get(t,e){var t=this.ii[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.ii,9);n&&delete this.ii[n],this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),t)}}function u(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})}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this._=t,this.v=e,this.K=n,this.L=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.ci(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.q(e,t)):n}catch(t){return this.q(e,t),null}}q(o,s){try{i.Log.warn("Caught error in "+o,{error:s});n(this,void 0,void 0,function*(){var t,e,n=s||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.L.has(r)||(this.L.add(r),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:s}):(t=l.SDKType.J(this._),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:o,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.v)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.K)&&i.call(this,{name:"error",error:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(832),o=n(780),s=n(716),u=n(48),l=n(876),a=n(444),c=n(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this._=e,this.K=t,this.V=n,this.v=i,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==i?void 0:i.disableLogging),this.Z=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.et=(0,c.it)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return i(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.$[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=n}return!0}dt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(n=null==(e=this.v)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[s.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();i(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.bt(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.B.push(n)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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)};e.li=t=>(0,e.oi)(JSON.stringify(r(t)));const r=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];!Array.isArray(e)&&e instanceof Object&&(e=r(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class o{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=o).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},188:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const u=n(496),_=n(280),g=n(780),l=n(716),o=n(360),a=n(48),c=n(612),d=n(604),h=n(972),y=n(100);e.NetworkCore=class{constructor(t,e){this.K=e,this.St=1e4,this.ri={},this.v={},t&&(this.v=t),this.v.networkConfig&&(this.ri=this.v.networkConfig),this.ri.networkTimeoutMs&&(this.St=this.ri.networkTimeoutMs)}post(e){return s(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield this.hn(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return s(this,void 0,void 0,function*(){var t,e,n;return!!b(i)&&(t=yield this.Ot(i),t=yield this.hn(i,t),e=yield this.wt(i),(n=navigator).sendBeacon.bind(n)(e,t))})}jt(h){var v,f;return s(this,void 0,void 0,function*(){if(!b(h))return null;if(this.ri.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===r||void 0===r?void 0:r.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(h),s=null,u=(0,y.ti)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===r||void 0===r?void 0:r.signal,priority:h.priority,keepalive:u},s=yield(null!=(v=this.ri.networkOverrideFunc)?v:fetch)(o,d);if(clearTimeout(t),s.ok)return c=yield s.text(),_.Diagnostics.mark(),{body:c,code:s.status};throw l=yield s.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){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"}(r,t);return _.Diagnostics.mark(),!i||i<=0?(null!=(f=this.K)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.jt($P($P({},h),{retries:i-1}))}})}wt(n){return s(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:n.sdkKey,[l.NetworkParam.SdkType]:o.SDKType.J(n.sdkKey),[l.NetworkParam.SdkVersion]:h.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return n.url+(t?"?"+t:"")})}Ot(r){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield d.StableID.get(e),i=yield c.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Tt(t,e){var n,i,r=(0,a.It)();if(!t.isStatsigEncodable||this.v.disableStatsigEncoding||null!=(0,u.dn)("no-encode")||null==r||!r.btoa)return e;try{var o=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),o}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}hn(i,r){var o;return s(this,void 0,void 0,function*(){var t,e,n;return!i.isCompressable||this.v.disableCompression||null!=(0,u.dn)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder?r:(t=(new TextEncoder).encode(r),(n=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(g.Log.error),n.close().catch(g.Log.error),i.params=$P($P({},null!=(o=i.params)?o:{}),{[l.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer())})}};const b=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={J:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.yt=i.xt=i.Dt=i.Et=i.kt=i.It=void 0;i.It=()=>"undefined"!=typeof window?window:null,i.kt=()=>{var t=(0,i.It)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.kt)(),i.Dt=(t,e)=>{var n=(0,i.It)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.yt=()=>{var t;try{return null==(t=(0,i.It)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(707),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,i.o)(t)}e.SessionID={get:t=>s(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>s(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(n){return s(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.P)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(o));var t=yield h[o],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;return r=f(r),(0,l.U)(r,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t})}},604:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const r=n(707),o=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.o)(t)}function c(t,e){e=a(e);(0,s.U)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,s.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(496);const s=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var r,o=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Nt(!0),this._=t,this.v=null!=i?i:{},this.Rt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Pt=new l.EventLogger(t,o,n,i),this.Ct=new u.ErrorBoundary(t,i,o),this.Ct.wrap(this),this.Ct.wrap(n),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(n=null!=(o=(r=(0,s.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,d.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Lt=e.qt=e.Jt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:o(n,i),secondaryExposures:r,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Jt=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Lt=(t,e,n)=>{var i,r=e.__evaluation,o=!0===(null==(o=null==r?void 0:r.explicit_parameters)?void 0:o.includes(n));let s="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return o&&(s=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.1.1";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=void 0;const r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function s(o,s){return(t,e)=>{var n,i,r=null!=(r=null==o?void 0:o[t])?r:null;return null==r||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(r)!==i(n))?null!=e?e:null:(null!=s&&s(t),r)}}e.$t=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=function(t,e,n){return $P($P({},o(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:s(null==n?void 0:n.value)})},e.zt=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:s(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),e.vn=e.T=void 0;const i=n(832),r=n(780);e.T=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{}}},e.vn=function(t){return t?(0,i.li)(t):null}},444:function(t,n,e){var i=this&&this.__awaiter||$A(),r=($Q2(n,"__esModule",{value:!0}),n.U=n.P=n.Storage=void 0,e(780)),e=e(48);const o={},s=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>s(o[t]||null),C:(t,e)=>(o[t]=e,s()),F:t=>(delete o[t],s()),Yt:()=>s(Object.keys(o))};let l=null;try{const h=(0,e.It)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>h.localStorage.getItem(t),Wt:t=>s(h.localStorage.getItem(t)),C:(t,e)=>(h.localStorage.setItem(t,e),s()),F:t=>(h.localStorage.removeItem(t),s()),Yt:()=>s(Object.keys(h.localStorage))})}catch(t){r.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Qt(u),null;throw t}}n.Storage={Ht:()=>c.Ht(),Wt:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.Wt(t))}),N:t=>d(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},n.P=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},n.U=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.C(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.ui=void 0;const r=n(780);e.ui=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}},556:(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)})}},84:(t,e)=>{$Q(e),e.it=void 0,e.it=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;n=n(48);const i="foreground",r="background",o=[];let s=i,u=!1;e._t=()=>s===i,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==s&&(s=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>{(u=!1,e.Xt)(i)}),(0,n.Dt)("blur",()=>(0,e.Xt)(r)),(0,n.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(r)}),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?i:r)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$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.Log=e.Storage=e.EventLogger=void 0,n(496);const o=n(728),s=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));$Q2(e,"Log",{enumerable:!0,get:function(){return s.Log}});var u=n(972);const l=n(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),r(n(496),e),r(n(707),e),r(n(856),e),r(n(320),e),r(n(184),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(664),e),r(n(780),e),r(n(188),e),r(n(716),e),r(n(264),e),r(n(48),e),r(n(360),e),r(n(612),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(396),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:s.Log,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);function v(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,d.It)(),o=(0,d.kt)();if(r&&o&&o.currentScript){var s=o.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(s&&u){var l=new URL(s,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,function(){var t=(0,d.It)();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,d.yt)()||"",language:null==(i=t.navigator)?void 0:i.language})})}())).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.ai=void 0;const i=n(464);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var n;return(e=(0,i.ui)(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.li)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,i.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},400:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e);const u=n(464),l=n(96);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,o){return s(this,void 0,void 0,function*(){var t=i?(0,u.ui)(i,"has_updates","InitializeResponse"):null;let e={user:o,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.ue(n,t,e,r)})}ue(e,n,i,r){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(n,t.body))?t:this.ue(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},520:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const s=n(464),o=n(156),u=n(400),l=n(364);class i extends s.StatsigClientBase{static instance(t){var e=(0,s.i)().instance(t);return e instanceof i?e:(s.Log.warn((0,s.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){s.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return r(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this._),stableID:yield s.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.oi)(t),{evaluation:n,details:i}=this.le.getGate(n),i=(0,s.$t)(t,i,n),r=null==(r=null==(n=this.Rt)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.ae,e),n=null!=r?r:i;return this.Kt(t,(0,s.Jt)(this.ae,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,s.oi)(e),{evaluation:t,details:i}=this.le.getLayer(t),i=(0,s.zt)(e,i,t),r=null==(r=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.ae,n);const o=(0,s.Vt)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Kt(e,(0,s.Lt)(this.ae,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{s.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,s.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&s.StableID.setOverride(t,this._)}ve(t,e,n){var i=(0,s.oi)(e),{evaluation:i,details:r}=this.le.getConfig(i),r=(0,s.Bt)(e,r,i),i="experiment"===t?null==(t=null==(i=this.Rt)?void 0:i.getExperimentOverride)?void 0:t.call(i,r,this.ae,n):null==(i=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,r,this.ae,n),t=null!=i?i:r;return this.Kt(e,(0,s.qt)(this.ae,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.I(t,e,n)}prefetchData(t,e){return this.M(t,e)}setData(t){var e=(0,i.ui)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}D(e,n,i){var r;return o(this,void 0,void 0,function*(){var t=yield null==(r=this.V)?void 0:r.fetchEvaluations(this.G(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}m(t){t=(0,i.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.h}.`+t}fn(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.vn)(e)}}e.StatsigEvaluationsDataAdapter=s},208:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(520);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const s=n(464),r=n(76),o=n(724);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this._e=t,this.Ge=Date.now(),this.Ne=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.Ct=n,this.Ct.wrap(this),(0,s.kt)());(0,s.Et)()&&((e=null!=(e=(__STATSIG__=(0,s.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Ce()):this.Ce()}Re(){const e=(0,s.It)();var t,n=(0,s.kt)();e&&n&&(t=t=>{this.Pe(t||e.event)},(0,r.Fe)(n,"click",t),(0,r.Fe)(n,"submit",t),(0,r.Fe)(e,"error",t),(0,r.Fe)(e,"beforeunload",()=>this.Ue()),(0,r.Fe)(e,"scroll",()=>this.Ke()))}Pe(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Le(t):(e=(0,r.qe)(t))&&(0,r.ot)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.Je)(e),this.Ve(n,t,e))}Ce(){this.Re(),this.ze(),this.Be()}Le(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.Ve("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ze(){setTimeout(()=>{var t=(0,r.$e)(),t=(0,o.cn)(t);this.Ve("page_view",(0,r.He)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}Be(){const n=(0,s.It)();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&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Ve("performance",(0,r.He)(),t)},1)}Ue(){this.Ve("page_view_end",(0,r.He)(),{scrollDepth:this.Ne,pageViewLength:Date.now()-this.Ge},{flushImmediately:!0})}Ve(n,i,r,o){this.We().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,s.It)())?void 0:e.location)?void 0:e.href)?e:""},r),t=(null!=o&&o.addNewSessionMetadata&&(e.isNewSession=String(Math.abs(t.data.startTime-Date.now())<1e3)),{eventName:"auto_capture::"+n,value:i,metadata:e});this._e.logEvent(t),null!=o&&o.flushImmediately&&this._e.flush().catch(t=>{s.Log.error(t)})}).catch(t=>{this.Ct.logError("AC::enqueue",t)})}Ke(){var t=null!=(t=null==(t=(0,s.kt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.It)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ne=Math.max(this.Ne,Math.min(100,Math.round((n+e)/t*100)))}We(){return i(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).session})}}e.AutoCapture=u},76:(t,e,n)=>{$Q(e),e.Fe=e.He=e.$e=e.ot=e.qe=e.Je=void 0;const i=n(464);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.Je=function(t){var e=t.tagName.toLowerCase(),n={},i=e,r=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),o(t));return r&&(n.href=r.getAttribute("href")),{value:i,metadata:n}},e.qe=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.ot=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.$e=function(){var t=null!=(t=null==(t=null==(t=(0,i.It)())?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.He=function(){return(0,i.yt)()||""},e.Fe=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$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}),e.default=__STATSIG__},724:(t,e,n)=>{$Q(e),e.cn=void 0;const a=n(464);e.cn=function(t){var e=(0,a.kt)(),n=(0,a.It)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,r=(null==e?void 0:e.referrer)||"";let o=new URL("empty:");if(r)try{o=new URL(r||"empty:")}catch(t){}u=o,s=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===s?"p":"q")||"";var s={searchEngine:s,searchQuery:u},u=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 l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},s),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",referrer:r,screen_width:(null==(t=null==n?void 0:n.screen)?void 0:t.width)||"unknown",screen_height:(null==(s=null==n?void 0:n.screen)?void 0:s.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 s=r(824);var o=r(920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new s.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={496:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.dn=i.i=void 0,i.i=()=>__STATSIG__||u,i.dn=t=>(0,i.i)()[t];i.t=t=>{var e=(0,i.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:e[s])?n:r[s])?n:{instance:i.t};o[s]=u,e[s]=u,r[s]=u},707:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(832);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.oi)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.oi)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(780),a=i(604),o=i(296),r=i(444),c=i(412);function d(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,o.vn)(n)}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),i=this.S.get(e,t);return i||((i=this.O(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,o.T)(e,null==(e=this.v)?void 0:e.environment),i=this.m(e);this.S.add(i,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.S.merge(t)}I(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.A(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(i,n){return s(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.I(null,i,n);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,r,u){return s(this,void 0,void 0,function*(){let t=null;o&&this.fn(o,r)&&(t=o.data);var e=yield this.D(t,r,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.ui)(e,"has_updates","Response"),n=this.G(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=d("Network",e,n,r);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=d("NetworkNotModified",t,n,r)}e=this.m(r);return this.S.add(e,s),yield this.k(e,s),s})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=r.Storage.N)?void 0:e.call(r.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return s(this,void 0,void 0,function*(){yield r.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,r.P)(this.p))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield r.Storage.F(e)),yield(0,r.U)(this.p,t)})}};class n{constructor(){this.ii={}}get(t,e){var t=this.ii[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.ii,9);i&&delete this.ii[i],this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),t)}}function u(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})}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this._=t,this.v=e,this.K=i,this.L=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.ci(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.q(e,t)):i}catch(t){return this.q(e,t),null}}q(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=r||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.L.has(s)||(this.L.add(s),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:r}):(t=l.SDKType.J(this._),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:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.v)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.K)&&n.call(this,{name:"error",error:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(832),o=i(780),r=i(716),u=i(48),l=i(876),a=i(444),c=i(84),d=i(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,i,n){this._=e,this.K=t,this.V=i,this.v=n,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==n?void 0:n.disableLogging),this.Z=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null==n?void 0:n.networkConfig;this.et=(0,c.it)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",r.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return n(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},i=t.metadata||{},t=[t.eventName,e.userID,i.gate,i.config,i.ruleID].join("|"),e=this.$[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=i}return!0}dt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(i=null==(e=this.v)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[r.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();n(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.bt(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.B.push(i)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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)};e.li=t=>(0,e.oi)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];!Array.isArray(e)&&e instanceof Object&&(e=s(e)),n[t]=e}),n}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},188:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(496);const u=i(496),_=i(280),y=i(780),l=i(716),o=i(360),a=i(48),c=i(612),d=i(604),h=i(972),b=i(100);e.NetworkCore=class{constructor(t,e){this.K=e,this.St=1e4,this.ri={},this.v={},t&&(this.v=t),this.v.networkConfig&&(this.ri=this.v.networkConfig),this.ri.networkTimeoutMs&&(this.St=this.ri.networkTimeoutMs)}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield this.hn(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!g(n)&&(t=yield this.Ot(n),t=yield this.hn(n,t),e=yield this.wt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}jt(h){var v,f;return r(this,void 0,void 0,function*(){if(!g(h))return null;if(this.ri.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n}=h;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(h),r=null,u=(0,b.ti)();try{var l,a,c,d={method:e,body:i,headers:$P({},h.headers),signal:null===s||void 0===s?void 0:s.signal,priority:h.priority,keepalive:u},r=yield(null!=(v=this.ri.networkOverrideFunc)?v:fetch)(o,d);if(clearTimeout(t),r.ok)return c=yield r.text(),_.Diagnostics.mark(),{body:c,code:r.status};throw l=yield r.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){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"}(s,t);return _.Diagnostics.mark(),!n||n<=0?(null!=(f=this.K)&&f.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.jt($P($P({},h),{retries:n-1}))}})}wt(i){return r(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:i.sdkKey,[l.NetworkParam.SdkType]:o.SDKType.J(i.sdkKey),[l.NetworkParam.SdkVersion]:h.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return i.url+(t?"?"+t:"")})}Ot(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield d.StableID.get(e),n=yield c.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Tt(t,e){var i,n,s=(0,a.It)();if(!t.isStatsigEncodable||this.v.disableStatsigEncoding||null!=(0,u.dn)("no-encode")||null==s||!s.btoa)return e;try{var o=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),o}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}hn(n,s){var o;return r(this,void 0,void 0,function*(){var t,e,i;return!n.isCompressable||this.v.disableCompression||null!=(0,u.dn)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder?s:(t=(new TextEncoder).encode(s),(i=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(y.Log.error),i.close().catch(y.Log.error),n.params=$P($P({},null!=(o=n.params)?o:{}),{[l.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer())})}};const g=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={J:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},Mt(t){n&&"-react"!==n||(n="-"+t)}}},48:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.yt=n.xt=n.Dt=n.Et=n.kt=n.It=void 0;n.It=()=>"undefined"!=typeof window?window:null,n.kt=()=>{var t=(0,n.It)();return null!=(t=null==t?void 0:t.document)?t:null},n.Et=()=>null!=(0,n.kt)(),n.Dt=(t,e)=>{var i=(0,n.It)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.xt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.yt=()=>{var t;try{return null==(t=(0,n.It)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(707),u=i(780),l=i(444),a=i(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>r(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>r(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(i){return r(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.P)(t)}(i);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:i}})}(o));var t=yield h[o],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>d}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;return s=f(s),(0,l.U)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,d-e),t})}},604:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=i(707),o=i(780),r=i(444),u=i(556),l={};function a(t){return"statsig.stable_id."+(0,s.o)(t)}function c(t,e){e=a(e);(0,r.U)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(496);const r=i(496),u=i(512),l=i(728),a=i(780),c=i(48),d=i(444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Nt(!0),this._=t,this.v=null!=n?n:{},this.Rt=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Pt=new l.EventLogger(t,o,i,n),this.Ct=new u.ErrorBoundary(t,n,o),this.Ct.wrap(this),this.Ct.wrap(i),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(i=null!=(o=(s=(0,r.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,d.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Gt[i.name]&&this.Gt[i.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Lt=e.qt=e.Jt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Jt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Lt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.1.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.$t=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.Bt=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.zt=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.Vt=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},136:(t,e)=>{$Q(e)},296:(t,e,i)=>{$Q(e),e.vn=e.T=void 0;const n=i(832),s=i(780);e.T=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{}}},e.vn=function(t){return t?(0,n.li)(t):null}},444:function(t,i,e){var n=this&&this.__awaiter||$A(),s=($Q2(i,"__esModule",{value:!0}),i.U=i.P=i.Storage=void 0,e(780)),e=e(48);const o={},r=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>r(o[t]||null),C:(t,e)=>(o[t]=e,r()),F:t=>(delete o[t],r()),Yt:()=>r(Object.keys(o))};let l=null;try{const h=(0,e.It)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>h.localStorage.getItem(t),Wt:t=>r(h.localStorage.getItem(t)),C:(t,e)=>(h.localStorage.setItem(t,e),r()),F:t=>(h.localStorage.removeItem(t),r()),Yt:()=>r(Object.keys(h.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.Qt(u),null;throw t}}i.Storage={Ht:()=>c.Ht(),Wt:t=>n(void 0,void 0,void 0,function*(){return d(()=>c.Wt(t))}),N:t=>d(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},i.P=function(e){return n(this,void 0,void 0,function*(){var t=yield i.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},i.U=function(t,e){return n(this,void 0,void 0,function*(){yield i.Storage.C(t,JSON.stringify(e))})}},412:(t,e,i)=>{$Q(e),e.ui=void 0;const s=i(780);e.ui=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}},556:(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)})}},84:(t,e)=>{$Q(e),e.it=void 0,e.it=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;i=i(48);const n="foreground",s="background",o=[];let r=n,u=!1;e._t=()=>r===n,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>{(u=!1,e.Xt)(n)}),(0,i.Dt)("blur",()=>(0,e.Xt)(s)),(0,i.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(s)}),(0,i.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?n:s)})},464: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.Log=e.Storage=e.EventLogger=void 0,i(496);const o=i(728),r=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(780));$Q2(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(972);const l=i(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(i(496),e),s(i(707),e),s(i(856),e),s(i(320),e),s(i(184),e),s(i(512),e),s(i(500),e),s(i(788),e),s(i(832),e),s(i(664),e),s(i(780),e),s(i(188),e),s(i(716),e),s(i(264),e),s(i(48),e),s(i(360),e),s(i(612),e),s(i(604),e),s(i(688),e),s(i(808),e),s(i(283),e),s(i(876),e),s(i(972),e),s(i(384),e),s(i(396),e),s(i(136),e),s(i(296),e),s(i(444),e),s(i(412),e),s(i(84),e),s(i(539),e),s(i(556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:r.Log,SDK_VERSION:u.SDK_VERSION})},696: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(208),e),e.default=__STATSIG__},96:(t,e,i)=>{$Q(e),e.ai=void 0;const n=i(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var i;return(e=(0,n.ui)(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.li)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,i)=>{$Q(e);const n=i(464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,n.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,n.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},400:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const u=i(464),l=i(96);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,o){return r(this,void 0,void 0,function*(){var t=n?(0,u.ui)(n,"has_updates","InitializeResponse"):null;let e={user:o,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.ue(i,t,e,s)})}ue(e,i,n,s){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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!=(o=null==t?void 0:t.body)?o:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(i,t.body))?t:this.ue(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},520:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const r=i(464),o=i(536),u=i(400),l=i(364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn((0,r.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.ce(i);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this._),stableID:yield r.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.oi)(t),{evaluation:i,details:n}=this.le.getGate(i),n=(0,r.$t)(t,n,i),s=null==(s=null==(i=this.Rt)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ae,e),i=null!=s?s:n;return this.Kt(t,(0,r.Jt)(this.ae,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.oi)(e),{evaluation:t,details:n}=this.le.getLayer(t),n=(0,r.zt)(e,n,t),s=null==(s=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ae,i);const o=(0,r.Vt)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Kt(e,(0,r.Lt)(this.ae,o,t),i)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,r.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&r.StableID.setOverride(t,this._)}ve(t,e,i){var n=(0,r.oi)(e),{evaluation:n,details:s}=this.le.getConfig(n),s=(0,r.Bt)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Rt)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.ae,i):null==(n=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.ae,i),t=null!=n?n:s;return this.Kt(e,(0,r.qt)(this.ae,t),i),t}}e.default=n},364:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(464),s=i(400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.I(t,e,i)}prefetchData(t,e){return this.M(t,e)}setData(t){var e=(0,n.ui)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}D(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield null==(s=this.V)?void 0:s.fetchEvaluations(this.G(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}m(t){t=(0,n.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.h}.`+t}fn(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.vn)(e)}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(520);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.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(696).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={496:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.dn=i.i=void 0,i.i=()=>__STATSIG__||u,i.dn=t=>(0,i.i)()[t];i.t=t=>{var e=(0,i.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:e[s])?n:r[s])?n:{instance:i.t};o[s]=u,e[s]=u,r[s]=u},707:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(832);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.oi)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.oi)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(780),a=i(604),o=i(296),r=i(444),c=i(412);function d(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,o.vn)(n)}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),i=this.S.get(e,t);return i||((i=this.O(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,o.T)(e,null==(e=this.v)?void 0:e.environment),i=this.m(e);this.S.add(i,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.S.merge(t)}I(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.A(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(i,n){return s(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.I(null,i,n);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,r,u){return s(this,void 0,void 0,function*(){let t=null;o&&this.fn(o,r)&&(t=o.data);var e=yield this.D(t,r,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.ui)(e,"has_updates","Response"),n=this.G(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=d("Network",e,n,r);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=d("NetworkNotModified",t,n,r)}e=this.m(r);return this.S.add(e,s),yield this.k(e,s),s})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=r.Storage.N)?void 0:e.call(r.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return s(this,void 0,void 0,function*(){yield r.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,r.P)(this.p))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield r.Storage.F(e)),yield(0,r.U)(this.p,t)})}};class n{constructor(){this.ii={}}get(t,e){var t=this.ii[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.ii,9);i&&delete this.ii[i],this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),t)}}function u(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})}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this._=t,this.v=e,this.K=i,this.L=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.ci(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.q(e,t)):i}catch(t){return this.q(e,t),null}}q(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=r||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.L.has(s)||(this.L.add(s),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:r}):(t=l.SDKType.J(this._),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:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.v)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.K)&&n.call(this,{name:"error",error:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(832),o=i(780),r=i(716),u=i(48),l=i(876),a=i(444),c=i(84),d=i(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,i,n){this._=e,this.K=t,this.V=i,this.v=n,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==n?void 0:n.disableLogging),this.Z=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null==n?void 0:n.networkConfig;this.et=(0,c.it)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",r.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return n(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},i=t.metadata||{},t=[t.eventName,e.userID,i.gate,i.config,i.ruleID].join("|"),e=this.$[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=i}return!0}dt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(i=null==(e=this.v)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[r.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();n(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.bt(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.B.push(i)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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)};e.li=t=>(0,e.oi)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];!Array.isArray(e)&&e instanceof Object&&(e=s(e)),n[t]=e}),n}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},188:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(496);const u=i(496),_=i(280),y=i(780),l=i(716),o=i(360),a=i(48),c=i(612),d=i(604),h=i(972),b=i(100);e.NetworkCore=class{constructor(t,e){this.K=e,this.St=1e4,this.ri={},this.v={},t&&(this.v=t),this.v.networkConfig&&(this.ri=this.v.networkConfig),this.ri.networkTimeoutMs&&(this.St=this.ri.networkTimeoutMs)}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield this.hn(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!g(n)&&(t=yield this.Ot(n),t=yield this.hn(n,t),e=yield this.wt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}jt(h){var v,f;return r(this,void 0,void 0,function*(){if(!g(h))return null;if(this.ri.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n}=h;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(h),r=null,u=(0,b.ti)();try{var l,a,c,d={method:e,body:i,headers:$P({},h.headers),signal:null===s||void 0===s?void 0:s.signal,priority:h.priority,keepalive:u},r=yield(null!=(v=this.ri.networkOverrideFunc)?v:fetch)(o,d);if(clearTimeout(t),r.ok)return c=yield r.text(),_.Diagnostics.mark(),{body:c,code:r.status};throw l=yield r.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){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"}(s,t);return _.Diagnostics.mark(),!n||n<=0?(null!=(f=this.K)&&f.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.jt($P($P({},h),{retries:n-1}))}})}wt(i){return r(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:i.sdkKey,[l.NetworkParam.SdkType]:o.SDKType.J(i.sdkKey),[l.NetworkParam.SdkVersion]:h.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return i.url+(t?"?"+t:"")})}Ot(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield d.StableID.get(e),n=yield c.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Tt(t,e){var i,n,s=(0,a.It)();if(!t.isStatsigEncodable||this.v.disableStatsigEncoding||null!=(0,u.dn)("no-encode")||null==s||!s.btoa)return e;try{var o=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),o}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}hn(n,s){var o;return r(this,void 0,void 0,function*(){var t,e,i;return!n.isCompressable||this.v.disableCompression||null!=(0,u.dn)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder?s:(t=(new TextEncoder).encode(s),(i=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(y.Log.error),i.close().catch(y.Log.error),n.params=$P($P({},null!=(o=n.params)?o:{}),{[l.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer())})}};const g=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={J:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},Mt(t){n&&"-react"!==n||(n="-"+t)}}},48:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.yt=n.xt=n.Dt=n.Et=n.kt=n.It=void 0;n.It=()=>"undefined"!=typeof window?window:null,n.kt=()=>{var t=(0,n.It)();return null!=(t=null==t?void 0:t.document)?t:null},n.Et=()=>null!=(0,n.kt)(),n.Dt=(t,e)=>{var i=(0,n.It)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.xt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.yt=()=>{var t;try{return null==(t=(0,n.It)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(707),u=i(780),l=i(444),a=i(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>r(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>r(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(i){return r(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.P)(t)}(i);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:i}})}(o));var t=yield h[o],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>d}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;return s=f(s),(0,l.U)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,d-e),t})}},604:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=i(707),o=i(780),r=i(444),u=i(556),l={};function a(t){return"statsig.stable_id."+(0,s.o)(t)}function c(t,e){e=a(e);(0,r.U)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(496);const r=i(496),u=i(512),l=i(728),a=i(780),c=i(48),d=i(444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Nt(!0),this._=t,this.v=null!=n?n:{},this.Rt=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Pt=new l.EventLogger(t,o,i,n),this.Ct=new u.ErrorBoundary(t,n,o),this.Ct.wrap(this),this.Ct.wrap(i),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(i=null!=(o=(s=(0,r.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,d.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Gt[i.name]&&this.Gt[i.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Lt=e.qt=e.Jt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Jt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Lt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.1.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.$t=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.Bt=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.zt=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.Vt=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},136:(t,e)=>{$Q(e)},296:(t,e,i)=>{$Q(e),e.vn=e.T=void 0;const n=i(832),s=i(780);e.T=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{}}},e.vn=function(t){return t?(0,n.li)(t):null}},444:function(t,i,e){var n=this&&this.__awaiter||$A(),s=($Q2(i,"__esModule",{value:!0}),i.U=i.P=i.Storage=void 0,e(780)),e=e(48);const o={},r=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>r(o[t]||null),C:(t,e)=>(o[t]=e,r()),F:t=>(delete o[t],r()),Yt:()=>r(Object.keys(o))};let l=null;try{const h=(0,e.It)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>h.localStorage.getItem(t),Wt:t=>r(h.localStorage.getItem(t)),C:(t,e)=>(h.localStorage.setItem(t,e),r()),F:t=>(h.localStorage.removeItem(t),r()),Yt:()=>r(Object.keys(h.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.Qt(u),null;throw t}}i.Storage={Ht:()=>c.Ht(),Wt:t=>n(void 0,void 0,void 0,function*(){return d(()=>c.Wt(t))}),N:t=>d(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},i.P=function(e){return n(this,void 0,void 0,function*(){var t=yield i.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},i.U=function(t,e){return n(this,void 0,void 0,function*(){yield i.Storage.C(t,JSON.stringify(e))})}},412:(t,e,i)=>{$Q(e),e.ui=void 0;const s=i(780);e.ui=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}},556:(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)})}},84:(t,e)=>{$Q(e),e.it=void 0,e.it=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;i=i(48);const n="foreground",s="background",o=[];let r=n,u=!1;e._t=()=>r===n,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>{(u=!1,e.Xt)(n)}),(0,i.Dt)("blur",()=>(0,e.Xt)(s)),(0,i.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(s)}),(0,i.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?n:s)})},464: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.Log=e.Storage=e.EventLogger=void 0,i(496);const o=i(728),r=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(780));$Q2(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(972);const l=i(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(i(496),e),s(i(707),e),s(i(856),e),s(i(320),e),s(i(184),e),s(i(512),e),s(i(500),e),s(i(788),e),s(i(832),e),s(i(664),e),s(i(780),e),s(i(188),e),s(i(716),e),s(i(264),e),s(i(48),e),s(i(360),e),s(i(612),e),s(i(604),e),s(i(688),e),s(i(808),e),s(i(283),e),s(i(876),e),s(i(972),e),s(i(384),e),s(i(396),e),s(i(136),e),s(i(296),e),s(i(444),e),s(i(412),e),s(i(84),e),s(i(539),e),s(i(556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:r.Log,SDK_VERSION:u.SDK_VERSION})},696: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(208),e),e.default=__STATSIG__},96:(t,e,i)=>{$Q(e),e.ai=void 0;const n=i(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var i;return(e=(0,n.ui)(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.li)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,i)=>{$Q(e);const n=i(464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,n.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,n.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},400:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const u=i(464),l=i(96);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,o){return r(this,void 0,void 0,function*(){var t=n?(0,u.ui)(n,"has_updates","InitializeResponse"):null;let e={user:o,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.ue(i,t,e,s)})}ue(e,i,n,s){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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!=(o=null==t?void 0:t.body)?o:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(i,t.body))?t:this.ue(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},520:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const r=i(464),o=i(536),u=i(400),l=i(364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn((0,r.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.ce(i);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this._),stableID:yield r.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.oi)(t),{evaluation:i,details:n}=this.le.getGate(i),n=(0,r.$t)(t,n,i),s=null==(s=null==(i=this.Rt)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ae,e),i=null!=s?s:n;return this.Kt(t,(0,r.Jt)(this.ae,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.oi)(e),{evaluation:t,details:n}=this.le.getLayer(t),n=(0,r.zt)(e,n,t),s=null==(s=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ae,i);const o=(0,r.Vt)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Kt(e,(0,r.Lt)(this.ae,o,t),i)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,r.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&r.StableID.setOverride(t,this._)}ve(t,e,i){var n=(0,r.oi)(e),{evaluation:n,details:s}=this.le.getConfig(n),s=(0,r.Bt)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Rt)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.ae,i):null==(n=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.ae,i),t=null!=n?n:s;return this.Kt(e,(0,r.qt)(this.ae,t),i),t}}e.default=n},364:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(464),s=i(400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.I(t,e,i)}prefetchData(t,e){return this.M(t,e)}setData(t){var e=(0,n.ui)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}D(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield null==(s=this.V)?void 0:s.fetchEvaluations(this.G(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}m(t){t=(0,n.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.h}.`+t}fn(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.vn)(e)}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(520);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.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(696).default})());
|
package/package.json
CHANGED