try{/* @amplitude/experiment-tag v0.29.2 - For license info see https://unpkg.com/@amplitude/experiment-tag@0.29.2/files/LICENSE */ !function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,i=1,n=arguments.length;i0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]{const i=(e=>{const t=[];let i=0;for(let n=0;n>6|192,t[i++]=63&r|128):55296==(64512&r)&&n+1>18|240,t[i++]=r>>12&63|128,t[i++]=r>>6&63|128,t[i++]=63&r|128):(t[i++]=r>>12|224,t[i++]=r>>6&63|128,t[i++]=63&r|128)}return Uint8Array.from(t)})(e),n=i.length,r=n>>2;let s=t;for(let e=0;e>>0},T=(e,t)=>{let i=e,n=t;return i=Math.imul(i,E),i=C(i,15),i=Math.imul(i,k),n^=i,n=C(n,13),n=Math.imul(n,5),n+-430675100|0},P=e=>{let t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16,t},C=(e,t,i=32)=>{t>i&&(t%=i);return(e<>>0)>>>0>>>i-t>>>0)>>>0},A=(e,t=0)=>{const i=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return M(i)},M=e=>(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24,R=(e,t)=>{if(t&&0!==t.length){for(const i of t){if(!i||!e||"object"!=typeof e)return;e=e[i]}return null==e?void 0:e}};class I{constructor(e,t,i,n=void 0){this.major=e,this.minor=t,this.patch=i,this.preRelease=n}static parse(e){if(!e)return;const t=new RegExp("^(\\d+)\\.(\\d+)(\\.(\\d+)(-(([-\\w]+\\.?)*))?)?$").exec(e);if(!t)return;const i=Number(t[1]),n=Number(t[2]);if(isNaN(i)||isNaN(n))return;const r=Number(t[4])||0,s=t[5]||void 0;return new I(i,n,r,s)}compareTo(e){return this.major>e.major?1:this.majore.minor?1:this.minore.patch?1:this.patche.preRelease?1:this.preRelease=t&&s=e&&othis.parseNumber(e),(e,t,i)=>this.comparator(e,t,i));case h:case g:case v:case f:return this.matchesComparable(e,t,i,e=>I.parse(e),(e,t,i)=>this.versionComparator(e,t,i));case _:return this.matchesRegex(e,i);case x:return!this.matchesRegex(e,i);default:return!1}}matchStringsNonSet(e,t,i){return e.some(e=>this.matchString(e,t,i))}matchesIs(e,t){if(this.containsBooleans(t)){const i=e.toLowerCase();if("true"===i||"false"===i)return t.some(e=>e.toLowerCase()===i)}return t.some(t=>e===t)}matchesContains(e,t){for(const i of t)if(e.toLowerCase().includes(i.toLowerCase()))return!0;return!1}matchesComparable(e,t,i,n,r){const s=n(e),o=i.map(e=>n(e)).filter(e=>void 0!==e);return void 0===s||0===o.length?i.some(i=>this.comparator(e,t,i)):o.some(e=>r(s,t,e))}comparator(e,t,i){switch(t){case l:case h:return ei;case d:case f:return e>=i;default:return!1}}versionComparator(e,t,i){const n=e.compareTo(i);switch(t){case l:case h:return n<0;case c:case g:return n<=0;case u:case v:return n>0;case d:case f:return n>=0;default:return!1}}matchesRegex(e,t){return t.some(t=>Boolean(new RegExp(t).exec(e)))}containsNone(e){return e.some(e=>"(none)"===e)}containsBooleans(e){return e.some(e=>{switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})}parseNumber(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0}coerceString(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)}coerceStringArray(e){if(Array.isArray(e)){return e.map(e=>this.coerceString(e)).filter(Boolean)}const t=String(e);if(t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e.map(e=>this.coerceString(e)).filter(Boolean):void 0}catch(e){return}}isSetOperator(e){switch(e){case p:case m:case b:case y:case w:case S:return!0;default:return!1}}setEquals(e,t){const i=new Set(e),n=new Set(t);return i.size===n.size&&[...n].every(e=>i.has(e))}matchesSetContainsAll(e,t){if(e.length{const i=Object.assign({},e),n=[],r=t||Object.keys(i);for(const e of r){const t=D(e,i);t&&n.push(...t)}return n},D=(e,t,i=[])=>{const n=t[e];if(!n)return;if(!n.dependencies||0===n.dependencies.length)return delete t[n.key],[n];i.push(n.key);const r=[];for(const e of n.dependencies){if(i.some(t=>t===e))throw Error(`Detected a cycle between flags ${i.join(", ")}`);const n=D(e,t,i);n&&r.push(...n)}return r.push(n),i.pop(),delete t[n.key],r};function U(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const $="function"==typeof Buffer,L=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),F=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),V=(e=>{let t={};return e.forEach((e,i)=>t[e]=i),t})(F),B=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,K=String.fromCharCode.bind(String),q=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_")),W=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),z=e=>{let t,i,n,r,s="";const o=e.length%3;for(let o=0;o255||(n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255)throw new TypeError("invalid character found");t=i<<16|n<<8|r,s+=F[t>>18&63]+F[t>>12&63]+F[t>>6&63]+F[63&t]}return o?s.slice(0,o-3)+"===".substring(o):s},J="function"==typeof btoa?e=>btoa(e):$?e=>Buffer.from(e,"binary").toString("base64"):z,H=$?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let i=0,n=e.length;i{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?K(192|t>>>6)+K(128|63&t):K(224|t>>>12&15)+K(128|t>>>6&63)+K(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return K(240|t>>>18&7)+K(128|t>>>12&63)+K(128|t>>>6&63)+K(128|63&t)},X=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Q=e=>e.replace(X,G),Z=$?e=>Buffer.from(e,"utf8").toString("base64"):L?e=>H(L.encode(e)):e=>J(Q(e)),Y=(e,t=!1)=>t?q(Z(e)):Z(e),ee=e=>Y(e,!0),te=e=>{if(e=e.replace(/\s+/g,""),!B.test(e))throw new TypeError("malformed base64.");let t,i,n;e+="==".slice(2-(3&e.length));let r=[];for(let s=0;s>16&255)):64===n?r.push(K(t>>16&255,t>>8&255)):r.push(K(t>>16&255,t>>8&255,255&t));return r.join("")},ie=ee;class ne extends Error{constructor(e,t){super(t),this.statusCode=e,Object.setPrototypeOf(this,ne.prototype)}}class re extends Error{constructor(e){super(e),Object.setPrototypeOf(this,re.prototype)}}class se{constructor(e,t,i){this.deploymentKey=e,this.serverUrl=t,this.httpClient=i}getVariants(e,t){return U(this,void 0,void 0,function*(){const i=ie(JSON.stringify(e)),n={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-User":i};(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=ie(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(n["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption);const r=new URL(`${this.serverUrl}/sdk/v2/vardata?v=0`);(null==t?void 0:t.evaluationMode)&&r.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&r.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod);const s=yield this.httpClient.request({requestUrl:r.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.timeoutMillis});if(200!=s.status)throw new ne(s.status,`Fetch error response: status=${s.status}`);return JSON.parse(s.body)})}}class oe{constructor(e,t,i){this.deploymentKey=e,this.serverUrl=t,this.httpClient=i}getFlags(e){return U(this,void 0,void 0,function*(){const t={Authorization:`Api-Key ${this.deploymentKey}`};(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]=`${e.libraryName}/${e.libraryVersion}`),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=ie(JSON.stringify(e.user)));const i=yield this.httpClient.request({requestUrl:`${this.serverUrl}/sdk/v2/flags`+((null==e?void 0:e.deliveryMethod)?`?delivery_method=${e.deliveryMethod}`:""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis});if(200!=i.status)throw Error(`Flags error response: status=${i.status}`);return JSON.parse(i.body).reduce((e,t)=>(e[t.key]=t,e),{})})}}const ae=()=>"undefined"!=typeof globalThis&&null!==globalThis?globalThis:"undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:"undefined"!=typeof global&&null!==global?global:void 0,le=()=>{const e=ae();if(e)try{const t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1},ce=()=>{var e;return null===(e=ae())||void 0===e?void 0:e.localStorage},ue=()=>{var e;return null===(e=ae())||void 0===e?void 0:e.sessionStorage},de=()=>{const e=ae();return(null==e?void 0:e.fetch)?e.fetch.bind(e):void 0},he=()=>{const e=ae();return(null==e?void 0:e.setTimeout)?e.setTimeout.bind(e):void 0},ge=()=>{const e=ae();return(null==e?void 0:e.setInterval)?e.setInterval.bind(e):void 0},ve=()=>{const e=ae();return(null==e?void 0:e.clearInterval)?e.clearInterval.bind(e):void 0};class fe{constructor(e,t){this.poller=void 0,this.action=e,this.ms=t}start(){if(this.poller)return;const e=ge();e&&(this.poller=e(()=>{this.action()},this.ms),this.action())}stop(){if(!this.poller)return;const e=ve();e&&e(this.poller),this.poller=void 0}}var pe="AMP",me="dclid",be="fbclid",ye="gbraid",we="gclid",Se="ko_click_id",_e="li_fat_id",xe="msclkid",Ee="rdt_cid",ke="ttclid",Oe="twclid",Te="wbraid",Pe={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},Ce="MKTG";class Ae{getApplicationContext(){return{versionName:this.versionName,language:Me(),platform:"Web",os:void 0,deviceModel:void 0}}}const Me=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class Re{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Ie=(e,t)=>{const i=["string","number","boolean","undefined"],n=typeof e;if(n!==typeof t)return!1;for(const r of i)if(r===n)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const r=Array.isArray(e),s=Array.isArray(t);if(r!==s)return!1;if(!r||!s){const i=Object.keys(e).sort(),n=Object.keys(t).sort();if(!Ie(i,n))return!1;let r=!0;return Object.keys(e).forEach(i=>{Ie(e[i],t[i])||(r=!1)}),r}for(let i=0;i{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class De{constructor(){this.identityStore=new je,this.eventBridge=new Re,this.applicationContextProvider=new Ae}static getInstance(e){return Ne.analyticsConnectorInstances||(Ne.analyticsConnectorInstances={}),Ne.analyticsConnectorInstances[e]||(Ne.analyticsConnectorInstances[e]=new De),Ne.analyticsConnectorInstances[e]}}var Ue=function(){var e,t,i=(t="ampIntegrationContext","undefined"!=typeof globalThis&&void 0!==globalThis[t]?globalThis[t]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0);return(null===(e=null==i?void 0:i.location)||void 0===e?void 0:e.search)?i.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var i=t.split("=",2),n=$e(i[0]),r=$e(i[1]);return r?(e[n]=r,e):e},{}):{}},$e=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Le=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},Fe=function(){function e(){}return e.prototype.parse=function(){return i(this,void 0,void 0,function(){return n(this,function(e){return[2,t(t(t(t({},Pe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Ue();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,i={referrer:void 0,referring_domain:void 0};try{i.referrer=document.referrer||void 0,i.referring_domain=null!==(t=null===(e=i.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return i},e.prototype.getClickIds=function(){var e,t=Ue();return(e={})[me]=t[me],e[be]=t[be],e[ye]=t[ye],e[we]=t[we],e[Se]=t[Se],e[_e]=t[_e],e[xe]=t[xe],e[Ee]=t[Ee],e[ke]=t[ke],e[Oe]=t[Oe],e[Te]=t[Te],e},e}(),Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};const Be=(e,t,i,n)=>{const r=n(e,t);if(!r)return i;try{const e=JSON.parse(i),n=JSON.parse(r);if(t.endsWith("_DEFAULT_USER_PROVIDER"))return JSON.stringify(Object.assign(Object.assign({},e),void 0!==n.first_seen?{first_seen:n.first_seen}:{}));if(/^EXP_[^_]+$/.test(t))return JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign({},e),void 0!==n.web_exp_id?{web_exp_id:n.web_exp_id}:{}),void 0!==n.web_exp_id_v2?{web_exp_id_v2:n.web_exp_id_v2}:{}),void 0!==n.device_id?{device_id:n.device_id}:{}))}catch(e){return i}return i},Ke=(e,t)=>{if(!e)return t;try{const i=JSON.parse(e),n=JSON.parse(t);return JSON.stringify(Object.assign(Object.assign(Object.assign({},n),void 0!==i.web_exp_id_v2?{web_exp_id_v2:i.web_exp_id_v2}:{}),void 0!==i.first_seen?{first_seen:i.first_seen}:{}))}catch(e){return t}};class qe{constructor(e="pending"){this.explicitlySet=!1,this.listeners=new Set,this.currentStatus=e}getStatus(){return this.currentStatus}hasExplicitStatus(){return this.explicitlySet}setStatus(e){return this.explicitlySet=!0,this.applyTransition(e)}seedFromConfig(e){return!this.explicitlySet&&this.applyTransition(e)}onChange(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}applyTransition(e){if(e===this.currentStatus)return!1;if("pending"===e)return console.warn(`Ignoring consent transition ${this.currentStatus} -> pending: 'pending' is only valid as an initial state`),!1;const t=this.currentStatus;this.currentStatus=e;for(const i of[...this.listeners])try{i(e,t)}catch(e){console.error("Consent status listener failed:",e)}return!0}}const We=e=>"granted"===e||"pending"===e||"denied"===e?e:null,ze={manager:new qe,required:!1,deferredStart:null,started:!1,cleanupArmedManager:null,reset(){this.manager=new qe,this.required=!1,this.deferredStart=null,this.started=!1,this.cleanupArmedManager=null}},Je=e=>{const t=ze.manager.onChange(i=>{t(),e("granted"===i)})},He=()=>ze.required&&"pending"===ze.manager.getStatus(),Ge=()=>ze.required&&"granted"!==ze.manager.getStatus(),Xe=e=>JSON.parse(JSON.stringify(e));class Qe{constructor(e){this.delegate=e,this.buffered=new Map,this.flush=null,this.flushArmed=!1,this.resolvedDelegate=null}getDelegate(){var e;return null!==(e=this.resolvedDelegate)&&void 0!==e?e:this.resolvedDelegate=Promise.resolve("function"==typeof this.delegate?this.delegate():this.delegate)}get(e){return i(this,void 0,void 0,function*(){if(Ge()){this.armFlush();const t=this.buffered.get(e);return void 0===t?void 0:Xe(t)}return yield this.flush,(yield this.getDelegate()).get(e)})}set(e,t){return i(this,void 0,void 0,function*(){if(!Ge())return yield this.flush,(yield this.getDelegate()).set(e,t);He()&&(this.armFlush(),this.buffered.set(e,Xe(t)))})}remove(e){return i(this,void 0,void 0,function*(){if(!He())return yield this.flush,(yield this.getDelegate()).remove(e);this.buffered.delete(e)})}armFlush(){this.flushArmed||(this.flushArmed=!0,Je(e=>{const t=[...this.buffered];this.buffered.clear(),e&&(this.flush=(()=>i(this,void 0,void 0,function*(){let e;try{e=yield this.getDelegate()}catch(e){return}for(const[i,n]of t){if("granted"!==ze.manager.getStatus())return;try{const t=yield e.get(i),r="string"==typeof n?Ke(t,n):n;yield e.set(i,r)}catch(e){}}}))())}))}}const Ze=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","blogspot.com","cloudfront.net","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","myshopify.com","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","netlify.app","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","workers.dev"],Ye={};function et(e){if("undefined"==typeof document)return!1;const t=`AMP_TLD_TEST_${Date.now()}`;try{document.cookie=`${t}=1; domain=.${e}; path=/; SameSite=Lax`;const i=-1!==document.cookie.indexOf(`${t}=`);return document.cookie=`${t}=; domain=.${e}; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`,i}catch(e){return!1}}function tt(e){if(!e)return[];const t=e.toLowerCase(),i=t.split(".");if(i.length<=1)return[];const n=Ze.some(e=>t.endsWith(`.${e}`))?2:1,r=[];for(let e=i.length-n-1;e>=0;--e)r.push(i.slice(e).join("."));return r}function it(e){if(e in Ye)return Ye[e];if(Ge())return function(e){const t=tt(e);return t.length>0?"."+t[0]:""}(e);for(const t of tt(e))if(et(t))return Ye[e]="."+t;return Ye[e]=""}function nt(e,t,n,r){return i(this,void 0,void 0,function*(){var i;let s={};try{const i=JSON.parse((yield e.get(t))||"{}");i&&"object"==typeof i&&(s=i)}catch(e){}const o={};let a=!1;for(const e of Object.keys(r)){const t=s[e];"string"==typeof t&&t?o[e]=t:(o[e]=null!==(i=n[e])&&void 0!==i?i:r[e](),a=!0)}if(a)try{yield e.set(t,JSON.stringify(o))}catch(e){}return o})}function rt(e){if("undefined"!=typeof document)for(const t of document.cookie?document.cookie.split("; "):[]){const i=t.indexOf("=");if((-1===i?t:t.slice(0,i))!==e)continue;const n=-1===i?"":t.slice(i+1);try{return decodeURIComponent(n)}catch(e){return n}}}function st(e,t,i={}){if("undefined"==typeof document)return!1;const{domain:n,maxAgeSeconds:r}=i;try{return document.cookie=`${e}=${encodeURIComponent(t)}; path=/; SameSite=Lax`+(n?`; domain=${n}`:"")+(void 0!==r?`; max-age=${r}`:"")+("https:"===(null===location||void 0===location?void 0:location.protocol)?"; Secure":""),rt(e)===t}catch(e){return!1}}function ot(e,t){if("undefined"!=typeof document)try{document.cookie=`${e}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`+(t?`; domain=${t}`:"")}catch(e){}}const at=(e={})=>({get:e=>i(void 0,void 0,void 0,function*(){return function(e){try{const t=rt(e);if(void 0===t)return;const i=Le(t);if(void 0===i)return;return JSON.parse(i)}catch(e){return}}(e)}),set:(t,n)=>i(void 0,void 0,void 0,function*(){return function(e,t,i={}){if("undefined"!=typeof document)try{let n=`${e}=${btoa(encodeURIComponent(JSON.stringify(t)))}`;if(i.expirationDays){const e=new Date;e.setTime(e.getTime()+24*i.expirationDays*60*60*1e3),n+=`; expires=${e.toUTCString()}`}n+="; path=/",i.domain&&(n+=`; domain=${i.domain}`),i.secure&&(n+="; Secure"),i.sameSite&&(n+=`; SameSite=${i.sameSite}`),document.cookie=n}catch(e){}}(t,n,Object.assign({sameSite:"Lax",secure:"https:"===location.protocol},e))}),remove:t=>i(void 0,void 0,void 0,function*(){return ot(t,e.domain)})}),lt=(e={})=>new Qe(at(e));class ct{constructor(e,t,i={}){this.key=e,this.getDomain=t,this.options=i,this.consentFlushArmed=!1}read(){if(!Ge()&&!1!==this.usable){const e=rt(this.key),t=void 0!==e?this.parse(e):void 0;if(void 0!==t)return t}return this.memory}write(e){this.memory=e,Ge()?He()&&this.armConsentFlush():this.usable="undefined"!=typeof document&&!1!==this.usable&&st(this.key,JSON.stringify(e),{domain:this.getDomain()||void 0,maxAgeSeconds:this.options.maxAgeSeconds})}clear(){this.memory=void 0,He()||ot(this.key,this.getDomain()||void 0)}armConsentFlush(){this.consentFlushArmed||(this.consentFlushArmed=!0,Je(e=>{e&&void 0!==this.memory&&this.write(this.memory)}))}parse(e){try{const t=JSON.parse(e);return this.options.validate?this.options.validate(t):t}catch(e){return}}}const ut=e=>`EXP_${e.slice(0,10)}_identity`,dt="amp-preview-mode",ht="visual-editor-state",gt=new Set([dt,ht]),vt=["_REDIRECT_MARKER","_REDIRECT_SUPPRESSED"],ft=new Map;let pt=null;const mt=()=>{pt!==ze.manager&&(pt=ze.manager,ft.clear(),Je(e=>{if(e)for(const{storageType:e,key:t,json:i}of ft.values()){if("granted"!==ze.manager.getStatus())break;const n=Be(e,t,i,xt);Et(e,t,n)}ft.clear()}))},bt=(e,t)=>`${e}:${t}`,yt=e=>(e=>Boolean(e)&&(gt.has(e)||vt.some(t=>e.endsWith(t))))(e),wt=e=>Ge()&&!yt(e),St=(e,t)=>{var i,n;if(wt(t))return He()&&mt(),kt(null===(i=ft.get(bt(e,t)))||void 0===i?void 0:i.json);try{const i=null===(n=Tt(e))||void 0===n?void 0:n.getItem(t);return i?JSON.parse(i):null}catch(t){return console.warn(`Failed to get and parse JSON from ${e}:`,t),null}},_t=(e,t,i)=>{let n;try{n=JSON.stringify(i)}catch(t){return void console.warn(`Failed to stringify and set JSON in ${e}:`,t)}wt(t)?He()&&(mt(),ft.set(bt(e,t),{storageType:e,key:t,json:n})):Et(e,t,n)},xt=(e,t)=>{var i,n;try{return null!==(n=null===(i=Tt(e))||void 0===i?void 0:i.getItem(t))&&void 0!==n?n:null}catch(e){return null}},Et=(e,t,i)=>{var n;try{null===(n=Tt(e))||void 0===n||n.setItem(t,i)}catch(t){console.warn(`Failed to set JSON in ${e}:`,t)}},kt=e=>{if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},Ot=(e,t)=>{var i;if(He()&&!yt(t))return mt(),void ft.delete(bt(e,t));try{null===(i=Tt(e))||void 0===i||i.removeItem(t)}catch(t){console.warn(`Failed to remove item from ${e}:`,t)}},Tt=e=>{const t=ae();return t?t[e]:null},Pt=e=>`EXP_${e.slice(0,10)}_erased`,Ct=(e,t="$default_instance")=>{const i=((e,t)=>{const i=e.slice(0,10),n=`amp-exp-${t}-web-${e.slice(-6)}`;return[{feature:"identity",localStorage:[`EXP_${i}`],cookies:[ut(e)]},{feature:"default user provider",localStorage:[`EXP_${i}_DEFAULT_USER_PROVIDER`],sessionStorage:[`EXP_${i}_DEFAULT_USER_PROVIDER`]},{feature:"behavioral targeting",localStorage:[`EXP_${i}_rtbt_events`],cookies:[`EXP_${i}_rtbt_session`]},{feature:"marketing attribution",localStorage:[`EXP_${Ce}_${i}`],cookies:[`AMP_${Ce}_ORIGINAL_${i}`]},{feature:"redirect impressions",sessionStorage:[`EXP_${i}_REDIRECT`,`EXP_${i}_REDIRECT_MARKER`,`EXP_${i}_REDIRECT_SUPPRESSED`],cookies:[`EXP_${i}_REDIRECT`]},{feature:"experiment-browser variant/flag caches",sessionStorage:[n,`${n}-flags`,`${n}-variants-options`]},{feature:"exposure queue and dedupe",localStorage:[`EXP_unsent_${t}`],sessionStorage:[`EXP_sent_v3_${t}`,`EXP_sent_v2_${t}`,`EXP_sent_${t}`]}]})(e,t);return{localStorage:i.flatMap(e=>{var t;return null!==(t=e.localStorage)&&void 0!==t?t:[]}),sessionStorage:i.flatMap(e=>{var t;return null!==(t=e.sessionStorage)&&void 0!==t?t:[]}),cookies:i.flatMap(e=>{var t;return null!==(t=e.cookies)&&void 0!==t?t:[]})}},At=(e,t)=>{var i,n,r;const s=Ct(e,t);for(const e of s.localStorage)Ot("localStorage",e);for(const e of s.sessionStorage)Ot("sessionStorage",e);const o=tt(null!==(r=null===(n=null===(i=ae())||void 0===i?void 0:i.location)||void 0===n?void 0:n.hostname)&&void 0!==r?r:"").map(e=>`.${e}`);for(const e of s.cookies){ot(e);for(const t of o)ot(e,t)}},Mt=(e,t)=>{if(ze.cleanupArmedManager===ze.manager)return;ze.cleanupArmedManager=ze.manager;const i=()=>{At(e,t),(e=>{var t,i,n;const r=null!==(n=null===(i=null===(t=ae())||void 0===t?void 0:t.location)||void 0===i?void 0:i.hostname)&&void 0!==n?n:"";for(const t of tt(r))if(st(Pt(e),"1",{domain:`.${t}`,maxAgeSeconds:31536e3}))return})(e)};"denied"===ze.manager.getStatus()&&i(),ze.manager.onChange(e=>{"denied"===e&&i()})};var Rt,It,jt,Nt=(Rt=function(e,t){!function(i,n){var r="function",s="undefined",o="object",a="string",l="model",c="name",u="type",d="vendor",h="version",g="architecture",v="console",f="mobile",p="tablet",m="smarttv",b="wearable",y="embedded",w="Amazon",S="Apple",_="ASUS",x="BlackBerry",E="Browser",k="Chrome",O="Firefox",T="Google",P="Huawei",C="LG",A="Microsoft",M="Motorola",R="Opera",I="Samsung",j="Sharp",N="Sony",D="Xiaomi",U="Zebra",$="Facebook",L=function(e){for(var t={},i=0;i0?2===l.length?typeof l[1]==r?this[l[0]]=l[1].call(this,u):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=u?u.replace(l[1],l[2]):n:this[l[0]]=u?l[1].call(this,u,l[2]):n:4===l.length&&(this[l[0]]=u?l[3].call(this,u.replace(l[1],l[2])):n):this[l]=u||n;d+=2}},q=function(e,t){for(var i in t)if(typeof t[i]===o&&t[i].length>0){for(var r=0;r350?B(e,350):e,this},this.setUA(r),this};J.VERSION="0.7.33",J.BROWSER=L([c,h,"major"]),J.CPU=L([g]),J.DEVICE=L([l,d,u,v,f,m,p,b,y]),J.ENGINE=J.OS=L([c,h]),e.exports&&(t=e.exports=J),t.UAParser=J;var H=typeof i!==s&&(i.jQuery||i.Zepto);if(H&&!H.ua){var G=new J;H.ua=G.getResult(),H.ua.get=function(){return G.getUA()},H.ua.set=function(e){G.setUA(e);var t=G.getResult();for(var i in t)H.ua[i]=t[i]}}}("object"==typeof window?window:Ve)},Rt(jt={path:It,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&jt.path)}},jt.exports),jt.exports); /* @amplitude/experiment-js-client v1.23.1 - For license info see https://app.unpkg.com/@amplitude/experiment-js-client@1.23.1/files/LICENSE */function Dt(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Ut=(e,t=!1)=>{const i=$t(e,t);let n;const r=(()=>{var e;return null===(e=ae())||void 0===e?void 0:e.document})();if(!r)return;const s=r.cookie.split("; ");for(const e of s){const[t,r]=e.split("=",2);t===i&&(n=decodeURIComponent(r))}if(n)try{if(t){const e=atob(n);return JSON.parse(decodeURIComponent(e))}const e=n.split(".");let i;return e.length>=2&&e[1]&&(i=atob(e[1])),{deviceId:e[0],userId:i}}catch(e){return}},$t=(e,t)=>{if(t){if((null==e?void 0:e.length)<10)return;return`AMP_${e.substring(0,10)}`}if(!((null==e?void 0:e.length)<6))return`amp_${e.substring(0,6)}`};class Lt{constructor(e,t,i){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=i,this.loadPersistedState(),i<=0&&(this.setup=void 0)}setup(e,t){return Dt(this,void 0,void 0,function*(){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(()=>{null==t||t.fetch()}),this.waitForConnectorIdentity(this.timeoutMillis)})}getUser(){const e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}}track(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)}loadPersistedState(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;let e=Ut(this.apiKey,!0);return e?(this.commitIdentityToConnector(e),!0):(e=Ut(this.apiKey,!1),e?(this.commitIdentityToConnector(e),!0):(e=(e=>{const t=$t(e,!0);try{const e=ce();if(!e)return;const i=e.getItem(t);if(!i)return;const n=JSON.parse(i);if("object"!=typeof n)return;return n}catch(e){return}})(this.apiKey),e?(this.commitIdentityToConnector(e),!0):(e=(e=>{const t=$t(e,!0);try{const e=ue();if(!e)return;const i=e.getItem(t);if(!i)return;const n=JSON.parse(i);if("object"!=typeof n)return;return n}catch(e){return}})(this.apiKey),!!e&&(this.commitIdentityToConnector(e),!0))))}commitIdentityToConnector(e){const t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()}waitForConnectorIdentity(e){return Dt(this,void 0,void 0,function*(){const t=this.identityStore.getIdentity();if(!t.userId&&!t.deviceId)return Promise.race([new Promise(e=>{const t=()=>{e(),this.identityStore.removeIdentityListener(t)};this.identityStore.addIdentityListener(t)}),new Promise((t,i)=>{const n=he();n?n(i,e,"Timed out waiting for Amplitude Analytics SDK to initialize."):i("Timed out waiting for Amplitude Analytics SDK to initialize.")})])})}}const Ft=de()||function(e,t){return t=t||{},new Promise(function(i,n){var r=new XMLHttpRequest,s=[],o=[],a={},l=function(){return{ok:2==(r.status/100|0),statusText:r.statusText,status:r.status,url:r.responseURL,text:function(){return Promise.resolve(r.responseText)},json:function(){return Promise.resolve(JSON.parse(r.responseText))},blob:function(){return Promise.resolve(new Blob([r.response]))},clone:l,headers:{keys:function(){return s},entries:function(){return o},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in r.open(t.method||"get",e,!0),r.onload=function(){r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,i){s.push(t=t.toLowerCase()),o.push([t,i]),a[t]=a[t]?a[t]+","+i:i}),i(l())},r.onerror=n,r.withCredentials="include"==t.credentials,t.headers)r.setRequestHeader(c,t.headers[c]);r.send(t.body||null)})};class Vt{constructor(e){this.client=e}request(e){return Dt(this,void 0,void 0,function*(){return yield this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)})}}const Bt={request:(e,t,i,n,r)=>((e,t)=>null==t||t<=0?e:new Promise(function(i,n){const r=he();r&&r(function(){n(new re(`Request timeout after ${t} milliseconds`))},t),e.then(i,n)}))(Dt(void 0,void 0,void 0,function*(){const r=yield Ft(e,{method:t,headers:i,body:n});return{status:r.status,body:yield r.text()}}),r)};var Kt,qt,Wt;!function(e){e[e.Disable=0]="Disable",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose"}(Kt||(Kt={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(qt||(qt={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(Wt||(Wt={}));const zt=e=>!e||e===Wt.FallbackInline||e===Wt.FallbackConfig||e===Wt.SecondaryInitialVariants,Jt={debug:!1,logLevel:Kt.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:qt.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:Bt};var Ht="1.23.1";class Gt{constructor(e,t){var i;this.isReady=new Promise(e=>{this.resolve=e}),this.config=e,this.client=t;const n=null!==(i=e.instanceName)&&void 0!==i?i:Jt.instanceName;this.queue=new Qt(n,512,e.internalPersistenceAllowed),this.cache=new Xt(n,e.internalPersistenceAllowed)}ready(){return this.integration?this.isReady:Promise.resolve()}setIntegration(e){this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()},()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())}getUser(){return this.integration?this.integration.getUser():{}}track(e,t){if(this.cache.shouldTrack(e,t)){const t=this.getExposureEvent(e);this.queue.push(t)}}getExposureEvent(e){var t,i,n;let r={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?r={eventType:null===(i=e.metadata)||void 0===i?void 0:i.exposureEvent,eventProperties:e}:"web"===(null===(n=e.metadata)||void 0===n?void 0:n.deliveryMethod)&&(r={eventType:"$impression",eventProperties:e}),r}}class Xt{constructor(e,t){this.persistenceAllowed=t,this.clearStoredOnReopen=!1,this.hasGatedEntries=!1,this.inMemoryCache={},this.identity={},this.storageKey=`EXP_sent_v3_${e}`}isGated(){return void 0!==this.persistenceAllowed&&!this.persistenceAllowed()}usableStorage(){if(this.isGated())return;void 0===this.isSessionStorageAvailable&&(this.isSessionStorageAvailable=Zt());const e=ue();return this.isSessionStorageAvailable&&e?(this.clearStoredOnReopen&&(this.clearStoredOnReopen=!1,e.removeItem(this.storageKey)),e):void 0}shouldTrack(e,t){var i,n;if("web"===(null===(i=e.metadata)||void 0===i?void 0:i.deliveryMethod))return!0;const r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||this.clearCache(),this.identity=r,this.loadCache();const s=e.flag_key in this.inMemoryCache,o=this.inMemoryCache[e.flag_key],a=null!==(n=e.variant)&&void 0!==n?n:null;let l=!1;return s&&(null!=o?o:null)===a||(l=!0,this.inMemoryCache[e.flag_key]=a,this.isGated()&&(this.hasGatedEntries=!0)),this.storeCache(),l}clearCache(){this.inMemoryCache={},this.hasGatedEntries=!1;const e=this.usableStorage();e?e.removeItem(this.storageKey):this.isGated()&&(this.clearStoredOnReopen=!0)}identityEquals(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId}loadCache(){const e=this.usableStorage();if(e){const t=e.getItem(this.storageKey),i=t?JSON.parse(t):{};this.hasGatedEntries?(this.inMemoryCache=Object.assign(Object.assign({},i),this.inMemoryCache),this.hasGatedEntries=!1):this.inMemoryCache=i}}storeCache(){const e=this.usableStorage();if(e)try{e.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}}}class Qt{constructor(e,t=512,i){this.persistenceAllowed=i,this.inMemoryQueue=[],this.holdsGatedEvents=!1,this.storageKey=`EXP_unsent_${e}`,this.maxQueueSize=t}push(e){this.loadQueue(),this.inMemoryQueue.push(e),this.canPersist()||(this.holdsGatedEvents=!0),this.flush(),this.storeQueue()}setTracker(e){this.tracker=e;const t=ge();t&&(this.poller=t(()=>{this.loadFlushStore()},1e3)),this.loadFlushStore()}flush(){if(!this.tracker)return;if(0===this.inMemoryQueue.length)return;let e=0;for(;ethis.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),e.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue))}}loadFlushStore(){this.loadQueue(),this.flush(),this.storeQueue()}}const Zt=()=>{const e=ae();if(e)try{const t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1};class Yt{constructor(e,t=Kt.Error){this.logger=e,this.logLevel=t}error(e,...t){this.logLevel>=Kt.Error&&this.logger.error(e,...t)}warn(e,...t){this.logLevel>=Kt.Warn&&this.logger.warn(e,...t)}info(e,...t){this.logLevel>=Kt.Info&&this.logger.info(e,...t)}debug(e,...t){this.logLevel>=Kt.Debug&&this.logger.debug(e,...t)}verbose(e,...t){this.logLevel>=Kt.Verbose&&this.logger.verbose(e,...t)}}class ei{error(e,...t){console.error(e,...t)}warn(e,...t){console.warn(e,...t)}info(e,...t){console.info(e,...t)}debug(e,...t){console.debug(e,...t)}verbose(e,...t){console.debug(e,...t)}}class ti{constructor(){this.globalScope=ae()}get(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)}put(e,t){var i;null===(i=this.globalScope)||void 0===i||i.localStorage.setItem(e,t)}delete(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)}}class ii{constructor(e,t){this.namespace=e,this.storage=t}get(){return this.value}put(e){this.value=e}load(){const e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))}store(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))}}class ni{constructor(e,t,i){this.cache={},this.namespace=e,this.storage=t,this.transformer=i}get(e){return this.cache[e]}getAll(){return Object.assign({},this.cache)}put(e,t){this.cache[e]=t}putAll(e){for(const t of Object.keys(e))this.cache[t]=e[t]}remove(e){delete this.cache[e]}clear(){this.cache={}}load(){const e=this.storage.get(this.namespace);let t;try{t=JSON.parse(e)||{}}catch(e){return}const i={};for(const e of Object.keys(t))try{let n;n=this.transformer?this.transformer(t[e]):t[e],n&&(i[e]=n)}catch(e){}this.clear(),this.putAll(i)}store(e=this.cache){this.storage.put(this.namespace,JSON.stringify(e))}}const ri=e=>{if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){const t=e.key,i=e.value,n=e.payload;let r=e.metadata,s=e.expKey;r&&r.experimentKey?s=r.experimentKey:s&&(r=r||{},r.experimentKey=s);const o={};return t?o.key=t:i&&(o.key=i),i&&(o.value=i),r&&(o.metadata=r),n&&(o.payload=n),s&&(o.expKey=s),o}};class si{constructor(){this.globalScope=ae()}get(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)}put(e,t){var i;null===(i=this.globalScope)||void 0===i||i.sessionStorage.setItem(e,t)}delete(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)}}const oi=e=>null==e,ai=e=>!!oi(e)||e&&0===Object.keys(e).length,li=e=>{var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)};class ci{constructor(e,t,i,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=i,this.scalar=n}start(e){return Dt(this,void 0,void 0,function*(){if(this.started)throw Error("Backoff already started");this.started=!0,yield this.backoff(e,0,this.min)})}cancel(){this.done=!0;const e=(()=>{const e=ae();return(null==e?void 0:e.clearTimeout)?e.clearTimeout.bind(e):void 0})();e&&e(this.timeoutHandle)}backoff(e,t,i){return Dt(this,void 0,void 0,function*(){if(this.done)return;const n=he();n&&(this.timeoutHandle=n(()=>{(()=>{Dt(this,void 0,void 0,function*(){try{yield e()}catch(n){const r=t+1;if(r{var t,i;if(!e)return{};const n={user:e},r=ae();(null==r?void 0:r.location)&&(n.page={url:r.location.href});const s={};if(!e.groups)return n;for(const n of Object.keys(e.groups)){const r=e.groups[n];if(r.length>0&&r[0]){const o=r[0],a={group_name:o},l=null===(i=null===(t=e.group_properties)||void 0===t?void 0:t[n])||void 0===i?void 0:i[o];l&&Object.keys(l).length>0&&(a.group_properties=l),s[n]=a}}return Object.keys(s).length>0&&(n.groups=s),delete n.user.groups,delete n.user.group_properties,n},di=e=>null==e?{}:"string"==typeof e?{key:e,value:e}:e,hi=e=>{if(!e)return{};let t;e.metadata&&(t=e.metadata.experimentKey);const i={};return e.key&&(i.key=e.key),e.value&&(i.value=e.value),e.payload&&(i.payload=e.payload),t&&(i.expKey=t),e.metadata&&(i.metadata=e.metadata),i};class gi{constructor(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}track(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))}setUserProperty(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)}unsetUserProperty(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))}}class vi{constructor(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}track(e,t){const i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,i)||(this.tracked={}),this.identity=i;const n=e.flag_key in this.tracked,r=this.tracked[e.flag_key];n&&r===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))}identityEquals(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId}}class fi{constructor(e,t){var i,n,r,s,o;this.engine=new j,this.isRunning=!1,this.apiKey=e,t=(e=>{if(!e||"object"!=typeof e)return{};const t={};for(const[i,n]of Object.entries(e))oi(n)||(t[i]=n);return t})(t),this.config=Object.assign(Object.assign(Object.assign({},Jt),t),{serverUrl:(null==t?void 0:t.serverUrl)||("eu"===(null===(i=null==t?void 0:t.serverZone)||void 0===i?void 0:i.toLowerCase())?"https://api.lab.eu.amplitude.com":Jt.serverUrl),flagsServerUrl:(null==t?void 0:t.flagsServerUrl)||("eu"===(null===(n=null==t?void 0:t.serverZone)||void 0===n?void 0:n.toLowerCase())?"https://flag.lab.eu.amplitude.com":Jt.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<6e4?6e4:null!==(r=t.flagConfigPollingIntervalMillis)&&void 0!==r?r:Jt.flagConfigPollingIntervalMillis}),this.logger=new Yt(this.config.loggerProvider||new ei,fi.getLogLevel(t));const a=null===(s=this.config)||void 0===s?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===a,this.poller=new fe(()=>Dt(this,void 0,void 0,function*(){try{yield this.doFlags()}catch(e){this.logger.info(e)}}),this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(const e in this.config.initialVariants)this.config.initialVariants[e]=ri(this.config.initialVariants[e]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new gi(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new vi(this.config.exposureTrackingProvider)),this.integrationManager=new Gt(this.config,this);const l=new Vt(this.config.httpClient||Bt);let c;this.flagApi=new oe(this.apiKey,this.config.flagsServerUrl,l),this.evaluationApi=new se(this.apiKey,this.config.serverUrl,l);const u=a?`${this.config.instanceName}-${String(a)}`:this.config.instanceName;if(this.isWebExperiment){const e=null===(o=this.config)||void 0===o?void 0:o.internalCacheStorage;c=null!=e?e:new si}else c=new ti;this.variants=((e,t,i)=>{const n=e.substring(e.length-6);return new ni(`amp-exp-${t}-${n}`,i,ri)})(this.apiKey,u,c),this.flags=((e,t,i=new ti)=>{const n=e.substring(e.length-6);return new ni(`amp-exp-${t}-${n}-flags`,i)})(this.apiKey,u,c),this.fetchVariantsOptions=((e,t,i=new ti)=>{const n=e.substring(e.length-6);return new ii(`amp-exp-${t}-${n}-variants-options`,i)})(this.apiKey,u,c);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}start(e){return Dt(this,void 0,void 0,function*(){var t;if(!this.isRunning){this.isRunning=!0,this.setUser(e);try{const i=this.doFlags();null===(t=this.config.fetchOnStart)||void 0===t||t?yield Promise.all([this.fetch(e),i]):yield i}catch(e){if(this.config.throwOnError)throw e}this.config.pollOnStart&&this.poller.start()}})}stop(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)}fetch(){return Dt(this,arguments,void 0,function*(e=this.user,t){this.setUser(e||{});try{yield this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)}catch(e){if(this.config.throwOnError)throw e;e instanceof re?this.logger.debug(e):this.logger.error(e)}return this})}variant(e,t){var i,n;if(!this.apiKey)return{value:void 0};const r=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,r),this.logger.debug(`[Experiment] variant for ${e} is ${(null===(i=r.variant)||void 0===i?void 0:i.key)||(null===(n=r.variant)||void 0===n?void 0:n.value)}`),r.variant||{}}exposure(e){const t=this.variantAndSource(e);this.exposureInternal(e,t)}all(){if(!this.apiKey)return{};const e=this.evaluate();for(const t in e){const i=this.flags.get(t);li(i)||delete e[t]}return Object.assign(Object.assign(Object.assign({},this.secondaryVariants()),this.sourceVariants()),e)}clear(){this.variants.clear();try{this.variants.store()}catch(e){}}getUser(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){const e=Object.assign({},this.user.user_properties);return Object.assign(Object.assign({},this.user),{user_properties:e})}return Object.assign({},this.user)}setUser(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){const t=Object.assign({},e.user_properties);this.user=Object.assign(Object.assign({},e),{user_properties:t})}else this.user=Object.assign({},e);else this.user=null}getUserProvider(){return this.userProvider}setUserProvider(e){return this.userProvider=e,this}mergeInitialFlagsWithStorage(){if(this.config.initialFlags){JSON.parse(this.config.initialFlags).forEach(e=>{this.flags.get(e.key)||this.flags.put(e.key,e)})}}evaluate(e){const t=this.addContext(this.user),i=N(this.flags.getAll(),e),n=ui(t),r=this.engine.evaluate(n,i),s={};for(const e of Object.keys(r))s[e]=hi(r[e]);return s}getEvaluationTraces(e){const t=this.addContext(this.user),i=N(this.flags.getAll(),e),n=ui(t),{traces:r}=this.engine.evaluateWithTraces(n,i);return r}variantAndSource(e,t){let i={};this.config.source===qt.LocalStorage?i=this.localStorageVariantAndSource(e,t):this.config.source===qt.InitialVariants&&(i=this.initialVariantsVariantAndSource(e,t));const n=this.flags.get(e);return(li(n)||!i.variant&&n)&&(i=this.localEvaluationVariantAndSource(e,n,t)),i}localEvaluationVariantAndSource(e,t,i){var n;let r={};const s=this.evaluate([t.key])[e],o=Wt.LocalEvaluation,a=null===(n=null==s?void 0:s.metadata)||void 0===n?void 0:n.default;if(!oi(s)&&!a)return{variant:di(s),source:o,hasDefaultVariant:!1};if(a&&(r={variant:di(s),source:o,hasDefaultVariant:!0}),!oi(i))return{variant:di(i),source:Wt.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};const l=this.config.initialVariants[e];if(!oi(l))return{variant:di(l),source:Wt.SecondaryInitialVariants,hasDefaultVariant:r.hasDefaultVariant};const c=di(this.config.fallbackVariant),u={variant:c,source:Wt.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return ai(c)?r:u}localStorageVariantAndSource(e,t){var i;let n={};const r=this.variants.get(e),s=null===(i=null==r?void 0:r.metadata)||void 0===i?void 0:i.default;if(!oi(r)&&!s)return{variant:di(r),source:Wt.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:di(r),source:Wt.LocalStorage,hasDefaultVariant:!0}),!oi(t))return{variant:di(t),source:Wt.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};const o=this.config.initialVariants[e];if(!oi(o))return{variant:di(o),source:Wt.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};const a=di(this.config.fallbackVariant),l={variant:a,source:Wt.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ai(a)?n:l}initialVariantsVariantAndSource(e,t){var i;let n={};const r=this.config.initialVariants[e];if(!oi(r))return{variant:di(r),source:Wt.InitialVariants,hasDefaultVariant:!1};const s=this.variants.get(e),o=null===(i=null==s?void 0:s.metadata)||void 0===i?void 0:i.default;if(!oi(s)&&!o)return{variant:di(s),source:Wt.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:di(s),source:Wt.LocalStorage,hasDefaultVariant:!0}),!oi(t))return{variant:di(t),source:Wt.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};const a=di(this.config.fallbackVariant),l={variant:a,source:Wt.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ai(a)?n:l}fetchInternal(e,t,i,n){return Dt(this,void 0,void 0,function*(){var r;if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug(`[Experiment] Fetch all: retry=${String(i)}`),i&&this.stopRetries();try{const i=yield this.doFetch(e,t,Object.assign({trackingOption:null===(r=this.fetchVariantsOptions.get())||void 0===r?void 0:r.trackingOption},n));return yield this.storeVariants(i,n),i}catch(t){throw i&&this.shouldRetryFetch(t)&&this.startRetries(e,n),t}})}setTracksAssignment(e){return Dt(this,void 0,void 0,function*(){this.fetchVariantsOptions.put(Object.assign(Object.assign({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store()})}cleanUserPropsForFetch(e){const t=Object.assign({},e);return delete t.cookie,t}doFetch(e,t,i){return Dt(this,void 0,void 0,function*(){e=yield this.addContextOrWait(e),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e);const n=yield this.evaluationApi.getVariants(e,Object.assign({timeoutMillis:t},i)),r={};for(const e of Object.keys(n))r[e]=hi(n[e]);return this.logger.debug("[Experiment] Received variants: ",r),r})}doFlags(){return Dt(this,void 0,void 0,function*(){try{let e;this.isWebExperiment&&(e=yield this.addContextOrWait(this.getUser()));const t=yield this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Ht,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0});this.flags.clear(),this.flags.putAll(t)}catch(e){if(!(e instanceof re))throw e;if(this.logger.debug(e),this.config.throwOnError)throw e}try{this.flags.store()}catch(e){}this.mergeInitialFlagsWithStorage()})}storeVariants(e,t){return Dt(this,void 0,void 0,function*(){let i=t&&t.flagKeys?t.flagKeys:[];0===i.length&&this.variants.clear();for(const t in e)i=i.filter(e=>e!==t),this.variants.put(t,e[t]);for(const e of i)this.variants.remove(e);try{this.variants.store()}catch(e){}this.logger.debug("[Experiment] Stored variants: ",e)})}startRetries(e,t){return Dt(this,void 0,void 0,function*(){this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new ci(8,500,1e4,1.5),this.retriesBackoff.start(()=>Dt(this,void 0,void 0,function*(){yield this.fetchInternal(e,1e4,!1,t)}))})}stopRetries(){this.retriesBackoff&&this.retriesBackoff.cancel()}addContext(e){var t;const i=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),n=this.integrationManager.getUser(),r=Object.assign(Object.assign(Object.assign({},null==i?void 0:i.user_properties),n.user_properties),null==e?void 0:e.user_properties);return Object.assign(Object.assign(Object.assign(Object.assign({library:`experiment-js-client/${Ht}`},i),n),e),{user_properties:r})}addContextOrWait(e){return Dt(this,void 0,void 0,function*(){return yield this.integrationManager.ready(),this.addContext(e)})}sourceVariants(){return this.config.source==qt.LocalStorage?this.variants.getAll():this.config.source==qt.InitialVariants?this.config.initialVariants:void 0}secondaryVariants(){return this.config.source==qt.LocalStorage?this.config.initialVariants:this.config.source==qt.InitialVariants?this.variants.getAll():void 0}exposureInternal(e,t){var i,n,r,s,o,a,l,c,u;if(!(null===(r=null===(n=null===(i=t.variant)||void 0===i?void 0:i.metadata)||void 0===n?void 0:n.trackExposure)||void 0===r||r))return;this.legacyExposureInternal(e,t.variant,t.source);const d={flag_key:e},h=zt(t.source);if(h&&!t.hasDefaultVariant)return;(null===(s=t.variant)||void 0===s?void 0:s.expKey)&&(d.experiment_key=null===(o=t.variant)||void 0===o?void 0:o.expKey);const g=null===(a=t.variant)||void 0===a?void 0:a.metadata;if(h||(null==g?void 0:g.default)||((null===(l=t.variant)||void 0===l?void 0:l.key)?d.variant=t.variant.key:(null===(c=t.variant)||void 0===c?void 0:c.value)&&(d.variant=t.variant.value)),g&&(d.metadata=g),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){const e=ae();if(null==e?void 0:e.location)try{const t=e.location.href;d.metadata.url=t.split("?")[0]||""}catch(e){}}const v=this.addContext(this.getUser());null===(u=this.userSessionExposureTracker)||void 0===u||u.track(d,v),this.integrationManager.track(d,v)}legacyExposureInternal(e,t,i){var n,r,s,o,a;if(this.analyticsProvider){const l=((e,t,i,n)=>{const r=null==i?void 0:i.value,s=`[Experiment] ${t}`;return{name:"[Experiment] Exposure",user:e,key:t,variant:i,userProperty:s,properties:{key:t,variant:r,source:n},userProperties:{[s]:r}}})(this.addContext(this.getUser()),e,t,i);zt(i)||!(null==t?void 0:t.value)?null===(r=null===(n=this.analyticsProvider)||void 0===n?void 0:n.unsetUserProperty)||void 0===r||r.call(n,l):(null==t?void 0:t.value)&&(null===(o=null===(s=this.analyticsProvider)||void 0===s?void 0:s.setUserProperty)||void 0===o||o.call(s,l),null===(a=this.analyticsProvider)||void 0===a||a.track(l))}}static getLogLevel(e){var t;return!0===e.debug?Kt.Debug:null!==(t=e.logLevel)&&void 0!==t?t:Kt.Error}shouldRetryFetch(e){return!(e instanceof ne)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)}addPlugin(e){"integration"===e.type&&this.integrationManager.setIntegration(e)}}class pi{constructor(e,t,i){var n,r,s;this.globalScope=ae(),this.userAgent=void 0!==(null===(n=this.globalScope)||void 0===n?void 0:n.navigator)?null===(r=this.globalScope)||void 0===r?void 0:r.navigator.userAgent:void 0,this.ua=new Nt.UAParser(this.userAgent).getResult(),this.localStorage=new ti,this.sessionStorage=new si,this.userProvider=e,this.apiKey=t,this.persistenceAllowed=i,this.storageKey=`EXP_${null===(s=this.apiKey)||void 0===s?void 0:s.slice(0,10)}_DEFAULT_USER_PROVIDER`}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}getUser(){var e,t,i,n,r;const s=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Object.assign({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(i=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==i?i:"desktop",referring_url:null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.document)||void 0===r?void 0:r.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},s)}getLanguage(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""}getOs(e){var t,i;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(i=e.browser)||void 0===i?void 0:i.major].filter(e=>null!=e).join(" ")}getDeviceModel(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name}getBrowser(e){var t;let i=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==i?void 0:i.includes("Chrom"))&&(i="Chrome"),(null==i?void 0:i.includes("Firefox"))&&(i="Firefox"),(null==i?void 0:i.includes("Safari"))&&(i="Safari"),(null==i?void 0:i.includes("Edge"))&&(i="Edge"),(null==i?void 0:i.includes("Opera"))&&(i="Opera"),i}getCookie(){var e,t,i,n,r;if(this.canPersist()&&(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie))return Object.fromEntries(null===(r=null===(n=null===(i=this.globalScope)||void 0===i?void 0:i.document)||void 0===n?void 0:n.cookie)||void 0===r?void 0:r.split("; ").map(e=>e.split("=")))}getLandingUrl(){var e,t;if(!this.canPersist())return null!==(e=this.gatedLandingUrl)&&void 0!==e||(this.gatedLandingUrl=this.getCurrentUrl()),this.gatedLandingUrl;try{const e=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return e.landing_url||(e.landing_url=null!==(t=this.gatedLandingUrl)&&void 0!==t?t:this.getCurrentUrl(),this.sessionStorage.put(this.storageKey,JSON.stringify(e))),e.landing_url}catch(e){return}}getCurrentUrl(){var e,t;return null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,"")}getFirstSeen(){if(!this.canPersist())return(Date.now()/1e3).toString();try{const e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}}getUrlParam(){var e;if(!this.globalScope)return;const t={};try{const i=new URL(this.globalScope.location.href);for(const[n,r]of i.searchParams)t[n]=[...null!==(e=t[n])&&void 0!==e?e:[],...r.split(",")]}catch(e){return}return Object.entries(t).reduce((e,[t,i])=>(e[t]=1==i.length?i[0]:i,e),{})}}var mi;const bi=ae();bi&&(bi.experimentInstances={});const yi=null!==(mi=null==bi?void 0:bi.experimentInstances)&&void 0!==mi?mi:{},wi=e=>(null==e?void 0:e.instanceName)||Jt.instanceName,Si=(e,t,i)=>{const n=((e,t)=>{const i=wi(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?`${i}.${e}.${String(n)}`:`${i}.${e}`})(e,t);let r=yi[n];return r||(r=((e,t)=>new fi(e,Object.assign(Object.assign({},t),{userProvider:new pi(null==t?void 0:t.userProvider,e,null==t?void 0:t.internalPersistenceAllowed)})))(e,t),i&&r.addPlugin(i()),yi[n]=r,r)},_i={initialize:(e,t)=>Si(e,t),initializeWithAmplitudeAnalytics:(e,t)=>Si(e,t,()=>new Lt(e,De.getInstance(wi(t)),1e4))};class xi{constructor(){this.store=new Map}get(e){return this.store.get(e)}put(e,t){this.store.set(e,t)}delete(e){this.store.delete(e)}}var Ei;var ki="undefined"==typeof document?void 0:document,Oi=!!ki&&"content"in ki.createElement("template"),Ti=!!ki&&ki.createRange&&"createContextualFragment"in ki.createRange();function Pi(e){return e=e.trim(),Oi?function(e){var t=ki.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(e):Ti?function(e){return Ei||(Ei=ki.createRange()).selectNode(ki.body),Ei.createContextualFragment(e).childNodes[0]}(e):function(e){var t=ki.createElement("body");return t.innerHTML=e,t.childNodes[0]}(e)}function Ci(e,t){var i,n,r=e.nodeName,s=t.nodeName;return r===s||(i=r.charCodeAt(0),n=s.charCodeAt(0),i<=90&&n>=97?r===s.toUpperCase():n<=90&&i>=97&&s===r.toUpperCase())}function Ai(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var Mi={OPTION:function(e,t){var i=e.parentNode;if(i){var n=i.nodeName.toUpperCase();"OPTGROUP"===n&&(n=(i=i.parentNode)&&i.nodeName.toUpperCase()),"SELECT"!==n||i.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}Ai(e,t,"selected")},INPUT:function(e,t){Ai(e,t,"checked"),Ai(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var n=e.firstChild;if(n){var r=n.nodeValue;if(r==i||!i&&r==e.placeholder)return;n.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i,n,r=-1,s=0,o=e.firstChild;o;)if("OPTGROUP"===(n=o.nodeName&&o.nodeName.toUpperCase()))(o=(i=o).firstChild)||(o=i.nextSibling,i=null);else{if("OPTION"===n){if(o.hasAttribute("selected")){r=s;break}s++}!(o=o.nextSibling)&&i&&(o=i.nextSibling,i=null)}e.selectedIndex=r}}};function Ri(){}function Ii(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var ji=function(e){return function(t,i,n){if(n||(n={}),"string"==typeof i)if("#document"===t.nodeName||"HTML"===t.nodeName){var r=i;(i=ki.createElement("html")).innerHTML=r}else if("BODY"===t.nodeName){var s=i;(i=ki.createElement("html")).innerHTML=s;var o=i.querySelector("body");o&&(i=o)}else i=Pi(i);else 11===i.nodeType&&(i=i.firstElementChild);var a=n.getNodeKey||Ii,l=n.onBeforeNodeAdded||Ri,c=n.onNodeAdded||Ri,u=n.onBeforeElUpdated||Ri,d=n.onElUpdated||Ri,h=n.onBeforeNodeDiscarded||Ri,g=n.onNodeDiscarded||Ri,v=n.onBeforeElChildrenUpdated||Ri,f=n.skipFromChildren||Ri,p=n.addChild||function(e,t){return e.appendChild(t)},m=!0===n.childrenOnly,b=Object.create(null),y=[];function w(e){y.push(e)}function S(e,t){if(1===e.nodeType)for(var i=e.firstChild;i;){var n=void 0;t&&(n=a(i))?w(n):(g(i),i.firstChild&&S(i,t)),i=i.nextSibling}}function _(e,t,i){!1!==h(e)&&(t&&t.removeChild(e),g(e),S(e,i))}function x(e){if(1===e.nodeType||11===e.nodeType)for(var t=e.firstChild;t;){var i=a(t);i&&(b[i]=t),x(t),t=t.nextSibling}}function E(e){c(e);for(var t=e.firstChild;t;){var i=t.nextSibling,n=a(t);if(n){var r=b[n];r&&Ci(t,r)?(t.parentNode.replaceChild(r,t),k(r,t)):E(t)}else E(t);t=i}}function k(t,i,n){var r=a(i);if(r&&delete b[r],!n){var s=u(t,i);if(!1===s)return;if(s instanceof HTMLElement&&x(t=s),e(t,i),d(t),!1===v(t,i))return}"TEXTAREA"!==t.nodeName?function(e,t){var i,n,r,s,o,c=f(e,t),u=t.firstChild,d=e.firstChild;e:for(;u;){for(s=u.nextSibling,i=a(u);!c&&d;){if(r=d.nextSibling,u.isSameNode&&u.isSameNode(d)){u=s,d=r;continue e}n=a(d);var h=d.nodeType,g=void 0;if(h===u.nodeType&&(1===h?(i?i!==n&&((o=b[i])?r===o?g=!1:(e.insertBefore(o,d),n?w(n):_(d,e,!0),n=a(d=o)):g=!1):n&&(g=!1),(g=!1!==g&&Ci(d,u))&&k(d,u)):3!==h&&8!=h||(g=!0,d.nodeValue!==u.nodeValue&&(d.nodeValue=u.nodeValue))),g){u=s,d=r;continue e}n?w(n):_(d,e,!0),d=r}if(i&&(o=b[i])&&Ci(o,u))c||p(e,o),k(o,u);else{var v=l(u);!1!==v&&(v&&(u=v),u.actualize&&(u=u.actualize(e.ownerDocument||ki)),p(e,u),E(u))}u=s,d=r}!function(e,t,i){for(;t;){var n=t.nextSibling;(i=a(t))?w(i):_(t,e,!0),t=n}}(e,d,n);var m=Mi[e.nodeName];m&&m(e,t)}(t,i):Mi.TEXTAREA(t,i)}x(t);var O,T,P=t,C=P.nodeType,A=i.nodeType;if(!m)if(1===C)1===A?Ci(t,i)||(g(t),P=function(e,t){for(var i=e.firstChild;i;){var n=i.nextSibling;t.appendChild(i),i=n}return t}(t,(O=i.nodeName,(T=i.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==T?ki.createElementNS(T,O):ki.createElement(O)))):P=i;else if(3===C||8===C){if(A===C)return P.nodeValue!==i.nodeValue&&(P.nodeValue=i.nodeValue),P;P=i}if(P===i)g(t);else{if(i.isSameNode&&i.isSameNode(P))return;if(k(P,i,m),y)for(var M=0,R=y.length;M=0;a--)n=(i=o[a]).name,r=i.namespaceURI,s=i.value,r?(n=i.localName||n,e.getAttributeNS(r,n)!==s&&("xmlns"===i.prefix&&(n=i.name),e.setAttributeNS(r,n,s))):e.getAttribute(n)!==s&&e.setAttribute(n,s);for(var l=e.attributes,c=l.length-1;c>=0;c--)n=(i=l[c]).name,(r=i.namespaceURI)?(n=i.localName||n,t.hasAttributeNS(r,n)||e.removeAttributeNS(r,n)):t.hasAttribute(n)||e.removeAttribute(n)}});function Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ui(){return Ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?Array.from(qi).join(","):"",l=0;l0?Array.from(qi).join(","):"";t&&(e.nodeType===Node.ELEMENT_NODE?c(e,t):e===document&&c(document.documentElement,t))}}}function Qi(e){return"html"===e?{childList:!0,subtree:!0,characterData:!0,characterDataOldValue:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}function Zi(e){var t=Vi.get(e);return t||(t={element:e,attributes:{}},Vi.set(e,t)),t}function Yi(e,t){return e.parentNode===t.parentNode&&e.insertBeforeNode===t.insertBeforeNode}function en(e,t){Ki.add(e),e.__params=t,Wi||e.observe.apply(e,e.__params)}function tn(e,t,i,n,r){var s,o=i(e),a=function(e,t){Ln(),r(e,t),Fn()},l={isDirty:!1,originalValue:o,virtualValue:o,mutations:[],el:e,rateLimitCount:0,observer:new MutationObserver(function(n){if(!(l.rateLimitCount>=10))if(l.rateLimitCount++,setTimeout(function(){l.rateLimitCount-=1,l.rateLimitCount<=0&&(l.rateLimitCount=0)},1e3),"html"!==t){var r=i(e);if("position"===t||"insert"===t){if(Yi(r,l.virtualValue))return;var s=l.mutations.at(-1);if(!s)return;if(In(l.virtualValue.parentNode,s))return}r!==l.virtualValue&&("position"!==t&&"insert"!==t&&(l.originalValue=r),a(l))}else{var o=l.modifiedNodes;Ln();for(var c=function(){var e=n[u],t=e.target,i=e.type,r=e.oldValue;if("childList"===i)return null!=o&&o.has(t)?(e.removedNodes.forEach(function(i){t.insertBefore(i,e.nextSibling)}),e.addedNodes.forEach(function(e){e.remove()}),0):0;if("characterData"===i){var s=t.parentNode;return null!==s&&null!=o&&o.has(s)?(t.nodeValue=r,0):0}},u=n.length-1;u>=0;u--)c();Fn()}}),mutationRunner:a,setValue:n,getCurrentValue:i};return"html"===t&&(l.originalValue=e.cloneNode(!0),l.discardStacks=[]),s="position"===t||"insert"===t?[new DocumentFragment,{childList:!0,subtree:!0,attributes:!1,characterData:!1}]:[e,Qi(t)],en(l.observer,s),l}function nn(e,t){var i=t.getCurrentValue(t.el);t.virtualValue=e,!e||"string"==typeof e||"string"==typeof i||i instanceof Element||e instanceof Element?e!==i&&(t.isDirty=!0,An()):i&&Yi(i,e)||(t.isDirty=!0,An())}var rn=new DOMParser;function sn(e,t){if(t){var i=t.originalClones.get(e.el);if(!i)return;nn(i,e)}else{var n=e.originalValue.cloneNode(!0),r=n.innerHTML,s=r;if(e.mutations.forEach(function(e){s=e.mutate(s)}),s!==r){var o=rn.parseFromString(""+s+"","text/html").body.childNodes;n.innerHTML="",n.append.apply(n,Array.from(o))}nn(n,e)}}function on(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),nn(Array.from(t).filter(Boolean).join(" "),e)}function an(e){var t=e.originalValue;e.mutations.forEach(function(e){t=e.mutate(t)}),nn(t,e)}function ln(e,t){var i;switch(t){case"prepend":i={parentNode:e,insertBeforeNode:e.firstChild};break;case"append":i={parentNode:e,insertBeforeNode:null};break;case"before":i={parentNode:e.parentNode,insertBeforeNode:e};break;case"after":i={parentNode:e.parentNode,insertBeforeNode:e.nextSibling}}return Ui({},i,{insertNode:e,direction:t})}function cn(e,t){if("insertSelector"in e){var i=e.insertSelector,n=e.direction,r=t.querySelector(i);return r?ln(r,n):null}var s=e.parentSelector,o=e.insertBeforeSelector,a=t.querySelector(s);if(!a)return null;var l=o?t.querySelector(o):null;return o&&!l?null:{parentNode:a,insertBeforeNode:l}}function un(e){for(var t=e.originalValue,i=e.mutations.length-1;i>=0;i--){var n,r=e.mutations[i];if(!r.newPosition||!r.newPosition.parentNode.isConnected||!1===(null==(n=r.newPosition.insertBeforeNode)?void 0:n.isConnected)){var s=Ji(r.shadowHosts);r.newPosition=s?cn(r.mutate(),s):null}if(r.newPosition){t=r.newPosition;break}}nn(t,e)}function dn(e){for(var t=e.originalValue,i=function(){var i=e.mutations[n];if(0===i.newPositions.size){var r=i.mutate();Hi({shadowHosts:i.shadowHosts,selector:r.insertSelector}).elements.forEach(function(t){var n=ln(t,r.direction),s=e.el.cloneNode(!0);i.newPositions.set(s,n),document.createDocumentFragment().appendChild(s),i.elements.add(s),Mn(i,s)})}var s=i.newPositions.get(e.el);if(s)return t=s,1},n=e.mutations.length-1;n>=0&&!i();n--);nn(t,e)}function hn(e,t){var i=t.get(e);if(void 0!==i)return i;if(e.id)return e.id;for(var n=e.parentElement,r=hn(n,t),s=new Map,o=n.firstElementChild;o;){var a=s.get(o.tagName)||0;s.set(o.tagName,a+1),o.id||t.set(o,r+" "+o.tagName+":"+a),o=o.nextElementSibling}return t.get(e)||""}var gn=function(e){return e},vn=function(e,t,i){var n,r,s,o,a,l,c=(null!=(n=null==(r=i.discardStacks)?void 0:r.length)?n:0)>(null!=(s=i.mutations.length)?s:0);c?o=(null==(a=i.discardStacks)?void 0:a.pop())||new Map:(o=new Map,null==(l=i.discardStacks)||l.push(o));i.modifiedNodes=new WeakSet([e]);var u=new WeakMap([[e,""],[t,""]]);!function(e,t){var i=e.querySelector("svg");if(i)for(var n=i.getAttributeNode("xmlns"),r=null==n?void 0:n.namespaceURI,s=t.querySelectorAll("svg"),o=0;oi)return!0;n=n.parentElement}return!1}function jn(e){"position"!==e.kind&&"insert"!==e.kind||function(e){"position"===e.kind&&e.newPosition||"insert"===e.kind&&e.newPositions.size>0||e.elements.forEach(function(t){"position"===e.kind&&t.isConnected?un(bn(t)):"insert"===e.kind&&dn(Sn(t))})}(e);var t=Array.from(e.elements);if(!t.some(function(e){return e.isConnected&&e.ownerDocument===document})){if(t.length>0){for(var i=t.at(-1);i.parentElement;)i=i.parentElement;if(i.__removedByDomMutator__)return}var n=new Set(e.elements),r="insert"===e.kind?function(e){if(0===e.newPositions.size&&e.elements.size>0)return[];var t=rn.parseFromString(""+e.html()+"","text/html").body.firstElementChild;return e.elements.clear(),e.newPositions.clear(),t?[t]:[]}(e):Gi(e);r.forEach(function(t){n.has(t)||In(t.parentElement,e)||(e.elements.add(t),Mn(e,t))})}}function Nn(e){var t=Bi.indexOf(e);if(-1!==t){for(var i=[],n=Ln(!0),r=function(){var t=Bi[s];"position"!==t.kind&&"insert"!==t.kind||("insert"===t.kind?Array.from(t.newPositions.values()):t.newPosition?[t.newPosition]:[]).forEach(function(i){var n=!("direction"in i)||"before"===i.direction,r=function(e,t,i){var n=e;for(;n instanceof Element&&t.has(n);)n=i?n.nextElementSibling:n.nextSibling;return n}(i.insertBeforeNode,e.elements,n);if(i.insertBeforeNode=r,"insertNode"in i)if("before"===i.direction)null===r?(i.insertNode=i.parentNode,i.direction="append"):i.insertNode=r;else if("after"===i.direction){var s,o=new Set(Array.from(e.elements).concat(Array.from(t.elements))),a=function(e,t){var i=e;for(;i instanceof Element&&t.has(i);)i=i.previousElementSibling;return i}((null==(s=i.insertBeforeNode)?void 0:s.previousElementSibling)||i.parentNode.lastElementChild,o);null===a?(i.direction="prepend",i.insertNode=i.parentNode):i.insertNode=a}});i.push(t),Nn(t)},s=Bi.length-1;s>t;s--)r();e.elements.forEach(function(t){return Rn(e,t)}),Bi.splice(t,1),n();for(var o=function(){var e=i.pop();if(!e)return 1;!function(e){Bi.push(e)}(e),("insert"===e.kind?Array.from(e.newPositions.keys()):e.elements).forEach(function(t){return Mn(e,t)})};i.length>0;)o()}}function Dn(){Bi.forEach(jn)}function Un(e){for(var t=0;t0})&&Vn.enableShadowAwareness(),Wi&&Vn.pause()))}function Kn(e){if("undefined"==typeof document)return Fi;var t;e.shadowHosts&&e.shadowHosts.length>0&&(qi.add(e.shadowHosts[0]),null==(t=Vn)||t.enableShadowAwareness());return e._priority=zi++,Bi.push(e),jn(e),{__mutation:e,revert:function(){Nn(e)}}}function qn(e,t,i){return Kn({kind:"html",elements:new Set,mutate:t,selector:e,originalClones:new WeakMap,shadowHosts:i})}function Wn(e,t,i){return Kn({kind:"position",elements:new Set,mutate:t,selector:e,shadowHosts:i})}function zn(e,t,i){return Kn({kind:"insert",elements:new Set,selector:"",mutate:e,html:t,newPositions:new Map,shadowHosts:i})}function Jn(e,t,i,n){return Kn({kind:"class",elements:new Set,mutate:t,selector:e,shadowHosts:n,rollback:i})}function Hn(e,t,i,n,r){return Li.test(t)?"class"===t||"className"===t?Jn(e,function(e){var t=i(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})},n,r):Kn({kind:"attribute",attribute:t,elements:new Set,mutate:i,selector:e,shadowHosts:r,rollback:n}):Fi}Bn();var Gn={html:qn,classes:Jn,attribute:Hn,position:Wn,insert:zn,declarative:function(e){if("insert"===e.action){var t,i=e.value,n=e.shadowHosts;if("parentSelector"in e)t=e.insertBeforeSelector?{insertSelector:e.insertBeforeSelector,direction:"before"}:{insertSelector:e.parentSelector,direction:"append"};else{if(!("insertSelector"in e))return Fi;var r=e.insertSelector,s=e.direction;t={insertSelector:r,direction:s}}return zn(function(){return t},function(){return null!=i?i:""},n)}var o=e.selector,a=e.action,l=e.value,c=e.attribute,u=e.shadowHosts,d=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;i[n]=e[n]}return i}(e,$i);if("html"===c){if("append"===a)return qn(o,function(e){return e+(null!=l?l:"")},u);if("set"===a)return qn(o,function(){return null!=l?l:""},u)}else if("class"===c){if("append"===a)return Jn(o,function(e){l&&e.add(l)},function(e){if(l&&e){var t=new Set(e.split(/\s+/).filter(Boolean));return t.delete(l),Array.from(t).join(" ")}return e},u);if("remove"===a)return Jn(o,function(e){l&&e.delete(l)},void 0,u);if("set"===a)return Jn(o,function(e){e.clear(),l&&e.add(l)},void 0,u)}else if("position"===c){if("set"===a){if("insertSelector"in d)return Wn(o,function(){return{insertSelector:d.insertSelector,direction:d.direction}},u);if("parentSelector"in d)return Wn(o,function(){return{insertBeforeSelector:d.insertBeforeSelector,parentSelector:d.parentSelector}},u)}}else{var h=l||"";if("append"===a)return"style"===c?Hn(o,c,function(e){return e?e+h:h},function(e){if(null===e)return null;var t=e.lastIndexOf(h);return-1!==t?e.substring(0,t)+e.substring(t+h.length):e},u):Hn(o,c,function(e){return null!==e?e+h:h},void 0,u);if("set"===a)return Hn(o,c,function(){return h},void 0,u);if("remove"===a)return Hn(o,c,function(){return null},void 0,u)}return Fi}},Xn={observeShadowAwareMutations:Xi,outermostShadowHostSelectors:qi},Qn=Object.freeze({__proto__:null,default:Gn,_testing:Xn,connectGlobalObserver:Bn,disconnectGlobalObserver:function(){var e;null==(e=Vn)||e.disconnect(),Vn=null},isGlobalObserverPaused:function(){return Wi},pauseGlobalObserver:Ln,resolveScope:Hi,resolveTargets:Gi,resumeGlobalObserver:Fn,validAttributeName:Li});class Zn{constructor(e){this.eventStorage=e,this.evaluationEngine=new j}evaluate(e){for(const t of e)if(this.evaluateAndGroup(t))return!0;return!1}evaluateAndGroup(e){for(const t of e)if(!this.evaluateConditionSet(t))return!1;return!0}evaluateConditionSet(e){const t=this.evaluateCondition(e.condition);return e.negated?!t:t}evaluateCondition(e){const t=this.eventStorage.getEventsInTimeWindow(e.event_type,e.time_type,e.time_value,e.interval).filter(t=>this.evaluatePropertyFilters(t,e.event_props||[])).length;return this.evaluateCountOperator(t,e.op,e.value)}evaluatePropertyFilters(e,t){if(!t||0===t.length)return!0;const i={context:e.properties,result:{}};return this.evaluationEngine.evaluateConditions(i,[t])}evaluateCountOperator(e,t,i){switch(t){case d:return e>=i;case u:return e>i;case r:return e===i;case l:return e{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}class tr{constructor(e,t,i){this.debouncedWriteTimeout=null,this.hasPendingWrites=!1,this.relayClient=null,this.handleBeforeUnload=()=>{this.flush()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.flush()},this.storageKey=`EXP_${e.slice(0,10)}_rtbt_events`,this.sessionManager=t,this.persistedEvents=i,this.memoryCache=this.loadFromLocalStorage(),He()&&this.armConsentListener(),this.setupFlushHandlers()}addEvent(e,t={},i){var n;if(this.persistedEvents&&!this.persistedEvents.has(e))return;const r=this.sessionManager.getCurrentSessionId(),s={uuid:er(),id:this.memoryCache.nextId++,event_type:e,timestamp:null!=i?i:Date.now(),session_id:r,properties:t};this.memoryCache.events.push(s),this.memoryCache.events.length>tr.MAX_EVENTS&&(this.memoryCache.events=this.memoryCache.events.slice(-tr.MAX_EVENTS)),this.scheduleDebouncedWrite(),null===(n=this.relayClient)||void 0===n||n.writeEvent(s)}setRelayClient(e){this.relayClient=e}flushRelay(){var e;null===(e=this.relayClient)||void 0===e||e.flush()}mergeFromRelay(e){const t=new Map;for(const e of this.memoryCache.events)t.set(Yn(e),e);for(const i of e.events)t.set(Yn(i),i);let i=Array.from(t.values()).sort((e,t)=>e.timestamp-t.timestamp);i.length>tr.MAX_EVENTS&&(i=i.slice(-tr.MAX_EVENTS));let n=Math.max(this.memoryCache.nextId,e.nextId);for(const e of i)e.id+1>n&&(n=e.id+1);this.memoryCache={events:i,nextId:n},this.hasPendingWrites=!0,this.scheduleDebouncedWrite()}syncFromRelay(e){return i(this,void 0,void 0,function*(){var t,i;const n=null!=e?e:this.relayClient;if(!(null==n?void 0:n.relayAvailable))return!1;try{const e=null===(i=null===(t=ae())||void 0===t?void 0:t.location)||void 0===i?void 0:i.origin;if(!e)return!1;!(yield n.checkMigrated(e))&&this.memoryCache.events.length>0&&(yield n.migrateEvents(e,{events:[...this.memoryCache.events],nextId:this.memoryCache.nextId}));const r=yield n.readEvents();if(this.memoryCache.events.length>0){const e=new Set(r.events.map(e=>Yn(e)));for(const t of this.memoryCache.events)e.has(Yn(t))||n.writeEvent(t)}return this.mergeFromRelay(r),!0}catch(e){return!1}})}getAllEvents(){return this.memoryCache.events}getEventsByType(e){return this.memoryCache.events.filter(t=>t.event_type===e)}getEventsInTimeWindow(e,t,i,n){let r=this.memoryCache.events.filter(t=>t.event_type===e);if("current_session"===t){const e=this.sessionManager.getCurrentSessionId();r=r.filter(t=>t.session_id===e)}else{const e=Date.now()-("day"===n?24*i*60*60*1e3:60*i*60*1e3);r=r.filter(t=>t.timestamp>=e)}return r}clearEvents(){this.memoryCache={events:[],nextId:1},this.hasPendingWrites=!0,this.flushToLocalStorage()}flush(){this.flushToLocalStorage(),this.flushRelay()}getEventCount(e){return this.getEventsByType(e).length}getEventCountInTimeWindow(e,t,i,n){return this.getEventsInTimeWindow(e,t,i,n).length}loadFromLocalStorage(){const e=St("localStorage",this.storageKey);if(e&&"object"==typeof e&&Array.isArray(e.events)&&"number"==typeof e.nextId){let t=!1;for(const i of e.events)"string"==typeof i.uuid&&0!==i.uuid.length||(i.uuid=er(),t=!0);return t&&_t("localStorage",this.storageKey,e),e}return{events:[],nextId:1}}scheduleDebouncedWrite(){this.hasPendingWrites=!0,this.debouncedWriteTimeout&&clearTimeout(this.debouncedWriteTimeout),this.debouncedWriteTimeout=setTimeout(()=>{this.flushToLocalStorage()},tr.DEBOUNCE_MS)}flushToLocalStorage(){this.hasPendingWrites&&(Ge()||_t("localStorage",this.storageKey,this.memoryCache),this.hasPendingWrites=!1,this.debouncedWriteTimeout&&(clearTimeout(this.debouncedWriteTimeout),this.debouncedWriteTimeout=null))}armConsentListener(){Je(e=>{if(e){const e=this.loadFromLocalStorage();if(0===e.events.length&&0===this.memoryCache.events.length)return;return this.mergeFromRelay(e),void this.flushToLocalStorage()}this.memoryCache={events:[],nextId:1},this.hasPendingWrites=!1,this.debouncedWriteTimeout&&(clearTimeout(this.debouncedWriteTimeout),this.debouncedWriteTimeout=null)})}setupFlushHandlers(){const e=ae();e&&(e.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("visibilitychange",this.handleVisibilityChange))}cleanup(){var e;this.flushToLocalStorage(),this.flushRelay(),this.debouncedWriteTimeout&&(clearTimeout(this.debouncedWriteTimeout),this.debouncedWriteTimeout=null),null===(e=ae())||void 0===e||e.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("visibilitychange",this.handleVisibilityChange)}}tr.MAX_EVENTS=500,tr.DEBOUNCE_MS=500;function ir(e){return{sessionId:`${e}-${Math.random().toString(36).substr(2,9)}`,sessionStartTime:e,lastEventTime:e}}function nr(e){if(e&&"object"==typeof e&&"string"==typeof e.sessionId&&"number"==typeof e.lastEventTime){const t=e;return{sessionId:t.sessionId,sessionStartTime:"number"==typeof t.sessionStartTime?t.sessionStartTime:t.lastEventTime,lastEventTime:t.lastEventTime}}}class rr{constructor(e,t=18e5){this.sessionTimeoutMs=t,this.store=new ct(`EXP_${e.slice(0,10)}_rtbt_session`,()=>this.domain(),{validate:nr})}getCurrentSessionId(){return this.resolve().sessionId}getOrCreateSessionId(){return this.getCurrentSessionId()}recordActivity(){const e=Date.now(),t=this.store.read();t&&e-t.lastEventTime<=this.sessionTimeoutMs?this.store.write(Object.assign(Object.assign({},t),{lastEventTime:e})):this.store.write(ir(e))}getSessionStartTime(){return this.resolve().sessionStartTime}clearSession(){this.store.clear()}resolve(){const e=Date.now(),t=this.store.read();if(t&&e-t.lastEventTime<=this.sessionTimeoutMs)return t;const i=ir(e);return this.store.write(i),i}domain(){if(void 0!==this.resolvedDomain)return this.resolvedDomain;const e="undefined"!=typeof location&&location.hostname?it(location.hostname):"";return Ge()||(this.resolvedDomain=e),e}}class sr{constructor(e,t={},i){this.matchedBehaviors=new Map,this.eventToBehaviors=new Map,this.rules=t,this.sessionManager=new rr(e,i),this.buildEventToBehaviorsMap(),this.eventStorage=new tr(e,this.sessionManager,new Set(this.eventToBehaviors.keys())),this.evaluator=new Zn(this.eventStorage),this.evaluateAll()}trackEvent(e,t){this.sessionManager.recordActivity(),this.eventStorage.addEvent(e,t),this.evaluateEvent(e)}setRelayClient(e){this.eventStorage.setRelayClient(e)}beginRelaySync(e){return i(this,void 0,void 0,function*(){const t=this.serializeMatchedBehaviors();if(yield e.init(),e.relayAvailable||(yield e.waitForAvailable()),!e.relayAvailable)return{status:"unavailable"};return(yield this.eventStorage.syncFromRelay(e))?(this.evaluateAll(),t!==this.serializeMatchedBehaviors()?{status:"behaviors_changed"}:{status:"unchanged"}):{status:"sync_failed"}})}hasRules(e){return!!this.rules[e]}getMatchedBehaviors(){return this.matchedBehaviors}cleanup(){this.eventStorage.cleanup()}buildEventToBehaviorsMap(){for(const e in this.rules){const t=this.rules[e];for(const[i,n]of Object.entries(t)){const t=this.extractEventTypes(n);for(const n of t){let t=this.eventToBehaviors.get(n);t||(t=[],this.eventToBehaviors.set(n,t)),t.push({id:i,flagKey:e})}}}}extractEventTypes(e){const t=new Set;for(const i of e)for(const e of i)"behavior"===e.condition.type&&t.add(e.condition.event_type);return t}evaluateAll(){for(const e in this.rules)this.evaluateFlag(e)}evaluateEvent(e){const t=this.eventToBehaviors.get(e);if(t)for(const{id:e,flagKey:i}of t)this.evaluateBehaviorId(i,e)}evaluateFlag(e){const t=this.rules[e];if(!t)return void this.matchedBehaviors.delete(e);const i=new Set;for(const[e,n]of Object.entries(t))this.evaluator.evaluate(n)&&i.add(e);i.size>0?this.matchedBehaviors.set(e,i):this.matchedBehaviors.delete(e)}serializeMatchedBehaviors(){const e={};for(const[t,i]of this.matchedBehaviors.entries())e[t]=[...i].sort();return JSON.stringify(e)}evaluateBehaviorId(e,t){const i=this.rules[e];if(!i||!i[t])return;const n=this.matchedBehaviors.get(e)||new Set,r=i[t];this.evaluator.evaluate(r)?n.add(t):n.delete(t),n.size>0?this.matchedBehaviors.set(e,n):this.matchedBehaviors.delete(e)}}const or="AMP_RELAY_READY",ar=2e3,lr=e=>{if(document.body)return e(),()=>{};const t=ae();if(!(null==t?void 0:t.requestAnimationFrame))return e(),()=>{};let i=!1;const n=()=>{i||(document.body?e():t.requestAnimationFrame(n))};return t.requestAnimationFrame(n),()=>{i=!0}};function cr(e,t){return e.uuid===t.uuid}class ur{constructor(e,t,i){this.apiKey=e,this.webExpIdV2=t,this.relayUrl=i,this.iframe=null,this.iframeWindow=null,this.relayOrigin="",this.available=!1,this.pendingWrites=[],this.pendingRequests=new Map,this.messageListener=null,this.initPromise=null,this.initTimeoutId=null,this.initResolve=null,this.cancelBodyReadyPoll=null,this.destroyed=!1,this.availablePromise=null,this.resolveAvailable=null,this.relayOrigin=new URL(i).origin}createRelayRequest(e,t){return{type:e,requestId:`${Date.now()}-${Math.random().toString(36).slice(2)}`,apiKey:this.apiKey,web_exp_id_v2:this.webExpIdV2,payload:t}}get relayAvailable(){return this.available}notifyAvailable(){var e;null===(e=this.resolveAvailable)||void 0===e||e.call(this),this.resolveAvailable=null,this.availablePromise=null}waitForAvailable(e=2e3){if(this.destroyed)return Promise.resolve(!1);if(this.available)return Promise.resolve(!0);this.availablePromise||(this.availablePromise=new Promise(e=>{this.resolveAvailable=e}));const t=this.availablePromise,i=ae();return new Promise(n=>{const r=()=>n(this.available&&!this.destroyed),s=null==i?void 0:i.setTimeout(r,e);t.then(()=>{null==i||i.clearTimeout(s),r()})})}init(){return i(this,void 0,void 0,function*(){if(this.initPromise)return this.initPromise;const e=ae();return this.destroyed=!1,this.available=!1,this.iframeWindow=null,this.messageListener&&(null==e||e.removeEventListener("message",this.messageListener),this.messageListener=null),this.initPromise=new Promise(t=>{var i,n;this.initResolve=t;const r=()=>{this.initResolve&&(null!==this.initTimeoutId&&(null==e||e.clearTimeout(this.initTimeoutId),this.initTimeoutId=null),this.initResolve=null,t())};this.initTimeoutId=null!==(i=null==e?void 0:e.setTimeout(()=>{this.initTimeoutId=null,r()},ar))&&void 0!==i?i:null,null===(n=this.cancelBodyReadyPoll)||void 0===n||n.call(this),this.cancelBodyReadyPoll=lr(()=>{if(this.destroyed||this.iframe)return;if(!document.body)return;const t=document.createElement("iframe");t.src=this.relayUrl,t.style.display="none",t.setAttribute("aria-hidden","true"),document.body.appendChild(t),this.iframe=t;const i=i=>{if(this.destroyed)return;if(i.origin!==this.relayOrigin)return;if(i.source!==t.contentWindow)return;if(!this.available&&((n=i.data)===or||"object"==typeof n&&null!==n&&n.type===or))return this.iframeWindow=t.contentWindow,this.available=!0,this.flush(),this.notifyAvailable(),void r();var n;const s=i.data;if(!(null==s?void 0:s.requestId))return;const o=this.pendingRequests.get(s.requestId);o&&(this.pendingRequests.delete(s.requestId),null==e||e.clearTimeout(o.timeoutId),o.resolve(s))};null==e||e.addEventListener("message",i),this.messageListener=i})}),this.initPromise})}sendRequest(e){return new Promise((t,i)=>{var n;if(!this.available||!this.iframeWindow)return void i(new Error("relay unavailable"));const r=null===(n=ae())||void 0===n?void 0:n.setTimeout(()=>{this.pendingRequests.has(e.requestId)&&(this.pendingRequests.delete(e.requestId),i(new Error("relay rpc timeout")))},ar);this.pendingRequests.set(e.requestId,{resolve:t,reject:i,timeoutId:r}),this.iframeWindow.postMessage(e,this.relayOrigin)})}readEvents(){return i(this,void 0,void 0,function*(){var e,t;const i=yield this.sendRequest(this.createRelayRequest("READ_EVENTS"));if(!i.ok)throw new Error(null!==(e=i.error)&&void 0!==e?e:"read events failed");return null!==(t=i.payload)&&void 0!==t?t:{events:[],nextId:1}})}writeEvent(e){if(this.destroyed)return;this.pendingWrites.some(t=>cr(t,e))||this.pendingWrites.push(e),this.sendPendingWrite(e)}removeConfirmedWrite(e){const t=this.pendingWrites.findIndex(t=>cr(t,e));-1!==t&&this.pendingWrites.splice(t,1)}sendPendingWrite(e){this.available&&this.iframeWindow&&this.sendRequest(this.createRelayRequest("WRITE_EVENT",{event:e})).then(t=>{t.ok&&this.removeConfirmedWrite(e)}).catch(()=>{})}flush(){if(this.available&&this.iframeWindow)for(const e of[...this.pendingWrites])this.sendPendingWrite(e)}checkMigrated(e){return i(this,void 0,void 0,function*(){var t,i;const n=yield this.sendRequest(this.createRelayRequest("CHECK_MIGRATED",{sourceOrigin:e}));if(!n.ok)throw new Error(null!==(t=n.error)&&void 0!==t?t:"check migrated failed");return Boolean(null===(i=n.payload)||void 0===i?void 0:i.migrated)})}migrateEvents(e,t){return i(this,void 0,void 0,function*(){var i;const n=yield this.sendRequest(this.createRelayRequest("MIGRATE_EVENTS",{sourceOrigin:e,store:t}));if(!n.ok)throw new Error(null!==(i=n.error)&&void 0!==i?i:"migrate events failed")})}destroy(){var e,t;const i=ae();this.destroyed=!0,null===(e=this.cancelBodyReadyPoll)||void 0===e||e.call(this),this.cancelBodyReadyPoll=null,null!==this.initTimeoutId&&(null==i||i.clearTimeout(this.initTimeoutId),this.initTimeoutId=null),this.initResolve&&(this.initResolve(),this.initResolve=null),this.messageListener&&(null==i||i.removeEventListener("message",this.messageListener),this.messageListener=null);for(const e of this.pendingRequests.values())null==i||i.clearTimeout(e.timeoutId),e.reject(new Error("relay destroyed"));this.pendingRequests.clear(),this.notifyAvailable(),null===(t=this.iframe)||void 0===t||t.remove(),this.iframe=null,this.iframeWindow=null,this.available=!1,this.pendingWrites=[],this.initPromise=null}}const dr="__ampConsentGatedTrack";class hr{constructor(e){this.realTrack=e,this.buffered=[],this.flushArmed=!1}getDebugState(){return{buffered:this.buffered.length,flushArmed:this.flushArmed,retrying:void 0!==this.poller}}track(e){return Ge()?(He()&&(this.buffer(e),this.armFlush()),!0):this.realTrack(e)}buffer(e){this.buffered.length>=512&&this.buffered.shift(),this.buffered.push(function(e){var t;if(void 0!==(null===(t=e.eventProperties)||void 0===t?void 0:t.time))return e;return Object.assign(Object.assign({},e),{eventProperties:Object.assign(Object.assign({},e.eventProperties),{time:Date.now()})})}(e))}armFlush(){this.flushArmed||(this.flushArmed=!0,Je(e=>{e?this.flush():this.discardBuffered()}))}discardBuffered(){this.buffered.length=0,this.stopRetry()}flush(){if(Ge())return void(He()||this.discardBuffered());let e=0;for(;e0?this.startRetry():this.stopRetry()}startRetry(){if(void 0!==this.poller)return;const e=ge();e&&(this.poller=e(()=>{this.flush()},1e3))}stopRetry(){var e;void 0!==this.poller&&(null===(e=ve())||void 0===e||e(this.poller),this.poller=void 0)}}const gr=[];function vr(e,t){var i,n,r;const s=e.nodeType===Node.DOCUMENT_NODE?e:null!==(i=e.ownerDocument)&&void 0!==i?i:document;const o=function(e){return void 0!==e.adoptedStyleSheets}(e)?e:s,a=new(null!==(r=null===(n=s.defaultView)||void 0===n?void 0:n.CSSStyleSheet)&&void 0!==r?r:CSSStyleSheet);a.replaceSync(t);let l=!1;const c=()=>{l||(o.adoptedStyleSheets=[...o.adoptedStyleSheets,a],l=!0)};return c(),{revert:()=>{l&&(o.adoptedStyleSheets=o.adoptedStyleSheets.filter(e=>e!==a),l=!1)},reapply:c}}let fr;class pr{constructor(e){this.modal=null,this.options=e}show(){document.getElementById("amp-preview-modal")||(this.createModal(),this.attachEventListeners())}hide(){var e,t;this.modal&&(this.modal.remove(),this.modal=null),null===(t=(e=this.options).onDismiss)||void 0===t||t.call(e)}createModal(){if(!document.body)return;this.modal=document.createElement("div"),this.modal.id="amp-preview-modal",this.modal.className="amp-pv";const e=document.createElement("div");e.className="amp-pv-c",Object.entries(this.options.flags).forEach(([t,i])=>{const n=document.createElement("div");n.className="amp-pv-r";const r=document.createElement("span");r.className="amp-pv-t",r.textContent=t;const s=document.createElement("div");s.className="amp-pv-b amp-pv-pb",s.innerHTML="Preview Mode";const o=document.createElement("span");o.className="amp-pv-b";const a=document.createElement("span");a.className="amp-pv-d",o.appendChild(a),o.appendChild(document.createTextNode(i)),n.appendChild(r),n.appendChild(s),n.appendChild(o),e.appendChild(n)});const t=document.createElement("button");t.className="amp-pv-x",t.setAttribute("aria-label","Dismiss preview mode notification"),t.innerHTML="×",this.modal.appendChild(e),this.modal.appendChild(t),this.injectStyles(),requestAnimationFrame(()=>{this.modal&&document.body&&document.body.appendChild(this.modal)})}attachEventListeners(){var e,t;null===(t=null===(e=this.modal)||void 0===e?void 0:e.querySelector(".amp-pv-x"))||void 0===t||t.addEventListener("click",()=>this.hide())}injectStyles(){if(fr)return;fr=vr(document,".amp-pv{position:fixed;top:20px;right:20px;z-index:10000;background:#2d3748;border:1px solid #4a5568;border-radius:8px;box-shadow:0 4px 24px rgba(0,0,0,.12);font-family:system-ui,sans-serif;font-size:14px;line-height:1.4;color:#f7fafc;animation:amp-pv-in .3s ease-out;display:flex;gap:8px;padding:12px;max-width:600px}@keyframes amp-pv-in{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}.amp-pv-c{flex:1;display:flex;flex-direction:column;gap:8px}.amp-pv-r{display:flex;align-items:center;gap:8px}.amp-pv-t{font-weight:600;max-width:300px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.amp-pv-b{padding:4px 8px;border-radius:12px;font-size:12px;font-weight:500;display:flex;align-items:center;gap:6px;border:1px solid #4a5568}.amp-pv-pb{color:#a0aec0}.amp-pv-d{width:8px;height:8px;border-radius:50%;background:#68d391;flex-shrink:0}.amp-pv-x{background:0 0;border:0;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:6px;color:#718096;font-size:18px;line-height:1;width:24px;height:24px}.amp-pv-x:hover{background:#4a5568;color:#e2e8f0}")}}function mr(e){const t=new pr(e);let i=!1,n=!1;const r=()=>{i&&n&&t.show()};return lr(()=>{i=!0,r()}),setTimeout(()=>{n=!0,r()},500),t}class br{constructor(){this.messageToSubscriberGroup=new Map,this.subscriberGroupCallback=new Map}subscribe(e,t,i=void 0){let n=this.messageToSubscriberGroup.get(e);n||(n={subscribers:[]},this.messageToSubscriberGroup.set(e,n));const r={identifier:i,callback:t};n.subscribers.push(r)}groupSubscribe(e,t){this.subscriberGroupCallback.set(e,t),this.messageToSubscriberGroup.has(e)||this.messageToSubscriberGroup.set(e,{subscribers:[]})}publish(e,t){var i;const n=this.messageToSubscriberGroup.get(e);n&&(t=t||{},n.subscribers.forEach(e=>{e.callback(t)}),null===(i=this.subscriberGroupCallback.get(e))||void 0===i||i(t))}unsubscribeAll(){this.messageToSubscriberGroup=new Map,this.subscriberGroupCallback=new Map}}function yr(e,t){if(!e&&t.size>0)return!1;if(e&&e.size!==t.size)return!1;if(!e)return!0;for(const[i,n]of e){const e=t.get(i);if(!e)return!1;if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1}return!0}const wr=[];let Sr=!1,_r="not_started",xr=null;const Er=e=>{var t;if(!0!==e.__AMP_DEBUG)try{Sr="true"===(null===(t=e.localStorage)||void 0===t?void 0:t.getItem("amp-ve-debug"))}catch(e){Sr=!1}else Sr=!0},kr=()=>Sr,Or=(e,t)=>{Sr&&wr.push({timestamp:Date.now(),event:e,detail:t})},Tr=e=>{_r=e},Pr=e=>{xr=e},Cr=()=>{var e;const t=null!==(e=null==xr?void 0:xr())&&void 0!==e?e:{flags:{},visualEditor:{isActive:!1},currentUrl:""};return{flags:t.flags,visualEditor:Object.assign(Object.assign({},t.visualEditor),{messengerState:_r}),events:wr,currentUrl:t.currentUrl,timestamp:Date.now(),consent:Object.assign(Object.assign({},{status:ze.manager.getStatus(),required:ze.required,started:ze.started,startDeferred:null!==ze.deferredStart}),{impressionBuffers:gr.map(e=>e.getDebugState())})}};function Ar(e,t){const i=[];for(const n of Object.values(e))for(const e of Object.values(n))t.includes(e.trigger_type)&&i.push(e);return i}function Mr(e){const t={};for(const i in e){t[i]={};for(const n in e[i])t[i][n]=Object.assign({},e[i][n])}return t}function Rr(e,t){const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(const n of i){const i=e[n],r=t[n];if(!r)return!1;const s=Object.keys(i),o=Object.keys(r);if(s.length!==o.length)return!1;for(const e of s){const t=i[e],n=r[e];if(!n||t.id!==n.id)return!1}}return!0}const Ir="amp-device-iframe",jr="amp-overlay-device-iframe-container";function Nr(){try{return"true"===sessionStorage.getItem("amp-visual-editor-mobile-mode")}catch(e){return!1}}function Dr(){return document.getElementById(Ir)}function Ur(e,t){const i=t.location.href;i&&i!==e.location.href&&e.history.replaceState(e.history.state,"",i)}function $r(e){const t=e.document,i=()=>{for(vr(t,`body > *:not(#${jr}):not(#overlay-shadow-host) { display: none !important; }`);t.body.firstChild;)t.body.removeChild(t.body.firstChild);t.body.style.cssText="\n margin: 0;\n padding: 0;\n overflow: auto;\n min-height: 100vh;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #fdfdfd radial-gradient(rgba(0, 23, 253, 0.5) 1px, transparent 1px);\n background-size: 32px 32px;\n ";const i=t.createElement("div");i.id=jr,i.style.cssText="\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n ";const n=t.createElement("iframe");n.id=Ir,n.src=e.location.href,n.style.cssText="\n width: 402px;\n height: 874px;\n border: 1px solid #dedfe2;\n border-radius: 20px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);\n background: #fff;\n transition: all 0.1s ease;\n ",n.addEventListener("load",()=>{const t=n.contentWindow;if(t)try{Ur(e,t),function(e,t){const i=t.history,n=i=>function(n,r,s){i.call(this,n,r,s),Ur(e,t)};i.pushState=n(i.pushState.bind(i)),i.replaceState=n(i.replaceState.bind(i)),t.addEventListener("popstate",()=>{Ur(e,t)})}(e,t)}catch(e){}}),i.appendChild(n),t.body.appendChild(i)};return new Promise(n=>{if("complete"===t.readyState&&t.body)i(),n();else{const r=()=>{"complete"===t.readyState&&t.body?(i(),n()):e.requestAnimationFrame(r)};e.requestAnimationFrame(r)}})}const Lr={observerOptions:{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]},debounceMs:100};class Fr{constructor(e,t,i=[],n={}){this.mutationObserver=null,this.pendingMutations=[],this.processMutationsImmediately=()=>{if(this.mutationObserver)try{this.pendingMutations.length>0&&this.onMutations(this.pendingMutations)}catch(e){}finally{this.pendingMutations=[]}},this.handleMutations=e=>{try{const t=e.filter(e=>this.shouldProcessMutation(e));if(0===t.length)return;if(this.pendingMutations.length+t.length>Fr.MAX_PENDING_MUTATIONS)return this.pendingMutations.push(...t),this.processMutationsDebounced.cancel(),void this.processMutationsImmediately();this.pendingMutations.push(...t),this.processMutationsDebounced()}catch(e){}},this.target=e,this.onMutations=t,this.filters=i,this.options=Object.assign(Object.assign({},Lr),n),this.processMutationsDebounced=function(e,t,i={}){let n=null,r=null;const s=function(...s){i.maxWait&&!r&&(r=setTimeout(()=>{n&&(clearTimeout(n),n=null),r=null,e(...s)},i.maxWait)),n&&clearTimeout(n),n=setTimeout(()=>{r&&(clearTimeout(r),r=null),e(...s)},t)};return s.cancel=()=>{n&&clearTimeout(n),r&&clearTimeout(r),n=null,r=null},s}(this.processMutationsImmediately,this.options.debounceMs,{maxWait:2*this.options.debounceMs})}shouldProcessMutation(e){if(0===this.filters.length)return!0;try{return this.filters.every(t=>t(e))}catch(e){return!1}}cleanup(){var e;this.processMutationsDebounced.cancel(),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),this.pendingMutations=[],this.mutationObserver=null}observe(){return this.mutationObserver&&this.cleanup(),this.mutationObserver=new MutationObserver(this.handleMutations),this.mutationObserver.observe(this.target,this.options.observerOptions),()=>{this.cleanup()}}}Fr.MAX_PENDING_MUTATIONS=1e3;const Vr=new j;class Br{get contentDocument(){return function(e){var t,i;return Nr()&&null!==(i=null===(t=Dr())||void 0===t?void 0:t.contentDocument)&&void 0!==i?i:e.document}(this.globalScope)}get contentWindow(){return(e=>{var t,i;return Nr()&&null!==(i=null===(t=Dr())||void 0===t?void 0:t.contentWindow)&&void 0!==i?i:e})(this.globalScope)}constructor(e,t,n,r,s,o){this.pageChangeSubscribers=new Set,this.lastNotifiedActivePages={},this.lastNotifiedActiveBehavioralFlags=new Map,this.intersectionObservers=new Map,this.elementVisibilityState=new Map,this.elementAppearedState=new Set,this.manuallyActivatedPageObjects=new Set,this.targetedElementSelectors=new Set,this.scrolledToObservers=new Map,this.scrolledToElementState=new Map,this.analyticsEventState=new Set,this.maxScrollPercentage=0,this.timeOnPageTimeouts={},this.firedUserInteractions=new Set,this.clickTimeouts=new Map,this.hoverTimeouts=new WeakMap,this.focusTimeouts=new WeakMap,this.userInteractionAbortController=null,this.pageLoadTime=Number.POSITIVE_INFINITY,this.lastPublishedUrl=null,this.debugStateSubscribers=new Set,this.debugDebounceTimer=null,this.setPageObjects=e=>{this.pageObjects=e},this.markUrlAsPublished=e=>{this.lastPublishedUrl=e},this.initSubscriptions=()=>{this.setupPageObjectSubscriptions(),this.options.useDefaultNavigationHandler&&this.setupLocationChangePublisher(),this.setupMutationObserverPublisher(),this.setupVisibilityPublisher(),this.setupUserInteractionPublisher(),this.setupExitIntentPublisher(),this.setupScrolledToPublisher(),this.setupTimeOnPagePublisher(),this.setupVisibilityChangeHandler(),this.checkInitialElements()},this.addPageChangeSubscriber=e=>(this.pageChangeSubscribers.add(e),()=>{this.pageChangeSubscribers.delete(e)}),this.addDebugStateSubscriber=e=>(this.debugStateSubscribers.add(e),()=>{this.debugStateSubscribers.delete(e)}),this.scheduleDebugNotification=()=>{this.options.isDebugActive&&0!==this.debugStateSubscribers.size&&(null!==this.debugDebounceTimer&&this.globalScope.clearTimeout(this.debugDebounceTimer),this.debugDebounceTimer=this.globalScope.setTimeout(()=>{this.debugDebounceTimer=null;const e=this.webExperimentClient.getDebugState();for(const t of this.debugStateSubscribers)t(e)},100))},this.setupPageObjectSubscriptions=()=>{const e={url_change:new Set};this.behavioralTargetingManager&&(e.analytics_event=new Set);for(const[t,i]of Object.entries(this.pageObjects))for(const n of Object.values(i))e[n.trigger_type]||(e[n.trigger_type]=new Set),e[n.trigger_type].add(t);for(const[e,t]of Object.entries(this.pageObjects))for(const i of Object.values(t))this.messageBus.subscribe(i.trigger_type,t=>{var n;const r=!!(null===(n=this.webExperimentClient.getActivePages()[e])||void 0===n?void 0:n[i.id]),s=this.isPageObjectActive(i,t);this.webExperimentClient.updateActivePages(e,i,s),s&&!r&&Or("trigger_fired",`flag=${e}, page=${i.name||i.id}, type=${i.trigger_type}`)});for(const t of Object.keys(e))this.messageBus.groupSubscribe(t,n=>{(()=>{i(this,void 0,void 0,function*(){var i,r;const s="url_change"===t,o="analytics_event"===t;s&&(Or("url_change",`navigated to ${this.globalScope.location.href}`),this.resetTriggerStates(),this.revertInjections());const a=this.webExperimentClient.getActivePages(),l=!Rr(a,this.lastNotifiedActivePages),c=null===(i=this.webExperimentClient.behavioralTargetingManager)||void 0===i?void 0:i.getMatchedBehaviors(),u=o&&!yr(c,this.lastNotifiedActiveBehavioralFlags);u&&this.webExperimentClient.updateUserWithBehaviors();if(!("updateActivePages"in n&&n.updateActivePages)&&!this.options.isVisualEditorMode&&(l||u||s)){let i;if(s)i=void 0;else{const n=Array.from(e[t]||[]),s=u?Array.from(new Set([...Array.from((null==c?void 0:c.keys())||[]),...Array.from((null===(r=this.lastNotifiedActiveBehavioralFlags)||void 0===r?void 0:r.keys())||[])])):[];i=Array.from(new Set([...n,...s]))}if(yield this.webExperimentClient.applyVariants({flagKeys:null==i?void 0:i.filter(e=>!this.webExperimentClient.previewFlags[e])}),this.webExperimentClient.isPreviewMode){const e=i?Object.fromEntries(Object.entries(this.webExperimentClient.previewFlags).filter(([e])=>i.includes(e))):this.webExperimentClient.previewFlags;yield this.webExperimentClient.previewVariants({keyToVariant:e})}}if(l){this.lastNotifiedActivePages=Mr(a);for(const e of this.pageChangeSubscribers)e({activePages:a})}(l||s)&&this.scheduleDebugNotification(),u&&c&&(this.lastNotifiedActiveBehavioralFlags=new Map(Array.from(c.entries()).map(([e,t])=>[e,new Set(t)])))})})()})},this.toggleManualPageObject=(e,t)=>{t?this.manuallyActivatedPageObjects.add(e):this.manuallyActivatedPageObjects.delete(e),this.messageBus.publish("manual")},this.resetTriggerStates=()=>{Or("trigger_reset","all non-url_change triggers cleared"),this.elementAppearedState.clear(),this.elementVisibilityState.clear(),this.firedUserInteractions.clear(),this.scrolledToElementState.clear(),this.manuallyActivatedPageObjects.clear(),this.maxScrollPercentage=0,this.pageLoadTime=Date.now(),this.analyticsEventState.clear(),this.lastNotifiedActiveBehavioralFlags=new Map;for(const e of this.clickTimeouts.values())this.globalScope.clearTimeout(e);this.clickTimeouts.clear();for(const[e,t]of Object.entries(this.pageObjects))for(const i of Object.values(t))"url_change"!==i.trigger_type&&this.webExperimentClient.updateActivePages(e,i,!1);this.setupTimeOnPagePublisher(),this.checkInitialElements()},this.revertInjections=()=>{Object.values(this.webExperimentClient.appliedMutations).forEach(e=>{Object.values(e).forEach(e=>{e[fs]&&Object.values(e[fs]).forEach(e=>{var t;null===(t=e.revert)||void 0===t||t.call(e)})})});const e=this.webExperimentClient.appliedMutations;Object.keys(e).forEach(t=>{const i=e[t];Object.keys(i).forEach(e=>{i[e][fs]&&(delete i[e][fs],0===Object.keys(i[e]).length&&delete i[e])}),0===Object.keys(i).length&&delete e[t]})},this.updateElementAppearedState=(e,t)=>{for(const i of e){if(0===t.length||this.isMutationRelevantToSelector(t,i))try{const e=this.contentDocument.querySelectorAll(i);for(const t of Array.from(e)){const e=this.contentWindow.getComputedStyle(t);if("none"!==e.display&&"hidden"!==e.visibility){this.elementAppearedState.add(i);break}}}catch(e){}}},this.checkInitialElements=()=>{this.updateElementAppearedState(this.targetedElementSelectors,[]),this.messageBus.publish("element_appeared",{mutationList:[]})},this.setupMutationObserverPublisher=()=>{if(this.targetedElementSelectors=function(e){const t=new Set;for(const i of Object.values(e))for(const e of Object.values(i))if("element_appeared"===e.trigger_type||"element_visible"===e.trigger_type){const i=e.trigger_value.selector;i&&t.add(i)}else if("scrolled_to"===e.trigger_type){const i=e.trigger_value;"element"===i.mode&&i.selector&&t.add(i.selector)}return t}(this.pageObjects),0===this.targetedElementSelectors.size)return;const e=[e=>Array.from(this.targetedElementSelectors).some(t=>this.isMutationRelevantToSelector([e],t))];return new Fr(this.contentDocument.documentElement,e=>{this.updateElementAppearedState(this.targetedElementSelectors,e),this.messageBus.publish("element_appeared",{mutationList:e})},e).observe()},this.setupVisibilityPublisher=()=>{var e;if(0!==Ar(this.pageObjects,["element_visible"]).length){for(const t of Object.values(this.pageObjects))for(const i of Object.values(t))if("element_visible"===i.trigger_type){const t=i.trigger_value,n=t.selector,r=null!==(e=t.visibilityRatio)&&void 0!==e?e:0,s=`${n}\0${r}`;if(this.intersectionObservers.has(s))continue;const o=new IntersectionObserver(e=>{e.forEach(e=>{const t=e.intersectionRatio>=r;this.elementVisibilityState.set(s,t),t&&this.messageBus.publish("element_visible")})},{threshold:r});this.intersectionObservers.set(s,o);try{this.contentDocument.querySelectorAll(n).forEach(e=>{o.observe(e)})}catch(e){}}this.messageBus.subscribe("element_appeared",e=>{const{mutationList:t}=e;for(const[e,i]of this.intersectionObservers.entries()){const[n]=e.split("\0");if(0===t.length||this.isMutationRelevantToSelector(t,n))try{this.contentDocument.querySelectorAll(n).forEach(e=>{i.observe(e)})}catch(e){}}})}},this.setupExitIntentPublisher=()=>{var e;this.pageLoadTime=Date.now();const t=Object.values(this.pageObjects).flatMap(e=>Object.values(e).filter(e=>"exit_intent"===e.trigger_type));if(0===t.length)return;let i=1/0;for(const n of t){const t=n.trigger_value;i=Math.min(i,null!==(e=t.minTimeOnPageMs)&&void 0!==e?e:0)}const n=e=>{e.clientY<=50&&null===e.relatedTarget&&this.messageBus.publish("exit_intent",{durationMs:Date.now()-this.pageLoadTime})};i>0?this.globalScope.setTimeout(()=>{this.contentDocument.addEventListener("mouseleave",n)},i):this.contentDocument.addEventListener("mouseleave",n)},this.setupLocationChangePublisher=()=>{let e=this.globalScope.location.href;const t=t=>{const i=this.globalScope.location.href;i!==this.lastPublishedUrl&&(this.lastPublishedUrl=i,this.messageBus.publish("url_change"),this.globalScope.webExperiment.previousUrl=t,e=i)};this.globalScope.addEventListener("popstate",()=>{t(e)});const i=this.globalScope.history,n=i.pushState.bind(i),r=i.replaceState.bind(i);i.pushState=(...e)=>{const i=this.globalScope.location.href,r=n(...e);return t(i),r},i.replaceState=(...e)=>{const i=this.globalScope.location.href,n=r(...e);return t(i),n}},this.setupUserInteractionPublisher=()=>{var e,t,i,n;null===(e=this.userInteractionAbortController)||void 0===e||e.abort(),this.userInteractionAbortController=new AbortController;const{signal:r}=this.userInteractionAbortController,s=new Map,o=new Map,a=new Map;for(const e of Object.values(this.pageObjects))for(const r of Object.values(e))if("user_interaction"===r.trigger_type){const e=r.trigger_value,{selector:l,interactionType:c,minThresholdMs:u}=e;"click"===c?(s.has(l)||s.set(l,new Set),null===(t=s.get(l))||void 0===t||t.add(u||0)):"hover"===c?(o.has(l)||o.set(l,new Set),null===(i=o.get(l))||void 0===i||i.add(u||0)):"focus"===c&&(a.has(l)||a.set(l,new Set),null===(n=a.get(l))||void 0===n||n.add(u||0))}0===s.size&&0===o.size&&0===a.size||(s.size>0&&this.setupClickDelegation(s,r),o.size>0&&this.setupHoverDelegation(o,r),a.size>0&&this.setupFocusDelegation(a,r))},this.setupClickDelegation=(e,t)=>{this.contentDocument.addEventListener("click",t=>{const i=t.target;if(i)for(const[t,n]of e)try{if(i.closest(t)){for(const e of n){const i=`${t}\0click\0${e}`;if(this.firedUserInteractions.has(i))continue;if(this.clickTimeouts.has(i))continue;const n=()=>{this.firedUserInteractions.add(i),this.messageBus.publish("user_interaction"),this.clickTimeouts.delete(i)};if(e>0){const t=this.globalScope.setTimeout(n,e);this.clickTimeouts.set(i,t)}else n()}break}}catch(e){}},{signal:t})},this.setupThresholdBasedDelegation=(e,t,i)=>{this.contentDocument.addEventListener(i.startEvent,t=>{const n=t.target;if(n)for(const[t,r]of e)try{const e=n.closest(t);if(e){for(const n of r){const r=`${t}\0${i.interactionType}\0${n}`;if(this.firedUserInteractions.has(r))continue;let s=i.timeoutStorage.get(e);s||(s=new Map,i.timeoutStorage.set(e,s));const o=`${t}\0${n}`;if(!s.get(o)){const e=()=>{this.firedUserInteractions.add(r),this.messageBus.publish("user_interaction"),null==s||s.delete(o)};if(n){const t=this.globalScope.setTimeout(e,n);s.set(o,t)}else e()}}break}}catch(e){}},{signal:t}),this.contentDocument.addEventListener(i.endEvent,t=>{const n=t.target;if(!n)return;const r=t.relatedTarget;for(const[t]of e)try{const e=n.closest(t);if(e){if(!r||!e.contains(r)){const t=i.timeoutStorage.get(e);if(t){for(const e of t.values())this.globalScope.clearTimeout(e);i.timeoutStorage.delete(e)}}break}}catch(e){}},{signal:t})},this.setupHoverDelegation=(e,t)=>{this.setupThresholdBasedDelegation(e,t,{interactionType:"hover",startEvent:"mouseover",endEvent:"mouseout",timeoutStorage:this.hoverTimeouts})},this.setupFocusDelegation=(e,t)=>{this.setupThresholdBasedDelegation(e,t,{interactionType:"focus",startEvent:"focusin",endEvent:"focusout",timeoutStorage:this.focusTimeouts})},this.setupTimeOnPagePublisher=()=>{Object.values(this.timeOnPageTimeouts).forEach(clearTimeout),this.timeOnPageTimeouts={};const e=new Set;for(const t of Object.values(this.pageObjects))for(const i of Object.values(t))if("time_on_page"===i.trigger_type){const t=i.trigger_value;e.add(t.durationMs)}0!==e.size&&this.setUpTimeouts(e)},this.setUpTimeouts=e=>{e.forEach(e=>{this.timeOnPageTimeouts[e]=this.globalScope.setTimeout(()=>{this.messageBus.publish("time_on_page",{durationMs:e}),delete this.timeOnPageTimeouts[e]},e)})},this.setupVisibilityChangeHandler=()=>{if(0===Ar(this.pageObjects,["time_on_page"]).length)return;this.globalScope.document.addEventListener("visibilitychange",()=>{if(this.globalScope.document.hidden)Object.values(this.timeOnPageTimeouts).forEach(clearTimeout);else{const e=new Set(Object.keys(this.timeOnPageTimeouts).map(Number));this.setUpTimeouts(e)}})},this.setupScrolledToPublisher=()=>{const e=Ar(this.pageObjects,["scrolled_to"]);if(0===e.length)return;let t=!1,i=!1;for(const n of e){const e=n.trigger_value;"percent"===e.mode?t=!0:"element"===e.mode&&(i=!0)}if(t){let e=null;const t=()=>{const e=this.calculateScrollPercentage();e>this.maxScrollPercentage&&(this.maxScrollPercentage=e,this.messageBus.publish("scrolled_to",{}))},i=()=>{null===e&&(e=this.globalScope.requestAnimationFrame(()=>{t(),e=null}))};this.contentWindow.addEventListener("scroll",i,{passive:!0}),t()}if(i){for(const t of e)if("scrolled_to"===t.trigger_type){const e=t.trigger_value;if("element"===e.mode){const t=e.selector,i=e.offsetPx||0,n=`${t}\0${i}`;if(this.scrolledToObservers.has(n))continue;const r=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(this.scrolledToElementState.set(n,!0),this.messageBus.publish("scrolled_to",{}))})},{rootMargin:`0px 0px ${i}px 0px`,threshold:0});this.scrolledToObservers.set(n,r);try{this.contentDocument.querySelectorAll(t).forEach(e=>{r.observe(e)})}catch(e){}}}this.messageBus.subscribe("element_appeared",e=>{const{mutationList:t}=e;for(const[e,i]of this.scrolledToObservers.entries()){const[n]=e.split("\0");if(0===t.length||this.isMutationRelevantToSelector(t,n))try{this.contentDocument.querySelectorAll(n).forEach(e=>{i.observe(e)})}catch(e){}}})}},this.isPageObjectActive=(e,t)=>{var i,n,r;const s={page:{url:this.globalScope.location.href}};if(e.conditions&&e.conditions.length>0){if(!Vr.evaluateConditions({context:s,result:{}},e.conditions))return!1}switch(e.trigger_type){case"url_change":return!0;case"manual":{const t=e.trigger_value;return this.manuallyActivatedPageObjects.has(t.name)}case"analytics_event":{const i=e.id;if(this.analyticsEventState.has(i))return!0;const n=e.trigger_value,r=t,s={type:"analytics_event",data:{event:r.event,properties:r.properties}},o=Vr.evaluateConditions({context:s,result:{}},n);return o&&this.analyticsEventState.add(i),o}case"element_appeared":{const t=e.trigger_value.selector;return this.elementAppearedState.has(t)}case"element_visible":{const t=e.trigger_value,r=`${t.selector}\0${null!==(i=t.visibilityRatio)&&void 0!==i?i:0}`;return null!==(n=this.elementVisibilityState.get(r))&&void 0!==n&&n}case"exit_intent":{const i=t.durationMs,n=e.trigger_value;return void 0===n.minTimeOnPageMs||i>=n.minTimeOnPageMs}case"user_interaction":{const t=e.trigger_value,i=`${t.selector}\0${t.interactionType}\0${t.minThresholdMs||0}`;return this.firedUserInteractions.has(i)}case"time_on_page":{const i=t,n=e.trigger_value;return i.durationMs>=n.durationMs}case"scrolled_to":{const t=e.trigger_value;if("percent"===t.mode)return this.maxScrollPercentage>=t.percentage;if("element"===t.mode){const e=t.offsetPx||0,i=`${t.selector}\0${e}`;return null!==(r=this.scrolledToElementState.get(i))&&void 0!==r&&r}return!1}default:return!1}},this.webExperimentClient=e,this.messageBus=t,this.pageObjects=n,this.behavioralTargetingManager=r,this.options=s,this.globalScope=o}getDebugPageObjects(){const e={},t=this.webExperimentClient.getActivePages();for(const[i,n]of Object.entries(this.pageObjects))e[i]=Object.values(n).map(e=>{const n=this.evaluateUrlConditions(e),r=this.buildTriggerDebugInfo(e,i,t);return{id:e.id,name:e.name,urlConditionsPassed:n,triggerPassed:r.passed,trigger:r,overallStatus:n&&r.passed?"pass":"fail"}});return e}evaluateUrlConditions(e){return!e.conditions||0===e.conditions.length||Vr.evaluateConditions({context:{page:{url:this.globalScope.location.href}},result:{}},e.conditions)}buildTriggerDebugInfo(e,t,i){var n,r,s;switch(e.trigger_type){case"url_change":return{type:"url_change",passed:!0};case"element_appeared":{const{selector:t}=e.trigger_value;return{type:"element_appeared",passed:this.elementAppearedState.has(t),config:{selector:t}}}case"element_visible":{const{selector:t,visibilityRatio:i}=e.trigger_value,r=null!=i?i:0,s=`${t}\0${r}`;return{type:"element_visible",passed:null!==(n=this.elementVisibilityState.get(s))&&void 0!==n&&n,config:{selector:t,visibilityRatio:r}}}case"manual":{const{name:t}=e.trigger_value;return{type:"manual",passed:this.manuallyActivatedPageObjects.has(t),config:{name:t}}}case"analytics_event":return{type:"analytics_event",passed:this.analyticsEventState.has(e.id),config:{conditions:e.trigger_value}};case"user_interaction":{const{selector:t,interactionType:i,minThresholdMs:n}=e.trigger_value,r=n||0,s=`${t}\0${i}\0${r}`;return{type:"user_interaction",passed:this.firedUserInteractions.has(s),config:{selector:t,interactionType:i,minThresholdMs:r}}}case"exit_intent":{const{minTimeOnPageMs:n}=e.trigger_value;return{type:"exit_intent",passed:!!(null===(r=i[t])||void 0===r?void 0:r[e.id]),config:{minTimeOnPageMs:n}}}case"time_on_page":{const{durationMs:t}=e.trigger_value,i=Math.max(0,Date.now()-this.pageLoadTime);return{type:"time_on_page",passed:!(t in this.timeOnPageTimeouts),config:{durationMs:t},elapsedMs:i}}case"scrolled_to":{const t=e.trigger_value;if("percent"===t.mode){const{percentage:e}=t;return{type:"scrolled_to",passed:this.maxScrollPercentage>=e,config:{mode:"percent",percentage:e},currentPercentage:Math.round(this.maxScrollPercentage)}}const{selector:i,offsetPx:n}=t,r=`${i}\0${n||0}`;return{type:"scrolled_to",passed:null!==(s=this.scrolledToElementState.get(r))&&void 0!==s&&s,config:{mode:"element",selector:i,offsetPx:n}}}default:return{type:"url_change",passed:!1}}}isMutationRelevantToSelector(e,t){for(const i of e){if(i.addedNodes.length>0)for(const e of Array.from(i.addedNodes))if(e.nodeType===Node.ELEMENT_NODE)try{const i=e;if(i.matches(t))return!0;if(i.querySelector(t))return!0}catch(e){}if(i.target.nodeType===Node.ELEMENT_NODE)try{const e=i.target;if(e.matches(t))return!0;if(e.querySelector(t))return!0}catch(e){}}return!1}calculateScrollPercentage(){const e=this.contentWindow.innerHeight,t=this.contentDocument.documentElement.scrollHeight,i=this.contentWindow.scrollY,n=t-e;return n<=0?0:i/n*100}}let Kr;const qr=()=>{var e;if(Kr)return;const t=ae(),i=vr(null!==(e=null==t?void 0:t.document)&&void 0!==e?e:document,"* { visibility: hidden !important; background-image: none !important; }");Kr=i,null==t||t.window.setTimeout(()=>{Kr===i&&Wr()},1e3)},Wr=()=>{var e;null==Kr||Kr.revert(),Kr=void 0;const t=ae();null===(e=null==t?void 0:t.document.getElementById("amp-exp-css"))||void 0===e||e.remove()};function zr(e,t){return i(this,void 0,void 0,function*(){const n=`EXP_${Ce}_${e.substring(0,10)}`,[r,s]=yield function(e){return i(this,void 0,void 0,function*(){const t=lt(),i=function(e,t,i){return void 0===t&&(t=""),void 0===i&&(i=10),[pe,t,e.substring(0,i)].filter(Boolean).join("_")}(e,Ce);return[yield(new Fe).parse(),yield t.get(i)]})}(e),o={},a=[s,St("localStorage",n),r];for(const e of a)if(e)for(const[t,i]of Object.entries(e))t.startsWith("utm_")&&void 0!==i&&(o[t]=i);return Object.keys(o).length>0?(function(e,t){const i=`EXP_${Ce}_${e.substring(0,10)}`;_t("localStorage",i,t)}(e,o),Object.assign(Object.assign({},t),{persisted_url_param:o})):t})}const Jr={useDefaultNavigationHandler:!0,redirectConfig:{encodeRedirectInUrl:!1,encodeRedirectInCookie:!0}},Hr=(e,t)=>{var i,n,r,s;const o=Object.assign(Object.assign(Object.assign(Object.assign({},Jr),e),null==t?void 0:t.experimentConfig),{consentOptions:Object.assign(Object.assign({},e.consentOptions),null===(i=null==t?void 0:t.experimentConfig)||void 0===i?void 0:i.consentOptions)});return null!==(n=o.nonce)&&void 0!==n||(o.nonce=null===(s=null===(r=null==t?void 0:t.document)||void 0===r?void 0:r.querySelector("[nonce]"))||void 0===s?void 0:s.nonce),o},Gr=e=>({waitForElement(t){return i(this,void 0,void 0,function*(){let i;const n=()=>{if(!e.cancelled)return document.querySelector(t);null==i||i.disconnect()},r=n();return r||new Promise(e=>{i=new MutationObserver(()=>{const t=n();t&&(null==i||i.disconnect(),e(t))}),i.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})})})},insertElement:(t,i,n)=>new Promise(r=>{let s,o=0;const a=()=>{if(e.cancelled)return void(null==s||s.disconnect());if(t.isConnected&&t.ownerDocument===document)return;if(o>=10)return;o++,setTimeout(()=>o--,1e3);const a=document.querySelector(i.parentSelector);if(!a)return;const l=i.insertBeforeSelector?a.querySelector(i.insertBeforeSelector):null;i.insertBeforeSelector&&!l||(Ln(),a.insertBefore(t,l),Fn(),null==n||n(),r())};a(),s=new MutationObserver(a),s.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})})}),Xr="amp-exp-loading";let Qr;const Zr=()=>{if(document.getElementById(Xr))return;const e=document.createElement("div");e.id=Xr,Qr=setTimeout(()=>{Yr()},1e4),e.innerHTML=`\n \n\n \n `,lr(()=>{document.body&&!document.getElementById(Xr)&&void 0!==Qr&&document.body.appendChild(e)})},Yr=()=>{var e;Qr&&(clearTimeout(Qr),Qr=void 0),null===(e=document.getElementById(Xr))||void 0===e||e.remove()},es=()=>{try{const e=ae();if(!e)return!0;const t=e.opener;return!t||t.closed}catch(e){return!0}};class ts{static setup(e){var t;let i="closed";Or("opener_check",es()?"FAIL: window.opener is null, closed, or inaccessible":"PASS");const n=ts.getStoredSession();if(n)return Or("setup",`stored session found, loading ${n.injectSrc}`),Tr("loading"),i="opening",Zr(),void is(n.injectSrc,e).then(()=>{i="open",Tr("loaded"),Or("script_load_success","from stored session")}).catch(e=>{console.warn("Failed to load overlay from stored session:",e),i="closed",Tr("error"),Or("script_load_error",`from stored session: ${String((null==e?void 0:e.message)||e)}`),Yr()});Or("setup","no stored session, registering message listener"),Tr("waiting"),null===(t=ae())||void 0===t||t.addEventListener("message",t=>{const n=/^.*\.amplitude\.com$/;try{if(!t.origin||!n.test(new URL(t.origin).hostname))return void Or("origin_validation",`FAIL: ${t.origin||"(empty)"}`)}catch(e){return void Or("origin_validation",`FAIL: exception parsing origin ${t.origin}`)}if("OpenOverlay"===t.data.type){Or("message_received",`origin=${t.origin}, type=OpenOverlay`),Or("origin_validation","PASS");const r=new URL(t.data.context.injectSrc);if("closed"!==i)return void Or("state_guard",`rejected: state=${i}`);if("https:"!==r.protocol||!n.test(r.hostname))return void Or("injectSrc_validation",`FAIL: ${r.href}`);Or("injectSrc_validation",`PASS (${r.hostname})`),Tr("loading"),i="opening",Zr(),is(t.data.context.injectSrc,e).then(()=>{i="open",Tr("loaded"),Or("script_load_success")}).catch(()=>{i="closed",Tr("error"),Or("script_load_error",`Failed to load ${t.data.context.injectSrc}`),Yr()})}})}static getStoredSession(){const e=St("sessionStorage",ht);if(!e)return null;const t=/^.*\.amplitude\.com$/;try{const i=new URL(e.injectSrc);if("https:"!==i.protocol||!t.test(i.hostname))return null}catch(e){return null}return e}}const is=(e,t)=>new Promise((i,n)=>{Or("script_load_start",`loading ${e}`);Or("readyState",document.readyState),lr(()=>{var r;try{const s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=e,t?(s.setAttribute("nonce",t),Or("nonce_check",`found: ${String(t)}`)):Or("nonce_check","not found, skipping"),s.addEventListener("load",()=>{i({status:!0})},{once:!0}),s.addEventListener("error",()=>{n({status:!1,message:`Failed to load the script ${e}`})}),null===(r=document.head)||void 0===r||r.appendChild(s)}catch(e){n(e)}})}),ns=()=>{HTMLElement.prototype.removeChild=function(e){return e&&e.parentNode!==this?e:Node.prototype.removeChild.call(this,e)}},rs=e=>{const t=ae();if(t&&!t.__domParserParseFromString&&(e||!(new DOMParser).parseFromString('',"text/html").body.firstChild.style.cssText)){const i=DOMParser.prototype.parseFromString;t.__domParserParseFromString=i,DOMParser.prototype.parseFromString=function(t,n){const r=i.apply(this,[t,n]);return"text/html"===n&&(e&&r.querySelectorAll("style:not([nonce])").forEach(t=>t.setAttribute("nonce",e)),r.querySelectorAll("[style]").forEach(e=>{e.style.cssText=e.getAttribute("style")})),r}}};const ss=Symbol.for("@amplitude/spa-link-interceptor-initiated");function os(){const e=ae();if(!e)return;if(e[ss])return;e[ss]=!0;document.addEventListener("click",e=>{var t,i;const n=e.target;if(!(n instanceof Element))return;const r=n.closest("a");if(!r)return;const s=r.__mutationRecord__;if(!(null===(i=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.href)||void 0===i?void 0:i.mutations.length))return;const o=r.getAttribute("href"),a=r.getAttribute("target");o&&function(e,t){return!(t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button>0)}(e,a)&&function(e){var t,i;const n=Object.keys(e).find(e=>e.startsWith("__reactFiber"));return!!n&&String(null===(i=null===(t=e[n])||void 0===t?void 0:t.memoizedProps)||void 0===i?void 0:i.onClick).includes(".defaultPrevented")}(r)&&(e.preventDefault(),function(e){var t,i;const n=ae();if(!n)return;let r;try{r=new URL(e,n.location.href)}catch(e){}if(r&&r.origin!==n.location.origin)return void(n.location.href=e);if(null===(i=null===(t=n.next)||void 0===t?void 0:t.router)||void 0===i?void 0:i.push)return void n.next.router.push(e);history.pushState(null,"",e),n.dispatchEvent(new PopStateEvent("popstate",{state:history.state}))}(o))},!0)}const as=()=>{const e=ae(),t=new URLSearchParams(null==e?void 0:e.location.search),i={};for(const[e,n]of t)i[e]=n;return i},ls=e=>{if(!e)return"";const t=new URL(e);return t.search="",t.hash="",t.toString()},cs=e=>{if(!e)return"";try{const t=new URL(e);return t.search="",t.toString()}catch(t){return e}},us=e=>{if(!e)return"";try{const t=new URL(e);return t.hash="",t.toString()}catch(t){return e}},ds=(e,t)=>{const i=new URL(e);for(const e of t)i.searchParams.delete(e);return i.toString()},hs=(e,t)=>(t=t.replace(/\/$/,""),e.some(e=>{e=(e=(e=e.replace(/\/$/,"")).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).replace(/\\\*/,".*");const i=new RegExp(`^${e}$`);return i.test(t)||i.test(t+"/")})),gs=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,gs)},vs="mutate",fs="inject",ps="PREVIEW",ms="VISUAL_EDITOR",bs="AMP_REDIRECT",ys=["pointerdown","keydown","popstate"],ws=(e,t)=>{try{const i=new URL(e).searchParams,n=new URL(t).searchParams,r=[];return n.forEach((e,t)=>{i.get(t)!==e&&r.push(t)}),r}catch(e){return[]}},Ss=ae();Ss&&(Ss.Experiment=_i);const _s=e=>e.startsWith("holdout-")?"holdout":e.startsWith("mutex-")?"mutex":"prerequisite",xs=(e,t,i,n)=>{const r=null==e?void 0:e.dependencies;if(!r||0===r.length)return;const s=(e=>{var t,i,n;const r=new Set;if(!e)return r;for(const s of e.steps){if(s.matched)break;for(const e of null!==(t=s.conditionResult)&&void 0!==t?t:[])for(const t of null!=e?e:[]){const e=null!==(n=null===(i=t.condition)||void 0===i?void 0:i.selector)&&void 0!==n?n:[];t.matched||"result"!==e[0]||"string"!=typeof e[1]||r.add(e[1])}}return r})(i);return r.map(e=>{var i,r;return{flagKey:e,type:_s(e),resolvedVariant:null!==(r=null===(i=t[e])||void 0===i?void 0:i.key)&&void 0!==r?r:null,blocking:!n&&s.has(e)}})},Es=(e,t,i,n)=>{var r;if(e)return;const s=null==n?void 0:n.find(e=>e.blocking);if(s)switch(s.type){case"holdout":return`Held out by "${s.flagKey}"`;case"mutex":return`Mutually excluded by "${s.flagKey}"`;default:return`Prerequisite "${s.flagKey}" = ${null!==(r=s.resolvedVariant)&&void 0!==r?r:"off"}`}return i&&!i.matched?"Audience not matched":t&&"off"!==t?void 0:"No variant assigned"};class ks{constructor(e,t,i={}){this.appliedInjections=new Set,this.appliedMutations={},this.previousUrl=void 0,this.urlExposureCache={},this.flagVariantMap={},this.localFlagKeys=[],this.remoteFlagKeys=[],this.isRemoteBlocking=!1,this.isRedirecting=!1,this.isRunning=!1,this.activePages={},this.behavioralTargetingRules={},this.relayClient=null,this.isVisualEditorMode=!1,this.isDebugActive=!1,this.isPreviewMode=!1,this.previewFlags={},this.preloadedUrlRedirectImpressions=null,this.identityRefreshOnGrant=null;const n=ae();if(!n||!Ge()&&!le())throw new Error("Amplitude Web Experiment Client could not be initialized.");this.globalScope=n,this.apiKey=e,this.initialFlags=JSON.parse(t.initialFlags),this.pageObjects=JSON.parse(t.pageObjects),this.behavioralTargetingRules=t.behavioralTargetingRules?JSON.parse(t.behavioralTargetingRules):{},this.config=Hr(i,this.globalScope),((e,t)=>{void 0!==rt(Pt(e))&&void 0===rt(ut(e))&&At(e,t)})(this.apiKey,this.config.instanceName),Object.keys(this.behavioralTargetingRules).length>0&&(this.behavioralTargetingManager=new sr(this.apiKey,this.behavioralTargetingRules,this.config.rtbtSessionTimeout)),this.initialFlags.forEach(e=>{const{key:t,variants:i,metadata:n={}}=e;this.flagVariantMap[t]={},Object.keys(i).forEach(e=>{this.flagVariantMap[t][e]=(e=>{if(!e)return{};let t;e.metadata&&(t="string"==typeof e.metadata.experimentKey?e.metadata.experimentKey:void 0);const i={};return e.key&&(i.key=e.key),e.value&&(i.value=e.value),e.payload&&(i.payload=e.payload),t&&(i.expKey=t),e.metadata&&(i.metadata=e.metadata),i})(i[e]),this.flagVariantMap[t][e].metadata={deliveryMethod:"web"}}),"local"!==n.evaluationMode&&this.remoteFlagKeys.push(t)});const r=new Set;let s=!0;for(;s;)s=!1,this.initialFlags.forEach(e=>{var t;!this.remoteFlagKeys.includes(e.key)&&(null===(t=e.dependencies)||void 0===t?void 0:t.some(e=>this.remoteFlagKeys.includes(e)))&&(this.remoteFlagKeys.push(e.key),r.add(e.key),s=!0)});const o=JSON.stringify(this.initialFlags);this.experimentClient=_i.initialize(this.apiKey,Object.assign(Object.assign({internalInstanceNameSuffix:"web",internalPersistenceAllowed:()=>!Ge(),initialFlags:o,fetchTimeoutMillis:1e3,pollOnStart:!1,fetchOnStart:!1,automaticExposureTracking:!1},this.config),Ge()&&{internalCacheStorage:new xi}));const a=this.experimentClient.all();this.localFlagKeys=Object.keys(a).filter(e=>{var t,i;return"local"===(null===(i=null===(t=a[e])||void 0===t?void 0:t.metadata)||void 0===i?void 0:i.evaluationMode)&&!r.has(e)}),this.messageBus=new br}start(){return i(this,void 0,void 0,function*(){var e,t,n;if(this.isRunning)return;ns(),rs(this.config.nonce),os();const r=as();let s=!1;try{s=(null===(e=this.globalScope.frameElement)||void 0===e?void 0:e.id)===Ir}catch(e){s=!1}if(s&&Nr())return this.globalScope.ampDomMutator=Qn,void(this.isRunning=!0);if(this.isVisualEditorMode="true"===r[ms]||null!==St("sessionStorage",ht),Er(this.globalScope),this.isDebugActive=kr(),this.subscriptionManager=new Br(this,this.messageBus,this.pageObjects,this.behavioralTargetingManager,Object.assign(Object.assign({},this.config),{isVisualEditorMode:this.isVisualEditorMode,isDebugActive:this.isDebugActive}),this.globalScope),this.setupPreviewMode(r),this.subscriptionManager.initSubscriptions(),this.reconcileRedirectMarkersOnLoad(),this.setupRedirectInteractionReset(),Pr(()=>({flags:this.buildFlagDebugInfo(),visualEditor:{isActive:this.isVisualEditorMode,source:this.isVisualEditorMode?null!==St("sessionStorage",ht)?"session_storage":"url_param":null},currentUrl:this.globalScope.location.href})),this.isVisualEditorMode){const e="true"===r[ms]?"url_param":"session_storage";return Or("ve_mode_detected",`source=${e}`),es()?(Or("opener_check","FAIL: window.opener is null, closed, or inaccessible"),Tr("error"),lr(()=>alert("*Can't connect to this page*\nThe Visual Editor lost its connection to this page and can't make edits here. This is usually a configuration issue on the site.\n---\n\n*Technical Details*\nThis page sends a Cross-Origin-Opener-Policy header that isolates it from the editor window. To resolve this:\n\nRemove the Cross-Origin-Opener-Policy header, or set its value to unsafe-none on pages you want to edit.")),this.globalScope.history.replaceState({},"",ds(this.globalScope.location.href,[ms])),void(this.isRunning=!0)):(Or("opener_check","PASS"),Nr()&&(yield $r(this.globalScope)),ts.setup(this.config.nonce),this.globalScope.history.replaceState({},"",ds(this.globalScope.location.href,[ms])),Or("url_param_removed",`cleaned URL: ${this.globalScope.location.href}`),this.subscriptionManager.markUrlAsPublished(this.globalScope.location.href),this.messageBus.publish("url_change",{updateActivePages:!0}),this.isRunning=!0,void Ns(this))}this.consumeRedirectParamFromUrl(r),this.subscriptionManager.markUrlAsPublished(this.globalScope.location.href),this.messageBus.publish("url_change",{updateActivePages:!0});const o=`EXP_${this.apiKey.slice(0,10)}`,a=St("localStorage",o)||{};a.web_exp_id?a.web_exp_id&&a.device_id&&(delete a.device_id,_t("localStorage",o,a)):(a.web_exp_id=a.device_id||gs(),delete a.device_id,_t("localStorage",o,a));const l=lt({domain:it(this.globalScope.location.hostname),sameSite:"Lax",expirationDays:365}),c=`${o}_DEFAULT_USER_PROVIDER`,u=St("localStorage",c)||{},d=yield nt(l,ut(this.apiKey),{web_exp_id_v2:null!==(t=a.web_exp_id_v2)&&void 0!==t?t:a.web_exp_id,first_seen:u.first_seen},{web_exp_id_v2:gs,first_seen:()=>(Date.now()/1e3).toString()});if(a.web_exp_id_v2=d.web_exp_id_v2,_t("localStorage",o,a),d.first_seen!==u.first_seen&&(u.first_seen=d.first_seen,_t("localStorage",c,u)),a.first_seen=d.first_seen,He()){const e=a.web_exp_id_v2,t=a.first_seen;this.identityRefreshOnGrant=new Promise(n=>{Je(r=>{r?(()=>{i(this,void 0,void 0,function*(){var i,r,s,u;try{const n=St("localStorage",o)||{},d=St("localStorage",c)||{},h=yield nt(l,ut(this.apiKey),{web_exp_id_v2:null!==(i=n.web_exp_id_v2)&&void 0!==i?i:a.web_exp_id_v2,first_seen:null!==(r=d.first_seen)&&void 0!==r?r:a.first_seen},{web_exp_id_v2:gs,first_seen:()=>(Date.now()/1e3).toString()}),g=Object.assign({},h);if(n.web_exp_id_v2&&h.web_exp_id_v2===e&&n.web_exp_id_v2!==e&&(g.web_exp_id_v2=n.web_exp_id_v2),d.first_seen&&h.first_seen===t&&d.first_seen!==t&&(g.first_seen=d.first_seen),g.web_exp_id_v2!==h.web_exp_id_v2||g.first_seen!==h.first_seen)try{yield l.set(ut(this.apiKey),JSON.stringify(g))}catch(e){}a.web_exp_id=null!==(s=n.web_exp_id)&&void 0!==s?s:a.web_exp_id,a.web_exp_id_v2=g.web_exp_id_v2,a.first_seen=g.first_seen;const v=Object.assign(Object.assign({},null!==(u=this.experimentClient.getUser())&&void 0!==u?u:{}),{web_exp_id:a.web_exp_id,web_exp_id_v2:a.web_exp_id_v2,first_seen:a.first_seen});this.experimentClient.setUser(v)}catch(e){}finally{n()}})})():n()})})}this.experimentClient.setUser(a);const h=this.getVariants();for(const[e,t]of Object.entries(h))this.remoteFlagKeys.includes(e)&&(null===(n=t.metadata)||void 0===n?void 0:n.blockingEvaluation)&&Object.keys(this.activePages).includes(e)&&!this.remoteFlagKeys.every(e=>Object.keys(this.previewFlags).includes(e))&&(this.isRemoteBlocking=!0,qr());const g=yield zr(this.apiKey,a);if(!this.globalScope.experimentIntegration){const e=De.getInstance("$default_instance");this.globalScope.experimentIntegration=new Lt(this.apiKey,e,1e3)}this.globalScope.experimentIntegration.type="integration",ze.required&&function(e){const t=e;if(t[dr])return;const i=new hr(e.track.bind(e));gr.push(i),e.track=e=>i.track(e),Object.defineProperty(t,dr,{value:!0})}(this.globalScope.experimentIntegration),this.experimentClient.addPlugin(this.globalScope.experimentIntegration),this.experimentClient.setUser(g),this.updateUserWithBehaviors(),this.fireStoredRedirectImpressions().catch(()=>{}),this.messageBus.subscribe("url_change",()=>{this.isRedirecting&&(this.isRedirecting=!1,Wr()),this.fireStoredRedirectImpressions().catch(()=>{})});if(this.initialFlags.some(e=>e.key.startsWith("holdout-")||e.key.startsWith("mutex-"))&&(yield this.experimentClient.integrationManager.ready()),yield this.applyVariants({flagKeys:this.localFlagKeys}),yield this.previewVariants({keyToVariant:this.previewFlags}),this.isRemoteBlocking||this.isRedirecting||Wr(),this.isRedirecting||this.remoteFlagKeys.every(e=>Object.keys(this.previewFlags).includes(e)))return this.scheduleRelaySync(g),this.isRunning=!0,void Ns(this);yield this.fetchRemoteFlags(),yield this.applyVariants({flagKeys:this.remoteFlagKeys}),this.scheduleRelaySync(g),this.isRunning=!0,Ns(this)})}static getInstance(e,t,i={}){const n=ae();if(!n)throw new Error("Amplitude Web Experiment Client could not be initialized.");if(n.webExperiment&&!n.webExperiment.isStub){const e=n.webExperiment;return e.isRunning&&Ns(e),e}const r=new ks(e,t,i);return n.webExperiment=r,r}getExperimentClient(){return this.experimentClient}hideLoadingIndicator(){Yr()}applyVariants(e){return i(this,void 0,void 0,function*(){var t,i;const{flagKeys:n}=e||{},r=this.getVariants();if(0===Object.keys(r).length)return;const s=ls(this.globalScope.location.href);(null===(t=this.urlExposureCache)||void 0===t?void 0:t[s])||(this.urlExposureCache={},this.urlExposureCache[s]={}),yield this.fireStoredRedirectImpressions().catch(()=>{});for(const e in r){if(n&&!n.includes(e)||this.previewFlags[e])continue;const t=r[e],s=t.key||"";if(this.appliedMutations[e]){const t=Object.keys(this.appliedMutations[e]);t.length>0&&!t.includes(s)&&(this.revertVariants({flagKeys:[e]}),delete this.appliedMutations[e])}if("web"===(null===(i=t.metadata)||void 0===i?void 0:i.deliveryMethod)){const i=Array.isArray(t.payload);if(("off"===t.key||"control"===t.key)&&(this.isActionActiveOnPage(e,void 0)&&this.exposureWithDedupe(e,t),"off"===t.key)){this.revertVariants({flagKeys:[e]});continue}i&&(yield this.handleVariantAction(e,t))}}})}revertVariants(e){var t,i;if(!this.appliedMutations)return;let{flagKeys:n}=e||{};n||(n=Object.keys(this.appliedMutations));for(const e of n){const n=this.appliedMutations[e];if(n){for(const e in n){const r=n[e];if(r)for(const e in r)for(const n in r[e])null===(i=null===(t=r[e][n])||void 0===t?void 0:t.revert)||void 0===i||i.call(t)}delete this.appliedMutations[e]}}}previewVariants(e){return i(this,void 0,void 0,function*(){const{keyToVariant:t}=e;if(t){this.revertVariants({flagKeys:Object.keys(t)});for(const e in t){const i=t[e],n=this.flagVariantMap[e];if(!n)continue;const r=n[i];if(!r)continue;this.isPreviewMode&&mr({flags:this.previewFlags});const s=r.payload;s&&Array.isArray(s)?yield this.handleVariantAction(e,r):this.isActionActiveOnPage(e,void 0)&&this.exposureWithDedupe(e,r)}}})}getVariants(){const e={};for(const t of[...this.localFlagKeys,...this.remoteFlagKeys])e[t]=this.experimentClient.variant(t);return e}getActiveExperiments(){return Object.keys(this.appliedMutations)}getActivePages(){return this.activePages}addPageChangeSubscriber(e){if(this.subscriptionManager)return this.subscriptionManager.addPageChangeSubscriber(e)}scheduleRelaySync(e){var t;if(!this.behavioralTargetingManager||this.isVisualEditorMode)return;const n=null!==(t=e.web_exp_id_v2)&&void 0!==t?t:e.web_exp_id;if(!n)return;if(Ge())return void(He()&&Je(t=>{t&&(()=>{i(this,void 0,void 0,function*(){yield this.identityRefreshOnGrant,this.scheduleRelaySync(Object.assign(Object.assign({},e),this.experimentClient.getUser()))})})()}));const r=new ur(this.apiKey,n,(s=this.apiKey,o=this.config.serverZone,(a=this.config.relayUrl)?`${a.replace(/\/+$/,"")}/script/${s}.relay.html`:`https://${"EU"===o?"cdn.eu.amplitude.com":"cdn.amplitude.com"}/script/${s}.relay.html`));var s,o,a;this.relayClient=r,ze.required&&Je(e=>{e||this.teardownRelay(r)}),this.behavioralTargetingManager.beginRelaySync(r).then(e=>{var t;if("unavailable"!==e.status&&"sync_failed"!==e.status)return null===(t=this.behavioralTargetingManager)||void 0===t||t.setRelayClient(r),"behaviors_changed"===e.status?this.reapplyVariantsAfterRelaySync(!0).catch(e=>{console.warn("Experiment relay variant re-apply failed:",e)}):void 0;this.teardownRelay(r)}).catch(()=>{this.teardownRelay(r)})}teardownRelay(e){var t;e.destroy(),this.relayClient=null,null===(t=this.behavioralTargetingManager)||void 0===t||t.setRelayClient(null)}reapplyVariantsAfterRelaySync(e){return i(this,void 0,void 0,function*(){if(!e||!this.behavioralTargetingManager)return;this.updateUserWithBehaviors();const t=Object.keys(this.behavioralTargetingRules).filter(e=>!this.previewFlags[e]),i=t.filter(e=>this.localFlagKeys.includes(e)),n=t.filter(e=>this.remoteFlagKeys.includes(e));i.length>0&&(yield this.applyVariants({flagKeys:i})),n.length>0&&(yield this.fetchRemoteFlags(),yield this.applyVariants({flagKeys:n}))})}updateUserWithBehaviors(){if(!this.behavioralTargetingManager)return;const e=[];for(const t of this.behavioralTargetingManager.getMatchedBehaviors().values())e.push(...t);const t=this.experimentClient.getUser(),i=Object.assign(Object.assign({},t),{behavioral_targeting:e});this.experimentClient.setUser(i)}setPageObjects(e){var t,i;this.isVisualEditorMode&&(this.pageObjects=e,null===(t=this.subscriptionManager)||void 0===t||t.setPageObjects(e),this.activePages={},this.messageBus.unsubscribeAll(),null===(i=this.subscriptionManager)||void 0===i||i.initSubscriptions(),this.messageBus.publish("url_change",{updateActivePages:!0}))}setRedirectHandler(e){this.customRedirectHandler=e}toggleManualPageObject(e,t=!0){var i;null===(i=this.subscriptionManager)||void 0===i||i.toggleManualPageObject(e,t)}getDebugState(){return Cr()}buildFlagDebugInfo(){var e,t,i,n;const r={},s=this.getVariants(),o=null!==(t=null===(e=this.subscriptionManager)||void 0===e?void 0:e.getDebugPageObjects())&&void 0!==t?t:{},a={};for(const e of this.initialFlags)a[e.key]=e;const l=this.localFlagKeys.length>0?this.experimentClient.getEvaluationTraces(this.localFlagKeys):void 0;for(const e of[...this.localFlagKeys,...this.remoteFlagKeys]){const t=s[e],c=this.activePages[e],u=a[e];let d;const h=null==l?void 0:l[e];h?d={matched:h.matched,matchedSegment:h.matchedSegment,steps:h.steps}:(null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.segmentName)&&(d={matched:!0,matchedSegment:t.metadata.segmentName,steps:[]});const g=!!(null==t?void 0:t.key)&&"off"!==t.key,v=xs(u,s,h,g),f=Es(g,null==t?void 0:t.key,d,v);r[e]={flagKey:e,variant:(null==t?void 0:t.key)?{key:t.key,value:t.value,metadata:t.metadata}:null,isActive:!!c&&Object.keys(c).length>0,audienceEvaluation:d,pageObjects:null!==(n=o[e])&&void 0!==n?n:[],flagMetadata:null==u?void 0:u.metadata,dependencies:v,inactiveReason:f}}return r}addDebugStateSubscriber(e){if(this.subscriptionManager)return this.subscriptionManager.addDebugStateSubscriber(e)}setConsentStatus(e){As(e)}plugin(){return{name:"@amplitude/experiment-tag",type:"enrichment",setup:()=>i(this,void 0,void 0,function*(){}),execute:e=>i(this,void 0,void 0,function*(){return this.trackEvent(e.event_type,e.event_properties),e})}}trackEvent(e,t){var i;null===(i=this.behavioralTargetingManager)||void 0===i||i.trackEvent(e,t||{}),this.messageBus.publish("analytics_event",{event:e,properties:t||{}})}fetchRemoteFlags(){return i(this,void 0,void 0,function*(){try{yield this.experimentClient.doFlags()}catch(e){console.warn("Error fetching remote flags:",e)}})}handleVariantAction(e,t){return i(this,void 0,void 0,function*(){for(const i of t.payload)"redirect"===i.action?yield this.handleRedirect(i,e,t):i.action===vs?this.handleMutate(i,e,t):i.action===fs&&this.handleInject(i,e,t)})}handleRedirect(e,t,n){return i(this,void 0,void 0,function*(){var r,s,o,a;if(this.isRedirecting)return;if(this.isRedirectSuppressed(t))return;if(!this.isActionActiveOnPage(t,null===(s=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.metadata)||void 0===s?void 0:s.scope))return;const l=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.url;let c=((e,t)=>{const i=new URL(e),n=new URL(t),r=new URL(t);return i.searchParams.forEach((e,t)=>{n.searchParams.has(t)||r.searchParams.append(t,e)}),r.toString()})(this.globalScope.location.href,l);if(this.isAtDestination(c))return;const u=this.getRedirectMarkers()[t];if(u&&this.markerBackAtSource(this.globalScope.location.href,u))return this.suppressRedirect(t,`channel=soft from=${u.from} to=${u.target}`),void this.clearRedirectMarker(t);const d=c;this.isRedirecting=!0;const h=(()=>{try{return new URL(c).hostname!==this.globalScope.location.hostname}catch(e){return!1}})();if(yield this.storeRedirectImpressions(t,n,l,h),(null===(a=this.config.redirectConfig)||void 0===a?void 0:a.encodeRedirectInUrl)&&h||He()){const e=new URL(c);let i={};const r=e.searchParams.get(bs);if(r)try{i=JSON.parse(atob(r))}catch(e){console.error("Failed to decode existing AMP_REDIRECT param:",e)}i[t]=Object.assign(Object.assign({redirectUrl:l,variantKey:n.key||""},void 0!==n.expKey?{expKey:n.expKey}:{}),void 0!==n.metadata?{metadata:n.metadata}:{}),e.searchParams.set(bs,btoa(JSON.stringify(i))),c=e.toString()}const g=this.globalScope.location.href;this.writeRedirectMarker(t,{from:g,target:d,distinguishingParams:ws(g,d),landed:!1}),this.previousUrl=g;try{if(yield function(e,t){return i(this,void 0,void 0,function*(){const i=lt({domain:it(t),sameSite:"Lax"}),n=new Fe,r=`AMP_${Ce}_ORIGINAL_${e.substring(0,10)}`,s=yield n.parse();yield i.set(r,s)})}(this.apiKey,this.globalScope.location.hostname),this.customRedirectHandler)return void this.customRedirectHandler(c);this.globalScope.location.replace(c)}catch(e){throw this.clearRedirectMarker(t),this.isRedirecting=!1,e}})}isAtDestination(e){const t=this.globalScope.location.href;if(t===e)return!0;try{if(new URL(e).hash)return!1}catch(e){return!1}return us(t)===us(e)}redirectMarkerStorageKey(){return`EXP_${this.apiKey.slice(0,10)}_REDIRECT_MARKER`}redirectSuppressStorageKey(){return`EXP_${this.apiKey.slice(0,10)}_REDIRECT_SUPPRESSED`}getRedirectMarkers(){return St("sessionStorage",this.redirectMarkerStorageKey())||{}}writeRedirectMarker(e,t){const i=this.getRedirectMarkers();i[e]=t,_t("sessionStorage",this.redirectMarkerStorageKey(),i)}clearRedirectMarker(e){const t=this.getRedirectMarkers();e in t&&(delete t[e],_t("sessionStorage",this.redirectMarkerStorageKey(),t))}isRedirectSuppressed(e){return(St("sessionStorage",this.redirectSuppressStorageKey())||[]).includes(e)}suppressRedirect(e,t){const i=St("sessionStorage",this.redirectSuppressStorageKey())||[];i.includes(e)||(i.push(e),_t("sessionStorage",this.redirectSuppressStorageKey(),i));const n=`flag=${e} ${t}`;console.warn(`[Experiment] redirect loop detected, suppressing for session: ${n}`),Or("redirect_loop_detected",n)}markerMatchesTarget(e,t){try{if(cs(e)!==cs(t.target))return!1;const i=new URL(e).searchParams,n=new URL(t.target).searchParams;return t.distinguishingParams.every(e=>i.get(e)===n.get(e))}catch(e){return!1}}markerBackAtSource(e,t){try{if(cs(e)!==cs(t.from))return!1;if(0===t.distinguishingParams.length)return!0;const i=new URL(e).searchParams,n=new URL(t.target).searchParams;return t.distinguishingParams.some(e=>i.get(e)!==n.get(e))}catch(e){return!1}}reconcileRedirectMarkersOnLoad(){const e=this.getRedirectMarkers();if(0===Object.keys(e).length)return;const t=this.globalScope.location.href;for(const i of Object.keys(e)){const n=e[i];this.markerMatchesTarget(t,n)?n.landed?delete e[i]:n.landed=!0:this.markerBackAtSource(t,n)?(n.landed||this.suppressRedirect(i,`channel=hard from=${n.from} to=${n.target}`),delete e[i]):delete e[i]}_t("sessionStorage",this.redirectMarkerStorageKey(),e)}setupRedirectInteractionReset(){var e;if("function"!=typeof(null===(e=this.globalScope)||void 0===e?void 0:e.addEventListener))return;const t=()=>_t("sessionStorage",this.redirectMarkerStorageKey(),{});for(const e of ys)this.globalScope.addEventListener(e,t,{capture:!0,passive:!0})}handleMutate(e,t,i){var n,r,s,o,a;const l=(null===(n=e.data)||void 0===n?void 0:n.mutations)||[],c=i.key||"";if(0===l.length)return;const u={};l.forEach((e,n)=>{var r,s,o,a,l,d,h,g,v,f,p;this.isActionActiveOnPage(t,null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.scope)?(this.exposureWithDedupe(t,i),(null===(p=null===(f=null===(v=this.appliedMutations[t])||void 0===v?void 0:v[c])||void 0===f?void 0:f[vs])||void 0===p?void 0:p[n])||(u[n]=Gn.declarative(e))):(null===(a=null===(o=null===(s=this.appliedMutations[t])||void 0===s?void 0:s[c])||void 0===o?void 0:o[vs])||void 0===a?void 0:a[n])&&(null===(g=null===(h=null===(d=null===(l=this.appliedMutations[t])||void 0===l?void 0:l[c])||void 0===d?void 0:d[vs])||void 0===h?void 0:h[n])||void 0===g||g.revert(),delete this.appliedMutations[t][c][vs][n])}),null!==(r=(o=this.appliedMutations)[t])&&void 0!==r||(o[t]={}),null!==(s=(a=this.appliedMutations[t])[c])&&void 0!==s||(a[c]={}),this.appliedMutations[t][c][vs]=Object.assign(Object.assign({},this.appliedMutations[t][c][vs]),u),0===Object.keys(this.appliedMutations[t][c][vs]||{}).length&&delete this.appliedMutations[t][c][vs],0===Object.keys(this.appliedMutations[t][c]||{}).length&&delete this.appliedMutations[t]}handleInject(e,t,i){var n,r,s,o,a,l,c,u,d,h,g,v,f;const p=i.key||"";if(!this.isActionActiveOnPage(t,null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.scope))return void(null===(a=null===(o=null===(s=null===(r=this.appliedMutations[t])||void 0===r?void 0:r[p])||void 0===s?void 0:s[fs])||void 0===o?void 0:o[0])||void 0===a||a.revert());const m=e.data.id;if(!m||"string"!=typeof m||0===m.length)return;const b=m.replace(/-/g,"");if(this.appliedInjections.has(b))return;const y=e.data.js;let w;if(y&&(w=this.globalScope.document.createElement("script"),w)){const e=`function ${b}(html, utils, id){${y}};`;w.textContent=e,w.id=`js-${b}`,this.globalScope.document.head.appendChild(w)}const S=e.data.css;let _;S&&(_=vr(this.globalScope.document,S));const x=e.data.html;let E;x&&(E=null!==(l=(new DOMParser).parseFromString(x,"text/html").body.firstElementChild)&&void 0!==l?l:void 0);const k={cancelled:!1},O=Gr(k);this.appliedInjections.add(b);try{const e=this.globalScope[b];e&&"function"==typeof e&&e(E,O,b)}catch(e){null==w||w.remove(),console.error(`Experiment inject failed for ${t} variant ${null!==(c=i.key)&&void 0!==c?c:""}. Reason:`,e)}null!==(u=(g=this.appliedMutations)[t])&&void 0!==u||(g[t]={}),null!==(d=(v=this.appliedMutations[t])[p])&&void 0!==d||(v[p]={}),null!==(h=(f=this.appliedMutations[t][p])[fs])&&void 0!==h||(f[fs]={}),this.appliedMutations[t][p][fs][b]={revert:()=>{var e;k.cancelled=!0,null===(e=O.remove)||void 0===e||e.call(O),null==_||_.revert(),null==w||w.remove(),this.appliedInjections.delete(b)}},this.exposureWithDedupe(t,i)}exposureWithDedupe(e,t,i){var n,r,s,o;const a=ls(this.globalScope.location.href);if(!((null===(r=null===(n=this.urlExposureCache)||void 0===n?void 0:n[a])||void 0===r?void 0:r[e])===t.key)){if(i||this.previewFlags[e]){const i={variant:t,source:"local-evaluation",hasDefaultVariant:!1};this.experimentClient.exposureInternal(e,i)}else this.experimentClient.exposure(e);(null!==(s=(o=this.urlExposureCache)[a])&&void 0!==s?s:o[a]={})[e]=t.key}}updateActivePages(e,t,i){this.activePages[e]||(this.activePages[e]={}),i?this.activePages[e][t.id]=t:(delete this.activePages[e][t.id],0===Object.keys(this.activePages[e]).length&&delete this.activePages[e])}isActionActiveOnPage(e,t){const i=this.activePages[e];return t?t.some(e=>{var t;return null!==(t=null==i?void 0:i[e])&&void 0!==t&&t}):!!i&&Object.values(i).some(Boolean)}storeRedirectImpressions(e,t,n,r){return i(this,void 0,void 0,function*(){var i;const s=`EXP_${this.apiKey.slice(0,10)}_REDIRECT`,o=Object.assign(Object.assign({redirectUrl:n,variantKey:t.key||""},void 0!==t.expKey?{expKey:t.expKey}:{}),void 0!==t.metadata?{metadata:t.metadata}:{}),a=St("sessionStorage",s)||{};if(a[e]=o,_t("sessionStorage",s,a),(null===(i=this.config.redirectConfig)||void 0===i?void 0:i.encodeRedirectInCookie)&&r){const t=lt({domain:it(this.globalScope.location.hostname),sameSite:"Lax",expirationDays:1/1440});try{const i=(yield t.get(s))||{};i[e]=o,yield t.set(s,i)}catch(t){console.error(`Failed to store redirect impression in cookie for ${e}:`,t)}}})}consumeRedirectParamFromUrl(e){var t,i;const n=e[bs];if(!n)return;if(!(null===(t=this.config.redirectConfig)||void 0===t?void 0:t.encodeRedirectInUrl)&&!ze.required)return;try{this.preloadedUrlRedirectImpressions=JSON.parse(atob(n))}catch(e){this.preloadedUrlRedirectImpressions={}}const r=ds(this.globalScope.location.href,[bs]);null===(i=this.subscriptionManager)||void 0===i||i.markUrlAsPublished(r),this.globalScope.history.replaceState({},"",r)}fireStoredRedirectImpressions(){return i(this,void 0,void 0,function*(){var e,t,n,r;const s=`EXP_${this.apiKey.slice(0,10)}_REDIRECT`;let o=null!==(e=this.preloadedUrlRedirectImpressions)&&void 0!==e?e:{};if(this.preloadedUrlRedirectImpressions=null,0===Object.keys(o).length&&((null===(t=this.config.redirectConfig)||void 0===t?void 0:t.encodeRedirectInUrl)||ze.required)){const e=as()[bs];if(e){try{o=JSON.parse(atob(e))}catch(e){}const t=ds(this.globalScope.location.href,[bs]);null===(n=this.subscriptionManager)||void 0===n||n.markUrlAsPublished(t),this.globalScope.history.replaceState({},"",t)}}const a=St("sessionStorage",s)||{};let l,c={};if(null===(r=this.config.redirectConfig)||void 0===r?void 0:r.encodeRedirectInCookie){l=lt({domain:it(this.globalScope.location.hostname),sameSite:"Lax"});try{c=(yield l.get(s))||{}}catch(e){console.error(`Failed to retrieve redirect impressions from cookie ${s}:`,e)}}const u=Object.assign(Object.assign(Object.assign({},c),a),o);if(0===Object.keys(u).length)return;const d=ls(this.globalScope.location.href);for(const e in u){const{redirectUrl:t,variantKey:i,expKey:n,metadata:r}=u[e];hs([d],ls(t))&&(this.exposureWithDedupe(e,{key:i,expKey:n,metadata:r},!0),delete u[e])}const h=()=>i(this,void 0,void 0,function*(){if(Ot("sessionStorage",s),l)try{yield l.remove(s)}catch(e){console.error(`Failed to remove redirect impressions from cookie ${s}:`,e)}});Object.keys(u).length>0?this.globalScope.setTimeout(()=>{(()=>{i(this,void 0,void 0,function*(){for(const e in u){const{variantKey:t,expKey:i,metadata:n}=u[e];this.exposureWithDedupe(e,{key:t,expKey:i,metadata:n},!0)}yield h()})})()},500):yield h()})}setupPreviewMode(e){if("true"===e[ps]){Object.keys(e).forEach(t=>{t!==ps&&e[t]&&(this.previewFlags[t]=e[t])}),_t("sessionStorage",dt,{previewFlags:this.previewFlags});const t=[...Object.keys(this.previewFlags),ps];this.globalScope.history.replaceState({},"",ds(this.globalScope.location.href,t)),ts.setup(this.config.nonce)}else{const e=St("sessionStorage",dt);e&&(this.previewFlags=e.previewFlags)}Object.keys(this.previewFlags).length>0&&(this.isPreviewMode=!0)}}const Os=de()||function(e,t){return t=t||{},new Promise(function(i,n){var r=new XMLHttpRequest,s=[],o=[],a={},l=function(){return{ok:2==(r.status/100|0),statusText:r.statusText,status:r.status,url:r.responseURL,text:function(){return Promise.resolve(r.responseText)},json:function(){return Promise.resolve(JSON.parse(r.responseText))},blob:function(){return Promise.resolve(new Blob([r.response]))},clone:l,headers:{keys:function(){return s},entries:function(){return o},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in r.open(t.method||"get",e,!0),r.onload=function(){r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,i){s.push(t=t.toLowerCase()),o.push([t,i]),a[t]=a[t]?a[t]+","+i:i}),i(l())},r.onerror=n,r.withCredentials="include"==t.credentials,t.headers)r.setRequestHeader(c,t.headers[c]);r.send(t.body||null)})},Ts={request:(e,t,n,r,s)=>i(void 0,void 0,void 0,function*(){return o=i(void 0,void 0,void 0,function*(){const i=yield Os(e,{method:t,headers:n,body:r});return{status:i.status,body:yield i.text()}}),!(a=s)||a<=0?o:Promise.race([o,new Promise((e,t)=>setTimeout(()=>t(new re(`Timeout after ${a}ms`)),a))]);var o,a})};class Ps{constructor(e,t,i){this.deploymentKey=e,this.serverUrl=t,this.httpClient=i}getPreviewFlagsAndPageViewObjects(){return i(this,void 0,void 0,function*(){const e={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-Library":"experiment-tag/0.29.2"},t=yield this.httpClient.request(`${this.serverUrl}/web/v1/configs`,"GET",e,null,1e4);if(200!=t.status)throw Error(`Preview error response: status=${t.status}`);const i=JSON.parse(t.body);return{flags:i.flags,pageViewObjects:i.pageObjects,behavioralTargetingRules:i.behavioralTargetingRules}})}}const Cs=[],As=e=>{const t=We(e);if(null===t)return void console.warn(`[experiment-tag] Invalid setConsentStatus ${JSON.stringify(e)}; expected 'granted', 'pending', or 'denied'. Ignoring.`);ze.manager.setStatus(t);const i=ze.deferredStart;"granted"===ze.manager.getStatus()&&i&&!ze.started&&(ze.deferredStart=null,Ms(i.apiKey,i.initConfigs,i.config))},Ms=(e,t,i)=>{var n;ze.started=!0;const r=ae();(()=>{if("true"===as()[ps])return!0;const e=St("sessionStorage",dt);return!!((null==e?void 0:e.previewFlags)&&Object.keys(e.previewFlags).length>0)})()||(null===(n=null==r?void 0:r.WebExperiment)||void 0===n?void 0:n.injectedByExtension)?(qr(),Is(e,i.serverZone).then(t=>{const n=JSON.stringify(t.flags),r=JSON.stringify(t.pageViewObjects),s=JSON.stringify(t.behavioralTargetingRules);return Rs(e,{initialFlags:n,pageObjects:r,behavioralTargetingRules:s},i)}).catch(n=>(console.warn("Failed to fetch latest configs for preview:",n),Rs(e,t,i)))):Rs(e,t,i)},Rs=(e,t,i)=>{const n=ks.getInstance(e,t,i);return n.start().finally(()=>{n.isRedirecting||Wr()})},Is=(e,t)=>i(void 0,void 0,void 0,function*(){return new Ps(e,"EU"===t?"https://api.lab.eu.amplitude.com":"https://api.lab.amplitude.com",Ts).getPreviewFlagsAndPageViewObjects()}),js=()=>({name:"@amplitude/experiment-tag",type:"enrichment",execute:e=>i(void 0,void 0,void 0,function*(){const t=ae(),i=null==t?void 0:t.webExperiment;var n;return i&&"function"==typeof i.trackEvent&&i.isRunning?i.trackEvent(e.event_type,e.event_properties):(null===ze.deferredStart||ze.started)&&(n={event_type:e.event_type,event_properties:e.event_properties},Cs.length>=500&&Cs.shift(),Cs.push(n)),e})}),Ns=e=>{Cs.length>0&&(Cs.forEach(({event_type:t,event_properties:i})=>{e.trackEvent(t,i)}),Cs.length=0)};e.createPlugin=js,e.flushEventBuffer=Ns,e.initialize=(e,t,i)=>{const n=ae();if(!n)throw new Error("Global scope not available");if(n.webExperiment||(n.webExperiment={plugin:js,isStub:!0,setConsentStatus:As}),ze.started)return;const r=Hr(i,n),s=r.consentOptions,o=s.consentRequired||null!==ze.deferredStart;if(ze.required=ze.required||o,o){if(!ze.manager.hasExplicitStatus()){const e=We(s.consentStatus);void 0!==s.consentStatus&&null===e&&console.warn(`[experiment-tag] Invalid consentOptions.consentStatus ${JSON.stringify(s.consentStatus)}; expected 'granted', 'pending', or 'denied'. Treating as pending.`),ze.manager.seedFromConfig(null!=e?e:"pending")}return Mt(e,r.instanceName),"denied"===ze.manager.getStatus()?(ze.deferredStart={apiKey:e,initConfigs:t,config:i},Cs.length=0,void(()=>{const e=ae();e&&as()[bs]&&e.history.replaceState({},"",ds(e.location.href,[bs]))})()):(ze.deferredStart=null,void Ms(e,t,i))}Ms(e,t,i)},e.setConsentStatus=As,Object.defineProperty(e,"__esModule",{value:!0})}(this.WebExperiment=this.WebExperiment||{}); 'use strict';(function(f){(()=>{try{"function"===typeof window.WebExperiment.initialize?(window.WebExperiment.initialize("1dd4f5b0d60b5997b33e31736230fe60",{initialFlags:"[{\x22key\x22:\x22exp\-es\-ag\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:5,\x22testInstrumentation\x22:true,\x22urlMatch\x22:[\x22https:\/\/www.alegra.com\/es\/gestion\/\x22]},\x22segments\x22:[{\x22metadata\x22:{\x22segmentName\x22:\x22default\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x222\x22:{\x22key\x22:\x222\x22,\x22payload\x22:[{\x22action\x22:\x22redirect\x22,\x22data\x22:{\x22metadata\x22:{\x22scope\x22:[\x22102edb41\-48ba\-4823\-80a0\-71ee81f49ec5\x22]},\x22url\x22:\x22https:\/\/www.alegra.com\/es\/gestion\/2\x22}}],\x22value\x22:\x222\x22},\x22control\x22:{\x22key\x22:\x22control\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[]}}],\x22value\x22:\x22control\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}}}},{\x22key\x22:\x22test\-hero\-creating\-triggers\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:12,\x22testInstrumentation\x22:true,\x22urlMatch\x22:[\x22https:\/\/almost\-www.alegra.com\/rdominicana\/\x22]},\x22segments\x22:[{\x22metadata\x22:{\x22segmentName\x22:\x22default\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[]}}],\x22value\x22:\x22control\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}},\x22variant\-b\x22:{\x22key\x22:\x22variant\-b\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[{\x22action\x22:\x22append\x22,\x22attribute\x22:\x22style\x22,\x22metadata\x22:{\x22scope\x22:[\x22fac38dd4\-4444\-46db\-b383\-3bfcece3781c\x22],\x22type\x22:\x22display\x22},\x22selector\x22:\x22.hero\-variant\-a\x22,\x22value\x22:\x22;display:none !important\x22},{\x22action\x22:\x22append\x22,\x22attribute\x22:\x22style\x22,\x22metadata\x22:{\x22scope\x22:[\x22fac38dd4\-4444\-46db\-b383\-3bfcece3781c\x22],\x22type\x22:\x22display\x22},\x22selector\x22:\x22.hero\-variant\-b\x22,\x22value\x22:\x22;display:flex !important\x22},{\x22action\x22:\x22append\x22,\x22attribute\x22:\x22style\x22,\x22metadata\x22:{\x22scope\x22:[\x22fac38dd4\-4444\-46db\-b383\-3bfcece3781c\x22],\x22type\x22:\x22visibility\x22},\x22selector\x22:\x22.hero\-variant\-a\x22,\x22value\x22:\x22;visibility:hidden !important\x22}]}}],\x22value\x22:\x22variant\-b\x22}}},{\x22key\x22:\x22test\-a\-b\-register\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:3,\x22testInstrumentation\x22:true,\x22urlMatch\x22:[\x22https:\/\/app.alegra.com\/user\/register\/country\/colombia\x22]},\x22segments\x22:[{\x22metadata\x22:{\x22segmentName\x22:\x22default\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22value\x22:\x22control\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}},\x22treatment\x22:{\x22key\x22:\x22treatment\x22,\x22payload\x22:[{\x22action\x22:\x22redirect\x22,\x22data\x22:{\x22metadata\x22:{},\x22url\x22:\x22https:\/\/app.alegra.com\/user\/register\/exp1\x22}}],\x22value\x22:\x22treatment\x22}}},{\x22key\x22:\x22dom\-or\-header\-contabilidad\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:7,\x22urlMatch\x22:[]},\x22segments\x22:[{\x22bucket\x22:{\x22allocations\x22:[{\x22distributions\x22:[{\x22range\x22:[0,21474837],\x22variant\x22:\x22control\x22},{\x22range\x22:[21474836,42949673],\x22variant\x22:\x22header\x22}],\x22range\x22:[0,100]}],\x22salt\x22:\x22ouCxsyVt\x22,\x22selector\x22:[\x22context\x22,\x22user\x22,\x22web_exp_id_v2\x22]},\x22metadata\x22:{\x22segmentName\x22:\x22All Other Users\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[]}}],\x22value\x22:\x22control\x22},\x22header\x22:{\x22key\x22:\x22header\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b640bca9\-59e2\-426f\-ad98\-f3444085c9c9\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.heading\-1:nth\-child(3)\x22,\x22value\x22:\x22Centraliza la contabilidad de tus clientes sin multiplicar el trabajo<\/span>\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b640bca9\-59e2\-426f\-ad98\-f3444085c9c9\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.v0\-hi__description\x22,\x22value\x22:\x22Hasta 70% menos tiempo en lo operativo: tú asesoras; Alegra digita, recibe e\-CF y arma los reportes DGII.
\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b640bca9\-59e2\-426f\-ad98\-f3444085c9c9\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22#alegra\-btn\-77ea97zf > span\x22,\x22value\x22:\x22Prueba gratis 15 días\x22}]}}],\x22value\x22:\x22header\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}}}},{\x22key\x22:\x22cri\-or\-icp\-menu\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:13,\x22urlMatch\x22:[]},\x22segments\x22:[{\x22bucket\x22:{\x22allocations\x22:[{\x22distributions\x22:[{\x22range\x22:[0,21474837],\x22variant\x22:\x22control\x22},{\x22range\x22:[21474836,42949673],\x22variant\x22:\x22menu_icp\x22}],\x22range\x22:[0,100]}],\x22salt\x22:\x22Qs3LM5eO\x22,\x22selector\x22:[\x22context\x22,\x22user\x22,\x22web_exp_id_v2\x22]},\x22metadata\x22:{\x22segmentName\x22:\x22All Other Users\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[]}}],\x22value\x22:\x22control\x22},\x22menu_icp\x22:{\x22key\x22:\x22menu_icp\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-list > .dropdown\-resources\-\-container:first\-child a[href=\\\x22\/costarica\/facturacion\-electronica\/\\\x22] p.text\-sm\x22,\x22value\x22:\x22Para su negocio\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-list > .dropdown\-resources\-\-container:first\-child a[href=\\\x22\/costarica\/contabilidad\/\\\x22] p.text\-sm\x22,\x22value\x22:\x22Para usted contador\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-list > .dropdown\-resources\-\-container:first\-child a[href=\\\x22\/costarica\/erp\/\\\x22] p.text\-sm\x22,\x22value\x22:\x22Para su empresa en crecimiento\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-list > .dropdown\-resources\-\-container:first\-child a[href=\\\x22\/costarica\/facturacion\-electronica\/\\\x22] p.text\-xs\x22,\x22value\x22:\x22Facturación y control sin enredos.\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-list > .dropdown\-resources\-\-container:first\-child a[href=\\\x22\/costarica\/contabilidad\/\\\x22] p.text\-xs\x22,\x22value\x22:\x22Más clientes, menos trabajo manual.\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-list > .dropdown\-resources\-\-container:first\-child a[href=\\\x22\/costarica\/erp\/\\\x22] p.text\-xs\x22,\x22value\x22:\x22Controle inventarios, ventas y finanzas en un solo lugar.\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-reponsive\-\-list .dropdown\-solutions\-for\-\-container:first\-child a[href=\\\x22\/costarica\/facturacion\-electronica\/\\\x22] .dropdown\-solution\-\-title\x22,\x22value\x22:\x22Para su negocio\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-reponsive\-\-list .dropdown\-solutions\-for\-\-container:first\-child a[href=\\\x22\/costarica\/contabilidad\/\\\x22] .dropdown\-solution\-\-title\x22,\x22value\x22:\x22Para usted contador\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.navigation\-dropdown\-\-reponsive\-\-list .dropdown\-solutions\-for\-\-container:first\-child a[href=\\\x22\/costarica\/erp\/\\\x22] .dropdown\-solution\-\-title\x22,\x22value\x22:\x22Para su empresa en crecimiento\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22b7dcf490\-744b\-4df6\-b5eb\-e8937da074cb\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.dropdown\-resources\-\-container:nth\-child(1) .resources\-for\-\-title\x22,\x22value\x22:\x22 SEGÚN SU PERFIL \x22}]}}],\x22value\x22:\x22menu_icp\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}}}},{\x22key\x22:\x22col\-or\-home\-icp\-mix\-icp\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:13,\x22urlMatch\x22:[]},\x22segments\x22:[{\x22bucket\x22:{\x22allocations\x22:[{\x22distributions\x22:[{\x22range\x22:[0,14316558],\x22variant\x22:\x22control\x22},{\x22range\x22:[14316557,28633116],\x22variant\x22:\x22full\-icp\x22},{\x22range\x22:[28633114,42949673],\x22variant\x22:\x22mix\-icp\x22}],\x22range\x22:[0,100]}],\x22salt\x22:\x22XdtSEzih\x22,\x22selector\x22:[\x22context\x22,\x22user\x22,\x22web_exp_id_v2\x22]},\x22metadata\x22:{\x22segmentName\x22:\x22All Other Users\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[]}}],\x22value\x22:\x22control\x22},\x22full\-icp\x22:{\x22key\x22:\x22full\-icp\x22,\x22payload\x22:[{\x22action\x22:\x22redirect\x22,\x22data\x22:{\x22metadata\x22:{\x22scope\x22:[\x22f101be2d\-098e\-4685\-a4d5\-7f1b55fef5bd\x22]},\x22url\x22:\x22https:\/\/www.alegra.com\/colombia\/2\/\x22}}],\x22value\x22:\x22full\-icp\x22},\x22mix\-icp\x22:{\x22key\x22:\x22mix\-icp\x22,\x22payload\x22:[{\x22action\x22:\x22redirect\x22,\x22data\x22:{\x22metadata\x22:{\x22scope\x22:[\x22f101be2d\-098e\-4685\-a4d5\-7f1b55fef5bd\x22]},\x22url\x22:\x22https:\/\/www.alegra.com\/colombia\/3\/\x22}}],\x22value\x22:\x22mix\-icp\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}}}},{\x22key\x22:\x22test\-col\-pos\-ver\-planes\-en\-hero\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$exposure\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:5,\x22testInstrumentation\x22:true,\x22urlMatch\x22:[\x22https:\/\/www.alegra.com\/colombia\/pos\/\x22]},\x22segments\x22:[{\x22metadata\x22:{\x22segmentName\x22:\x22default\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22value\x22:\x22control\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}},\x22treatment\x22:{\x22key\x22:\x22treatment\x22,\x22payload\x22:[{\x22action\x22:\x22redirect\x22,\x22data\x22:{\x22url\x22:\x22https:\/\/www.alegra.com\/colombia\/pos\-2\/\x22}}],\x22value\x22:\x22treatment\x22}}},{\x22key\x22:\x22exp\-40\-mex\-pos\-validar\-cual\-es\-mejor\-copie\-no\-incluye\-iva\-o\-mas\-iva\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:5,\x22testInstrumentation\x22:true,\x22urlMatch\x22:[\x22https:\/\/www.alegra.com\/mexico\/pos\/precios\/\x22]},\x22segments\x22:[{\x22metadata\x22:{\x22segmentName\x22:\x22default\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22value\x22:\x22control\x22},\x22off\x22:{\x22key\x22:\x22off\x22,\x22metadata\x22:{\x22default\x22:true}},\x22treatment\x22:{\x22key\x22:\x22treatment\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22type\x22:\x22text\x22,\x22value\x22:\x22Más IVA\x22},\x22selector\x22:\x22.theme\-\-emprendedor .price\-\-card\-\-price\-currency\-\-container > .price\-text\-\-disclaimer\x22,\x22value\x22:\x22Más IVA\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22type\x22:\x22text\x22,\x22value\x22:\x22Más IVA\x22},\x22selector\x22:\x22.theme\-\-pyme .price\-\-card\-\-price\-currency\-\-container > .price\-text\-\-disclaimer\x22,\x22value\x22:\x22Más IVA\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22type\x22:\x22text\x22,\x22value\x22:\x22Más IVA\x22},\x22selector\x22:\x22.price\-\-card\-\-name\-price\-cta:nth\-child(2) .price\-\-card\-\-price\-currency\-\-container > .price\-text\-\-disclaimer\x22,\x22value\x22:\x22Más IVA\x22},{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22type\x22:\x22text\x22,\x22value\x22:\x22Más IVA\x22},\x22selector\x22:\x22.theme\-\-plus .price\-\-card\-\-price\-currency\-\-container > .price\-text\-\-disclaimer\x22,\x22value\x22:\x22Más IVA\x22}]}}],\x22value\x22:\x22treatment\x22}}},{\x22key\x22:\x22mex\-contabilidad\-header\-beneficio\x22,\x22metadata\x22:{\x22deliveryMethod\x22:\x22web\x22,\x22deployed\x22:true,\x22evaluationMode\x22:\x22local\x22,\x22experimentKey\x22:\x22exp\-1\x22,\x22exposureEvent\x22:\x22$impression\x22,\x22flagType\x22:\x22experiment\x22,\x22flagVersion\x22:8,\x22urlMatch\x22:[]},\x22segments\x22:[{\x22bucket\x22:{\x22allocations\x22:[{\x22distributions\x22:[{\x22range\x22:[0,21474837],\x22variant\x22:\x22control\x22},{\x22range\x22:[21474836,42949673],\x22variant\x22:\x22header\-beneficio\x22}],\x22range\x22:[0,100]}],\x22salt\x22:\x22NPXTudCb\x22,\x22selector\x22:[\x22context\x22,\x22user\x22,\x22web_exp_id_v2\x22]},\x22metadata\x22:{\x22segmentName\x22:\x22All Other Users\x22},\x22variant\x22:\x22off\x22}],\x22variants\x22:{\x22control\x22:{\x22key\x22:\x22control\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[]}}],\x22value\x22:\x22control\x22},\x22header\-beneficio\x22:{\x22key\x22:\x22header\-beneficio\x22,\x22payload\x22:[{\x22action\x22:\x22mutate\x22,\x22data\x22:{\x22mutations\x22:[{\x22action\x22:\x22set\x22,\x22attribute\x22:\x22html\x22,\x22metadata\x22:{\x22scope\x22:[\x22fc74157d\-c596\-4a2d\-99e0\-8038a735dd8a\x22],\x22type\x22:\x22text\x22},\x22selector\x22:\x22.v0\-hi__text\x22,\x22value\x22:\x22