UNPKG

@atlassian/aui

Version:

Atlassian User Interface library

15 lines 188 kB
/*!! * @atlassian/aui - Atlassian User Interface library * @version v10.0.0 * @link https://aui.atlassian.com * @license Apache-2.0 * @author Atlassian Pty Ltd. */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("@atlassian/aui",[],t):"object"==typeof exports?exports["@atlassian/aui"]=t():(e.AJS=e.AJS||{},e.AJS.DesignTokens=t())}(window,(()=>(()=>{var e={6572:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var o=r(1634);function i(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,r){var s=t.map((function(t){var s=function(e,t){return null==t?e:n(n({},e),{options:n(n({},i(t)),i(e.options))})}(t,r);return(0,o.bind)(e,s)}));return function(){s.forEach((function(e){return e()}))}}},1634:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var r=t.type,n=t.listener,o=t.options;return e.addEventListener(r,n,o),function(){e.removeEventListener(r,n,o)}}},1833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=t.bind=void 0;var n=r(1634);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return n.bind}});var o=r(6572);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return o.bindAll}})},7553:(e,t,r)=>{var n; /*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. */!function(o){var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=10;function a(){this._events={},this._conf&&l.call(this,this._conf)}function l(e){e?(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),this._maxListeners=e.maxListeners!==o?e.maxListeners:s,e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this.newListener=e.newListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=s}function c(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}function d(e){this._events={},this.newListener=!1,this.verboseMemoryLeak=!1,l.call(this,e)}function u(e,t,r,n){if(!r)return[];var o,i,s,a,l,c,d,h=[],g=t.length,p=t[n],f=t[n+1];if(n===g&&r._listeners){if("function"==typeof r._listeners)return e&&e.push(r._listeners),[r];for(o=0,i=r._listeners.length;o<i;o++)e&&e.push(r._listeners[o]);return[r]}if("*"===p||"**"===p||r[p]){if("*"===p){for(s in r)"_listeners"!==s&&r.hasOwnProperty(s)&&(h=h.concat(u(e,t,r[s],n+1)));return h}if("**"===p){for(s in(d=n+1===g||n+2===g&&"*"===f)&&r._listeners&&(h=h.concat(u(e,t,r,g))),r)"_listeners"!==s&&r.hasOwnProperty(s)&&("*"===s||"**"===s?(r[s]._listeners&&!d&&(h=h.concat(u(e,t,r[s],g))),h=h.concat(u(e,t,r[s],n))):h=s===f?h.concat(u(e,t,r[s],n+2)):h.concat(u(e,t,r[s],n)));return h}h=h.concat(u(e,t,r[p],n+1))}if((a=r["*"])&&u(e,t,a,n+1),l=r["**"])if(n<g)for(s in l._listeners&&u(e,t,l,g),l)"_listeners"!==s&&l.hasOwnProperty(s)&&(s===f?u(e,t,l[s],n+2):s===p?u(e,t,l[s],n+1):((c={})[s]=l[s],u(e,t,{"**":c},n+1)));else l._listeners?u(e,t,l,g):l["*"]&&l["*"]._listeners&&u(e,t,l["*"],g);return h}function h(e,t){for(var r=0,n=(e="string"==typeof e?e.split(this.delimiter):e.slice()).length;r+1<n;r++)if("**"===e[r]&&"**"===e[r+1])return;for(var i=this.listenerTree,s=e.shift();s!==o;){if(i[s]||(i[s]={}),i=i[s],0===e.length)return i._listeners?("function"==typeof i._listeners&&(i._listeners=[i._listeners]),i._listeners.push(t),!i._listeners.warned&&this._maxListeners>0&&i._listeners.length>this._maxListeners&&(i._listeners.warned=!0,c.call(this,i._listeners.length,s))):i._listeners=t,!0;s=e.shift()}return!0}d.EventEmitter2=d,d.prototype.delimiter=".",d.prototype.setMaxListeners=function(e){e!==o&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},d.prototype.event="",d.prototype.once=function(e,t){return this._once(e,t,!1)},d.prototype.prependOnceListener=function(e,t){return this._once(e,t,!0)},d.prototype._once=function(e,t,r){return this._many(e,1,t,r),this},d.prototype.many=function(e,t,r){return this._many(e,t,r,!1)},d.prototype.prependMany=function(e,t,r){return this._many(e,t,r,!0)},d.prototype._many=function(e,t,r,n){var o=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function i(){return 0==--t&&o.off(e,i),r.apply(this,arguments)}return i._origin=r,this._on(e,i,n),o},d.prototype.emit=function(){this._events||a.call(this);var e=arguments[0];if("newListener"===e&&!this.newListener&&!this._events.newListener)return!1;var t,r,n,o,i,s=arguments.length;if(this._all&&this._all.length){if(i=this._all.slice(),s>3)for(t=new Array(s),o=0;o<s;o++)t[o]=arguments[o];for(n=0,r=i.length;n<r;n++)switch(this.event=e,s){case 1:i[n].call(this,e);break;case 2:i[n].call(this,e,arguments[1]);break;case 3:i[n].call(this,e,arguments[1],arguments[2]);break;default:i[n].apply(this,t)}}if(this.wildcard){i=[];var l="string"==typeof e?e.split(this.delimiter):e.slice();u.call(this,i,l,this.listenerTree,0)}else{if("function"==typeof(i=this._events[e])){switch(this.event=e,s){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(s-1),o=1;o<s;o++)t[o-1]=arguments[o];i.apply(this,t)}return!0}i&&(i=i.slice())}if(i&&i.length){if(s>3)for(t=new Array(s-1),o=1;o<s;o++)t[o-1]=arguments[o];for(n=0,r=i.length;n<r;n++)switch(this.event=e,s){case 1:i[n].call(this);break;case 2:i[n].call(this,arguments[1]);break;case 3:i[n].call(this,arguments[1],arguments[2]);break;default:i[n].apply(this,t)}return!0}if(!this._all&&"error"===e)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},d.prototype.emitAsync=function(){this._events||a.call(this);var e=arguments[0];if("newListener"===e&&!this.newListener&&!this._events.newListener)return Promise.resolve([!1]);var t,r,n,o,i,s=[],l=arguments.length;if(this._all){if(l>3)for(t=new Array(l),o=1;o<l;o++)t[o]=arguments[o];for(n=0,r=this._all.length;n<r;n++)switch(this.event=e,l){case 1:s.push(this._all[n].call(this,e));break;case 2:s.push(this._all[n].call(this,e,arguments[1]));break;case 3:s.push(this._all[n].call(this,e,arguments[1],arguments[2]));break;default:s.push(this._all[n].apply(this,t))}}if(this.wildcard){i=[];var c="string"==typeof e?e.split(this.delimiter):e.slice();u.call(this,i,c,this.listenerTree,0)}else i=this._events[e];if("function"==typeof i)switch(this.event=e,l){case 1:s.push(i.call(this));break;case 2:s.push(i.call(this,arguments[1]));break;case 3:s.push(i.call(this,arguments[1],arguments[2]));break;default:for(t=new Array(l-1),o=1;o<l;o++)t[o-1]=arguments[o];s.push(i.apply(this,t))}else if(i&&i.length){if(i=i.slice(),l>3)for(t=new Array(l-1),o=1;o<l;o++)t[o-1]=arguments[o];for(n=0,r=i.length;n<r;n++)switch(this.event=e,l){case 1:s.push(i[n].call(this));break;case 2:s.push(i[n].call(this,arguments[1]));break;case 3:s.push(i[n].call(this,arguments[1],arguments[2]));break;default:s.push(i[n].apply(this,t))}}else if(!this._all&&"error"===e)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(s)},d.prototype.on=function(e,t){return this._on(e,t,!1)},d.prototype.prependListener=function(e,t){return this._on(e,t,!0)},d.prototype.onAny=function(e){return this._onAny(e,!1)},d.prototype.prependAny=function(e){return this._onAny(e,!0)},d.prototype.addListener=d.prototype.on,d.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},d.prototype._on=function(e,t,r){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");return this._events||a.call(this),this.emit("newListener",e,t),this.wildcard?(h.call(this,e,t),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,c.call(this,this._events[e].length,e))):this._events[e]=t,this)},d.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();n=u.call(this,null,s,this.listenerTree,0)}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var a=0;a<n.length;a++){var l=n[a];if(r=l._listeners,i(r)){for(var c=-1,d=0,h=r.length;d<h;d++)if(r[d]===t||r[d].listener&&r[d].listener===t||r[d]._origin&&r[d]._origin===t){c=d;break}if(c<0)continue;return this.wildcard?l._listeners.splice(c,1):this._events[e].splice(c,1),0===r.length&&(this.wildcard?delete l._listeners:delete this._events[e]),this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete l._listeners:delete this._events[e],this.emit("removeListener",e,t))}return function e(t){if(t!==o){var r=Object.keys(t);for(var n in r){var i=r[n],s=t[i];s instanceof Function||"object"!=typeof s||null===s||(Object.keys(s).length>0&&e(t[i]),0===Object.keys(s).length&&delete t[i])}}}(this.listenerTree),this},d.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this.emit("removeListenerAny",e),this}else{for(r=0,n=(t=this._all).length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},d.prototype.removeListener=d.prototype.off,d.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||a.call(this),this;if(this.wildcard)for(var t="string"==typeof e?e.split(this.delimiter):e.slice(),r=u.call(this,null,t,this.listenerTree,0),n=0;n<r.length;n++){r[n]._listeners=null}else this._events&&(this._events[e]=null);return this},d.prototype.listeners=function(e){if(this.wildcard){var t=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return u.call(this,t,r,this.listenerTree,0),t}return this._events||a.call(this),this._events[e]||(this._events[e]=[]),i(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},d.prototype.eventNames=function(){return Object.keys(this._events)},d.prototype.listenerCount=function(e){return this.listeners(e).length},d.prototype.listenersAny=function(){return this._all?this._all:[]},(n=function(){return d}.call(t,r,t,e))===o||(e.exports=n)}()},6039:()=>{},9541:(e,t,r)=>{var n=r(998).default;function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,i=r.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",d=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var o=t&&t.prototype instanceof f?t:f,i=Object.create(o.prototype),a=new D(n||[]);return s(i,"_invoke",{value:E(e,r,a)}),i}function g(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p={};function f(){}function v(){}function b(){}var y={};u(y,l,(function(){return this}));var m=Object.getPrototypeOf,_=m&&m(m(j([])));_&&_!==r&&i.call(_,l)&&(y=_);var k=b.prototype=f.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,s,a,l){var c=g(e[o],e,s);if("throw"!==c.type){var d=c.arg,u=d.value;return u&&"object"==n(u)&&i.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(u).then((function(e){d.value=e,a(d)}),(function(e){return r("throw",e,a,l)}))}l(c.arg)}var o;s(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function E(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=S(s,r);if(a){if(a===p)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=g(e,t,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function S(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=g(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function j(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:P}}function P(){return{value:void 0,done:!0}}return v.prototype=b,s(k,"constructor",{value:b,configurable:!0}),s(b,"constructor",{value:v,configurable:!0}),v.displayName=u(b,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,d,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},w(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new O(h(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},w(k),u(k,d,"Generator"),u(k,l,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=j,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(a&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},998:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},6192:(e,t,r)=>{var n=r(9541)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},8657:(e,t,r)=>{"use strict";var n,o,i;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;const s=r(2132);t._getStatsigGlobal=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:u}catch(e){return u}};t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e];t._getInstance=e=>{const r=(0,t._getStatsigGlobal)();return e?r.instances&&r.instances[e]:(r.instances&&Object.keys(r.instances).length>1&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),r.firstInstance)};const a="__STATSIG__",l="undefined"!=typeof window?window:{},c=void 0!==r.g?r.g:{},d="undefined"!=typeof globalThis?globalThis:{},u=null!==(i=null!==(o=null!==(n=l[a])&&void 0!==n?n:c[a])&&void 0!==o?o:d[a])&&void 0!==i?i:{instance:t._getInstance};l[a]=u,c[a]=u,d[a]=u},981:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const n=r(8210);function o(e,t,r){var o;if(r)return r(e,t);const i=t&&t.customIDs?t.customIDs:{},s=[`uid:${null!==(o=null==t?void 0:t.userID)&&void 0!==o?o:""}`,`cids:${Object.keys(i).sort(((e,t)=>e.localeCompare(t))).map((e=>`${e}-${i[e]}`)).join(",")}`,`k:${e}`];return(0,n._DJB2)(s.join("|"))}t._getUserStorageKey=o,t._getStorageKey=function(e,t,r){return t?o(e,t,r):(0,n._DJB2)(`k:${e}`)}},4399:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8562:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;const o=r(2132),i=r(6286),s=r(4830),a=r(6346),l=r(1829);function c(e,t,r,n){return{source:e,data:t,receivedAt:Date.now(),stableID:r,fullUserHash:(0,s._getFullUserHash)(n)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new d}attach(e,t,r){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,s._normalizeUser)(e,this._options),r=this._getCacheKey(t),n=this._inMemoryCache.get(r,t);if(n)return n;const o=this._loadFromCache(r);return o?(this._inMemoryCache.add(r,o),this._inMemoryCache.get(r,t)):null}setData(e,t){const r=t&&(0,s._normalizeUser)(t,this._options),n=this._getCacheKey(r);this._inMemoryCache.add(n,c("Bootstrap",e,null,r))}_getDataAsyncImpl(e,t,r){return n(this,void 0,void 0,(function*(){a.Storage.isReady()||(yield a.Storage.isReadyResolver());const n=null!=e?e:this.getDataSync(t),i=[this._fetchAndPrepFromNetwork(n,t,r)];return(null==r?void 0:r.timeoutMs)&&i.push(new Promise((e=>setTimeout(e,r.timeoutMs))).then((()=>(o.Log.debug("Fetching latest value timed out"),null)))),yield Promise.race(i)}))}_prefetchDataImpl(e,t){return n(this,void 0,void 0,(function*(){const r=e&&(0,s._normalizeUser)(e,this._options),n=this._getCacheKey(r),o=yield this._getDataAsyncImpl(null,r,t);o&&this._inMemoryCache.add(n,Object.assign(Object.assign({},o),{source:"Prefetch"}))}))}_fetchAndPrepFromNetwork(e,t,r){var s;return n(this,void 0,void 0,(function*(){const n=null!==(s=null==e?void 0:e.data)&&void 0!==s?s:null,a=null!=e&&this._isCachedResultValidFor204(e,t),d=yield this._fetchFromNetwork(n,t,r,a);if(!d)return o.Log.debug("No response returned for latest value"),null;const u=(0,l._typedJsonParse)(d,"has_updates","Response"),h=this._getSdkKey(),g=i.StableID.get(h);let p=null;if(!0===(null==u?void 0:u.has_updates))p=c("Network",d,g,t);else{if(!n||!1!==(null==u?void 0:u.has_updates))return null;p=c("NetworkNotModified",n,g,t)}const f=this._getCacheKey(t);return this._inMemoryCache.add(f,p),this._writeToCache(f,p),p}))}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(o.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;const r=null===(t=a.Storage.getItem)||void 0===t?void 0:t.call(a.Storage,e);if(null==r)return null;const n=(0,l._typedJsonParse)(r,"source","Cached Result");return n?Object.assign(Object.assign({},n),{source:"Cache"}):null}_writeToCache(e,t){a.Storage.setItem(e,JSON.stringify(t)),this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e){var t;const r=null!==(t=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==t?t:{};r[e]=Date.now();const n=u(r,10);n&&(delete r[n],a.Storage.removeItem(n)),(0,a._setObjectInStorage)(this._lastModifiedStoreKey,r)}},t._makeDataAdapterResult=c;class d{constructor(){this._data={}}get(e,t){var r;const n=this._data[e],i=null==n?void 0:n.stableID,s=null===(r=null==t?void 0:t.customIDs)||void 0===r?void 0:r.stableID;return s&&i&&s!==i?(o.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):n}add(e,t){const r=u(this._data,9);r&&delete this._data[r],this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function u(e,t){const r=Object.keys(e);return r.length<=t?null:r.reduce(((t,r)=>{const n=e[t],o=e[r];return"object"==typeof n&&"object"==typeof o?o.receivedAt<n.receivedAt?r:t:o<n?r:t}))}},2798:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const r=new Map,n="start",o="end",i="statsig::diagnostics";function s(e,t,r,n){return Object.assign({key:r,action:t,step:n,timestamp:Date.now()},e)}function a(e,t){var n;const o=null!==(n=r.get(e))&&void 0!==n?n:[];o.push(t),r.set(e,o)}function l(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>r.get(e),_markInitOverallStart:e=>{a(e,s({},n,"overall"))},_markInitOverallEnd:(e,t,r)=>{a(e,s({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:r},o,"overall"))},_markInitNetworkReqStart:(e,t)=>{a(e,s(t,n,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{a(e,s(t,o,"initialize","network_request"))},_markInitProcessStart:e=>{a(e,s({},n,"initialize","process"))},_markInitProcessEnd:(e,t)=>{a(e,s(t,o,"initialize","process"))},_clearMarkers:e=>{r.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:l(e,"code"),name:l(e,"name"),message:l(e,"message")}},_getDiagnosticsData(e,r,n,o){var i;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(i=null==e?void 0:e.headers)||void 0===i?void 0:i.get("x-statsig-region"),isDelta:!0===n.includes('"is_delta":true')||void 0,attempt:r,error:t.Diagnostics._formatError(o)}},_enqueueDiagnosticsEvent(e,r,n,o){const s=t.Diagnostics._getMarkers(n);if(null==s||s.length<=0)return-1;const a=s[s.length-1].timestamp-s[0].timestamp;t.Diagnostics._clearMarkers(n);const l=function(e,t){const r={eventName:i,user:e,value:null,metadata:t,time:Date.now()};return r}(e,{context:"initialize",markers:s.slice(),statsigOptions:o});return r.enqueue(l),a}}},6413:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._fetchTxtRecords=void 0;const n=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),o=["i","e","d"],i=200;t._fetchTxtRecords=function(e){return r(this,void 0,void 0,(function*(){const t=yield e("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:n});if(!t.ok){const e=new Error("Failed to fetch TXT records from DNS");throw e.name="DnsTxtFetchError",e}const r=yield t.arrayBuffer();return function(e){const t=e.findIndex(((t,r)=>r<i&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(e[r-1]))));if(-1===t){const e=new Error("Failed to parse TXT records from DNS");throw e.name="DnsTxtParseError",e}let r="";for(let n=t-1;n<e.length;n++)r+=String.fromCharCode(e[n]);return r.split(",")}(new Uint8Array(r))}))}},6663:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1290:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const o=r(2132),i=r(2442),s=r(2452);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";const a="[Statsig] UnknownError";function l(e){return e instanceof Error?e:"string"==typeof e?new Error(e):new Error("An unknown error occurred.")}function c(e){if(!e)return{};const t={};return Object.entries(e).forEach((([e,r])=>{switch(typeof r){case"number":case"bigint":case"boolean":t[String(e)]=r;break;case"string":r.length<50?t[String(e)]=r:t[String(e)]="set";break;case"object":"environment"===e?t.environment=r:"networkConfig"===e?t.networkConfig=r:t[String(e)]=null!=r?"set":"unset"}})),t}t.ErrorBoundary=class{constructor(e,t,r,n){this._sdkKey=e,this._options=t,this._emitter=r,this._lastSeenError=n,this._seen=new Set}wrap(e){try{const t=e;(function(e){const t=new Set;let r=Object.getPrototypeOf(e);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).filter((e=>"function"==typeof(null==r?void 0:r[e]))).forEach((e=>t.add(e))),r=Object.getPrototypeOf(r);return Array.from(t)})(t).forEach((r=>{const n=t[r];"$EB"in n||(t[r]=(...t)=>this._capture(r,(()=>n.apply(e,t))),t[r].$EB=!0)}))}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}getLastSeenErrorAndReset(){const e=this._lastSeenError;return this._lastSeenError=void 0,null!=e?e:null}attachErrorIfNoneExists(e){this._lastSeenError||(this._lastSeenError=l(e))}_capture(e,t){try{const r=t();return r&&r instanceof Promise?r.catch((t=>this._onError(e,t))):r}catch(t){return this._onError(e,t),null}}_onError(e,r){try{o.Log.warn(`Caught error in ${e}`,{error:r});(()=>n(this,void 0,void 0,(function*(){var n,o,d,u,h,g,p;const f=r||Error(a),v=f instanceof Error,b=v?f.name:"No Name",y=l(f);if(this._lastSeenError=y,this._seen.has(b))return;if(this._seen.add(b),null===(o=null===(n=this._options)||void 0===n?void 0:n.networkConfig)||void 0===o?void 0:o.preventAllNetworkTraffic)return void(null===(d=this._emitter)||void 0===d||d.call(this,{name:"error",error:r,tag:e}));const m=i.SDKType._get(this._sdkKey),_=s.StatsigMetadataProvider.get(),k=v?f.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(f),w=Object.assign({tag:e,exception:b,info:k,statsigOptions:c(this._options)},Object.assign(Object.assign({},_),{sdkType:m})),O=null!==(g=null===(h=null===(u=this._options)||void 0===u?void 0:u.networkConfig)||void 0===h?void 0:h.networkOverrideFunc)&&void 0!==g?g:fetch;yield O(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(m),"STATSIG-SDK-VERSION":String(_.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(w)}),null===(p=this._emitter)||void 0===p||p.call(this,{name:"error",error:r,tag:e})})))().then((()=>{})).catch((()=>{}))}catch(e){}}}},118:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3725:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},638:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const o=r(981),i=r(8210),s=r(2132),a=r(3582),l=r(6650),c=r(1217),d=r(5910),u=r(6346),h=r(5445),g=r(5873),p={},f="startup",v="gained_focus";class b{static _safeFlushAndForget(e){var t;null===(t=p[e])||void 0===t||t.flush().catch((()=>{}))}static _safeRetryFailedLogs(e){var t;null===(t=p[e])||void 0===t||t._retryFailedLogs(v)}constructor(e,t,r,n){var o,i;this._sdkKey=e,this._emitter=t,this._network=r,this._options=n,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._loggingEnabled=null!==(o=null==n?void 0:n.loggingEnabled)&&void 0!==o?o:!0===(null==n?void 0:n.disableLogging)?d.LoggingEnabledOption.disabled:d.LoggingEnabledOption.browserOnly,(null==n?void 0:n.loggingEnabled)&&void 0!==n.disableLogging&&s.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this._maxQueueSize=null!==(i=null==n?void 0:n.loggingBufferMaxSize)&&void 0!==i?i:100;const l=null==n?void 0:n.networkConfig;this._logEventUrlConfig=new h.UrlConfiguration(a.Endpoint._rgstr,null==l?void 0:l.logEventUrl,null==l?void 0:l.api,null==l?void 0:l.logEventFallbackUrls)}setLogEventCompressionMode(e){this._network.setLogEventCompressionMode(e)}setLoggingEnabled(e){this._loggingEnabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&b._safeFlushAndForget(this._sdkKey))}incrementNonExposureCount(e){var t;const r=null!==(t=this._nonExposedChecks[e])&&void 0!==t?t:0;this._nonExposedChecks[e]=r+1}reset(){this._lastExposureTimeMap={}}start(){var e;const t=(0,l._isServerEnv)();t&&"always"!==(null===(e=this._options)||void 0===e?void 0:e.loggingEnabled)||(p[this._sdkKey]=this,t||(0,g._subscribeToVisiblityChanged)((e=>{"background"===e?b._safeFlushAndForget(this._sdkKey):"foreground"===e&&b._safeRetryFailedLogs(this._sdkKey)})),this._retryFailedLogs(f),this._startBackgroundFlushInterval())}stop(){return n(this,void 0,void 0,(function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),delete p[this._sdkKey],yield this.flush()}))}flush(){return n(this,void 0,void 0,(function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;const e=this._queue;this._queue=[],yield this._sendEvents(e)}))}_quickFlushIfNeeded(){this._hasRunQuickFlush||(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout((()=>b._safeFlushAndForget(this._sdkKey)),200))}_shouldLogEvent(e){var t;if("always"!==(null===(t=this._options)||void 0===t?void 0:t.loggingEnabled)&&(0,l._isServerEnv)())return!1;if(!(0,c._isExposureEvent)(e))return!0;const r=e.user?e.user:{statsigEnvironment:void 0},n=(0,o._getUserStorageKey)(this._sdkKey,r),i=e.metadata?e.metadata:{},s=[e.eventName,n,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),a=this._lastExposureTimeMap[s],d=Date.now();return!(a&&d-a<6e5)&&(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[s]=d,!0)}_sendEvents(e){var t,r;return n(this,void 0,void 0,(function*(){if("disabled"===this._loggingEnabled)return this._saveFailedLogsToStorage(e),!1;try{const n=(0,g._isUnloading)()&&this._network.isBeaconSupported()&&null==(null===(r=null===(t=this._options)||void 0===t?void 0:t.networkConfig)||void 0===r?void 0:r.networkOverrideFunc);this._emitter({name:"pre_logs_flushed",events:e});return(n?this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success?(this._emitter({name:"logs_flushed",events:e}),!0):(s.Log.warn("Failed to flush events."),this._saveFailedLogsToStorage(e),!1)}catch(e){return s.Log.warn("Failed to flush events."),!1}}))}_sendEventsViaPost(e){var t;return n(this,void 0,void 0,(function*(){const r=yield this._network.post(this._getRequestData(e)),n=null!==(t=null==r?void 0:r.code)&&void 0!==t?t:-1;return{success:n>=200&&n<300}}))}_sendEventsViaBeacon(e){return{success:this._network.beacon(this._getRequestData(e))}}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e},urlConfig:this._logEventUrlConfig,retries:3,isCompressable:!0,params:{[a.NetworkParam.EventCount]:String(e.length)},credentials:"same-origin"}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();const t=this._getStorageKey();try{(0,u._setObjectInStorage)(t,e)}catch(e){s.Log.warn("Unable to save failed logs to storage")}}_retryFailedLogs(e){const t=this._getStorageKey();(()=>n(this,void 0,void 0,(function*(){u.Storage.isReady()||(yield u.Storage.isReadyResolver());const r=(0,u._getObjectFromStorage)(t);if(!r)return;e===f&&u.Storage.removeItem(t);(yield this._sendEvents(r))&&e===v&&u.Storage.removeItem(t)})))().catch((()=>{s.Log.warn("Failed to flush stored logs")}))}_getStorageKey(){return`statsig.failed_logs.${(0,i._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},r=this._getCurrentPageUrl();r&&(t.statsigMetadata={currentPage:r});const n=Object.assign(Object.assign({},e),t);s.Log.debug("Enqueued Event:",n),this._queue.push(n)}_appendAndResetNonExposedChecks(){0!==Object.keys(this._nonExposedChecks).length&&(this._normalizeAndAppendEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this._nonExposedChecks)}}),this._nonExposedChecks={})}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;const r=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingIntervalMs)&&void 0!==t?t:1e4,n=setInterval((()=>{const e=p[this._sdkKey];e&&e._flushIntervalId===n?b._safeFlushAndForget(this._sdkKey):clearInterval(n)}),r);this._flushIntervalId=n}}t.EventLogger=b},8210:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;const n=r(8062);t._DJB2=e=>{let t=0;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t|=0}return String(t>>>0)};t._DJB2Object=(e,r)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,r)));t._getSortedObject=(e,r)=>{if(null==e)return null;const o=Object.keys(e).sort(),i={};return o.forEach((o=>{const s=e[o];0!==r&&"object"===(0,n._typeOf)(s)?i[o]=(0,t._getSortedObject)(s,null!=r?r-1:r):i[o]=s})),i}},2849:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2132:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Log=t.LogLevel=void 0;function r(e){return e.unshift("[Statsig]"),e}t.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...e){n.level>=t.LogLevel.Info&&console.info(" INFO ",...r(e))}static debug(...e){n.level>=t.LogLevel.Debug&&console.debug(" DEBUG ",...r(e))}static warn(...e){n.level>=t.LogLevel.Warn&&console.warn(" WARN ",...r(e))}static error(...e){n.level>=t.LogLevel.Error&&console.error(" ERROR ",...r(e))}}t.Log=n,n.level=t.LogLevel.Warn},6375:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createMemoKey=t.MemoPrefix=void 0,t.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_layer:"l",_paramStore:"p"};const r=new Set([]),n=new Set(["userPersistedValues"]);t.createMemoKey=function(e,t,o){let i=`${e}|${t}`;if(!o)return i;for(const e of Object.keys(o)){if(n.has(e))return;r.has(e)?i+=`|${e}=true`:i+=`|${e}=${o[e]}`}return i}},3582:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkParam=t.NetworkDefault=t.Endpoint=void 0,t.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"},t.NetworkDefault={[t.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[t.Endpoint._initialize]:"https://featureassets.org/v1",[t.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"},t.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},6555:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,r(8657);const o=r(8657),i=r(2798),s=r(2132),a=r(3582),l=r(2064),c=r(4175),d=r(2442),u=r(6650),h=r(4899),g=r(6286),p=r(3528),f=r(2452),v=r(5910),b=r(5873),y=new Set([408,500,502,503,504,522,524,599]);t.NetworkCore=class{constructor(e,t){this._emitter=t,this._errorBoundary=null,this._timeout=1e4,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,e&&(this._options=e),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new l.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(e))}setLogEventCompressionMode(e){this._options.logEventCompressionMode=e}setErrorBoundary(e){this._errorBoundary=e,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(e)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){const e=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,e}beacon(e){if(!m(e))return!1;const t=this._getInternalRequestArgs("POST",e),r=this._getPopulatedURL(t),n=navigator;return n.sendBeacon.bind(n)(r,t.body)}post(e){return n(this,void 0,void 0,(function*(){const t=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(t),yield this._tryToCompressBody(t),this._sendRequest(t)}))}get(e){const t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e){var t,r,o,l;return n(this,void 0,void 0,(function*(){if(!m(e))return null;if(this._netConfig.preventAllNetworkTraffic)return null;const{method:c,body:d,retries:u,attempt:h}=e,g=e.urlConfig.endpoint;if(this._isRateLimited(g))return s.Log.warn(`Request to ${g} was blocked because you are making requests too frequently.`),null;const f=null!=h?h:1,v="undefined"!=typeof AbortController?new AbortController:null,_=setTimeout((()=>{null==v||v.abort(`Timeout of ${this._timeout}ms expired.`)}),this._timeout),w=this._getPopulatedURL(e);let O=null;const E=(0,b._isUnloading)();try{const r={method:c,body:d,headers:Object.assign({},e.headers),signal:null==v?void 0:v.signal,priority:e.priority,keepalive:E};!function(e,t){if(e.urlConfig.endpoint!==a.Endpoint._initialize)return;i.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}(e,f);const n=this._leakyBucket[g];n&&(n.lastRequestTime=Date.now(),this._leakyBucket[g]=n);const o=null!==(t=this._netConfig.networkOverrideFunc)&&void 0!==t?t:fetch;if(O=yield o(w,r),clearTimeout(_),!O.ok){const e=yield O.text().catch((()=>"No Text")),t=new Error(`NetworkError: ${w} ${e}`);throw t.name="NetworkError",t}const s=yield O.text();return k(e,O,f,s),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:s,code:O.status}}catch(t){const i=function(e,t){if((null==e?void 0:e.signal.aborted)&&"string"==typeof e.signal.reason)return e.signal.reason;if("string"==typeof t)return t;if(t instanceof Error)return`${t.name}: ${t.message}`;return"Unknown Error"}(v,t),a=(null==(S=v)?void 0:S.signal.aborted)&&"string"==typeof S.signal.reason&&S.signal.reason.includes("Timeout")||!1;k(e,O,f,"",t);if((yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,i,a))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!u||f>u||!y.has(null!==(r=null==O?void 0:O.status)&&void 0!==r?r:500)){null===(o=this._emitter)||void 0===o||o.call(this,{name:"error",error:t,tag:p.ErrorTag.NetworkError,requestArgs:e});const r=`A networking error occurred during ${c} request to ${w}.`;return s.Log.error(r,i,t),null===(l=this._errorBoundary)||void 0===l||l.attachErrorIfNoneExists(r),null}return yield function(e){return n(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,Math.min(e*e*500,3e4))))}))}(f),this._sendRequest(Object.assign(Object.assign({},e),{retries:u,attempt:f+1}))}var S}))}_getLogEventCompressionMode(e){let t=null==e?void 0:e.logEventCompressionMode;return t||!0!==(null==e?void 0:e.disableCompression)||(t=v.LogEventCompressionMode.Disabled),t||(t=v.LogEventCompressionMode.Enabled),t}_isRateLimited(e){var t;const r=Date.now(),n=null!==(t=this._leakyBucket[e])&&void 0!==t?t:{count:0,lastRequestTime:r},o=r-n.lastRequestTime,i=Math.floor(.05*o);return n.count=Math.max(0,n.count-i),n.count>=50||(n.count+=1,n.lastRequestTime=r,this._leakyBucket[e]=n,!1)}_getPopulatedURL(e){var t;const r=null!==(t=e.fallbackUrl)&&void 0!==t?t:e.urlConfig.getUrl();e.urlConfig.endpoint!==a.Endpoint._initialize&&e.urlConfig.endpoint!==a.Endpoint._download_config_specs||(this._lastUsedInitUrl=r);const n=Object.assign({[a.NetworkParam.SdkKey]:e.sdkKey,[a.NetworkParam.SdkType]:d.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:f.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:h.SessionID.get(e.sdkKey)},e.params),o=Object.keys(n).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`)).join("&");return`${r}${o?`?${o}`:""}`}_tryEncodeBody(e){var t;const r=(0,u._getWindowSafe)(),n=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof n&&null==(0,o._getStatsigGlobalFlag)("no-encode")&&(null==r?void 0:r.btoa))try{e.body=r.btoa(n).split("").reverse().join(""),e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.StatsigEncoded]:"1"})}catch(t){s.Log.warn(`Request encoding failed for ${e.urlConfig.getUrl()}`,t)}}_tryToCompressBody(e){var t;return n(this,void 0,void 0,(function*(){const r=e.body;if("string"==typeof r&&function(e,t){if(!e.isCompressable)return!1;if(null!=(0,o._getStatsigGlobalFlag)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return!1;const r=null!=e.urlConfig.customUrl||null!=e.urlConfig.fallbackUrls,n=!0===c.SDKFlags.get(e.sdkKey,"enable_log_event_compression");switch(t.logEventCompressionMode){case v.LogEventCompressionMode.Disabled:return!1;case v.LogEventCompressionMode.Enabled:return!(r&&!n);case v.LogEventCompressionMode.Forced:return!0;default:return!1}}(e,this._options))try{const n=(new TextEncoder).encode(r),o=new CompressionStream("gzip"),i=o.writable.getWriter();i.write(n).catch(s.Log.error),i.close().catch(s.Log.error);const l=o.readable.getReader(),c=[];let d;for(;!(d=yield l.read()).done;)c.push(d.value);const u=c.reduce(((e,t)=>e+t.length),0),h=new Uint8Array(u);let g=0;for(const e of c)h.set(e,g),g+=e.length;e.body=h,e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.IsGzipped]:"1"})}catch(t){s.Log.warn(`Request compression failed for ${e.urlConfig.getUrl()}`,t)}}))}_getInternalRequestArgs(e,t){const r=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig),n=Object.assign(Object.assign({},t),{method:e,fallbackUrl:r});return"data"in t&&_(n,t.data),n}};const m=e=>!!e.sdkKey||(s.Log.warn("Unable to make request without an SDK key"),!1),_=(e,t)=>{const{sdkKey:r,fallbackUrl:n}=e,o=g.StableID.get(r),i=h.SessionID.get(r),s=d.SDKType._get(r);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},f.StatsigMetadataProvider.get()),{stableID:o,sessionID:i,sdkType:s,fallbackUrl:n})}))};function k(e,t,r,n,o){e.urlConfig.endpoint===a.Endpoint._initialize&&i.Diagnostics._markInitNetworkReqEnd(e.sdkKey,i.Diagnostics._getDiagnosticsData(t,r,n,o))}},2064:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;const o=r(6413),i=r(8210),s=r(2132),a=r(6346),l=6048e5;function c(e,t){var r;const n=null!==(r=null==e?void 0:e.toLowerCase())&&void 0!==r?r:"";return t||n.includes("uncaught exception")||n.includes("failed to fetch")||n.includes("networkerror when attempting to fetch resource")}function d(e){return`statsig.network_fallback.${(0,i._DJB2)(e)}`}function u(e,t){const r=d(e);t&&0!==Object.keys(t).length?a.Storage.setItem(r,JSON.stringify(t)):a.Storage.removeItem(r)}t.NetworkFallbackResolver=class{constructor(e){var t;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=null===(t=e.networkConfig)||void 0===t?void 0:t.networkOverrideFunc}setErrorBoundary(e){this._errorBoundary=e}tryBumpExpiryTime(e,t){var r;const n=null===(r=this._fallbackInfo)||void 0===r?void 0:r[t.endpoint];n&&(n.expiryTime=Date.now()+l,u(e,Object.assign(Object.assign({},this._fallbackInfo),{[t.endpoint]:n})))}getActiveFallbackUrl(e,t){var r,n;if(null!=t.customUrl&&null!=t.fallbackUrls)return null;let o=this._fallbackInfo;null==o&&(o=null!==(r=function(e){const t=d(e),r=a.Storage.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return s.Log.error("Failed to parse FallbackInfo"),null}}(e))&&void 0!==r?r:{},this._fallbackInfo=o);const i=o[t.endpoint];return!i||Date.now()>(null!==(n=i.expiryTime)&&void 0!==n?n:0)||t.getChecksum()!==i.urlConfigChecksum?(delete o[t.endpoint],this._fallbackInfo=o,u(e,this._fallbackInfo),null):i.url?i.url:null}tryFetchUpdatedFallbackInfo(e,t,r,o){var i,s;return n(this,void 0,void 0,(function*(){try{if(!c(r,o))return!1;const n=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,s=this._pickNewFallbackUrl(null===(i=this._fallbackInfo)||void 0===i?void 0:i[t.endpoint],n);return!!s&&(this._updateFallbackInfoWithNewUrl(e,t,s),!0)}catch(e){return null===(s=this._errorBoundary)||void 0===s||s.logError("tryFetchUpdatedFallbackInfo",e),!1}}))}_updateFallbackInfoWithNewUrl(e,t,r){var n,o,i;const s={urlConfigChecksum:t.getChecksum(),url:r,expiryTime:Date.now()+l,previous:[]},a=t.endpoint,c=null===(n=this._fallbackInfo)||void 0===n?void 0:n[a];c&&s.previous.push(...c.previous),s.previous.length>10&&(s.previous=[]);const d=null===(i=null===(o=this._fallbackInfo)||void 0===o?void 0:o[a])||void 0===i?void 0:i.url;null!=d&&s.previous.push(d),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[a]:s}),u(e,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(e){var t;return n(this,void 0,void 0,(function*(){const r=this._dnsQueryCooldowns[e.endpoint];if(r&&Date.now()<r)return null;this._dnsQueryCooldowns[e.endpoint