PageSourceSearch

https://insighttimer.com/static/js/8000.932fdbdf.chunk.js

js insighttimer.com collected 2026-09-24 08:26:59 UTC 61,681 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkinsight_timer=self.webpackChunkinsight_timer||[]).push([[8e3],{98e3:(e,t,n)=>{function r(e,t,n){for(let s=0;s<28;s+=7){const r=e>>>s,i=!(r>>>7==0&&0==t),o=255&(i?128|r:r);if(n.push(o),!i)return}const r=e>>>28&15|(7&t)<<4,i=!(t>>3==0);if(n.push(255&(i?128|r:r)),i){for(let e=3;e<31;e+=7){const r=t>>>e,i=!(r>>>7==0),s=255&(i?128|r:r);if(n.push(s),!i)return}n.push(t>>>31&1)}}n.r(t),n.d(t,{Closer:()=>Ft,Confidence:()=>Gt,Trackable:()=>Lt,Value:()=>he,pageViews:()=>$t,visitorIdentity:()=>qt,webVitals:()=>Zt});const i=4294967296;function s(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let r=0,s=0;function o(t,o){const a=Number(e.slice(t,o));s*=n,r=r*n+a,r>=i&&(s+=r/i|0,r%=i)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?c(r,s):a(r,s)}function o(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(i*t+e);const n=16777215&(e>>>24|t<<8),r=t>>16&65535;let s=(16777215&e)+6777216*n+6710656*r,o=n+8147497*r,a=2*r;const c=1e7;return s>=c&&(o+=Math.floor(s/c),s%=c),o>=c&&(a+=Math.floor(o/c),o%=c),a.toString()+l(o)+l(s)}function a(e,t){return{lo:0|e,hi:0|t}}function c(e,t){return t=~t,e?e=1+~e:t+=1,a(e,t)}const l=e=>{const t=String(e);return"0000000".slice(t.length)+t};function u(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}const h=E();function E(){const e=new DataView(new ArrayBuffer(8));if("function"===typeof BigInt&&"function"===typeof e.getBigInt64&&"function"===typeof e.getBigUint64&&"function"===typeof e.setBigInt64&&"function"===typeof e.setBigUint64&&("object"!=typeof process||"1"!=={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FEATURE_FLAGS:"production",REACT_APP_WEBAPP_HOST:"https://insighttimer.com",REACT_APP_BRANCH_API_KEY:"key_live_chyxR8sQGM9AEuhYZBE4PbngtvaSUG1K",REACT_APP_AGORA_APP_ID:"b5a051ef6de84cd387b676678b6f2128",REACT_APP_FIREBASE_apiKey:"AIzaSyBZ4bueqw6KXclXafSDk7eOy4QSH8gueIk",REACT_APP_FIREBASE_authDomain:"insight-timer-a1ac7.firebaseapp.com",REACT_APP_FIREBASE_databaseURL:"https://insight-timer-a1ac7.firebaseio.com",REACT_APP_FIREBASE_projectId:"insight-timer-a1ac7",REACT_APP_FIREBASE_storageBucket:"insight-timer-a1ac7.appspot.com",REACT_APP_FIREBASE_messagingSenderId:"966281705875",REACT_APP_FIREBASE_measurementId:"G-J9FKG1GVKZ",REACT_APP_FIREBASE_appId:"1:966281705875:web:40a5a541fa9603f4b9d066",REACT_APP_WEB_DOMAIN:"insighttimer.com",REACT_APP_API_HOST:"https://api.insighttimer.com",REACT_APP_PLAYLIST_IMAGE:"https://playlists.insighttimer.com",REACT_APP_PUBLISHER_IMAGE:"https://users.insighttimer.com",REACT_APP_LIBRARY_ITEM_IMAGE:"https://libraryitems.insighttimer.com",REACT_APP_LIBRARY_ITEM_AUDIO:"https://libraryaudio.insighttimer.com",REACT_APP_GROUP_API_HOST:"https://groups-api.insighttimer-api.net",REACT_APP_GROUP_STATIC_HOST:"https://groups.insighttimer.com",REACT_APP_FILTER_API_HOST:"https://filtering.insighttimer-api.net",REACT_APP_SITEMAP_HOST:"https://sitemap.insighttimer.com",REACT_APP_EVENT_HOST:"https://events.insighttimer.com",REACT_APP_FEATURED_LIST_API_HOST:"https://featured-lists.insighttimer.com",REACT_APP_EVENT_API_HOST:"https://events-api.insighttimer-api.net",REACT_APP_MARKETPLACE_API_HOST:"https://marketplace-api.insighttimer-api.net",REACT_APP_USER_HOST:"https://users.insighttimer.com",REACT_APP_TAGS_HOST:"https://tags.insighttimer.com",REACT_APP_STATS_HOST:"https://stats.insighttimer.com",REACT_APP_USER_API_HOST:"https://users-api.insighttimer-api.net",REACT_APP_FORUM_API_HOST:"https://forums-api.insighttimer-api.net",REACT_APP_SHARED_AUTH_API_HOST:"https://shared-auth-api.insighttimer.com",REACT_APP_FILE_HOST:"https://files.insighttimer.com",REACT_APP_EDITORIAL_HOST:"https://editorial-cards.insighttimer.com",REACT_APP_WORKSHOP_HOST:"https://workshops.insighttimer.com",REACT_APP_FRESHDESK_API:"https://freshdesk-support-api.insighttimer-api.net",REACT_APP_SUBSCRIPTION_API:"https://user-subscription-api.insighttimer-api.net",REACT_APP_STRIPE_PUBLIC_API_KEY:"pk_live_mPiJW3D4wpNDgWoLMa2aZ54y",REACT_APP_STRIPE_PLAN:"premium_annual",REACT_APP_TRIAL_CODE_0:"0D6pPYxUy7",REACT_APP_TRIAL_CODE_30:"7fmC8Uu4vG",REACT_APP_TRIAL_CODE_7:"7Dt2Uv3I9m",REACT_APP_TRIAL_CODE_365:"4ayU2GhBvl",REACT_APP_FACEBOOK_ID:"157891377582896",REACT_APP_STRIPE_SCRIPT_URL:"https://js.stripe.com/v3/",REACT_APP_ENABLE_NOTIFICATION:"false",REACT_APP_CHALLENGE_BANNER_EXPIRY_DATE:"2021-05-02T00:00:00",REACT_APP_RECAPTCHA_SITE_KEY:"6LcM7m0aAAAAAOUqm1X_l0z996munSio_fpaJHIb",REACT_APP_CONFIDENCE_CLIENT_SECRET:"DKVKot66kciZC88zsWqRWvRyvOXumODO",REACT_APP_SEARCH_API_HOST:"https://search.insighttimer-api.net",REACT_APP_GOOGLE_API_KEY:"AIzaSyA_nzfLvAwbNkI54gQkmUUUEw3h386SXjs",REACT_APP_ROLLBAR_ACCESS_TOKEN:"213086f0a378457587d2f9dfa163b19c",REACT_APP_ENABLE_VIDEO_ROUTE_PHASED_ROLLOUT:"true",REACT_APP_WEBAPP_VERSION:"v2.473.0"}.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),r=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const r="bigint"==typeof e?e:BigInt(e);if(r>n||r<t)throw new Error(`invalid int64: ${e}`);return r},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>i||t<r)throw new Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),f(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),_(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),f(e),s(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),_(e),s(e)),dec:(e,t)=>function(e,t){let n=a(e,t);const r=2147483648&n.hi;r&&(n=c(n.lo,n.hi));const i=o(n.lo,n.hi);return r?"-"+i:i}(e,t),uDec:(e,t)=>o(e,t)}}function f(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function _(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}const d=Symbol.for("@bufbuild/protobuf/text-encoding");var S;!function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(S||(S={}));const R=34028234663852886e22,g=-34028234663852886e22;class p{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){if(void 0==globalThis[d]){const e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[d]={encodeUtf8:t=>e.encode(t),decodeUtf8:e=>t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(z){return!1}}}}return globalThis[d]}().encodeUtf8;this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let t=new Uint8Array(e),n=0;for(let r=0;r<this.chunks.length;r++)t.set(this.chunks[r],n),n+=this.chunks[r].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(O(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return I(e),u(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){!function(e){if("string"==typeof e){const t=e;if(e=Number(e),Number.isNaN(e)&&"NaN"!==t)throw new Error("invalid float32: "+t)}else if("number"!=typeof e)throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>R||e<g))throw new Error("invalid float32: "+e)}(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){O(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){I(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return I(e),u(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=h.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=h.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=h.enc(e);return r(t.lo,t.hi,this.buf),this}sint64(e){const t=h.enc(e),n=t.hi>>31;return r(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){const t=h.uEnc(e);return r(t.lo,t.hi,this.buf),this}}function I(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int32: "+e)}function O(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint32: "+e)}var T,m=-1,A=function(e){addEventListener("pageshow",(function(t){t.persisted&&(m=t.timeStamp,e(t))}),!0)},D=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},N=function(){var e=D();return e&&e.activationStart||0},v=function(e,t){var n=D(),r="navigate";return m>=0?r="back-forward-cache":n&&(document.prerendering||N()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},C=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},b=function(e,t,n,r){var i,s;return function(o){t.value>=0&&(o||r)&&((s=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=s,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))}
1,P=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},w=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},L=-1,F=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},V=function(e){"hidden"===document.visibilityState&&L>-1&&(L="visibilitychange"===e.type?e.timeStamp:0,x())},U=function(){addEventListener("visibilitychange",V,!0),addEventListener("prerenderingchange",V,!0)},x=function(){removeEventListener("visibilitychange",V,!0),removeEventListener("prerenderingchange",V,!0)},k=function(){return L<0&&(L=F(),U(),A((function(){setTimeout((function(){L=F(),U()}),0)}))),{get firstHiddenTime(){return L}}},K=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},J=[1800,3e3],M=[.1,.25],B=function(e,t){t=t||{},function(e,t){t=t||{},K((function(){var n,r=k(),i=v("FCP"),s=C("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-N(),0),i.entries.push(e),n(!0)))}))}));s&&(n=b(e,i,J,t.reportAllChanges),A((function(r){i=v("FCP"),n=b(e,i,J,t.reportAllChanges),y((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))}(w((function(){var n,r=v("CLS",0),i=0,s=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=s[0],n=s[s.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,s.push(e)):(i=e.value,s=[e])}})),i>r.value&&(r.value=i,r.entries=s,n())},a=C("layout-shift",o);a&&(n=b(e,r,M,t.reportAllChanges),P((function(){o(a.takeRecords()),n(!0)})),A((function(){i=0,r=v("CLS",0),n=b(e,r,M,t.reportAllChanges),y((function(){return n()}))})),setTimeout(n,0))})))},G=(new Date,0),H=1/0,Y=0,j=function(e){e.forEach((function(e){e.interactionId&&(H=Math.min(H,e.interactionId),Y=Math.max(Y,e.interactionId),G=Y?(Y-H)/7+1:0)}))},W=function(){return T?G:performance.interactionCount||0},$=function(){"interactionCount"in performance||T||(T=C("event",j,{type:"event",buffered:!0,durationThreshold:0}))},Z=[200,500],z=0,q=function(){return W()-z},X=[],Q={},ee=function(e){var t=X[X.length-1],n=Q[e.interactionId];if(n||X.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};Q[r.id]=r,X.push(r)}X.sort((function(e,t){return t.latency-e.latency})),X.splice(10).forEach((function(e){delete Q[e.id]}))}},te=function(e,t){t=t||{},K((function(){var n;$();var r,i=v("INP"),s=function(e){e.forEach((function(e){e.interactionId&&ee(e),"first-input"===e.entryType&&!X.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&ee(e)}));var t,n=(t=Math.min(X.length-1,Math.floor(q()/50)),X[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=C("event",s,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=b(e,i,Z,t.reportAllChanges),o&&("PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),P((function(){s(o.takeRecords()),i.value<0&&q()>0&&(i.value=0,i.entries=[]),r(!0)})),A((function(){X=[],z=W(),i=v("INP"),r=b(e,i,Z,t.reportAllChanges)})))}))},ne=[2500,4e3],re={},ie=function(e,t){t=t||{},K((function(){var n,r=k(),i=v("LCP"),s=function(e){var t=e[e.length-1];t&&t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-N(),0),i.entries=[t],n())},o=C("largest-contentful-paint",s);if(o){n=b(e,i,ne,t.reportAllChanges);var a=w((function(){re[i.id]||(s(o.takeRecords()),o.disconnect(),re[i.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),P(a),A((function(r){i=v("LCP"),n=b(e,i,ne,t.reportAllChanges),y((function(){i.value=performance.now()-r.timeStamp,re[i.id]=!0,n(!0)}))}))}}))},se=[800,1800],oe=function e(t){document.prerendering?K((function(){return e(t)}
1)):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},ae=function(e,t){t=t||{};var n=v("TTFB"),r=b(e,n,se,t.reportAllChanges);oe((function(){var i=D();if(i){var s=i.responseStart;if(s<=0||s>performance.now())return;n.value=Math.max(s-N(),0),n.entries=[i],r(!0),A((function(){n=v("TTFB",0),(r=b(e,n,se,t.reportAllChanges))(!0)}))}}))};function ce(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var le=0;function ue(e){return"__private_"+le+++"_"+e}var he,Ee,fe,_e=ue("_state"),de=ue("_value");class Se{chain(e,t){return new Se(e,t)}get state(){return ce(this,_e)[_e]}then(e,t){let n=ce(this,de)[de],r=!1;switch(ce(this,_e)[_e]){case"PENDING":n=n.then(e,t);break;case"RESOLVED":if(e)try{n=e(n)}catch(i){n=i,r=!0}break;case"REJECTED":if(t)try{n=t(n)}catch(i){n=i,r=!0}}return this.chain(n,r)}catch(e){return this.then(void 0,e)}finally(e){return this.then((t=>(null==e||e(),t)),(t=>{throw null==e||e(),t}))}orSupply(e){if("RESOLVED"===ce(this,_e)[_e])return ce(this,de)[de];if("REJECTED"===ce(this,_e)[_e])throw ce(this,de)[de];return e()}orSuspend(){return this.orSupply((()=>{const e=new Error("Promise is not fulfilled."),t=ce(this,de)[de].then.bind(ce(this,de)[de]);throw Object.assign(e,{then:t})}))}orThrow(){return this.orSupply((()=>{throw new Error("Promise is not fulfilled.")}))}or(e){return this.orSupply((()=>e))}static resolve(e){return new Se(e)}static reject(e){return new Se(e,!0)}constructor(e,t){Object.defineProperty(this,_e,{writable:!0,value:void 0}),Object.defineProperty(this,de,{writable:!0,value:void 0}),ce(this,de)[de]=e,!function(e){return"object"===typeof e&&null!==e&&"then"in e&&"function"===typeof e.then}(e)?ce(this,_e)[_e]=t?"REJECTED":"RESOLVED":(ce(this,_e)[_e]="PENDING",e.then((e=>{ce(this,_e)[_e]="RESOLVED",ce(this,de)[de]=e}),(e=>{ce(this,_e)[_e]="REJECTED",ce(this,de)[de]=e})))}}class Re{get path(){return this.steps.reduce(((e,t)=>"string"===typeof t?e?`${e}.${t}`:t:`${e}[${t}]`),"")}get message(){let e;return this.expected?(e=`Expected ${this.expected}`,this.actual&&(e+=`, but found ${this.actual}`)):e=`Unexpected ${this.actual}`,this.steps.length&&(e+=`, at path '${this.path}'`),e}static hoist(e,t){Array.isArray(e)||(e=[e]);try{return t()}catch(n){throw n instanceof Re&&(n=new Re(n.expected,n.actual,[...e,...n.steps])),n}}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this.expected=e,this.actual=t,this.steps=n}}!function(e){const t=new Set(["number","string","boolean"]);function n(e,t){if(e===t)return!0;const i=r(e);return r(t)===i&&("Struct"===i?function(e,t){const r=Object.keys(e);if(Object.keys(t).length!==r.length)return!1;for(const i of r)if(!n(e[i],t[i]))return!1;return!0}(e,t):"List"===i&&function(e,t){const r=e.length;if(t.length!==r)return!1;for(let i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}(e,t))}function r(e){const t=typeof e;switch(t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return Array.isArray(e)?"List":"Struct"}throw new TypeError(`Invalid Value type "${t}"`)}function i(t){return"Struct"===e.getType(t)}function s(t){return"List"===e.getType(t)}function o(t,n){const r=e.getType(n);if(t!==r)throw new Re(t,r)}e.assertValue=function e(n){switch(typeof n){case"bigint":case"symbol":case"function":throw new Re("number | boolean | string | Struct | List",typeof n);case"object":if(null===n)throw new Re("number | boolean | string | Struct | List","null");if(Array.isArray(n)&&n.length>0){const e=r(n[0]);if(!t.has(e))throw new Re("number | boolean | string",e,[0]);for(let t=1;t<n.length;t++){const i=r(n[t]);if(i!==e)throw new Re(e,i,[t])}}for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&Re.hoist(t,(()=>e(n[t])));return}},e.clone=function e(t){if(i(t)){const n={};for(const r of Object.keys(t))n[r]=e(t[r]);return Object.freeze(n)}return s(t)?Object.freeze(t.map(e)):t},e.equal=n,e.getType=r,e.isStruct=i,e.isList=s,e.assertType=o,e.get=function(e){let t=e;const n=[];for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];for(const a of i.flatMap((e=>e.split("."))))Re.hoist(n,(()=>{o("Struct",t),t=t[a],n.push(a)}));return t},e.serialize=function(e){const t=new c;return t.writeValue(e),t.data},e.deserialize=function(e){return new l(e).readValue()};const a=new Uint16Array(4);class c{get data(){return this.buffer.join("")}writeValue(e){switch(r(e)){case"string":return this.writeString(e);case"number":return this.writeNumber(e);case"boolean":return this.writeBoolean(e);case"Struct":return this.writeStruct(e);case"List":return this.writeList(e)}}writeString(e){this.buffer.push(String.fromCharCode(0,e.length),e)}writeNumber(e){new DataView(a.buffer).setFloat64(0,e),this.buffer.push(String.fromCharCode(1,...a))}writeBoolean(e){this.buffer.push(String.fromCharCode(e?2:3))}writeList(e){this.buffer.push(String.fromCharCode(4,e.length));for(const t of e)this.writeValue(t)}writeStruct(e){const t=Object.keys(e).filter((t=>"undefined"!==typeof e[t]));t.sort(),this.buffer.push(String.fromCharCode(5,t.length));for(const n of t)this.buffer.push(String.fromCharCode(n.length),n),this.writeValue(e[
1n])}constructor(){this.buffer=[]}}class l{readValue(){switch(this.str.charCodeAt(this.pos)){case 0:return this.readString();case 1:return this.readNumber();case 2:return this.pos++,!0;case 3:return this.pos++,!1;case 4:return this.readList();case 5:return this.readStruct()}}readString(){return this.readType(0),this.readNakedString()}readNumber(){this.readType(1);for(let e=0;e<4;e++)a[e]=this.read();return new DataView(a.buffer).getFloat64(0)}readBoolean(){const e=this.read();if(2===e)return!0;if(3===e)return!1;throw new Error("Expected type 2|3 found $type} at pos "+(this.pos-1))}readList(){this.readType(4);const e=[];let t=this.read();for(;--t>=0;)e.push(this.readValue());return e}readStruct(){this.readType(5);const e={};let t=this.read();for(;--t>=0;){const t=this.readNakedString(),n=this.readValue();e[t]=n}return e}read(){if(this.pos>=this.str.length)throw new Error("Read past end of data");return this.str.charCodeAt(this.pos++)}readType(e){const t=this.read();if(t!==e)throw new Error(`Expected type ${e} found ${t} at pos ${this.pos-1}`)}readNakedString(){const e=this.read(),t=this.pos;if(this.pos+=e,this.pos>this.str.length)throw new Error("Read past end of data");return this.str.substring(t,this.pos)}constructor(e){this.pos=0,this.str=e}}}(he||(he={}));class ge{get(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.flatMap((e=>e.split("."))).length?this:ge.UNDEFINED}constructor(e){this.typeName=e}}function pe(e){switch(e){case 0:case"RESOLVE_REASON_UNSPECIFIED":return Ee.RESOLVE_REASON_UNSPECIFIED;case 1:case"RESOLVE_REASON_MATCH":return Ee.RESOLVE_REASON_MATCH;case 2:case"RESOLVE_REASON_NO_SEGMENT_MATCH":return Ee.RESOLVE_REASON_NO_SEGMENT_MATCH;case 3:case"RESOLVE_REASON_NO_TREATMENT_MATCH":return Ee.RESOLVE_REASON_NO_TREATMENT_MATCH;case 4:case"RESOLVE_REASON_FLAG_ARCHIVED":return Ee.RESOLVE_REASON_FLAG_ARCHIVED;case 5:case"RESOLVE_REASON_TARGETING_KEY_ERROR":return Ee.RESOLVE_REASON_TARGETING_KEY_ERROR;case 6:case"RESOLVE_REASON_ERROR":return Ee.RESOLVE_REASON_ERROR;default:return Ee.UNRECOGNIZED}}function Ie(e){switch(e){case 0:case"SDK_ID_UNSPECIFIED":return fe.SDK_ID_UNSPECIFIED;case 1:case"SDK_ID_JAVA_PROVIDER":return fe.SDK_ID_JAVA_PROVIDER;case 2:case"SDK_ID_KOTLIN_PROVIDER":return fe.SDK_ID_KOTLIN_PROVIDER;case 3:case"SDK_ID_SWIFT_PROVIDER":return fe.SDK_ID_SWIFT_PROVIDER;case 4:case"SDK_ID_JS_WEB_PROVIDER":return fe.SDK_ID_JS_WEB_PROVIDER;case 5:case"SDK_ID_JS_SERVER_PROVIDER":return fe.SDK_ID_JS_SERVER_PROVIDER;case 6:case"SDK_ID_PYTHON_PROVIDER":return fe.SDK_ID_PYTHON_PROVIDER;case 7:case"SDK_ID_GO_PROVIDER":return fe.SDK_ID_GO_PROVIDER;case 8:case"SDK_ID_RUBY_PROVIDER":return fe.SDK_ID_RUBY_PROVIDER;case 9:case"SDK_ID_RUST_PROVIDER":return fe.SDK_ID_RUST_PROVIDER;case 10:case"SDK_ID_JAVA_CONFIDENCE":return fe.SDK_ID_JAVA_CONFIDENCE;case 11:case"SDK_ID_KOTLIN_CONFIDENCE":return fe.SDK_ID_KOTLIN_CONFIDENCE;case 12:case"SDK_ID_SWIFT_CONFIDENCE":return fe.SDK_ID_SWIFT_CONFIDENCE;case 13:case"SDK_ID_JS_CONFIDENCE":return fe.SDK_ID_JS_CONFIDENCE;case 14:case"SDK_ID_PYTHON_CONFIDENCE":return fe.SDK_ID_PYTHON_CONFIDENCE;case 15:case"SDK_ID_GO_CONFIDENCE":return fe.SDK_ID_GO_CONFIDENCE;default:return fe.UNRECOGNIZED}}!function(e){class t extends e{assertAssignsTo(e){he.assertType("Struct",e);for(const t of Object.keys(e)){const n=this.fields[t];Re.hoist(t,(()=>{n?n.assertAssignsTo(e[t]):he.assertType("undefined",e)}))}}get(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i=n.flatMap((e=>e.split(".")));if(0===i.length)return this;const[s,...o]=i,a=this.fields[s];return Re.hoist(s,(()=>a?a.get(...o):e.UNDEFINED))}constructor(e){super("Struct"),this.fields=e}}class n extends e{assertAssignsTo(e){he.assertType("List",e);for(let t=0;t<e.length;t++)Re.hoist(t,(()=>{this.itemSchema.assertAssignsTo(e[t])}))}constructor(e){super("List"),this.itemSchema=e}}class r extends e{assertAssignsTo(e){he.assertType(this.typeName,e)}}function i(e){return new t(e)}function s(e){return new n(e)}e.ANY=new class extends e{get(){return e.ANY}assertAssignsTo(e){}constructor(){super("undefined")}},e.UNDEFINED=new r("undefined"),e.BOOLEAN=new r("boolean"),e.STRING=new r("string"),e.DOUBLE=new r("number"),e.INTEGER=new class extends r{assertAssignsTo(e){if(he.assertType("number",e),!Number.isInteger(e))throw new Re("Integer",String(e))}constructor(){super("number")}},e.struct=i,e.list=s,e.parse=function t(n){if(n.boolSchema)return e.BOOLEAN;if(n.doubleSchema)return e.DOUBLE;
1if(n.intSchema)return e.INTEGER;if(n.stringSchema)return e.STRING;if(n.listSchema){if(!n.listSchema.elementSchema)throw new TypeError("ListSchema must specify an elementSchema");return s(t(n.listSchema.elementSchema))}if(n.structSchema)return i(function(e,t){const n={};for(const r of Object.keys(e))n[r]=t(e[r],r);return n}(n.structSchema.schema,t));throw new TypeError(`Unknown schema type ${n}`)}}(ge||(ge={})),function(e){e[e.RESOLVE_REASON_UNSPECIFIED=0]="RESOLVE_REASON_UNSPECIFIED",e[e.RESOLVE_REASON_MATCH=1]="RESOLVE_REASON_MATCH",e[e.RESOLVE_REASON_NO_SEGMENT_MATCH=2]="RESOLVE_REASON_NO_SEGMENT_MATCH",e[e.RESOLVE_REASON_NO_TREATMENT_MATCH=3]="RESOLVE_REASON_NO_TREATMENT_MATCH",e[e.RESOLVE_REASON_FLAG_ARCHIVED=4]="RESOLVE_REASON_FLAG_ARCHIVED",e[e.RESOLVE_REASON_TARGETING_KEY_ERROR=5]="RESOLVE_REASON_TARGETING_KEY_ERROR",e[e.RESOLVE_REASON_ERROR=6]="RESOLVE_REASON_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Ee||(Ee={})),function(e){e[e.SDK_ID_UNSPECIFIED=0]="SDK_ID_UNSPECIFIED",e[e.SDK_ID_JAVA_PROVIDER=1]="SDK_ID_JAVA_PROVIDER",e[e.SDK_ID_KOTLIN_PROVIDER=2]="SDK_ID_KOTLIN_PROVIDER",e[e.SDK_ID_SWIFT_PROVIDER=3]="SDK_ID_SWIFT_PROVIDER",e[e.SDK_ID_JS_WEB_PROVIDER=4]="SDK_ID_JS_WEB_PROVIDER",e[e.SDK_ID_JS_SERVER_PROVIDER=5]="SDK_ID_JS_SERVER_PROVIDER",e[e.SDK_ID_PYTHON_PROVIDER=6]="SDK_ID_PYTHON_PROVIDER",e[e.SDK_ID_GO_PROVIDER=7]="SDK_ID_GO_PROVIDER",e[e.SDK_ID_RUBY_PROVIDER=8]="SDK_ID_RUBY_PROVIDER",e[e.SDK_ID_RUST_PROVIDER=9]="SDK_ID_RUST_PROVIDER",e[e.SDK_ID_JAVA_CONFIDENCE=10]="SDK_ID_JAVA_CONFIDENCE",e[e.SDK_ID_KOTLIN_CONFIDENCE=11]="SDK_ID_KOTLIN_CONFIDENCE",e[e.SDK_ID_SWIFT_CONFIDENCE=12]="SDK_ID_SWIFT_CONFIDENCE",e[e.SDK_ID_JS_CONFIDENCE=13]="SDK_ID_JS_CONFIDENCE",e[e.SDK_ID_PYTHON_CONFIDENCE=14]="SDK_ID_PYTHON_CONFIDENCE",e[e.SDK_ID_GO_CONFIDENCE=15]="SDK_ID_GO_CONFIDENCE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(fe||(fe={}));const Oe={fromJSON:e=>({id:Te(e.id)?Ie(e.id):void 0,customId:Te(e.customId)?globalThis.String(e.customId):void 0,version:Te(e.version)?globalThis.String(e.version):""}),toJSON(e){const t={};return void 0!==e.id&&(t.id=function(e){switch(e){case fe.SDK_ID_UNSPECIFIED:return"SDK_ID_UNSPECIFIED";case fe.SDK_ID_JAVA_PROVIDER:return"SDK_ID_JAVA_PROVIDER";case fe.SDK_ID_KOTLIN_PROVIDER:return"SDK_ID_KOTLIN_PROVIDER";case fe.SDK_ID_SWIFT_PROVIDER:return"SDK_ID_SWIFT_PROVIDER";case fe.SDK_ID_JS_WEB_PROVIDER:return"SDK_ID_JS_WEB_PROVIDER";case fe.SDK_ID_JS_SERVER_PROVIDER:return"SDK_ID_JS_SERVER_PROVIDER";case fe.SDK_ID_PYTHON_PROVIDER:return"SDK_ID_PYTHON_PROVIDER";case fe.SDK_ID_GO_PROVIDER:return"SDK_ID_GO_PROVIDER";case fe.SDK_ID_RUBY_PROVIDER:return"SDK_ID_RUBY_PROVIDER";case fe.SDK_ID_RUST_PROVIDER:return"SDK_ID_RUST_PROVIDER";case fe.SDK_ID_JAVA_CONFIDENCE:return"SDK_ID_JAVA_CONFIDENCE";case fe.SDK_ID_KOTLIN_CONFIDENCE:return"SDK_ID_KOTLIN_CONFIDENCE";case fe.SDK_ID_SWIFT_CONFIDENCE:return"SDK_ID_SWIFT_CONFIDENCE";case fe.SDK_ID_JS_CONFIDENCE:return"SDK_ID_JS_CONFIDENCE";case fe.SDK_ID_PYTHON_CONFIDENCE:return"SDK_ID_PYTHON_CONFIDENCE";case fe.SDK_ID_GO_CONFIDENCE:return"SDK_ID_GO_CONFIDENCE";case fe.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(e.id)),void 0!==e.customId&&(t.customId=e.customId),""!==e.version&&(t.version=e.version),t}};function Te(e){return null!==e&&void 0!==e}var me;!function(e){e.ready=function(e,t,n){return new Ae(e,t,n)},e.failed=function(e,t,n){return new De(e,t,n)}}(me||(me={}));class Ae{evaluate(e,t){try{const[n,...r]=e.split("."),i=this.flags.get(n);if(!i)return{reason:"ERROR",value:t,errorCode:"FLAG_NOT_FOUND",errorMessage:`Flag "${n}" not found`};const s=i.reason;if("ERROR"===s)throw new Error("Unknown resolve error");
1if(i.shouldApply&&this.applier&&(null==this.applier||this.applier.call(this,n)),"MATCH"!==s)return{reason:s,value:t};const o=Re.hoist(n,(()=>he.get(i.value,...r))),a=i.schema.get(...r);return Re.hoist(["defaultValue",...r],(()=>{a.assertAssignsTo(t)})),{reason:s,value:o,variant:i.variant}}catch(r){var n;return{reason:"ERROR",value:t,errorCode:r instanceof Re?"TYPE_MISMATCH":"GENERAL",errorMessage:null!=(n=r.message)?n:"Unknown error"}}}constructor(e,t,n){this.flags=new Map,this.context=e,this.applier=n;for(const{flag:r,variant:i,value:s,reason:o,flagSchema:a,shouldApply:c}of t.resolvedFlags){const e=r.slice(6),t=a?ge.parse({structSchema:a}):ge.ANY;this.flags.set(e,{schema:t,value:s,variant:i,reason:Ne(o),shouldApply:c})}this.resolveToken=function(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");const t=[];return e.forEach((e=>{t.push(globalThis.String.fromCharCode(e))})),globalThis.btoa(t.join(""))}(t.resolveToken)}}Ae.prototype.state="READY";class De{evaluate(e,t){return{reason:"ERROR",value:t,errorCode:this.code,errorMessage:this.message}}constructor(e,t,n){this.context=e,this.code=t,this.message=n}}function Ne(e){switch(e){case Ee.RESOLVE_REASON_UNSPECIFIED:return"UNSPECIFIED";case Ee.RESOLVE_REASON_MATCH:return"MATCH";case Ee.RESOLVE_REASON_NO_SEGMENT_MATCH:return"NO_SEGMENT_MATCH";case Ee.RESOLVE_REASON_NO_TREATMENT_MATCH:return"NO_TREATMENT_MATCH";case Ee.RESOLVE_REASON_FLAG_ARCHIVED:return"FLAG_ARCHIVED";case Ee.RESOLVE_REASON_TARGETING_KEY_ERROR:return"TARGETING_KEY_ERROR";case Ee.RESOLVE_REASON_ERROR:return"ERROR";default:return"UNSPECIFIED"}}function ve(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(l){return void n(l)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ce(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){ve(s,r,i,o,a,"next",e)}function a(e){ve(s,r,i,o,a,"throw",e)}o(void 0)}))}}function be(){return be=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},be.apply(this,arguments)}De.prototype.state="ERROR";class ye extends Error{}class Pe extends ye{constructor(){super("Request timed out")}}class we{compose(e){const t=this.impl;return this.impl=t?n=>t(e(n)):e,this}timeout(e){return this.compose((t=>n=>{const[r,i]=function(){const e=new AbortController;function t(){e.abort(this.reason)}for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(const s of r)s&&s.addEventListener("abort",t);return[e.signal,e.abort.bind(e)]}(n.signal),s=setTimeout((()=>{i(new Pe)}),e);return t(be({},n,{signal:r})).finally((()=>{clearTimeout(s)}))}))}rejectNotOk(){return this.rejectOn((e=>!e.ok))}rejectOn(e){return this.compose((t=>n=>t(n).then((t=>{if(e(t))throw new ye(`${t.status}: ${t.statusText}`);return t}))))}limitPending(e){let t=0;return this.compose((n=>r=>t>=e?Promise.reject(new ye("Number of pending requests exceeded")):(t++,n(r).finally((()=>{t--})))))}rateLimit(e){let{maxTokens:t=e,initialTokens:n=e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe(e>0,"tokenFillRate must be positive");let r=Number.NEGATIVE_INFINITY,i=n,s=Promise.resolve();return this.compose((n=>o=>(s=s.catch((()=>{})).then(Ce((function*(){!function(){const n=Date.now();if(Number.isFinite(r)&&i<t){const s=(n-r)/1e3;i=Math.min(t,i+s*e)}r=n}(),i<1&&(yield Le((1-i)/e*1e3,o.signal))}))),s.then((()=>(i--,n(o)))))))}retry(){let{maxRetries:e=Number.POSITIVE_INFINITY,delay:t=0,maxDelay:n=Number.POSITIVE_INFINITY,backoff:r=2,jitter:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fe(e>=0,"maxRetries must be larger or equal to zero"),this.compose((s=>Ce((function*(o){let a=0;const c=Ce((function*(l){var u;if(null==(u=o.signal)?void 0:u.aborted)throw o.signal.reason;if(a>=e)throw l;const h=1+2*Math.random()*i-i;return yield Le(h*Math.min(n,t*Math.pow(r,a)),o.signal),a++,s(o).catch(c)}));return s(o).catch(c)}))))}modifyRequest(e){return this.compose((t=>Ce((function*(n){return t(be({},n,yield e(n)))}))))}route(e,t){const n=t.impl;return this.compose((t=>r=>n&&e(r.url)?n(t)(r):t(r)))}build(e){const t=t=>{var{url:n}=t,r=function(e,t){if(null==e)return{};var n,r,i={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(t,["url"]);
1return e(new Request(n,r))},n=this.impl?this.impl(t):t;return(e,t)=>n(be({url:new URL(e).toString()},t))}}function Le(e,t){return e<=0?Promise.resolve():new Promise(((n,r)=>{if(t){const e=()=>r(t.reason);if(t.aborted)return void e();t.addEventListener("abort",e)}setTimeout(n,e)}))}function Fe(e,t){if(!e)throw new TypeError(t)}const Ve={fromJSON:e=>({seconds:Ue(e.seconds)?globalThis.Number(e.seconds):0,nanos:Ue(e.nanos)?globalThis.Number(e.nanos):0}),toJSON(e){const t={};return 0!==e.seconds&&(t.seconds=Math.round(e.seconds)),0!==e.nanos&&(t.nanos=Math.round(e.nanos)),t}};function Ue(e){return null!==e&&void 0!==e}const xe={fromJSON:e=>({structSchema:He(e.structSchema)?ke.fromJSON(e.structSchema):void 0,listSchema:He(e.listSchema)?Ge.fromJSON(e.listSchema):void 0,intSchema:He(e.intSchema)?Je.fromJSON(e.intSchema):void 0,doubleSchema:He(e.doubleSchema)?Ke.fromJSON(e.doubleSchema):void 0,stringSchema:He(e.stringSchema)?Me.fromJSON(e.stringSchema):void 0,boolSchema:He(e.boolSchema)?Be.fromJSON(e.boolSchema):void 0}),toJSON(e){const t={};return void 0!==e.structSchema&&(t.structSchema=ke.toJSON(e.structSchema)),void 0!==e.listSchema&&(t.listSchema=Ge.toJSON(e.listSchema)),void 0!==e.intSchema&&(t.intSchema=Je.toJSON(e.intSchema)),void 0!==e.doubleSchema&&(t.doubleSchema=Ke.toJSON(e.doubleSchema)),void 0!==e.stringSchema&&(t.stringSchema=Me.toJSON(e.stringSchema)),void 0!==e.boolSchema&&(t.boolSchema=Be.toJSON(e.boolSchema)),t}},ke={fromJSON(e){return{schema:(t=e.schema,"object"===typeof t&&null!==t?Object.entries(e.schema).reduce(((e,t)=>{let[n,r]=t;return e[n]=xe.fromJSON(r),e}),{}):{})};var t},toJSON(e){const t={};if(e.schema){const n=Object.entries(e.schema);n.length>0&&(t.schema={},n.forEach((e=>{let[n,r]=e;t.schema[n]=xe.toJSON(r)})))}return t}},Ke={fromJSON:e=>({}),toJSON:e=>({})},Je={fromJSON:e=>({}),toJSON:e=>({})},Me={fromJSON:e=>({}),toJSON:e=>({})},Be={fromJSON:e=>({}),toJSON:e=>({})},Ge={fromJSON:e=>({elementSchema:He(e.elementSchema)?xe.fromJSON(e.elementSchema):void 0}),toJSON(e){const t={};return void 0!==e.elementSchema&&(t.elementSchema=xe.toJSON(e.elementSchema)),t}};function He(e){return null!==e&&void 0!==e}const Ye={fromJSON:e=>({flags:globalThis.Array.isArray(null==e?void 0:e.flags)?e.flags.map((e=>globalThis.String(e))):[],evaluationContext:Qe(e.evaluationContext)?e.evaluationContext:void 0,clientSecret:et(e.clientSecret)?globalThis.String(e.clientSecret):"",apply:!!et(e.apply)&&globalThis.Boolean(e.apply),sdk:et(e.sdk)?Oe.fromJSON(e.sdk):void 0}),toJSON(e){var t;const n={};return(null==(t=e.flags)?void 0:t.length)&&(n.flags=e.flags),void 0!==e.evaluationContext&&(n.evaluationContext=e.evaluationContext),""!==e.clientSecret&&(n.clientSecret=e.clientSecret),!1!==e.apply&&(n.apply=e.apply),void 0!==e.sdk&&(n.sdk=Oe.toJSON(e.sdk)),n}},je={fromJSON:e=>({resolvedFlags:globalThis.Array.isArray(null==e?void 0:e.resolvedFlags)?e.resolvedFlags.map((e=>Ze.fromJSON(e))):[],resolveToken:et(e.resolveToken)?ze(e.resolveToken):new Uint8Array(0),resolveId:et(e.resolveId)?globalThis.String(e.resolveId):""}),toJSON(e){var t;const n={};return(null==(t=e.resolvedFlags)?void 0:t.length)&&(n.resolvedFlags=e.resolvedFlags.map((e=>Ze.toJSON(e)))),0!==e.resolveToken.length&&(n.resolveToken=qe(e.resolveToken)),""!==e.resolveId&&(n.resolveId=e.resolveId),n}},We={fromJSON:e=>({flags:globalThis.Array.isArray(null==e?void 0:e.flags)?e.flags.map((e=>$e.fromJSON(e))):[],clientSecret:et(e.clientSecret)?globalThis.String(e.clientSecret):"",resolveToken:et(e.resolveToken)?ze(e.resolveToken):new Uint8Array(0),sendTime:et(e.sendTime)?Xe(e.sendTime):void 0,sdk:et(e.sdk)?Oe.fromJSON(e.sdk):void 0}),toJSON(e){var t;const n={};return(null==(t=e.flags)?void 0:t.length)&&(n.flags=e.flags.map((e=>$e.toJSON(e)))),""!==e.clientSecret&&(n.clientSecret=e.clientSecret),0!==e.resolveToken.length&&(n.resolveToken=qe(e.resolveToken)),void 0!==e.sendTime&&(n.sendTime=e.sendTime.toISOString()),void 0!==e.sdk&&(n.sdk=Oe.toJSON(e.sdk)),n}},$e={fromJSON:e=>({flag:et(e.flag)?globalThis.String(e.flag):"",applyTime:et(e.applyTime)?Xe(e.applyTime):void 0}),toJSON(e){const t={};return""!==e.flag&&(t.flag=e.flag),void 0!==e.applyTime&&(t.applyTime=e.applyTime.toISOString()),t}},Ze={fromJSON:e=>({flag:et(e.flag)?globalThis.String(e.flag):"",variant:et(e.variant)?globalThis.String(e.variant):"",value:Qe(e.value)?e.value:void 0,flagSchema:et(e.flagSchema)?ke.fromJSON(e.flagSchema):void 0,reason:et(e.reason)?pe(e.reason):0,shouldApply:!!et(e.shouldApply)&&globalThis.Boolean(e.shouldApply)}),toJSON(e){const t={};return""!==e.flag&&(t.flag=e.flag),""!==e.variant&&(t.variant=e.variant),void 0!==e.value&&(t.value=e.value),void 0!==e.flagSchema&&(t.flagSchema=ke.toJSON(e.flagSchema)),0!==e.reason&&(t.reason=function(e){switch(e){case Ee.RESOLVE_REASON_UNSPECIFIED:return"RESOLVE_REASON_UNSPECIFIED";case Ee.RESOLVE_REASON_MATCH:return"RESOLVE_REASON_MATCH";case Ee.RESOLVE_REASON_NO_SEGMENT_MATCH:return"RESOLVE_REASON_NO_SEGMENT_MATCH";case Ee.RESOLVE_REASON_NO_TREATMENT_MATCH:return"RESOLVE_REASON_NO_TREATMENT_MATCH";case Ee.RESOLVE_REASON_FLAG_ARCHIVED:return"RESOLVE_REASON_FLAG_ARCHIVED";case Ee.RESOLVE_REASON_TARGETING_KEY_ERROR:return"RESOLVE_REASON_TARGETING_KEY_ERROR";case Ee.RESOLVE_REASON_ERROR:return"RESOLVE_REASON_ERROR";case Ee.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(e.reason)),!1!==e.shouldApply&&(t.shouldApply=e.shouldApply),t}};function ze(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{const t=globalThis.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}}function qe(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{const t=[];return e.forEach((e=>{t.push(globalThis.String.fromCharCode(e))})),globalThis.btoa(t.join(""))}}function Xe(e){return e instanceof globalThis.Date?e:"string"===typeof e?new globalThis.Date(e):function(e){let t=1e3*(e.seconds||0);return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}(Ve.fromJSON(e))}function Qe(e){return"object"===typeof e&&null!==e}function et(e){return null!==e&&void 0!==e}var tt,nt,rt;function it(e){switch(e){case 0:case"PLATFORM_UNSPECIFIED":return tt.PLATFORM_UNSPECIFIED;case 4:case"PLATFORM_JS_WEB":return tt.PLATFORM_JS_WEB;case 5:case"PLATFORM_JS_SERVER":return tt.PLATFORM_JS_SERVER;default:return tt.UNRECOGNIZED}}function st(e){switch(e){case 0:case"LIBRARY_UNSPECIFIED":return nt.LIBRARY_UNSPECIFIED;case 1:case"LIBRARY_CONFIDENCE":return nt.LIBRARY_CONFIDENCE;case 2:case"LIBRARY_OPEN_FEATURE":return nt.LIBRARY_OPEN_FEATURE;case 3:case"LIBRARY_REACT":return nt.LIBRARY_REACT;default:return nt.UNRECOGNIZED}}function ot(e){switch(e){case 0:case"TRACE_ID_UNSPECIFIED":return rt.TRACE_ID_UNSPECIFIED;case 1:case"TRACE_ID_RESOLVE_LATENCY":return rt.TRACE_ID_RESOLVE_LATENCY;case 2:case"TRACE_ID_STALE_FLAG":return rt.TRACE_ID_STALE_FLAG;case 3:case"TRACE_ID_FLAG_TYPE_MISMATCH":return rt.TRACE_ID_FLAG_TYPE_MISMATCH;case 4:case"TRACE_ID_WITH_CONTEXT":return rt.TRACE_ID_WITH_CONTEXT;default:return rt.UNRECOGNIZED}}!function(e){e[e.PLATFORM_UNSPECIFIED=0]="PLATFORM_UNSPECIFIED",e[e.PLATFORM_JS_WEB=4]="PLATFORM_JS_WEB",e[e.PLATFORM_JS_SERVER=5]="PLATFORM_JS_SERVER",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(tt||(tt={})),function(e){e[e.LIBRARY_UNSPECIFIED=0]="LIBRARY_UNSPECIFIED",e[e.LIBRARY_CONFIDENCE=1]="LIBRARY_CONFIDENCE",e[e.LIBRARY_OPEN_FEATURE=2]="LIBRARY_OPEN_FEATURE",e[e.LIBRARY_REACT=3]="LIBRARY_REACT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(nt||(nt={})),function(e){e[e.TRACE_ID_UNSPECIFIED=0]="TRACE_ID_UNSPECIFIED",e[e.TRACE_ID_RESOLVE_LATENCY=1]="TRACE_ID_RESOLVE_LATENCY",e[e.TRACE_ID_STALE_FLAG=2]="TRACE_ID_STALE_FLAG",e[e.TRACE_ID_FLAG_TYPE_MISMATCH=3]="TRACE_ID_FLAG_TYPE_MISMATCH",e[e.TRACE_ID_WITH_CONTEXT=4]="TRACE_ID_WITH_CONTEXT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(rt||(rt={}));const at={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new p;for(const n of e.libraryTraces)ct.encode(n,t.uint32(10).fork()).join();return 0!==e.platform&&t.uint32(16).int32(e.platform),t},fromJSON:e=>({libraryTraces:globalThis.Array.isArray(null==e?void 0:e.libraryTraces)?e.libraryTraces.map((e=>ct.fromJSON(e))):[],platform:ut(e.platform)?it(e.platform):0}),toJSON(e){var t;const n={};return(null==(t=e.libraryTraces)?void 0:t.length)&&(n.libraryTraces=e.libraryTraces.map((e=>ct.toJSON(e)))),0!==e.platform&&(n.platform=function(e){switch(e){case tt.PLATFORM_UNSPECIFIED:return"PLATFORM_UNSPECIFIED";case tt.PLATFORM_JS_WEB:return"PLATFORM_JS_WEB";case tt.PLATFORM_JS_SERVER:return"PLATFORM_JS_SERVER";case tt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(e.platform)),n}},ct={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new p;0!==e.library&&t.uint32(8).int32(e.library),""!==e.libraryVersion&&t.uint32(18).string(e.libraryVersion);for(const n of e.traces)lt.encode(n,t.uint32(26).fork()).join();return t},fromJSON:e=>({library:ut(e.library)?st(e.library):0,libraryVersion:ut(e.libraryVersion)?globalThis.String(e.libraryVersion):"",traces:globalThis.Array.isArray(null==e?void 0:e.traces)?e.traces.map((e=>lt.fromJSON(e))):[]}),toJSON(e){var t;const n={};return 0!==e.library&&(n.library=function(e){switch(e){case nt.LIBRARY_UNSPECIFIED:return"LIBRARY_UNSPECIFIED";case nt.LIBRARY_CONFIDENCE:return"LIBRARY_CONFIDENCE";case nt.LIBRARY_OPEN_FEATURE:return"LIBRARY_OPEN_FEATURE";case nt.LIBRARY_REACT:return"LIBRARY_REACT";case nt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(e.library)),""!==e.libraryVersion&&(n.libraryVersion=e.libraryVersion),(null==(t=e.traces)?void 0:t.length)&&(n.traces=e.traces.map((e=>lt.toJSON(e)))),n}},lt={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new p;return 0!==e.id&&t.uint32(8).int32(e.id),void 0!==e.millisecondDuration&&t.uint32(16).uint64(e.millisecondDuration),t},fromJSON:e=>({id:ut(e.id)?ot(e.id):0,millisecondDuration:ut(e.millisecondDuration)?globalThis.Number(e.millisecondDuration):void 0}),toJSON(e){const t={};return 0!==e.id&&(t.id=function(e){switch(e){case rt.TRACE_ID_UNSPECIFIED:return"TRACE_ID_UNSPECIFIED";case rt.TRACE_ID_RESOLVE_LATENCY:return"TRACE_ID_RESOLVE_LATENCY";case rt.TRACE_ID_STALE_FLAG:return"TRACE_ID_STALE_FLAG";case rt.TRACE_ID_FLAG_TYPE_MISMATCH:return"TRACE_ID_FLAG_TYPE_MISMATCH";case rt.TRACE_ID_WITH_CONTEXT:return"TRACE_ID_WITH_CONTEXT";case rt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(e.id)),void 0!==e.millisecondDuration&&(t.millisecondDuration=Math.round(e.millisecondDuration)),t}};function ut(e){return null!==e&&void 0!==e}function ht(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(l){return void n(l)}a.done?t(c):Promise.resolve(c).then(r,i)}function Et(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){ht(s,r,i,o,a,"next",e)}function a(e){ht(s,r,i,o,a,"throw",e)}o(void 0)}))}}function ft(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var _t=0;function dt(e){return"__private_"+_t+++"_"+e}function St(){return St=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},St.apply(this,arguments)}const Rt="flags/",gt=new Set([408,502,503,504]);
1class pt extends Error{constructor(e,t){super(t),this.code=e}}var It=dt("_context"),Ot=dt("_controller");class Tt extends Se{get signal(){return ft(this,Ot)[Ot].signal}chain(e,t){return new Tt(e,ft(this,It)[It],ft(this,Ot)[Ot],t)}get context(){return ft(this,It)[It]}abort(){ft(this,Ot)[Ot].abort()}then(e,t){return super.then(e,t)}catch(e){return super.catch(e)}finally(e){return super.finally(e)}static create(e,t){const n=new AbortController;return new Tt(t(n.signal),e,n)}constructor(e,t,n,r){super(e,r),Object.defineProperty(this,It,{writable:!0,value:void 0}),Object.defineProperty(this,Ot,{writable:!0,value:void 0}),ft(this,It)[It]=t,ft(this,Ot)[Ot]=n}}class mt{resolve(e,t){const n={clientSecret:this.clientSecret,evaluationContext:e,apply:!1,sdk:this.sdk,flags:t.map((e=>Rt+e))};return Tt.create(e,(t=>{const r=function(e,t,n){const r=new AbortController,i=setTimeout((()=>r.abort(n)),t);"object"===typeof i&&i.unref();return e.addEventListener("abort",(()=>{clearTimeout(i),r.abort(e.reason)})),r.signal}(t,this.resolveTimeout,new pt("TIMEOUT","Resolve timeout")),i=Date.now();return this.resolveFlagsJson(n,r).then((t=>me.ready(e,t,this.createApplier(t.resolveToken)))).catch((t=>t instanceof pt?me.failed(e,t.code,t.message):me.failed(e,"GENERAL",t.message))).finally((()=>{this.markLatency(Date.now()-i)}))}))}createApplier(e){const t=new Set,n=[];let[r,i]=bt();const s=()=>{const t=i;[r,i]=bt(),o=0,this.apply({flags:n.splice(0,n.length),clientSecret:this.clientSecret,resolveToken:e,sdk:this.sdk,sendTime:new Date}).finally(t)};let o=0;return e=>{t.has(e)||(null==this.waitUntil||this.waitUntil.call(this,r),t.add(e),n.push({flag:Rt+e,applyTime:new Date}),o&&clearTimeout(o),0===this.applyDebounce?s():o=Number(setTimeout(s,this.applyDebounce)))}}apply(e){var t=this;return Et((function*(){const n=yield t.fetchImplementation(`${t.baseUrl}/flags:apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(We.toJSON(e))});if(!n.ok)throw new Error(`${n.status}: ${n.statusText}`)}))()}resolveFlagsJson(e,t){var n=this;return Et((function*(){const r=yield n.fetchImplementation(`${n.baseUrl}/flags:resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ye.toJSON(e)),signal:t});if(!r.ok)throw new Error(`${r.status}: ${r.statusText}`);return je.fromJSON(yield r.json())}))()}constructor(e){let{fetchImplementation:t,clientSecret:n,sdk:r,applyDebounce:i,resolveTimeout:s,environment:o,region:a,resolveBaseUrl:c,telemetry:l,logger:u,waitUntil:h}=e;this.markLatency=l.registerMeter({library:nt.LIBRARY_CONFIDENCE,version:r.version,id:rt.TRACE_ID_RESOLVE_LATENCY});const E=new we;!function(e,t){e.modifyRequest((e=>{let{headers:n}=e;const r=t.getSnapshot();if(r.libraryTraces.length>0){return{headers:St({},n,{"X-CONFIDENCE-TELEMETRY":btoa(String.fromCharCode(...at.encode(r).finish()))})}}return{}}))}(E,l),"client"===o&&function(e,t){const n=(new we).compose((e=>Et((function*(n){try{return yield e(n)}catch(r){throw null==t.error||t.error.call(t,`Confidence: ${r}`),r}})))).rejectNotOk().retry().rejectOn((e=>gt.has(e.status))).rateLimit(1,{initialTokens:3,maxTokens:2}),r=(new we).limitPending(1e3).timeout(18e5).rejectNotOk().retry({delay:5e3,backoff:2,maxDelay:3e5,jitter:.2}).rejectOn((e=>gt.has(e.status))).rateLimit(2).modifyRequest((e=>{let{method:t,body:n}=e;return"POST"===t&&n?(n=JSON.stringify(St({},JSON.parse(n),{sendTime:(new Date).toISOString()})),{body:n}):{}}));e.route((e=>e.endsWith("flags:resolve")),n).route((e=>e.endsWith("flags:apply")),r)}(E,u),this.fetchImplementation=E.build(t),this.clientSecret=n,this.sdk=r,this.applyDebounce=i,this.baseUrl=c?`${c}/v1`:a?`https://resolver.${a}.confidence.dev/v1`:"https://resolver.confidence.dev/v1",this.resolveTimeout=s,this.waitUntil=h}}var At,Dt=dt("_cache"),Nt=dt("_source"),vt=dt("_ttl");class Ct{resolve(e,t){this.evict();const n=he.serialize(e);let r=ft(this,Dt)[Dt].get(n);if(r)r.refCount++;else{const i=ft(this,Nt)[Nt].resolve(e,t);r={refCount:1,timestamp:Date.now(),value:i},ft(this,Dt)[Dt].set(n,r),i.signal.addEventListener("abort",(()=>{ft(this,Dt)[Dt].delete(n)}),{once:!0})}return Tt.create(e,(e=>(e.addEventListener("abort",(()=>{0===--r.refCount&&r.value.abort()}),{once:!0}),r.value)))}evict(){const e=Date.now();for(const[t,{timestamp:n}]of ft(this,Dt)[Dt]){if(e-n<ft(this,vt)[vt])return;ft(this,Dt)[Dt].delete(t)}}constructor(e,t){Object.defineProperty(this,Dt,{writable:!0,value:void 0}),Object.defineProperty(this,Nt,{writable:!0,value:void 0}),Object.defineProperty(this,vt,{writable:!0,value:void 0}),ft(this,Dt)[Dt]=new Map,ft(this,Nt)[Nt]=e,ft(this,vt)[vt]=t}}function bt(){let e,t;return[new Promise(((n,r)=>{e=n,t=r})),e,t]}function yt(){return yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yt.apply(this,arguments)}class Pt{send(e,t,n){if(n&&"context"in n)throw new Error("Event data must not contain a context field");this.writeQueue.push({eventDefinition:t,eventTime:(new Date).toISOString(),payload:yt({context:e},n)}),this.clearPendingFlush(),this.writeQueue.length>=this.maxBatchSize?this.flush():this.flushTimeoutMilliseconds>0&&(this.pendingFlush=setTimeout((()=>{this.flush()}),this.flushTimeoutMilliseconds))}flush(){this.clearPendingFlush();const e=this.writeQueue.length;return 0===e?Promise.resolve(!0):this.upload({clientSecret:this.clientSecret,sendTime:(new Date).toISOString(),events:this.writeQueue.splice(0,this.maxBatchSize)}).then((t=>{if(0===t.length)return null==this.logger.info||this.logger.info.call(this.logger,"Confidence: successfully uploaded %i events",e),!0;const n=Array.from(new Set(t.map((e=>{let{reason:t,message:n}=e;return n||t}))));return null==this.logger.warn||this.logger.warn.call(this.logger,"Confidence: failed to upload %i out of %i event(s) with the following errors: %o",t.length,e,n),!1})).catch((t=>(null==this.logger.error||this.logger.error.call(this.logger,"Confidence: failed to upload %i events.",e,t),!1)))}clearPendingFlush(){this.pendingFlush&&(clearTimeout(this.pendingFlush),this.pendingFlush=void 0)}upload(e){const t={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(yt({},e,{events:e.events.map((e=>yt({},e,{eventDefinition:`eventDefinitions/${e.eventDefinition}`})))}))};return this.fetchImplementation(this.publishUrl,t).then((e=>e.json())).then((e=>{let{errors:t}=e;return t}))}constructor(e){let{clientSecret:t,maxBatchSize:n,flushTimeoutMilliseconds:r,fetchImplementation:i,region:s,rateLimitRps:o=1e3/r,maxOpenRequests:a,logger:c}=e;this.writeQueue=[],this.publishUrl=s?`https://events.${s}
1.confidence.dev/v1/events:publish`:"https://events.confidence.dev/v1/events:publish",this.clientSecret=t,this.maxBatchSize=n,this.flushTimeoutMilliseconds=r,this.logger=c;const l=(new we).limitPending(a).rejectNotOk().timeout(18e5).retry({delay:5e3,backoff:2,maxDelay:3e5,jitter:.2}).rejectOn((e=>{let{status:t}=e;return t>=500||429===t}));o&&l.rateLimit(o),this.fetchImplementation=l.modifyRequest((e=>{let{method:t,body:n}=e;return"POST"===t&&n?(n=JSON.stringify(yt({},JSON.parse(n),{sendTime:(new Date).toISOString()})),{body:n}):{}})).build(i)}}function wt(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}!function(e){const t=Object.freeze({});e.LEVELS=["trace","debug","info","warn","error"],e.noOp=function(){return t},e.withLevel=function(t,n){const r={};for(let s=e.LEVELS.indexOf(n);s>=0&&s<e.LEVELS.length;s++){var i;r[e.LEVELS[s]]=null==(i=t[e.LEVELS[s]])?void 0:i.bind(t)}return Object.freeze(r)}}(At||(At={}));var Lt,Ft,Vt,Ut=0;function xt(e){return"__private_"+Ut+++"_"+e}function kt(e){const t=new Set,n=function(e,t){let n;return()=>{n?(n(),n=void 0):n=t((t=>{for(const n of e)n(t)}))}}(t,e);return e=>{if(t.has(e))throw new Error("Observer already subscribed.");return t.add(e),1===t.size&&n(),()=>{t.delete(e)&&0===t.size&&n()}}}function Kt(){return Kt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kt.apply(this,arguments)}!function(e){var t=xt("_isRevoked"),n=xt("_delegate"),r=xt("_childTrackers");class i{setContext(e){return this.assertNonRevoked(),wt(this,n)[n].setContext(e)}track(e,t){if(this.assertNonRevoked(),"function"===typeof e){const t=wt(this,n)[n].track(e);return wt(this,r)[r].push(t),t}return wt(this,n)[n].track(e,t)}get config(){return this.assertNonRevoked(),wt(this,n)[n].config}get isRevoked(){return wt(this,t)[t]}revoke(){if(!wt(this,t)[t])for(wt(this,t)[t]=!0;wt(this,r)[r].length>0;){wt(this,r)[r].pop()()}}
1assertNonRevoked(){if(wt(this,t)[t])throw new Error("The tracker is closed")}constructor(e){Object.defineProperty(this,t,{writable:!0,value:void 0}),Object.defineProperty(this,n,{writable:!0,value:void 0}),Object.defineProperty(this,r,{writable:!0,value:void 0}),wt(this,t)[t]=!1,wt(this,r)[r]=[],wt(this,n)[n]=e}}e.setup=function(e,t){const n=new i(e),r=t(n);return()=>{if(!n.isRevoked)try{null==r||r()}finally{n.revoke()}}}}(Lt||(Lt={}));class Jt{registerLibraryTraces(e){let{library:t,version:n,id:r}=e;if(this.disabled)return()=>{};const i=[];return this.libraryTraces.push({library:t,libraryVersion:n,traces:i}),e=>{var t,n;null==(n=this.logger)||null==(t=n.debug)||t.call(n,rt[r],e),i.push(Kt({id:r},e))}}registerCounter(e){const t=this.registerLibraryTraces(e);return()=>t({})}registerMeter(e){const t=this.registerLibraryTraces(e);return e=>t({millisecondDuration:e})}getSnapshot(){return{libraryTraces:this.libraryTraces.filter((e=>{let{traces:t}=e;return t.length>0})).map((e=>{let{library:t,libraryVersion:n,traces:r}=e;return{library:t,libraryVersion:n,traces:r.splice(0,r.length)}})),platform:this.platform}}constructor(e){this.libraryTraces=[],this.disabled=e.disabled,this.logger=e.logger,this.platform="client"===e.environment?tt.PLATFORM_JS_WEB:tt.PLATFORM_JS_SERVER}}function Mt(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(l){return void n(l)}a.done?t(c):Promise.resolve(c).then(r,i)}function Bt(){return Bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bt.apply(this,arguments)}class Gt{get environment(){return this.config.environment}sendEvent(e,t){this.config.eventSenderEngine.send(this.getContext(),e,t)}*contextEntries(){if(this.parent)for(const e of this.parent.contextEntries())this._context.has(e[0])||(yield e);for(const e of this._context.entries())"undefined"!==typeof e[1]&&(yield e)}getContext(){const e={};for(const[t,n]of this.contextEntries())e[t]=n;return Object.freeze(e)}setContext(e){const t=this.getContext(),n=[];for(const r of Object.keys(e))he.equal(t[r],e[r])||(n.push(r),this._context.set(r,he.clone(e[r])));return this.contextChanged&&n.length>0&&this.contextChanged(n),n.length>0}clearContext(){const e=this.getContext();if(this._context.clear(),this.contextChanged){const t=this.getContext(),n=Array.from(new Set([...Object.keys(e),...Object.keys(t)])).filter((n=>!he.equal(e[n],t[n])));n.length&&this.contextChanged(n)}}withContext(e){const t=new Gt(this.config,this);return t.setContext(e),t}track(e,t){if("function"===typeof e)return Lt.setup(this,e);this.sendEvent(e,t)}resolveFlags(){const e=this.getContext();var t;this.pendingFlags&&he.equal(this.pendingFlags.context,e)||(null==(t=this.pendingFlags)||t.abort(),this.pendingFlags=this.config.flagResolverClient.resolve(e,[]).then((e=>{this.currentFlags=e})).catch((e=>{"AbortError"!==e.name&&(null==this.config.logger.info||this.config.logger.info.call(this.config.logger,"Resolve failed.",e))})).finally((()=>{this.pendingFlags=void 0})));return"PENDING"!==this.pendingFlags.state?(this.pendingFlags=void 0,Se.resolve()):this.pendingFlags}get flagState(){return this.currentFlags?this.pendingFlags?"STALE":this.currentFlags.state:"NOT_READY"}subscribe(){const e=function(e,t){let n=t;return t=>{Object.is(t,n)||(n=t,e(t))}}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>{}),t=this.flagStateSubject(e);return e(this.flagState),t}evaluateFlagAsync(e,t){let n;return new Promise((r=>{n=this.subscribe((n=>{"READY"!==n&&"ERROR"!==n||r(this.currentFlags.evaluate(e,t))}))})).finally(n)}evaluateFlag(e,t){let n;if(this.currentFlags||this.pendingFlags||this.resolveFlags(),this.currentFlags?(this.showLoggerLink(e,this.getContext()),n=this.currentFlags.evaluate(e,t)):n={reason:"ERROR",errorCode:"NOT_READY",errorMessage:"Flags are not yet ready",value:t},!this.currentFlags||!he.equal(this.currentFlags.context,this.getContext())){return Bt({},n,{then:(n,r)=>this.evaluateFlagAsync(e,t).then(n,r)})}return n}getFlag(e,t){var n,r=this;return(n=function*(){return(yield r.evaluateFlag(e,t)).value},function(){var e=this,t=arguments;return new Promise((function(r,i){var s=n.apply(e,t);function o(e){Mt(s,r,i,o,a,"next",e)}function a(e){Mt(s,r,i,o,a,"throw",e)}o(void 0)}))})()}showLoggerLink(e,t){null==this.config.logger.info||this.config.logger.info.call(this.config.logger,`See resolves for '${e}' in Confidence: https://app.confidence.spotify.com/flags/resolver-test?client-key=${this.config.clientSecret}&flag=flags/${e}&context=${encodeURIComponent(JSON.stringify(t))}`)}static create(e){let{clientSecret:t,region:n,timeout:r,environment:i,fetchImplementation:s=Ht(),logger:o=Yt(),resolveBaseUrl:a,disableTelemetry:c=!1,applyDebounce:l=10,waitUntil:u}=e;if("client"!==i&&"backend"!==i)throw new Error(`Invalid environment: ${i}. Must be 'client' or 'backend'.`);const h={id:fe.SDK_ID_JS_CONFIDENCE,version:"0.2.5"},E=new Jt({disabled:c,environment:i});t||null==o.error||o.error.call(o,"Confidence: confidence cannot be instantiated without a client secret");let f=new mt({clientSecret:t,fetchImplementation:s,sdk:h,environment:i,resolveTimeout:r,region:n,resolveBaseUrl:a,telemetry:E,logger:o,applyDebounce:l,waitUntil:u});"client"===i&&(f=new Ct(f,Number.POSITIVE_INFINITY));const _=Math.floor(1024),d=new Pt({clientSecret:t,maxBatchSize:_,flushTimeoutMilliseconds:500,fetchImplementation:s,region:n,rateLimitRps:"client"===i?2:Number.POSITIVE_INFINITY,maxOpenRequests:51200/(1*_),logger:o});return new Gt({environment:i,flagResolverClient:f,eventSenderEngine:d,timeout:r,logger:o,clientSecret:t})}constructor(e,t){this._context=new Map,this.config=e,this.parent=t,this.contextChanges=kt((e=>{let n;return t&&(n=t.contextChanges((t=>{const n=t.filter((e=>!this._context.has(e)));n.length&&e(n)}))),this.contextChanged=e,()=>{null==n||n(),this.contextChanged=void 0}})),this.flagStateSubject=kt((e=>{const t=()=>e(this.flagState);this.currentFlags&&he.equal(this.currentFlags.context,this.getContext())||this.resolveFlags().then(t);const n=this.contextChanges((()=>{"READY"!==this.flagState&&"ERROR"!==this.flagState||e("STALE"),this.resolveFlags().then(t)}));return()=>{var e;n(),null==(e=this.pendingFlags)||e.abort(),this.pendingFlags=void 0}}))}}function Ht(){if(!globalThis.fetch)throw new TypeError("No default fetch implementation found. Please provide provide the fetchImplementation option to createConfidenceWebProvider.");return globalThis.fetch.bind(globalThis)}function Yt(){try{0}catch(e){}return At.noOp()}function jt(e,t,n){const r=e,i=r[t];return r[t]=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];try{return i.call(this,...t)}finally{n(...t)}},()=>{r[t]=i}}function Wt(e,t,n){return e.addEventListener(t,n),()=>{e.removeEventListener(t,n)}}function $t(){return e=>{let t=document.referrer;e.setContext({page:{path:location.pathname,search:location.search,referrer:t,title:document.title,url:location.href}});
1const n=[jt(history,"pushState",(()=>{r({type:"pushstate"})})),jt(history,"replaceState",(()=>{r({type:"replacestate"})})),Wt(window,"popstate",r),Wt(window,"hashchange",r)];return"complete"===document.readyState?r({type:"load"}):n.push(Wt(window,"load",r)),Ft.combine(...n);function r(n){let{type:r}=n;e.setContext({page:{path:location.pathname,search:location.search,referrer:t,title:document.title,url:location.href}}),null==e.config.logger.debug||e.config.logger.debug.call(e.config.logger,"Confidence: page viewed",{type:r}),e.track("page-viewed"),t=location.href}}}function Zt(){let{lcp:e=!0,inp:t=!0,cls:n=!0,ttfb:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i=>{const s=e=>{let{name:t,id:n,delta:r}=e;const s=`web-vitals-${t.toLocaleLowerCase()}`;i.track(s,{metric_id:n,metric_delta:r})};e&&ie(s),t&&te(s),n&&B(s),r&&ae(s)}}!function(e){e.combine=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return()=>{for(const e of t)e()}}}(Ft||(Ft={})),function(e){function t(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=[`${encodeURIComponent(e)}=${encodeURIComponent(t)}`];n.expires?r.push(`expires=${n.expires.toUTCString()}`):"number"===typeof n.maxAge&&r.push(`expires=${new Date(Date.now()+1e3*n.maxAge).toUTCString()}`),n.sameSite&&r.push("samesite"),n.domain&&r.push(`domain=${encodeURIComponent(n.domain)}`),n.secure&&r.push("secure"),document.cookie=r.join("; ")}e.set=t,e.get=function(e){const t=`${encodeURIComponent(e)}=`,n=document.cookie.split(/;\s*/g).find((e=>e.startsWith(t)));return n&&decodeURIComponent(n.slice(t.length))},e.remove=function(e){t(e,"",{maxAge:0})}}(Vt||(Vt={}));const zt="cnfdVisitorId",qt=()=>e=>{if("undefined"===typeof document)return;let t=Vt.get(zt);t||(t="xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx".replace(/x/g,(()=>"0123456789abcdef"[16*Math.random()|0])),Vt.set(zt,t,{maxAge:15768e4})),e.setContext({visitor_id:t})}}}]);
2//# sourceMappingURL=8000.932fdbdf.chunk.js.map

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.