1import{a as e,o as t}from"./BsfI1waD.js";import{g as n}from"./DBq4UlV4.js";import{m as r}from"./BQ3X4EG0.js";import{t as i}from"./C06xcKA_.js";import{E as a,H as o,U as s,c}from"./ChQdSMSK.js";import{r as l}from"./D2AZapgy.js";import"./BUbSHu5v.js";import{t as u}from"./CbRJQYM5.js";import{_ as d}from"./90xg2Rc1.js";import{t as f}from"./DqR3yzBO.js";var p={CONTROL:`control`,OFF:`off`,ON:`on`},m={ADD_TO_CART:`addToCart`},h=`user`,g=`device_type`,_={DESKTOP:`desktop`,PHONE:`phone`,TABLET:`tablet`},v=Object.assign||function(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);e=Object(e);for(var t=1;t<arguments.length;t++){var n=Object(arguments[t]);for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y=`settings`,b=`Factory instantiation`,x=`Client instantiation`,S=`engine`,C=S+`:combiner: `,w=S+`:matcher: `,T=S+`:value: `,E=`sync`,D=E+`:sync-manager: `,O=E+`:offline: `,k=E+`:streaming: `,A=E+`:featureflag-changes: `;E+``;var j=E+`:my-segments: `,ee=E+`:polling-manager: `,M=E+`:submitter: `,N=`impressions-tracker: `,te=`events-tracker: `,ne=`unique-keys-tracker: `,P=`cleanup: `,re=new Set([`splitsdkclientkey`,`splitsdkversion`,`splitsdkmachineip`,`splitsdkmachinename`,`splitsdkimpressionsmode`,`host`,`referrer`,`content-type`,`content-length`,`content-encoding`,`accept`,`keep-alive`,`x-fastly-debug`]);function F(e,t){if(e.sync.requestOptions?.getHeaderOverrides)try{var n=e.sync.requestOptions.getHeaderOverrides({headers:v({},t)});Object.keys(n).filter(function(e){return!re.has(e.toLowerCase())}).forEach(function(e){return t[e]=n[e]})}catch(t){e.log.error(`Problem adding custom headers to request decorator: `+t)}return t}function ie(e){return e.replace(/[^\x00-\xFF]/g,``)}function ae(e,t){return e<1?t:new Promise(function(n,r){var i=setTimeout(function(){r(Error(`Operation timed out because it exceeded the configured time limit of `+e+` ms.`))},e);t.then(function(e){clearTimeout(i),n(e)},function(e){clearTimeout(i),r(e)})})}var oe=100,se=`Global fetch API is not available.`;function ce(e,t){var n=t.getOptions,r=t.getFetch,i=e.log,a=e.core.authorizationKey,o=e.version,s=e.runtime,c=s.ip,l=s.hostname,u=n&&n(e),d=r&&r(e);d||i.error(303,[se]);var f={Accept:`application/json`,"Content-Type":`application/json`,Authorization:`Bearer `+a,SplitSDKVersion:o};return c&&(f.SplitSDKMachineIP=c),l&&(f.SplitSDKMachineName=ie(l)),function(t,n,r,a){n===void 0&&(n={}),r===void 0&&(r=function(){}),a===void 0&&(a=!1);var o=v({headers:F(e,v({},f,n.headers||{})),method:n.method||`GET`,body:n.body},u);return d?d(t,o).then(function(e){return e.ok?(r(),e):ae(oe,e.text()).then(function(t){return Promise.reject({response:e,message:t})},function(){return Promise.reject({response:e})})}).catch(function(e){var n=e&&e.response,o=``;if(n)switch(n.status){case 404:o=`Invalid SDK key or resource not found.`;break;default:o=e.message}else o=e.message||`Network Error`;(!n||n.status!==403)&&i[a?`info`:`error`](322,[n?`status code `+n.status:`no status code`,t,o]);var s=Error(o);throw s.statusCode=n&&n.status,r(s),s}):Promise.reject(Error(se))}}var I=`control`,le=`DEBUG`,L=`OPTIMIZED`,ue=`NONE`,de=`localhost`,fe=`standalone`,pe=`consumer`,me=`consumer_partial`,he=`MEMORY`,ge=`LOCALSTORAGE`,R=`GRANTED`,_e=`DECLINED`,ve=`UNKNOWN`,ye=`getTreatment`,be=`getTreatments`,xe=`getTreatmentWithConfig`,Se=`getTreatmentsWithConfig`,Ce=`getTreatmentsByFlagSet`,we=`getTreatmentsByFlagSets`,Te=`getTreatmentsWithConfigByFlagSet`,Ee=`getTreatmentsWithConfigByFlagSets`,De=`track`,Oe=`split`,ke=`tcfs`,Ae=`IN_SEGMENT`,je=`IN_RULE_BASED_SEGMENT`,Me={headers:{"Cache-Control":`no-cache`}};function Ne(e){return`users=`+encodeURIComponent(e)}function Pe(e,t,n){var r=e.urls,i=e.sync.__splitFiltersValidation&&e.sync.__splitFiltersValidation.queryString,a=e.sync.impressionsMode,o=ce(e,t);return{getSdkAPIHealthCheck:function(){return o(r.sdk+`/version`).then(function(){return!0}).catch(function(){return!1})},getEventsAPIHealthCheck:function(){return o(r.events+`/version`).then(function(){return!0}).catch(function(){return!1})},fetchAuth:function(t){var i=r.auth+`/v2/auth?s=`+e.sync.flagSpecVersion;if(t){var a=t.map(Ne).join(`&`);a&&(i+=`&`+a)}return o(i,void 0,n.trackHttp(`to`))},fetchSplitChanges:function(t,a,s,c){return o(r.sdk+`/splitChanges?s=`+e.sync.flagSpecVersion+`&since=`+t+(c?`&rbSince=`+c:``)+(i||``)+(s?`&till=`+s:``),a?Me:void 0,n.trackHttp(`sp`)).catch(function(t){throw t.statusCode===414&&e.log.error(327),t})},fetchSegmentChanges:function(e,t,i,a){return o(r.sdk+`/segmentChanges/`+t+`?since=`+e+(a?`&till=`+a:``),i?Me:void 0,n.trackHttp(`se`))},fetchMemberships:function(e,t,i){return o(r.sdk+`/memberships/`+encodeURIComponent(e)+(i?`?till=`+i:``),t?Me:void 0,n.trackHttp(`ms`))},postEventsBulk:function(e,t){return o(r.events+`/events/bulk`,{method:`POST`,body:e,headers:t},n.trackHttp(`ev`))},postTestImpressionsBulk:function(e,t){return o(r.events+`/testImpressions/bulk`,{method:`POST`,body:e,headers:v({SplitSDKImpressionsMode:a},t)},n.trackHttp(`im`))},postTestImpressionsCount:function(e,t){return o(r.events+`/testImpressions/count`,{method:`POST`,body:e,headers:t},n.trackHttp(`ic`))},postUniqueKeysBulkCs:function(e,t){return o(r.telemetry+`/v1/keys/cs`,{method:`POST`,body:e,headers:t},n.trackHttp(`te`))},postUniqueKeysBulkSs:function(e,t){return o(r.telemetry+`/v1/keys/ss`,{method:`POST`,body:e,headers:t},n.trackHttp(`te`))},postMetricsConfig:function(e,t){return o(r.telemetry+`/v1/metrics/config`,{method:`POST`,body:e,headers:t},n.trackHttp(`te`),!0)},postMetricsUsage:function(e,t){return o(r.telemetry+`/v1/metrics/usage`,{method:`POST`,body:e,headers:t},n.trackHttp(`te`),!0)}}}function Fe(e,t,n,r){r===void 0&&(r=`task`);var i=0,a,o=!1,s=0,c,l;function u(){var n=[...arguments];return i++,e.debug(37,[r]),a=(a?a.then(function(){return t.apply(void 0,n)}):t.apply(void 0,n)).then(function(e){return i--,e}),a}function d(e){return u.apply(void 0,c).then(function(t){return o&&e===s&&(l=setTimeout(d,n,e)),t})}return{execute:u,isExecuting:function(){return i>0},start:function(){var t=[...arguments];if(!o)return o=!0,s++,c=t,e.debug(36,[r,n]),d(s)},stop:function(){o&&(o=!1,e.debug(38,[r]),clearTimeout(l),l=void 0)},isRunning:function(){return o}}}function Ie(e,t,n,r,i,a,o){a===void 0&&(a=0);var s=n.name,c=0,l;function u(){if(n.isEmpty()&&!l)return Promise.resolve();l=n.pop(l);var r=typeof l.length==`number`?l.length+` `+s:s;e[o?`debug`:`info`](116,[r]);var u=JSON.stringify(i?i(l):l);return a||(l=void 0),t(u).then(function(){c=0,l=void 0}).catch(function(t){a?c===a?(c=0,l=void 0,e[o?`debug`:`warn`](209,[r,t])):(c++,e[o?`debug`:`warn`](210,[r,t])):e[o?`debug`:`warn`](209,[r,t])})}return Fe(e,u,r,s+` submitter`)}function Le(e,t){var n=!1,r,i=e.start;e.start=function(){n=!0,r=setTimeout(i,t)};var a=e.stop;return e.stop=function(){n=!1,clearTimeout(r),a()},e.isRunning=function(){return n},e}function Re(e){var t=e.settings,n=t.log,r=t.scheduler.eventsPushRate,i=t.startup.eventsFirstPushWindow,a=e.splitApi.postEventsBulk,o=e.storage.events,s=Ie(n,a,o,r);return i>0&&(s=Le(s,i)),o.setOnFullQueueCb(function(){s.isRunning()&&(n.info(115,[o.name]),s.execute())}),s}var ze=function(e,t){return ze=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ze(e,t)};function Be(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);ze(e,t);function n(){this.constructor=e}
1e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ve=function(){return Ve=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ve.apply(this,arguments)};function He(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function Ue(e,t,n){return n===void 0&&(n=!1),V(e)&&V(t)?(n&&(e=e.toLowerCase(),t=t.toLowerCase()),e.slice(e.length-t.length)===t):!1}function We(e,t){var n;if(B(e))for(var r=Object.keys(e),i=0;i<r.length&&!n;i++){var a=r[i],o=t(e[a],a,e);o&&(n=e[a])}else if(Array.isArray(e))for(var i=0;i<e.length&&!n;i++){var o=t(e[i],i,e);o&&(n=e[i])}return n}function Ge(e,t){if(Array.isArray(e)&&typeof t==`function`){for(var n=0;n<e.length;n++)if(t(e[n],n,e)===!0)return n}return-1}function z(e,t){return Object.keys(e).forEach(function(n){return t(e[n],n,e)}),e}function Ke(e,t,n){var r=n;try{var i=t.split(`.`),a=e;i.forEach(function(e){return a=a[e]}),a!==void 0&&(r=a)}catch{}return r}function qe(e,t){var n={};if(Array.isArray(e)&&V(t))for(var r=0;r<e.length;r++){var i=e[r][t];V(i)&&(n[i]||(n[i]=[]),n[i].push(e[r]))}return n}function Je(e){return e===!0||e===!1}function Ye(e){return e instanceof Number&&(e=e.valueOf()),typeof e==`number`?Number.isFinite?Number.isFinite(e):isFinite(e):!1}function Xe(e){return e instanceof Number&&(e=e.valueOf()),e!==e}function B(e){return typeof e==`object`&&!!e&&(e.constructor===Object||e.constructor!=null&&e.constructor.name===`Object`)}function V(e){return typeof e==`string`||e instanceof String}function Ze(e){return V(e)?e.toUpperCase():e}function Qe(e,t){var n=[...arguments].slice(2),r=e;if(B(t)&&Object.keys(t).forEach(function(e){var n=t[e];B(n)&&(n=r[e]&&B(r[e])?Qe({},r[e],n):Qe({},n)),n!==void 0&&(r[e]=n)}),n&&n.length){var i=n.splice(0,1)[0];r=Qe.apply(void 0,He([r,i],n,!1))}return r}function $e(e,t){return V(e)&&V(t)?e.slice(0,t.length)===t:!1}function et(e){if(typeof e==`number`)return e;if(B(e)&&typeof e.valueOf==`function`){var t=e.valueOf();e=B(t)?t+``:t}return typeof e==`string`?(e=e.replace(/^\s+|\s+$/g,``),+e):e===0?e:+e}function tt(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(function(e){return V(e)?e:``})+``;var t=e+``;return t===`0`&&1/e==-1/0?`-0`:t}function nt(e){var t={};return e.filter(function(e){return Object.prototype.hasOwnProperty.call(t,e)?!1:t[e]=!0})}function rt(e,t){var n=qe(t,`feature`),r=[];return z(n,function(t,n){r.push({f:n,i:t.map(function(t){return{k:t.keyName,t:t.treatment,m:t.time,c:t.changeNumber,r:e?t.label:void 0,b:t.bucketingKey,pt:t.pt,properties:t.properties}})})}),r}function it(e){var t=e.settings,n=t.log,r=t.scheduler.impressionsRefreshRate,i=t.core.labelsEnabled,a=e.splitApi.postTestImpressionsBulk,o=e.storage.impressions,s=Ie(n,a,o,r,rt.bind(void 0,i),1);return o.setOnFullQueueCb(function(){s.isRunning()&&(n.info(115,[o.name]),s.execute())}),s}function at(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++){var i=n[r].split(`::`);if(i.length===2){var a=i[0],o=i[1],s={f:a,m:Number(o),rc:e[n[r]]};t.push(s)}}return{pf:t}}var ot=18e5;function st(e){var t=e.settings.log,n=e.splitApi.postTestImpressionsCount,r=e.storage.impressionCounts;return Ie(t,n,r,ot,at,1)}var ct=`state::splits-arrived`,lt=`state::splits-cache-loaded`,ut=`state::segments-arrived`,dt=`init::timeout`,ft=`init::ready`,pt=`init::cache-ready`,mt=`state::update`,ht=`FLAGS_UPDATE`,gt=`SEGMENTS_UPDATE`;function _t(e,t){if(e===`localhost`)return de;if([`standalone`,`producer`,`consumer`,`consumer_partial`].indexOf(t)===-1)throw Error(`Invalid mode provided`);return t}function vt(e){return e===`consumer`||e===`consumer_partial`}var yt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;function bt(e,t,n,r){if(r===void 0&&(r=`feature flag name`),t==null)e.error(315,[n,r]);else if(!V(t))e.error(318,[n,r]);else{if(yt.test(t)&&(e.warn(214,[n,r,t]),t=t.trim()),t.length>0)return t;e.error(319,[n,r])}return!1}function xt(e,t,n,r,i){if(r===void 0&&(r=`feature flag names`),i===void 0&&(i=`feature flag name`),Array.isArray(t)&&t.length>0){var a=[];if(t.forEach(function(t){var r=bt(e,t,n,i);r&&a.push(r)}),a.length)return nt(a)}return e.error(320,[n,r]),!1}var St=[{type:`bySet`,maxLength:50,queryParam:`sets=`},{type:`byName`,maxLength:400,queryParam:`names=`},{type:`byPrefix`,maxLength:50,queryParam:`prefixes=`}],Ct=/^[a-z0-9][_a-z0-9]{0,49}$/,wt=/[A-Z]/;function Tt(e){return St.some(function(t){return t.type===e})}function Et(e,t,n,r){var i=xt(e,n,y,t+` filter`,t+` filter value`);if(i){if(t===`bySet`&&(i=Ot(e,i,y)),i.length>r)throw Error(r+` unique values can be specified at most for '`+t+`' filter. You passed `+i.length+`. Please consider reducing the amount or using other filter.`);i.sort()}return i||[]}function Dt(e){var t=[];return St.forEach(function(n){var r=n.type,i=n.queryParam,a=e[r];a.length>0&&t.push(i+a.map(function(e){return encodeURIComponent(e)}).join(`,`))}),t.length>0?`&`+t.join(`&`):null}function Ot(e,t,n){return nt(t.map(function(t){return wt.test(t)&&(e.warn(226,[n,t]),t=t.toLowerCase()),t}).filter(function(t){return Ct.test(t)?typeof t==`string`:(e.warn(225,[n,t,Ct,t]),!1)}))}function kt(e,t){return We(e,function(e){return e.type===t&&e.values.length>0})}function At(e,t,n){var r={validFilters:[],queryString:null,groupedFilters:{bySet:[],byName:[],byPrefix:[]}};return t?vt(n)?(e.warn(219),r):!Array.isArray(t)||t.length===0?(e.warn(221),r):(r.validFilters=t.filter(function(t,n){return t&&Tt(t.type)&&Array.isArray(t.values)?(r.groupedFilters[t.type]=r.groupedFilters[t.type].concat(t.values),!0):(e.warn(220,[n]),!1)}),St.forEach(function(t){var n=t.type,i=t.maxLength;r.groupedFilters[n].length>0&&(r.groupedFilters[n]=Et(e,n,r.groupedFilters[n],i))}),kt(r.validFilters,`bySet`)&&((kt(r.validFilters,`byName`)||kt(r.validFilters,`byPrefix`))&&e.error(328),v(r.groupedFilters,{byName:[],byPrefix:[]})),r.queryString=Dt(r.groupedFilters),e.debug(39,[r.queryString]),r):r}function jt(e,t,n,r){var i=xt(e,n,t,`flag sets`,`flag set`),a=i?Ot(e,i,t):[];return r.length>0&&(a=a.filter(function(n){return r.indexOf(n)>-1||(e.warn(227,[t,n]),!1)})),a.length?a:!1}
1function Mt(e,t){return t=Ze(t),[`DEBUG`,`OPTIMIZED`,`NONE`].indexOf(t)>-1?t:(e.error(321,[`impressionsMode`,[le,L,ue],L]),L)}var Nt=250;function Pt(e,t,n,r){if(t==null)return e.error(315,[n,r]),!1;if(Ye(t))return e.warn(213,[n,r,t]),tt(t);if(V(t)){if(t=t.trim(),t.length>0&&t.length<=Nt)return t;t.length===0?e.error(319,[n,r]):t.length>Nt&&e.error(316,[n,r])}else e.error(318,[n,r]);return!1}function Ft(e,t,n){if(B(t)){var r=Pt(e,t.matchingKey,n,`matchingKey`),i=Pt(e,t.bucketingKey,n,`bucketingKey`);return r&&i?{matchingKey:r,bucketingKey:i}:(e.error(317,[n]),!1)}return Pt(e,t,n,`key`)}function It(e,t){var n=t.mode,r=t.initialRolloutPlan;if(vt(n)){e.warn(`storage: initial rollout plan is ignored in consumer mode`);return}if(B(r)&&B(r.splitChanges))return r;e.error(`storage: invalid rollout plan provided`)}function Lt(e,t,n,r){var i=n.splits,a=n.rbSegments,o=n.segments,s=n.largeSegments,c=t.splitChanges,l=c.ff,u=c.rbs;e.debug(`storage: set feature flags and segments`+(r?` for key `+r:``)),i&&l&&(i.clear(),i.update(l.d,[],l.t)),a&&u&&(a.clear(),a.update(u.d,[],u.t));var d=t.segmentChanges;if(r){var f=t.memberships&&t.memberships[r];!f&&d&&(f={ms:{k:d.filter(function(e){return e.added.indexOf(r)>-1}).map(function(e){return{n:e.name}})}}),f&&(f.ms&&o.resetSegments(f.ms),f.ls&&s&&s.resetSegments(f.ls))}else d&&(o.clear(),d.forEach(function(e){o.update(e.name,e.added,e.removed,e.till)}))}var Rt;(function(e){e.FlagName=`Invalid flag name (max 100 chars, no spaces)`,e.Treatment=`Invalid treatment (max 100 chars and must match pattern)`})(Rt||={});var zt=/^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$/;function Bt(e){return e.length<=100&&!e.includes(` `)}function Vt(e){var t=B(e)?e.treatment:e;return!V(t)||t.length>100?!1:zt.test(t)}function Ht(e,t){if(t!==void 0){if(!Vt(t)){e.error(`Fallback treatments - Discarded fallback: `+Rt.Treatment);return}return t}}function Ut(e,t){var n={};return B(t)&&Object.keys(t).forEach(function(r){var i=t[r];if(!Bt(r)){e.error(`Fallback treatments - Discarded flag '`+r+`': `+Rt.FlagName);return}if(!Vt(i)){e.error(`Fallback treatments - Discarded treatment for flag '`+r+`': `+Rt.Treatment);return}n[r]=i}),n}function Wt(e,t){if(!B(t)){e.error("Fallback treatments - Discarded configuration: it must be an object with optional `global` and `byFlag` properties");return}return{global:Ht(e,t.global),byFlag:Ut(e,t.byFlag)}}var Gt={mode:fe,core:{authorizationKey:void 0,key:void 0,labelsEnabled:!0,IPAddressesEnabled:void 0},scheduler:{featuresRefreshRate:60,segmentsRefreshRate:60,telemetryRefreshRate:3600,impressionsRefreshRate:300,offlineRefreshRate:15,eventsPushRate:60,eventsQueueSize:500,impressionsQueueSize:3e4,pushRetryBackoffBase:1},urls:{sdk:`https://sdk.split.io/api`,events:`https://events.split.io/api`,auth:`https://auth.split.io/api`,streaming:`https://streaming.split.io`,telemetry:`https://telemetry.split.io/api`},storage:void 0,debug:void 0,impressionListener:void 0,version:void 0,integrations:void 0,streamingEnabled:!0,sync:{splitFilters:void 0,impressionsMode:L,enabled:!0,flagSpecVersion:`1.3`},log:void 0};function H(e){return Math.round(e*1e3)}function Kt(e,t){var n=t.defaults,r=t.runtime,i=t.storage,a=t.integrations,o=t.logger,s=t.consent,c=t.flagSpec,l=Qe({},Gt,n,e);l.features=Ke(e,`features`);var u=o(l);l.log=u;var d=l.sync;d.impressionsMode=Mt(u,d.impressionsMode);function f(e,t,n){return t>=n?t:(u.error(326,[e,n]),n)}var p=l.scheduler,m=l.startup;p.featuresRefreshRate=H(p.featuresRefreshRate),p.segmentsRefreshRate=H(p.segmentsRefreshRate),p.offlineRefreshRate=H(p.offlineRefreshRate),p.eventsPushRate=H(p.eventsPushRate),p.telemetryRefreshRate=H(f(`telemetryRefreshRate`,p.telemetryRefreshRate,60)),Ke(e,`scheduler.impressionsRefreshRate`)===void 0&&d.impressionsMode===`DEBUG`&&(p.impressionsRefreshRate=60),p.impressionsRefreshRate=H(p.impressionsRefreshRate),p.metricsRefreshRate&&u.warn("`metricsRefreshRate` will be deprecated soon. For configuring telemetry rates, update `telemetryRefreshRate` value in configs"),m.requestTimeoutBeforeReady=H(m.requestTimeoutBeforeReady),m.readyTimeout=H(m.readyTimeout),m.eventsFirstPushWindow=H(m.eventsFirstPushWindow),l.mode=_t(l.core.authorizationKey,l.mode),i&&(l.storage=i(l)),l.initialRolloutPlan&&=It(u,l);var h=l.core.key;t.acceptKey?l.mode===`localhost`&&h===void 0?l.core.key=`localhost_key`:l.core.key=Ft(u,h,x):(h!==void 0&&u.warn("Provided `key` is ignored in server-side SDK."),l.core.key=void 0),l.runtime=r(l),a&&(l.integrations=a(l)),l.streamingEnabled!==!1&&(l.streamingEnabled=!0,p.pushRetryBackoffBase=H(p.pushRetryBackoffBase)),d.enabled!==!1&&(d.enabled=!0);var g=At(u,d.splitFilters,l.mode);return d.splitFilters=g.validFilters,d.__splitFiltersValidation=g,d.flagSpecVersion=c?c(l):`1.3`,l.userConsent=s?s(l):void 0,l.fallbackTreatments=l.fallbackTreatments?Wt(u,l.fallbackTreatments):void 0,l}var qt=`sdk_key`;function Jt(e,t){var n=!1;return t==null?e.error(315,[b,qt]):V(t)?t.length>0?n=t:e.error(319,[b,qt]):e.error(318,[b,qt]),n}var U={};function Yt(e,t){var n=Jt(e,t);return n&&(U[n]?(e.warn(222,[U[n]+` factory/ies with this SDK Key`]),U[n]++):(U[n]=1,Object.keys(U).length>1&&e.warn(222,[`an instance of the Split factory`]))),n}function Xt(e){U[e]&&U[e]--,U[e]===0&&delete U[e]}function Zt(e){var t=e();return function(){return Math.round(e()-t)}}function Qt(e){return B(e)?e.matchingKey:e}function $t(e){return B(e)?e.bucketingKey:void 0}function en(e){return B(e)?{matchingKey:e.matchingKey,bucketingKey:e.bucketingKey}:{matchingKey:e,bucketingKey:e}}function tn(e){return!e.core.key}var nn={},rn,an,on=(nn[fe]=0,nn[pe]=1,nn[me]=2,nn),sn=(rn={},rn[L]=0,rn[le]=1,rn[ue]=2,rn),cn=(an={},an[ve]=1,an[R]=2,an[_e]=3,an);function ln(){return Object.keys(U).length}function un(){return Object.keys(U).reduce(function(e,t){return e+U[t]-1},0)}function dn(e){var t=0;
1e.validFilters.forEach(function(e){e.type===`bySet`&&(t+=e.values.length)});var n=e.groupedFilters.bySet.length,r=t-n;return{flagSetsTotal:t,flagSetsIgnored:r}}function fn(e,t){return{oM:on[e],st:t.toLowerCase(),aF:ln(),rF:un()}}function pn(e,t){return{name:`telemetry config`,isEmpty:function(){return!1},clear:function(){},pop:function(){var n=t.urls,r=t.scheduler,i=tn(t),a=dn(t.sync.__splitFiltersValidation),o=a.flagSetsTotal,s=a.flagSetsIgnored;return v(fn(t.mode,t.storage.type),{sE:t.streamingEnabled,rR:{sp:r.featuresRefreshRate/1e3,se:i?r.segmentsRefreshRate/1e3:void 0,ms:i?void 0:r.segmentsRefreshRate/1e3,im:r.impressionsRefreshRate/1e3,ev:r.eventsPushRate/1e3,te:r.telemetryRefreshRate/1e3},uO:{s:n.sdk!==Gt.urls.sdk,e:n.events!==Gt.urls.events,a:n.auth!==Gt.urls.auth,st:n.streaming!==Gt.urls.streaming,t:n.telemetry!==Gt.urls.telemetry},iQ:r.impressionsQueueSize,eQ:r.eventsQueueSize,iM:sn[t.sync.impressionsMode],iL:!!t.impressionListener,hP:!1,tR:e.getTimeUntilReady(),tC:e.getTimeUntilReadyFromCache(),nR:e.getNonReadyUsage(),t:e.popTags(),i:t.integrations&&t.integrations.map(function(e){return e.type}),uC:t.userConsent?cn[t.userConsent]:0,fsT:o,fsI:s})}}}function mn(e){var t=e.storage.telemetry,n=e.platform.now;if(t&&n){var r=e.settings,i=e.settings,a=i.log,o=i.scheduler.telemetryRefreshRate,s=e.splitApi,c=e.readiness,l=e.sdkReadinessManager,u=Zt(n),d=Le(Ie(a,s.postMetricsUsage,t,o,void 0,0,!0),o);return c.gate.once(pt,function(){t.recordTimeUntilReadyFromCache(u())}),l.incInternalReadyCbCount(),c.gate.once(ft,function(){t.recordTimeUntilReady(u()),d.isRunning()&&Ie(a,s.postMetricsConfig,pn(t,r),0,void 0,0,!0).execute()}),d}}var hn=9e5;function gn(e){var t=e.settings,n=t.log,r=t.core.key,i=e.splitApi,a=i.postUniqueKeysBulkCs,o=i.postUniqueKeysBulkSs,s=e.storage.uniqueKeys,c=Ie(n,r===void 0?o:a,s,hn);return s.setOnFullQueueCb(function(){c.isRunning()&&(n.info(115,[s.name]),c.execute())}),c}function _n(e){var t=[it(e),Re(e),st(e),gn(e)],n=mn(e);return{start:function(e){e||t.forEach(function(e){return e.start()}),n&&n.start()},stop:function(e){t.forEach(function(e){return e.stop()}),!e&&n&&n.stop()},isRunning:function(){return t.some(function(e){return e.isRunning()})},execute:function(e){var r=e?[]:t.map(function(e){return e.execute()});return n&&r.push(n.execute()),Promise.all(r).then(function(){})},isExecuting:function(){return t.some(function(e){return e.isExecuting()})}}}var vn=`PUSH_NONRETRYABLE_ERROR`,yn=`PUSH_RETRYABLE_ERROR`,bn=`PUSH_SUBSYSTEM_UP`,xn=`PUSH_SUBSYSTEM_DOWN`,Sn=`MEMBERSHIPS_MS_UPDATE`,Cn=`MEMBERSHIPS_LS_UPDATE`,wn=`SEGMENT_UPDATE`,Tn=`SPLIT_KILL`,En=`SPLIT_UPDATE`,Dn=`RB_SEGMENT_UPDATE`,On=`CONTROL`,kn=`OCCUPANCY`,An;(function(e){e.STREAMING_DISABLED=`STREAMING_DISABLED`,e.STREAMING_PAUSED=`STREAMING_PAUSED`,e.STREAMING_RESUMED=`STREAMING_RESUMED`,e.STREAMING_RESET=`STREAMING_RESET`})(An||={});function jn(e){var t=e.userConsent;return!t||t===`GRANTED`}var Mn=function(){function e(){}return e.prototype.update=function(e,t,n){var r=this,i=e.map(function(e){return r.addSplit(e)}).some(function(e){return e});return i=t.map(function(e){return r.removeSplit(e.name)}).some(function(e){return e})||i,this.setChangeNumber(n),i},e.prototype.getSplits=function(e){var t=this,n={};return e.forEach(function(e){n[e]=t.getSplit(e)}),n},e.prototype.getAll=function(){var e=this;return this.getSplitNames().map(function(t){return e.getSplit(t)})},e.prototype.killLocally=function(e,t,n){var r=this.getSplit(e);if(r&&(!r.changeNumber||r.changeNumber<n)){var i=v({},r);return i.killed=!0,i.defaultTreatment=t,i.changeNumber=n,this.addSplit(i)}return!1},e}();function W(e){for(var t=e.conditions||[],n=0;n<t.length;n++)for(var r=t[n].matcherGroup.matchers,i=0;i<r.length;i++){var a=r[i].matcherType;if(a===`IN_SEGMENT`||a===`IN_LARGE_SEGMENT`)return!0}var o=e.excluded;return!!(o&&o.segments&&o.segments.length>0)}function Nn(e){return e.splits.usesSegments()||e.rbSegments.usesSegments()}function Pn(e,t){return function(n){var r=n.settings,i=n.settings,a=i.log,o=i.streamingEnabled,s=i.sync.enabled,c=n.telemetryTracker,l=n.storage,u=n.readiness,d=e&&e(n),f=s&&o&&d&&t?t(n,d):void 0,p=_n(n);function m(){d.isRunning()?a.info(118):(a.info(117),d.start(),c.streamingEvent(70,1))}function h(){a.info(119),d.isRunning()&&(d.stop(),c.streamingEvent(70,0)),d.syncAll()}f&&(f.on(bn,h),f.on(xn,m));var g=!1,_=!0;return{pollingManager:d,pushManager:f,submitterManager:p,start:function(){return g=!0,p.start(!jn(r)),Promise.resolve(l.validateCache?l.validateCache():{initialCacheLoad:!0}).then(function(e){g&&(_&&(e.initialCacheLoad||u.splits.emit(lt,e)),d&&(s?f?(_&&d.syncAll(),f.start()):d.start():_&&d.syncAll()),_=!1)})},stop:function(){g=!1,f&&f.stop(),d&&d.isRunning()&&d.stop(),p.stop()},isRunning:function(){return g},flush:function(){return p.execute(!jn(r))},shared:function(e,t,n){if(d){var r=d.add(e,t,n);return s&&f&&f.add(e,r),g&&(s?f?d.isRunning()?Nn(n)&&r.start():r.execute():Nn(n)&&r.start():t.isReady()||r.execute()),{stop:function(){var t=d.get(e);t&&(f&&f.remove(e),t.isRunning()&&t.stop(),d.remove(e))},flush:function(){return Promise.resolve()}}}}}}}var Fn=function(){function e(t,n,r){this.baseMillis=e.__TEST__BASE_MILLIS||n||e.DEFAULT_BASE_MILLIS,this.maxMillis=e.__TEST__MAX_MILLIS||r||e.DEFAULT_MAX_MILLIS,this.attempts=0,this.cb=t}return e.prototype.scheduleCall=function(){var e=this,t=Math.min(this.baseMillis*2**this.attempts,this.maxMillis);return this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout(function(){e.timeoutID=void 0,e.cb()},t),this.attempts++,t},e.prototype.reset=function(){this.attempts=0,this.timeoutID&&=(clearTimeout(this.timeoutID),void 0)},e.DEFAULT_BASE_MILLIS=1e3,e.DEFAULT_MAX_MILLIS=18e5,e}();function In(e){return V(e.data)&&(e.parsedData=JSON.parse(e.data)),e}function Ln(e){if(e.data){var t=JSON.parse(e.data);return t.parsedData=JSON.parse(t.data),t.name&&t.name===`[meta]occupancy`&&(t.parsedData.type=kn),t}}var Rn=[/control_pri$/,/control_sec$/],zn=[10,20];function Bn(e,t){var n=Rn.map(function(e){return{regex:e,hasPublishers:!0,oTime:-1,cTime:-1}}),r=!0,i=!0;function a(){return n.some(function(e){return e.hasPublishers})}return{handleOpen:function(){t.streamingEvent(0),e.emit(bn)},isStreamingUp:function(){return i&&r},handleOccupancyEvent:function(o,s,c){for(var l=0;l<n.length;l++){var u=n[l];
1if(u.regex.test(s)){if(t.streamingEvent(zn[l],o),c>u.oTime){u.oTime=c,u.hasPublishers=o!==0;var d=a();i&&(!d&&r?e.emit(xn):d&&!r&&e.emit(bn)),r=d}return}}},handleControlEvent:function(a,o,s){if(a===An.STREAMING_RESET){e.emit(a);return}for(var c=0;c<n.length;c++){var l=n[c];if(l.regex.test(o)){s>l.cTime&&(l.cTime=s,a===An.STREAMING_DISABLED?(t.streamingEvent(30,0),e.emit(vn)):r&&(a===An.STREAMING_PAUSED&&i?(t.streamingEvent(30,2),e.emit(xn)):a===An.STREAMING_RESUMED&&!i&&(t.streamingEvent(30,1),e.emit(bn))),i=a===An.STREAMING_RESUMED);return}}}}}function Vn(e,t,n){var r=Bn(t,n);function i(e){if(e.parsedData&&e.parsedData.code){var t=e.parsedData.code;if(n.streamingEvent(60,t),40140<=t&&t<=40149)return!0;if(4e4<=t&&t<=49999)return!1}else n.streamingEvent(40,1);return!0}return{handleOpen:function(){r.handleOpen()},handleError:function(n){var r=n;try{r=In(n)}catch(t){e.warn(206,[t])}var a=r.parsedData&&r.parsedData.message||r.message;e.error(305,[a]),i(r)?t.emit(yn):t.emit(vn)},handleMessage:function(n){var i;try{if(i=Ln(n),!i)return}catch(t){e.warn(207,[t]);return}var a=i.parsedData,o=i.data,s=i.channel,c=i.timestamp;if(e.debug(35,[o]),r.isStreamingUp()||[`OCCUPANCY`,`CONTROL`].indexOf(a.type)!==-1)switch(a.type){case En:case wn:case Sn:case Cn:case Tn:case Dn:t.emit(a.type,a);break;case kn:r.handleOccupancyEvent(a.metrics.publishers,s,c);break;case On:r.handleControlEvent(a.controlType,s,c)}}}}var Hn=1e4,Un=6e4;function Wn(e,t,n,r){var i,a,o;function s(t){var i=0,s=-1,c=!1,l,u,d,f=new Fn(p);function p(){if(l=!0,i>Math.max(s,t.getChangeNumber())){c=!1;var m=i;(a?new Promise(function(e){o=setTimeout(function(){a=void 0,n.execute(d,!0,u?i:void 0).then(e)},a)}):n.execute(d,!0,u?i:void 0)).then(function(n){if(l){if(n!==!1){var a=t.getChangeNumber();s=a>-1?a:Math.max(s,m)}if(c)p();else{d&&r.trackUpdatesFromSSE(`ms`);var o=f.attempts+1;if(i<=s){e.debug(`Refresh completed`+(u?` bypassing the CDN`:``)+` in `+o+` attempts.`),l=!1;return}if(o<10){f.scheduleCall();return}u?(e.debug(`No changes fetched after `+o+` attempts with CDN bypassed.`),l=!1):(f.reset(),u=!0,p())}}})}else l=!1}return{put:function(e,n,r){var o=e.type,m=e.cn;m<=Math.max(s,t.getChangeNumber())||m<=i||(i=m,!a&&(c=!0,u=!1,d=n&&{type:o,cn:m,added:n.added,removed:n.removed},a=r,(f.timeoutID||!l)&&p(),f.reset()))},stop:function(){clearTimeout(o),a=void 0,l=!1,f.reset()}}}var c=(i={},i[Sn]=s(t.segments),i[Cn]=s(t.largeSegments),i);return{put:function(e,t,n){c[e.type].put(e,t,n)},stop:function(){c[Sn].stop(),c[Cn].stop()}}}function Gn(e,t,n){function r(r){var i=0,a=!1,o,s,c=new Fn(l,Hn,Un);function l(){o=!0,i>(n.getChangeNumber(r)||-1)?(a=!1,t.execute(!1,r,!0,s?i:void 0).then(function(){if(o){if(a)l();else{var t=c.attempts+1;if(i<=(n.getChangeNumber(r)||-1)){e.debug(`Refresh completed`+(s?` bypassing the CDN`:``)+` in `+t+` attempts.`),o=!1;return}if(t<10){c.scheduleCall();return}s?(e.debug(`No changes fetched after `+t+` attempts with CDN bypassed.`),o=!1):(c.reset(),s=!0,l())}}})):o=!1}return{put:function(e){e<=(n.getChangeNumber(r)||-1)||e<=i||(i=e,a=!0,s=!1,(c.timeoutID||!o)&&l(),c.reset())},stop:function(){o=!1,c.reset()}}}var i={};return{put:function(e){var t=e.changeNumber,n=e.segmentName;i[n]||(i[n]=r(n)),i[n].put(t)}
1,stop:function(){Object.keys(i).forEach(function(e){return i[e].stop()})}}}var Kn=(function(){if([typeof Uint8Array,typeof Uint16Array,typeof Uint32Array].some(function(e){return e!=`function`}))return`global Uint8Array object is not available for gzip/zlib decompression`;var e=Uint8Array,t=Uint16Array,n=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(e,r){for(var i=new t(31),a=0;a<31;++a)i[a]=r+=1<<e[a-1];for(var o=new n(i[30]),a=1;a<30;++a)for(var s=i[a];s<i[a+1];++s)o[s]=s-i[a]<<5|a;return[i,o]},s=o(r,2),c=s[0],l=s[1];c[28]=258,l[258]=28;for(var u=o(i,0)[0],d=new t(32768),f=0;f<32768;++f){var p=(f&43690)>>>1|(f&21845)<<1;p=(p&52428)>>>2|(p&13107)<<2,p=(p&61680)>>>4|(p&3855)<<4,d[f]=((p&65280)>>>8|(p&255)<<8)>>>1}for(var m=(function(e,n,r){for(var i=e.length,a=0,o=new t(n);a<i;++a)++o[e[a]-1];var s=new t(n);for(a=0;a<n;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(r){c=new t(1<<n);var l=15-n;for(a=0;a<i;++a)if(e[a])for(var u=a<<4|e[a],f=n-e[a],p=s[e[a]-1]++<<f,m=p|(1<<f)-1;p<=m;++p)c[d[p]>>>l]=u}else for(c=new t(i),a=0;a<i;++a)e[a]&&(c[a]=d[s[e[a]-1]++]>>>15-e[a]);return c}),h=new e(288),f=0;f<144;++f)h[f]=8;for(var f=144;f<256;++f)h[f]=9;for(var f=256;f<280;++f)h[f]=7;for(var f=280;f<288;++f)h[f]=8;for(var g=new e(32),f=0;f<32;++f)g[f]=5;var _=m(h,9,1),v=m(g,5,1),y=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},b=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},x=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},S=function(e){return(e+7)/8|0},C=function(r,i,a){(i==null||i<0)&&(i=0),(a==null||a>r.length)&&(a=r.length);var o=new(r instanceof t?t:r instanceof n?n:e)(a-i);return o.set(r.subarray(i,a)),o},w=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],T=function(e,t,n){var r=Error(t||w[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,T),!n)throw r;return r},E=function(t,n,o){var s=t.length;if(!s||o&&o.f&&!o.l)return n||new e(0);var l=!n||o,d=!o||o.i;o||={},n||=new e(s*3);var f=function(t){var r=n.length;if(t>r){var i=new e(Math.max(r*2,t));i.set(n),n=i}},p=o.f||0,h=o.p||0,g=o.b||0,w=o.l,E=o.d,D=o.m,O=o.n,k=s*8;do{if(!w){p=b(t,h,1);var A=b(t,h+1,3);if(h+=3,!A){var j=S(h)+4,ee=t[j-4]|t[j-3]<<8,M=j+ee;if(M>s){d&&T(0);break}l&&f(g+ee),n.set(t.subarray(j,M),g),o.b=g+=ee,o.p=h=M*8,o.f=p;continue}if(A==1)w=_,E=v,D=9,O=5;else if(A==2){var N=b(t,h,31)+257,te=b(t,h+10,15)+4,ne=N+b(t,h+5,31)+1;h+=14;for(var P=new e(ne),re=new e(19),F=0;F<te;++F)re[a[F]]=b(t,h+F*3,7);h+=te*3;for(var ie=y(re),ae=(1<<ie)-1,oe=m(re,ie,1),F=0;F<ne;){var se=oe[b(t,h,ae)];h+=se&15;var j=se>>>4;if(j<16)P[F++]=j;else{var ce=0,I=0;for(j==16?(I=3+b(t,h,3),h+=2,ce=P[F-1]):j==17?(I=3+b(t,h,7),h+=3):j==18&&(I=11+b(t,h,127),h+=7);I--;)P[F++]=ce}}var le=P.subarray(0,N),L=P.subarray(N);D=y(le),O=y(L),w=m(le,D,1),E=m(L,O,1)}else T(1);if(h>k){d&&T(0);break}}l&&f(g+131072);for(var ue=(1<<D)-1,de=(1<<O)-1,fe=h;;fe=h){var ce=w[x(t,h)&ue],pe=ce>>>4;if(h+=ce&15,h>k){d&&T(0);break}if(ce||T(2),pe<256)n[g++]=pe;else if(pe==256){fe=h,w=null;break}else{var me=pe-254;if(pe>264){var F=pe-257,he=r[F];me=b(t,h,(1<<he)-1)+c[F],h+=he}var ge=E[x(t,h)&de],R=ge>>>4;ge||T(3),h+=ge&15;var L=u[R];if(R>3){var he=i[R];L+=x(t,h)&(1<<he)-1,h+=he}if(h>k){d&&T(0);break}l&&f(g+131072);for(var _e=g+me;g<_e;g+=4)n[g]=n[g-L],n[g+1]=n[g+1-L],n[g+2]=n[g+2-L],n[g+3]=n[g+3-L];g=_e}}o.l=w,o.p=fe,o.b=g,o.f=p,w&&(p=1,o.m=D,o.d=E,o.n=O)}while(!p);return g==n.length?n:C(n,0,g)},D=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&T(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=e[10]|(e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},O=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},k=function(e){((e[0]&15)!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)&&T(6,`invalid zlib data`),e[1]&32&&T(6,`invalid zlib data: preset dictionaries not supported`)};return{gunzipSync:function(t,n){return E(t.subarray(D(t),-8),n||new e(O(t)))},unzlibSync:function(e,t){return E((k(e),e.subarray(2,-4)),t)}}})(),qn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/=`;function Jn(e){var t=String(e).replace(/[=]+$/,``);if(t.length%4==1)throw Error(`'atob' failed: The string to be decoded is not correctly encoded.`);for(var n=``,r=0,i=void 0,a=void 0,o=0;a=t.charAt(o++);~a&&(i=r%4?i*64+a:a,r++%4)&&(n+=String.fromCharCode(255&i>>(-2*r&6))))a=qn.indexOf(a);return n}function Yn(e){for(var t=String(e),n=``,r=void 0,i=void 0,a=0,o=qn;t.charAt(a|0)||(o=`=`,a%1);n+=o.charAt(63&r>>8-a%1*8)){if(i=t.charCodeAt(a+=3/4),i>255)throw Error(`'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.`);r=r<<8|i}return n}function Xn(e,t){var n=null;for(typeof e==`number`&&(n=e,e=function(){return null});n!==null||(n=e())!==null;)n<128?t(n&127):n<2048?(t(n>>6&31|192),t(n&63|128)):n<65536?(t(n>>12&15|224),t(n>>6&63|128),t(n&63|128)):(t(n>>18&7|240),t(n>>12&63|128),t(n>>6&63|128),t(n&63|128)),n=null}function Zn(e,t){for(var n,r=null;(n=r===null?e():r)!==null;){if(n>=55296&&n<=57343&&(r=e())!==null&&r>=56320&&r<=57343){t((n-55296)*1024+r-56320+65536),r=null;continue}t(n)}r!==null&&t(r)}function Qn(e,t){Zn(e,function(e){Xn(e,t)})}var $n=String.fromCharCode;function er(e){if(typeof e!=`string`)throw TypeError(`Illegal argument: `+typeof e);var t=0;return function(){return t>=e.length?null:e.charCodeAt(t++)}}function tr(){var e=[],t=[];return function(){if(arguments.length===0)return t.join(``)+$n.apply(String,e);e.length+arguments.length>1024&&(t.push($n.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function nr(e){var t;return Qn(er(e),t=tr()),t()}function rr(e,t){return(e&65535)*t+(((e>>>16)*t&65535)<<16)}function ir(e,t){return e<<t|e>>>32-t}function ar(e){return e^=e>>>16,e=rr(e,2246822507),e^=e>>>13,e=rr(e,3266489909),e^=e>>>16,e}function or(e,t){e||=``,t||=0;for(var n=e.length%4,r=e.length-n,i=t,a=0,o=3432918353,s=461845907,c=0;c<r;c+=4)a=e.charCodeAt(c)&255|(e.charCodeAt(c+1)&255)<<8|(e.charCodeAt(c+2)&255)<<16|(e.charCodeAt(c+3)&255)<<24,a=rr(a,o),a=ir(a,15),a=rr(a,s),i^=a,i=ir(i,13),i=rr(i,5)+3864292196;switch(a=0,n){case 3:a^=(e.charCodeAt(c+2)&255)<<16;case 2:a^=(e.charCodeAt(c+1)&255)<<8;case 1:a^=e.charCodeAt(c)&255,a=rr(a,o),a=ir(a,15),a=rr(a,s),i^=a}return i^=e.length,i=ar(i),i>>>0}function sr(e,t){return or(nr(e),t>>>0)}function cr(e,t){return Math.abs(sr(e,t)%100)+1}var lr=1,ur=2;function dr(e){return String.fromCharCode.apply(null,e)}function fr(e){var t=e.split(``).map(function(e){return e.charCodeAt(0)});return new Uint8Array(t)}function pr(e,t){var n=fr(Jn(e));if(typeof Kn==`string`)throw Error(Kn);if(t===lr)return Kn.gunzipSync(n);if(t===ur)return Kn.unzlibSync(n);throw Error(`Invalid compression algorithm #`+t)}function mr(e,t,n){n===void 0&&(n=!0);var r=dr(pr(e,t));return n&&(r=r.replace(/\d+/g,`"$&"`)),JSON.parse(r)}function hr(e,t){return pr(e,t)}function gr(e,t){var n=parseInt(t.slice(8),16)%(e.length*8),r=Math.floor(n/8),i=n%8;return(e[r]&1<<i)>0}function _r(e,t){return e>0?mr(t,e,!1):JSON.parse(Jn(t))}var vr=6e4;function yr(e,t){if(e.h===0)return 0;var n=e.i||vr;return sr(t,e.s||0)%n}function br(e,t,n,r,i,a){var o=c(t.splits),s=c(t.rbSegments);function c(t){var r=-1,c=!1,l,u,d,f=new Fn(p,Hn,Un);function p(){l=!0,r>t.getChangeNumber()?(c=!1,n.execute(!0,u?r:void 0,d).then(function(){if(l){if(c)p();else{d&&i.trackUpdatesFromSSE(`sp`),a&&a.execute(!0);var t=f.attempts+1;if(o.isSync()&&s.isSync()){e.debug(`Refresh completed`+(u?` bypassing the CDN`:``)+` in `+t+` attempts.`),l=!1;return}if(t<10){f.scheduleCall();return}u?(e.debug(`No changes fetched after `+t+` attempts with CDN bypassed.`),l=!1):(f.reset(),u=!0,p())}}})):l=!1}return{put:function(e,n){var i=e.changeNumber,a=e.pcn,o=e.type,s=t.getChangeNumber();i<=s||i<=r||(r=i,c=!0,u=!1,d=void 0,n&&s===a&&(d={payload:n,changeNumber:i,type:o}),(f.timeoutID||!l)&&p(),f.reset())},stop:function(){l=!1,f.reset()},isSync:function(){return r<=t.getChangeNumber()}}}return{put:function(t){if(t.d&&t.c!==void 0)try{var n=_r(t.c,t.d);if(n){(t.type===`RB_SEGMENT_UPDATE`?s:o).put(t,n);return}}catch(n){e.warn(224,[t.type,n])}(t.type===`RB_SEGMENT_UPDATE`?s:o).put(t)},killSplit:function(e){var n=e.changeNumber,i=e.splitName,a=e.defaultTreatment;t.splits.killLocally(i,a,n)&&r.emit(ct,!0),o.put({changeNumber:n})},stop:function(){o.stop(),s.stop()}}}function xr(e){var t=e.split(`.`)[1].replace(/-/g,`+`).replace(/_/g,`/`),n=decodeURIComponent(Jn(t).split(``).map(function(e){return`%`+(`00`+e.charCodeAt(0).toString(16)).slice(-2)}).join(``));return JSON.parse(n)}function Sr(e){return function(t){return e(t).then(function(e){return e.json()}).then(function(e){if(e.token){var t=xr(e.token);if(typeof t.iat!=`number`||typeof t.exp!=`number`)throw Error(`token properties "issuedAt" (iat) or "expiration" (exp) are missing or invalid`);return v({decodedToken:t,channels:JSON.parse(t[`x-ably-capability`])},e)}return e})}}function Cr(e){return Yn(sr(e,0).toString())}var wr=`1.1`,Tr=/^control_/;function Er(e){var t={SplitSDKClientKey:V(e.core.authorizationKey)?e.core.authorizationKey.slice(-4):``,SplitSDKVersion:e.version},n=e.runtime,r=n.ip,i=n.hostname;return r&&(t.SplitSDKMachineIP=r),i&&(t.SplitSDKMachineName=i),t}var Dr=function(){function e(e,t){var n=t.getEventSource,r=t.getOptions;if(this.settings=e,this.eventSource=n&&n(e),!this.eventSource)throw Error(`EventSource API is not available.`);this.headers=Er(e),this.options=r&&r(e)}return e.prototype.setEventHandler=function(e){this.handler=e},e.prototype.open=function(e){this.close();var t=Object.keys(e.channels).map(function(e){var t=Tr.test(e)?`[?occupancy=metrics.publishers]`:``;return encodeURIComponent(t+e)}
1).join(`,`),n=this.settings.urls.streaming+`/sse?channels=`+t+`&accessToken=`+e.token+`&v=`+wr+`&heartbeats=true`,r=tn(this.settings);this.connection=new this.eventSource(r?n:n+(`&SplitSDKVersion=`+this.headers.SplitSDKVersion+`&SplitSDKClientKey=`+this.headers.SplitSDKClientKey),v(r?{headers:F(this.settings,this.headers)}:this.settings.sync.requestOptions?.getHeaderOverrides?{headers:F(this.settings,{})}:{},this.options)),this.handler&&(this.connection.addEventListener(`open`,this.handler.handleOpen),this.connection.addEventListener(`message`,this.handler.handleMessage),this.connection.addEventListener(`error`,this.handler.handleError))},e.prototype.close=function(){this.connection&&this.connection.close()},e}(),Or;(function(e){e[e.None=0]=`None`,e[e.Gzip=1]=`Gzip`,e[e.Zlib=2]=`Zlib`})(Or||={});var kr;(function(e){e[e.UnboundedFetchRequest=0]=`UnboundedFetchRequest`,e[e.BoundedFetchRequest=1]=`BoundedFetchRequest`,e[e.KeyList=2]=`KeyList`,e[e.SegmentRemoval=3]=`SegmentRemoval`})(kr||={});function Ar(e,t){e=[e[0]>>>16,e[0]&65535,e[1]>>>16,e[1]&65535],t=[t[0]>>>16,t[0]&65535,t[1]>>>16,t[1]&65535];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function G(e,t){e=[e[0]>>>16,e[0]&65535,e[1]>>>16,e[1]&65535],t=[t[0]>>>16,t[0]&65535,t[1]>>>16,t[1]&65535];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function jr(e,t){return t%=64,t===32?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function K(e,t){return t%=64,t===0?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function q(e,t){return[e[0]^t[0],e[1]^t[1]]}function Mr(e){return e=q(e,[0,e[0]>>>
11]),e=G(e,[4283543511,3981806797]),e=q(e,[0,e[0]>>>1]),e=G(e,[3301882366,444984403]),e=q(e,[0,e[0]>>>1]),e}function Nr(e,t){e||=``,t||=0;for(var n=e.length%16,r=e.length-n,i=[0,t],a=[0,t],o=[0,0],s=[0,0],c=[2277735313,289559509],l=[1291169091,658871167],u=0;u<r;u+=16)o=[e.charCodeAt(u+4)&255|(e.charCodeAt(u+5)&255)<<8|(e.charCodeAt(u+6)&255)<<16|(e.charCodeAt(u+7)&255)<<24,e.charCodeAt(u)&255|(e.charCodeAt(u+1)&255)<<8|(e.charCodeAt(u+2)&255)<<16|(e.charCodeAt(u+3)&255)<<24],s=[e.charCodeAt(u+12)&255|(e.charCodeAt(u+13)&255)<<8|(e.charCodeAt(u+14)&255)<<16|(e.charCodeAt(u+15)&255)<<24,e.charCodeAt(u+8)&255|(e.charCodeAt(u+9)&255)<<8|(e.charCodeAt(u+10)&255)<<16|(e.charCodeAt(u+11)&255)<<24],o=G(o,c),o=jr(o,31),o=G(o,l),i=q(i,o),i=jr(i,27),i=Ar(i,a),i=Ar(G(i,[0,5]),[0,1390208809]),s=G(s,l),s=jr(s,33),s=G(s,c),a=q(a,s),a=jr(a,31),a=Ar(a,i),a=Ar(G(a,[0,5]),[0,944331445]);switch(o=[0,0],s=[0,0],n){case 15:s=q(s,K([0,e.charCodeAt(u+14)],48));case 14:s=q(s,K([0,e.charCodeAt(u+13)],40));case 13:s=q(s,K([0,e.charCodeAt(u+12)],32));case 12:s=q(s,K([0,e.charCodeAt(u+11)],24));case 11:s=q(s,K([0,e.charCodeAt(u+10)],16));case 10:s=q(s,K([0,e.charCodeAt(u+9)],8));case 9:s=q(s,[0,e.charCodeAt(u+8)]),s=G(s,l),s=jr(s,33),s=G(s,c),a=q(a,s);case 8:o=q(o,K([0,e.charCodeAt(u+7)],56));case 7:o=q(o,K([0,e.charCodeAt(u+6)],48));case 6:o=q(o,K([0,e.charCodeAt(u+5)],40));case 5:o=q(o,K([0,e.charCodeAt(u+4)],32));case 4:o=q(o,K([0,e.charCodeAt(u+3)],24));case 3:o=q(o,K([0,e.charCodeAt(u+2)],16));case 2:o=q(o,K([0,e.charCodeAt(u+1)],8));case 1:o=q(o,[0,e.charCodeAt(u)]),o=G(o,c),o=jr(o,31),o=G(o,l),i=q(i,o)}return i=q(i,[0,e.length]),a=q(a,[0,e.length]),i=Ar(i,a),a=Ar(a,i),i=Mr(i),a=Mr(a),i=Ar(i,a),a=Ar(a,i),(`00000000`+(i[0]>>>0).toString(16)).slice(-8)+(`00000000`+(i[1]>>>0).toString(16)).slice(-8)+(`00000000`+(a[0]>>>0).toString(16)).slice(-8)+(`00000000`+(a[1]>>>0).toString(16)).slice(-8)}function Pr(e,t){return Nr(nr(e),t>>>0)}function Fr(e){var t,n,r=[0],i;for(t=0;t<e.length;t+=1){for(i=parseInt(e.charAt(t),16),n=r.length-1;n>=0;--n)r[n]=r[n]*16+i,i=r[n]/10|0,r[n]%=10;for(;i>0;)r.unshift(i%10),i=i/10|0}return r.join(``)}function Ir(e){var t=Pr(e).slice(0,16);return{hex:t,dec:Fr(t)}}function Lr(e,t){var n=e.settings,r=e.storage,i=e.splitApi,a=e.readiness,o=e.platform,s=e.telemetryTracker,c=tn(n)?void 0:Qt(n.core.key),l=n.log,u;try{u=new Dr(n,o)}catch(e){l.warn(208,[e]);return}var d=Sr(i.fetchAuth),f=new o.EventEmitter,p=Vn(l,f,s);u.setEventHandler(p);var m=c?void 0:Gn(l,t.segmentsSyncTask,r.segments),h=br(l,r,t.splitsSyncTask,a.splits,s,c?void 0:t.segmentsSyncTask),g={},_={},y=!1,b,x,S=new Fn(E,n.scheduler.pushRetryBackoffBase),C,w;function T(e){C&&clearTimeout(C),w&&clearTimeout(w);var t=e.decodedToken,n=t.exp-t.iat-600,r=typeof e.connDelay==`number`&&e.connDelay>=0?e.connDelay:60;l.info(110,[n,r]),C=setTimeout(E,n*1e3),w=setTimeout(function(){b||u.open(e)},r*1e3),s.streamingEvent(50,t.exp)}function E(){if(!b){l.info(112),b=!1;var e=c?Object.keys(_):void 0;d(e).then(function(t){if(!b){if(!t.pushEnabled){l.info(113),f.emit(vn);return}e&&e.length<Object.keys(_).length||T(t)}}).catch(function(e){if(!b){if(l.error(306,[e.message]),e.statusCode>=400&&e.statusCode<500){s.streamingEvent(80),f.emit(vn);return}f.emit(yn)}})}}function D(){b||(b=!0,u.close(),l.info(114),C&&clearTimeout(C),w&&clearTimeout(w),S.reset(),O())}function O(){h.stop(),c?z(_,function(e){return e.worker.stop()}):m.stop()}f.on(xn,O),f.on(bn,function(){S.reset()}),f.on(vn,function(){x=!0,D(),f.emit(xn)}),f.on(yn,function(){u.close();var e=S.scheduleCall();l.info(111,[e/1e3]),f.emit(xn)}),f.on(An.STREAMING_RESET,function(){b||(C&&clearTimeout(C),E())}),f.on(Tn,h.killSplit),f.on(En,h.put),f.on(Dn,h.put);function k(e){switch(e.u){case kr.BoundedFetchRequest:var t;try{t=hr(e.d,e.c)}catch(e){l.warn(223,[`BoundedFetchRequest`,e]);break}z(_,function(n,r){var i=n.hash64,a=n.worker;gr(t,i.hex)&&a.put(e,void 0,yr(e,r))});return;case kr.KeyList:var n=void 0,r,i;try{n=mr(e.d,e.c),r=new Set(n.a),i=new Set(n.r)}catch(e){l.warn(223,[`KeyList`,e]);break}if(!e.n||!e.n.length){l.warn(223,[`KeyList`,`No segment name was provided`]);break}z(_,function(t){var n=t.hash64,a=t.worker,o=r.has(n.dec)?!0:!i.has(n.dec)&&void 0;o!==void 0&&a.put(e,{added:o?[e.n[0]]:[],removed:o?[]:[e.n[0]]})});return;case kr.SegmentRemoval:if(!e.n||!e.n.length){l.warn(223,[`SegmentRemoval`,`No segment name was provided`]);break}z(_,function(t){t.worker.put(e,{added:[],removed:e.n})});return}z(_,function(t,n){t.worker.put(e,void 0,yr(e,n))})}return c?(f.on(Sn,k),f.on(Cn,k)):f.on(wn,m.put),v(Object.create(f),{stop:function(){D(),c&&this.remove(c)},start:function(){x||b===!1||(b=!1,c?this.add(c,t.segmentsSyncTask):setTimeout(E))},isRunning:function(){return b===!1},add:function(e,t){var n=Cr(e);g[n]||(g[n]=e,_[e]={hash64:Ir(e),worker:Wn(l,r,t,s)},y=!0,this.isRunning()&&setTimeout(function(){y&&(y=!1,E())},0))},remove:function(e){var t=Cr(e);delete g[t],delete _[e]}})}function Rr(e){return function(t,n,r,i){var a=e(t,n,r);return i&&(a=i(a)),a.then(function(e){return e.json()})}}function zr(e,t,n,r,i,a,o){var s=n.segments,c=n.largeSegments,l=!0,u=!0;
1function d(e){return u&&(e=ae(i,e)),e}function f(e){var t;e.type===void 0?(t=s.resetSegments(e.ms||{}),t=c.resetSegments(e.ls||{})||t):t=e.type===`MEMBERSHIPS_LS_UPDATE`?c.resetSegments(e):s.resetSegments(e),n.save&&n.save(),Nn(n)&&(t||l)&&(l=!1,r.emit(ut,{type:gt,names:[]}))}function p(n,r,i,s){return(r?new Promise(function(e){f(r),e(!0)}):t(o,i,s,d).then(function(e){return f(e),u=!1,!0})).catch(function(t){return u&&a>n?(n+=1,e.warn(204,[n,t]),p(n)):(u=!1,!1)})}return function(e,t,n){return p(0,e,t,n)}}function Br(e,t,n,r,i){return Fe(r.log,zr(r.log,Rr(e),t,n.segments,r.startup.requestTimeoutBeforeReady,r.startup.retriesOnFailureBeforeReady,i),r.scheduler.segmentsRefreshRate,`mySegmentsUpdater`)}var Vr=36e5,Hr=24*Vr;function Ur(e){return e.urls.sdk!==Gt.urls.sdk}function Wr(e,t,n){var r=t.log,i=tn(t)?Hr:Vr,a;return function o(s,c,l,u,d){a&&Date.now()-a>i&&(t.sync.flagSpecVersion=`1.3`);var f=e(s,c,l,t.sync.flagSpecVersion===`1.3`?u:void 0).catch(function(n){if((!n.statusCode||n.statusCode===400)&&Ur(t)&&t.sync.flagSpecVersion===`1.3`)return r.error(A+`Proxy error detected. Retrying with spec 1.2. If you are using Split Proxy, please upgrade to latest version`),a=Date.now(),t.sync.flagSpecVersion=`1.2`,e(s,c,l);throw n});return d&&(f=d(f)),f.then(function(e){return e.json()}).then(function(e){return e.splits?{ff:{d:e.splits,s:e.since,t:e.till}}:a?(r.info(A+`Proxy error recovered`),a=void 0,o(-1,void 0,void 0,-1).then(function(e){return Promise.all([n.splits.clear(),n.rbSegments.clear()]).then(function(){return e})})):e})}}function Gr(e){if(Array.from)return Array.from(e);var t=[];return e.forEach(function(e){t.push(e)}),t}function Kr(e,t){return new Set(Gr(e).concat(Gr(t)))}function qr(e){return Promise.resolve(e.getRegisteredSegments()).then(function(t){return Promise.all(t.map(function(t){return e.getChangeNumber(t)})).then(function(e){return e.every(function(e){return e!==void 0})})})}function Jr(e,t){t===void 0&&(t=Ae);var n=e,r=n.conditions,i=r===void 0?[]:r,a=n.excluded,o=new Set;a&&a.segments&&a.segments.forEach(function(e){var n=e.type,r=e.name;(n===`standard`&&t===`IN_SEGMENT`||n===`rule-based`&&t===`IN_RULE_BASED_SEGMENT`)&&o.add(r)});for(var s=0;s<i.length;s++)i[s].matcherGroup.matchers.forEach(function(e){e.matcherType===t&&o.add(e.userDefinedSegmentMatcherData.segmentName)});return o}function Yr(e,t){var n=t.groupedFilters,r=n.bySet,i=n.byName,a=n.byPrefix;if(r.length>0)return e.sets&&e.sets.some(function(e){return r.indexOf(e)>-1});var o=i.length>0,s=a.length>0;if(!o&&!s)return!0;var c=o&&i.indexOf(e.name)>-1,l=s&&a.some(function(t){return $e(e.name,t)});return c||l}function Xr(e,t,n){return e.reduce(function(e,r){return r.status===`ACTIVE`&&(!n||Yr(r,n))?(e.added.push(r),Jr(r).forEach(function(e){t.add(e)})):e.removed.push(r),e.names.push(r.name),e},{added:[],removed:[],names:[]})}function Zr(e,t,n,r,i,a,o,s){a===void 0&&(a=0),o===void 0&&(o=0);var c=n.splits,l=n.rbSegments,u=n.segments,d=!0;function f(e){return d&&a&&(e=ae(a,e)),e}return function(a,p,m){function h(g,_){_===void 0&&(_=0);var v=g[0],y=g[1];return e.debug(31,g),Promise.resolve(m?m.type===`SPLIT_UPDATE`?Promise.resolve(l.contains(Jr(m.payload,je))).then(function(e){return e?{ff:{d:[m.payload],t:m.changeNumber}}:t(v,a,p,y,f)}):{rbs:{d:[m.payload],t:m.changeNumber}}:t(v,a,p,y,f)).then(function(t){var a=new Set,o=[],f=!1;if(t.ff){var p=Xr(t.ff.d,a,r),m=p.added,h=p.removed;o=p.names,e.debug(32,[m.length,h.length]),f=c.update(m,h,t.ff.t)}var g=!1;if(t.rbs){var _=Xr(t.rbs.d,a),m=_.added,h=_.removed;e.debug(33,[m.length,h.length]),g=l.update(m,h,t.rbs.t)}return Promise.all([f,g,u.registerSegments(Gr(a))]).then(function(e){var t=e[0],r=e[1];return n.save&&n.save(),d=!1,!i||Promise.resolve(!i.splitsArrived||(t||r)&&(s||qr(u))).catch(function(){return!1}).then(function(e){if(e){var t={type:o.length>0?ht:gt,names:o.length>0?o:[]};i.emit(ct,t)}return!0})})}).catch(function(t){return d&&o>_?(_+=1,e.warn(109,[_,t]),h(g,_)):(d=!1,e.warn(205,[t]),!1)})}return Promise.all([c.getChangeNumber(),l.getChangeNumber()]).then(h)}}function Qr(e,t,n,r,i){return Fe(r.log,Zr(r.log,Wr(e,r,t),t,r.sync.__splitFiltersValidation,n.splits,r.startup.requestTimeoutBeforeReady,r.startup.retriesOnFailureBeforeReady,i),r.scheduler.featuresRefreshRate,`splitChangesUpdater`)}function $r(e){var t=e.splitApi,n=e.storage,r=e.readiness,i=e.settings,a=i.log,o=Qr(t.fetchSplitChanges,n,r,i,!0),s={},c=d(Qt(i.core.key),r,n);function l(){z(s,function(e){e.start()})}function u(){z(s,function(e){e.isRunning()&&e.stop()})}r.splits.on(ct,function(){if(o.isRunning()){var e=Nn(n);
1e!==c.isRunning()&&(a.info(106,[e?`ON`:`OFF`]),e?l():u())}});function d(e,n,r){var a=Br(t.fetchMemberships,r,n,i,e);function o(e){!n.isReady()&&!Nn(r)&&n.segments.emit(ut,e)}return Nn(r)?n.splits.once(ct,o):setTimeout(o,0),s[e]=a,a}return{splitsSyncTask:o,segmentsSyncTask:c,start:function(){a.info(107),o.start(),Nn(n)&&l()},stop:function(){a.info(108),o.isRunning()&&o.stop(),u()},isRunning:o.isRunning,syncAll:function(){var e=[o.execute()];return z(s,function(t){e.push(t.execute())}),Promise.all(e)},add:d,remove:function(e){delete s[e]},get:function(e){return s[e]}}}var ei=function(){function e(e){e===void 0&&(e=0),this.name=`impressions`,this.maxQueue=e,this.queue=[]}return e.prototype.setOnFullQueueCb=function(e){this.onFullQueue=e},e.prototype.track=function(e){var t;(t=this.queue).push.apply(t,e),this.maxQueue>0&&this.queue.length>=this.maxQueue&&this.onFullQueue&&this.onFullQueue()},e.prototype.clear=function(){this.queue=[]},e.prototype.pop=function(e){var t=this.queue;return this.clear(),e?e.concat(t):t},e.prototype.isEmpty=function(){return this.queue.length===0},e}(),ti=36e5;function ni(e){return e-e%ti}var ri=3e4,ii=function(){function e(e){e===void 0&&(e=ri),this.name=`impression counts`,this.cache={},this.cacheSize=0,this.maxStorage=e}return e.prototype._makeKey=function(e,t){return e+`::`+ni(t)},e.prototype.track=function(e,t,n){var r=this._makeKey(e,t),i=this.cache[r];this.cache[r]=i?i+n:n,this.onFullQueue&&(this.cacheSize+=n,this.cacheSize>=this.maxStorage&&this.onFullQueue())},e.prototype.pop=function(e){var t=this.cache;return this.clear(),e?(Object.keys(t).forEach(function(n){e[n]?e[n]+=t[n]:e[n]=t[n]}),e):t},e.prototype.clear=function(){this.cache={},this.cacheSize=0},e.prototype.isEmpty=function(){return Object.keys(this.cache).length===0},e}(),ai=5242880,oi=function(){function e(e){e===void 0&&(e=0),this.name=`events`,this.maxQueue=e,this.queue=[],this.queueByteSize=0}return e.prototype.setOnFullQueueCb=function(e){this.onFullQueue=e},e.prototype.track=function(e,t){return t===void 0&&(t=0),this.queueByteSize+=t,this.queue.push(e),this._checkForFlush(),!0},e.prototype.clear=function(){this.queue=[],this.queueByteSize=0},e.prototype.pop=function(e){var t=this.queue;return this.clear(),e?e.concat(t):t},e.prototype.isEmpty=function(){return this.queue.length===0},e.prototype._checkForFlush=function(){(this.queueByteSize>ai||this.maxQueue>0&&this.queue.length>=this.maxQueue)&&this.onFullQueue&&this.onFullQueue()},e}(),si=/[^.]+$/,ci=`SPLITIO`;function li(e){return e?e+`.SPLITIO`:`SPLITIO`}var ui=function(){function e(e){e===void 0&&(e=ci),this.prefix=e}return e.prototype.buildTrafficTypeKey=function(e){return this.prefix+`.trafficType.`+e},e.prototype.buildFlagSetKey=function(e){return this.prefix+`.flagSet.`+e},e.prototype.buildSplitKey=function(e){return this.prefix+`.split.`+e},e.prototype.buildSplitsTillKey=function(){return this.prefix+`.splits.till`},e.prototype.buildSplitKeyPrefix=function(){return this.prefix+`.split.`},e.prototype.buildRBSegmentKey=function(e){return this.prefix+`.rbsegment.`+e},e.prototype.buildRBSegmentsTillKey=function(){return this.prefix+`.rbsegments.till`},e.prototype.buildRBSegmentKeyPrefix=function(){return this.prefix+`.rbsegment.`},e.prototype.buildSegmentNameKey=function(e){return this.prefix+`.segment.`+e},e.prototype.buildSegmentTillKey=function(e){return this.prefix+`.segment.`+e+`.till`},e.prototype.extractKey=function(e){var t=e.match(si);if(t&&t.length)return t[0];throw Error(`Invalid latency key provided`)},e.prototype.buildHashKey=function(){return this.prefix+`.hash`},e}();function di(e){return sr(e.core.authorizationKey+`::`+e.sync.__splitFiltersValidation.queryString+`::`+e.sync.flagSpecVersion).toString(16)}var fi=function(e){Be(t,e);function t(t,n){var r=e.call(this,t)||this;return r.matchingKey=n,r.regexSplitsCacheKey=RegExp(`^`+t+`\\.(splits?|trafficType|flagSet)\\.`),r}return t.prototype.buildSegmentNameKey=function(e){return this.prefix+`.`+this.matchingKey+`.segment.`+e},t.prototype.extractSegmentName=function(e){var t=this.prefix+`.`+this.matchingKey+`.segment.`;if($e(e,t))return e.slice(t.length)},t.prototype.buildLastUpdatedKey=function(){return this.prefix+`.splits.lastUpdated`},t.prototype.isSplitsCacheKey=function(e){return this.regexSplitsCacheKey.test(e)},t.prototype.buildTillKey=function(){return this.prefix+`.`+this.matchingKey+`.segments.till`},t.prototype.isSplitKey=function(e){return $e(e,this.prefix+`.split.`)},t.prototype.isRBSegmentKey=function(e){return $e(e,this.prefix+`.rbsegment.`)},t.prototype.buildSplitsWithSegmentCountKey=function(){return this.prefix+`.splits.usingSegments`},t.prototype.buildLastClear=function(){return this.prefix+`.last
1Clear`},t}(ui);function pi(e,t){return{buildSegmentNameKey:function(n){return e+`.`+t+`.largeSegment.`+n},extractSegmentName:function(n){var r=e+`.`+t+`.largeSegment.`;if($e(n,r))return n.slice(r.length)},buildTillKey:function(){return e+`.`+t+`.largeSegments.till`}}}function mi(){var e=`__SPLITSOFTWARE__`;try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}function hi(e){return typeof e==`object`&&!!e&&typeof e.setItem==`function`&&typeof e.getItem==`function`&&typeof e.removeItem==`function`}function gi(e){if(typeof e.length==`number`)try{return e.key(0),!0}catch{return!1}return!1}var J=`storage:localstorage: `,_i=function(e){Be(t,e);function t(t,n,r){var i=e.call(this)||this;return i.keys=n,i.log=t.log,i.flagSetsFilter=t.sync.__splitFiltersValidation.groupedFilters.bySet,i.storage=r,i}return t.prototype._decrementCount=function(e){var t=et(this.storage.getItem(e))-1;t>0?this.storage.setItem(e,t+``):this.storage.removeItem(e)},t.prototype._decrementCounts=function(e){try{var t=this.keys.buildTrafficTypeKey(e.trafficTypeName);if(this._decrementCount(t),W(e)){var n=this.keys.buildSplitsWithSegmentCountKey();this._decrementCount(n)}}catch(e){this.log.error(J+e)}},t.prototype._incrementCounts=function(e){try{var t=this.keys.buildTrafficTypeKey(e.trafficTypeName);if(this.storage.setItem(t,et(this.storage.getItem(t))+1+``),W(e)){var n=this.keys.buildSplitsWithSegmentCountKey();this.storage.setItem(n,et(this.storage.getItem(n))+1+``)}}catch(e){this.log.error(J+e)}},t.prototype.clear=function(){for(var e=this,t=this.storage.length,n=[],r=0;r<t;r++){var i=this.storage.key(r);i!=null&&this.keys.isSplitsCacheKey(i)&&n.push(i)}n.forEach(function(t){e.storage.removeItem(t)}),this.hasSync=!1},t.prototype.addSplit=function(e){var t=e.name,n=this.keys.buildSplitKey(t),r=this.storage.getItem(n),i=r?JSON.parse(r):null;return i&&(this._decrementCounts(i),this.removeFromFlagSets(i.name,i.sets)),this.storage.setItem(n,JSON.stringify(e)),this._incrementCounts(e),this.addToFlagSets(e),!0},t.prototype.removeSplit=function(e){var t=this.getSplit(e);return t?(this.storage.removeItem(this.keys.buildSplitKey(e)),this._decrementCounts(t),this.removeFromFlagSets(t.name,t.sets),!0):!1},t.prototype.getSplit=function(e){var t=this.storage.getItem(this.keys.buildSplitKey(e));return t&&JSON.parse(t)},t.prototype.setChangeNumber=function(e){try{return this.storage.setItem(this.keys.buildSplitsTillKey(),e+``),this.storage.setItem(this.keys.buildLastUpdatedKey(),Date.now()+``),this.hasSync=!0,!0}catch(e){return this.log.error(J+e),!1}},t.prototype.getChangeNumber=function(){var e=-1,t=this.storage.getItem(this.keys.buildSplitsTillKey());return t===null?e:(t=parseInt(t,10),Xe(t)?e:t)},t.prototype.getSplitNames=function(){for(var e=this.storage.length,t=[],n=0;n<e;){var r=this.storage.key(n);r!=null&&this.keys.isSplitKey(r)&&t.push(this.keys.extractKey(r)),n++}return t},t.prototype.trafficTypeExists=function(e){var t=et(this.storage.getItem(this.keys.buildTrafficTypeKey(e)));return Ye(t)&&t>0},t.prototype.usesSegments=function(){if(!this.hasSync)return!0;var e=this.storage.getItem(this.keys.buildSplitsWithSegmentCountKey()),t=e===null?0:et(e);return!Ye(t)||t>0},t.prototype.getNamesByFlagSets=function(e){var t=this;return e.map(function(e){var n=t.keys.buildFlagSetKey(e),r=t.storage.getItem(n);return new Set(r?JSON.parse(r):[])})},t.prototype.addToFlagSets=function(e){var t=this;e.sets&&e.sets.forEach(function(n){if(!(t.flagSetsFilter.length>0&&!t.flagSetsFilter.some(function(e){return e===n}))){var r=t.keys.buildFlagSetKey(n),i=t.storage.getItem(r),a=new Set(i?JSON.parse(i):[]);a.has(e.name)||(a.add(e.name),t.storage.setItem(r,JSON.stringify(Gr(a))))}})},t.prototype.removeFromFlagSets=function(e,t){var n=this;t&&t.forEach(function(t){n.removeNames(t,e)})},t.prototype.removeNames=function(e,t){var n=this.keys.buildFlagSetKey(e),r=this.storage.getItem(n);if(r){var i=new Set(JSON.parse(r));if(i.delete(t),i.size===0){this.storage.removeItem(n);return}this.storage.setItem(n,JSON.stringify(Gr(i)))}},t}(Mn),vi=function(){function e(e,t,n){this.keys=t,this.log=e.log,this.storage=n}return e.prototype.clear=function(){var e=this;
1this.getNames().forEach(function(t){return e.remove(t)}),this.storage.removeItem(this.keys.buildRBSegmentsTillKey())},e.prototype.update=function(e,t,n){var r=this,i=e.map(function(e){return r.add(e)}).some(function(e){return e});return i=t.map(function(e){return r.remove(e.name)}).some(function(e){return e})||i,this.setChangeNumber(n),i},e.prototype.setChangeNumber=function(e){try{this.storage.setItem(this.keys.buildRBSegmentsTillKey(),e+``),this.storage.setItem(this.keys.buildLastUpdatedKey(),Date.now()+``)}catch(e){this.log.error(J+e)}},e.prototype.updateSegmentCount=function(e){var t=this.keys.buildSplitsWithSegmentCountKey(),n=et(this.storage.getItem(t))+e;n>0?this.storage.setItem(t,n+``):this.storage.removeItem(t)},e.prototype.add=function(e){var t=e.name,n=this.keys.buildRBSegmentKey(t),r=this.storage.getItem(n),i=r?JSON.parse(r):null;this.storage.setItem(n,JSON.stringify(e));var a=0;return i&&W(i)&&a--,W(e)&&a++,a!==0&&this.updateSegmentCount(a),!0},e.prototype.remove=function(e){var t=this.get(e);return t?(this.storage.removeItem(this.keys.buildRBSegmentKey(e)),W(t)&&this.updateSegmentCount(-1),!0):!1},e.prototype.getNames=function(){for(var e=this.storage.length,t=[],n=0;n<e;){var r=this.storage.key(n);r!=null&&this.keys.isRBSegmentKey(r)&&t.push(this.keys.extractKey(r)),n++}return t},e.prototype.get=function(e){var t=this.storage.getItem(this.keys.buildRBSegmentKey(e));return t&&JSON.parse(t)},e.prototype.getAll=function(){var e=this;return this.getNames().map(function(t){return e.get(t)})},e.prototype.contains=function(e){var t=Gr(e),n=this.getNames();return t.every(function(e){return n.indexOf(e)!==-1})},e.prototype.getChangeNumber=function(){var e=-1,t=this.storage.getItem(this.keys.buildRBSegmentsTillKey());return t===null?e:(t=parseInt(t,10),Xe(t)?e:t)},e.prototype.usesSegments=function(){var e=this.storage.getItem(this.keys.buildSplitsWithSegmentCountKey()),t=e===null?0:et(e);return!Ye(t)||t>0},e}(),yi=function(){function e(){}return e.prototype.clear=function(){this.resetSegments({})},e.prototype.registerSegments=function(){return!1},e.prototype.update=function(){return!1},e.prototype.resetSegments=function(e){var t=this,n=!1,r=e,i=r.added,a=r.removed;if(i&&a)i.forEach(function(e){n=t.addSegment(e)||n}),a.forEach(function(e){n=t.removeSegment(e)||n});else{var o=(e.k||[]).map(function(e){return e.n}).sort(),s=this.getRegisteredSegments().sort();if(!o.length&&!s.length)n=!1;else{for(var c=0;c<o.length&&c<s.length&&o[c]===s[c];)c++;if(c===o.length&&c===s.length)n=!1;else{for(var l=c;l<s.length;l++)this.removeSegment(s[l]);for(var u=c;u<o.length;u++)this.addSegment(o[u]);n=!0}}}return this.setChangeNumber(e.cn),n},e}(),bi=function(e){Be(t,e);function t(t,n,r){var i=e.call(this)||this;return i.log=t,i.keys=n,i.storage=r,i}return t.prototype.addSegment=function(e){var t=this.keys.buildSegmentNameKey(e);return this.storage.getItem(t)!==`1`&&(this.storage.setItem(t,`1`),!0)},t.prototype.removeSegment=function(e){var t=this.keys.buildSegmentNameKey(e);return this.storage.getItem(t)===`1`&&(this.storage.removeItem(t),!0)},t.prototype.isInSegment=function(e){return this.storage.getItem(this.keys.buildSegmentNameKey(e))===`1`},t.prototype.getRegisteredSegments=function(){for(var e=[],t=0,n=this.storage.length;t<n;t++){var r=this.keys.extractSegmentName(this.storage.key(t));r&&e.push(r)}return e},t.prototype.getKeysCount=function(){return 1},t.prototype.setChangeNumber=function(e){e?this.storage.setItem(this.keys.buildTillKey(),e+``):this.storage.removeItem(this.keys.buildTillKey())},t.prototype.getChangeNumber=function(){var e=-1,t=this.storage.getItem(this.keys.buildTillKey());return t===null?e:(t=parseInt(t,10),Xe(t)?e:t)},t}(yi),xi=function(e){Be(t,e);function t(t){var n=e.call(this)||this;return n.splitsCache={},n.ttCache={},n.changeNumber=-1,n.segmentsCount=0,n.flagSetsCache={},n.flagSetsFilter=t?t.groupedFilters.bySet:[],n}return t.prototype.clear=function(){this.splitsCache={},this.ttCache={},this.changeNumber=-1,this.segmentsCount=0,this.flagSetsCache={}},t.prototype.addSplit=function(e){var t=e.name,n=this.getSplit(t);if(n){var r=n.trafficTypeName;this.ttCache[r]--,this.ttCache[r]||delete this.ttCache[r],this.removeFromFlagSets(n.name,n.set
1s),W(n)&&this.segmentsCount--}this.splitsCache[t]=e;var i=e.trafficTypeName;return this.ttCache[i]=(this.ttCache[i]||0)+1,this.addToFlagSets(e),W(e)&&this.segmentsCount++,!0},t.prototype.removeSplit=function(e){var t=this.getSplit(e);if(!t)return!1;delete this.splitsCache[e];var n=t.trafficTypeName;return this.ttCache[n]--,this.ttCache[n]||delete this.ttCache[n],this.removeFromFlagSets(t.name,t.sets),W(t)&&this.segmentsCount--,!0},t.prototype.getSplit=function(e){return this.splitsCache[e]||null},t.prototype.setChangeNumber=function(e){return this.changeNumber=e,!0},t.prototype.getChangeNumber=function(){return this.changeNumber},t.prototype.getSplitNames=function(){return Object.keys(this.splitsCache)},t.prototype.trafficTypeExists=function(e){return Ye(this.ttCache[e])&&this.ttCache[e]>0},t.prototype.usesSegments=function(){return this.getChangeNumber()===-1||this.segmentsCount>0},t.prototype.getNamesByFlagSets=function(e){var t=this;return e.map(function(e){return t.flagSetsCache[e]||new Set})},t.prototype.addToFlagSets=function(e){var t=this;e.sets&&e.sets.forEach(function(n){t.flagSetsFilter.length>0&&!t.flagSetsFilter.some(function(e){return e===n})||(t.flagSetsCache[n]||(t.flagSetsCache[n]=new Set([])),t.flagSetsCache[n].add(e.name))})},t.prototype.removeFromFlagSets=function(e,t){var n=this;t&&t.forEach(function(t){n.removeNames(t,e)})},t.prototype.removeNames=function(e,t){this.flagSetsCache[e]&&(this.flagSetsCache[e].delete(t),this.flagSetsCache[e].size===0&&delete this.flagSetsCache[e])},t}(Mn),Si=function(e){Be(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.segmentCache={},t}return t.prototype.addSegment=function(e){return!this.segmentCache[e]&&(this.segmentCache[e]=!0,!0)},t.prototype.removeSegment=function(e){return this.segmentCache[e]?(delete this.segmentCache[e],!0):!1},t.prototype.isInSegment=function(e){return this.segmentCache[e]===!0},t.prototype.setChangeNumber=function(e){this.cn=e},t.prototype.getChangeNumber=function(){return this.cn||-1},t.prototype.getRegisteredSegments=function(){return Object.keys(this.segmentCache)},t.prototype.getKeysCount=function(){return 1},t}(yi),Ci=0,wi=22,Ti=1.5;function Ei(e){var t=Math.min(wi,Math.max(Ci,Math.ceil(Math.log(e)/Math.log(Ti))));return Xe(t)?0:t}var Di=20,Oi=10;function ki(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}var Ai=.001;function ji(e){var t=e.settings;return t.mode!==`localhost`&&(tn(t)||Math.random()<=Ai)}var Mi=function(){function e(e,t,n){this.splits=e,this.segments=t,this.largeSegments=n,this.name=`telemetry stats`,this.e=!0,this.notReadyUsage=0,this.impressionStats=[0,0,0],this.eventStats=[0,0],this.lastSync={},this.httpErrors={},this.httpLatencies={},this.authRejections=0,this.tokenRefreshes=0,this.streamingEvents=[],this.tags=[],this.exceptions={},this.latencies={},this.updatesFromSSE={}}return e.prototype.isEmpty=function(){return this.e},e.prototype.clear=function(){},e.prototype.pop=function(){return this.e=!0,{lS:this.getLastSynchronization(),mL:this.popLatencies(),mE:this.popExceptions(),hE:this.popHttpErrors(),hL:this.popHttpLatencies(),tR:this.popTokenRefreshes(),aR:this.popAuthRejections(),iQ:this.getImpressionStats(0),iDe:this.getImpressionStats(2),iDr:this.getImpressionStats(1),spC:this.splits&&this.splits.getSplitNames().length,seC:this.segments&&this.segments.getRegisteredSegments().length,skC:this.segments&&this.segments.getKeysCount(),lsC:this.largeSegments&&this.largeSegments.getRegisteredSegments().length,lskC:this.largeSegments&&this.largeSegments.getKeysCount(),sL:this.getSessionLength(),eQ:this.getEventStats(0),eD:this.getEventStats(1),sE:this.popStreamingEvents(),t:this.popTags(),ufs:this.popUpdatesFromSSE()}},e.prototype.getTimeUntilReady=function(){return this.timeUntilReady},e.prototype.recordTimeUntilReady=function(e){this.timeUntilReady=e},e.prototype.getTimeUntilReadyFromCache=function(){return this.timeUntilReadyFromCache},e.prototype.recordTimeUntilReadyFromCache=function(e){this.timeUntilReadyFromCache=e},e.prototype.getNonReadyUsage=function(){return this.notReadyUsage},e.prototype.recordNonReadyUsage=function(){this.notReadyUsage++},e.prototype.getImpressionStats=function(e){return this.impressionStats[e]},e.prototype.recordImpressionStats=function(e,t){this.impressionStats[e]+=t,this.e=!1},e.prototype.getEventStats=function(e){return this.eventStats[e]},e.prototype.recordEventStats=function(e,t){this.eventStats[e]+=t,this.e=!1},e.prototype.getLastSynchronization=function(){return this.lastSync},e.prototype.recordSuccessfulSync=function(e,t){this.lastSync[e]=t,this.e=!1},e.prototype.popHttpErrors=function(){var e=this.httpErrors;return this.httpErrors={},e},e.prototype.recordHttpError=function(e,t){var n=this.httpErrors[e]=this.httpErrors[e]||{};n[t]=(n[t]||0)+1,this.e=!1},e.prototype.popHttpLatencies=function(){var e=this.httpLatencies;return this.httpLatencies={},e},e.prototype.recordHttpLatency=function(e,t){var n=this.httpLatencies[e]=this.httpLatencies[e]||ki();n[Ei(t)]++,this.e=!1},e.prototype.popAuthRejections=function(){var e=this.authRejections;return this.authRejections=0,e},e.prototype.recordAuthRejections=function(){this.authRejections++,this.e=!1},e.prototype.popTokenRefreshes=function(){var e=this.tokenRefreshes;return this.tokenRefreshes=0,e},e.prototype.recordTokenRefreshes=function(){this.tokenRefreshes++,this.e=!1},e.prototype.popStreamingEvents=function(){return this.streamingEvents.splice(0)},e.prototype.recordStreamingEvents=function(e){this.streamingEvents.length<Di&&this.streamingEvents.push(e),this.e=!1},e.prototype.popTags=function(){return this.tags.splice(0)},e.prototype.addTag=function(e){this.tags.length<Oi&&this.tags.push(e),this.e=!1},e.prototype.getSessionLength=function(){return this.sessionLength},e.prototype.recordSessionLength=function(e){this.sessionLength=e,this.e=!1},e.prototype.popExceptions=function(){var e=this.exceptions;return this.exceptions={},e},e.prototype.recordException=function(e){this.exceptions[e]=(this.exceptions[e]||0)+1,this.e=!1},e.prototype.popLatencies=function(){var e=this.latencies;return this.latencies={},e},e.prototype.recordLatency=function(e,t){var n=this.latencies[e]=this.latencies[e]||ki();n[Ei(t)]++,this.e=!1},e.prototype.popUpdatesFromSSE=function(){var e=this.updatesFromSSE;return this.updatesFromSSE={},e},e.prototype.recordUpdatesFromSSE=function(e){this.updatesFromSSE[e]=(this.updatesFromSSE[e]||0)+1,this.e=!1},e}(),Ni=function(){function e(e){e===void 0&&(e=ri),this.name=`unique keys`,this.uniqueTrackerSize=0,this.uniqueKeysTracker={},this.maxStorage=e}return e.prototype.setOnFullQueueCb=function(e){this.onFullQueue=e},e.prototype.track=function(e,t){this.uniqueKeysTracker[e]||(this.uniqueKeysTracker[e]=new Set);var n=this.uniqueKeysTracker[e];n.has(t)||(n.add(t),this.uniqueTrackerSize++),this.uniqueTrackerSize>=this.maxStorage&&this.onFullQueue&&this.onFullQueue()},e.prototype.clear=function(){this.uniqueTrackerSize=0,this.uniqueKeysTracker={}},e.prototype.pop=function(){var e=this.uniqueKeysTracker;return this.clear(),this.fromUniqueKeysCollector(e)},e.prototype.isEmpty=function(){return Object.keys(this.uniqueKeysTracker).length===0},e.prototype.fromUniqueKeysCollector=function(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a={k:i,fs:Gr(e[i])};t.push(a)}return{keys:t}},e}(),Pi=function(){function e(){this.cache={},this.changeNumber=-1,this.segmentsCount=0}return e.prototype.clear=function(){this.cache={},this.changeNumber=-1,this.segmentsCount=0},e.prototype.update=function(e,t,n){var r=this,i=e.map(function(e){return r.add(e)}).some(function(e){return e});return i=t.map(function(e){return r.remove(e.name)}
1).some(function(e){return e})||i,this.changeNumber=n,i},e.prototype.add=function(e){var t=e.name,n=this.get(t);return n&&W(n)&&this.segmentsCount--,this.cache[t]=e,W(e)&&this.segmentsCount++,!0},e.prototype.remove=function(e){var t=this.get(e);return t?(delete this.cache[e],W(t)&&this.segmentsCount--,!0):!1},e.prototype.getNames=function(){return Object.keys(this.cache)},e.prototype.get=function(e){return this.cache[e]||null},e.prototype.getAll=function(){var e=this;return this.getNames().map(function(t){return e.get(t)})},e.prototype.contains=function(e){var t=Gr(e),n=this.getNames();return t.every(function(e){return n.indexOf(e)!==-1})},e.prototype.getChangeNumber=function(){return this.changeNumber},e.prototype.usesSegments=function(){return this.segmentsCount>0},e}();function Fi(e){var t=e.settings,n=t.scheduler,r=n.impressionsQueueSize,i=n.eventsQueueSize,a=t.sync.__splitFiltersValidation,o=new xi(a),s=new Pi,c=new Si,l={splits:o,rbSegments:s,segments:c,largeSegments:new Si,impressions:new ei(r),impressionCounts:new ii,events:new oi(i),telemetry:ji(e)?new Mi(o,c):void 0,uniqueKeys:new Ni,destroy:function(){},shared:function(){return{splits:this.splits,rbSegments:this.rbSegments,segments:new Si,largeSegments:new Si,impressions:this.impressions,impressionCounts:this.impressionCounts,events:this.events,telemetry:this.telemetry,uniqueKeys:this.uniqueKeys,destroy:function(){}}}};if(e.settings.mode===`localhost`){var u=function(){return!0};l.impressions.track=u,l.events.track=u,l.impressionCounts.track=u,l.uniqueKeys.track=u}return l}Fi.type=he;var Ii=10,Li=864e5;function Ri(e,t,n,r,i,a){var o=n.log,s=n.initialRolloutPlan,c=parseInt(t.getItem(r.buildLastUpdatedKey()),10);if(!Xe(c)){var l=Ye(e.expirationDays)&&e.expirationDays>=1?e.expirationDays:Ii;if(c<i-Li*l)return o.info(J+`Cache expired more than `+l+` days ago. Cleaning up cache`),!0}var u=r.buildHashKey(),d=t.getItem(u),f=di(n);if(d!==f){try{t.setItem(u,f)}catch(e){o.error(J+e)}return a&&!s?(o.info(J+`SDK key, flags filter criteria, or flags spec version has changed. Cleaning up cache`),!0):!1}if(e.clearOnInit){var p=parseInt(t.getItem(r.buildLastClear()),10);if(Xe(p)||p<i-Li)return o.info(J+`clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache`),!0}}function zi(e,t,n,r,i,a,o,s){return Promise.resolve(t.load&&t.load()).then(function(){var c=Date.now(),l=i.getChangeNumber()>-1,u=t.getItem(r.buildLastUpdatedKey()),d=u?parseInt(u,10):void 0,f=!Xe(d)&&d!==void 0?d:void 0;if(Ri(e,t,n,r,c,l)){i.clear(),a.clear(),o.clear(),s.clear();try{t.setItem(r.buildLastClear(),c+``)}catch(e){n.log.error(J+e)}return t.save&&t.save(),{initialCacheLoad:!0,lastUpdateTimestamp:void 0}}return{initialCacheLoad:!l,lastUpdateTimestamp:f}})}function Bi(e,t,n){var r=[],i={},a,o=Promise.resolve();return{load:function(){return a||=Promise.resolve().then(function(){return n.getItem(t)}).then(function(e){i=JSON.parse(e||`{}`),r=Object.keys(i)}).catch(function(t){e.error("storage:localstorage: Error calling wrapper `getItem` method: "+t)})},save:function(){return o=o.then(function(){return Promise.resolve(n.setItem(t,JSON.stringify(i)))}).catch(function(t){e.error(J+"Error calling wrapper `setItem` method: "+t)})},whenSaved:function(){return o},get length(){return r.length},getItem:function(e){return i[e]||null},key:function(e){return r[e]||null},removeItem:function(e){var t=r.indexOf(e);t!==-1&&(r.splice(t,1),delete i[e])},setItem:function(e,t){r.indexOf(e)===-1&&r.push(e),i[e]=t}}}function Vi(e,t,n){if(n){if(hi(n))return gi(n)?n:Bi(e,t,n);e.warn(J+`Invalid storage provided. Falling back to LocalStorage API`)}if(mi())return localStorage;e.warn(J+`LocalStorage API is unavailable. Falling back to default MEMORY storage`)}function Hi(e){e===void 0&&(e={});var t=li(e.prefix);function n(n){var r=n.settings,i=n.settings,a=i.log,o=i.scheduler,s=o.impressionsQueueSize,c=o.eventsQueueSize,l=Vi(a,t,e.wrapper);if(!l)return Fi(n);var u=Qt(r.core.key),d=new fi(t,u),f=new _i(r,d,l),p=new vi(r,d,l),m=new bi(a,d,l),h=new bi(a,pi(t,u),l),g;return{splits:f,rbSegments:p,segments:m,largeSegments:h,impressions:new ei(s),impressionCounts:new ii,events:new oi(c),telemetry:ji(n)?new Mi(f,m):void 0,uniqueKeys:new Ni,validateCache:function(){return g||=zi(e,l,r,d,f,p,m,h),g},save:function(){return l.save&&l.save()},destroy:function(){return l.whenSaved&&l.whenSaved()},shared:function(e){return{splits:this.splits,rbSegments:this.rbSegments,segments:new bi(a,new fi(t,e),l),largeSegments:new bi(a,pi(t,e),l),impressions:this.impressions,impressionCounts:this.impressionCounts,events:this.events,telemetry:this.telemetry,uniqueKeys:this.uniqueKeys,destroy:function(){}}}}}return n.type=ge,n}function Y(e){return e!=null&&typeof e.then==`function`}function Ui(e,t,n,r){if(!V(t)||t.length===0)return e.warn(r+`: you passed an invali
1d attribute name, attribute name must be a non-empty string.`),!1;var i=V(n),a=Ye(n),o=Je(n);return i||a||o||Array.isArray(n)?!0:(e.warn(r+`: you passed an invalid attribute value for `+t+`. Acceptable types are: string, number, boolean and array of strings.`),!1)}function Wi(e,t,n){return t==null||B(t)?t:(e.error(311,[n,`attributes`]),!1)}function Gi(e,t,n){if(!Wi(e,t,n))return!1;var r=!0;return Object.keys(t).forEach(function(i){Ui(e,i,t[i],n)||(r=!1)}),r}var Ki=/^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/,qi=`event_type`;function Ji(e,t,n){if(t==null)e.error(315,[n,qi]);else if(!V(t))e.error(318,[n,qi]);else if(t.length===0)e.error(319,[n,qi]);else if(!Ki.test(t))e.error(310,[n,t]);else return t;return!1}function Yi(e,t,n){return Ye(t)||t==null?t:(e.error(313,[n]),!1)}var Xi={NULL:0,STRING:2,BOOLEAN:4,NUMBER:8},Zi=300,Qi=32768,$i=1024;function ea(e,t,n){if(t==null)return{properties:null,size:$i};if(!B(t))return e.error(311,[n,`properties`]),{properties:!1,size:$i};var r=Object.keys(t),i=v({},t),a={properties:i,size:$i};r.length>Zi&&e.warn(212,[n]);for(var o=0;o<r.length;o++){a.size+=r[o].length*Xi.STRING;var s=i[r[o]],c=V(s),l=Ye(s),u=Je(s),d=s===null;if(c||l||u||d||(i[r[o]]=null,s=null,d=!0,e.warn(211,[n,r[o]])),d?a.size+=Xi.NULL:l?a.size+=Xi.NUMBER:u?a.size+=Xi.BOOLEAN:c&&(a.size+=s.length*Xi.STRING),a.size>Qi){e.error(312,[n]),a.properties=!1;break}}return a}function ta(e,t,n){if(B(t)){var r=ea(e,t.properties,n).properties,i=r&&Object.keys(r).length>0?{properties:r}:void 0,a=t.impressionsDisabled;return a?i?Ve(Ve({},i),{impressionsDisabled:a}):{impressionsDisabled:a}:i}t&&e.error(311,[n,`evaluation options`])}var na=/[A-Z]/,ra=`traffic_type`;function ia(e,t,n){if(t==null)e.error(315,[n,ra]);else if(!V(t))e.error(318,[n,ra]);else if(t.length===0)e.error(319,[n,ra]);else return na.test(t)&&(e.warn(216,[n]),t=t.toLowerCase()),t;return!1}function aa(e,t,n){return!t.isDestroyed()||(e.error(314,[n]),!1)}function oa(e,t,n,r){return t.isReadyFromCache()?!0:(e.warn(203,[n,r?` for feature flag `+r.toString():``]),!1)}function sa(e,t,n,r){return aa(e,t,n)&&oa(e,t,n,r)}var ca=`fallback - `,la=function(){function e(e){e===void 0&&(e={}),this.fallbacks=e}return e.prototype.resolve=function(e,t){var n=this.fallbacks.byFlag?.[e];return n?this.copyWithLabel(n,t):this.fallbacks.global?this.copyWithLabel(this.fallbacks.global,t):{treatment:I,config:null,label:t}},e.prototype.copyWithLabel=function(e,t){return V(e)?{treatment:e,config:null,label:``+ca+t}:{treatment:e.treatment,config:e.config,label:``+ca+t}},e}(),ua=`killed`,da=`default rule`,fa=`definition not found`,pa=`not ready`,ma=`exception`,ha=`archived`,ga=`not in split`,_a=`targeting rule type unsupported by sdk`,va=`prerequisites not met`,ya=ca+fa;function ba(e,t,n,r,i){return t.isReady()&&(r===`definition not found`||r===ya||r==null)?(e.warn(215,[i,n]),!1):!0}function xa(e,t,n){e.warn(217,[n,t])}function Sa(e,t,n,r,i,a){if(!t.isReady()||r===`localhost`)return!0;var o=n.trafficTypeExists(i);return Y(o)?o.then(function(t){return t||xa(e,i,a),t}):(o||xa(e,i,a),o)}function Ca(e){var t=e.conditions,n=We(t,function(e){return e.conditionType===`ROLLOUT`});return n||=t[0],n?n.partitions.map(function(e){return e.treatment}):[]}function wa(e){return e?{name:e.name,trafficType:e.trafficTypeName,killed:e.killed,changeNumber:e.changeNumber||0,treatments:Ca(e),configs:e.configurations||{},sets:e.sets||[],defaultTreatment:e.defaultTreatment,impressionsDisabled:e.impressionsDisabled===!0,prerequisites:(e.prerequisites||[]).map(function(e){return{flagName:e.n,treatments:e.ts}})}:null}function Ta(e){var t=[];return e.forEach(function(e){var n=wa(e);n&&t.push(n)}),t}function Ea(e,t,n){var r=n.readinessManager,i=n.sdkStatus,a=e.log,o=e.mode,s=vt(o);return v(Object.create(i),{split:function(e){var n=bt(a,e,Oe);if(!sa(a,r,`split`)||!n)return s?Promise.resolve(null):null;var i=t.getSplit(n);return Y(i)?i.catch(function(){return null}).then(function(e){return ba(a,r,n,e,Oe),wa(e)}):(ba(a,r,n,i,Oe),wa(i))},splits:function(){if(!sa(a,r,`splits`))return s?Promise.resolve([]):[];var e=t.getAll();return Y(e)?e.catch(function(){return[]}).then(Ta):Ta(e)},names:function(){if(!sa(a,r,`names`))return s?Promise.resolve([]):[];var e=t.getSplitNames();return Y(e)?e.catch(function(){return[]}):e}})}var Da=function(){function e(){this.attributesCache={}}return e.prototype.setAttribute=function(e,t){return this.attributesCache[e]=t,!0},e.prototype.getAttribute=function(e){return this.attributesCache[e]},e.prototype.setAttributes=function(e){return this.attributesCache=v(this.attributesCache,e),!0},e.prototype.getAll=function(){return this.attributesCache},e.prototype.removeAttribute=function(e){return Object.keys(this.attributesCache).indexOf(e)>=0&&(delete this.attributesCache[e],!0)},e.prototype.clear=function(){return this.attributesCache={},!0},e}();function Oa(e,t){var n=new Da,r=t.getTreatment,i=t.getTreatmentWithConfig,a=t.getTreatments,o=t.getTreatmentsWithConfig,s=t.getTreatmentsByFlagSets,c=t.getTreatmentsWithConfigByFlagSets,l=t.getTreatmentsByFlagSet,u=t.getTreatmentsWithConfigByFlagSet;function d(e,t,n,i){return r(e,t,b(n),i)}function f(e,t,n,r){return i(e,t,b(n),r)}function p(e,t,n,r){return a(e,t,b(n),r)}function m(e,t,n,r){return o(e,t,b(n),r)}function h(e,t,n,r){return s(e,t,b(n),r)}function g(e,t,n,r){return c(e,t,b(n),r)}function _(e,t,n,r){return l(e,t,b(n),r)}function y(e,t,n,r){return u(e,t,b(n),r)}function b(e){var t=n.getAll();return Object.keys(t).length>0?v({},t,e):e}return v(t,{getTreatment:d,getTreatmentWithConfig:f,getTreatments:p,getTreatmentsWithConfig:m,getTreatmentsByFlagSets:h,getTreatmentsWithConfigByFlagSets:g,getTreatmentsByFlagSet:_,getTreatmentsWithConfigByFlagSet:y,setAttribute:function(t,r){var i={};return i[t]=r,Gi(e,i,`setAttribute`)?(e.debug(`stored `+r+` for attribute `+t),n.setAttribute(t,r)):!1},getAttribute:function(t){return e.debug(`retrieved attribute `+t),n.getAttribute(t+``)}
1,setAttributes:function(t){return Gi(e,t,`setAttributes`)?n.setAttributes(t):!1},getAttributes:function(){return n.getAll()},removeAttribute:function(t){return e.debug(`removed attribute `+t),n.removeAttribute(t+``)},clearAttributes:function(){return n.clear()}})}function ka(e,t,n){var r=Oa(e,t);return v(r,{getTreatment:r.getTreatment.bind(r,n),getTreatmentWithConfig:r.getTreatmentWithConfig.bind(r,n),getTreatments:r.getTreatments.bind(r,n),getTreatmentsWithConfig:r.getTreatmentsWithConfig.bind(r,n),getTreatmentsByFlagSets:r.getTreatmentsByFlagSets.bind(r,n),getTreatmentsWithConfigByFlagSets:r.getTreatmentsWithConfigByFlagSets.bind(r,n),getTreatmentsByFlagSet:r.getTreatmentsByFlagSet.bind(r,n),getTreatmentsWithConfigByFlagSet:r.getTreatmentsWithConfigByFlagSet.bind(r,n),track:r.track.bind(r,n),isClientSide:!0,key:n})}var X={UNDEFINED:0,ALL_KEYS:1,IN_SEGMENT:2,WHITELIST:3,EQUAL_TO:4,GREATER_THAN_OR_EQUAL_TO:5,LESS_THAN_OR_EQUAL_TO:6,BETWEEN:7,EQUAL_TO_SET:8,CONTAINS_ANY_OF_SET:9,CONTAINS_ALL_OF_SET:10,PART_OF_SET:11,ENDS_WITH:12,STARTS_WITH:13,CONTAINS_STRING:14,IN_SPLIT_TREATMENT:15,EQUAL_TO_BOOLEAN:16,MATCHES_STRING:17,EQUAL_TO_SEMVER:18,GREATER_THAN_OR_EQUAL_TO_SEMVER:19,LESS_THAN_OR_EQUAL_TO_SEMVER:20,BETWEEN_SEMVER:21,IN_LIST_SEMVER:22,IN_LARGE_SEGMENT:23,IN_RULE_BASED_SEGMENT:24},Z={BOOLEAN:`BOOLEAN`,STRING:`STRING`,NUMBER:`NUMBER`,SET:`SET`,DATETIME:`DATETIME`,NOT_SPECIFIED:`NOT_SPECIFIED`};function Aa(e){return X[e]||X.UNDEFINED}function ja(e){return e?e.segmentName||e.largeSegmentName:void 0}function Ma(e){return e&&e.whitelist}function Na(e){return e.value}function Pa(e){return new Date(e).setUTCHours(0,0,0,0)}function Fa(e){return new Date(e).setUTCSeconds(0,0)}function Ia(e){return{dataType:e.dataType,start:Fa(e.start),end:Fa(e.end)}}function La(e){var t=e.map(function(e){var t=e.matcherType,n=e.negate,r=e.keySelector,i=e.userDefinedSegmentMatcherData,a=e.userDefinedLargeSegmentMatcherData,o=e.whitelistMatcherData,s=e.unaryNumericMatcherData,c=e.betweenMatcherData,l=e.dependencyMatcherData,u=e.booleanMatcherData,d=e.stringMatcherData,f=e.betweenStringMatcherData,p=r&&r.attribute,m=Aa(t),h=Z.STRING,g;return m===X.IN_SEGMENT?g=ja(i):m===X.IN_LARGE_SEGMENT?g=ja(a):m===X.EQUAL_TO?(g=Na(s),h=Z.NUMBER,s.dataType===`DATETIME`&&(g=Pa(g),h=Z.DATETIME)):m===X.GREATER_THAN_OR_EQUAL_TO||m===X.LESS_THAN_OR_EQUAL_TO?(g=Na(s),h=Z.NUMBER,s.dataType===`DATETIME`&&(g=Fa(g),h=Z.DATETIME)):m===X.BETWEEN?(g=c,h=Z.NUMBER,g.dataType===`DATETIME`&&(g=Ia(g),h=Z.DATETIME)):m===X.BETWEEN_SEMVER?g=f:m===X.EQUAL_TO_SET||m===X.CONTAINS_ANY_OF_SET||m===X.CONTAINS_ALL_OF_SET||m===X.PART_OF_SET?(g=Ma(o),h=Z.SET):m===X.WHITELIST||m===X.IN_LIST_SEMVER||m===X.STARTS_WITH||m===X.ENDS_WITH||m===X.CONTAINS_STRING?g=Ma(o):m===X.IN_SPLIT_TREATMENT?(g=l,h=Z.NOT_SPECIFIED):m===X.EQUAL_TO_BOOLEAN?(h=Z.BOOLEAN,g=u):m===X.MATCHES_STRING||m===X.EQUAL_TO_SEMVER||m===X.GREATER_THAN_OR_EQUAL_TO_SEMVER||m===X.LESS_THAN_OR_EQUAL_TO_SEMVER?g=d:m===X.IN_RULE_BASED_SEGMENT&&(g=ja(i),h=Z.NOT_SPECIFIED),{attribute:p,negate:n,type:m,name:t,value:g,dataType:h}});return Ge(t,function(e){return e.type===X.UNDEFINED})===-1?t:[]}var Ra=function(){function e(e,t){if(e[e.length-1]!==100)throw RangeError(`Provided invalid dataset as input`);this._ranges=e,this._treatments=t}return e.parse=function(t){var n=t.reduce(function(e,t){var n=t.size,r=t.treatment;return e.ranges.push(e.inc+=n),e.treatments.push(r),e},{inc:0,ranges:[],treatments:[]}),r=n.ranges,i=n.treatments;return new e(r,i)},e.prototype.getTreatmentFor=function(e){if(e<0||e>100)throw RangeError(`Please provide a value between 0 and 100`);var t=Ge(this._ranges,function(t){return e<=t});return this._treatments[t]},e}();function za(){return function(e){return e!=null}}function Ba(e,t){return function(n){return t.segments.isInSegment(e,n)}}function Va(e,t){return function(n){return t.largeSegments?t.largeSegments.isInSegment(e,n):!1}}function Ha(e){var t=new Set(e);return function(e){return t.has(e)}}function Ua(e){return function(t){return t===e}}function Wa(e){return function(t){return t>=e}}function Ga(e){return function(t){return t<=e}}function Ka(e){return function(t){return t>=e.start&&t<=e.end}}function qa(e){return function(t){for(var n=t.length===e.length,r=function(r){Ge(e,function(e){return e===t[r]})<0&&(n=!1)},i=0;i<t.length&&n;i++)r(i);return n}}function Ja(e){return function(t){for(var n=!1,r=function(r){Ge(t,function(t){return t===e[r]})>=0&&(n=!0)},i=0;i<e.length&&!n;i++)r(i);return n}}function Ya(e){return function(t){var n=!0;if(t.length<e.length)n=!1;else for(var r=function(r){Ge(t,function(t){return t===e[r]})<0&&(n=!1)},i=0;i<e.length&&n;i++)r(i);return n}}function Xa(e){return function(t){for(var n=t.length<=e.length,r=function(r){Ge(e,function(e){return e===t[r]})<0&&(n=!1)},i=0;i<t.length&&n;i++)r(i);return n}}function Za(e){return function(t){return e.some(function(e){return Ue(t,e)})}}function Qa(e){return function(t){return e.some(function(e){return $e(t,e)})}}function $a(e){return function(t){return e.some(function(e){return V(t)&&t.indexOf(e)>-1})}}function eo(e,t,n){var r=e.split,i=e.treatments;function a(e,t,r){var i=!1;return Array.isArray(t)&&(i=t.indexOf(e.treatment)!==-1),n.debug(10,[r,e.treatment,e.label,r,t,i]),i}return function(e,o){var s=e.key,c=e.attributes;n.debug(11,[r,JSON.stringify(s),c?` 2 attributes: `+JSON.stringify(c):``]);var l=o(n,s,r,c,t);return Y(l)?l.then(function(e){return a(e,i,r)}):a(l,i,r)}}function to(e){return function(t){return e===t}}function no(e){var t=new RegExp(e);return function(e){return t.test(e)}}var ro=/^[0-9]+$/,io=`+`,ao=`-`,oo=`.`;function so(e,t){if(ro.test(e)&&ro.test(t)){var n=e.length-t.length;if(n!==0)return n}return e<t?-1:+(e>t)}function co(e){return e.replace(/^0+(?=\d)/,``)}function lo(e){throw Error(`Unable to convert to Semver, incorrect format: `+e)}var Q=function(){function e(e){V(e)||lo(e);var t=e.indexOf(io),n=t===-1?[e]:[e.slice(0,t),e.slice(t+1)],r=n[0],i=n[1];i===``&&lo(e),t=r.indexOf(ao),t===-1?(this._isStable=!0,this._preRelease=[]):(this._isStable=!1,this._preRelease=r.slice(t+1).split(oo).map(function(t){return t||lo(e),ro.test(t)?co(t):t}),r=r.slice(0,t));var a=r.split(oo).map(function(t){return(!t||!ro.test(t))&&lo(e),co(t)});a.length!==3&&lo(e),this._major=a[0],this._minor=a[1],this._patch=a[2],this.version=a.join(oo),this._preRelease.length&&(this.version+=ao+this._preRelease.j
2oin(oo)),i&&(this.version+=io+i)}return e.prototype.compare=function(e){if(this.version===e.version)return 0;var t=so(this._major,e._major);if(t!==0||(t=so(this._minor,e._minor),t!==0)||(t=so(this._patch,e._patch),t!==0))return t;if(!this._isStable&&e._isStable)return-1;if(this._isStable&&!e._isStable)return 1;for(var n=0,r=Math.min(this._preRelease.length,e._preRelease.length);n<r;n++){var i=so(this._preRelease[n],e._preRelease[n]);if(i!==0)return i}return this._preRelease.length-e._preRelease.length},e}();function uo(e){var t=new Q(e);return function(e){var n=new Q(e);return t.version===n.version}}function fo(e){var t=new Q(e);return function(e){return new Q(e).compare(t)>=0}}function po(e){var t=new Q(e);return function(e){return new Q(e).compare(t)<=0}}function mo(e){var t=new Q(e.start),n=new Q(e.end);return function(e){var r=new Q(e);return t.compare(r)<=0&&n.compare(r)>=0}}function ho(e){if(!e||e.length===0)throw Error(`whitelistMatcherData is required for IN_LIST_SEMVER matcher type`);var t=new Set(e.map(function(e){return new Q(e).version}));return function(e){var n=new Q(e).version;return t.has(n)}}function go(e,t,n){return function(r,i){var a=r.key,o=r.attributes,s=Qt(a);function c(e){var r=e.conditions||[];if(!r.length)return!1;var s=Po(n,r,t)(en(a),void 0,void 0,void 0,o,i);return Y(s)?s.then(function(e){return!!e}):!!s}function l(e){var r=e.type,c=e.name;return r===`standard`?t.segments.isInSegment(c,s):r===`rule-based`?go(c,t,n)({key:a,attributes:o},i):r===`large`&&t.largeSegments?t.largeSegments.isInSegment(c,s):!1}function u(e){var t=e.excluded||{};return t.keys&&t.keys.indexOf(s)!==-1?!0:(t.segments||[]).reduce(function(e,t){return Y(e)?e.then(function(e){return e||l(t)}):e||l(t)},!1)}function d(e){if(!e)return!1;var t=u(e);return Y(t)?t.then(function(t){return!t&&c(e)}):!t&&c(e)}var f=t.rbSegments.get(e);return Y(f)?f.then(d):d(f)}}var _o=[void 0,za,Ba,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,uo,fo,po,mo,ho,Va,go];function vo(e,t,n){var r=t.type,i=t.value,a;return _o[r]&&(a=_o[r](i,n,e)),a}function yo(e){var t=et(e);return isNaN(t)?void 0:t}function bo(e){var t=e;return B(e)&&(t=e.matchingKey?e.matchingKey:void 0),tt(t)||void 0}function xo(e){var t=Array.isArray(e)?nt(e.map(function(e){return e+``})):[];return t.length?t:void 0}function So(e){if(e===!0||e===!1)return e;if(typeof e==`string`){var t=e.toLocaleLowerCase();if(t===`true`)return!0;if(t===`false`)return!1}}function Co(e,t){return{key:e,attributes:t}}function wo(e,t){switch(e){case X.EQUAL_TO:return t===`DATETIME`?Pa:void 0;case X.GREATER_THAN_OR_EQUAL_TO:case X.LESS_THAN_OR_EQUAL_TO:case X.BETWEEN:return t===`DATETIME`?Fa:void 0;case X.IN_SPLIT_TREATMENT:case X.IN_RULE_BASED_SEGMENT:return Co;default:return}}function To(e,t,n,r,i){var a=wo(t,r),o;switch(r){case Z.NUMBER:case Z.DATETIME:o=yo(n);break;case Z.STRING:o=bo(n);break;case Z.SET:o=xo(n);break;case Z.BOOLEAN:o=So(n);break;case Z.NOT_SPECIFIED:o=n;break;default:o=void 0}return a&&(o=a(o,i)),e.debug(24,[n,r,o instanceof Object?JSON.stringify(o):o]),o}function Eo(e,t,n,r){var i=void 0;return n?r?(i=r[n],e.debug(23,[n,i])):e.warn(201,[n]):i=t,i}function Do(e,t,n,r){var i=n.attribute,a=Eo(e,t,i,r),o=To(e,n.type,a,n.dataType,r);if(o!==void 0)return o;e.warn(200,[a+(i?` for attribute `+i:``)])}function Oo(e,t,n,r){var i=cr(t,n),a=r.getTreatmentFor(i);return e.debug(3,[i,t,n,a]),a}function ko(e,t,n){return!(e<100&&cr(t,n)>e)}function Ao(e,t,n,r,i,a){if(t)return!i||{treatment:Oo(e,n,r,i),label:a}}function jo(e,t,n,r,i){return function(a,o,s,c,l,u){if(i===`ROLLOUT`&&!ko(s,a.bucketingKey,c))return{treatment:void 0,label:ga};var d=t(a,l,u);return Y(d)?d.then(function(t){return Ao(e,t,a.bucketingKey,o,n,r)}):Ao(e,d,a.bucketingKey,o,n,r)}}function Mo(e,t){function n(){return e.error(300),{treatment:I,label:_a}}function r(t){for(var n=0,r=t.length;n<r;n++){var i=t[n];if(i!==void 0)return Je(i)||e.debug(1,[i.treatment]),i}e.debug(2)}function i(e,n,i,a,o,s){var c=t.map(function(t){return t(e,n,i,a,o,s)});return Ge(c,Y)===-1?r(c):Promise.all(c).then(function(e){return r(e)})}return!Array.isArray(t)||t.length===0?n:i}function No(e,t){function n(t){var n=t.every(function(e){return e});return e.debug(0,[n]),n}return function(e,r,i){var a=t.map(function(t){return t(e,r,i)});return Ge(a,Y)===-1?n(a):Promise.all(a).then(n)}}function Po(e,t,n){for(var r=[],i=0;i<t.length;i++){var a=t[i],o=a.matcherGroup,s=a.partitions,c=a.label,l=a.conditionType,u=La(o.matchers).map(function(t){var r;try{r=vo(e,t,n)}catch(n){e.error(329,[t.name,n])}return function(n,i,a){var o=Do(e,n,t,i),s=!1;if(o!==void 0&&r)try{s=r(o,a)}catch(n){e.error(329,[t.name,n])}function c(n){return e.debug(40,[t.name,n,t.value,o]),!!(n^t.negate)}return Y(s)?s.then(c):c(s)}});if(u.length===0){r=[];break}r.push(jo(e,No(e,u),s&&Ra.parse(s),c,l))}return Mo(e,r)}
2function Fo(e,t,n){return function(r,i){var a=r.key,o=r.attributes;e??=[];function s(e){var r=i(n,a,e.n,o,t);return Y(r)?r.then(function(t){return e.ts.indexOf(t.treatment)!==-1}):e.ts.indexOf(r.treatment)!==-1}return e.reduce(function(e,t){return Y(e)?e.then(function(e){return e?s(t):!1}):e?s(t):!1},!0)}}function Io(e,t){return{treatment:Ke(e,`treatment`,t),label:Ke(e,`label`,da)}}function Lo(e,t,n){var r=t.killed,i=t.seed,a=t.trafficAllocation,o=t.trafficAllocationSeed,s=t.status,c=t.conditions,l=t.prerequisites,u=V(t.defaultTreatment)?t.defaultTreatment:I,d=Po(e,c,n),f=Fo(l,n,e);return{getTreatment:function(t,n,c){var l=en(t);function p(t){if(!t)return e.debug(41,[`Prerequisite not met`]),{treatment:u,label:va};var r=d(l,i,a,o,n,c);return Y(r)?r.then(function(e){return Io(e,u)}):Io(r,u)}if(s===`ARCHIVED`)return{treatment:I,label:ha};if(r)return e.debug(41,[`Flag is killed`]),{treatment:u,label:ua};var m=f({key:t,attributes:n},c);return Y(m)?m.then(p):p(m)}}}var Ro={treatment:I,label:ma,config:null};function zo(e){var t={};return e.forEach(function(e){t[e]=Ro}),t}function Bo(e,t,n,r,i,a){var o;try{o=i.splits.getSplit(n)}catch{return Ro}return Y(o)?o.then(function(n){return Uo(e,t,n,r,i,a)}).catch(function(){return Ro}):Uo(e,t,o,r,i,a)}function Vo(e,t,n,r,i,a){var o;try{o=i.splits.getSplits(n)}catch{return zo(n)}return Y(o)?o.then(function(o){return Wo(e,t,n,o,r,i,a)}).catch(function(){return zo(n)}):Wo(e,t,n,o,r,i,a)}function Ho(e,t,n,r,i,a,o){var s;function c(s){for(var c=new Set,l=0;l<n.length;l++){var u=s[l];u.size?c=Kr(c,u):e.warn(228,[a,n[l]])}return c.size?Vo(e,t,Gr(c),r,i,o):{}}try{s=i.splits.getNamesByFlagSets(n)}catch{return{}}return Y(s)?s.then(function(e){return c(e)}).catch(function(){return{}}):c(s)}function Uo(e,t,n,r,i,a){var o={treatment:I,label:fa,config:null};if(n){if(o=Lo(e,n,i).getTreatment(t,r,Bo),Y(o))return o.then(function(e){return e.changeNumber=n.changeNumber,e.config=n.configurations&&n.configurations[e.treatment]||null,e.impressionsDisabled=a?.impressionsDisabled||n.impressionsDisabled,e});o.changeNumber=n.changeNumber,o.config=n.configurations&&n.configurations[o.treatment]||null,o.impressionsDisabled=a?.impressionsDisabled||n.impressionsDisabled}return o}function Wo(e,t,n,r,i,a,o){var s={},c=[];return n.forEach(function(n){var l=Uo(e,t,r[n],i,a,o);Y(l)?c.push(l.then(function(e){s[n]=e})):s[n]=l}),c.length>0?Promise.all(c).then(function(){return s}):s}var Go={treatment:I,label:pa};function Ko(e){var t={};return e.forEach(function(e){t[e]=Go}),t}function qo(e){if(e&&e.properties)try{return JSON.stringify(e.properties)}catch{}}function Jo(e){var t=e.sdkReadinessManager.readinessManager,n=e.storage,r=e.settings,i=e.impressionsTracker,a=e.eventTracker,o=e.telemetryTracker,s=e.fallbackTreatmentsCalculator,c=r.log,l=r.mode,u=vt(l);function d(e,r,a,s,l,d){l===void 0&&(l=!1),d===void 0&&(d=ye);var f=o.trackEval(l?`tc`:`t`),p=function(t){var n=[],o=y(t,r,e,qo(s),l,d,n);return i.track(n,a),f(n[0]&&n[0].imp.label),o},m=t.isReadyFromCache()?Bo(c,e,r,a,n,s):u?Promise.resolve(Go):Go;return Y(m)?m.then(function(e){return p(e)}):p(m)}function f(e,t,n,r){return d(e,t,n,r,!0,xe)}function p(e,r,a,s,l,d){l===void 0&&(l=!1),d===void 0&&(d=be);var f=o.trackEval(l?`tcs`:`ts`),p=function(t){var n=[],r={},o=qo(s);return Object.keys(t).forEach(function(i){r[i]=y(t[i],i,e,o,l,d,n)}),i.track(n,a),f(n[0]&&n[0].imp.label),r},m=t.isReadyFromCache()?Vo(c,e,r,a,n,s):u?Promise.resolve(Ko(r)):Ko(r);return Y(m)?m.then(function(e){return p(e)}):p(m)}function m(e,t,n,r){return p(e,t,n,r,!0,Se)}function h(e,r,a,s,l,d,f){l===void 0&&(l=!1),d===void 0&&(d=`tfs`),f===void 0&&(f=we);var p=o.trackEval(d),m=function(t){var n=[],r={},o=qo(s);return Object.keys(t).forEach(function(i){r[i]=y(t[i],i,e,o,l,f,n)}),i.track(n,a),p(n[0]&&n[0].imp.label),r},h=t.isReadyFromCache()?Ho(c,e,r,a,n,f,s):u?Promise.resolve({}):{};return Y(h)?h.then(function(e){return m(e)}):m(h)}function g(e,t,n,r){return h(e,t,n,r,!0,ke,Ee)}function _(e,t,n,r){return h(e,[t],n,r,!1,`tf`,Ce)}function v(e,t,n,r){return h(e,[t],n,r,!0,`tcf`,Te)}function y(e,n,r,i,a,o,l){var u=Qt(r),d=$t(r),f=e.changeNumber,p=e.impressionsDisabled,m=e.treatment,h=e.label,g=e.config,_=g===void 0?null:g;if(m===`control`){var v=s.resolve(n,h);m=v.treatment,h=v.label,_=v.config}return c.info(102,[n,u,m,h]),ba(c,t,n,h,o)&&(c.info(103),l.push({imp:{feature:n,keyName:u,treatment:m,time:Date.now(),bucketingKey:d,label:h,changeNumber:f,properties:i},disabled:p})),a?{treatment:m,config:_}:m}function b(e,r,i,s,u,d){d===void 0&&(d=1024);var f=o.trackEval(`tr`),p=Qt(e),m={eventTypeId:i,trafficTypeName:r,value:s,timestamp:Date.now(),key:p,properties:u};Sa(c,t,n.splits,l,r,De);var h=a.track(m,d);return Y(h)?h.then(function(e){return f(),e}):(f(),h)}return{getTreatment:d,getTreatmentWithConfig:f,getTreatments:p,getTreatmentsWithConfig:m,getTreatmentsByFlagSets:h,getTreatmentsWithConfigByFlagSets:g,getTreatmentsByFlagSet:_,getTreatmentsWithConfigByFlagSet:v,track:b}}function Yo(e,t,n,r){var i=e.log,a=e.mode,o=vt(a);function s(t,r,a,o,s){var c=Ft(i,r,t),l=t.indexOf(`ByFlagSet`)>-1?jt(i,t,a,e.sync.__splitFiltersValidation.groupedFilters.bySet):$e(t,`getTreatments`)?xt(i,a,t):bt(i,a,t),u=Wi(i,o,t),d=aa(i,n,t),f=ta(i,s,t);return oa(i,n,t,l),{valid:d&&c&&l&&u!==!1,key:c,nameOrNames:l,attributes:u,options:f}}function c(e,t){var n=r.resolve(e,``),i=n.treatment,a=n.config;
2return t?{treatment:i,config:a}:i}function l(e){return o?Promise.resolve(e):e}function u(e,n,r,i){var a=s(ye,e,n,r,i);return a.valid?t.getTreatment(a.key,a.nameOrNames,a.attributes,a.options):l(c(a.nameOrNames,!1))}function d(e,n,r,i){var a=s(xe,e,n,r,i);return a.valid?t.getTreatmentWithConfig(a.key,a.nameOrNames,a.attributes,a.options):l(c(a.nameOrNames,!0))}function f(e,n,r,i){var a=s(be,e,n,r,i);if(a.valid)return t.getTreatments(a.key,a.nameOrNames,a.attributes,a.options);var o={};return a.nameOrNames&&a.nameOrNames.forEach(function(e){return o[e]=c(e,!1)}),l(o)}function p(e,n,r,i){var a=s(Se,e,n,r,i);if(a.valid)return t.getTreatmentsWithConfig(a.key,a.nameOrNames,a.attributes,a.options);var o={};return a.nameOrNames&&a.nameOrNames.forEach(function(e){return o[e]=c(e,!0)}),l(o)}function m(e,n,r,i){var a=s(we,e,n,r,i);return a.valid?t.getTreatmentsByFlagSets(a.key,a.nameOrNames,a.attributes,a.options):l({})}function h(e,n,r,i){var a=s(Ee,e,n,r,i);return a.valid?t.getTreatmentsWithConfigByFlagSets(a.key,a.nameOrNames,a.attributes,a.options):l({})}function g(e,n,r,i){var a=s(Ce,e,[n],r,i);return a.valid?t.getTreatmentsByFlagSet(a.key,a.nameOrNames[0],a.attributes,a.options):l({})}function _(e,n,r,i){var a=s(Te,e,[n],r,i);return a.valid?t.getTreatmentsWithConfigByFlagSet(a.key,a.nameOrNames[0],a.attributes,a.options):l({})}function v(e,r,a,s,c){var l=Ft(i,e,De),u=ia(i,r,De),d=Ji(i,a,De),f=Yi(i,s,De),p=ea(i,c,De),m=p.properties,h=p.size;return aa(i,n,`track`)&&l&&u&&d&&f!==!1&&m!==!1?t.track(l,u,d,f,m,h):o?Promise.resolve(!1):!1}return{getTreatment:u,getTreatmentWithConfig:d,getTreatments:f,getTreatmentsWithConfig:p,getTreatmentsByFlagSets:m,getTreatmentsWithConfigByFlagSets:h,getTreatmentsByFlagSet:g,getTreatmentsWithConfigByFlagSet:_,track:v}}var Xo=1e3;function Zo(e,t){var n=e.sdkReadinessManager,r=e.syncManager,i=e.storage,a=e.signalListener,o=e.settings,s=e.telemetryTracker,c=e.uniqueKeysTracker,l=0;function u(e,t){var n=Date.now(),r=n-l;return r<t?(o.log.warn(`Flush cooldown, remaining time `+(t-r)/1e3+` seconds`),Promise.resolve()):(l=n,e())}function d(){return r?r.flush():Promise.resolve()}return v(Object.create(n.sdkStatus),Yo(o,Jo(e),n.readinessManager,e.fallbackTreatmentsCalculator),{flush:function(){return u(d,Xo)},destroy:function(){return n.readinessManager.destroy(),t||(Xt(o.core.authorizationKey),s.sessionLength(),a&&a.stop(),c.stop()),r&&r.stop(),d().then(function(){return i.destroy()})}})}function Qo(e,t){return(e.matchingKey?e.matchingKey:e)+`-`+(e.bucketingKey?e.bucketingKey:e)+`-`+(t||``)}function $o(e){var t=e.clients,n=e.storage,r=e.syncManager,i=e.sdkReadinessManager,a=e.settings,o=a.core.key,s=a.log,c=a.initialRolloutPlan,l=ka(s,Zo(e),o),u=Qo(en(o));return t[u]=l,function(a){if(a===void 0)return s.debug(27),l;var o=Ft(s,a,x);if(o===!1)throw Error(`Shared Client needs a valid key.`);var u=Qo(o);if(t[u])s.debug(28);else{var d=Qt(o),f=i.shared(),p=n.shared&&n.shared(d,function(e){if(e){f.readinessManager.timeout();return}f.readinessManager.segments.emit(`state::segments-arrived`)});p&&c&&Lt(s,c,{segments:p.segments,largeSegments:p.largeSegments},d);var m=r&&p&&r.shared(d,f.readinessManager,p);t[u]=ka(s,Zo(v({},e,{sdkReadinessManager:f,storage:p||n,syncManager:m}),!0),o),s.info(104)}return t[u]}}var es=function(){function e(e,t,n,r){this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}return e}(),ts=function(){function e(){this.tail=null,this.head=null,this.length=0}return e.prototype.removeNode=function(e){if(e&&e instanceof es){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t}},e.prototype.unshiftNode=function(e){if(e&&e instanceof es&&e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},e.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)this.head=new es(arguments[e],null,this.head,this),this.tail||=this.head,this.length++;return this.length},e}(),ns=function(){function e(e){this.maxLen=e||1,this.items=new Map,this.lru=new ts}return e.prototype.get=function(e){var t=this.items.get(e);if(t&&t instanceof es)return this.lru.unshiftNode(t),t.value.value},e.prototype.set=function(e,t){var n=this.items.get(e);if(n){if(!(n instanceof es))return!1;this.lru.unshiftNode(n),this.lru.head.value.value=t}else{if(this.lru.length===this.maxLen){var r=this.lru.tail;if(!r)return!1;this.items.delete(r.value.key),this.lru.removeNode(this.lru.tail)}this.lru.unshift({key:e,value:t}),this.items.set(e,this.lru.head)}return!0},e}(),rs=function(){function e(e,t){this.cache=new ns(e),this.hasher=t}return e.prototype.testAndSet=function(e){var t=this.hasher(e),n=this.cache.get(t);return this.cache.set(t,e.time),n},e}();function is(e){return e.keyName+`:`+e.feature+`:`+e.treatment+`:`+e.label+`:`+e.changeNumber}function as(e){return sr(is(e))}var os=500;function ss(){return new rs(os,as)}function cs(e){var t=Fi(e);return t.validateCache=function(){return Promise.resolve({initialCacheLoad:!1})},t}cs.type=he;function ls(e,t){var n=!1,r=!1;function i(e){var a=new Promise(function(n,i){return e.then(n,function(e){r?i(e):t(e)})}),o=a.then;return Object.defineProperty(a,"then",{value:function(e,t){var s=o.call(a,e,t);return typeof e==`function`&&(n=!0),typeof t==`function`?(r=!0,s):i(s)}}),a}var a=i(e);return a.hasOnFulfilled=function(){return n},a}
2function us(e){var t=v(new e,{splitsArrived:!1,splitsCacheLoaded:!1,hasInit:!1,initCallbacks:[]});return t.on(ct,function(e,n){n||(t.splitsArrived=!0)}),t.once(lt,function(){t.splitsCacheLoaded=!0}),t}function ds(e){var t=v(new e,{segmentsArrived:!1});return t.once(ut,function(){t.segmentsArrived=!0}),t}function fs(e,t,n,r){n===void 0&&(n=us(e));var i=t.startup.readyTimeout,a=ds(e),o=new e,s=0;function c(){var e=Date.now();s=e>s?e:s+1}var l={initialCacheLoad:!0},u=!1;n.splitsCacheLoaded?u=!0:n.once(lt,_);var d=!1;function f(){d||p||(d=!0,c(),o.emit(dt,`Split SDK emitted SDK_READY_TIMED_OUT event.`))}var p=!1;n.on(ct,v),a.on(ut,v);var m=!1,h;function g(){m=!1,i>0&&!p&&(h=setTimeout(f,i))}n.initCallbacks.push(g),n.hasInit&&g();function _(e){if(l=e,u=!0,!p&&!m)try{c(),o.emit(pt,e)}catch(e){setTimeout(function(){throw e},0)}}function v(e){if(!m){if(p)try{c(),o.emit(mt,e)}catch(e){setTimeout(function(){throw e},0)}else if(n.splitsArrived&&a.segmentsArrived){clearTimeout(h),p=!0;try{c(),u||(u=!0,o.emit(pt,{initialCacheLoad:!0,lastUpdateTimestamp:void 0})),o.emit(ft,l)}catch(e){setTimeout(function(){throw e},0)}}}}return{splits:n,segments:a,gate:o,shared:function(){return fs(e,t,n,!0)},timeout:f,setDestroyed:function(){m=!0},init:function(){n.hasInit||(n.hasInit=!0,n.initCallbacks.forEach(function(e){return e()}))},destroy:function(){m=!0,c(),clearTimeout(h),r||(n.hasInit=!1)},isReady:function(){return p},isReadyFromCache:function(){return u},isTimedout:function(){return d&&!p},hasTimedout:function(){return d},isDestroyed:function(){return m},isOperational:function(){return(p||u)&&!m},lastUpdate:function(){return s},metadataReady:function(){return l}}}var ps=`newListener`,ms=`removeListener`,hs=Error(dt);function gs(e,t,n){n===void 0&&(n=fs(e,t));var r=t.log,i=0,a=0;n.gate.on(ms,function(e){e===`init::ready`&&a--}),n.gate.on(ps,function(e){e===`init::ready`||e===`init::timeout`?n.isReady()?r.error(302,[e===`init::ready`?`SDK_READY`:`SDK_READY_TIMED_OUT`]):e===`init::ready`&&a++:e===`init::cache-ready`&&n.isReadyFromCache()&&r.error(302,[`SDK_READY_FROM_CACHE`])});var o=c();n.gate.once(pt,function(){r.info(100)});function s(e){r.error(e&&e.message)}function c(){var e=ls(new Promise(function(t,o){n.gate.once(ft,function(){r.info(101),a===i&&!e.hasOnFulfilled()&&r.warn(202),t()}),n.gate.once(dt,function(e){o(Error(e))})}),s);return e}function l(){return{isReady:n.isReady(),isReadyFromCache:n.isReadyFromCache(),isTimedout:n.isTimedout(),hasTimedout:n.hasTimedout(),isDestroyed:n.isDestroyed(),isOperational:n.isOperational(),lastUpdate:n.lastUpdate()}}return{readinessManager:n,shared:function(){return gs(e,t,n.shared())},incInternalReadyCbCount:function(){i++},sdkStatus:v(Object.create(n.gate),{Event:{SDK_READY:ft,SDK_READY_FROM_CACHE:pt,SDK_UPDATE:mt,SDK_READY_TIMED_OUT:dt},ready:function(){return n.hasTimedout()?n.isReady()?Promise.resolve():ls(Promise.reject(Error(`Split SDK has emitted SDK_READY_TIMED_OUT event.`)),s):o},whenReady:function(){return new Promise(function(e,t){n.isReady()?e(n.metadataReady()):n.hasTimedout()?t(hs):(n.gate.once(ft,e),n.gate.once(dt,function(){return t(hs)}))})},whenReadyFromCache:function(){return new Promise(function(e,t){n.isReadyFromCache()?e(n.metadataReady()):n.hasTimedout()?t(hs):(n.gate.once(pt,e),n.gate.once(dt,function(){return t(hs)}))})},getStatus:l,__getStatus:l})}}function _s(e,t,n,r,i,a,o){var s=e.log,c=e.impressionListener,l=e.runtime,u=l.ip,d=l.hostname,f=e.version;return{track:function(l,p){if(e.userConsent!==`DECLINED`){var m=l.filter(function(e){var t=e.imp;return e.disabled?n.process(t):r.process(t)}),h=l.length,g=m.length;if(g){var _=t.track(m.map(function(e){return e.imp}));Y(_)?_.then(function(){s.info(121,[h])}).catch(function(e){s.error(307,[h,e])}):o&&(o.recordImpressionStats(0,g),o.recordImpressionStats(2,h-g))}if(c||a)for(var y=function(e){var t={impression:v({},l[e].imp),attributes:p,ip:u,hostname:d,sdkLanguageVersion:f};i(function(){setTimeout(function(){a&&a.handleImpression(t);try{c&&c.logImpression(t)}catch(e){s.error(308,[e])}})})},b=0;b<h;b++)y(b)}}}}function vs(e,t,n,r,i){var a=e.log,o=e.mode,s=vt(o);function c(e,t){var i=e.eventTypeId,o=e.trafficTypeName,s=e.key,c=e.value,l=e.timestamp,u=e.properties,d=`event of type "`+i+`" for traffic type "`+o+`". Key: `+s+`. Value: `+c+`. Timestamp: `+l+`. `+(u?`With properties.`:`With no properties.`);return t?(a.info(120,[d]),r&&n(function(){setTimeout(function(){var t=v({},e);u&&(t.properties=v({},u)),r.handleEvent(t)})})):a.error(309,[d]),t}return{track:function(n,r){if(e.userConsent===`DECLINED`)return s?Promise.resolve(!1):!1;var a=t.track(n,r);return Y(a)?a.then(c.bind(null,n)):(i&&i.recordEventStats(+!a,1),c(n,a))}}}function ys(e,t){if(e&&t){var n=Zt(t);return{trackEval:function(n){var r=Zt(t);return function(t){switch(t){case ma:e.recordException(n);return;
2case pa:e.recordNonReadyUsage&&e.recordNonReadyUsage()}e.recordLatency(n,r())}},trackHttp:function(n){var r=Zt(t);return function(t){e.recordHttpLatency(n,r()),t&&t.statusCode?e.recordHttpError(n,t.statusCode):e.recordSuccessfulSync(n,Date.now())}},sessionLength:function(){e.recordSessionLength&&e.recordSessionLength(n())},streamingEvent:function(t,n){t===80?e.recordAuthRejections():(e.recordStreamingEvents({e:t,d:n,t:Date.now()}),t===50&&e.recordTokenRefreshes())},addTag:function(t){e.addTag&&e.addTag(t)},trackUpdatesFromSSE:function(t){e.recordUpdatesFromSSE(t)}}}var r=function(){return function(){}};return{trackEval:r,trackHttp:r,sessionLength:function(){},streamingEvent:function(){},addTag:function(){},trackUpdatesFromSSE:function(){}}}function bs(e){return typeof e==`boolean`?e?Ss.DEBUG:Ss.NONE:typeof e==`string`&&Ts(e)?e:void 0}function xs(e){return typeof e==`object`&&!!e&&typeof e.debug==`function`&&typeof e.info==`function`&&typeof e.warn==`function`&&typeof e.error==`function`}var Ss={DEBUG:`DEBUG`,INFO:`INFO`,WARN:`WARN`,ERROR:`ERROR`,NONE:`NONE`},Cs={DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},ws={debug:function(e){console.log(`[DEBUG] `+e)},info:function(e){console.log(`[INFO] `+e)},warn:function(e){console.log(`[WARN] `+e)},error:function(e){console.log(`[ERROR] `+e)}};function Ts(e){return!!We(Ss,function(t){return e===t})}function Es(e,t){e===void 0&&(e=``),t===void 0&&(t=[]);var n=0;return e.replace(/%s/g,function(){var e=t[n++];if(B(e)||Array.isArray(e))try{e=JSON.stringify(e)}catch{}return e})}var Ds={prefix:`splitio`,logLevel:Ss.NONE},Os=function(){function e(e,t){this.options=v({},Ds,e),this.codes=t||new Map,this.logLevel=Cs[this.options.logLevel]}return e.prototype.setLogLevel=function(e){this.options.logLevel=e,this.logLevel=Cs[e]},e.prototype.setLogger=function(e){if(e){if(xs(e)){this.logger=e;return}this.error("Invalid `logger` instance. It must be an object with `debug`, `info`, `warn` and `error` methods. Defaulting to `console.log`")}this.logger=void 0},e.prototype.debug=function(e,t){this._shouldLog(Cs.DEBUG)&&this._log(`debug`,e,t)},e.prototype.info=function(e,t){this._shouldLog(Cs.INFO)&&this._log(`info`,e,t)},e.prototype.warn=function(e,t){this._shouldLog(Cs.WARN)&&this._log(`warn`,e,t)},e.prototype.error=function(e,t){this._shouldLog(Cs.ERROR)&&this._log(`error`,e,t)},e.prototype._log=function(e,t,n){if(typeof t==`number`){var r=this.codes.get(t);t=r?Es(r,n):`Message code `+t+(n?`, with args: `+n.toString():``)}else n&&(t=Es(t,n));if(this.options.prefix&&(t=this.options.prefix+` => `+t),this.logger)try{this.logger[e](t);return}catch{}ws[e](t)},e.prototype._shouldLog=function(e){return e>=this.logLevel},e}();function ks(e){function t(t){Ts(t)?e.setLogLevel(t):e.error(301)}return{enable:function(){t(Ss.DEBUG)},setLogLevel:t,setLogger:function(t){e.setLogger(t)},disable:function(){t(Ss.NONE)},LogLevel:Ss}}function As(e){return{process:function(t){return t.properties||(t.pt=e.testAndSet(t)),!0}}}function js(e,t){return{process:function(n){if(n.properties)return!0;n.pt=e.testAndSet(n);var r=Date.now();return n.pt&&t.track(n.feature,r,1),!n.pt||n.pt<ni(r)}}}function Ms(e,t){return{process:function(n){var r=Date.now();return e.track(n.feature,r,1),t.track(n.keyName,n.feature),!1}}}var Ns={add:function(){return!0},contains:function(){return!0},clear:function(){}};function Ps(e,t,n){n===void 0&&(n=Ns);var r;return{track:function(r,i){if(!n.add(r,i)){e.debug(ne+`The feature `+i+` and key `+r+` exist in the filter`);return}t.track(r,i)},start:function(){n.refreshRate&&(r=setInterval(n.clear,n.refreshRate))},stop:function(){clearInterval(r)}}}function Fs(e){var t=e.settings,n=e.platform,r=e.storageFactory,i=e.splitApiFactory,a=e.extraProps,o=e.syncManagerFactory,s=e.SignalListener,c=e.impressionsObserverFactory,l=e.integrationsManagerFactory,u=e.sdkManagerFactory,d=e.sdkClientMethodFactory,f=e.filterAdapterFactory,p=e.lazyInit,m=t.log,h=t.sync.impressionsMode,g=t.initialRolloutPlan,_=t.core.key,y=!1,b=[];function x(e){y?e():b.push(e)}var S=gs(n.EventEmitter,t),C=S.readinessManager,w=r({settings:t,onReadyCb:function(e){if(e){C.timeout();return}C.splits.emit(ct),C.segments.emit(ut)}
2,onReadyFromCacheCb:function(){C.splits.emit(lt)}}),T=new la(t.fallbackTreatments);g&&(Lt(m,g,w,_&&Qt(_)),w.splits.getChangeNumber()>-1&&C.splits.emit(lt,{initialCacheLoad:!1}));var E={},D=ys(w.telemetry,n.now),O=l&&l({settings:t,storage:w,telemetryTracker:D}),k=c(),A=Ps(m,w.uniqueKeys,f&&f()),j=Ms(w.impressionCounts,A),ee=h===`OPTIMIZED`?js(k,w.impressionCounts):h===`DEBUG`?As(k):j,M=_s(t,w.impressions,j,ee,x,O,w.telemetry),N=vs(t,w.events,x,O,w.telemetry),te=i&&i(t,n,D),ne={clients:E,splitApi:te,eventTracker:N,impressionsTracker:M,telemetryTracker:D,uniqueKeysTracker:A,sdkReadinessManager:S,readiness:C,settings:t,storage:w,platform:n,fallbackTreatmentsCalculator:T},P=o&&o(ne);ne.syncManager=P;var re=s&&new s(P,t,w,te);ne.signalListener=re;var F=d(ne),ie=u(t,w.splits,S);function ae(){y||(y=!0,Yt(m,t.core.authorizationKey),C.init(),A.start(),P&&P.start(),re&&re.start(),b.forEach(function(e){return e()}),b.length=0)}return m.info(105,[t.version]),v({client:F,manager:function(){return m.debug(29),ie},Logger:ks(m),settings:t,destroy:function(){return y=!1,Promise.all(Object.keys(E).map(function(e){return E[e].destroy()})).then(function(){})}},a&&a(ne),p?{init:ae}:ae())}var Is={GRANTED:R,DECLINED:_e,UNKNOWN:ve};function Ls(e){var t=e.settings,n=e.settings.log,r=e.syncManager,i=e.storage,a=i.events,o=i.impressions,s=i.impressionCounts,c=i.uniqueKeys;return jn(t)||n.info(124,[t.userConsent]),{setStatus:function(e){var i,l;if(!Je(e))return n.warn(325,[`UserConsent.setStatus`]),!1;var u=e?R:_e;return t.userConsent===u?n.info(123,[u]):(n.info(122,[t.userConsent,u]),t.userConsent=u,e?(i=r?.submitterManager)==null||i.start():((l=r?.submitterManager)==null||l.stop(!0),a.clear&&a.clear(),o.clear&&o.clear(),s.clear&&s.clear(),c.clear&&c.clear())),!0},getStatus:function(){return t.userConsent},Status:Is}}function Rs(e){var t=e.treatment;return e.keys?{conditionType:`WHITELIST`,matcherGroup:{combiner:`AND`,matchers:[{keySelector:null,matcherType:`WHITELIST`,negate:!1,whitelistMatcherData:{whitelist:V(e.keys)?[e.keys]:e.keys}}]},partitions:[{treatment:t,size:100}],label:`whitelisted `+t}:{conditionType:`ROLLOUT`,matcherGroup:{combiner:`AND`,matchers:[{keySelector:null,matcherType:`ALL_KEYS`,negate:!1}]},partitions:[{treatment:t,size:100}],label:`default rule`}}function zs(e,t){return typeof e==typeof t?typeof e==`string`?e!==t:e.treatment!==t.treatment||e.config!==t.config:!0}function Bs(){var e={emptyMock:`1`};function t(t){var n=Object.keys(t);return n.length===Object.keys(e).length?n.some(function(n){var r=!e[n],i=zs(e[n],t[n]),a=r||i;return a&&(e=Qe({},t)),a}):(e=Qe({},t),!0)}return function(e){var n=e.features||{};if(!t(n))return!1;var r={};return z(n,function(e,t){var n=e,i=null;B(e)&&(n=e.treatment,i=e.config||i);var a={};i!==null&&(a[n]=i),r[t]={trafficTypeName:`localhost`,conditions:[Rs({treatment:n})],configurations:a}}),r}}function Vs(e,t,n,r){var i=r.log,a=t.splits,o=!0;return function(){var s=[],c=null,l={};try{l=e(r)}catch(e){c=e,i.error(304,[e])}return!c&&l?(i.debug(30,[JSON.stringify(l)]),z(l,function(e,t){s.push({name:t,status:`ACTIVE`,killed:!1,trafficAllocation:100,defaultTreatment:I,conditions:e.conditions||[],configurations:e.configurations,trafficTypeName:e.trafficTypeName})}),Promise.all([a.clear(),a.update(s,[],Date.now())]).then(function(){return n.splits.emit(ct,{type:ht,names:[]}),o&&(o=!1,Promise.resolve(t.validateCache?t.validateCache():{initialCacheLoad:!0}).then(function(e){e.initialCacheLoad||n.splits.emit(lt,e),n.segments.emit(ut,{type:gt,names:[]})})),!0})):Promise.resolve(!0)}}function Hs(e,t,n,r){return Fe(r.log,Vs(e,t,n,r),r.scheduler.offlineRefreshRate,`offlineUpdater`)}function Us(){return Promise.resolve()}function Ws(e){return function(t){var n=t.settings,r=t.readiness,i=t.storage,a=Hs(e(),i,r,n),o=a.start,s=[];return v(a,{start:function(){o(),s.forEach(function(e){return e()}),s.length=0},flush:Us,shared:function(e,t){function n(){t.segments.emit(ut)}return a.isRunning()?setTimeout(n):s.push(n),{stop:function(){},flush:Us}}})}}var Gs=Ws(Bs);function Ks(){return{ip:!1,hostname:!1}}var qs=!!(typeof process<`u`&&process.version!==void 0&&process.version),Js=[[300,C+`Invalid feature flag, no valid rules or unsupported targeting rule type found`],[329,w+`[%s] %s`],[301,`logger: Invalid Log Level - No changes to the logs will be applied.`],[303,`The SDK will not get ready. Reason: %s`],[307,N+`Could not store impressions bulk with %s
2impression(s). Error: %s`],[308,N+`Impression listener logImpression method threw: %s.`],[309,te+`Failed to queue %s`],[304,O+`There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s`],[305,k+`Failed to connect or error on streaming connection, with error message: %s`],[306,k+`Failed to authenticate for streaming. Error: %s.`],[322,`HTTP request failed with %s. URL: %s. Message: %s`],[302,`A listener was added for %s on the SDK, which has already fired and won't be emitted again. The callback won't be executed.`],[314,`%s: Client has already been destroyed - no calls possible.`],[310,`%s: you passed "%s", event_type must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/g. This means an event_type must be alphanumeric, cannot be more than 80 characters long, and can only include a dash, underscore, period, or colon as separators of alphanumeric characters.`],[311,`%s: %s must be a plain object.`],[312,`%s: the maximum size allowed for the properties is 32768 bytes, which was exceeded.`],[313,`%s: value must be a finite number.`],[315,`%s: you passed a null or undefined %s. It must be a non-empty string.`],[316,`%s: %s too long. It must have 250 characters or less.`],[317,`%s: Key must be an object with bucketingKey and matchingKey with valid string properties.`],[318,`%s: you passed an invalid %s. It must be a non-empty string.`],[319,`%s: you passed an empty %s. It must be a non-empty string.`],[320,`%s: %s must be a non-empty array.`],[325,`%s: provided param must be a boolean value.`],[321,y+`: you passed an invalid "%s" config param. It should be one of the following values: %s. Defaulting to "%s".`],[324,y+`: the provided storage is invalid.%s Falling back into default MEMORY storage`],[326,y+`: the provided "%s" config param is lower than allowed. Setting to the minimum value %s seconds`],[327,y+`: the amount of flag sets provided are big causing uri length error.`],[328,y+`: the Set filter is exclusive and cannot be used simultaneously with names or prefix filters. Ignoring names and prefixes.`],[200,T+`Value %s doesn't match with expected type.`],[201,T+"Defined attribute `%s`. No attributes received."],[204,j+`Retrying fetch of memberships (attempt #%s). Reason: %s`],[205,A+`Error while doing fetch of feature flags. %s`],[206,k+`Error parsing SSE error notification: %s`],[207,k+`Error parsing SSE message notification: %s`],[208,k+`Falling back to polling mode. Reason: %s`],[209,M+`Dropping %s after retry. Reason: %s.`],[210,M+`Failed to push %s, keeping data to retry on next iteration. Reason: %s.`],[203,`%s: the SDK is not ready to evaluate. Results may be incorrect%s. Make sure to wait for SDK readiness before using this method.`],[202,`No listeners for SDK_READY event detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet synchronized with the backend.`],[211,`%s: Property "%s" is of invalid type. Setting value to null.`],[212,`%s: more than 300 properties were provided. Some of them will be trimmed when processed.`],[213,`%s: %s "%s" is not of type string, converting.`],[214,`%s: %s "%s" has extra whitespace, trimming.`],[215,`%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.`],[216,`%s: traffic_type_name should be all lowercase - convert
2ing string to lowercase.`],[217,`%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you're tracking your events to a valid traffic type defined in the Split user interface.`],[227,`%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.`],[218,y+`: %s integration item(s) at settings is invalid. %s`],[219,y+`: feature flag filters are not applicable for Consumer modes where the SDK does not keep rollout data in sync. Filters were discarded`],[220,y+`: feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".`],[221,y+`: feature flag filter configuration must be a non-empty array of filter objects.`],[222,y+`: You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application`],[223,k+`Fetching Memberships due to an error processing %s notification: %s`],[224,k+`Fetching SplitChanges due to an error processing %s notification: %s`],[225,`%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.`],[226,`%s: flag set %s should be all lowercase - convert
2ing string to lowercase.`],[228,`%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface.`]],Ys=`Split SDK client is ready`,Xs=Js.concat([[100,Ys+` from cache`],[101,Ys],[102,N+`Feature flag: %s. Key: %s. Evaluation: %s. Label: %s`],[103,N+`Queueing corresponding impression.`],[104,`New shared client instance created.`],[105,`New Split SDK instance created. %s`],[120,te+`Successfully queued %s`],[121,N+`Successfully stored %s impression(s).`],[122,`UserConsent: consent status changed from %s to %s.`],[123,`UserConsent: call had no effect because it was the current consent status (%s).`],[124,`Starting the SDK with %s user consent. No data will be sent.`],[106,ee+`Turning segments data polling %s.`],[107,ee+`Starting polling`],[108,ee+`Stopping polling`],[109,A+`Retrying fetch of feature flags (attempt #%s). Reason: %s`],[115,M+`Flushing full %s queue and resetting timer.`],[116,M+`Pushing %s.`],[125,M+`Flushing %s because page became hidden.`],[110,k+`Refreshing streaming token in %s seconds, and connecting streaming in %s seconds.`],[111,k+`Attempting to reconnect streaming in %s seconds.`],[112,k+`Connecting streaming.`],[113,k+`Streaming is disabled for given SDK key. Switching to polling mode.`],[114,k+`Disconnecting streaming.`],[117,D+`Streaming not available. Starting polling.`],[118,D+`Streaming couldn't connect. Continue polling.`],[119,D+`Streaming connected. Syncing and stopping polling.`]]).concat([[0,C+`[andCombiner] evaluates to %s`],[1,C+`Treatment found: %s`],[2,C+`All predicates evaluated, no treatment found.`],[3,S+`: using algo "murmur" bucket %s for key %s using seed %s - treatment %s`],[10,w+`[IN_SPLIT_TREATMENT] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of %s ? %s.`],[11,w+`[IN_SPLIT_TREATMENT] will evaluate parent feature flag: "%s" with key: %s %s`],[23,T+"Extracted attribute `%s`. %s will be used for matching."],[24,S+`:sanitize: Attempted to sanitize %s which should be of type %s. Sanitized and processed value => %s`],[40,w+`[%s] Result: %s. Rule value: %s. Evaluation value: %s`],[41,S+`Evaluates to default treatment. %s`],[25,P+`Registering cleanup handler %s`],[26,P+`Deregistering cleanup handler %s`],[27,`Retrieving default SDK client.`],[28,`Retrieving existing SDK client.`],[29,`Retrieving manager instance.`],[30,O+`Feature flags data: 3%s`],[31,A+`Spin up feature flags update using since = %s and rbSince = %s.`],[32,A+`New feature flags: %s. Removed feature flags: %s.`],[33,A+`New rule-based segments: %s. Removed rule-based segments: %s.`],[35,k+`New SSE message received, with data: %s.`],[36,E+`: Starting %s. Running each %s millis`],[37,E+`: Running %s`],[38,E+`: Stopping %s`],[39,y+`: feature flags filtering criteria is "%s".`]]),Zs=new Map(Xs),Qs=String(qs?{}.SPLITIO_DEBUG:mi()?localStorage.getItem(`splitio_debug`):``),$s=Ss.NONE;/^(enabled?|on)/i.test(Qs)?$s=Ss.DEBUG:Ts(Qs)&&($s=Qs);function ec(e){var t=e.debug,n=e.logger,r=t===void 0?$s:bs(t),i=new Os({logLevel:r||$s},Zs);return i.setLogger(n),r||i._log(`error`,`Invalid Log Level - No changes to the logs will be applied.`),i}var tc=[_e,R,ve];function nc(e){var t=e.userConsent,n=e.log;return t=Ze(t),tc.indexOf(t)>-1?t:(n.error(321,[`userConsent`,tc,R]),R)}var rc={startup:{requestTimeoutBeforeReady:5,retriesOnFailureBeforeReady:1,readyTimeout:10,eventsFirstPushWindow:10},userConsent:R,version:`javascript-11.11.1`},ic=`LOCALSTORAGE`;function ac(e){var t=e.log,n=e.mode,r=e.storage,i=r===void 0?{type:he}:r,a=i.type,o=i.options,s=o===void 0?{}:o,c=i.prefix,l=i.expirationDays,u=i.clearOnInit,d=i.wrapper,f,p=function(){f=a,a=he};return n===`localhost`&&a===ic&&p(),a!==`MEMORY`&&a!==ic&&(p(),t.error(`Invalid storage type. Fallback into MEMORY storage`)),{type:a,options:s,prefix:c,expirationDays:l,clearOnInit:u,wrapper:d,__originalType:f}}var oc={defaults:rc,acceptKey:!0,runtime:Ks,storage:ac,logger:ec,consent:nc};function sc(e){return Kt(e,oc)}var cc=typeof Reflect==`object`?Reflect:null,lc=cc&&typeof cc.apply==`function`?cc.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},uc=cc&&typeof cc.ownKeys==`function`?cc.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function dc(e){console&&console.warn&&console.warn(e)}var fc=Number.isNaN||function(e){return e!==e};function $(){$.init.call(this)}$.prototype._events=void 0,$.prototype._eventsCount=0,$.prototype._maxListeners=void 0;var pc=10;function mc(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty($,"defaultMaxListeners",{enumerable:!0,get:function(){return pc},set:function(e){if(typeof e!=`number`||e<0||fc(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);pc=e}}),$.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},$.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||fc(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function hc(e){return e._maxListeners===void 0?$.defaultMaxListeners:e._maxListeners}$.prototype.getMaxListeners=function(){return hc(this)},$.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r=e===`error`,i=this._events;if(i!==void 0)r&&=i.error===void 0;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=Error(`Unhandled error.`+(a?` (`+a.message+`)`:``));throw o.context=a,o}var s=i[e];if(s===void 0)return!1;if(typeof s==`function`)lc(s,this,t);else for(var c=s.length,l=xc(s,c),n=0;n<c;++n)lc(l[n],this,t);return!0};function gc(e,t,n,r){var i,a,o;if(mc(n),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]),o===void 0)
3o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),i=hc(e),i>0&&o.length>i&&!o.warned){o.warned=!0;var s=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);s.name=`MaxListenersExceededWarning`,s.emitter=e,s.type=t,s.count=o.length,dc(s)}return e}$.prototype.addListener=function(e,t){return gc(this,e,t,!1)},$.prototype.on=$.prototype.addListener,$.prototype.prependListener=function(e,t){return gc(this,e,t,!0)};function _c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function vc(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=_c.bind(r);return i.listener=n,r.wrapFn=i,i}$.prototype.once=function(e,t){return mc(t),this.on(e,vc(this,e,t)),this},$.prototype.prependOnceListener=function(e,t){return mc(t),this.prependListener(e,vc(this,e,t)),this},$.prototype.removeListener=function(e,t){var n,r,i,a,o;if(mc(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():Sc(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},$.prototype.off=$.prototype.removeListener,$.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function yc(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?Cc(i):xc(i,i.length)}$.prototype.listeners=function(e){return yc(this,e,!0)},$.prototype.rawListeners=function(e){return yc(this,e,!1)},$.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):bc.call(e,t)},$.prototype.listenerCount=bc;function bc(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}$.prototype.eventNames=function(){return this._eventsCount>0?uc(this._events):[]};function xc(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Sc(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Cc(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function wc(e,t){return t||={},new Promise(function(n,r){var i=new XMLHttpRequest,a=[],o=[],s={},c=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:c,headers:{keys:function(){return a},entries:function(){return o},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var l in i.open(t.method||`get`,e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,n){a.push(t=t.toLowerCase()),o.push([t,n]),s[t]=s[t]?s[t]+`,`+n:n}),n(c())},i.onerror=r,i.withCredentials=t.credentials==`include`,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)})}function Tc(){return typeof fetch==`function`?fetch:wc}function Ec(){return typeof EventSource==`function`?EventSource:void 0}var Dc=`visibilitychange`,Oc=`pagehide`,kc=`for visibilitychange and pagehide events.`,Ac=function(){function e(e,t,n,r){this.syncManager=e,this.settings=t,this.storage=n,this.serviceApi=r,this.flushData=this.flushData.bind(this),this.flushDataIfHidden=this.flushDataIfHidden.bind(this),this.fromImpressionsCollector=rt.bind(void 0,t.core.labelsEnabled)}return e.prototype.start=function(){this.settings.log.debug(25,[kc]),typeof document<`u`&&document.addEventListener&&document.addEventListener(
3Dc,this.flushDataIfHidden),typeof window<`u`&&window.addEventListener&&window.addEventListener(Oc,this.flushData)},e.prototype.stop=function(){this.settings.log.debug(26,[kc]),typeof document<`u`&&document.removeEventListener&&document.removeEventListener(Dc,this.flushDataIfHidden),typeof window<`u`&&window.removeEventListener&&window.removeEventListener(Oc,this.flushData)},e.prototype.flushData=function(){if(this.syncManager){var e=this.settings.urls,t=e.events,n=e.telemetry;if(jn(this.settings)){var r={sim:this.settings.sync.impressionsMode};this._flushData(t+`/testImpressions/beacon`,this.storage.impressions,this.serviceApi.postTestImpressionsBulk,this.fromImpressionsCollector,r),this._flushData(t+`/events/beacon`,this.storage.events,this.serviceApi.postEventsBulk),this._flushData(t+`/testImpressions/count/beacon`,this.storage.impressionCounts,this.serviceApi.postTestImpressionsCount,at),this._flushData(n+`/v1/keys/cs/beacon`,this.storage.uniqueKeys,this.serviceApi.postUniqueKeysBulkCs)}this.storage.telemetry&&this._flushData(n+`/v1/metrics/usage/beacon`,this.storage.telemetry,this.serviceApi.postMetricsUsage)}},e.prototype.flushDataIfHidden=function(){document.visibilityState===`hidden`&&this.flushData()},e.prototype._flushData=function(e,t,n,r,i){if(!t.isEmpty()){var a=r?r(t.pop()):t.pop();this._sendBeacon(e,a,i)||n(JSON.stringify(a)).catch(function(){}),this.settings.log.debug(125,[t.name])}},e.prototype._sendBeacon=function(e,t,n){if(typeof navigator<`u`&&navigator.sendBeacon){var r={entries:t,token:this.settings.core.authorizationKey,sdk:this.settings.version};n&&v(r,n);var i=JSON.stringify(r);try{return navigator.sendBeacon(e,i)}catch{return!1}}return!1},e}();function jc(){return typeof performance==`object`&&typeof performance.now==`function`?performance.now.bind(performance):Date.now}var Mc={getFetch:Tc,getEventSource:Ec,EventEmitter:$,now:jc()},Nc=Ac,Pc=Pn($r,Lr);function Fc(e){return e.storage.type===`LOCALSTORAGE`?Hi(e.storage):e.storage.__originalType===`LOCALSTORAGE`?cs:Fi}function Ic(e){var t={settings:e,platform:Mc,storageFactory:Fc(e),splitApiFactory:Pe,syncManagerFactory:Pc,sdkManagerFactory:Ea,sdkClientMethodFactory:$o,SignalListener:Nc,impressionsObserverFactory:ss,extraProps:function(e){return{UserConsent:Ls(e)}}};switch(e.mode){case de:t.splitApiFactory=void 0,t.syncManagerFactory=Gs,t.SignalListener=void 0}return t}function Lc(e,t){var n=Ic(sc(e));return t&&t(n),Fs(n)}var Rc=()=>{let t=i(`activeFeatureFlags`,()=>({})),n=d(`split-monitoring`,{featureFlags:{}}),{$device:r,$isSSRSafeRoute:o}=e(),s=e=>(t,n,r)=>{(!n?.featureFlagName||n.featureFlagName.toLowerCase().startsWith(`voll`))&&a[e](t,n?{...n}:void 0)},c=s(`warn`),u=s(`error`),f=(e,r)=>{r===p.CONTROL&&u(l.SPLIT_ERROR_NO_TREATMENT,{featureFlagName:e,treatment:r}),t.value[e]||(t.value[e]=r),n.value.featureFlags?.[e]||(n.value.featureFlags[e]=r)};return{activeFeatureFlags:t,initSplitMonitoring:e=>{n.value.splitKey||(n.value.splitKey=e),n.value.splitKey===e?Object.entries(t.value).forEach(([e,t])=>f(e,t)):(n.value.splitKey=e,n.value.featureFlags={})},splitError:u,splitMonitoring:n,splitWarn:c,updateFeatureFlag:f}},zc=`MacIntel`,Bc=({isMobile:e,isTablet:t})=>{let n=window.navigator.platform===zc&&window.navigator.maxTouchPoints>1;return t||n?_.TABLET:e?_.PHONE:_.DESKTOP},Vc=()=>{let a=u(`splitIoUserKey`,{httpOnly:!1,maxAge:o,secure:!0}),d=i(`splitIoUserKey`,()=>a.value),m=i(`splitManager`,()=>void 0),{activeFeatureFlags:_,initSplitMonitoring:v,splitError:y,splitWarn:b,updateFeatureFlag:x}=Rc(),S=r(),C=S.query[s.FEATURE]||``,w=S.query[s.TREATMENT]||``,T=S.query[s.DISABLED]||``,E=!!S.query._debug||``,D=n(()=>!!T||!!E||!!C),{$aie:O,$device:k,$splitClient:A,$trackSplitEvaluation:j}=e(),ee=A,M=()=>{if(!a.value){let e=f();a.value=e,d.value=e}return a.value||y(l.SPLIT_ERROR_KEY_EMPTY),a.value},N=async()=>{if(T)return;if(A)return y(l.SPLIT_ERROR_ALREADY_INITIALIZED),A;let{splitApiKey:e}=t().public;if(!e){y(l.SPLIT_ERROR_AUTHORIZATION_KEY_EMPTY);return}let n=M();if(!n)return;let r=Lc({core:{authorizationKey:e,key:n},startup:{readyTimeout:5}}),i=r.client();try{return await i.ready().catch(e=>{throw e}),m.value=r.manager(),D||v(d.value),i}
3catch(e){y(l.SPLIT_ERROR_INITIALIZE,{error:e,userKey:n})}},te=e=>{if(S.query[e]){let t=S.query[e];return j?.(e,t),x(e,t),t}if(C===e&&w){let t=w;return j?.(e,t),x(e,t),t}if(!A)return T||b(l.SPLIT_ERROR_CLIENT_OR_SDK_EMPTY,{featureFlagName:e}),p.OFF;if(!d.value)return b(l.SPLIT_ERROR_KEY_EMPTY,{featureFlagName:e}),p.OFF;let t={channel:c,mobileDevice:k.isMobile},n=ee.getTreatment?.(e,t);return D.value?_.value[e]=n:(j?.(e,n),x(e,n)),O?.addFeatureFlag(e,n),n},ne=(e,t)=>{let n=[...t,p.CONTROL],r=te(e);return n.includes(r)?r:p.CONTROL};return{createSplitKey:M,getMultiOptionTreatment:ne,getSplitTreatment:te,initClientSplit:N,isTreatmentActive:(e,t,n)=>ne(e,t)===n,isTreatmentOn:e=>te(e)===p.ON,splitIoUserKey:d,splitManager:m,trackSplitEvent:(e,t)=>{A&&ee.track(h,e,t,{[g]:Bc(k)})}}};export{p as i,Rc as n,m as r,Vc as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.