1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,107996,(e,t,r)=>{"use strict";e.i(692504);var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.promiseTimeout=r.getAutoExperimentChangeType=r.mergeQueryStrings=r.loadSDKVersion=r.paddedVersionString=r.toString=r.decrypt=r.isIncluded=r.getQueryStringOverride=r.getBucketRanges=r.isURLTargeted=r.getUrlRegExp=r.chooseVariation=r.inNamespace=r.inRange=r.getEqualWeights=r.hash=r.getPolyfills=void 0;let n={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function a(e){let t=0x811c9dc5,r=e.length;for(let i=0;i<r;i++)t^=e.charCodeAt(i),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function s(e,t,r){return 2===r?a(a(e+t)+"")%1e4/1e4:1===r?a(t+e)%1e3/1e3:null}function o(e){return e<=0?[]:Array(e).fill(1/e)}function c(e,t){return e>=t[0]&&e<t[1]}function u(e){try{let t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch(e){console.error(e);return}}r.getPolyfills=function(){return n},r.hash=s,r.getEqualWeights=o,r.inRange=c,r.inNamespace=function(e,t){let r=s("__"+t[0],e,1);return null!==r&&r>=t[1]&&r<t[2]},r.chooseVariation=function(e,t){for(let r=0;r<t.length;r++)if(c(e,t[r]))return r;return -1},r.getUrlRegExp=u,r.isURLTargeted=function(e,t){if(!t.length)return!1;let r=!1,i=!1;for(let n=0;n<t.length;n++){let a=function(e,t,r){try{let i=new URL(e,"https://_");if("regex"===t){let e=u(r);if(!e)return!1;return e.test(i.href)||e.test(i.href.substring(i.origin.length))}if("simple"===t)try{let e=new URL(r.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),t=[[i.host,e.host,!1],[i.pathname,e.pathname,!0]];return e.hash&&t.push([i.hash,e.hash,!1]),e.searchParams.forEach((e,r)=>{t.push([i.searchParams.get(r)||"",e,!1])}),!t.some(e=>!function(e,t,r){try{let i=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return r&&(i="\\/?"+i.replace(/(^\/|\/$)/g,"")+"\\/?"),RegExp("^"+i+"$","i").test(e)}catch(e){return!1}}(e[0],e[1],e[2]))}catch(e){}return!1}catch(e){return!1}}(e,t[n].type,t[n].pattern);if(!1===t[n].include){if(a)return!1}else r=!0,a&&(i=!0)}return i||!r},r.getBucketRanges=function(e,t,r){(t=void 0===t?1:t)<0?t=0:t>1&&(t=1);let i=o(e);(r=r||i).length!==e&&(r=i);let n=r.reduce((e,t)=>t+e,0);(n<.99||n>1.01)&&(r=i);let a=0;return r.map(e=>{let r=a;return a+=e,[r,r+t*e]})},r.getQueryStringOverride=function(e,t,r){if(!t)return null;let i=t.split("?")[1];if(!i)return null;let n=i.replace(/#.*/,"").split("&").map(e=>e.split("=",2)).filter(([t])=>t===e).map(([,e])=>parseInt(e));return n.length>0&&n[0]>=0&&n[0]<r?n[0]:null},r.isIncluded=function(e){try{return e()}catch(e){return console.error(e),!1}};let l=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0));function d(e){return"object"==typeof e&&null!==e}r.decrypt=function(e,t,r){return i(this,void 0,void 0,function*(){if(t=t||"",!(r=r||globalThis.crypto&&globalThis.crypto.subtle||n.SubtleCrypto))throw Error("No SubtleCrypto implementation found");try{let i=yield r.importKey("raw",l(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[n,a]=e.split("."),s=yield r.decrypt({name:"AES-CBC",iv:l(n)},i,l(a));return new TextDecoder().decode(s)}catch(e){throw Error("Failed to decrypt")}})},r.toString=function(e){return"string"==typeof e?e:JSON.stringify(e)},r.paddedVersionString=function(e){"number"==typeof e&&(e+=""),e&&"string"==typeof e||(e="0");let t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return 3===t.length&&t.push("~"),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5," "):e).join("-")},r.loadSDKVersion=function(){let e;try{e=__SDK_VERSION__}catch(t){e=""}return e},r.mergeQueryStrings=function(e,t){let r,i;try{r=new URL(e),i=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}
1return r.searchParams.forEach((e,t)=>{i.searchParams.has(t)||i.searchParams.set(t,e)}),i.toString()},r.getAutoExperimentChangeType=function(e){return e.urlPatterns&&e.variations.some(e=>d(e)&&"urlRedirect"in e)?"redirect":e.variations.some(e=>d(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"},r.promiseTimeout=function(e,t){return i(this,void 0,void 0,function*(){return new Promise(r=>{let i,n=!1,a=e=>{n||(n=!0,i&&clearTimeout(i),r(e||null))};t&&(i=setTimeout(()=>a(),t)),e.then(e=>a(e)).catch(()=>a())})})}},547450,(e,t,r)=>{"use strict";e.i(692504);var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.startStreaming=r.clearAutoRefresh=r.onVisible=r.onHidden=r.unsubscribe=r.refreshFeatures=r.clearCache=r.configureCache=r.setPolyfills=r.helpers=void 0;let n=e.r(107996),a={staleTTL:6e4,maxAge:144e5,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},s=(0,n.getPolyfills)();r.helpers={fetchFeaturesCall:({host:e,clientKey:t,headers:r})=>s.fetch(`${e}/api/features/${t}`,{headers:r}),fetchRemoteEvalCall:({host:e,clientKey:t,payload:r,headers:i})=>{let n={method:"POST",headers:Object.assign({"Content-Type":"application/json"},i),body:JSON.stringify(r)};return s.fetch(`${e}/api/eval/${t}`,n)},eventSourceCall:({host:e,clientKey:t,headers:r})=>r?new s.EventSource(`${e}/sub/${t}`,{headers:r}):new s.EventSource(`${e}/sub/${t}`),startIdleListener:()=>{let e;if(!("u">typeof window&&"u">typeof document))return;let t=()=>{"visible"===document.visibilityState?(window.clearTimeout(e),f()):"hidden"===document.visibilityState&&(e=window.setTimeout(p,a.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(s.localStorage=globalThis.localStorage)}catch(e){}let o=new Map,c=!1,u=new Map,l=new Map,d=new Map,h=new Set;function p(){d.forEach(e=>{e&&(e.state="idle",S(e))})}function f(){d.forEach(e=>{e&&"idle"===e.state&&A(e)})}function g(){return i(this,void 0,void 0,function*(){try{if(!s.localStorage)return;yield s.localStorage.setItem(a.cacheKey,JSON.stringify(Array.from(u.entries())))}catch(e){}})}function y(e){let[t,r]=e.getApiInfo();return`${t}||${r}`}function v(e){let t=y(e);if(!("isRemoteEval"in e)||!e.isRemoteEval())return t;let r=e.getAttributes(),i=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),n={};i.forEach(e=>{n[e]=r[e]});let a=e.getForcedVariations(),s=e.getUrl();return`${t}||${JSON.stringify({ca:n,fv:a,url:s})}`}function m(){let e=Array.from(u.entries()).map(([e,t])=>({key:e,staleAt:t.staleAt.getTime()})).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,u.size-a.maxEntries),u.size);for(let r=0;r<t;r++)u.delete(e[r].key)}function _(e,t,r){let n=r.dateUpdated||"",s=new Date(Date.now()+a.staleTTL),c=a.disableCache?void 0:u.get(t);if(c&&n&&c.version===n){c.staleAt=s,g();return}a.disableCache||(u.set(t,{data:r,version:n,staleAt:s,sse:h.has(e)}),m()),g();let l=o.get(e);l&&l.forEach(e=>(function(e,t){return i(this,void 0,void 0,function*(){yield e.setPayload(t||e.getPayload())})})(e,r))}function E(e){return i(this,void 0,void 0,function*(){let{apiHost:t,apiRequestHeaders:i}=e.getApiHosts(),n=e.getClientKey(),a="isRemoteEval"in e&&e.isRemoteEval(),s=y(e),o=v(e),c=l.get(o);return c||(c=(a?r.helpers.fetchRemoteEvalCall({host:t,clientKey:n,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:i}):r.helpers.fetchFeaturesCall({host:t,clientKey:n,headers:i})).then(e=>{if(!e.ok)throw Error(`HTTP error: ${e.status}`);return"enabled"===e.headers.get("x-sse-support")&&h.add(s),e.json()}).then(t=>(_(s,o,t),b(e),l.delete(o),{data:t,success:!0,source:"network"})).catch(e=>(l.delete(o),{data:null,source:"error",success:!1,error:e})),l.set(o,c)),c})}function b(e,t=!1){let r=y(e),i=v(e),{streamingHost:n,streamingHostRequestHeaders:c}=e.getApiHosts(),u=e.getClientKey();if(t&&h.add(r),a.backgroundSync&&h.has(r)&&s.EventSource){if(d.has(r))return;let e={src:null,host:n,clientKey:u,headers:c,cb:t=>{try{if("features-updated"===t.type){let e=o.get(r);
1e&&e.forEach(e=>{E(e)})}else if("features"===t.type){let e=JSON.parse(t.data);_(r,i,e)}e.errors=0}catch(t){w(e)}},errors:0,state:"active"};d.set(r,e),A(e)}}function w(e){if("idle"!==e.state&&(e.errors++,e.errors>3||e.src&&2===e.src.readyState)){let t=Math.pow(3,e.errors-3)*(1e3+1e3*Math.random());S(e),setTimeout(()=>{["idle","active"].includes(e.state)||A(e)},Math.min(t,3e5))}}function S(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,"active"===e.state&&(e.state="disabled"))}function A(e){e.src=r.helpers.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>w(e),e.src.onopen=()=>{e.errors=0}}function k(e,t){S(e),d.delete(t)}function C(){h.clear(),d.forEach(k),o.clear(),r.helpers.stopIdleListener()}r.setPolyfills=function(e){Object.assign(s,e)},r.configureCache=function(e){Object.assign(a,e),a.backgroundSync||C()},r.clearCache=function(){return i(this,void 0,void 0,function*(){u.clear(),l.clear(),C(),c=!1,yield g()})},r.refreshFeatures=function({instance:e,timeout:t,skipCache:o,allowStale:l,backgroundSync:d}){return i(this,void 0,void 0,function*(){return d||(a.backgroundSync=!1),function({instance:e,allowStale:t,timeout:o,skipCache:l}){return i(this,void 0,void 0,function*(){let d=y(e),p=v(e),f=new Date,g=new Date(f.getTime()-a.maxAge+a.staleTTL);yield function(){return i(this,void 0,void 0,function*(){if(!c){c=!0;try{if(s.localStorage){let e=yield s.localStorage.getItem(a.cacheKey);if(!a.disableCache&&e){let t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(([e,t])=>{u.set(e,Object.assign(Object.assign({},t),{staleAt:new Date(t.staleAt)}))}),m()}}}catch(e){}if(!a.disableIdleStreams){let e=r.helpers.startIdleListener();e&&(r.helpers.stopIdleListener=e)}}})}();let _=a.disableCache||l?void 0:u.get(p);return _&&(t||_.staleAt>f)&&_.staleAt>g?(_.sse&&h.add(d),_.staleAt<f?E(e):b(e),{data:_.data,success:!0,source:"cache"}):(yield(0,n.promiseTimeout)(E(e),o))||{data:null,success:!1,source:"timeout",error:Error("Timeout")}})}({instance:e,allowStale:l,timeout:t,skipCache:o})})},r.unsubscribe=function(e){o.forEach(t=>t.delete(e))},r.onHidden=p,r.onVisible=f,r.clearAutoRefresh=C,r.startStreaming=function(e,t){if(t.streaming){let r,i;if(!e.getClientKey())throw Error("Must specify clientKey to enable streaming");t.payload&&b(e,!0),r=y(e),(i=o.get(r)||new Set).add(e),o.set(r,i)}}},850933,e=>{"use strict";var t,r,i=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,n={revert:function(){}},a=new Map,s=new Set;function o(e){var t=a.get(e);return t||(t={element:e,attributes:{}},a.set(e,t)),t}function c(e,t,r,i,n){var a=r(e),s={isDirty:!1,originalValue:a,virtualValue:a,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if("position"!==t||!s._positionTimeout){"position"===t&&(s._positionTimeout=setTimeout(function(){s._positionTimeout=null},1e3));var i=r(e);"position"===t&&i.parentNode===s.virtualValue.parentNode&&i.insertBeforeNode===s.virtualValue.insertBeforeNode||i!==s.virtualValue&&(s.originalValue=i,n(s))}}),mutationRunner:n,setValue:i,getCurrentValue:r};return"position"===t&&e.parentNode?s.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):s.observer.observe(e,"html"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}),s}function u(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?r&&e.parentNode===r.parentNode&&e.insertBeforeNode===r.insertBeforeNode||(t.isDirty=!0,C()):e!==r&&(t.isDirty=!0,C())}function l(e){var r,i=e.originalValue;e.mutations.forEach(function(e){return i=e.mutate(i)}),u((r=i,t||(t=document.createElement("div")),t.innerHTML=r,t.innerHTML),e)}function d(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),u(Array.from(t).filter(Boolean).join(" "),e)}function h(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),u(t,e)}function p(e){var t=e.originalValue;e.mutations.forEach(function(e){t=function(e){var t=e.parentSelector,r=e.insertBeforeSelector,i=document.querySelector(t);if(!i)return null;var n=r?document.querySelector(r):null;return r&&!n?null:{parentNode:i,insertBeforeNode:n}}(e.mutate())||t}),u(t,e)}var f=function(e){return e.innerHTML},g=function(e,t){return e.innerHTML=t};function y(e){var t=o(e);return t.html||(t.html=c(e,"html",f,g,l)),t.html}var v=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},m=function(e,t){(!t.insertBeforeNode||t.parentNode.contains(t.insertBeforeNode))&&t.parentNode.insertBefore(e,t.insertBeforeNode)};function _(e){var t=o(e);return t.position||(t.position=c(e,"position",v,m,p)),t.position}var E=function(e,t){return t?e.className=t:e.removeAttribute("class")},b=function(e){return e.className};function w(e){var t=o(e);return t.classes||(t.classes=c(e,"class",b,E,d)),t.classes}function S(e,t){var r=o(e);return r.attributes[t]||(r.attributes[t]=c(e,t,function(e){var r;return null!=(r=e.getAttribute(t))?r:null},function(e,r){return null!==r?e.setAttribute(t,r):e.removeAttribute(t)},h)),r.attributes[t]}function A(e,t,r){if(r.isDirty){r.isDirty=!1;var i,n,s,o,c,u,l,d,h,p,f=r.virtualValue;!r.mutations.length&&(p=a.get(e))&&("html"===t?(null==(i=p.html)||null==(n=i.observer)||n.disconnect(),delete p.html):"class"===t?(null==(s=p.classes)||null==(o=s.observer)||o.disconnect(),delete p.classes):"position"===t?(null==(c=p.position)||null==(u=c.observer)||u.disconnect(),delete p.position):(null==(l=p.attributes)||null==(d=l[t])||null==(h=d.observer)||h.disconnect(),delete p.attributes[t])),r.setValue(e,f)}}function k(e,t){e.html&&A(t,"html",e.html),e.classes&&A(t,"class",e.classes),e.position&&A(t,"position",e.position),Object.keys(e.attributes).forEac
1h(function(r){A(t,r,e.attributes[r])})}function C(){a.forEach(k)}function O(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(r){if(!t.has(r)){var i;e.elements.add(r),i=null,"html"===e.kind?i=y(r):"class"===e.kind?i=w(r):"attribute"===e.kind?i=S(r,e.attribute):"position"===e.kind&&(i=_(r)),i&&(i.mutations.push(e),i.mutationRunner(i))}})}}function T(){s.forEach(O)}function x(){"u">typeof document&&(r||(r=new MutationObserver(function(){T()})),T(),r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function P(e){return"u"<typeof document?n:(s.add(e),O(e),{revert:function(){e.elements.forEach(function(t){var r=null;if("html"===e.kind?r=y(t):"class"===e.kind?r=w(t):"attribute"===e.kind?r=S(t,e.attribute):"position"===e.kind&&(r=_(t)),r){var i=r.mutations.indexOf(e);-1!==i&&r.mutations.splice(i,1),r.mutationRunner(r)}}),e.elements.clear(),s.delete(e)}})}function I(e,t){return P({kind:"html",elements:new Set,mutate:t,selector:e})}function K(e,t){return P({kind:"position",elements:new Set,mutate:t,selector:e})}function R(e,t){return P({kind:"class",elements:new Set,mutate:t,selector:e})}function D(e,t,r){return i.test(t)?"class"===t||"className"===t?R(e,function(e){var t=r(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):P({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):n}x(),e.s(["connectGlobalObserver",0,x,"default",0,{html:I,classes:R,attribute:D,position:K,declarative:function(e){var t=e.selector,r=e.action,i=e.value,a=e.attribute,s=e.parentSelector,o=e.insertBeforeSelector;if("html"===a){if("append"===r)return I(t,function(e){return e+(null!=i?i:"")});else if("set"===r)return I(t,function(){return null!=i?i:""})}else if("class"===a){if("append"===r)return R(t,function(e){i&&e.add(i)});else if("remove"===r)return R(t,function(e){i&&e.delete(i)});else if("set"===r)return R(t,function(e){e.clear(),i&&e.add(i)})}else if("position"===a){if("set"===r&&s)return K(t,function(){return{insertBeforeSelector:o,parentSelector:s}})}else if("append"===r)return D(t,a,function(e){return null!==e?e+(null!=i?i:""):null!=i?i:""});else if("set"===r)return D(t,a,function(){return null!=i?i:""});else if("remove"===r)return D(t,a,function(){return null});return n}},"disconnectGlobalObserver",0,function(){r&&r.disconnect()},"validAttributeName",0,i])},654863,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.evalCondition=void 0;let i=e.r(107996),n={};function a(e,t,r){for(let[u,l]of(r=r||{},Object.entries(t)))switch(u){case"$or":if(!c(e,l,r))return!1;break;case"$nor":if(c(e,l,r))return!1;break;case"$and":if(!function(e,t,r){for(let i=0;i<t.length;i++)if(!a(e,t[i],r))return!1;return!0}(e,l,r))return!1;break;case"$not":if(a(e,l,r))return!1;break;default:if(!function e(t,r,c){if("string"==typeof t)return r+""===t;if("number"==typeof t)return+r===t;if("boolean"==typeof t)return null!==r&&!!r===t;if(null===t)return null===r;if(Array.isArray(t)||!s(t))return JSON.stringify(r)===JSON.stringify(t);for(let u in t)if(!function(t,r,c,u){switch(t){case"$veq":return(0,i.paddedVersionString)(r)===(0,i.paddedVersionString)(c);case"$vne":return(0,i.paddedVersionString)(r)!==(0,i.paddedVersionString)(c);case"$vgt":return(0,i.paddedVersionString)(r)>(0,i.paddedVersionString)(c);case"$vgte":return(0,i.paddedVersionString)(r)>=(0,i.paddedVersionString)(c);case"$vlt":return(0,i.paddedVersionString)(r)<(0,i.paddedVersionString)(c);case"$vlte":return(0,i.paddedVersionString)(r)<=(0,i.paddedVersionString)(c);case"$eq":return r===c;case"$ne":return r!==c;case"$lt":return r<c;case"$lte":return r<=c;case"$gt":return r>c;case"$gte":return r>=c;case"$exists":return c?null!=r:null==r;case"$in":if(!Array.isArray(c))return!1;return o(r,c);case"$inGroup":return o(r,u[c]||[]);case"$notInGroup":return!o(r,u[c]||[]);case"$nin":if(!Array.isArray(c))return!1;return!o(r,c);case"$not":return!e(c,r,u);case"$size":if(!Array.isArray(r))return!1;return e(c,r.length,u);case"$elemMatch":if(!Array.isArray(r))return!1;let l=s(c)?t=>e(c,t,u):e=>a(e,c,u);for(let e=0;e<r.length;e++)if(r[e]&&l(r[e]))return!0;return!1;case"$all":if(!Array.isArray(r))return!1;for(let t=0;t<c.length;t++){let i=!1;for(let n=0;n<r.length;n++)if(e(c[t],r[n],u)){i=!0;break}if(!i)return!1}return!0;case"$regex":try{return(!n[c]&&(n[c]=new RegExp(c.replace(/([^\\])\//g,"$1\\/"))),n[c]).test(r)}catch(e){return!1}case"$type":return function(e){if(null===e)return"null";if(Array.isArray(e))return"array";let t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}(r)===c;default:return console.error("Unknown operator: "+t),!1}}(u,r,t[u],c))return!1;return!0}(l,function(e,t){let r=t.split("."),i=e;for(let e=0;e<r.length;e++)if(!i||"object"!=typeof i||!(r[e]in i))return null;else i=i[r[e]];return i}(e,u),r))return!1}return!0}r.evalCondition=a;function s(e){let t=Object.keys(e);return t.length>0&&t.filter(e=>"$"===e[0]).length===t.length}function o(e,t){return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function c(e,t,r){if(!t.length)return!0;for(let i=0;i<t.length;
1i++)if(a(e,t[i],r))return!0;return!1}},220904,(e,t,r)=>{"use strict";e.i(692504);var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.getExperimentDedupeKey=r.getApiHosts=r.decryptPayload=r.getStickyBucketAttributes=r.getAllStickyBucketAssignmentDocs=r.getStickyBucketAttributeKey=r.getHashAttribute=r.getExperimentResult=r.runExperiment=r.evalFeature=r.EVENT_EXPERIMENT_VIEWED=r.EVENT_FEATURE_EVALUATED=void 0;let n=e.r(654863),a=e.r(107996);function s(e){return i(this,void 0,void 0,function*(){try{yield e()}catch(e){}})}function o(e,t,i){if(e.user.trackedExperiments){let r=_(t,i);if(e.user.trackedExperiments.has(r))return[];e.user.trackedExperiments.add(r)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:i,timestamp:Date.now().toString(),logType:"experiment"});let n=[];if(e.global.trackingCallback){let r=e.global.trackingCallback;n.push(s(()=>r(t,i,e.user)))}if(e.user.trackingCallback){let r=e.user.trackingCallback;n.push(s(()=>r(t,i)))}if(e.global.eventLogger){let a=e.global.eventLogger;n.push(s(()=>a(r.EVENT_EXPERIMENT_VIEWED,{experimentId:t.key,variationId:i.key,hashAttribute:i.hashAttribute,hashValue:i.hashValue},e.user)))}return n}function c(e,t){let r;if(t.stack.evaluatedFeatures.has(e))return l(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;let i=(r=new Map,t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach((e,t)=>r.set(t,e)),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach((e,t)=>r.set(t,e)),r);if(i.has(e))return l(t,e,i.get(e),"override");if(!t.global.features||!t.global.features[e])return l(t,e,null,"unknownFeature");let s=t.global.features[e];if(s.rules){let r=new Set(t.stack.evaluatedFeatures);e:for(let i of s.rules){if(i.parentConditions)for(let a of i.parentConditions){t.stack.evaluatedFeatures=new Set(r);let i=c(a.id,t);if("cyclicPrerequisite"===i.source)return l(t,e,null,"cyclicPrerequisite");let s={value:i.value};if(!(0,n.evalCondition)(s,a.condition||{})){if(a.gate)return l(t,e,null,"prerequisite");continue e}}if(i.filters&&p(i.filters,t))continue;if("force"in i){if(i.condition&&!h(i.condition,t)||!function(e,t,r,i,n,s,o){if(!n&&void 0===s)return!0;if(!n&&0===s)return!1;let{hashValue:c}=g(e,r,i);if(!c)return!1;let u=(0,a.hash)(t,c,o||1);return null!==u&&(n?(0,a.inRange)(u,n):void 0===s||u<=s)}(t,i.seed||e,i.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach(e=>{!o(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),l(t,e,i.force,"force",i.id)}if(!i.variations)continue;let s={variations:i.variations,key:i.key||e};"coverage"in i&&(s.coverage=i.coverage),i.weights&&(s.weights=i.weights),i.hashAttribute&&(s.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(s.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(s.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(s.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(s.minBucketVersion=i.minBucketVersion),i.namespace&&(s.namespace=i.namespace),i.meta&&(s.meta=i.meta),i.ranges&&(s.ranges=i.ranges),i.name&&(s.name=i.name),i.phase&&(s.phase=i.phase),i.seed&&(s.seed=i.seed),i.hashVersion&&(s.hashVersion=i.hashVersion),i.filters&&(s.filters=i.filters),i.condition&&(s.condition=i.condition);let{result:d}=u(s,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(s,d),d.inExperiment&&!d.passthrough)return l(t,e,d.value,"experiment",i.id,s,d)}}return l(t,e,void 0===s.defaultValue?null:s.defaultValue,"defaultValue")}function u(e,t,r){var i,s,u,l,d,m,_;let E,b,w=e.key,S=e.variations.length;if(S<2||!1===r.global.enabled||!1===r.user.enabled||(i=e,s=r,E=i.key,(b=s.global.overrides)&&b[E]&&"string"==typeof(i=Object.assign({},i,b[E])).url&&(i.url=(0,a.getUrlRegExp)(i.url)),e=i).urlPatterns&&!(0,a.isURLTargeted)(r.user.url||"",e.urlPatterns))return{result:f(r,e,-1,!1,t)};let A=(0,a.getQueryStringOverride)(w,r.user.url||"",S);if(null!==A)return{result:f(r,e,A,!1,t)};let k=(u=r).global.forcedVariations&&u.user.forcedVariations?Object.assign(Object.assign({},u.global.forcedVariations),u.user.forcedVariations):u.global.forcedVariations?u.global.forcedVariations:u.user.forcedVariations?u.user.forcedVariations:{};if(w in k)return{result:f(r,e,k[w],!1,t)};if("draft"===e.status||!1===e.active)return{result:f(r,e,-1,!1,t)};let{hashAttribute:C,hashValue:O}=g(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!O)return{result:f(r,e,-1,!1,t)};let T=-1,x=!1,P=!1;if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:t,versionIsBlocked:i}=function({ctx:e,expKey:t,expBucketVersion:r,expHashAttribute:i,expFallbackAttribute:n,expMinBucketVersion:s,expMeta:o}){s=s||0,i=i||"id",o=o||[];let c=y(t,r=r||0),u=function(e,t,r){if(!e.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:i,hashValue:n}=g(e,t),s=v(i,(0,a.toString)(n)),{hashAttribute:o,hashValue:c}=g(e,r),u=c?v(o,(0,a.toString)(c)):null,l={};return u&&e.user.stickyBucketAssignmentDocs[u]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[u].assignments||{}),e.user.stickyBucketAssignmentDocs[s]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[s].assignments||{}),l}(e,i,n);if(s>0){for(let e=0;e<s;e++)if(void 0!==u[y(t,e)])return{variation:-1,versionIsBlocked:!0}}let l=u[c];if(void 0===l)return{variation:-1};let d=o.findIndex(e=>e.key===l);return d<0?{variation:-1}:{variation:d}}({ctx:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});x=t>=0,T=t,P=!!i}if(!x){if(e.filters){if(p(e.filters,r))return{result:f(r,e,-1,!1,t)}}else if(e.namespace&&!(0,a.inNamespace)(O,e.namespace))return{result:f(r,e,-1,!1,t)};if(e.include&&!(0,a.isIncluded)(e.include)||e.condition&&!h(e.condition,r))return{result:f(r,e,-1,!1,t)};if(e.parentConditions){let i=new Set(r.stack.evaluatedFeatures);for(let a of e.parentConditions){r.stack.evaluatedFeatures=new Set(i);let s=c(a.id,r);if("cyclicPrerequisite"===s.source)return{result:f(r,e,-1,!1,t)};let o={value:s.value};if(!(0,n.evalCondition)(o,a.condition||{}))return{result:f(r,e,-1,!1,t)}}}if(e.groups&&!function(e,t){let r=t.global.groups||{};for(let t=0;t<e.length;t++)if(r[e[t]])return!0;return!1}(e.groups,r))return{result:f(r,e,-1,!1,t)}}if(e.url&&!function(e,t){let r=t.user.url;if(!r)return!1;let i=r.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(e.test(r)||e.test(i))}(e.url,r))return{result:f(r,e,-1,!1,t)};
1let I=1===e.hashVersion?w:e.seed||w,K=(0,a.hash)(I,O,e.hashVersion||1);if(null===K)return{result:f(r,e,-1,!1,t)};if(!x){let t=e.ranges||(0,a.getBucketRanges)(S,void 0===e.coverage?1:e.coverage,e.weights);T=(0,a.chooseVariation)(K,t)}if(P)return{result:f(r,e,-1,!1,t,void 0,!0)};if(T<0)return{result:f(r,e,-1,!1,t)};if("force"in e)return{result:f(r,e,void 0===e.force?-1:e.force,!1,t)};if(r.global.qaMode||r.user.qaMode||"stopped"===e.status)return{result:f(r,e,-1,!1,t)};let R=f(r,e,T,!0,t,K,x);if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let t,i,n,s,{changed:o,key:c,doc:u}=(l=r,d=C,m=(0,a.toString)(O),_={[y(e.key,e.bucketVersion)]:R.key},t=v(d,m),n=Object.assign(Object.assign({},i=l.user.stickyBucketAssignmentDocs&&l.user.stickyBucketAssignmentDocs[t]&&l.user.stickyBucketAssignmentDocs[t].assignments||{}),_),s=JSON.stringify(i)!==JSON.stringify(n),{key:t,doc:{attributeName:d,attributeValue:m,assignments:n},changed:s});o&&(r.user.stickyBucketAssignmentDocs=r.user.stickyBucketAssignmentDocs||{},r.user.stickyBucketAssignmentDocs[c]=u,r.user.saveStickyBucketAssignmentDoc(u))}let D=o(r,e,R);0===D.length&&r.global.saveDeferredTrack&&r.global.saveDeferredTrack({experiment:e,result:R});let M=D.length?1===D.length?D[0]:Promise.all(D).then(()=>{}):void 0;return"changeId"in e&&e.changeId&&r.global.recordChangeId&&r.global.recordChangeId(e.changeId),{result:R,trackingCall:M}}function l(e,t,i,n,a,o,c){let u={value:i,on:!!i,off:!i,source:n,ruleId:a||""};return o&&(u.experiment=o),c&&(u.experimentResult=c),"override"!==n&&function(e,t,i){if(e.user.trackedFeatureUsage){let r=JSON.stringify(i.value);if(e.user.trackedFeatureUsage[t]===r)return;e.user.trackedFeatureUsage[t]=r,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:i,timestamp:Date.now().toString(),logType:"feature"})}if(e.global.onFeatureUsage){let r=e.global.onFeatureUsage;s(()=>r(t,i,e.user))}if(e.user.onFeatureUsage){let r=e.user.onFeatureUsage;s(()=>r(t,i))}if(e.global.eventLogger){let n=e.global.eventLogger;s(()=>n(r.EVENT_FEATURE_EVALUATED,{feature:t,source:i.source,value:i.value,ruleId:"defaultValue"===i.source?"$default":i.ruleId||"",variationId:i.experimentResult?i.experimentResult.key:""},e.user))}}(e,t,u),u}function d(e){return Object.assign(Object.assign({},e.user.attributes),e.user.attributeOverrides)}function h(e,t){return(0,n.evalCondition)(d(t),e,t.global.savedGroups||{})}function p(e,t){return e.some(e=>{let{hashValue:r}=g(t,e.attribute);if(!r)return!0;let i=(0,a.hash)(e.seed,r,e.hashVersion||2);return null===i||!e.ranges.some(e=>(0,a.inRange)(i,e))})}function f(e,t,r,i,n,a,s){let o=!0;(r<0||r>=t.variations.length)&&(r=0,o=!1);let{hashAttribute:c,hashValue:u}=g(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),l=t.meta?t.meta[r]:{},d={key:l.key||""+r,featureId:n,inExperiment:o,hashUsed:i,variationId:r,value:t.variations[r],hashAttribute:c,hashValue:u,stickyBucketUsed:!!s};return l.name&&(d.name=l.name),void 0!==a&&(d.bucket=a),l.passthrough&&(d.passthrough=l.passthrough),d}function g(e,t,r){let i=t||"id",n="",a=d(e);return a[i]&&(n=a[i]),!n&&r&&(a[r]&&(n=a[r]),n&&(i=r)),{hashAttribute:i,hashValue:n}}function y(e,t){return t=t||0,`${e}__${t}`}function v(e,t){return`${e}||${t}`}function m(e,t){let r,i,n,s={};return(r=new Set,i=t&&t.features?t.features:e.global.features||{},n=t&&t.experiments?t.experiments:e.global.experiments||[],Object.keys(i).forEac
1h(e=>{let t=i[e];if(t.rules)for(let e of t.rules)e.variations&&(r.add(e.hashAttribute||"id"),e.fallbackAttribute&&r.add(e.fallbackAttribute))}),n.map(e=>{r.add(e.hashAttribute||"id"),e.fallbackAttribute&&r.add(e.fallbackAttribute)}),Array.from(r)).forEach(t=>{let{hashValue:r}=g(e,t);s[t]=(0,a.toString)(r)}),s}function _(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}r.EVENT_FEATURE_EVALUATED="Feature Evaluated",r.EVENT_EXPERIMENT_VIEWED="Experiment Viewed",r.evalFeature=c,r.runExperiment=u,r.getExperimentResult=f,r.getHashAttribute=g,r.getStickyBucketAttributeKey=v,r.getAllStickyBucketAssignmentDocs=function(e,t,r){return i(this,void 0,void 0,function*(){let i=m(e,r);return t.getAllAssignments(i)})},r.getStickyBucketAttributes=m,r.decryptPayload=function(e,t,r){return i(this,void 0,void 0,function*(){if((e=Object.assign({},e)).encryptedFeatures){try{e.features=JSON.parse((yield(0,a.decrypt)(e.encryptedFeatures,t,r)))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse((yield(0,a.decrypt)(e.encryptedExperiments,t,r)))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse((yield(0,a.decrypt)(e.encryptedSavedGroups,t,r)))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e})},r.getApiHosts=function(e){let t=e.apiHost||"https://cdn.growthbook.io";return{apiHost:t.replace(/\/*$/,""),streamingHost:(e.streamingHost||t).replace(/\/*$/,""),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}},r.getExperimentDedupeKey=_},467030,(e,t,r)=>{"use strict";e.i(692504);var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r},a=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.prefetchPayload=r.GrowthBook=void 0;let s=a(e.r(850933)),o=e.r(107996),c=e.r(547450),u=e.r(220904),l="u">typeof window&&"u">typeof document,d=(0,o.loadSDKVersion)();class h{constructor(e){if(e=e||{},this.version=d,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw Error("Encryption is not available for remoteEval");if(!e.clientKey)throw Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch(e){}if(t)throw Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){const t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(const t of e.plugins)t(this);if(e.features&&(this.ready=!0),l&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(const e in this._options.stickyBucketAssignmentDocs){const t=this._options.stickyBucketAssignmentDocs[e];
1t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}setPayload(e){return i(this,void 0,void 0,function*(){this._payload=e;let t=yield(0,u.decryptPayload)(e,this._options.decryptionKey);this._decryptedPayload=t,yield this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()})}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,(0,c.startStreaming)(this,e),this}init(e){return i(this,void 0,void 0,function*(){if(this._initialized=!0,(e=e||{}).cacheSettings&&(0,c.configureCache)(e.cacheSettings),e.payload)return yield this.setPayload(e.payload),(0,c.startStreaming)(this,e),{success:!0,source:"init"};{let t=yield this._refresh(Object.assign(Object.assign({},e),{allowStale:!0})),{data:r}=t,i=n(t,["data"]);return(0,c.startStreaming)(this,e),yield this.setPayload(r||{}),i}})}loadFeatures(e){var t;return i(this,void 0,void 0,function*(){e=e||{},yield this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(null==(t=this._options.backgroundSync)||t)&&(e.autoRefresh||this._options.subscribeToChanges)})})}refreshFeatures(e){return i(this,void 0,void 0,function*(){let t=yield this._refresh(Object.assign(Object.assign({},e||{}),{allowStale:!1}));t.data&&(yield this.setPayload(t.data))})}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return(0,u.getApiHosts)(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}_refresh({timeout:e,skipCache:t,allowStale:r,streaming:n}){var a;return i(this,void 0,void 0,function*(){if(!this._options.clientKey)throw Error("Missing clientKey");return(0,c.refreshFeatures)({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:r,backgroundSync:null==(a=null!=n?n:this._options.backgroundSync)||a})})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}setEncryptedFeatures(e,t,r){return i(this,void 0,void 0,function*(){let i=yield(0,o.decrypt)(e,t||this._options.decryptionKey,r);this.setFeatures(JSON.parse(i))})}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}setEncryptedExperiments(e,t,r){return i(this,void 0,void 0,function*(){let i=yield(0,o.decrypt)(e,t||this._options.decryptionKey,r);this.setExperiments(JSON.parse(i))})}setAttributes(e){return i(this,void 0,void 0,function*(){(this._options.attributes=e,this._options.stickyBucketService&&(yield this.refreshStickyBuckets()),this._options.remoteEval)?yield this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())})}updateAttributes(e){return i(this,void 0,void 0,function*(){return this.setAttributes(Object.assign(Object.assign({},this._options.attributes),e))})}setAttributeOverrides(e){return i(this,void 0,void 0,function*(){(this._options.attributeOverrides=e,this._options.stickyBucketService&&(yield this.refreshStickyBuckets()),this._options.remoteEval)?yield this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())})}setForcedVariations(e){return i(this,void 0,void 0,function*(){(this._options.forcedVariations=e||{},this._options.remoteEval)?yield this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())})}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}setURL(e){return i(this,void 0,void 0,function*(){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval){yield this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}})}getAttributes(){return Object.assign(Object.assign({},this._options.attributes),this._options.attributeOverrides)}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}_refreshForRemoteEval(){return i(this,void 0,void 0,function*(){if(!this._options.remoteEval||!this._initialized)return;let e=yield this._refresh({allowStale:!1});e.data&&(yield this.setPayload(e.data))})}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{}
1,this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,(0,c.unsubscribe)(this),e.destroyAllStreams&&(0,c.clearAutoRefresh)(),this.logs=[],l&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval)?this._refreshForRemoteEval():(this._updateAllAutoExperiments(),this._render())}run(e){let{result:t}=(0,u.runExperiment)(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return(this._triggeredExpKeys.add(e),this._options.experiments)?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>null!==e):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?Object.assign(Object.assign({},this._options.user),this._options.attributes):this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){var r;let i,n,a=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!a)return null;this._isAutoExperimentBlockedByContext(e)?i=(0,u.getExperimentResult)(this._getEvalContext(),e,-1,!1,""):({result:i,trackingCall:n}=(0,u.runExperiment)(e,null,this._getEvalContext()),this._onExperimentEval(e,i));let s=JSON.stringify(i.value);if(!t&&i.inExperiment&&a&&a.valueHash===s)return i;if(a&&this._undoActiveAutoExperiment(e),i.inExperiment){let t=(0,o.getAutoExperimentChangeType)(e);if("redirect"===t&&i.value.urlRedirect&&e.urlPatterns){let t=e.persistQueryString?(0,o.mergeQueryStrings)(this._getContextUrl(),i.value.urlRedirect):i.value.urlRedirect;if((0,o.isURLTargeted)(t,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),i;this._redirectedUrl=t;let{navigate:a,delay:s}=this._getNavigateFunction();if(a)if(l)Promise.all([...n?[(0,o.promiseTimeout)(n,null!=(r=this._options.maxNavigateDelay)?r:1e3)]:[],new Promise(e=>{var t;return window.setTimeout(e,null!=(t=this._options.navigateDelay)?t:s)})]).then(()=>{try{a(t)}catch(e){console.error(e)}});else try{a(t)}catch(e){console.error(e)}}else if("visual"===t){let t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(i.value):this._applyDOMChanges(i.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:s})}}return i}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],r=new Set(t);
1for(let i of(this._activeAutoExperiments.forEach((e,t)=>{r.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))}),t)){let t=this._runAutoExperiment(i,e);if(t&&t.inExperiment&&"redirect"===(0,o.getAutoExperimentChangeType)(i))break}}_onExperimentEval(e,t){let r=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,r)}_fireSubscriptions(e,t,r){r&&r.result.inExperiment===t.inExperiment&&r.result.variationId===t.variationId||this._subscriptions.forEach(r=>{try{r(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let r=this.evalFeature(e).value;return null===r?t:r}feature(e){return this.evalFeature(e)}evalFeature(e){return(0,u.evalFeature)(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[(0,u.getExperimentDedupeKey)(e.experiment,e.result),e]))}fireDeferredTrackingCalls(){return i(this,void 0,void 0,function*(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{t&&t.experiment&&t.result?e.push(this._options.trackingCallback(t.experiment,t.result)):console.error("Invalid deferred tracking call",{call:t})}),this._deferredTrackingCalls.clear(),yield Promise.all(e)})}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}logEvent(e,t){return i(this,void 0,void 0,function*(){if(this._destroyed)return void console.error("Cannot log event to destroyed GrowthBook instance");if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{yield this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error("No event logger configured")})}_saveDeferredTrack(e){this._deferredTrackingCalls.set((0,u.getExperimentDedupeKey)(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(l?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=(0,o.getAutoExperimentChangeType)(e);if("visual"===t){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else{if("redirect"!==t||this._options.disableUrlRedirectExperiments)return!0;try{let t=new URL(this._getContextUrl());for(let r of e.variations){if(!r||!r.urlRedirect)continue;let e=new URL(r.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(e.protocol!==t.protocol||e.host!==t.host))return!0}}catch(t){return this.log("Error parsing current or redirect URL",{id:e.key,error:t}),!0}}return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:l?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!l)return;let t=[];if(e.css){let r=document.createElement("style");r.innerHTML=e.css,document.head.appendChild(r),t.push(()=>r.remove())}if(e.js){let r=document.createElement("script");r.innerHTML=e.js,this._options.jsInjectionNonce&&(r.nonce=this._options.jsInjectionNonce),document.head.appendChild(r),t.push(()=>r.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(s.default.declarative(e).revert)}),()=>{t.forEach(e=>e())}}refreshStickyBuckets(e){return i(this,void 0,void 0,function*(){if(this._options.stickyBucketService){let t=this._getEvalContext(),r=yield(0,u.getAllStickyBucketAssignmentDocs)(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=r}})}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e))return void console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");let r=this._getEvalContext(),i=(0,u.getStickyBucketAttributes)(r,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}}r.GrowthBook=h,r.prefetchPayload=function(e){return i(this,void 0,void 0,function*(){let t=new h(e);yield(0,c.refreshFeatures)({instance:t,skipCache:e.skipCache,allowStale:!1,backgroundSync:e.streaming}),t.destroy()})}},867868,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};
1Object.defineProperty(r,"__esModule",{value:!0}),r.UserScopedGrowthBook=r.GrowthBookClient=void 0;let a=e.r(107996),s=e.r(547450),o=e.r(220904),c=(0,a.loadSDKVersion)();r.GrowthBookClient=class{constructor(e){if(e=e||{},this.version=c,this._options=e,this.debug=!!e.debug,this.ready=!1,this._features={},this._experiments=[],this.log=this.log.bind(this),e.plugins)for(const t of e.plugins)t(this)}setPayload(e){return i(this,void 0,void 0,function*(){this._payload=e;let t=yield(0,o.decryptPayload)(e,this._options.decryptionKey);this._decryptedPayload=t,t.features&&(this._features=t.features),t.experiments&&(this._experiments=t.experiments),t.savedGroups&&(this._options.savedGroups=t.savedGroups),this.ready=!0})}initSync(e){let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw Error("initSync does not support encrypted payloads");return this._payload=t,this._decryptedPayload=t,t.features&&(this._features=t.features),t.experiments&&(this._experiments=t.experiments),this.ready=!0,(0,s.startStreaming)(this,e),this}init(e){return i(this,void 0,void 0,function*(){if((e=e||{}).cacheSettings&&(0,s.configureCache)(e.cacheSettings),e.payload)return yield this.setPayload(e.payload),(0,s.startStreaming)(this,e),{success:!0,source:"init"};{let t=yield this._refresh(Object.assign(Object.assign({},e),{allowStale:!0})),{data:r}=t,i=n(t,["data"]);return(0,s.startStreaming)(this,e),yield this.setPayload(r||{}),i}})}refreshFeatures(e){return i(this,void 0,void 0,function*(){let t=yield this._refresh(Object.assign(Object.assign({},e||{}),{allowStale:!1}));t.data&&(yield this.setPayload(t.data))})}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return(0,o.getApiHosts)(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this._experiments||[]}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}_refresh({timeout:e,skipCache:t,allowStale:r,streaming:n}){return i(this,void 0,void 0,function*(){if(!this._options.clientKey)throw Error("Missing clientKey");return(0,s.refreshFeatures)({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:r,backgroundSync:null==n||n})})}getFeatures(){return this._features||{}}getGlobalAttributes(){return this._options.globalAttributes||{}}setGlobalAttributes(e){this._options.globalAttributes=e}destroy(e){e=e||{},this._destroyed=!0,(0,s.unsubscribe)(this),e.destroyAllStreams&&(0,s.clearAutoRefresh)(),this._features={},this._experiments=[],this._decryptedPayload=void 0,this._payload=void 0,this._options={}}isDestroyed(){return!!this._destroyed}setEventLogger(e){this._options.eventLogger=e}logEvent(e,t,r){if(this._options.eventLogger){let i=this._getEvalContext(r);this._options.eventLogger(e,t,i.user)}}runInlineExperiment(e,t){let{result:r}=(0,o.runExperiment)(e,null,this._getEvalContext(t));return r}_getEvalContext(e){return this._options.globalAttributes&&(e=Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},this._options.globalAttributes),e.attributes)})),{user:e,global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getGlobalContext(){return{features:this._features,experiments:this._experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,forcedFeatureValues:this._options.forcedFeatureValues,forcedVariations:this._options.forcedVariations,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage}}isOn(e,t){return this.evalFeature(e,t).on}isOff(e,t){return this.evalFeature(e,t).off}getFeatureValue(e,t,r){let i=this.evalFeature(e,r).value;return null===i?t:i}evalFeature(e,t){return(0,o.evalFeature)(e,this._getEvalContext(t))}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}setTrackingCallback(e){this._options.trackingCallback=e}applyStickyBuckets(e,t){return i(this,void 0,void 0,function*(){let r=this._getEvalContext(e),i=yield(0,o.getAllStickyBucketAssignmentDocs)(r,t);return Object.assign(Object.assign({},e),{stickyBucketAssignmentDocs:i,saveStickyBucketAssignmentDoc:e=>t.saveAssignments(e)})})}createScopedInstance(e,t){return new u(this,e,[...this._options.plugins||[],...t||[]])}};class u{constructor(e,t,r){if(this._gb=e,this._userContext=t,this.logs=[],this._userContext.trackedExperiments=this._userContext.trackedExperiments||new Set,this._userContext.trackedFeatureUsage=this._userContext.trackedFeatureUsage||{},this._userContext.devLogs=this.logs,r)for(const e of r)e(this)}
1runInlineExperiment(e){return this._gb.runInlineExperiment(e,this._userContext)}isOn(e){return this._gb.isOn(e,this._userContext)}isOff(e){return this._gb.isOff(e,this._userContext)}getFeatureValue(e,t){return this._gb.getFeatureValue(e,t,this._userContext)}evalFeature(e){return this._gb.evalFeature(e,this._userContext)}logEvent(e,t){this._userContext.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._gb.logEvent(e,t||{},this._userContext)}setTrackingCallback(e){this._userContext.trackingCallback=e}getApiInfo(){return this._gb.getApiInfo()}getClientKey(){return this._gb.getClientKey()}setURL(e){this._userContext.url=e}updateAttributes(e){this._userContext.attributes=Object.assign(Object.assign({},this._userContext.attributes),e)}setAttributeOverrides(e){this._userContext.attributeOverrides=e}setForcedVariations(e){return i(this,void 0,void 0,function*(){this._userContext.forcedVariations=e||{}})}setForcedFeatures(e){this._userContext.forcedFeatureValues=e}getUserContext(){return this._userContext}getVersion(){return c}getDecryptedPayload(){return this._gb.getDecryptedPayload()}inDevMode(){return!!this._userContext.enableDevMode}}r.UserScopedGrowthBook=u},568516,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.RedisStickyBucketService=r.BrowserCookieStickyBucketService=r.ExpressCookieStickyBucketService=r.LocalStorageStickyBucketService=r.StickyBucketServiceSync=r.StickyBucketService=void 0;let n=e.r(107996),a=e.r(220904);class s{constructor(e){e=e||{},this.prefix=e.prefix||""}getAllAssignments(e){return i(this,void 0,void 0,function*(){let t={};return(yield Promise.all(Object.entries(e).map(([e,t])=>this.getAssignments(e,t)))).forEach(e=>{e&&(t[(0,a.getStickyBucketAttributeKey)(e.attributeName,e.attributeValue)]=e)}),t})}getKey(e,t){return`${this.prefix}${e}||${t}`}}r.StickyBucketService=s;class o extends s{getAssignments(e,t){return i(this,void 0,void 0,function*(){return this.getAssignmentsSync(e,t)})}saveAssignments(e){return i(this,void 0,void 0,function*(){this.saveAssignmentsSync(e)})}getAllAssignmentsSync(e){let t={};return Object.entries(e).map(([e,t])=>this.getAssignmentsSync(e,t)).forEach(e=>{e&&(t[(0,a.getStickyBucketAttributeKey)(e.attributeName,e.attributeValue)]=e)}),t}}r.StickyBucketServiceSync=o,r.LocalStorageStickyBucketService=class extends s{constructor(e){e=e||{},super(),this.prefix=e.prefix||"gbStickyBuckets__";try{this.localStorage=e.localStorage||globalThis.localStorage}catch(e){}}getAssignments(e,t){return i(this,void 0,void 0,function*(){let r=this.getKey(e,t),i=null;if(!this.localStorage)return i;try{let e=(yield this.localStorage.getItem(r))||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(i=t)}catch(e){}return i})}saveAssignments(e){return i(this,void 0,void 0,function*(){let t=this.getKey(e.attributeName,e.attributeValue);if(this.localStorage)try{yield this.localStorage.setItem(t,JSON.stringify(e))}catch(e){}})}},r.ExpressCookieStickyBucketService=class extends o{constructor({prefix:e="gbStickyBuckets__",req:t,res:r,cookieAttributes:i={maxAge:15552e6}}){super(),this.prefix=e,this.req=t,this.res=r,this.cookieAttributes=i}getAssignmentsSync(e,t){let r=this.getKey(e,t),i=null;if(!this.req)return i;try{let e=this.req.cookies[r]||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(i=t)}catch(e){}return i}saveAssignmentsSync(e){let t=this.getKey(e.attributeName,e.attributeValue);if(!this.res)return;let r=JSON.stringify(e);this.res.cookie(encodeURIComponent(t),encodeURIComponent(r),this.cookieAttributes)}},r.BrowserCookieStickyBucketService=class extends o{constructor({prefix:e="gbStickyBuckets__",jsCookie:t,cookieAttributes:r={expires:180}}){super(),this.prefix=e,this.jsCookie=t,this.cookieAttributes=r}getAssignmentsSync(e,t){let r=this.getKey(e,t),i=null;if(!this.jsCookie)return i;try{let e=this.jsCookie.get(r),t=JSON.parse(e||"{}");t.attributeName&&t.attributeValue&&t.assignments&&(i=t)}catch(e){}return i}saveAssignmentsSync(e){return i(this,void 0,void 0,function*(){let t=this.getKey(e.attributeName,e.attributeValue);if(!this.jsCookie)return;let r=JSON.stringify(e);this.jsCookie.set(t,r,this.cookieAttributes)})}},r.RedisStickyBucketService=class extends s{constructor({redis:e}){super(),this.redis=e}getAllAssignments(e){return i(this,void 0,void 0,function*(){let t={},r=Object.entries(e).map(([e,t])=>(0,a.getStickyBucketAttributeKey)(e,t));return this.redis&&(yield this.redis.mget(...r).then(e=>
1{e.forEach(e=>{try{let r=JSON.parse(e||"{}");r.attributeName&&"attributeValue"in r&&r.assignments&&(t[(0,a.getStickyBucketAttributeKey)(r.attributeName,(0,n.toString)(r.attributeValue))]=r)}catch(e){}})})),t})}getAssignments(e,t){return i(this,void 0,void 0,function*(){return null})}saveAssignments(e){return i(this,void 0,void 0,function*(){let t=this.getKey(e.attributeName,e.attributeValue);this.redis&&(yield this.redis.set(t,JSON.stringify(e)))})}}},803022,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EVENT_FEATURE_EVALUATED=r.EVENT_EXPERIMENT_VIEWED=r.paddedVersionString=r.getAutoExperimentChangeType=r.getPolyfills=r.isURLTargeted=r.evalCondition=r.RedisStickyBucketService=r.BrowserCookieStickyBucketService=r.ExpressCookieStickyBucketService=r.LocalStorageStickyBucketService=r.StickyBucketServiceSync=r.StickyBucketService=r.UserScopedGrowthBook=r.GrowthBookClient=r.GrowthBookMultiUser=r.prefetchPayload=r.GrowthBook=r.onHidden=r.onVisible=r.helpers=r.configureCache=r.clearCache=r.setPolyfills=void 0;var i=e.r(547450);Object.defineProperty(r,"setPolyfills",{enumerable:!0,get:function(){return i.setPolyfills}}),Object.defineProperty(r,"clearCache",{enumerable:!0,get:function(){return i.clearCache}}),Object.defineProperty(r,"configureCache",{enumerable:!0,get:function(){return i.configureCache}}),Object.defineProperty(r,"helpers",{enumerable:!0,get:function(){return i.helpers}}),Object.defineProperty(r,"onVisible",{enumerable:!0,get:function(){return i.onVisible}}),Object.defineProperty(r,"onHidden",{enumerable:!0,get:function(){return i.onHidden}});var n=e.r(467030);Object.defineProperty(r,"GrowthBook",{enumerable:!0,get:function(){return n.GrowthBook}}),Object.defineProperty(r,"prefetchPayload",{enumerable:!0,get:function(){return n.prefetchPayload}});var a=e.r(867868);Object.defineProperty(r,"GrowthBookMultiUser",{enumerable:!0,get:function(){return a.GrowthBookClient}}),Object.defineProperty(r,"GrowthBookClient",{enumerable:!0,get:function(){return a.GrowthBookClient}}),Object.defineProperty(r,"UserScopedGrowthBook",{enumerable:!0,get:function(){return a.UserScopedGrowthBook}});var s=e.r(568516);Object.defineProperty(r,"StickyBucketService",{enumerable:!0,get:function(){return s.StickyBucketService}}),Object.defineProperty(r,"StickyBucketServiceSync",{enumerable:!0,get:function(){return s.StickyBucketServiceSync}}),Object.defineProperty(r,"LocalStorageStickyBucketService",{enumerable:!0,get:function(){return s.LocalStorageStickyBucketService}}),Object.defineProperty(r,"ExpressCookieStickyBucketService",{enumerable:!0,get:function(){return s.ExpressCookieStickyBucketService}}),Object.defineProperty(r,"BrowserCookieStickyBucketService",{enumerable:!0,get:function(){return s.BrowserCookieStickyBucketService}}),Object.defineProperty(r,"RedisStickyBucketService",{enumerable:!0,get:function(){return s.RedisStickyBucketService}});var o=e.r(654863);Object.defineProperty(r,"evalCondition",{enumerable:!0,get:function(){return o.evalCondition}});var c=e.r(107996);Object.defineProperty(r,"isURLTargeted",{enumerable:!0,get:function(){return c.isURLTargeted}}),Object.defineProperty(r,"getPolyfills",{enumerable:!0,get:function(){return c.getPolyfills}}),Object.defineProperty(r,"getAutoExperimentChangeType",{enumerable:!0,get:function(){return c.getAutoExperimentChangeType}}),Object.defineProperty(r,"paddedVersionString",{enumerable:!0,get:function(){return c.paddedVersionString}});var u=e.r(220904);Object.defineProperty(r,"EVENT_EXPERIMENT_VIEWED",{enumerable:!0,get:function(){return u.EVENT_EXPERIMENT_VIEWED}}),Object.defineProperty(r,"EVENT_FEATURE_EVALUATED",{enumerable:!0,get:function(){return u.EVENT_FEATURE_EVALUATED}})},939520,(e,t,r)=>{"use strict";var i=e.i(692504);function n(e=!1){try{return"u">typeof window&&"u">typeof document&&"string"==typeof document.cookie}catch(t){return console.error(t),e}}Object.defineProperty(r,"__esModule",{value:!0}),r.getEnvVariable=r.safeIsClient=void 0,r.safeIsClient=n,r.getEnvVariable=function(e){var t,r;return n()?null!=(r=null==(t=window.ENV)?void 0:t[e])?r:"":i.default.env[e]}},731941,(e,t,r)=>{"use strict";var i;
1Object.defineProperty(r,"__esModule",{value:!0}),r.AllowedNamespace=void 0,(i=r.AllowedNamespace||(r.AllowedNamespace={})).TEST="test",i.SHOP="codashop",i.PAY="codapay",i.COMMUNICATION_SERVICE="communication-service",i.DISTRIBUTION="distribution",i.PUBLISHER_PORTAL="publisher-portal",i.RMS="risk-management-service",i.RECHARGE_V2="recharge-v2",i.TREX="trex",i.UNKNOWN="unknown"},441264,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ExperimentationConfigBuilder=r.ExperimentationConfig=void 0;let i=e.r(939520),n=e.r(731941);class a{constructor(e,t,r,i,s,o,c,u,l,d){this.version=0,this._mode=a.MODE_PROD,this._namespace=n.AllowedNamespace.UNKNOWN,this._namespacedFeatures=!1,this._fetchTimeoutMs=a.DEFAULT_FETCH_TIMEOUT_MS,this._fetchMaxRetries=a.DEFAULT_FETCH_MAX_RETRIES,this._endPointUrl=e,this._mode=t,this._errorHandler=r,this._fetchTimeoutMs=i,this._fetchMaxRetries=s,this._eventTrackingUrl=o,this._exptTokenUrl=c,this._namespace=u,this._namespacedFeatures=l,this._sampleRate=d,this.version=++a.GLOBAL_CONFIG_VERSION}static builder(){return new s}_isEmptyString(e){return!e||0===e.trim().length}_hasMode(){return!!this._mode&&this._mode.trim().length>0&&this._mode in a.MODES_MAP}get endPointUrl(){if(!this._isEmptyString(this._endPointUrl)&&!this._hasMode())return this._endPointUrl;let{endpoint:e,featuresKey:t}=a.MODES_MAP[this._mode],r=e.features;return this._namespacedFeatures&&this.namespace?`${r}/${this.namespace}/${t}`:`${r}/${t}`}get eventTrackingUrl(){return this._isEmptyString(this._eventTrackingUrl)&&this._hasMode()?a.MODES_MAP[this._mode].endpoint.eventTracking:this._eventTrackingUrl}get exptTokenUrl(){return this._isEmptyString(this._exptTokenUrl)&&this._hasMode()?a.MODES_MAP[this._mode].endpoint.exptToken:this._exptTokenUrl}get mode(){return this._mode}get namespace(){return this._namespace}get namespacedFeatures(){return this._namespacedFeatures}get errorHandler(){return this._errorHandler}get fetchTimeoutMs(){return this._fetchTimeoutMs}get fetchMaxRetries(){return this._fetchMaxRetries}get isProductionMode(){return this._mode===a.MODE_PROD}get sampleRate(){return this._sampleRate}}r.ExperimentationConfig=a,a.DEFAULT_FETCH_TIMEOUT_MS=8e3,a.DEFAULT_FETCH_MAX_RETRIES=3,a.MODE_PROD="prod",a.MODE_STAGING="qa",a.MODE_DEV="dev",a.MODE_LOCAL="local",a.GLOBAL_CONFIG_VERSION=0,a.MODES_MAP={[a.MODE_PROD]:{endpoint:{features:"https://features-cdn.codainfra.com",eventTracking:"https://events.codainfra.com/topics/experiment-viewed",exptToken:"https://api-experiments.codainfra.com/api/v1/id"},featuresKey:"features.json"},[a.MODE_STAGING]:{endpoint:{features:"https://features-cdn.codainfra.com",eventTracking:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/experiment-viewed",exptToken:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/api/v1/id"},featuresKey:"qa-features.json"},[a.MODE_DEV]:{endpoint:{features:"https://features-cdn.codainfra.com",eventTracking:"https://dev-events.codainfra.com/topics/experiment-viewed",exptToken:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/api/v1/id"},featuresKey:"dev-features.json"},[a.MODE_LOCAL]:{endpoint:{get features(){return`${(0,i.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}`},get eventTracking(){return`${(0,i.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/experiment-viewed`},get exptToken(){return`${(0,i.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/api/v1/id`}},featuresKey:"features.json"}};class s{constructor(){this.mode=a.MODE_PROD,this.namespace=n.AllowedNamespace.UNKNOWN,this.namespacedFeatures=!1,this.sampleRate=0,this.fetchTimeoutMs=a.DEFAULT_FETCH_TIMEOUT_MS,this.fetchMaxRetries=a.DEFAULT_FETCH_MAX_RETRIES}setEndPointUrl(e){return this.endPointUrl=e,this}setEventTrackingUrl(e){return this.eventTrackingUrl=e,this}setExptTokenUrl(e){return this.exptTokenUrl=e,this}setMode(e){return this.mode=e,this}setNamespace(e){return this.namespace=e,this}setNamespacedFeatures(e){return this.namespacedFeatures=!!e,this}setErrorHandler(e){return this.errorHandler=e,this}setFetchTimeoutMs(e){return this.fetchTimeoutMs=e,this}setFetchMaxRetries(e){return this.fetchMaxRetries=e,this}setSampleRate(e){return this.sampleRate=e,this}build(){return new a(this.endPointUrl,this.mode,this.errorHandler,this.fetchTimeoutMs,this.fetchMaxRetries,this.eventTrackingUrl,this.exptTokenUrl,this.namespace,this.namespacedFeatures,this.sampleRate)}}r.ExperimentationConfigBuilder=s},497045,e=>{"use strict";var t=e.i(692504),r="undefined",i="object",n=typeof t.default!==r?t.default:{},a=(n.env&&n.env.NODE_ENV,typeof document!==r);function s(e,t){return t.charAt(0)[e]()+t.slice(1)}a&&window.location.hostname,null!=n.versions&&n.versions.node,typeof Deno!==r&&Deno.core,typeof self===i&&self.constructor&&self.constructor.name,a&&"nodejs"===window.name||typeof navigator!==r&&typeof navigator.userAgent!==r&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var o=s.bind(null,"toUpperCase"),c=s.bind(null,"toLowerCase");function u(e,t){void 0===t&&(t=!0);
1var r,n=null===e?o("null"):typeof e===i?d((r=e).constructor)?r.constructor.name:null:Object.prototype.toString.call(e).slice(8,-1);return t?c(n):n}function l(e,t){return typeof t===e}var d=l.bind(null,"function"),h=l.bind(null,"string"),p=l.bind(null,r);function f(e,t){if("object"!=typeof t||null===t)return!1;if(t instanceof e)return!0;var r,i,n=u(new e(""));if((r=t)instanceof Error||h(r.message)&&r.constructor&&"number"===u(i=r.constructor.stackTraceLimit)&&!isNaN(i))for(;t;){if(u(t)===n)return!0;t=Object.getPrototypeOf(t)}return!1}function g(e,t){var r,i,n=e instanceof Element||e instanceof HTMLDocument;return n&&t?(r=e,void 0===(i=t)&&(i=""),r&&r.nodeName===i.toUpperCase()):n}function y(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}l.bind(null,"boolean"),l.bind(null,"symbol"),f.bind(null,TypeError),f.bind(null,SyntaxError),y(g,"form"),y(g,"button"),y(g,"input"),y(g,"select");var v="global",m="__"+v+"__",_=typeof self===i&&self.self===self&&self||e.g[v]===e.g&&e.g||void 0;function E(e){return _[m][e]}function b(e,t){return _[m][e]=t}function w(e){delete _[m][e]}function S(e,t,r){var i;try{if(k(e)){var n=window[e];i=n[t].bind(n)}}catch(e){}return i||r}_[m]||(_[m]={});var A={};function k(e){if(typeof A[e]!==r)return A[e];try{var t=window[e];t.setItem(r,r),t.removeItem(r)}catch(t){return A[e]=!1}return A[e]=!0}var C="cookie",O=I(),T=K,x=K;function P(e){return O?K(e,"",-1):w(e)}function I(){if(void 0!==O)return O;var e=C+C;try{K(e,e),O=-1!==document.cookie.indexOf(e),P(e)}catch(e){O=!1}return O}function K(e,t,r,i,n,a){if("u">typeof window){var s=arguments.length>1;return!1===O&&(s?b(e,t):E(e)),s?document.cookie=e+"="+encodeURIComponent(t)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(i?"; path="+i:"")+(n?"; domain="+n:"")+(a?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var R="localStorage",D=k.bind(null,R);S(R,"getItem",E),S(R,"setItem",b),S(R,"removeItem",w);var M="sessionStorage",H=k.bind(null,M);function U(e){var t=e;try{if("true"===(t=JSON.parse(e)))return!0;if("false"===t)return!1;if(function(e){var t;if(!((t=e)&&(typeof t===i||null!==t)))return!1;for(var r=e;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch(e){}if(null!==t&&""!==t)return t}S(M,"getItem",E),S(M,"setItem",b),S(M,"removeItem",w);var j=D(),V=H(),N=I();function B(e,t){if(e){var r=F(t),i=!Y(r),n=L(r)?U(localStorage.getItem(e)):void 0;if(i&&!p(n))return n;var a=G(r)?U(T(e)):void 0;if(i&&a)return a;var s=$(r)?U(sessionStorage.getItem(e)):void 0;if(i&&s)return s;var o=E(e);return i?o:{localStorage:n,sessionStorage:s,cookie:a,global:o}}}function W(e,t,r){if(e&&!p(t)){var i={},n=F(r),a=JSON.stringify(t),s=!Y(n);return L(n)&&(i[R]=z(R,t,U(localStorage.getItem(e))),localStorage.setItem(e,a),s)?i[R]:G(n)&&(i[C]=z(C,t,U(T(e))),x(e,a),s)?i[C]:$(n)&&(i[M]=z(M,t,U(sessionStorage.getItem(e))),sessionStorage.setItem(e,a),s)?i[M]:(i[v]=z(v,t,E(e)),b(e,t),s?i[v]:i)}}function J(e,t){if(e){var r=F(t),i=B(e,"*"),n={};return!p(i.localStorage)&&L(r)&&(localStorage.removeItem(e),n[R]=i.localStorage),!p(i.cookie)&&G(r)&&(P(e),n[C]=i.cookie),!p(i.sessionStorage)&&$(r)&&(sessionStorage.removeItem(e),n[M]=i.sessionStorage),!p(i.global)&&X(r,v)&&(w(e),n[v]=i.global),n}}function F(e){return e?h(e)?e:e.storage:"any"}function L(e){return j&&X(e,R)}function G(e){return N&&X(e,C)}function $(e){return V&&X(e,M)}function Y(e){return"*"===e||"all"===e}function X(e,t){return"any"===e||e===t||Y(e)}function z(e,t,r){return{location:e,current:t,previous:r}}var q={setItem:W,getItem:B,removeItem:J};e.s(["default",0,q,"getItem",0,B,"removeItem",0,J,"setItem",0,W],79660),e.i(79660),e.s(["ALL",0,"*","ANY",0,"any","COOKIE",0,C,"GLOBAL",0,v,"LOCAL_STORAGE",0,R,"SESSION_STORAGE",0,M,"default",0,q,"getCookie",0,T,"getItem",0,B,"globalContext",0,_,"hasCookies",0,I,"hasLocalStorage",0,D,"hasSessionStorage",0,H,"removeCookie",0,P,"removeItem",0,J,"setCookie",0,x,"setItem",0,W],497045)},140643,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.ChainableStore=void 0,r.ChainableStore=class{constructor(e){e&&(this._nextStore=e)}syncValue(e,t){this.saveOrUpdateValue(e,t),this._nextStore&&this._nextStore.syncValue(e,t)}}},702501,(e,t,r)=>{t.exports=function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(1);e.exports=function(t,r){var a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s="object"===("u"<typeof document?"undefined":i(document))&&"string"==typeof document.cookie,o="object"===(void 0===t?"undefined":i(t))&&"object"===(void 0===r?"undefined":i(r))&&void 0!==e,c=!s&&!o||s&&o,u=function(e){if(o){var i=t.headers.cookie||"";return e&&(i=(i=r.getHeaders())["set-cookie"]?i["set-cookie"].map(function(e){return e.split(";")[0]}).join(";"):""),i}if(s)return document.cookie||""},l=function(){var e=r.getHeader("Set-Cookie");return(e="string"==typeof e?[e]:e)||[]},d=function(e,t){if(!t)return e;try{return JSON.parse(e)}catch(t){return e}},h={parseJSON:a,set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"};if(!c)if(t="object"===(void 0===t?"undefined":i(t))?JSON.stringify(t):t,o){var s=l();s.push(n.serialize(e,t,a)),r.setHeader("Set-Cookie",s)}else document.cookie=n.serialize(e,t,a)},setAll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];c||Array.isArray(e)&&e.forEach(function(e){var t=e.name,r=e.value,i=e.opts;h.set(void 0===t?"":t,void 0===r?"":r,void 0===i?{path:"/"}:i)})},get:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fromRes:!1,parseJSON:h.parseJSON};return c?"":d(n.parse(u(t.fromRes))[e],t.parseJSON)},getAll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{fromRes:!1,parseJSON:h.parseJSON};if(c)return{};var t=n.parse(u(e.fromRes));for(var r in t)t[r]=d(t[r],e.parseJSON);return t},remove:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{path:"/"};c||(t.expires=new Date(0),h.set(e,"",t))},removeAll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:"/"};if(!c){var t=n.parse(u());for(var r in t)h.remove(r,e)}},nodeCookie:n};return h}},function(e,t,r){"use strict";t.parse=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");for(var r={},n=e.split(a),s=(t||{}).decode||i,o=0;o<n.length;o++){var c=n[o],u=c.indexOf("=");if(!(u<0)){var l=c.substr(0,u).trim(),d=c.substr(++u,c.length).trim();'"'==d[0]&&(d=d.slice(1,-1)),void 0==r[l]&&(r[l]=function(e,t){try{return t(e)}catch(t){return e}}(d,s))}}return r},t.serialize=function(e,t,r){var i=r||{},a=i.encode||n;if("function"!=typeof a)throw TypeError("option encode is invalid");if(!s.test(e))throw TypeError("argument name is invalid");var o=a(t);if(o&&!s.test(o))throw TypeError("argument val is invalid");var c=e+"="+o;if(null!=i.maxAge){var u=i.maxAge-0;if(isNaN(u))throw Error("maxAge should be a Number");c+="; Max-Age="+Math.floor(u)}if(i.domain){if(!s.test(i.domain))throw TypeError("option domain is invalid");c+="; Domain="+i.domain}if(i.path){if(!s.test(i.path))throw TypeError("option path is invalid");c+="; Path="+i.path}if(i.expires){if("function"!=typeof i.expires.toUTCString)throw TypeError("option expires is invali
1d");c+="; Expires="+i.expires.toUTCString()}if(i.httpOnly&&(c+="; HttpOnly"),i.secure&&(c+="; Secure"),i.sameSite)switch("string"==typeof i.sameSite?i.sameSite.toLowerCase():i.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return c};var i=decodeURIComponent,n=encodeURIComponent,a=/; */,s=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/}])},679790,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.tld=void 0;let n=i(e.r(702501)),a="__ctld__";r.tld=function(e){let t,r=function(e){try{return new URL(e)}catch(e){return}}(e);if(!r)return;let i=function(e){let t=e.hostname.split("."),r=t[t.length-1],i=[];if(4===t.length&&parseInt(r,10)>0||t.length<=1)return i;for(let e=t.length-2;e>=0;--e)i.push(t.slice(e).join("."));return i}(r),s=(0,n.default)();for(let e=0;e<i.length;++e){let r=i[e],n={domain:"."+r};try{if(s.set(a,"1",n),s.get(a)){s.remove(a,n),t=r;break}}catch(e){console.error(e);break}}return t}},205324,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.CookieStore=void 0;let n=e.r(140643),a=i(e.r(702501)),s=e.r(679790),o=e.r(939520);class c extends n.ChainableStore{constructor(e,t){super(e),this._cfg=t}getOrCreate(e,t){if(this.isCookieAvailable()){let r=(0,a.default)();return r.get(e)?r.get(e):this._nextStore?this._nextStore.getOrCreate(e,t):t()}return t()}saveOrUpdateValue(e,t){var r,i,n,o;if(this.isCookieAvailable()){let c=(0,a.default)(),u={path:"/",maxAge:31536e4,priority:"high"};try{if(null!=(i=null==(r=this._cfg)?void 0:r.allowSubdomain)&&i&&null!=(o=null==(n=null==document?void 0:document.location)?void 0:n.origin)&&o){let e=(0,s.tld)(document.location.origin);(null==e?void 0:e.trim())&&(u.domain=this._domain=`.${e.trim()}`)}}catch(e){console.error(e)}c.set(e,t,u)}return t}getDomain(){return this._domain}isCookieAvailable(){return(0,o.safeIsClient)()}}r.CookieStore=c},612561,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getOrCreateSegmentAnonymousId=r.storageAvailable=void 0,r.storageAvailable=function(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(t){if(!(t instanceof DOMException))return!1;return(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&window[e]&&window[e].length>0}};let i=!1;r.getOrCreateSegmentAnonymousId=function(e){var t;try{if(!i&&"u">typeof analytics&&analytics.ready(()=>{i=!0}),i&&(null==analytics?void 0:analytics.user))return null==(t=analytics.user())?void 0:t.anonymousId();return e()}catch(t){console.error("Failed to get Segment ID:",t);try{return e()}catch(e){return e instanceof Error?e.message:"Failed to generate anonymous ID"}}}},156457,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.LocalStorageStore=void 0;let i=e.r(140643),n=e.r(612561),a=e.r(939520);class s extends i.ChainableStore{constructor(e){super(e)}getOrCreate(e,t){let r=null;return this.isStorageAvailable()&&(r=localStorage.getItem(e)?localStorage.getItem(e):null!=this._nextStore?this._nextStore.getOrCreate(e,t):null),null===r?t():r}saveOrUpdateValue(e,t){return this.isStorageAvailable()&&localStorage.setItem(e,t),t}isStorageAvailable(){return(0,a.safeIsClient)()&&(0,n.storageAvailable)("localStorage")}}r.LocalStorageStore=s},816577,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.SSRCookieStore=void 0;let n=e.r(140643),a=i(e.r(702501));class s extends n.ChainableStore{constructor(e,t,r){super(r),this._req=e,this._resp=t}getOrCreate(e,t){let r=(0,a.default)(this._req,this._resp);return r.get(e)?r.get(e):this._nextStore?this._nextStore.getOrCreate(e,t):t()}saveOrUpdateValue(e,t){return(0,a.default)(this._req,this._resp).set(e,t),t}}r.SSRCookieStore=s},8663,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};
1Object.defineProperty(r,"__esModule",{value:!0});let n=[419,503,504],a=(e,t,r,i,a)=>(!!i||!a||n.includes(a.status))&&t<r;function s(e,t){let r=Object.assign(Object.assign({},t),e);return void 0===r.retries&&(r.retries=t.retries),void 0===r.retryDelay&&(r.retryDelay=t.retryDelay),void 0===r.retryOn&&(r.retryOn=t.retryOn),r}r.default=function(e,t={}){let r=s(t,{retries:3,retryDelay:500,retryOn:n,timeoutMs:8e3});return function(t,n){return i(this,void 0,void 0,function*(){let i=s({retries:null==n?void 0:n.retries,retryDelay:null==n?void 0:n.retryDelay,retryOn:null==n?void 0:n.retryOn},r),o="function"==typeof i.retryDelay?i.retryDelay:()=>i.retryDelay,c="function"==typeof i.retryOn?i.retryOn:a;return new Promise((r,a)=>{let s=s=>{e(t,n).then(e=>{c(t,s,i.retries,null,e)?u(s,null,e):r(e)}).catch(e=>{c(t,s,i.retries,e,null)?u(s,e,null):a(e)})},u=(e,t,r)=>{setTimeout(()=>s(e+1),o(e,t,r))};s(0)})})}}},979691,(e,t,r)=>{"use strict";var i=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=e.e&&e.e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e.e&&e.e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},s=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},o=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let c=o(e.r(8663));class u{constructor(t){var r,i,n,o;this.withKeepAlive=!1;const l={timeoutMs:(null!=(r=null==t?void 0:t.timeoutMs)?r:0)>0?t.timeoutMs:u.DEFAULT_CONFIG.timeoutMs,retries:null!=(i=null==t?void 0:t.retries)?i:u.DEFAULT_CONFIG.retries,retryDelay:null!=(n=null==t?void 0:t.retryDelay)?n:u.DEFAULT_CONFIG.retryDelay,retryOn:null!=(o=null==t?void 0:t.retryOn)?o:u.DEFAULT_CONFIG.retryOn},d=(t,r)=>s(this,void 0,void 0,function*(){var i;let n,s=new AbortController;try{n=globalThis.setTimeout(()=>s.abort(),l.timeoutMs);let o=null!=(i=globalThis.fetch)?i:(yield Promise.resolve().then(()=>a(e.r(7577)))).default;return yield o(t,Object.assign(Object.assign({},r),{signal:s.signal}))}finally{clearTimeout(n)}});this.fetcher=(0,c.default)(d,l)}fetch(e,t){return s(this,void 0,void 0,function*(){if(this.withKeepAlive&&t){let e="string"==typeof t.body?t.body.length:0;t=Object.assign(Object.assign({},t),{keepalive:e<=65536})}return this.fetcher(e,t)})}setKeepAlive(e){this.withKeepAlive=e}}r.default=u,u.LOG_PREFIX="trex256",u.DEFAULT_CONFIG={timeoutMs:8e3,retries:2,retryDelay:300,retryOn:(e,t,r,i,n)=>t<r&&(null!==i||null==n||n.status>=400)}},216434,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=n(e.r(979691));r.default=class{constructor(e){this._cfg=e,this.exptFetcher=new a.default({timeoutMs:5e3,retries:2})}fetchExptToken(){return i(this,void 0,void 0,function*(){return yield this.exptFetcher.fetch(this._cfg.exptTokenUrl).then(e=>e.text())})}}},951584,e=>{"use strict";let t,r,i;e.s([],777454),e.i(777454);let n=crypto,a=async(e,t)=>{let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await n.subtle.digest(r,t))},s=new TextEncoder,o=new TextDecoder;function c(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let i of e)t.set(i,r),r+=i.length;return t}function u(e,t,r){if(t<0||t>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}
1function l(e){let t=Math.floor(e/0x100000000),r=new Uint8Array(8);return u(r,t,0),u(r,e%0x100000000,4),r}function d(e){let t=new Uint8Array(4);return u(t,e),t}function h(e){return c(d(e.length),e)}async function p(e,t,r){let i=Math.ceil((t>>3)/32),n=new Uint8Array(32*i);for(let t=0;t<i;t++){let i=new Uint8Array(4+e.length+r.length);i.set(d(t+1)),i.set(e,4),i.set(r,4+e.length),n.set(await a("sha256",i),32*t)}return n.slice(0,t>>3)}let f=e=>{let t=e;"string"==typeof t&&(t=s.encode(t));let r=[];for(let e=0;e<t.length;e+=32768)r.push(String.fromCharCode.apply(null,t.subarray(e,e+32768)));return btoa(r.join(""))},g=e=>f(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),y=e=>{let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r},v=e=>{let t=e;t instanceof Uint8Array&&(t=o.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return y(t)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}};class m extends Error{constructor(e,t){super(e,t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}m.code="ERR_JOSE_GENERIC";class _ extends m{constructor(e,t,r="unspecified",i="unspecified"){super(e,{cause:{claim:r,reason:i,payload:t}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=i,this.payload=t}}_.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class E extends m{constructor(e,t,r="unspecified",i="unspecified"){super(e,{cause:{claim:r,reason:i,payload:t}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=i,this.payload=t}}E.code="ERR_JWT_EXPIRED";class b extends m{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}b.code="ERR_JOSE_ALG_NOT_ALLOWED";class w extends m{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}w.code="ERR_JOSE_NOT_SUPPORTED";class S extends m{constructor(e="decryption operation failed",t){super(e,t),this.code="ERR_JWE_DECRYPTION_FAILED"}}S.code="ERR_JWE_DECRYPTION_FAILED";class A extends m{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}A.code="ERR_JWE_INVALID";class k extends m{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}k.code="ERR_JWS_INVALID";class C extends m{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}C.code="ERR_JWT_INVALID";class O extends m{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}O.code="ERR_JWK_INVALID";class T extends m{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}T.code="ERR_JWKS_INVALID";class x extends m{constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_NO_MATCHING_KEY"}}x.code="ERR_JWKS_NO_MATCHING_KEY";class P extends m{constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}P.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class I extends m{constructor(e="request timed out",t){super(e,t),this.code="ERR_JWKS_TIMEOUT"}}I.code="ERR_JWKS_TIMEOUT";class K extends m{constructor(e="signature verification failed",t){super(e,t),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}K.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",e.s(["JOSEAlgNotAllowed",0,b,"JOSEError",0,m,"JOSENotSupported",0,w,"JWEDecryptionFailed",0,S,"JWEInvalid",0,A,"JWKInvalid",0,O,"JWKSInvalid",0,T,"JWKSMultipleMatchingKeys",0,P,"JWKSNoMatchingKey",0,x,"JWKSTimeout",0,I,"JWSInvalid",0,k,"JWSSignatureVerificationFailed",0,K,"JWTClaimValidationFailed",0,_,"JWTExpired",0,E,"JWTInvalid",0,C],133186);let R=n.getRandomValues.bind(n);function D(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new w(`Unsupported JWE Algorithm: ${e}`)}}let M=(e,t)=>{if(t.length<<3!==D(e))throw new A("Invalid Initialization Vector length")},H=(e,t)=>{let r=e.byteLength<<3;if(r!==t)throw new A(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)};function U(e,t="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function j(e,t){return e.name===t}function V(e){return parseInt(e.name.slice(4),10)}function N(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){let r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw TypeError(e)}}function B(e,t,...r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!j(e.algorithm,"AES-GCM"))throw U("AES-GCM");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw U(r,"algorithm.length");break}
1case"A128KW":case"A192KW":case"A256KW":{if(!j(e.algorithm,"AES-KW"))throw U("AES-KW");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw U(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw U("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!j(e.algorithm,"PBKDF2"))throw U("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!j(e.algorithm,"RSA-OAEP"))throw U("RSA-OAEP");let r=parseInt(t.slice(9),10)||1;if(V(e.algorithm.hash)!==r)throw U(`SHA-${r}`,"algorithm.hash");break}default:throw TypeError("CryptoKey does not support this operation")}N(e,r)}function W(e,t,...r){if((r=r.filter(Boolean)).length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let J=(e,...t)=>W("Key must be ",e,...t);function F(e,t,...r){return W(`Key for the ${e} algorithm must be `,t,...r)}let L=e=>e instanceof CryptoKey||e?.[Symbol.toStringTag]==="KeyObject",G=["CryptoKey"];async function $(e,t,r,i,a,s){let o,u;if(!(t instanceof Uint8Array))throw TypeError(J(t,"Uint8Array"));let d=parseInt(e.slice(1,4),10),h=await n.subtle.importKey("raw",t.subarray(d>>3),"AES-CBC",!1,["decrypt"]),p=await n.subtle.importKey("raw",t.subarray(0,d>>3),{hash:`SHA-${d<<1}`,name:"HMAC"},!1,["sign"]),f=c(s,i,r,l(s.length<<3)),g=new Uint8Array((await n.subtle.sign("HMAC",p,f)).slice(0,d>>3));try{o=((e,t)=>{if(!(e instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(t instanceof Uint8Array))throw TypeError("Second argument must be a buffer");if(e.length!==t.length)throw TypeError("Input buffers must have the same length");let r=e.length,i=0,n=-1;for(;++n<r;)i|=e[n]^t[n];return 0===i})(a,g)}catch{}if(!o)throw new S;try{u=new Uint8Array(await n.subtle.decrypt({iv:i,name:"AES-CBC"},h,r))}catch{}if(!u)throw new S;return u}async function Y(e,t,r,i,a,s){let o;t instanceof Uint8Array?o=await n.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(B(t,e,"decrypt"),o=t);try{return new Uint8Array(await n.subtle.decrypt({additionalData:s,iv:i,name:"AES-GCM",tagLength:128},o,c(r,a)))}catch{throw new S}}let X=async(e,t,r,i,n,a)=>{if(!(t instanceof CryptoKey)&&!(t instanceof Uint8Array))throw TypeError(J(t,...G,"Uint8Array"));if(!i)throw new A("JWE Initialization Vector missing");if(!n)throw new A("JWE Authentication Tag missing");switch(M(e,i),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return t instanceof Uint8Array&&H(t,parseInt(e.slice(-3),10)),$(e,t,r,i,n,a);case"A128GCM":case"A192GCM":case"A256GCM":return t instanceof Uint8Array&&H(t,parseInt(e.slice(1,4),10)),Y(e,t,r,i,n,a);default:throw new w("Unsupported JWE Content Encryption Algorithm")}},z=(...e)=>{let t,r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0};function q(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}let Q=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]];function Z(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function ee(e,t,r){if(e instanceof CryptoKey)return B(e,t,r),e;if(e instanceof Uint8Array)return n.subtle.importKey("raw",e,"AES-KW",!0,[r]);throw TypeError(J(e,...G,"Uint8Array"))}let et=async(e,t,r)=>{let i=await ee(t,e,"wrapKey");Z(i,e);let a=await n.subtle.importKey("raw",r,...Q);return new Uint8Array(await n.subtle.wrapKey("raw",a,i,"AES-KW"))},er=async(e,t,r)=>{let i=await ee(t,e,"unwrapKey");Z(i,e);let a=await n.subtle.unwrapKey("raw",r,i,"AES-KW",...Q);return new Uint8Array(await n.subtle.exportKey("raw",a))};async function ei(e,t,r,i,a=new Uint8Array(0),o=new Uint8Array(0)){let u;if(!(e instanceof CryptoKey))throw TypeError(J(e,...G));if(B(e,"ECDH"),!(t instanceof CryptoKey))throw TypeError(J(t,...G));B(t,"ECDH","deriveBits");let l=c(h(s.encode(r)),h(a),h(o),d(i));return u="X25519"===e.algorithm.name?256:"X448"===e.algorithm.name?448:Math.ceil(parseInt(e.algorithm.namedCurve.substr(-3),10)/8)<<3,p(new Uint8Array(await n.subtle.deriveBits({name:e.algorithm.name,public:e},t,u)),i,l)}async function en(e){if(!(e instanceof CryptoKey))throw TypeError(J(e,...G));return n.subtle.generateKey(e.algorithm,!0,["deriveBits"])}function ea(e){if(!(e instanceof CryptoKey))throw TypeError(J(e,...G));return["P-256","P-384","P-521"].includes(e.algorithm.namedCurve)||"X25519"===e.algorithm.name||"X448"===e.algorithm.name}async function es(e,t,r,i){if(!(e instanceof Uint8Array)||e.length<8)throw new A("PBES2 Salt Input must be 8 or more octets");let a=c(s.encode(t),new Uint8Array([0]),e),o=parseInt(t.slice(13,16),10),u={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:a},l=await function(e,t){if(e instanceof Uint8Array)return n.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);if(e instanceof CryptoKey)return B(e,t,"deriveBits","deriveKey"),e;throw TypeError(J(e,...G,"Uint8Array"))}(i,t);if(l.usages.includes("deriveBits"))return new Uint8Array(await n.subtle.deriveBits(u,l,o));if(l.usages.includes("deriveKey"))return n.subtle.deriveKey(u,l,{length:o,name:"AES-KW"},!1,["wrapKey","unwrapKey"]);throw TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}let eo=async(e,t,r,i=2048,n=R(new Uint8Array(16)))=>{let a=await es(n,e,i,t);return{encryptedKey:await et(e.slice(-6),a,r),p2c:i,p2s:g(n)}},ec=async(e,t,r,i,n)=>{let a=await es(n,e,i,t);return er(e.slice(-6),a,r)};function eu(e){switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new w(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}let el=(e,t)=>
1{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}},ed=async(e,t,r)=>{if(!(t instanceof CryptoKey))throw TypeError(J(t,...G));if(B(t,e,"encrypt","wrapKey"),el(e,t),t.usages.includes("encrypt"))return new Uint8Array(await n.subtle.encrypt(eu(e),t,r));if(t.usages.includes("wrapKey")){let i=await n.subtle.importKey("raw",r,...Q);return new Uint8Array(await n.subtle.wrapKey("raw",i,t,eu(e)))}throw TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')},eh=async(e,t,r)=>{if(!(t instanceof CryptoKey))throw TypeError(J(t,...G));if(B(t,e,"decrypt","unwrapKey"),el(e,t),t.usages.includes("decrypt"))return new Uint8Array(await n.subtle.decrypt(eu(e),t,r));if(t.usages.includes("unwrapKey")){let i=await n.subtle.unwrapKey("raw",r,t,eu(e),...Q);return new Uint8Array(await n.subtle.exportKey("raw",i))}throw TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')};function ep(e){return q(e)&&"string"==typeof e.kty}let ef=async e=>{if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"EdDSA":t={name:e.crv},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new w('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),i=[t,e.ext??!1,e.key_ops??r],a={...e};return delete a.alg,delete a.use,n.subtle.importKey("jwk",a,...i)},eg=e=>e?.[Symbol.toStringTag]==="KeyObject",ey=async(e,t,r,i,n=!1)=>{let a=e.get(t);if(a?.[i])return a[i];let s=await ef({...r,alg:i});return n&&Object.freeze(t),a?a[i]=s:e.set(t,{[i]:s}),s},ev=(e,t)=>{if(eg(e)){let i=e.export({format:"jwk"});return(delete i.d,delete i.dp,delete i.dq,delete i.p,delete i.q,delete i.qi,i.k)?v(i.k):(r||(r=new WeakMap),ey(r,e,i,t))}return ep(e)?e.k?v(e.k):(r||(r=new WeakMap),ey(r,e,e,t,!0)):e},em=(e,r)=>{if(eg(e)){let i=e.export({format:"jwk"});return i.k?v(i.k):(t||(t=new WeakMap),ey(t,e,i,r))}return ep(e)?e.k?v(e.k):(t||(t=new WeakMap),ey(t,e,e,r,!0)):e};function e_(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new w(`Unsupported JWE Algorithm: ${e}`)}}let eE=e=>R(new Uint8Array(e_(e)>>3)),eb=(e,t)=>{let r=(e.match(/.{1,64}/g)||[]).join("\n");return`-----BEGIN ${t}----- 2${r} 3-----END ${t}-----`},ew=async(e,t,r)=>{if(!(r instanceof CryptoKey))throw TypeError(J(r,...G));if(!r.extractable)throw TypeError("CryptoKey is not extractable");if(r.type!==e)throw TypeError(`key is not a ${e} key`);return eb(f(new Uint8Array(await n.subtle.exportKey(t,r))),`${e.toUpperCase()} KEY`)},eS=(e,t,r=0)=>{0===r&&(t.unshift(t.length),t.unshift(6));let i=e.indexOf(t[0],r);if(-1===i)return!1;let n=e.subarray(i,i+t.length);return n.length===t.length&&(n.every((e,r)=>e===t[r])||eS(e,t,i+1))},eA=e=>{switch(!0){case eS(e,[42,134,72,206,61,3,1,7]):return"P-256";case eS(e,[43,129,4,0,34]):return"P-384";case eS(e,[43,129,4,0,35]):return"P-521";case eS(e,[43,101,110]):return"X25519";case eS(e,[43,101,111]):return"X448";case eS(e,[43,101,112]):return"Ed25519";case eS(e,[43,101,113]):return"Ed448";default:throw new w("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},ek=async(e,t,r,i,a)=>{let s,o,c=new Uint8Array(atob(r.replace(e,"")).split("").map(e=>e.charCodeAt(0))),u="spki"===t;switch(i){case"PS256":case"PS384":case"PS512":s={name:"RSA-PSS",hash:`SHA-${i.slice(-3)}`},o=u?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":s={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${i.slice(-3)}`},o=u?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s={name:"RSA-OAEP",hash:`SHA-${parseInt(i.slice(-3),10)||1}`},o=u?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":s={name:"ECDSA",namedCurve:"P-256"},o=u?["verify"]:["sign"];break;case"ES384":s={name:"ECDSA",namedCurve:"P-384"},o=u?["verify"]:["sign"];break;case"ES512":s={name:"ECDSA",namedCurve:"P-521"},o=u?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let e=eA(c);s=e.startsWith("P-")?{name:"ECDH",namedCurve:e}:{name:e},o=u?[]:["deriveBits"];break}
3case"Ed25519":s={name:"Ed25519"},o=u?["verify"]:["sign"];break;case"EdDSA":s={name:eA(c)},o=u?["verify"]:["sign"];break;default:throw new w('Invalid or unsupported "alg" (Algorithm) value')}return n.subtle.importKey(t,c,s,a?.extractable??!1,o)};function eC(e){let t=[],r=0;for(;r<e.length;){let i=eO(e.subarray(r));t.push(i),r+=i.byteLength}return t}function eO(e){let t=0,r=31&e[0];if(t++,31===r){for(r=0;e[t]>=128;)r=128*r+e[t]-128,t++;r=128*r+e[t]-128,t++}let i=0;if(e[t]<128)i=e[t],t++;else if(128===i){for(i=0;0!==e[t+i]||0!==e[t+i+1];){if(i>e.byteLength)throw TypeError("invalid indefinite form length");i++}let r=t+i+2;return{byteLength:r,contents:e.subarray(t,t+i),raw:e.subarray(0,r)}}else{let r=127&e[t];t++,i=0;for(let n=0;n<r;n++)i=256*i+e[t],t++}let n=t+i;return{byteLength:n,contents:e.subarray(t,n),raw:e.subarray(0,n)}}async function eT(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw TypeError('"spki" must be SPKI formatted string');return ek(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",e,t,r)}async function ex(e,t,r){let i;if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw TypeError('"x509" must be X.509 formatted string');try{var n;let t;n=e,i=eb((t=eC(eC(eO(y(n.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,""))).contents)[0].contents),f(t[160===t[0].raw[0]?6:5].raw)),"PUBLIC KEY")}catch(e){throw TypeError("Failed to parse the X.509 certificate",{cause:e})}return ek(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",i,t,r)}async function eP(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return ek(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",e,t,r)}async function eI(e,t){if(!q(e))throw TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return v(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new w('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return ef({...e,alg:t});default:throw new w('Unsupported "kty" (Key Type) Parameter value')}}let eK=e=>e?.[Symbol.toStringTag],eR=(e,t,r)=>{if(void 0!==t.use&&"sig"!==t.use)throw TypeError("Invalid key for this operation, when present its use must be sig");if(void 0!==t.key_ops&&t.key_ops.includes?.(r)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0};function eD(e,t,r,i){t.startsWith("HS")||"dir"===t||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?((e,t,r,i)=>{if(!(t instanceof Uint8Array)){if(i&&ep(t)){if(ep(t)&&"oct"===t.kty&&"string"==typeof t.k&&eR(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!L(t))throw TypeError(F(e,t,...G,"Uint8Array",i?"JSON Web Key":null));if("secret"!==t.type)throw TypeError(`${eK(t)} instances for symmetric algorithms must be of type "secret"`)}})(t,r,i,e):((e,t,r,i)=>{if(i&&ep(t))switch(r){case"sign":if("oct"!==t.kty&&"string"==typeof t.d&&eR(e,t,r))return;throw TypeError("JSON Web Key for this operation be a private JWK");case"verify":if("oct"!==t.kty&&void 0===t.d&&eR(e,t,r))return;throw TypeError("JSON Web Key for this operation be a public JWK")}if(!L(t))throw TypeError(F(e,t,...G,i?"JSON Web Key":null));if("secret"===t.type)throw TypeError(`${eK(t)} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw TypeError(`${eK(t)} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw TypeError(`${eK(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw TypeError(`${eK(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw TypeError(`${eK(t)} instances for asymmetric algorithm encryption must be of type "public"`)})(t,r,i,e)}let eM=eD.bind(void 0,!1),eH=eD.bind(void 0,!0);async function eU(e,t,r,i,a){if(!(r instanceof Uint8Array))throw TypeError(J(r,"Uint8Array"));let s=parseInt(e.slice(1,4),10),o=await n.subtle.importKey("raw",r.subarray(s>>3),"AES-CBC",!1,["encrypt"]),u=await n.subtle.importKey("raw",r.subarray(0,s>>3),{hash:`SHA-${s<<1}`,name:"HMAC"},!1,["sign"]),d=new Uint8Array(await n.subtle.encrypt({iv:i,name:"AES-CBC"},o,t)),h=c(a,i,d,l(a.length<<3));return{ciphertext:d,tag:new Uint8Array((await n.subtle.sign("HMAC",u,h)).slice(0,s>>3)),iv:i}}async function ej(e,t,r,i,a){let s;r instanceof Uint8Array?s=await n.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(B(r,e,"encrypt"),s=r);let o=new Uint8Array(await n.subtle.encrypt({additionalData:a,iv:i,name:"AES-GCM",tagLength:128},s,t)),c=o.slice(-16);return{ciphertext:o.slice(0,-16),tag:c,iv:i}}let eV=async(e,t,r,i,n)=>{if(!(r instanceof CryptoKey)&&!(r instanceof Uint8Array))throw TypeError(J(r,...G,"Uint8Array"));switch(i?M(e,i):i=R(new Uint8Array(D(e)>>3)),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&H(r,parseInt(e.slice(-3),10)),eU(e,t,r,i,n);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&H(r,parseInt(e.slice(1,4),10)),ej(e,t,r,i,n);default:throw new w("Unsupported JWE Content Encryption Algorithm")}};async function eN(e,t,r,i){let n=e.slice(0,7),a=await eV(n,r,t,i,new Uint8Array(0));return{encryptedKey:a.ciphertext,iv:g(a.iv),tag:g(a.tag)}}async function eB(e,t,r,i,n){return X(e.slice(0,7),t,r,i,n,new Uint8Array(0))}async function eW(e,t,r,i,n){switch(eM(e,t,"decrypt"),t=await em?.(t,e)||t,e){case"dir":if(void 0!==r)throw new A("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new A("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let n,a;if(!q(i.epk))throw new A('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!ea(t))throw new w("ECDH with the provided key is not allowed or not supported by your javascript runtime");let s=await eI(i.epk,e);if(void 0!==i.apu){if("string"!=typeof i.apu)throw new A('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{n=v(i.apu)}catch{throw new A("Failed to base64url decode the apu")}}if(void 0!==i.apv){if("string"!=typeof i.apv)throw new A('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{a=v(i.apv)}catch{throw new A("Failed to base64url decode the apv")}}let o=await ei(s,t,"ECDH-ES"===e?i.enc:e,"ECDH-ES"===e?e_(i.enc):parseInt(e.slice(-5,-2),10),n,a);if("ECDH-ES"===e)return o;if(void 0===r)throw new A("JWE Encrypted Key missing");return er(e.slice(-6),o,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new A("JWE Encrypted Key missing");return eh(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let a;if(void 0===r)throw new A("JWE Encrypted Key missing");if("number"!=typeof i.p2c)throw new A('JOSE Header "p2c" (PBES2 Count) missing or invalid');let s=n?.maxPBES2Count||1e4;if(i.p2c>s)throw new A('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof i.p2s)throw new A('JOSE Header "p2s" (PBES2 Salt) missing or invalid');try{a=v(i.p2s)}catch{throw new A("Failed to base64url decode the p2s")}return ec(e,t,r,i.p2c,a)}
3case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new A("JWE Encrypted Key missing");return er(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{let n,a;if(void 0===r)throw new A("JWE Encrypted Key missing");if("string"!=typeof i.iv)throw new A('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof i.tag)throw new A('JOSE Header "tag" (Authentication Tag) missing or invalid');try{n=v(i.iv)}catch{throw new A("Failed to base64url decode the iv")}try{a=v(i.tag)}catch{throw new A("Failed to base64url decode the tag")}return eB(e,t,r,n,a)}default:throw new w('Invalid or unsupported "alg" (JWE Algorithm) header value')}}let eJ=function(e,t,r,i,n){let a;if(void 0!==n.crit&&i?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!i||void 0===i.crit)return new Set;if(!Array.isArray(i.crit)||0===i.crit.length||i.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let s of(a=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,i.crit)){if(!a.has(s))throw new w(`Extension Header Parameter "${s}" is not recognized`);if(void 0===n[s])throw new e(`Extension Header Parameter "${s}" is missing`);if(a.get(s)&&void 0===i[s])throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(i.crit)},eF=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};async function eL(e,t,r){let i,n,a,u,l,d,h;if(!q(e))throw new A("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new A("JOSE Header missing");if(void 0!==e.iv&&"string"!=typeof e.iv)throw new A("JWE Initialization Vector incorrect type");if("string"!=typeof e.ciphertext)throw new A("JWE Ciphertext missing or incorrect type");if(void 0!==e.tag&&"string"!=typeof e.tag)throw new A("JWE Authentication Tag incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new A("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new A("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new A("JWE AAD incorrect type");if(void 0!==e.header&&!q(e.header))throw new A("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!q(e.unprotected))throw new A("JWE Per-Recipient Unprotected Header incorrect type");if(e.protected)try{let t=v(e.protected);i=JSON.parse(o.decode(t))}catch{throw new A("JWE Protected Header is invalid")}if(!z(i,e.header,e.unprotected))throw new A("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let p={...i,...e.header,...e.unprotected};if(eJ(A,new Map,r?.crit,i,p),void 0!==p.zip)throw new w('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg:f,enc:g}=p;if("string"!=typeof f||!f)throw new A("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof g||!g)throw new A("missing JWE Encryption Algorithm (enc) in JWE Header");let y=r&&eF("keyManagementAlgorithms",r.keyManagementAlgorithms),m=r&&eF("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(y&&!y.has(f)||!y&&f.startsWith("PBES2"))throw new b('"alg" (Algorithm) Header Parameter value not allowed');if(m&&!m.has(g))throw new b('"enc" (Encryption Algorithm) Header Parameter value not allowed');if(void 0!==e.encrypted_key)try{n=v(e.encrypted_key)}catch{throw new A("Failed to base64url decode the encrypted_key")}let _=!1;"function"==typeof t&&(t=await t(i,e),_=!0);try{a=await eW(f,t,n,p,r)}catch(e){if(e instanceof TypeError||e instanceof A||e instanceof w)throw e;a=eE(g)}if(void 0!==e.iv)try{u=v(e.iv)}catch{throw new A("Failed to base64url decode the iv")}if(void 0!==e.tag)try{l=v(e.tag)}catch{throw new A("Failed to base64url decode the tag")}let E=s.encode(e.protected??"");d=void 0!==e.aad?c(E,s.encode("."),s.encode(e.aad)):E;try{h=v(e.ciphertext)}catch{throw new A("Failed to base64url decode the ciphertext")}let S={plaintext:await X(g,a,h,u,l,d)};if(void 0!==e.protected&&(S.protectedHeader=i),void 0!==e.aad)try{S.additionalAuthenticatedData=v(e.aad)}catch{throw new A("Failed to base64url decode the aad")}return(void 0!==e.unprotected&&(S.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(S.unprotectedHeader=e.header),_)?{...S,key:t}:S}async function eG(e,t,r){if(e instanceof Uint8Array&&(e=o.decode(e)),"string"!=typeof e)throw new A("Compact JWE must be a string or Uint8Array");let{0:i,1:n,2:a,3:s,4:c,length:u}=e.split(".");if(5!==u)throw new A("Invalid Compact JWE");let l=await eL({ciphertext:s,iv:a||void 0,protected:i,tag:c||void 0,encrypted_key:n||void 0},t,r),d={plaintext:l.plaintext,protectedHeader:l.protectedHeader};return"function"==typeof t?{...d,key:l.key}:d}async function e$(e,t,r){if(!q(e))throw new A("General JWE must be an object");
3if(!Array.isArray(e.recipients)||!e.recipients.every(q))throw new A("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new A("JWE Recipients has no members");for(let i of e.recipients)try{return await eL({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:i.encrypted_key,header:i.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch{}throw new S}let eY=Symbol(),eX=async e=>{if(e instanceof Uint8Array)return{kty:"oct",k:g(e)};if(!(e instanceof CryptoKey))throw TypeError(J(e,...G,"Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:i,use:a,...s}=await n.subtle.exportKey("jwk",e);return s};async function ez(e){return ew("public","spki",e)}async function eq(e){return ew("private","pkcs8",e)}async function eQ(e){return eX(e)}async function eZ(e,t,r,i,n={}){let a,s,o;switch(eM(e,r,"encrypt"),r=await ev?.(r,e)||r,e){case"dir":o=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!ea(r))throw new w("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:c,apv:u}=n,{epk:l}=n;l||(l=(await en(r)).privateKey);let{x:d,y:h,crv:p,kty:f}=await eQ(l),y=await ei(r,l,"ECDH-ES"===e?t:e,"ECDH-ES"===e?e_(t):parseInt(e.slice(-5,-2),10),c,u);if(s={epk:{x:d,crv:p,kty:f}},"EC"===f&&(s.epk.y=h),c&&(s.apu=g(c)),u&&(s.apv=g(u)),"ECDH-ES"===e){o=y;break}o=i||eE(t);let v=e.slice(-6);a=await et(v,y,o);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":o=i||eE(t),a=await ed(e,r,o);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{o=i||eE(t);let{p2c:c,p2s:u}=n;({encryptedKey:a,...s}=await eo(e,r,o,c,u));break}case"A128KW":case"A192KW":case"A256KW":o=i||eE(t),a=await et(e,r,o);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{o=i||eE(t);let{iv:c}=n;({encryptedKey:a,...s}=await eN(e,r,o,c));break}default:throw new w('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:o,encryptedKey:a,parameters:s}}class e0{constructor(e){if(!(e instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,t){let r,i,n,a,u;if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new A("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!z(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new A("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let l={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(eJ(A,new Map,t?.crit,this._protectedHeader,l),void 0!==l.zip)throw new w('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg:d,enc:h}=l;if("string"!=typeof d||!d)throw new A('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof h||!h)throw new A('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this._cek&&("dir"===d||"ECDH-ES"===d))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${d}`);{let n;({cek:i,encryptedKey:r,parameters:n}=await eZ(d,h,e,this._cek,this._keyManagementParameters)),n&&(t&&eY in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}a=this._protectedHeader?s.encode(g(JSON.stringify(this._protectedHeader))):s.encode(""),this._aad?(u=g(this._aad),n=c(a,s.encode("."),s.encode(u))):n=a;let{ciphertext:p,tag:f,iv:y}=await eV(h,this._plaintext,i,this._iv,n),v={ciphertext:g(p)};return y&&(v.iv=g(y)),f&&(v.tag=g(f)),r&&(v.encrypted_key=g(r)),u&&(v.aad=u),this._protectedHeader&&(v.protected=o.decode(a)),this._sharedUnprotectedHeader&&(v.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(v.header=this._unprotectedHeader),v}}class e1{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}function e2(e,t){let r=`SHA-${e.slice(-3)}`;
3switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:t.name};default:throw new w(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function e5(e,t,r){if("sign"===r&&(t=await em(t,e)),"verify"===r&&(t=await ev(t,e)),t instanceof CryptoKey)return!function(e,t,...r){switch(t){case"HS256":case"HS384":case"HS512":{if(!j(e.algorithm,"HMAC"))throw U("HMAC");let r=parseInt(t.slice(2),10);if(V(e.algorithm.hash)!==r)throw U(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!j(e.algorithm,"RSASSA-PKCS1-v1_5"))throw U("RSASSA-PKCS1-v1_5");let r=parseInt(t.slice(2),10);if(V(e.algorithm.hash)!==r)throw U(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if
3(!j(e.algorithm,"RSA-PSS"))throw U("RSA-PSS");let r=parseInt(t.slice(2),10);if(V(e.algorithm.hash)!==r)throw U(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw U("Ed25519 or Ed448");break;case"Ed25519":if(!j(e.algorithm,"Ed25519"))throw U("Ed25519");break;case"ES256":case"ES384":case"ES512":{if(!j(e.algorithm,"ECDSA"))throw U("ECDSA");let r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw U(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}N(e,r)}(t,e,r),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(J(t,...G));return n.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}throw TypeError(J(t,...G,"Uint8Array","JSON Web Key"))}let e8=async(e,t,r,i)=>{let a=await e5(e,t,"verify");el(e,a);let s=e2(e,a.algorithm);try{return await n.subtle.verify(s,a,r,i)}catch{return!1}};async function e4(e,t,r){let i,n;if(!q(e))throw new k("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new k('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new k("JWS Protected Header incorrect type");if(void 0===e.payload)throw new k("JWS Payload missing");if("string"!=typeof e.signature)throw new k("JWS Signature missing or incorrect type");if(void 0!==e.header&&!q(e.header))throw new k("JWS Unprotected Header incorrect type");let a={};if(e.protected)try{let t=v(e.protected);a=JSON.parse(o.decode(t))}catch{throw new k("JWS Protected Header is invalid")}if(!z(a,e.header))throw new k("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...a,...e.header},l=eJ(k,new Map([["b64",!0]]),r?.crit,a,u),d=!0;if(l.has("b64")&&"boolean"!=typeof(d=a.b64))throw new k('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:h}=u;if("string"!=typeof h||!h)throw new k('JWS "alg" (Algorithm) Header Parameter missing or invalid');let p=r&&eF("algorithms",r.algorithms);if(p&&!p.has(h))throw new b('"alg" (Algorithm) Header Parameter value not allowed');if(d){if("string"!=typeof e.payload)throw new k("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new k("JWS Payload must be a string or an Uint8Array instance");let f=!1;"function"==typeof t?(t=await t(a,e),f=!0,eH(h,t,"verify"),ep(t)&&(t=await eI(t,h))):eH(h,t,"verify");let g=c(s.encode(e.protected??""),s.encode("."),"string"==typeof e.payload?s.encode(e.payload):e.payload);try{i=v(e.signature)}catch{throw new k("Failed to base64url decode the signature")}if(!await e8(h,t,i,g))throw new K;if(d)try{n=v(e.payload)}catch{throw new k("Failed to base64url decode the payload")}else n="string"==typeof e.payload?s.encode(e.payload):e.payload;let y={payload:n};return(void 0!==e.protected&&(y.protectedHeader=a),void 0!==e.header&&(y.unprotectedHeader=e.header),f)?{...y,key:t}:y}async function e6(e,t,r){if(e instanceof Uint8Array&&(e=o.decode(e)),"string"!=typeof e)throw new k("Compact JWS must be a string or Uint8Array");let{0:i,1:n,2:a,length:s}=e.split(".");if(3!==s)throw new k("Invalid Compact JWS");let c=await e4({payload:n,protected:i,signature:a},t,r),u={payload:c.payload,protectedHeader:c.protectedHeader};return"function"==typeof t?{...u,key:c.key}:u}async function e3(e,t,r){if(!q(e))throw new k("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(q))throw new k("JWS Signatures missing or incorrect type");for(let i of e.signatures)try{return await e4({header:i.header,payload:e.payload,protected:i.protected,signature:i.signature},t,r)}catch{}throw new K}let e9=e=>Math.floor(e.getTime()/1e3),e7=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,te=e=>{let t,r=e7.exec(e);if(!r||r[4]&&r[1])throw TypeError("Invalid time period format");let i=parseFloat(r[2]);switch(r[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(i);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*i);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*i);break;case"day":case"days":case"d":t=Math.round(86400*i);break;case"week":case"weeks":case"w":t=Math.round(604800*i);break;default:t=Math.round(0x1e187e0*i)}return"-"===r[1]||"ago"===r[4]?-t:t},tt=e=>e.toLowerCase().replace(/^application\//,""),tr=(e,t,r={})=>{var i,n;let a,s;try{a=JSON.parse(o.decode(t))}catch{}if(!q(a))throw new C("JWT Claims Set must be a top-level JSON object");let{typ:c}=r;if(c&&("string"!=typeof e.typ||tt(e.typ)!==tt(c)))throw new _('unexpected "typ" JWT header value',a,"typ","check_failed");let{requiredClaims:u=[],issuer:l,subject:d,audience:h,maxTokenAge:p}=r,f=[...u];for(let e of(void 0!==p&&f.push("iat"),void 0!==h&&f.push("aud"),void 0!==d&&f.push("sub"),void 0!==l&&f.push("iss"),new Set(f.reverse())))if(!(e in a))throw new _(`missing required "${e}" claim`,a,e,"missing");if(l&&!(Array.isArray(l)?l:[l]).includes(a.iss))throw new _('unexpected "iss" claim value',a,"iss","check_failed");if(d&&a.sub!==d)throw new _('unexpected "sub" claim value',a,"sub","check_failed");if(h&&(i=a.aud,n="string"==typeof h?[h]:h,"string"==typeof i?!n.includes(i):!(Array.isArray(i)&&n.some(Set.prototype.has.bind(new Set(i))))))throw new _('unexpected "aud" claim value',a,"aud","check_failed");switch(typeof r.clockTolerance){case"string":s=te(r.clockTolerance);break;case"number":s=r.clockTolerance;break;case"undefined":s=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:g}=r,y=e9(g||new Date);if((void 0!==a.iat||p)&&"number"!=typeof a.iat)throw new _('"iat" claim must be a number',a,"iat","invali
3d");if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw new _('"nbf" claim must be a number',a,"nbf","invalid");if(a.nbf>y+s)throw new _('"nbf" claim timestamp check failed',a,"nbf","check_failed")}if(void 0!==a.exp){if("number"!=typeof a.exp)throw new _('"exp" claim must be a number',a,"exp","invalid");if(a.exp<=y-s)throw new E('"exp" claim timestamp check failed',a,"exp","check_failed")}if(p){let e=y-a.iat;if(e-s>("number"==typeof p?p:te(p)))throw new E('"iat" claim timestamp check failed (too far in the past)',a,"iat","check_failed");if(e<0-s)throw new _('"iat" claim timestamp check failed (it should be in the past)',a,"iat","check_failed")}return a};async function ti(e,t,r){let i=await e6(e,t,r);if(i.protectedHeader.crit?.includes("b64")&&!1===i.protectedHeader.b64)throw new C("JWTs MUST NOT use unencoded payload");let n={payload:tr(i.protectedHeader,i.payload,r),protectedHeader:i.protectedHeader};return"function"==typeof t?{...n,key:i.key}:n}async function tn(e,t,r){let i=await eG(e,t,r),n=tr(i.protectedHeader,i.plaintext,r),{protectedHeader:a}=i;if(void 0!==a.iss&&a.iss!==n.iss)throw new _('replicated "iss" claim header parameter mismatch',n,"iss","mismatch");if(void 0!==a.sub&&a.sub!==n.sub)throw new _('replicated "sub" claim header parameter mismatch',n,"sub","mismatch");if(void 0!==a.aud&&JSON.stringify(a.aud)!==JSON.stringify(n.aud))throw new _('replicated "aud" claim header parameter mismatch',n,"aud","mismatch");let s={payload:n,protectedHeader:a};return"function"==typeof t?{...s,key:i.key}:s}class ta{constructor(e){this._flattened=new e0(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){let r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}let ts=async(e,t,r)=>{let i=await e5(e,t,"sign");return el(e,i),new Uint8Array(await n.subtle.sign(e2(e,i.algorithm),i,r))};class to{constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){let r;if(!this._protectedHeader&&!this._unprotectedHeader)throw new k("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!z(this._protectedHeader,this._unprotectedHeader))throw new k("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...this._protectedHeader,...this._unprotectedHeader},n=eJ(k,new Map([["b64",!0]]),t?.crit,this._protectedHeader,i),a=!0;if(n.has("b64")&&"boolean"!=typeof(a=this._protectedHeader.b64))throw new k('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:u}=i;if("string"!=typeof u||!u)throw new k('JWS "alg" (Algorithm) Header Parameter missing or invalid');eH(u,e,"sign");let l=this._payload;a&&(l=s.encode(g(l)));let d=c(r=this._protectedHeader?s.encode(g(JSON.stringify(this._protectedHeader))):s.encode(""),s.encode("."),l),h={signature:g(await ts(u,e,d)),payload:""};return a&&(h.payload=o.decode(l)),this._unprotectedHeader&&(h.header=this._unprotectedHeader),this._protectedHeader&&(h.protected=o.decode(r)),h}}class tc{constructor(e){this._flattened=new to(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){let r=await this._flattened.sign(e,t);if(void 0===r.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}class tu{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}function tl(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}class td{constructor(e={}){if(!q(e))throw TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return"number"==typeof e?this._payload={...this._payload,nbf:tl("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:tl("setNotBefore",e9(e))}:this._payload={...this._payload,nbf:e9(new Date)+te(e)},this}setExpirationTime(e){return"number"==typeof e?this._payload={...this._payload,exp:tl("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:tl("setExpirationTime",e9(e))}:this._payload={...this._payload,exp:e9(new Date)+te(e)},this}setIssuedAt(e){return void 0===e?this._payload={...this._payload,iat:e9(new Date)}:e instanceof Date?this._payload={...this._payload,iat:tl("setIssuedAt",e9(e))}:"string"==typeof e?this._payload={...this._payload,iat:tl("setIssuedAt",e9(new Date)+te(e))}:this._payload={...this._payload,iat:tl("setIssuedAt",e)},this}}let th=(e,t)=>{if("string"!=typeof e||!e)throw new O(`${t} missing or invalid`)};async function tp(e,t){let r;if(!q(e))throw TypeError("JWK must be an object");
3if(t??(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(e.kty){case"EC":th(e.crv,'"crv" (Curve) Parameter'),th(e.x,'"x" (X Coordinate) Parameter'),th(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":th(e.crv,'"crv" (Subtype of Key Pair) Parameter'),th(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":th(e.e,'"e" (Exponent) Parameter'),th(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":th(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new w('"kty" (Key Type) Parameter missing or unsupported')}let i=s.encode(JSON.stringify(r));return g(await a(t,i))}async function tf(e,t){t??(t="sha256");let r=await tp(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}async function tg(e,t){let r={...e,...t?.header};if(!q(r.jwk))throw new k('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let i=await eI({...r.jwk,ext:!0},r.alg);if(i instanceof Uint8Array||"public"!==i.type)throw new k('"jwk" (JSON Web Key) Header Parameter must be a public key');return i}function ty(e){return q(e)}function tv(e){return"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}class tm{constructor(e){if(this._cached=new WeakMap,!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(ty)}(e))throw new T("JSON Web Key Set malformed");this._jwks=tv(e)}async getKey(e,t){let{alg:r,kid:i}={...e,...t?.header},n=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new w('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=this._jwks.keys.filter(e=>{let t=n===e.kty;if(t&&"string"==typeof i&&(t=i===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":t="Ed25519"===e.crv;break;case"EdDSA":t="Ed25519"===e.crv||"Ed448"===e.crv}return t}),{0:s,length:o}=a;if(0===o)throw new x;if(1!==o){let e=new P,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(let e of a)try{yield await t_(t,e,r)}catch{}},e}return t_(this._cached,s,r)}}async function t_(e,t,r){let i=e.get(t)||e.set(t,{}).get(t);if(void 0===i[r]){let e=await eI({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new T("JSON Web Key Set members must be public keys");i[r]=e}return i[r]}function tE(e){let t=new tm(e),r=async(e,r)=>t.getKey(e,r);return Object.defineProperties(r,{jwks:{value:()=>tv(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),r}let tb=async(e,t,r)=>{let i,n,a=!1;"function"==typeof AbortController&&(i=new AbortController,n=setTimeout(()=>{a=!0,i.abort()},t));let s=await fetch(e.href,{signal:i?i.signal:void 0,redirect:"manual",headers:r.headers}).catch(e=>{if(a)throw new I;throw e});if(void 0!==n&&clearTimeout(n),200!==s.status)throw new m("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await s.json()}catch{throw new m("Failed to parse the JSON Web Key Set HTTP response as JSON")}};("u"<typeof navigator||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(i="jose/v5.10.0");let tw=Symbol();class tS{constructor(e,t){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:t?.agent,headers:t?.headers},this._timeoutDuration="number"==typeof t?.timeoutDuration?t?.timeoutDuration:5e3,this._cooldownDuration="number"==typeof t?.cooldownDuration?t?.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof t?.cacheMaxAge?t?.cacheMaxAge:6e5,t?.[tw]!==void 0&&(this._cache=t?.[tw],function(e,t){return!("object"!=typeof e||null===e||!("uat"in e)||"number"!=typeof e.uat||Date.now()-e.uat>
3=t)&&"jwks"in e&&!!q(e.jwks)&&!!Array.isArray(e.jwks.keys)&&!!Array.prototype.every.call(e.jwks.keys,q)}(t?.[tw],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=tE(this._cache.jwks)))}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){this._local&&this.fresh()||await this.reload();try{return await this._local(e,t)}catch(r){if(r instanceof x&&!1===this.coolingDown())return await this.reload(),this._local(e,t);throw r}}async reload(){this._pendingFetch&&("u">typeof WebSocketPair||"u">typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"u">typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(this._pendingFetch=void 0);let e=new Headers(this._options.headers);i&&!e.has("User-Agent")&&(e.set("User-Agent",i),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||(this._pendingFetch=tb(this._url,this._timeoutDuration,this._options).then(e=>{this._local=tE(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e})),await this._pendingFetch}}e.s(["decode",0,v,"encode",0,g],741574);var tA=e.i(133186);async function tk(e,t){let r,i,a;switch(e){case"HS256":case"HS384":case"HS512":r=parseInt(e.slice(-3),10),i={name:"HMAC",hash:`SHA-${r}`,length:r},a=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return R(new Uint8Array((r=parseInt(e.slice(-3),10))>>3));case"A128KW":case"A192KW":case"A256KW":i={name:"AES-KW",length:r=parseInt(e.slice(1,4),10)},a=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":i={name:"AES-GCM",length:r=parseInt(e.slice(1,4),10)},a=["encrypt","decrypt"];break;default:throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return n.subtle.generateKey(i,t?.extractable??!1,a)}function tC(e){let t=e?.modulusLength??2048;if("number"!=typeof t||t<2048)throw new w("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return t}async function tO(e,t){let r,i;switch(e){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:tC(t)},i=["sign","verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:tC(t)},i=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:`SHA-${parseInt(e.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:tC(t)},i=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"},i=["sign","verify"];break;case"ES384":r={name:"ECDSA",namedCurve:"P-384"},i=["sign","verify"];break;case"ES512":r={name:"ECDSA",namedCurve:"P-521"},i=["sign","verify"];break;case"Ed25519":r={name:"Ed25519"},i=["sign","verify"];break;case"EdDSA":{i=["sign","verify"];let e=t?.crv??"Ed25519";
3switch(e){case"Ed25519":case"Ed448":r={name:e};break;default:throw new w("Invalid or unsupported crv option provided")}break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{i=["deriveKey","deriveBits"];let e=t?.crv??"P-256";switch(e){case"P-256":case"P-384":case"P-521":r={name:"ECDH",namedCurve:e};break;case"X25519":case"X448":r={name:e};break;default:throw new w("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return n.subtle.generateKey(r,t?.extractable??!1,i)}async function tT(e,t){return tO(e,t)}async function tx(e,t){return tk(e,t)}var tP=e.i(741574);e.s(["CompactEncrypt",0,ta,"CompactSign",0,tc,"EmbeddedJWK",0,tg,"EncryptJWT",0,class extends td{setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){let r=new ta(s.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}},"FlattenedEncrypt",0,e0,"FlattenedSign",0,to,"GeneralEncrypt",0,class{constructor(e){this._recipients=[],this._plaintext=e}addRecipient(e,t){let r=new e1(this,e,{crit:t?.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(){let e;if(!this._recipients.length)throw new A("at least one recipient must be added");if(1===this._recipients.length){let[e]=this._recipients,t=await new e0(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options}),r={ciphertext:t.ciphertext,iv:t.iv,recipients:[{}],tag:t.tag};return t.aad&&(r.aad=t.aad),t.protected&&(r.protected=t.protected),t.unprotected&&(r.unprotected=t.unprotected),t.encrypted_key&&(r.recipients[0].encrypted_key=t.encrypted_key),t.header&&(r.recipients[0].header=t.header),r}for(let t=0;t<this._recipients.length;t++){let r=this._recipients[t];if(!z(this._protectedHeader,this._unprotectedHeader,r.unprotectedHeader))throw new A("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let i={...this._protectedHeader,...this._unprotectedHeader,...r.unprotectedHeader},{alg:n}=i;if("string"!=typeof n||!n)throw new A('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===n||"ECDH-ES"===n)throw new A('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof i.enc||!i.enc)throw new A('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(e){if(e!==i.enc)throw new A('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else e=i.enc;if(eJ(A,new Map,r.options.crit,this._protectedHeader,i),void 0!==i.zip)throw new w('JWE "zip" (Compression Algorithm) Header Parameter is not supported.')}let t=eE(e),r={ciphertext:"",iv:"",recipients:[],tag:""};for(let i=0;i<this._recipients.length;i++){let n=this._recipients[i],a={};r.recipients.push(a);let s=({...this._protectedHeader,...this._unprotectedHeader,...n.unprotectedHeader}).alg.startsWith("PBES2")?2048+i:void 0;if(0===i){let e=await new e0(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(t).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(n.unprotectedHeader).setKeyManagementParameters({p2c:s}
3).encrypt(n.key,{...n.options,[eY]:!0});r.ciphertext=e.ciphertext,r.iv=e.iv,r.tag=e.tag,e.aad&&(r.aad=e.aad),e.protected&&(r.protected=e.protected),e.unprotected&&(r.unprotected=e.unprotected),a.encrypted_key=e.encrypted_key,e.header&&(a.header=e.header);continue}let{encryptedKey:o,parameters:c}=await eZ(n.unprotectedHeader?.alg||this._protectedHeader?.alg||this._unprotectedHeader?.alg,e,n.key,t,{p2c:s});a.encrypted_key=g(o),(n.unprotectedHeader||c)&&(a.header={...n.unprotectedHeader,...c})}return r}},"GeneralSign",0,class{constructor(e){this._signatures=[],this._payload=e}addSignature(e,t){let r=new tu(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new k("at least one signature must be added");let e={signatures:[],payload:""};for(let t=0;t<this._signatures.length;t++){let r=this._signatures[t],i=new to(this._payload);i.setProtectedHeader(r.protectedHeader),i.setUnprotectedHeader(r.unprotectedHeader);let{payload:n,...a}=await i.sign(r.key,r.options);if(0===t)e.payload=n;else if(e.payload!==n)throw new k("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(a)}return e}},"SignJWT",0,class extends td{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){let r=new tc(s.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new C("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}},"UnsecuredJWT",0,class extends td{encode(){let e=g(JSON.stringify({alg:"none"})),t=g(JSON.stringify(this._payload));return`${e}.${t}.`}static decode(e,t){let r;if("string"!=typeof e)throw new C("Unsecured JWT must be a string");let{0:i,1:n,2:a,length:s}=e.split(".");if(3!==s||""!==a)throw new C("Invalid Unsecured JWT");try{if(r=JSON.parse(o.decode(v(i))),"none"!==r.alg)throw Error()}catch{throw new C("Invalid Unsecured JWT")}return{payload:tr(r,v(n),t),header:r}}},"base64url",0,tP,"calculateJwkThumbprint",0,tp,"calculateJwkThumbprintUri",0,tf,"compactDecrypt",0,eG,"compactVerify",0,e6,"createLocalJWKSet",0,tE,"createRemoteJWKSet",0,function(e,t){let r=new tS(e,t),i=async(e,t)=>r.getKey(e,t);return Object.defineProperties(i,{coolingDown:{get:()=>r.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>r.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>r.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!r._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>r._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),i},"cryptoRuntime",0,"WebCryptoAPI","decodeJwt",0,function(e){let t,r;if("string"!=typeof e)throw new C("JWTs must use Compact JWS serialization, JWT must be a string");let{1:i,length:n}=e.split(".");if(5===n)throw new C("Only JWTs using Compact JWS serialization can be decoded");if(3!==n)throw new C("Invalid JWT");if(!i)throw new C("JWTs must contain a payload");try{t=v(i)}catch{throw new C("Failed to base64url decode the payload")}try{r=JSON.parse(o.decode(t))}catch{throw new C("Failed to parse the decoded payload as JSON")}if(!q(r))throw new C("Invalid JWT Claims Set");return r},"decodeProtectedHeader",0,function(e){let t;if("string"==typeof e){let r=e.split(".");(3===r.length||5===r.length)&&([t]=r)}else if("object"==typeof e&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");try{if("string"!=typeof t||!t)throw Error();let e=JSON.parse(o.decode(v(t)));if(!q(e))throw Error();return e}catch{throw TypeError("Invalid Token or Protected Header formatting")}},"errors",0,tA,"experimental_jwksCache",0,tw,"exportJWK",0,eQ,"exportPKCS8",0,eq,"exportSPKI",0,ez,"flattenedDecrypt",0,eL,"flattenedVerify",0,e4,"generalDecrypt",0,e$,"generalVerify",0,e3,"generateKeyPair",0,tT,"generateSecret",0,tx,"importJWK",0,eI,"importPKCS8",0,eP,"importSPKI",0,eT,"importX509",0,ex,"jwksCache",0,tw,"jwtDecrypt",0,tn,"jwtVerify",0,ti],951584)},73924,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getOrDefaultFromMap=r.getOrDefault=r.kebabToCamel=r.safeToString=r.isFunction=r.cleanedAttributes=r.isValidAttribute=void 0;let i=new Set(["string","number","boolean"]);function n(e){return null!==e&&"function"==typeof e}r.isValidAttribute=function(e){return void 0!==e&&(null==e||i.has(typeof e))},r.cleanedAttributes=function(e){let t=Object.keys(e),r={};return t.forEach(t=>{n(e[t])||(r[t]=e[t])}),r},r.isFunction=n,r.safeToString=function(e){let t;try{t=JSON.stringify(e)}catch(r){t=String(e)}return t},r.kebabToCamel=function(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())},r.getOrDefault=function(e,t,r){return e&&t&&void 0!==e[t]?e[t]:r},r.getOrDefaultFromMap=function(e,t,r){return e&&t&&void 0!==e.get(t)?e.get(t):r}},868942,(e,t,r)=>{"use strict";
3Object.defineProperty(r,"__esModule",{value:!0}),r.TRACK_CUSTOM_KEY_PREFIX=r.DATA_AUTO_TRACK_KEY=r.EXPT_TOKEN_KEY=r.CODA_COOKIE_ID_KEY=r.LEGACY_CODA_COOKIE_ID_KEY=r.USER_CONTEXT_COOKIE_KEY=void 0,r.USER_CONTEXT_COOKIE_KEY="trex-user-context",r.LEGACY_CODA_COOKIE_ID_KEY="coda-cookie-id",r.CODA_COOKIE_ID_KEY="codaCookieId",r.EXPT_TOKEN_KEY="exptToken",r.DATA_AUTO_TRACK_KEY="data-auto-capture",r.TRACK_CUSTOM_KEY_PREFIX="capture-custom-"},901938,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.syncCodaCookieId=void 0;let i=e.r(868942);r.syncCodaCookieId=function(e){e[i.LEGACY_CODA_COOKIE_ID_KEY]&&void 0===e[i.CODA_COOKIE_ID_KEY]?e[i.CODA_COOKIE_ID_KEY]=e[i.LEGACY_CODA_COOKIE_ID_KEY]:e[i.CODA_COOKIE_ID_KEY]&&void 0===e[i.LEGACY_CODA_COOKIE_ID_KEY]&&(e[i.LEGACY_CODA_COOKIE_ID_KEY]=e[i.CODA_COOKIE_ID_KEY])}},49067,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});let i=e.r(205324),n=e.r(156457),a=e.r(73924),s=e.r(868942),o=e.r(901938);class c{constructor(e){this.cfg=e,this._store=new i.CookieStore(new n.LocalStorageStore,e)}getOrCreate(e,t){let r=this.getValidUserContextKey(e);if(!r)return t();let i=this.getJsonValueFromStore()[r[c.USER_CONTEXT_KEY]];return i?(c.cache[r[c.USER_CONTEXT_KEY]]=i,i):this.set(r[c.USER_CONTEXT_KEY],t())}set(e,t){let r=this.getValidUserContextKey(e);if(!r||"string"!=typeof t&&"number"!=typeof t)return t;let i=this.getJsonValueFromStore();i[r[c.USER_CONTEXT_KEY]]=t;let n=JSON.stringify(i);return c.cache[r[c.USER_CONTEXT_KEY]]=t,this._store.syncValue(s.USER_CONTEXT_COOKIE_KEY,n),t}getJsonValueFromStore(){let e=this._store.getOrCreate(s.USER_CONTEXT_COOKIE_KEY,()=>""),t={};if(""===e)return t;let r=e;"string"!=typeof e&&(r=(0,a.safeToString)(e));try{t=JSON.parse(r),(0,o.syncCodaCookieId)(t)}catch(e){console.error(e)}return this._store.syncValue(s.USER_CONTEXT_COOKIE_KEY,JSON.stringify(t)),t}getCachedValue(e){return c.cache[e]}clearCachedValue(){c.cache={}}getValidUserContextKey(e){return c.VALID_USER_CONTEXT_KEY.find(t=>e===t[c.INPUT_KEY])}}r.default=c,c.INPUT_KEY=0,c.USER_CONTEXT_KEY=1,c.VALID_USER_CONTEXT_KEY=[[s.CODA_COOKIE_ID_KEY,s.CODA_COOKIE_ID_KEY],[s.LEGACY_CODA_COOKIE_ID_KEY,s.CODA_COOKIE_ID_KEY],[s.EXPT_TOKEN_KEY,s.EXPT_TOKEN_KEY]],c.cache={}},867001,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=e.r(951584),s=n(e.r(49067)),o=e.r(497045),c=e.r(868942);class u{constructor(e){this.api=e,this.attributes={},this._store=new s.default({allowSubdomain:!0}),this.env=(0,o.getItem)("trex-env")}getExptTokenIdKey(){return u.ATTR_SSID_ID}getOrCreate(e){return i(this,void 0,void 0,function*(){let t=(null==e?void 0:e.forceFetch)?void 0:this._store.getOrCreate(u.KEY,()=>void 0);return t||(this.fetchToken||(this.fetchToken=this.api.fetchExptToken()),t=yield this.fetchToken,(0,o.getItem)("trex-env")===this.env&&this._store.set(u.KEY,t)),t})}getValue(){return this._store.getCachedValue(u.KEY)}getExptTokenId(e){if(e)try{return(0,a.decodeJwt)(e).id}catch(r){let t="Unknown Error";r instanceof Error&&(t=r.message),console.error(`[decodeJwt] Error when decoding token: ${t}, jwt: ${e}`)}}}r.default=u,u.KEY=c.EXPT_TOKEN_KEY,u.ATTR_SSID_ID="exptTokenId"},374776,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.ExperimentationBase=void 0;let a=e.r(497045),s=e.r(205324),o=e.r(156457),c=e.r(798528),u=e.r(816577),l=n(e.r(216434)),d=n(e.r(867001));class h{constructor(){this.featuresLastUpdatedInMs=-1,this._observers=[]}setAttributeCallback(e){var t;return null==(t=this._metadata)||t.getCustomAttributes().setBaseAttributesCallback(e),this}getOrCreateDeviceId(){return i(this,void 0,void 0,function*(){if(void 0!==this._cachedDeviceId)return this._cachedDeviceId;let e=new s.CookieStore(new o.LocalStorageStore),t=e.getOrCreate(h.DEVICEID_KEY,()=>(0,c.v4)());return this._cachedDeviceId=t,e.syncValue(h.DEVICEID_KEY,t),t})}getOrCreateDeviceIdSSR(e,t){return i(this,void 0,void 0,function*(){if(void 0!==this._cachedDeviceId)return this._cachedDeviceId;let r=new u.SSRCookieStore(e,t),i=r.getOrCreate(h.DEVICEID_KEY,()=>(0,c.v4)());
3return this._cachedDeviceId=i,r.syncValue(h.DEVICEID_KEY,i),i})}attachObserver(e){return"function"==typeof e.featuresUpdated&&this._observers.push(e),this}detachObserver(e){let t=this._observers.indexOf(e);return t>-1&&this._observers.splice(t,1),this}refresh(){return i(this,void 0,void 0,function*(){return yield this.fetch(this._cfg)})}_featuresFetched(){this.featuresLastUpdatedInMs=new Date().getTime(),this._notifyObservers()}_notifyObservers(){this._observers.forEach(e=>{e.featuresUpdated(this)})}_configurationUpdated(e){var t,r;return i(this,void 0,void 0,function*(){let i=(null==(t=this===null||void 0===this?void 0:this._cfg)?void 0:t.mode)!==(null==e?void 0:e.mode);(null==(r=this===null||void 0===this?void 0:this._cfg)?void 0:r.mode)===void 0&&(i=!1),this._cfg=e;let n=(0,a.getItem)("trex-env");n||(n="prod",(0,a.setItem)("trex-env","prod")),i&&this._cfg.mode!==n?(0,a.setItem)("trex-env",this._cfg.mode):i&&this._cfg.mode===n&&(i=!1),this.exptToken=new d.default(new l.default(this._cfg)),yield this.exptToken.getOrCreate({forceFetch:i}).catch(e=>{console.log("[ExperimentationBase] Error when populating ExptToken attributes",e)})})}getExptToken(){return this.exptToken?this.exptToken.getOrCreate():Promise.resolve(void 0)}getExptTokenId(){var e,t;let r=null==(e=this.exptToken)?void 0:e.getValue();return null==(t=this.exptToken)?void 0:t.getExptTokenId(r)}getCfg(){return this._cfg}}r.ExperimentationBase=h,h.DEVICEID_KEY="deviceId"},134178,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.safeGuard=void 0,r.safeGuard=function(e){return i(this,void 0,void 0,function*(){try{let t=yield e();return{ok:!0,value:t}}catch(e){return console.log(e),{ok:!1,error:e}}})}},905186,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=e.r(803022),s=e.r(441264),o=e.r(374776),c=e.r(612561),u=n(e.r(702501)),l=e.r(798528),d=e.r(134178),h=e.r(939520),p=e.r(73924),f=n(e.r(49067)),g=n(e.r(979691)),y=e.r(868942),v=e.r(901938),m=e.r(731941);class _ extends o.ExperimentationBase{constructor(e,t){super(),this._featuresJson={},this._gbIsReady=!1,this._canRefresh=!0,this._sampleRate=0,this._arrResolveGB=new Map,this._customEventTracer=e,this._metadata=t,this._trexUserContextStore=new f.default({allowSubdomain:!0}),this._gb=new a.GrowthBookClient({enabled:!0,trackingCallback:(e,t,r)=>{this._trackingCallbackImpl(e,t,r)}})}static getInstance(e,t){return(void 0===_.instance||null===_.instance)&&(_.instance=new _(e,t)),_.instance}init(e){(0,d.safeGuard)(()=>{var t,r,i,n,a,s;this.updateEnv(e),null==(t=this._metadata)||t.setNamespace(e.namespace),null==(r=this._metadata)||r.setReduceIdentifiers(null!=(i=e.reduceIdentifiers)&&i),null==(n=this._customEventTracer)||n.setKeepAlive(null!=(a=e.keepalive)&&a),this._enableAutoRefresh(null!=(s=e.autoRefreshInterval)?s:0)})}_enableAutoRefresh(e=0){e<=0||this._refreshTimer||(this._refreshTimer=setInterval(()=>{this._canRefresh&&(this._canRefresh=!1,this.refresh().finally(()=>{this._canRefresh=!0}))},e))}isReady(e=5e3){var t;return i(this,void 0,void 0,function*(){if(this._gbIsReady)return!0;let r=Symbol("key"),i=null==(t=this.getCfg())?void 0:t.version;return new Promise(t=>{let n=setTimeout(()=>{t(!1),this._arrResolveGB.delete(r)},e);this._arrResolveGB.set(r,e=>{e===i&&(clearTimeout(n),t(!0),this._arrResolveGB.delete(r))})})})}updateEnv(e){var t,r,i,n,a;let o=e.environment,c=e.namespacedFeatures,u=e.namespace||m.AllowedNamespace.UNKNOWN;if(!o)return;let l=!0;if(this.isValidEnv(o)||(console.log(`Invalid input, current env ${null==(t=this.getCfg())?void 0:t.mode}, current input ${o}`),l=!1),o===(null==(r=this.getCfg())?void 0:r.mode)&&u===(null==(i=this.getCfg())?void 0:i.namespace)&&(l=!1),l){let t=new s.ExperimentationConfigBuilder().setErrorHandler({handleError:(e,t)=>
3{console.error(e)}}).setMode(o).setNamespace(u).setNamespacedFeatures(!!c).setSampleRate(null!=(n=e.sampleRate)?n:0).build();this.fetch(t).catch(e=>console.log(e)),null==(a=this._customEventTracer)||a.setEnv(o)}}setSampleRate(e){e<0||e>1?console.warn("sampleRate value cannot be less than 0 or more than 1"):this._sampleRate=e}isValidEnv(e){return"prod"===e||"qa"===e||"dev"===e||"local"===e}_trackingCallbackImpl(e,t,r){var n,a;return i(this,void 0,void 0,function*(){let i={deviceId:this._cachedDeviceId,anonymousId:this._getOrCreateAnonymousId(),experimentId:e.key,variationId:t.variationId,resultValue:t.value};Object.assign(i,null!=(n=null==r?void 0:r.attributes)?n:{}),null==(a=this._customEventTracer)||a.traceExperimentViewedEvent(i)})}_getOrCreateAnonymousId(){try{return(0,c.getOrCreateSegmentAnonymousId)(this._getOrGenerateSegmentAnonymousId)}catch(r){console.error(r);let e="Unknown Error";r instanceof Error&&(e=r.message);let t="getOrCreateAnonymousId error "+e;return console.error("returning error result:",t),t}}_getOrGenerateSegmentAnonymousId(){let e="ajs_anonymous_id",t=(0,u.default)(),r=t.get(e);return r||(r=(0,l.v4)(),t.set(e,r)),r}fetch(e){return i(this,void 0,void 0,function*(){this._gbIsReady=!1,yield this._configurationUpdated(e),this._gb=new a.GrowthBookClient({trackingCallback:(e,t,r)=>{this._trackingCallbackImpl(e,t,r)}}),yield this._gb.setPayload({features:this._featuresJson}),this.setSampleRate(e.sampleRate);let t={timeoutMs:e.fetchTimeoutMs||s.ExperimentationConfig.DEFAULT_FETCH_TIMEOUT_MS,retries:e.fetchMaxRetries||s.ExperimentationConfig.DEFAULT_FETCH_MAX_RETRIES};return new g.default(t).fetch(e.endPointUrl).then(e=>{if(e.ok)return e.json();throw Error(`fetching features not ok, with status ${e.status} / ${e.statusText}, with resp headers of ${JSON.stringify(e.headers)}`)}).then(t=>i(this,void 0,void 0,function*(){var r;return e.version===(null==(r=this.getCfg())?void 0:r.version)&&(this._featuresJson=t.features,yield this._gb.setPayload({features:t.features}),this._featuresFetched()),this._notifyIsReady(e.version),this}))})}_notifyIsReady(e){var t;if(e===(null==(t=this.getCfg())?void 0:t.version)&&(this._gbIsReady=!0,this._arrResolveGB))for(let t of this._arrResolveGB.values())t(e)}_populateAttributes(){var e,t,r;let i=(null==(e=this._metadata)?void 0:e.getCustomAttributes().get())||{};return i.codaCookieId=null==(r=null==(t=this._metadata)?void 0:t.codaCookieId)?void 0:r.getValue(),i.exptTokenId=this.getExptTokenId(),i}isOn(e,t){let r=this._populateAttributes();t&&(r=this.overrideGB(t,r));let i={attributes:r,enabled:!0};return this._traceFeatureCall(e,()=>this._isOn(e,i),"isOn",r)}overrideGB(e,t){var r;let i=Object.assign(Object.assign({},null!=(r=t.customMetadata)?r:{}),e);return(0,v.syncCodaCookieId)(i),Object.keys(i).length>0?Object.assign(Object.assign(Object.assign({},t),i),{customMetadata:i}):t}_isOn(e,t){return this._whiteLabelAwareExec(e,t,()=>this._gb.isOn(e,t),!1)}isOff(e,t){let r=this._populateAttributes();t&&(r=this.overrideGB(t,r));let i={attributes:r,enabled:!0};return this._traceFeatureCall(e,()=>this._isOff(e,i),"isOff",r)}_isOff(e,t){return this._whiteLabelAwareExec(e,t,()=>this._gb.isOff(e,t),!0)}_traceFeatureCall(e,t,r,i){var n;if(!this._shouldTrace(i))return t();let a=this.now(),s=t(),o={feature:e,resultTracing:s,durationMicro:Math.trunc((this.now()-a)*1e3).toString(),userContext:JSON.stringify(i),methodName:r};return null==(n=this._customEventTracer)||n.traceCustomEvent("featureFlagTracing",o),s}now(){return performance.now()}_shouldTrace(e){let t=e.codaCookieId;return null!=t&&!!t.startsWith("test")||!(this._sampleRate<=0)&&Math.random()<this._sampleRate}getFeatureValue(e,t,r){let i=this._populateAttributes();r&&(i=this.overrideGB(r,i));let n={attributes:i,enabled:!0};return this._traceFeatureCall(e,()=>this._getFeatureValue(e,t,n),"getFeatureValue",i)}_getFeatureValue(e,t,r){return this._whiteLabelAwareExec(e,r,()=>this._gb.getFeatureValue(e,t,r),t)}getSerializedContext(){return i(this,void 0,void 0,function*(){let e=yield this.callSerializedContext();return e.ok?e.value:"{}"})}getMetadata(){var e;return i(this,void 0,void 0,function*(){let t=(yield null==(e=this._metadata)?void 0:e.getOrPopulate())||{};return Object.assign(t,(null==t?void 0:t.customMetadata)||{}),delete t.customMetadata,delete t.utmTerm,t})}deserializeOrCreateContext(e){return i(this,void 0,void 0,function*(){try{let t=JSON.parse(e);return void 0!==t[y.LEGACY_CODA_COOKIE_ID_KEY]&&(t.codaCookieId=t[y.LEGACY_CODA_COOKIE_ID_KEY]),t}catch(e){return{codaCookieId:(0,l.v4)()}}})}enableAutoTrack(){(0,h.safeIsClient)()&&document.body.addEventListener("click",this.handleAutoTrackClick.bind(this))}parseDeserializedContext(e){return i(this,void 0,void 0,function*(){let t={};try{t=JSON.parse(e)}catch(e){console.error(e);return}for(let e in t){let r=t[e];this._trexUserContextStore.set(e,r)}})}handleAutoTrackClick(e){(0,d.safeGuard)(()=>{var t;let r=[],i=e.target;for(;i;){let e=i;i=e.parentElement,this.collectEventData(e,r)}r.length>0&&(null==(t=this._customEventTracer)||t.traceClickEvent(r))})}collectEventData(e,t){let r=null==e?void 0:e.attributes;if(!r)return;let i=r.getNamedItem(y.DATA_AUTO_TRACK_KEY);if(!i)return;let n=i.value;if(0===n.trim().length)return;let a=Array.from(r).filter(e=>e.name.startsWith(y.TRACK_CUSTOM_KEY_PREFIX)&&e.name!==y.TRACK_CUSTOM_KEY_PREFIX).reduce((e,t)=>
3{let r=t.name.replace(y.TRACK_CUSTOM_KEY_PREFIX,"");return e[(0,p.kebabToCamel)(r)]=t.value,e},{}),s={eventName:n,elementId:e.id,elementClass:e.classList.value,eventData:a};t.push(s)}callSerializedContext(){return i(this,void 0,void 0,function*(){return(0,d.safeGuard)(()=>i(this,void 0,void 0,function*(){var e;let t=yield null==(e=this._metadata)?void 0:e.getOrPopulate(),r=Object.assign(Object.assign({},t),{exptToken:yield this.getExptToken()});return Object.assign(r,(null==t?void 0:t.customMetadata)||{}),delete r.customMetadata,delete r.utmTerm,JSON.stringify(r)}))})}_whiteLabelAwareExec(e,t,r,i){try{let n=t.attributes||{};return!(!("whiteLabelId"in n)||null===n.whiteLabelId||0===n.whiteLabelId||"0"===n.whiteLabelId||void 0===n.whiteLabelId||!this._featuresJson[e]||this._hasWhiteLabelIdInCondition(this._featuresJson[e]))?i:r()}catch(e){return console.error(e),i}}_hasWhiteLabelIdInCondition(e){var t;let r=null!=(t=null==e?void 0:e.rules)?t:null;return!!r&&Array.isArray(r)&&r.some(e=>e.condition&&"whiteLabelId"in e.condition)}}r.default=_,_.NON_FEATURE_KEYS=["dateUpdated"]},96292,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=n(e.r(49067)),s=e.r(868942);class o{constructor(e){var t;this._cfg=e,this._trexCookieStore=new a.default({allowSubdomain:null==(t=null==e?void 0:e.allowSubdomain)||t})}getOrCreate(){return i(this,void 0,void 0,function*(){return this._trexCookieStore.getOrCreate(this.getKey(),()=>this._cfg.valueGenerator())})}getKey(){return o.KEY}getValue(){return this._trexCookieStore.getCachedValue(this.getKey())}}r.default=o,o.KEY=s.CODA_COOKIE_ID_KEY},422751,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default="1.7.0"},523815,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var e;if(null==globalThis.history)return;let t=globalThis.history;if(null==t.onpushstateCallbacks){let r=function(e){var r;for(let[i,n]of(null!=(r=t.onpushstateCallbacks)?r:[]).entries())try{n({state:e})}catch(e){console.error(`Error processing callback with id ${i}:`,e)}},i=t.pushState;t.onpushstateCallbacks=new Map,t.pushState=function(e,n,a){return r(e),i.apply(t,[e,n,a])},t.setOnPushStateCallback=function(e,r){var i;return null==(i=t.onpushstateCallbacks)||i.set(e,r),t},t.unsetOnPushStateCallback=function(e){var r,i;return null!=(i=null==(r=t.onpushstateCallbacks)?void 0:r.delete(e))&&i},null==(e=globalThis.window)||e.addEventListener("popstate",e=>{var t;r(null!=(t=e.state)?t:{})})}return globalThis.history}},222978,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CustomAttributes=void 0;let i=e.r(73924),n=()=>({}),a=0;r.CustomAttributes=class{constructor(){this._baseAttributes=void 0}setBaseAttributesCallback(e){this._baseAttributes=e}get(){var e;return this.useCallback(null!=(e=this._baseAttributes)?e:n)}useCallback(e){var t;return(0,i.cleanedAttributes)(Object.fromEntries(Object.entries(null!=(t=e())?t:{}).filter(([e,t])=>{var r;let n,s=(0,i.isValidAttribute)(t);return!s&&(r=`ignoring invalid attribute ${e}:${t}`,(n=Date.now())-a>5e3&&(console.warn(r),a=n)),s})))}}},253036,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=n(e.r(422751)),s=n(e.r(979691)),o=n(e.r(523815)),c=e.r(222978),u=e.r(731941),l=e.r(497045),d=["ip"];r.default=class{setNamespace(e){if(e){if(!Object.values(u.AllowedNamespace).includes(e))return void console.error("invalid namespace provided: "+e);this.namespace=e}}setSession(e){this.session=e}getNamespace(){return this.namespace}setReduceIdentifiers(e){this.isReduceIdentifiers=e}constructor(e){var t;this.codaCookieId=e,this.namespace=u.AllowedNamespace.UNKNOWN,this.isReduceIdentifiers=!1,this.tracingMetadata={},this.ipFetcher=new s.default({timeoutMs:2e3,retries:3}),this.customAttributes=new c.CustomAttributes,null==(t=(0,o.default)())||t.setOnPushStateCallback("repopulateMetadataUponNewVisit:EX-161",()=>this.getOrPopulate().catch(e=>console.error(e)))}getUrl(){var e,t;return null==(t=null==(e=null==globalThis?void 0:globalThis.document)?void 0:e.location)?void 0:t.href}getCustomAttributes(){return this.customAttributes}getOrPopulate(){return i(this,void 0,void 0,function*(){let e=this.customAttributes.get();if(0===Object.keys(e).length?delete this.tracingMetadata.customMetadata:this.tracingMetadata.customMetadata=e,this.tracingMetadata.ns=this.namespace,this.tracingMetadata.codaCookieId=yield this.co
3daCookieId.getOrCreate(),this.latestUrl===this.getUrl())return Object.assign({},this.tracingMetadata);this.tracingMetadata.fullUrl=this.getUrl(),this.tracingMetadata.ip||this.ipFetcher.fetch("https://api.ipify.org?format=text").then(e=>e.text()).then(e=>{this.tracingMetadata.ip=e}).catch(e=>console.error(e));let t=this.populateCampaignParams();if(this.tracingMetadata.libraryVersion||(this.tracingMetadata.libraryVersion=a.default),this.populateBrowserAttributes(),this.latestUrl=this.getUrl(),this.session){let e=yield this.session.get(t,this.tracingMetadata);this.tracingMetadata.sessionId=e.sessionId,this.tracingMetadata.sessionNum=e.sessionNum,this.tracingMetadata.engagementMs=e.engagementMs}return this.isReduceIdentifiers?Object.assign({},this.reduceIdentifiers(this.tracingMetadata)):Object.assign({},this.tracingMetadata)})}reduceIdentifiers(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!d.includes(e)))}populateBrowserAttributes(){var e,t,r,i,n,a,s,o,c,u,l,d,h,p,f;let g=null==(t=null==(e=null==globalThis?void 0:globalThis.document)?void 0:e.location)?void 0:t.hostname;this.tracingMetadata.domainName!==g&&(this.tracingMetadata.domainName=g),this.tracingMetadata.userAgent||(this.tracingMetadata.userAgent=(null==(r=null==globalThis?void 0:globalThis.navigator)?void 0:r.userAgent)||(null==(i=null==globalThis?void 0:globalThis.navigator)?void 0:i.vendor)||(null==globalThis?void 0:globalThis.opera)),this.tracingMetadata.os||(this.tracingMetadata.os=null!=(s=null==(a=null==(n=null==globalThis?void 0:globalThis.navigator)?void 0:n.userAgentData)?void 0:a.platform)?s:null==globalThis?void 0:globalThis.navigator.platform),this.tracingMetadata.mobile||(this.tracingMetadata.mobile=null!=(u=null==(c=null==(o=null==globalThis?void 0:globalThis.navigator)?void 0:o.userAgentData)?void 0:c.mobile)?u:this.isMobileDevice(null!=(l=this.tracingMetadata.userAgent)?l:"")),this.tracingMetadata.browser||(this.tracingMetadata.browser=null!=(f=null==(p=null==(h=null==(d=null==globalThis?void 0:globalThis.navigator)?void 0:d.userAgentData)?void 0:h.brands)?void 0:p.reduce((e,t)=>`${e}${""===e?"":"/"}${t.brand}:${t.version}`,""))?f:null==globalThis?void 0:globalThis.navigator.appVersion)}populateCampaignParams(){let e=this.getQueryParams(),t=this.createCampaignList(e),r=this.getOldCampaignValue(t),i=this.shouldOverride(t),n=!1;i&&(n=this.isCampaignNew(t),this.updateTracingMetadata(e));let a={};return n&&(a=this.updateCampaignStorage(t)),{campaignOverride:i,newCampaign:n,newCampaignObj:a,oldCampaignObj:r}}shouldOverride(e){return Object.values(e).some(e=>!!e)}updateCampaignStorage(e){return Object.entries(e).reduce((e,[t,r])=>(this.isCampaignValueValid(r)?(0,l.setItem)(t,r):(0,l.removeItem)(t),e[t]=(0,l.getItem)(t),e),{})}getOldCampaignValue(e){return Object.keys(e).reduce((e,t)=>(e[t]=(0,l.getItem)(t),e),{})}updateTracingMetadata(e){let t=e=>void 0!==e?encodeURIComponent(e):e;Object.assign(this.tracingMetadata,{cid:t(e.cid),campaignId:t(e.utm_campaign),utmCampaign:t(e.utm_campaign),utmSource:t(e.utm_source),utmMedium:t(e.utm_medium),utmContent:t(e.utm_content),utmTerm:e.utm_term})}createCampaignList(e){return{campaignId:e.utm_campaign,utmCampaign:e.utm_campaign,utmSource:e.utm_source,utmMedium:e.utm_medium,utmContent:e.utm_content,utmTerm:e.utm_term,cid:e.cid}}getQueryParams(){var e,t;return Object.fromEntries(Array.from(new URLSearchParams(null==(t=null==(e=null==globalThis?void 0:globalThis.document)?void 0:e.location)?void 0:t.search),([e,t])=>[e.toLowerCase(),t]))}isCampaignNew(e){return Object.entries(e).map(([e,t])=>(""===t?void 0:t)!==(0,l.getItem)(e)).some(Boolean)}isCampaignValueValid(e){return!!e||""===e}isMobileDevice(e){return[/(Android)(.+)(Mobile)/i,/BlackBerry/i,/iPhone|iPod/i,/Opera Mini/i,/IEMobile/i].some(t=>e.match(t))}}},134152,(e,t,r)=>{"use strict";var i=e.e&&e.e.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};
3Object.defineProperty(r,"__esModule",{value:!0});let n=e.r(497045),a=e.r(205324);class s{constructor(e,t,r){var i;this._cfg=e,this.timeoutMs=t,this._store=new a.CookieStore(void 0,{allowSubdomain:null==(i=null==e?void 0:e.allowSubdomain)||i}),this._timeoutMs=t,this._customEventTracer=r}get(e,t){let r=Date.now(),i=this._store.getOrCreate(s.SESSION_ID_KEY,()=>r),n=this._store.getOrCreate(s.LAST_ACTION_KEY,()=>r),a=this._store.getOrCreate(s.SESSION_NUM_KEY,()=>0),o=[],c=!1;return(null==e?void 0:e.newCampaign)&&(c=this.handleNewCampaign(o,i,a,n,r,e.oldCampaignObj,e.newCampaignObj)),!c&&this.isSessionTimedOut(r,n)&&(c=this.handleSessionTimeout(o,e,i,a,n,r,e.oldCampaignObj,e.newCampaignObj)),!c&&this.isSessionJustInitiated(i,a,r)&&(c=this.handleNewSessionInitiation(o,i,a,r,e.newCampaignObj)),this.updatelastActionTime(r),c?this._customEventTracer.traceSessionEvents({payloads:this.transformPayload(o)},t):o.push(this.generateSessionRunning(i,a,r,e.oldCampaignObj)),o[o.length-1]}setCustomEventTracer(e){this._customEventTracer=e}handleNewCampaign(e,t,r,i,n,a,s){return t!==n&&e.push(this.generateSessionClose(t,r,i,a)),e.push(this.generateSessionStart(n,r,n,s)),this.updateSessionData(n),!0}isSessionTimedOut(e,t){return e-t>=this._timeoutMs}handleSessionTimeout(e,t,r,i,n,a,s,o){return t&&!t.campaignOverride&&this.deleteCampaignData(),e.push(this.generateSessionClose(r,i,n,s)),e.push(this.generateSessionStart(a,i,a,o)),this.updateSessionData(a),!0}isSessionJustInitiated(e,t,r){return e===r&&0===t}handleNewSessionInitiation(e,t,r,i,n){return e.push(this.generateSessionStart(t,r,i,n)),this.updateSessionData(i),!0}updateSessionData(e){this._store.saveOrUpdateValue(s.SESSION_ID_KEY,e),this._store.saveOrUpdateValue(s.LAST_ACTION_KEY,e),this.incrementSessionNum()}updatelastActionTime(e){this._store.saveOrUpdateValue(s.LAST_ACTION_KEY,e)}deleteCampaignData(){["campaignId","utmCampaign","utmSource","utmMedium","utmContent","utmTerm","cid"].forEach(e=>{(0,n.removeItem)(e)})}transformPayload(e){return e.map(e=>{let{lastActionTime:t,eventName:r}=e;return{customMetadata:Object.assign({},i(e,["lastActionTime","eventName"])),eventName:e.eventName}})}generateSessionStart(e,t,r,i){return this.insertSessionData(s.SESSION_START,e,t+1,r,i)}generateSessionClose(e,t,r,i){return this.insertSessionData(s.SESSION_CLOSE,e,t,r,i)}generateSessionRunning(e,t,r,i){return this.insertSessionData("",e,t,r,i)}insertSessionData(e,t,r,i,n){return Object.assign({eventName:e,sessionId:t,sessionNum:r,lastActionTime:i,engagementMs:i-t},null!=n?n:{})}incrementSessionNum(){let e=this._store.getOrCreate(s.SESSION_NUM_KEY,()=>0);this._store.saveOrUpdateValue(s.SESSION_NUM_KEY,e+1)}}r.default=s,s.SESSION_ID_KEY="trex-sessionId",s.SESSION_NUM_KEY="trex-sessionNum",s.LAST_ACTION_KEY="trex-lastActionTime",s.SESSION_START="sessionStart",s.SESSION_CLOSE="sessionClose"},42193,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0});let n={Accept:"*/*"};r.default=function(e,t,...r){return i(this,void 0,void 0,function*(){let i={records:(null!=r?r:[]).filter(e=>null!=e).map(e=>({value:e}))},a=yield t.fetch(e,{method:"POST",headers:n,body:JSON.stringify(i)});return a.ok||console.error(`HTTP response error! Status: ${a.status}`),{payload:r,finalPayload:i,response:a}})}},220857,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceConfigByEnvironment=void 0;let a=n(e.r(523815)),s=e.r(134178),o=e.r(939520);r.traceConfigByEnvironment={prod:{customEventEndpoint:"https://events.codainfra.com/topics/custom-events",pageViewEndpoint:"https://events.codainfra.com/topics/page-viewed",experimentViewedEndpoint:"https://events.codainfra.com/topics/experiment-viewed",clickEventEndpoint:"https://events.codainfra.com/topics/clicked",identifyEventEndpoint:"https://events.codainfra.com/topics/identified",sessionEndpoint:"https://events.codainfra.com/topics/trex-sessions"},qa:{customEventEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/custom-events",pageViewEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/page-viewed",experimentViewedEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/experiment-viewed",clickEventEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/clicked",identifyEventEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/identified",sessionEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/trex-sessions"},dev:{customEventEndpoint:"http://alb-expt-events-qa.codapay.net/topics/custom-events",pageViewEndpoint:"http://alb-expt-events-qa.codapay.net/topics/page-viewed",experimentViewedEndpoint:"http://alb-expt-events-qa.codapay.net/topics/experiment-viewed",clickEventEndpoint:"http://alb-expt-events-qa.codapay.net/topics/clicked",identifyEventEndpoint:"http://alb-expt-events-qa.codapay.net/topics/identified",sessionEndpoint:"https://api-experiments.codainfra-staging.com/dMcPNUpWQKVp/topics/trex-sessions"},get local(){return{customEventEndpoint:`${(0,o.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/custom-events`,pageViewEndpoint:`${(0,o.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/page-viewed`,experimentViewedEndpoint:`${(0,o.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/experiment-viewed`,clickEventEndpoint:`${(0,o.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/clicked`,identifyEventEndpoint:`${(0,o.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/identified`,sessionEndpoint:`${(0,o.getEnvVariable)("LOCAL_GROWTHBOOK_SERVER_URL")}/topics/trex-sessions`}}};
3class c{constructor(e,t,r,i){this.cfg=e,this.pageViewInited=!1,this.codaCookieId=t,this.metadata=r,this.customEventTracer=i,this.toggleAutomaticPageViewEvent(!0)}toggleAutomaticPageViewEvent(e){return i(this,void 0,void 0,function*(){return(0,s.safeGuard)(()=>{var t,r;e?null==(t=(0,a.default)())||t.setOnPushStateCallback(c.PUSH_STATE_PAGE_VIEW,()=>this.tracePageViewWithAdditionalInfo()):null==(r=(0,a.default)())||r.unsetOnPushStateCallback(c.PUSH_STATE_PAGE_VIEW)})})}traceIdentifyEvent(e,t={}){return i(this,void 0,void 0,function*(){return this.customEventTracer.traceIdentifyEvent(e,t)})}traceIdentifyEvents(e){return i(this,void 0,void 0,function*(){return this.customEventTracer.traceIdentifyEvent(e)})}traceCustomEvent(e,t,r={}){return i(this,void 0,void 0,function*(){return this.customEventTracer.traceCustomEvent(e,t,r)})}traceCustomEvents(e){return i(this,void 0,void 0,function*(){return this.customEventTracer.traceCustomEvents(e)})}traceExperimentViewedEvent(e,t={}){return i(this,void 0,void 0,function*(){return this.customEventTracer.traceExperimentViewedEvent(e,t)})}traceExperimentViewedEvents(e){return i(this,void 0,void 0,function*(){return this.customEventTracer.traceExperimentViewedEvents(e)})}tracePageViewEvent(){return i(this,void 0,void 0,function*(){return this.customEventTracer.tracePageViewEvent()})}traceFirstPageView(){return i(this,void 0,void 0,function*(){this.pageViewInited||(this.pageViewInited=!0,this.customEventTracer.tracePageViewEvent())})}setPageViewAdditionalInfoCallback(e){null!=e&&(this.additionalInfoCallback=e)}tracePageViewWithAdditionalInfo(){return i(this,void 0,void 0,function*(){return this.customEventTracer.tracePageViewEvent(this.additionalInfoCallback)})}initCodaCookieId(){return i(this,void 0,void 0,function*(){return this.codaCookieId.getOrCreate()})}initMetadata(){return i(this,void 0,void 0,function*(){return this.metadata.getOrPopulate()})}initPageView(){return i(this,void 0,void 0,function*(){return this.tracePageViewWithAdditionalInfo()})}}r.default=c,c.PUSH_STATE_PAGE_VIEW="pageViewEventUponNewVisitAndSubsequentNavigation:EX-145-146"},790052,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=n(e.r(979691)),s=n(e.r(42193)),o=e.r(134178),c=e.r(73924),u=e.r(220857);function l(e={}){var t,r,i;return{eventData:null!=(t=e.eventData)?t:{},customMetaData:null!=(r=e.customMetaData)?r:{},contextV2:null!=(i=e.contextV2)?i:{}}}function d(e={}){var t;return{payloadArr:null!=(t=e.payloadArr)?t:[]}}class h{constructor(e,t){this.metadata=e,this.cfg=t,this.fetcher=new a.default({timeoutMs:2e3,retries:3}),this.env="prod"}setEnv(e){this.env=e,this.cfg=u.traceConfigByEnvironment[e]}getMetadata(){return this.metadata}setKeepAlive(e){this.fetcher.setKeepAlive(e)}tracePageViewEvent(e,t){return i(this,void 0,void 0,function*(){return(0,o.safeGuard)(()=>i(this,void 0,void 0,function*(){var r,i,n,a,s,o,c,u,l,d,p,f;let g=yield this.metadata.getOrPopulate(),y=Object.assign(Object.assign({},g),{customMetadata:Object.assign(Object.assign({},g.customMetadata||{}),t||{}),title:document.title,path:null==(i=null==(r=globalThis.document)?void 0:r.location)?void 0:i.pathname,referrerUrl:null==(n=globalThis.document)?void 0:n.referrer,locale:(null!=(c=null==(o=null==(s=null==(a=globalThis.document)?void 0:a.location)?void 0:s.pathname)?void 0:o.match(h.REGEX_LOCALE))?c:[])[1],additionalInfo:(null==(d=null==(l=null==(u=null==globalThis?void 0:globalThis.document)?void 0:u.location)?void 0:l.search)?void 0:d.includes("debug=true"))?Object.assign(Object.assign({},(null==e?void 0:e())||{}),{url:null==(f=null==(p=null==globalThis?void 0:globalThis.document)?void 0:p.location)?void 0:f.href}):null==e?void 0:e()});return"dev"===this.env?this.logTracing("pageViewEvent",y):this.postCustomEvent(this.cfg.pageViewEndpoint,()=>y)}))})}traceClickEvent(e,t){return i(this,void 0,void 0,function*(){return(0,o.safeGuard)(()=>i(this,void 0,void 0,function*(){let r=yield this.metadata.getOrPopulate(),i=e.map(e=>{let i=Object.assign(Object.assign({},e),r),n=Object.assign(Object.assign({},r.customMetadata||{}),t||{});return Object.keys(n).length>0&&(i.customMetadata=n),i});return"dev"===this.env?this.logTracing("clickEvent",i):this.postCustomEvent(this.cfg.clickEventEndpoint,()=>i)}))})}traceExperimentViewedEvent(e,t={},r={}){return i(this,void 0,void 0,function*(){return"dev"===this.env?(0,o.safeGuard)(()=>this.logTracing("experimentViewedEvent",{payloadArr:[{eventData:e,customMetaData:t,contextV2:r}]})):this.traceExperimentViewedEvents({payloadArr:[{eventData:e,customMetaData:t,contextV2:r}]})})}traceExperimentViewedEvents(e){return i(this,void 0,void 0,function*(){return(0,o.safeGuard)(()=>i(this,void 0,void 0,function*(){e=d(e);let t=yield this.metadata.getOrPopulate(),r=[];for(let i=0;i<e.payloadArr.length;i++){let n=l(e.payloadArr[i]),a=(0,c.cleanedAttributes)(n.eventData);
3r.push(Object.assign(Object.assign(Object.assign({},t),n.customMetaData),a))}return"dev"===this.env?this.logTracing("experimentViewedEvent",r):this.postCustomEvent(this.cfg.experimentViewedEndpoint,()=>r)}))})}traceCustomEvent(e,t,r={},n={}){return i(this,void 0,void 0,function*(){return"dev"===this.env?(0,o.safeGuard)(()=>this.logTracing("customEvent",{eventName:e,payloadArr:[{eventData:t,customMetaData:r,contextV2:n}]})):this.traceCustomEvents({eventName:e,payloadArr:[{eventData:t,customMetaData:r,contextV2:n}]})})}traceCustomEvents(e){return i(this,void 0,void 0,function*(){return(0,o.safeGuard)(()=>i(this,void 0,void 0,function*(){e=function(e={}){var t,r;return Object.assign({eventName:null!=(t=e.eventName)?t:"",contextV2:null!=(r=e.contextV2)?r:{}},d(e))}(e);let t=yield this.metadata.getOrPopulate(),r=[];for(let i=0;i<e.payloadArr.length;i++){let n=l(e.payloadArr[i]),a=(0,c.cleanedAttributes)(n.eventData);""!==e.eventName.trim()?r.push(Object.assign(Object.assign(Object.assign(Object.assign({},t),{customMetadata:Object.assign(Object.assign(Object.assign({},t.customMetadata||{}),n.customMetaData||{}),n.contextV2||{})}),n.customMetaData),{codaCookieId:this.getCodaCookieId(n,t),eventName:e.eventName,eventData:a})):console.error(`uneligible payload for custom event posting: ${(0,c.safeToString)(n)}, with endpoint of ${this.cfg.customEventEndpoint}`)}return"dev"===this.env?this.logTracing("customEvent",r):this.postCustomEvent(this.cfg.customEventEndpoint,()=>r)}))})}traceIdentifyEvent(e,t={},r={}){return i(this,void 0,void 0,function*(){return"dev"===this.env?(0,o.safeGuard)(()=>this.logTracing("identifyEvent",{payloadArr:[{eventData:e,customMetaData:t,contextV2:r}]})):this.traceIdentifyEvents({payloadArr:[{eventData:e,customMetaData:t,contextV2:r}]})})}traceIdentifyEvents(e){return i(this,void 0,void 0,function*(){return(0,o.safeGuard)(()=>i(this,void 0,void 0,function*(){e=function(e={}){return Object.assign({},d(e))}(e);let t=yield this.metadata.getOrPopulate(),r=[];for(let i=0;i<e.payloadArr.length;i++){let n=l(e.payloadArr[i]),a=(0,c.cleanedAttributes)(n.eventData);if(null!==t.codaCookieId){let e=Object.assign({},a);r.push(Object.assign(Object.assign(Object.assign({},t),n.customMetaData),{eventData:e,codaCookieId:this.getCodaCookieId(n,t),customMetadata:Object.assign(Object.assign(Object.assign({},t.customMetadata||{}),n.customMetaData||{}),n.contextV2||{})}))}else console.error(`uneligible payload for identify event posting: ${(0,c.safeToString)(n)}, with endpoint of ${this.cfg.identifyEventEndpoint}`)}return"dev"===this.env?this.logTracing("identifyEvent",r):this.postCustomEvent(this.cfg.identifyEventEndpoint,()=>r)}))})}traceSessionEvent(e,t={},r){return i(this,void 0,void 0,function*(){return"dev"===this.env?(0,o.safeGuard)(()=>this.logTracing("sessionEvent",{payloadArr:[{eventName:e,customMetadata:t}]})):this.traceSessionEvents({payloads:[{eventName:e,customMetadata:t}]},r)})}traceSessionEvents(e,t){return i(this,void 0,void 0,function*(){return(0,o.safeGuard)(()=>i(this,void 0,void 0,function*(){var r;e=function(e={}){var t;return{payloads:null!=(t=e.payloads)?t:[]}}(e);let i=[];for(let n=0;n<(null!=(r=e.payloads)?r:[]).length;n++){let r=null!==t.codaCookieId,a=Object.assign(Object.assign(Object.assign({},t),e.payloads[n].customMetadata),{eventName:e.payloads[n].eventName});r?i.push(a):console.error(`uneligible payload for session event posting: ${(0,c.safeToString)(a)}, with endpoint of ${this.cfg.sessionEndpoint}`)}return"dev"===this.env?this.logTracing("sessionEvent",i):this.postCustomEvent(this.cfg.sessionEndpoint,()=>i)}))})}postCustomEvent(e,t){return i(this,void 0,void 0,function*(){let r=t(),i=Array.isArray(r)?r:[r];if(!(i.length>0)){let t=`uneligible empty array for custom event posting with endpoint of ${e}`;throw console.error(t),Error(t)}return(0,s.default)(e,this.fetcher,...i)})}logTracing(e,t){let r={payload:[],finalPayload:{records:[]},response:new Response};return console.log("Currently in dev env, logging instead of sending to kafka"),console.log(`Type: ${e} Payload: ${JSON.stringify(t)}`),Promise.resolve(r)}getCodaCookieId(e,t){var r,i,n;return(null==(r=e.contextV2)?void 0:r.codaCookieId)||(null==(i=e.customMetaData)?void 0:i.codaCookieId)||(null==(n=e.customMetaData)?void 0:n["coda-cookie-id"])||t.codaCookieId}}r.default=h,h.EXPERIMENT_VIEWED_EVENT_NAME="ExperimentViewed",h.REGEX_LOCALE=/^\/([a-z]{2}-[a-z]{2})\/?/},639030,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};
3Object.defineProperty(r,"__esModule",{value:!0}),r.default=class e{constructor(e){this.experimentation=e}isOn(e,t){return this.getExperimentation().isOn(e,t)}isOff(e,t){return this.getExperimentation().isOff(e,t)}isReady(e){return i(this,void 0,void 0,function*(){return this.getExperimentation().isReady(e)})}getFeatureValue(e,t,r){return this.getExperimentation().getFeatureValue(e,t,r)}getMetadata(){return i(this,void 0,void 0,function*(){return this.getExperimentation().getMetadata()})}getExperimentation(){var t;return null!=(t=this.experimentation)?t:e.SUPER_CLASS}}},810080,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.default=class e{constructor(e){this.tracer=e}sendCustomEvent(e,t,r,n){return i(this,void 0,void 0,function*(){return this.getTracer().traceCustomEvent(e,t,r,n)})}sendIdentified(e,t,r){return i(this,void 0,void 0,function*(){return this.getTracer().traceIdentifyEvent(e,t,r)})}sendPageViewed(e){return i(this,void 0,void 0,function*(){return this.getTracer().tracePageViewEvent(void 0,e)})}sendClicked(e,t){return i(this,void 0,void 0,function*(){return this.getTracer().traceClickEvent(e,t)})}sendClickEvent(e,t,r){return i(this,void 0,void 0,function*(){let i=[Object.assign({eventName:e},t)];return this.getTracer().traceClickEvent(i,r)})}getTracer(){var t;return null!=(t=this.tracer)?t:e.TRACER}}},638864,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let a=n(e.r(639030)),s=n(e.r(810080)),o=e.r(868942);r.default=class e{constructor(t,r,i){t instanceof e?(this.experimenter=t.experimenter,this.resultSender=t.resultSender,this.context=t.context):(this.experimenter=void 0===r?new a.default:new a.default(r),this.resultSender=void 0===i?new s.default:new s.default(i),this.context=null!=t?t:{})}put(e,t){if(e===o.CODA_COOKIE_ID_KEY||e===o.EXPT_TOKEN_KEY)throw Error("Cannot set codaCookieId or exptToken");return this.context[e]=t,this}clearContext(){for(let e in this.context)e!==o.CODA_COOKIE_ID_KEY&&e!==o.EXPT_TOKEN_KEY&&delete this.context[e];return this}setContextCallback(e){return this.contextCallback=e,this}getBoolean(e,t){return"boolean"==typeof this.context[e]?this.context[e]:t}getNumber(e,t){return"number"==typeof this.context[e]?this.context[e]:t}getString(e,t){return"string"==typeof this.context[e]?this.context[e]:t}toJsonString(){return i(this,void 0,void 0,function*(){let e=yield this.experimenter.getMetadata();return(null==e?void 0:e.codaCookieId)&&delete e.codaCookieId,JSON.stringify(Object.assign(Object.assign({},e),this.resolveContext()))})}isReady(e){return i(this,void 0,void 0,function*(){return this.experimenter.isReady(e)})}isOn(e,t){return void 0===t?this.experimenter.isOn(e,this.resolveContext()):this.experimenter.isOn(e,this.resolveContext(t))}isOff(e,t){return void 0===t?this.experimenter.isOff(e,this.resolveContext()):this.experimenter.isOff(e,this.resolveContext(t))}getFeatureValue(e,t,r){return void 0===r?this.experimenter.getFeatureValue(e,t,this.resolveContext()):this.experimenter.getFeatureValue(e,t,this.resolveContext(r))}customEvent(e,t,r={}){var n;return i(this,void 0,void 0,function*(){return null==(n=this.resultSender)?void 0:n.sendCustomEvent(e,t,r,this.resolveContext())})}identified(e,t={}){var r;return i(this,void 0,void 0,function*(){return null==(r=this.resultSender)?void 0:r.sendIdentified(e,t,this.resolveContext())})}pageViewed(e={}){var t;return i(this,void 0,void 0,function*(){return null==(t=this.resultSender)?void 0:t.sendPageViewed(this.resolveContext(e))})}clicked(e){var t;return i(this,void 0,void 0,function*(){return null==(t=this.resultSender)?void 0:t.sendClicked(e,this.resolveContext())})}clickEvent(e,t){var r;return i(this,void 0,void 0,function*(){return null==(r=this.resultSender)?void 0:r.sendClickEvent(e,t,this.resolveContext())})}resolveContext(e){return Object.assign(Object.assign(Object.assign({},this.context),this.contextCallback?this.contextCallback():{}),e)}}},799233,(e,t,r)=>{"use strict";
3var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.EventAutoTracker=void 0;let n=e.r(868942),a=e.r(73924),s=i(e.r(523815)),o=i(e.r(220857)),c=e.r(134178);r.EventAutoTracker=class{constructor(e){this.trexContext=e}enableClickAutoTracking(){document.addEventListener("click",this.handleClickAutoTracking.bind(this))}enablePageViewAutoTracking(){return(0,c.safeGuard)(()=>{var e;null==(e=(0,s.default)())||e.setOnPushStateCallback(o.default.PUSH_STATE_PAGE_VIEW,()=>this.trexContext.pageViewed())})}handleClickAutoTracking(e){let t=[],r=e.target;for(;r;){let e=r;r=e.parentElement,this.collectEventData(e,t)}t.length>0&&this.trexContext.clicked(t)}collectEventData(e,t){let r=e.attributes;if(!r)return;let i=r.getNamedItem(n.DATA_AUTO_TRACK_KEY);if(!i)return;let s=i.value;if(0===s.trim().length)return;let o=Array.from(r).filter(e=>e.name.startsWith(n.TRACK_CUSTOM_KEY_PREFIX)&&e.name!==n.TRACK_CUSTOM_KEY_PREFIX).reduce((e,t)=>{let r=t.name.replace(n.TRACK_CUSTOM_KEY_PREFIX,"");return e[(0,a.kebabToCamel)(r)]=t.value,e},{}),c={eventName:s,elementId:e.id,elementClass:e.classList.value,eventData:o};t.push(c)}}},597432,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.BrowserUtil=void 0;let a=e.r(868942),s=e.r(205324),o=e.r(156457),c=n(e.r(638864)),u=n(e.r(639030)),l=e.r(799233),d=n(e.r(810080));r.BrowserUtil=class{static getTrexContext(e={},t=u.default.SUPER_CLASS,r=d.default.TRACER){var n;return i(this,void 0,void 0,function*(){t===u.default.SUPER_CLASS&&(yield null==t?void 0:t.isReady());let i=new s.CookieStore(new o.LocalStorageStore,{allowSubdomain:!0}),l=i.getOrCreate(a.USER_CONTEXT_COOKIE_KEY,()=>({}));if("string"==typeof l)try{l=JSON.parse(l)}catch(e){console.error("Error parsing cookie context",e)}let d=Object.assign(Object.assign({},l),e),h=null!=(n=d.codaCookieId)?n:d["coda-cookie-id"];return i.syncValue(a.USER_CONTEXT_COOKIE_KEY,JSON.stringify({codaCookieId:h,"coda-cookie-id":h,exptToken:d.exptToken})),new c.default(Object.assign(Object.assign({},d),{codaCookieId:h,"coda-cookie-id":h}),t,r)})}static getEventAutoTracker(e){return new l.EventAutoTracker(e)}}},821196,(e,t,r)=>{for(var i,n=256,a=[];n--;)a[n]=(n+256).toString(16).substring(1);r.v4=function(){var e,t=0,r="";if(!i||n+16>256){for(i=Array(t=256);t--;)i[t]=256*Math.random()|0;t=n=0}for(;t<16;t++)e=i[n+t],6==t?r+=a[15&e|64]:8==t?r+=a[63&e|128]:r+=a[e],1&t&&t>1&&t<11&&(r+="-");return n++,r}},955205,(e,t,r)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.ServerUtil=void 0;let a=e.r(821196),s=n(e.r(638864)),o=n(e.r(639030)),c=n(e.r(810080));r.ServerUtil=class{static getTrexContext(e={},t={},r=o.default.SUPER_CLASS,n=c.default.TRACER){var u;return i(this,void 0,void 0,function*(){return yield null==(u=o.default.SUPER_CLASS)?void 0:u.isReady(),!e.codaCookieId&&t.generateCookieIdIfNotExists&&(e.codaCookieId=(0,a.v4)()),new s.default(e,r,n)})}}},146170,(e,t,r)=>{"use strict";var i=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=e.e&&e.e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}
3),a=e.e&&e.e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},s=e.e&&e.e.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}c((i=i.apply(e,t||[])).next())})},o=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let c=e.r(798528),u=o(e.r(905186)),l=o(e.r(96292)),d=o(e.r(253036)),h=o(e.r(134152)),p=e.r(939520),f=o(e.r(790052)),g=a(e.r(220857)),y=e.r(597432),v=e.r(955205),m=e.r(799233);class _{constructor(e,t,r){this.experimentation=e,this.customEventTracer=t,this.tracer=r}getBrowserContext(e={}){return s(this,void 0,void 0,function*(){return y.BrowserUtil.getTrexContext(e,this.experimentation,this.customEventTracer)})}getServerContext(e={},t){return s(this,void 0,void 0,function*(){return v.ServerUtil.getTrexContext(e,t,this.experimentation,this.customEventTracer)})}getEventAutoTracker(e){return new m.EventAutoTracker(e)}toggleAutomaticPageViewEvent(e){return s(this,void 0,void 0,function*(){return this.tracer.toggleAutomaticPageViewEvent(e)})}static init(e){return s(this,void 0,void 0,function*(){let t=g.traceConfigByEnvironment[e.environment],r=yield this.initializeCodaCookieId(),i=yield this.initializeMetadata(e,r),n=yield this.initializeTracer(i,t),a=yield this.initializeExperimentObj(e,n,i),s=new g.default(t,r,i,n);yield s.toggleAutomaticPageViewEvent(!1),yield s.initCodaCookieId(),yield s.initMetadata();let o=e.initTimeoutMs;return(void 0===o||o<0)&&(o=_.DEFAULT_TIMEOUT_MS),{experimentations:new _(a,n,s),isReady:yield a.isReady(o)}})}static initializeExperimentObj(e,t,r){return s(this,void 0,void 0,function*(){let i=new u.default(t,r);return i.init(e),i})}static initializeCodaCookieId(){return s(this,void 0,void 0,function*(){let e=new l.default({valueGenerator:()=>(0,c.v4)(),allowSubdomain:!0});return yield e.getOrCreate(),e})}static initializeMetadata(e,t){return s(this,void 0,void 0,function*(){let r=new d.default(t);return r.setNamespace(e.namespace),r})}static initializeTracer(e,t){let r=new f.default(e,t);if((0,p.safeIsClient)()){let t=new h.default({allowSubdomain:!0},18e5,r);e.setSession(t)}return r}}r.default=_,_.DEFAULT_TIMEOUT_MS=5e3},895762,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.AllowedNamespace=r.ExperimentationV2=void 0,r.ExperimentationV2=i(e.r(146170)).default;let n=e.r(731941);Object.defineProperty(r,"AllowedNamespace",{enumerable:!0,get:function(){return n.AllowedNamespace}})},705186,(e,t,r)=>{r.random=function(e){return crypto.getRandomValues(new Uint8Array(e))}},798528,(e,t,r)=>{let{random:i}=e.r(705186);for(var n,a=[],s=0;s<256;s++)a[s]=(s+256).toString(16).substring(1);r.v4=function(){(!n||s+16>4096)&&(n=i(4096),s=0);for(var e,t=0,r="";t<16;t++)e=n[s+t],6==t?r+=a[15&e|64]:8==t?r+=a[63&e|128]:r+=a[e],1&t&&t>1&&t<11&&(r+="-");return s+=16,r}},7577,(e,t,r)=>{"use strict";var i="u">typeof self?self:"u">typeof window?window:e.g;t.exports=r=i.fetch,i.fetch&&(r.default=i.fetch.bind(i)),r.Headers=i.Headers,r.Request=i.Request,r.Response=i.Response}]);
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.