try{/* @amplitude/experiment-tag v0.4.0 */ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function o(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),l=function(){return l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var d=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=c(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===i)return e===t}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),u=Array.isArray(t);if(s!==u)return!1;if(!s||!u){var l=Object.keys(e).sort(),f=Object.keys(t).sort();if(!d(l,f))return!1;var h=!0;return Object.keys(e).forEach((function(r){d(e[r],t[r])||(h=!1)})),h}for(var v=0;v0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function k(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return Uint8Array.from(t)}(e),n=r.length,i=n>>2,o=t,a=0;a>>0},H=function(e,t){var r=e,n=t;return r=Math.imul(r,z),r=$(r,15),r=Math.imul(r,J),n=$(n^=r,13),(n=Math.imul(n,5))+-430675100|0},W=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},$=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<>>0)>>>0>>>r-t>>>0)>>>0},X=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return Z(r)},Z=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},G=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=x(t),o=i.next();!o.done;o=i.next()){var a=o.value;if(!a||!e||"object"!=typeof e)return;e=e[a]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e||void 0}},Y="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),ee=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(Y).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!isNaN(n)&&!isNaN(i))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.majore.minor?1:this.minore.patch?1:this.patche.preRelease?1:this.preRelease=v&&l=b&&cr;case T:case U:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case C:case N:return n<0;case A:case V:return n<=0;case O:case M:return n>0;case T:case U:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some((function(t){return Boolean(new RegExp(t).exec(e))}))},e.prototype.containsNone=function(e){return e.some((function(e){return"(none)"===e}))},e.prototype.containsBooleans=function(e){return e.some((function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}}))},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map((function(e){return t.coerceString(e)})).filter(Boolean);var r=String(e);try{var n=JSON.parse(r);return Array.isArray(n)?e.map((function(e){return t.coerceString(e)})).filter(Boolean):(i=this.coerceString(r))?[i]:void 0}catch(e){var i;return(i=this.coerceString(r))?[i]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case L:case j:case R:case F:case q:case D:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&k([],S(n),!1).every((function(e){return r.has(e)}))},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length{let t={};e.forEach(((e,r)=>t[e]=r))})(ae),String.fromCharCode.bind(String)),ue=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),le=e=>{let t,r,n,i,o="";const a=e.length%3;for(let a=0;a255||(n=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,o+=ae[t>>18&63]+ae[t>>12&63]+ae[t>>6&63]+ae[63&t]}return a?o.slice(0,a-3)+"===".substring(a):o},ce=ne?e=>btoa(e):ie?e=>Buffer.from(e,"binary").toString("base64"):le,fe=ie?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?se(192|t>>>6)+se(128|63&t):se(224|t>>>12&15)+se(128|t>>>6&63)+se(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return se(240|t>>>18&7)+se(128|t>>>12&63)+se(128|t>>>6&63)+se(128|63&t)},he=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ve=e=>e.replace(he,de),pe=ie?e=>Buffer.from(e,"utf8").toString("base64"):oe?e=>fe(oe.encode(e)):e=>ce(ve(e)),ye=(e,t=!1)=>t?ue(pe(e)):pe(e),ge=e=>ye(e,!0),me=ge;var be=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return g(t,e),t}(Error),we=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return g(t,e),t}(Error),xe=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return b(this,void 0,void 0,(function(){var r,n,i,o;return w(this,(function(a){switch(a.label){case 0:return r=me(JSON.stringify(e)),n={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=me(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),i=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=a.sent()).status)throw new be(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}}))}))},e}(),Se=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return b(this,void 0,void 0,(function(){var t,r;return w(this,(function(n){switch(n.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=me(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=n.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce((function(e,t){return e[t.key]=t,e}),{})]}}))}))},e}(),ke="undefined"!=typeof globalThis?globalThis:global||self,Ee=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},Ie=function(){var e=Ee();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1},Pe=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=ke.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(ke.clearInterval(this.poller),this.poller=void 0)},e}(),_e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var Ce,Ae,Oe,Te=(Ce=function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",u="model",l="name",c="type",f="vendor",d="version",h="architecture",v="console",p="mobile",y="tablet",g="smarttv",m="wearable",b="embedded",w="Amazon",x="Apple",S="ASUS",k="BlackBerry",E="Browser",I="Chrome",P="Firefox",_="Google",C="Huawei",A="LG",O="Microsoft",T="Motorola",N="Opera",V="Samsung",M="Sharp",U="Sony",L="Xiaomi",j="Zebra",R="Facebook",F=function(e){for(var t={},r=0;r0?2===u.length?typeof u[1]==i?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==i||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):n:this[u[0]]=c?u[1].call(this,c,u[2]):n:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):n):this[u]=c||n;f+=2}},z=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var i=0;i350?B(e,350):e,this},this.setUA(i),this};H.VERSION="0.7.33",H.BROWSER=F([l,d,"major"]),H.CPU=F([h]),H.DEVICE=F([u,f,c,v,p,g,y,m,b]),H.ENGINE=H.OS=F([l,d]),e.exports&&(t=e.exports=H),t.UAParser=H;var W=typeof r!==o&&(r.jQuery||r.Zepto);if(W&&!W.ua){var $=new H;W.ua=$.getResult(),W.ua.get=function(){return $.getUA()},W.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var r in t)W.ua[r]=t[r]}}}("object"==typeof window?window:_e)},Ce(Oe={path:Ae,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&Oe.path)}},Oe.exports),Oe.exports),Ne=function(){function e(e){this.amplitudeInstance=e}return e.prototype.getUser=function(){var e,t,r,n,i,o,a,s,u,l;return{device_id:null===(t=null===(e=this.amplitudeInstance)||void 0===e?void 0:e.options)||void 0===t?void 0:t.deviceId,user_id:null===(n=null===(r=this.amplitudeInstance)||void 0===r?void 0:r.options)||void 0===n?void 0:n.userId,version:null===(o=null===(i=this.amplitudeInstance)||void 0===i?void 0:i.options)||void 0===o?void 0:o.versionName,language:null===(s=null===(a=this.amplitudeInstance)||void 0===a?void 0:a.options)||void 0===s?void 0:s.language,platform:null===(l=null===(u=this.amplitudeInstance)||void 0===u?void 0:u.options)||void 0===l?void 0:l.platform,os:this.getOs(),device_model:this.getDeviceModel()}},e.prototype.getOs=function(){var e,t,r,n,i,o;return[null===(r=null===(t=null===(e=this.amplitudeInstance)||void 0===e?void 0:e._ua)||void 0===t?void 0:t.browser)||void 0===r?void 0:r.name,null===(o=null===(i=null===(n=this.amplitudeInstance)||void 0===n?void 0:n._ua)||void 0===i?void 0:i.browser)||void 0===o?void 0:o.major].filter((function(e){return null!=e})).join(" ")},e.prototype.getDeviceModel=function(){var e,t,r;return null===(r=null===(t=null===(e=this.amplitudeInstance)||void 0===e?void 0:e._ua)||void 0===t?void 0:t.os)||void 0===r?void 0:r.name},e}(),Ve=function(){function e(e){this.amplitudeInstance=e}return e.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},e.prototype.setUserProperty=function(e){var t,r;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null===(r=e.variant)||void 0===r?void 0:r.value,t))},e.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:(t={},t[e.userProperty]="-",t)})},e}(),Me=function(){return Me=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Re(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Fe(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i=2&&h[1]&&(v=Buffer.from(h[1],"base64").toString("utf-8")),{deviceId:h[0],userId:v}}catch(e){return}},De=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},Be=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return Ue(this,void 0,void 0,(function(){return Le(this,(function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener((function(){null==t||t.fetch()})),[2,this.waitForConnectorIdentity(this.timeoutMillis)]}))}))},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=qe(this.apiKey,!0);return(e||(e=qe(this.apiKey,!1))||(e=function(e){var t=De(e,!0);try{var r=ke.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}}(this.apiKey))||!!(e=function(e){var t=De(e,!0);try{var r=ke.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}}(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return Ue(this,void 0,void 0,(function(){var t,r=this;return Le(this,(function(n){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise((function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)})),new Promise((function(t,r){ke.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")}))])]}))}))},e}();var Ke,ze,Je=ke.fetch||function(e,t){return t=t||{},new Promise((function(r,n){var i=new XMLHttpRequest,o=[],a=[],s={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var l in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){o.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(u())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)}))},Qe=function(){function e(e){this.client=e}return e.prototype.request=function(e){return Ue(this,void 0,void 0,(function(){return Le(this,(function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}}))}))},e}(),He={request:function(e,t,r,n,i){return function(e,t){return null==t||t<=0?e:new Promise((function(r,n){ke.setTimeout((function(){n(new we("Request timeout after "+t+" milliseconds"))}),t),e.then(r,n)}))}(Ue(void 0,void 0,void 0,(function(){var i,o;return Le(this,(function(a){switch(a.label){case 0:return[4,Je(e,{method:t,headers:r,body:n})];case 1:return i=a.sent(),o={status:i.status},[4,i.text()];case 2:return o.body=a.sent(),[2,o]}}))})),i)}};!function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(Ke||(Ke={})),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"}(ze||(ze={}));var We=function(e){return!e||e===ze.FallbackInline||e===ze.FallbackConfig||e===ze.SecondaryInitialVariants},$e={debug:!1,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:Ke.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:He},Xe="1.15.0",Ze=function(){function e(e,t){var r,n=this;this.isReady=new Promise((function(e){n.resolve=e})),this.config=e,this.client=t;var i=null!==(r=e.instanceName)&&void 0!==r?r:$e.instanceName;this.queue=new Ye(i),this.cache=new Ge(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then((function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}),(function(r){console.error("Integration setup failed.",r),t.queue.setTracker(t.integration.track.bind(e)),t.resolve()})):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t,r,n,i={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?i={eventType:null===(r=e.metadata)||void 0===r?void 0:r.exposureEvent,eventProperties:e}:"web"===(null===(n=e.metadata)||void 0===n?void 0:n.deliveryMethod)&&(i={eventType:"$impression",eventProperties:e}),i},e}(),Ge=function(){function e(e){this.isSessionStorageAvailable=et(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),et&&ke.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){var t;if("web"===(null===(t=e.metadata)||void 0===t?void 0:t.deliveryMethod))return!0;this.loadCache();var r=this.inMemoryCache[e.flag_key],n=!1;return r&&r.variant===e.variant||(n=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),n},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=ke.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&ke.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),Ye=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=Ie(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=ke.setInterval((function(){t.loadFlushStore()}),1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=je(this.inMemoryQueue),n=r.next();!n.done;n=r.next()){var i=n.value;if(!this.tracker(i))return}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(ke.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=ke.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),ke.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),et=function(){var e=Ee();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1},tt=function(){function e(){this.globalScope=Ee()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)},e}(),rt=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return Me({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=je(Object.keys(e)),i=n.next();!i.done;i=n.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,n=this.storage.get(this.namespace);try{r=JSON.parse(n)||{}}catch(e){return}var i={};try{for(var o=je(Object.keys(r)),a=o.next();!a.done;a=o.next()){var s=a.value;try{var u=void 0;(u=this.transformer?this.transformer(r[s]):r[s])&&(i[s]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),nt=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,n=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);var a={};return t?a.key=t:r&&(a.key=r),r&&(a.value=r),i&&(a.metadata=i),n&&(a.payload=n),o&&(a.expKey=o),a}},it=function(e){return null==e},ot=function(e){return!!it(e)||e&&0===Object.keys(e).length},at=function(e){var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)},st=function(){function e(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}return e.prototype.start=function(e){return Ue(this,void 0,void 0,(function(){return Le(this,(function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}}))}))},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return Ue(this,void 0,void 0,(function(){var n=this;return Le(this,(function(i){return this.done||(this.timeoutHandle=ke.setTimeout((function(){return Ue(n,void 0,void 0,(function(){var n,i;return Le(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(n=t+1)0&&f[0]){var d=f[0],h={group_name:d},v=null===(i=null===(n=e.group_properties)||void 0===n?void 0:n[c])||void 0===i?void 0:i[d];v&&Object.keys(v).length>0&&(h.group_properties=v),s[c]=h}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(s).length>0&&(o.groups=s),delete o.user.groups,delete o.user.group_properties,o}(n),a=this.engine.evaluate(o,i),s={};try{for(var u=je(Object.keys(a)),l=u.next();!l.done;l=u.next()){var c=l.value;s[c]=lt(a[c])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return s},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===Ke.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===Ke.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(at(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var n,i={},o=this.evaluate([t.key])[e],a=ze.LocalEvaluation,s=null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.default;if(!it(o)&&!s)return{variant:ut(o),source:a,hasDefaultVariant:!1};if(s&&(i={variant:ut(o),source:a,hasDefaultVariant:!0}),!it(r))return{variant:ut(r),source:ze.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var u=this.config.initialVariants[e];if(!it(u))return{variant:ut(u),source:ze.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var l=ut(this.config.fallbackVariant),c={variant:l,source:ze.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return ot(l)?i:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,n={},i=this.variants.get(e),o=null===(r=null==i?void 0:i.metadata)||void 0===r?void 0:r.default;if(!it(i)&&!o)return{variant:ut(i),source:ze.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:ut(i),source:ze.LocalStorage,hasDefaultVariant:!0}),!it(t))return{variant:ut(t),source:ze.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=this.config.initialVariants[e];if(!it(a))return{variant:ut(a),source:ze.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var s=ut(this.config.fallbackVariant),u={variant:s,source:ze.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ot(s)?n:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!it(i))return{variant:ut(i),source:ze.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),a=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!it(o)&&!a)return{variant:ut(o),source:ze.LocalStorage,hasDefaultVariant:!1};if(a&&(n={variant:ut(o),source:ze.LocalStorage,hasDefaultVariant:!0}),!it(t))return{variant:ut(t),source:ze.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var s=ut(this.config.fallbackVariant),u={variant:s,source:ze.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ot(s)?n:u},e.prototype.fetchInternal=function(e,t,r,n){return Ue(this,void 0,void 0,(function(){var i,o;return Le(this,(function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,n)];case 2:return i=a.sent(),[4,this.storeVariants(i,n)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,n),o;case 5:return[2]}}))}))},e.prototype.cleanUserPropsForFetch=function(e){var t=Me({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return Ue(this,void 0,void 0,(function(){var n,i,o,a,s,u,l;return Le(this,(function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,Me({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(o=je(Object.keys(n)),a=o.next();!a.done;a=o.next())s=a.value,i[s]=lt(n[s])}catch(e){u={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.debug("[Experiment] Received variants: ",i),[2,i]}}))}))},e.prototype.doFlags=function(){var e;return Ue(this,void 0,void 0,(function(){var t,r,n,i;return Le(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),t="web"===(null===(e=this.config)||void 0===e?void 0:e.internalInstanceNameSuffix),r=this.addContext(this.getUser()),[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Xe,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:t?"web":void 0,user:t&&((null==r?void 0:r.user_id)||(null==r?void 0:r.device_id))?{user_id:null==r?void 0:r.user_id,device_id:null==r?void 0:r.device_id}:void 0})];case 1:return n=o.sent(),this.flags.clear(),this.flags.putAll(n),[3,3];case 2:if(!((i=o.sent())instanceof we))throw i;return this.config.debug&&console.debug(i),[3,3];case 3:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}}))}))},e.prototype.storeVariants=function(e,t){return Ue(this,void 0,void 0,(function(){var r,n,i,o;return Le(this,(function(a){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),n=function(t){r=r.filter((function(e){return e!==t})),i.variants.put(t,e[t])},i=this,e)n(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.debug("[Experiment] Stored variants: ",e),[2]}))}))},e.prototype.startRetries=function(e,t){return Ue(this,void 0,void 0,(function(){var r=this;return Le(this,(function(n){return this.debug("[Experiment] Retry fetch"),this.retriesBackoff=new st(8,500,1e4,1.5),this.retriesBackoff.start((function(){return Ue(r,void 0,void 0,(function(){return Le(this,(function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}}))}))})),[2]}))}))},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),n=this.integrationManager.getUser(),i=Me(Me(Me({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return Me(Me(Me(Me({library:"experiment-js-client/".concat(Xe)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return Ue(this,void 0,void 0,(function(){return Le(this,(function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}}))}))},e.prototype.sourceVariants=function(){return this.config.source==Ke.LocalStorage?this.variants.getAll():this.config.source==Ke.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==Ke.LocalStorage?this.config.initialVariants:this.config.source==Ke.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){var r,n,i,o,a,s,u,l,c;if(null===(i=null===(n=null===(r=t.variant)||void 0===r?void 0:r.metadata)||void 0===n?void 0:n.trackExposure)||void 0===i||i){this.legacyExposureInternal(e,t.variant,t.source);var f={flag_key:e},d=We(t.source);if(!d||t.hasDefaultVariant){(null===(o=t.variant)||void 0===o?void 0:o.expKey)&&(f.experiment_key=null===(a=t.variant)||void 0===a?void 0:a.expKey);var h=null===(s=t.variant)||void 0===s?void 0:s.metadata;d||(null==h?void 0:h.default)||((null===(u=t.variant)||void 0===u?void 0:u.key)?f.variant=t.variant.key:(null===(l=t.variant)||void 0===l?void 0:l.value)&&(f.variant=t.variant.value)),h&&(f.metadata=h),null===(c=this.exposureTrackingProvider)||void 0===c||c.track(f),this.integrationManager.track(f)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,a,s;if(this.analyticsProvider){var u=function(e,t,r,n){var i,o=null==r?void 0:r.value,a="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:a,properties:{key:t,variant:o,source:n},userProperties:(i={},i[a]=o,i)}}(this.addContext(this.getUser()),e,t,r);We(r)||!(null==t?void 0:t.value)?null===(i=null===(n=this.analyticsProvider)||void 0===n?void 0:n.unsetUserProperty)||void 0===i||i.call(n,u):(null==t?void 0:t.value)&&(null===(a=null===(o=this.analyticsProvider)||void 0===o?void 0:o.setUserProperty)||void 0===a||a.call(o,u),null===(s=this.analyticsProvider)||void 0===s||s.track(u))}},e.prototype.debug=function(e){for(var t=[],r=1;r=500||429===e.statusCode)},e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),ht=function(){function e(){this.globalScope=Ee()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)},e}(),vt=function(){function e(e,t){var r,n,i;this.globalScope=Ee(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(n=this.globalScope)||void 0===n?void 0:n.navigator.userAgent:void 0,this.ua=new Te.UAParser(this.userAgent).getResult(),this.localStorage=new tt,this.sessionStorage=new ht,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null===(i=this.apiKey)||void 0===i?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,n,i,o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Me({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(r=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==r?r:"desktop",referring_url:null===(i=null===(n=this.globalScope)||void 0===n?void 0:n.document)||void 0===i?void 0:i.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},o)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(r=e.browser)||void 0===r?void 0:r.major].filter((function(e){return null!=e})).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,n,i;if(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie)return Object.fromEntries(null===(i=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.document)||void 0===n?void 0:n.cookie)||void 0===i?void 0:i.split("; ").map((function(e){return e.split("=")})))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var 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}},e.prototype.getUrlParam=function(){var e,t,r;if(this.globalScope){var n={};try{var i=new URL(this.globalScope.location.href);try{for(var o=je(i.searchParams),a=o.next();!a.done;a=o.next()){var s=Re(a.value,2),u=s[0],l=s[1];n[u]=Fe(Fe([],Re(null!==(r=n[u])&&void 0!==r?r:[]),!1),Re(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(n).reduce((function(e,t){var r=Re(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e}),{})}},e}();ke.experimentInstances={};var pt=ke.experimentInstances,yt=function(e){return(null==e?void 0:e.instanceName)||$e.instanceName},gt=function(e,t){var r=yt(t),n=null==t?void 0:t.internalInstanceNameSuffix,i=n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e);return pt[i]||(t=Me(Me({},t),{userProvider:new vt(null==t?void 0:t.userProvider,e)}),pt[i]=new dt(e,t)),pt[i]},mt=function(e,t){var r=yt(t),n=gt(e,t);return n.addPlugin(new Be(e,p.getInstance(r),1e4)),n},bt={initialize:gt,initializeWithAmplitudeAnalytics:mt},wt=function(){function e(){}return e.prototype.getUser=function(){return{}},e.prototype.start=function(e){return Ue(this,void 0,void 0,(function(){return Le(this,(function(e){return[2]}))}))},e.prototype.stop=function(){},e.prototype.setUser=function(e){},e.prototype.fetch=function(e){return Ue(this,void 0,void 0,(function(){return Le(this,(function(e){return[2,this]}))}))},e.prototype.getUserProvider=function(){return null},e.prototype.setUserProvider=function(e){return this},e.prototype.variant=function(e,t){return $e.fallbackVariant},e.prototype.all=function(){return{}},e.prototype.clear=function(){},e.prototype.exposure=function(e){},e}(),xt=Object.freeze({__proto__:null,AmplitudeAnalyticsProvider:Ve,AmplitudeIntegrationPlugin:Be,AmplitudeUserProvider:Ne,Experiment:bt,ExperimentClient:dt,get Source(){return Ke},StubExperimentClient:wt,initialize:gt,initializeWithAmplitudeAnalytics:mt}),St=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,kt={revert:function(){}},Et=new Map,It=new Set;function Pt(e){var t=Et.get(e);return t||(t={element:e,attributes:{}},Et.set(e,t)),t}function _t(e,t,r,n,i){var o=r(e),a={isDirty:!1,originalValue:o,virtualValue:o,mutations:[],el:e,_positionTimeout:null,_textTimeout:null,rateLimitCount:0,observer:new MutationObserver((function(){if(!(a.rateLimitCount>=10||(a.rateLimitCount++,setTimeout((function(){a.rateLimitCount=a.rateLimitCount-1,a.rateLimitCount<=0&&(a.rateLimitCount=0)}),1e3),"position"===t&&a._positionTimeout||"html"===t&&a._textTimeout))){"position"===t?a._positionTimeout=setTimeout((function(){a._positionTimeout=null}),1e3):"html"===t&&(a._textTimeout=setTimeout((function(){a._textTimeout=null}),500));var n=r(e);if(("position"!==t||n.parentNode!==a.virtualValue.parentNode||n.insertBeforeNode!==a.virtualValue.insertBeforeNode)&&n!==a.virtualValue){var o=function(e,t){function r(e){var t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll(".visual-editing-highlight-hover, .visual-editing-highlight-select").forEach((function(e){e.classList.remove("visual-editing-highlight-hover","visual-editing-highlight-select")})),t.innerHTML}return"string"!=typeof e?{currentValue:e,virtualValue:t}:{currentValue:r(e),virtualValue:r(t)}}(n,a.virtualValue);o.currentValue!==o.virtualValue&&(a.originalValue=n,i(a))}}})),mutationRunner:i,setValue:n,getCurrentValue:r};return"position"===t&&e.parentNode?a.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):a.observer.observe(e,function(e){return"html"===e?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}(t)),a}function Ct(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?r&&e.parentNode===r.parentNode&&e.insertBeforeNode===r.insertBeforeNode||(t.isDirty=!0,$t()):e!==r&&(t.isDirty=!0,$t())}function At(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),Ct(function(e){Bt||(Bt=document.createElement("div"));return Bt.innerHTML=e,Bt.innerHTML}(t),e)}function Ot(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach((function(e){return e.mutate(t)})),Ct(Array.from(t).filter(Boolean).join(" "),e)}function Tt(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),Ct(t,e)}function Nt(e){var t=e.originalValue;e.mutations.forEach((function(e){var r=function(e){var t=e.parentSelector,r=e.insertBeforeSelector,n=document.querySelector(t);if(!n)return null;var i=r?document.querySelector(r):null;return r&&!i?null:{parentNode:n,insertBeforeNode:i}}(e.mutate());t=r||t})),Ct(t,e)}var Vt=function(e){return e.innerHTML},Mt=function(e,t){return e.innerHTML=t};function Ut(e){var t=Pt(e);return t.html||(t.html=_t(e,"html",Vt,Mt,At)),t.html}var Lt=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},jt=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function Rt(e){var t=Pt(e);return t.position||(t.position=_t(e,"position",Lt,jt,Nt)),t.position}var Ft=function(e,t){return t?e.className=t:e.removeAttribute("class")},qt=function(e){return e.className};function Dt(e){var t=Pt(e);return t.classes||(t.classes=_t(e,"class",qt,Ft,Ot)),t.classes}var Bt,Kt,zt=function(e){return function(t){var r;return null!=(r=t.getAttribute(e))?r:null}},Jt=function(e){return function(t,r){return null!==r?t.setAttribute(e,r):t.removeAttribute(e)}};function Qt(e,t){var r=Pt(e);return r.attributes[t]||(r.attributes[t]=_t(e,t,zt(t),Jt(t),Tt)),r.attributes[t]}function Ht(e,t,r){if(r.isDirty){r.isDirty=!1;var n=r.virtualValue;r.mutations.length||function(e,t){var r,n,i=Et.get(e);if(i)if("html"===t)null==(r=i.html)||null==(n=r.observer)||n.disconnect(),delete i.html;else if("class"===t){var o,a;null==(o=i.classes)||null==(a=o.observer)||a.disconnect(),delete i.classes}else if("position"===t){var s,u;null==(s=i.position)||null==(u=s.observer)||u.disconnect(),delete i.position}else{var l,c,f;null==(l=i.attributes)||null==(c=l[t])||null==(f=c.observer)||f.disconnect(),delete i.attributes[t]}}(e,t),r.setValue(e,n)}}function Wt(e,t){e.html&&Ht(t,"html",e.html),e.classes&&Ht(t,"class",e.classes),e.position&&Ht(t,"position",e.position),Object.keys(e.attributes).forEach((function(r){Ht(t,r,e.attributes[r])}))}function $t(){Et.forEach(Wt)}function Xt(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach((function(r){t.has(r)||(e.elements.add(r),function(e,t){var r=null;"html"===e.kind?r=Ut(t):"class"===e.kind?r=Dt(t):"attribute"===e.kind?r=Qt(t,e.attribute):"position"===e.kind&&(r=Rt(t)),r&&(r.mutations.push(e),r.mutationRunner(r))}(e,r))}))}}function Zt(e){e.elements.forEach((function(t){return function(e,t){var r=null;if("html"===e.kind?r=Ut(t):"class"===e.kind?r=Dt(t):"attribute"===e.kind?r=Qt(t,e.attribute):"position"===e.kind&&(r=Rt(t)),r){var n=r.mutations.indexOf(e);-1!==n&&r.mutations.splice(n,1),r.mutationRunner(r)}}(e,t)})),e.elements.clear(),It.delete(e)}function Gt(){It.forEach(Xt)}function Yt(e){return"undefined"==typeof document?kt:(It.add(e),Xt(e),{revert:function(){Zt(e)}})}function er(e,t){return Yt({kind:"html",elements:new Set,mutate:t,selector:e})}function tr(e,t){return Yt({kind:"position",elements:new Set,mutate:t,selector:e})}function rr(e,t){return Yt({kind:"class",elements:new Set,mutate:t,selector:e})}function nr(e,t,r){return St.test(t)?"class"===t||"className"===t?rr(e,(function(e){var t=r(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach((function(t){return e.add(t)}))})):Yt({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):kt}"undefined"!=typeof document&&(Kt||(Kt=new MutationObserver((function(){Gt()}))),Gt(),Kt.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));var ir={html:er,classes:rr,attribute:nr,position:tr,declarative:function(e){var t=e.selector,r=e.action,n=e.value,i=e.attribute,o=e.parentSelector,a=e.insertBeforeSelector;if("html"===i){if("append"===r)return er(t,(function(e){return e+(null!=n?n:"")}));if("set"===r)return er(t,(function(){return null!=n?n:""}))}else if("class"===i){if("append"===r)return rr(t,(function(e){n&&e.add(n)}));if("remove"===r)return rr(t,(function(e){n&&e.delete(n)}));if("set"===r)return rr(t,(function(e){e.clear(),n&&e.add(n)}))}else if("position"===i){if("set"===r&&o)return tr(t,(function(){return{insertBeforeSelector:a,parentSelector:o}}))}else{if("append"===r)return nr(t,i,(function(e){return null!==e?e+(null!=n?n:""):null!=n?n:""}));if("set"===r)return nr(t,i,(function(){return null!=n?n:""}));if("remove"===r)return nr(t,i,(function(){return null}))}return kt}},or=function(){function e(){}return e.setup=function(){var e,t="closed";null===(e=Ee())||void 0===e||e.addEventListener("message",(function(e){var r=/^.*\.amplitude\.com$/;try{if(!e.origin||!r.test(new URL(e.origin).hostname))return}catch(e){return}if("OpenOverlay"===e.data.type){if("closed"!==t||!r.test(new URL(e.data.context.injectSrc).hostname))return;t="opening",ar(e.data.context.injectSrc).then((function(){t="open"})).catch((function(){t="closed"}))}}))},e}(),ar=function(e){return new Promise((function(t,r){var n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",(function(){t({status:!0})}),{once:!0}),i.addEventListener("error",(function(){r({status:!1,message:"Failed to load the script ".concat(e)})})),null===(n=document.head)||void 0===n||n.appendChild(i)}catch(e){r(e)}}))},sr=function(e){if(!e)return"";var t=new URL(e);return t.search="",t.hash="",t.toString()},ur=function(e,t){var r,i,o=new URL(e);try{for(var a=n(t),s=a.next();!s.done;s=a.next()){var u=s.value;o.searchParams.delete(u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o.toString()},lr=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,lr)};ke.Experiment=xt;var cr,fr,dr=new Set,hr=[],vr=function(e,t){var r,i,o,a,s;if(void 0===t&&(t=void 0),0!==Object.keys(e).length){var u=Ee();if(u){var l=sr(u.location.href);for(var c in(null==fr?void 0:fr[l])||((fr={})[l]={}),e)if(!t||t.has(c)){var f=e[c];if("web"===(null===(o=f.metadata)||void 0===o?void 0:o.deliveryMethod)){var d=null===(s=null===(a=f.metadata)||void 0===a?void 0:a.trackExposure)||void 0===s||s,h=Array.isArray(f.payload),v=!f.payload||h&&0===f.payload.length;if(d&&v){xr(c,f);continue}if(h)try{for(var p=(r=void 0,n(f.payload)),y=p.next();!y.done;y=p.next()){var g=y.value;"redirect"===g.action?pr(g,c,f):"mutate"===g.action?yr(g,c,f):"inject"===g.action&&mr(g,c,f)}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}}}}},pr=function(e,t,r){var n,i=Ee();if(i){var o=sr(cr||i.document.referrer),a=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.url;if(sr(i.location.href)!==o){var s=function(e,t){var r=new URL(e),n=new URL(t),i=new URL(t);return r.searchParams.forEach((function(e,t){n.searchParams.has(t)||i.searchParams.append(t,e)})),i.toString()}(i.location.href,a);xr(t,r),cr=i.location.href,i.location.replace(s)}}},yr=function(e,t,r){var n;Ee()&&((null===(n=e.data)||void 0===n?void 0:n.mutations).forEach((function(e){hr.push(ir.declarative(e))})),xr(t,r))},gr=function(){for(var e;hr.length>0;)null===(e=hr.pop())||void 0===e||e.revert()},mr=function(e,n,i){var o,a=Ee();if(a){var s=e.data.id;if(s&&"string"==typeof s&&0!==s.length&&(s=s.replace(/-/g,""),!dr.has(s))){var u,l=e.data.js;l&&(u=a.document.createElement("script"))&&(u.innerHTML="function ".concat(s,"(html, utils, id){").concat(l,"};"),u.id="js-".concat(s),a.document.head.appendChild(u));var c,f=e.data.css;f&&(c=a.document.createElement("style"))&&(c.innerHTML=f,c.id="css-".concat(s),a.document.head.appendChild(c));var d,h=e.data.html;h&&(d=null!==(o=(new DOMParser).parseFromString(h,"text/html").body.firstElementChild)&&void 0!==o?o:void 0);var v={waitForElement:function(e){return t(this,void 0,void 0,(function(){var t;return r(this,(function(r){return(t=document.querySelector(e))?[2,t]:[2,new Promise((function(t){var r=new MutationObserver((function(){var n=document.querySelector(e);n&&(r.disconnect(),t(n))}));r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})}))]}))}))}};dr.add(s);try{var p=a[s];p&&"function"==typeof p&&p(d,v,s)}catch(e){null==u||u.remove(),console.error("Experiment inject failed for ".concat(n," variant ").concat(i.key,". Reason:"),e)}hr.push({revert:function(){v.remove&&v.remove(),null==c||c.remove(),null==u||u.remove(),dr.delete(s)}}),xr(n,i)}}},br=function(e){var t=Ee();if(t){t.addEventListener("popstate",(function(){gr(),vr(t.webExperiment.all(),e)}));var r,n;r=history.pushState,n=history.replaceState,history.pushState=function(){for(var n=[],i=0;i