@absmartly/sdk-plugins 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/absmartly-cookie.min.js +1 -1
  2. package/dist/absmartly-dom-changes-core.min.js +1 -1
  3. package/dist/absmartly-dom-changes-lite.min.js +1 -1
  4. package/dist/absmartly-overrides-full.min.js +1 -1
  5. package/dist/absmartly-sdk-plugins.min.js +1 -1
  6. package/dist/absmartly-vitals.min.js +1 -1
  7. package/es/cookies/CookiePlugin.js +31 -61
  8. package/es/cookies/CookiePlugin.js.map +1 -1
  9. package/es/cookies/cookieUtils.js +82 -0
  10. package/es/cookies/cookieUtils.js.map +1 -0
  11. package/es/cookies/index.js +1 -0
  12. package/es/cookies/index.js.map +1 -1
  13. package/es/core/DOMChangesPluginLite.js +103 -20
  14. package/es/core/DOMChangesPluginLite.js.map +1 -1
  15. package/es/core/DOMManipulatorLite.js +64 -9
  16. package/es/core/DOMManipulatorLite.js.map +1 -1
  17. package/es/entries/dom-with-overrides-lite.js +6 -1
  18. package/es/entries/dom-with-overrides-lite.js.map +1 -1
  19. package/es/index.js +4 -0
  20. package/es/index.js.map +1 -1
  21. package/es/overrides/index.js +1 -0
  22. package/es/overrides/index.js.map +1 -1
  23. package/es/overrides/overridesUtils.js +255 -0
  24. package/es/overrides/overridesUtils.js.map +1 -0
  25. package/es/utils/debug.js +2 -1
  26. package/es/utils/debug.js.map +1 -1
  27. package/es/vitals/WebVitalsPlugin.js +65 -54
  28. package/es/vitals/WebVitalsPlugin.js.map +1 -1
  29. package/lib/cookies/CookiePlugin.d.ts +0 -3
  30. package/lib/cookies/CookiePlugin.js +31 -61
  31. package/lib/cookies/CookiePlugin.js.map +1 -1
  32. package/lib/cookies/cookieUtils.d.ts +34 -0
  33. package/lib/cookies/cookieUtils.js +90 -0
  34. package/lib/cookies/cookieUtils.js.map +1 -0
  35. package/lib/cookies/index.d.ts +2 -0
  36. package/lib/cookies/index.js +8 -1
  37. package/lib/cookies/index.js.map +1 -1
  38. package/lib/core/DOMChangesPluginLite.d.ts +1 -1
  39. package/lib/core/DOMChangesPluginLite.js +103 -20
  40. package/lib/core/DOMChangesPluginLite.js.map +1 -1
  41. package/lib/core/DOMManipulatorLite.js +64 -9
  42. package/lib/core/DOMManipulatorLite.js.map +1 -1
  43. package/lib/entries/dom-with-overrides-lite.d.ts +7 -1
  44. package/lib/entries/dom-with-overrides-lite.js +19 -1
  45. package/lib/entries/dom-with-overrides-lite.js.map +1 -1
  46. package/lib/index.d.ts +4 -0
  47. package/lib/index.js +17 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/overrides/index.d.ts +2 -0
  50. package/lib/overrides/index.js +8 -1
  51. package/lib/overrides/index.js.map +1 -1
  52. package/lib/overrides/overridesUtils.d.ts +48 -0
  53. package/lib/overrides/overridesUtils.js +263 -0
  54. package/lib/overrides/overridesUtils.js.map +1 -0
  55. package/lib/utils/debug.js +2 -1
  56. package/lib/utils/debug.js.map +1 -1
  57. package/lib/vitals/WebVitalsPlugin.d.ts +1 -2
  58. package/lib/vitals/WebVitalsPlugin.js +98 -54
  59. package/lib/vitals/WebVitalsPlugin.js.map +1 -1
  60. package/package.json +4 -1
  61. package/types/cookies/CookiePlugin.d.ts +0 -3
  62. package/types/cookies/cookieUtils.d.ts +34 -0
  63. package/types/cookies/index.d.ts +2 -0
  64. package/types/core/DOMChangesPluginLite.d.ts +1 -1
  65. package/types/entries/dom-with-overrides-lite.d.ts +7 -1
  66. package/types/index.d.ts +4 -0
  67. package/types/overrides/index.d.ts +2 -0
  68. package/types/overrides/overridesUtils.d.ts +48 -0
  69. package/types/vitals/WebVitalsPlugin.d.ts +1 -2
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlySDKPlugins=t():e.ABsmartlySDKPlugins=t()}(this,()=>(()=>{"use strict";var e={44:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginLite=void 0;var l=r(609),s=function(){function e(e){var t,r,n,i,o;if(this.initialized=!1,!e.context)throw new Error("[OverridesPluginLite] Context is required");this.config={context:e.context,cookieName:null!==(t=e.cookieName)&&void 0!==t?t:"absmartly_overrides",useQueryString:null===(r=e.useQueryString)||void 0===r||r,queryPrefix:null!==(n=e.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(i=e.persistQueryToCookie)&&void 0!==i&&i,debug:null!==(o=e.debug)&&void 0!==o&&o},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Initialized with config:",{cookieName:this.config.cookieName,useQueryString:this.config.useQueryString,queryPrefix:this.config.queryPrefix})}return e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e,t,r,n,s,c,u,d,h,g,f;return i(this,function(i){if(this.initialized)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Already initialized"),[2];if(this.initialized=!0,this.registerWithContext(),e={},this.config.useQueryString&&"undefined"!=typeof window&&(e=this.getQueryStringOverrides(),this.config.persistQueryToCookie&&this.config.cookieName&&Object.keys(e).length>0&&this.persistOverridesToCookie(e)),0===Object.keys(e).length&&this.config.cookieName&&(e=this.getCookieOverrides()),0===Object.keys(e).length)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] No overrides found"),[2];try{for(t=o(Object.entries(e)),r=t.next();!r.done;r=t.next())n=a(r.value,2),s=n[0],c=n[1],u="number"==typeof c?c:c.variant,isNaN(u)?this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Skipping invalid variant for ".concat(s,": ").concat(u)):(null===(f=(g=this.config.context).override)||void 0===f||f.call(g,s,u),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Override: ".concat(s," -> variant ").concat(u)))}catch(e){d={error:e}}finally{try{r&&!r.done&&(h=t.return)&&h.call(t)}finally{if(d)throw d.error}}return[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.ready()]})})},e.prototype.getQueryStringOverrides=function(){var e,t;if("undefined"==typeof window||!window.location)return{};var r=new URLSearchParams(window.location.search),n={},i=this.config.queryPrefix;try{for(var s=o(r.entries()),c=s.next();!c.done;c=s.next()){var u=a(c.value,2),d=u[0],h=u[1];if(d.startsWith(i)){var g=d.substring(i.length);if(g){var f=h.split(","),p=parseInt(f[0],10);isNaN(p)||(1===f.length?n[g]=p:n[g]={variant:p,env:f[1]?parseInt(f[1],10):void 0,id:f[2]?parseInt(f[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return this.config.debug&&Object.keys(n).length>0&&(0,l.logDebug)("[OverridesPluginLite] Query string overrides:",n),n},e.prototype.getCookieOverrides=function(){var e,t;if("undefined"==typeof document)return{};var r=this.config.cookieName+"=",n=document.cookie.split(";");try{for(var i=o(n),a=i.next();!a.done;a=i.next()){var l=a.value;if(0===(l=l.trim()).indexOf(r)){var s=decodeURIComponent(l.substring(r.length));return this.parseCookieValue(s)}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return{}},e.prototype.parseCookieValue=function(e){var t,r;if(!e)return{};var n={},i=e;e.includes("|")&&(i=(p=e.split("|"))[p.length-1]);if(!i)return{};var l=i.split(",");try{for(var s=o(l),c=s.next();!c.done;c=s.next()){var u=c.value,d=a(u.split(":"),2),h=d[0],g=d[1];if(h&&g){var f=decodeURIComponent(h),p=g.split("."),v=parseInt(p[0],10);isNaN(v)||(1===p.length?n[f]=v:n[f]={variant:v,env:p[1]?parseInt(p[1],10):void 0,id:p[2]?parseInt(p[2],10):void 0})}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return n},e.prototype.persistOverridesToCookie=function(e){var t,r;if(this.config.cookieName&&"undefined"!=typeof document){var n=[];try{for(var i=o(Object.entries(e)),s=i.next();!s.done;s=i.next()){var c=a(s.value,2),u=c[0],d=c[1],h=encodeURIComponent(u);if("number"==typeof d)n.push("".concat(h,":").concat(d));else{var g="".concat(h,":").concat(d.variant);void 0!==d.env&&(g+=".".concat(d.env)),void 0!==d.id&&(g+=".".concat(d.id)),n.push(g)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}var f=n.join(",");document.cookie="".concat(this.config.cookieName,"=").concat(encodeURIComponent(f),";path=/;max-age=").concat(86400),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Persisted to cookie:",f)}},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.overridesPlugin={name:"OverridesPluginLite",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides"],instance:this,timestamp:Date.now()},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Registered with context at __plugins.overridesPlugin"))},e.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.config.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.config.context.__plugins.overridesPlugin,this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Unregistered from context"))},e.prototype.destroy=function(){this.initialized=!1,this.unregisterFromContext()},e}();t.OverridesPluginLite=s},91:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(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},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var l=r(609),s=function(){function e(e){void 0===e&&(e={}),this.context=e.context,this.debug=e.debug||!1,this.cookieDomain=e.cookieDomain||".absmartly.com",this.cookiePath=e.cookiePath||"/",this.sameSite=e.sameSite||"Lax",this.secure=e.secure||!1,this.cookieExpiryDays=e.cookieExpiryDays||730,this.unitIdCookieName=e.unitIdCookieName||"abs",this.publicIdCookieName=e.publicIdCookieName||"abs_public",this.expiryCookieName=e.expiryCookieName||"abs_expiry",this.utmCookieName=e.utmCookieName||"abs_utm_params",this.utmParams=e.utmParamsList||["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.autoUpdateExpiry=!1!==e.autoUpdateExpiry,this.expiryCheckInterval=e.expiryCheckInterval||30}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&l.logDebug.apply(void 0,a(["[CookiePlugin]"],o(e),!1))},e.prototype.getCookie=function(e){var t,r="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===r.length&&(null===(t=r.pop())||void 0===t?void 0:t.split(";").shift())||null},e.prototype.setCookie=function(e,t,r){try{var n=new Date,i=void 0!==r?r:this.cookieExpiryDays;n.setTime(n.getTime()+24*i*60*60*1e3);var o="expires=".concat(n.toUTCString()),a="".concat(e,"=").concat(t,";").concat(o,";path=").concat(this.cookiePath);return this.cookieDomain&&"localhost"!==this.cookieDomain&&(a+=";domain=".concat(this.cookieDomain)),a+=";SameSite=".concat(this.sameSite),this.secure&&(a+=";Secure"),document.cookie=a,this.debugLog("Set cookie ".concat(e,":"),t),!0}catch(t){return(0,l.logDebug)("[CookiePlugin] Unable to set cookie ".concat(e,":"),t),!1}},e.prototype.deleteCookie=function(e){this.setCookie(e,"",-1)},e.prototype.isLocalStorageAvailable=function(){try{var e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}},e.prototype.generateFastUniqueID=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=this.isLocalStorageAvailable(),r=null;return e&&(r=this.getCookie(this.unitIdCookieName)||this.getCookie(this.publicIdCookieName)),!r&&t&&(r=localStorage.getItem("abs_id")),r&&(this.unitId=r),r},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,r=this.isLocalStorageAvailable();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),r&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=this.generateFastUniqueID();return this.setUnitId(e),e},e.prototype.updateExpiryTimestamp=function(){if(navigator.cookieEnabled){var e=Date.now();this.setCookie(this.expiryCookieName,e.toString()),this.debugLog("Updated expiry timestamp:",e)}},e.prototype.isExpiryFresh=function(){if(!navigator.cookieEnabled)return!1;var e=this.getCookie(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),r=(Date.now()-t)/864e5,n=r<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:r,isFresh:n}),n}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e={},t=new URLSearchParams(window.location.search);if(this.utmParams.forEach(function(r){var n=t.get(r);n&&(e[r]=n)}),0===Object.keys(e).length&&document.referrer)try{var r=new URL(document.referrer);this.utmParams.forEach(function(t){var n=r.searchParams.get(t);n&&(e[t]=n)})}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(e).length){var n=this.getStoredUtmParams();if(n)return n}return e},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},r=navigator.cookieEnabled;if(this.isLocalStorageAvailable())try{localStorage.setItem(this.utmCookieName,JSON.stringify(t)),this.debugLog("Stored UTM params in localStorage:",e)}catch(e){this.debugLog("Failed to store UTM params in localStorage:",e)}r&&(this.setCookie(this.utmCookieName,JSON.stringify(t),30),this.debugLog("Stored UTM params in cookie:",e))}},e.prototype.getStoredUtmParams=function(){var e=null,t=this.isLocalStorageAvailable(),r=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&r&&(e=this.getCookie(this.utmCookieName)),e)try{var n=JSON.parse(e);if(Date.now()-n.timestamp<2592e6)return n.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t=this,r=e||this.context;if(r){var n=this.getUtmParams();Object.keys(n).length>0&&this.storeUtmParams(n),Object.entries(n).forEach(function(e){var n=o(e,2),i=n[0],a=n[1],l=i.slice(4);r.attribute(l,a),t.debugLog("Set attribute ".concat(l,":"),a)})}else(0,l.logDebug)("[CookiePlugin] No context available to apply UTM attributes")},e.prototype.clearAllCookies=function(){this.deleteCookie(this.unitIdCookieName),this.deleteCookie(this.publicIdCookieName),this.deleteCookie(this.expiryCookieName),this.deleteCookie(this.utmCookieName),this.isLocalStorageAvailable()&&(localStorage.removeItem("abs_id"),localStorage.removeItem(this.utmCookieName)),this.unitId=void 0,this.debugLog("All cookies and storage cleared")},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){return this.debugLog("Initializing CookiePlugin"),(e=this.getUnitId())?(this.debugLog("Using existing unit ID:",e),this.autoUpdateExpiry&&!this.isExpiryFresh()&&this.updateExpiryTimestamp()):(e=this.generateAndSetUnitId(),this.debugLog("Generated new unit ID:",e)),this.context&&this.applyUtmAttributesToContext(),this.debugLog("CookiePlugin initialized successfully"),[2]})})},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for CookiePlugin")},e.prototype.needsWorkerCall=function(e){var t=e||new URLSearchParams(window.location.search);if(Array.from(t.keys()).some(function(e){return e.startsWith("exp_")}))return this.debugLog("Worker call needed due to experiment overrides"),!0;var r=this.getUnitId(),n=navigator.cookieEnabled,i=this.isLocalStorageAvailable();if(r){if(n&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(n||i){var o=this.getCookie(this.expiryCookieName);return this.debugLog(o?"No existing ID but expiry cookie exists - need worker call":"No existing ID and no expiry cookie - need worker call"),!0}return!1},e.prototype.trackLanding=function(e){var t=e||this.context;if(t){var r=new URLSearchParams(window.location.search),n=this.utmParams.some(function(e){return r.get(e)}),i=document.referrer,o=i&&!i.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||this.isLocalStorageAvailable(),s=!!(this.getCookie(this.unitIdCookieName)||this.getCookie(this.publicIdCookieName)||this.getCookie(this.expiryCookieName)||this.isLocalStorageAvailable()&&localStorage.getItem("abs_id"));if(n||o||a&&!s){var c={referrer_url:i||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:this.isLocalStorageAvailable(),has_utm:n};this.debugLog("Tracking landing:",c),t.track("landing",c)}}else(0,l.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=s},196:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsPlugin=t.CookiePlugin=t.BrowserCookieAdapter=t.OverridesPlugin=t.OverridesPluginFull=t.DOMChangesPlugin=t.DOMChangesPluginLite=void 0;var o=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}});var a=r(977);Object.defineProperty(t,"OverridesPluginFull",{enumerable:!0,get:function(){return a.OverridesPluginFull}}),Object.defineProperty(t,"OverridesPlugin",{enumerable:!0,get:function(){return a.OverridesPluginFull}});var l=r(637);Object.defineProperty(t,"BrowserCookieAdapter",{enumerable:!0,get:function(){return l.BrowserCookieAdapter}});var s=r(91);Object.defineProperty(t,"CookiePlugin",{enumerable:!0,get:function(){return s.CookiePlugin}});var c=r(420);Object.defineProperty(t,"WebVitalsPlugin",{enumerable:!0,get:function(){return c.WebVitalsPlugin}}),i(r(574),t),i(r(639),t),t.default=o.DOMChangesPluginLite},214:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var a=r(609),l=function(){function e(e,t){void 0===t&&(t=!1),this.applyFn=e,this.pending=new Map,this.observers=new Map,this.appliedSelectors=new Set,this.batchTimer=null,this.batchedWork=new Set,this.debug=t}return e.prototype.addPending=function(e){var t=e.change,r=e.observerRoot,i=r;r&&!document.querySelector(r)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var o="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,a.logDebug)("[ABsmartly] Adding pending change for selector:",t.selector);var l=this.getObserverRoot(i).querySelector(t.selector);if(l)this.applyChange(l,n(n({},e),{observerRoot:i}));else{var s=this.pending.get(o)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(o,s),this.ensureObserver(i)}},e.prototype.removePending=function(e,t,r){var n="".concat(e,"-").concat(r||"document"),i=this.pending.get(n);if(i){var o=i.filter(function(e){return e.experimentName!==t});0===o.length?this.pending.delete(n):this.pending.set(n,o)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),a=n.next();!a.done;a=n.next()){var l=o(a.value,2),s=l[0],c=l[1].filter(function(t){return t.experimentName!==e});0===c.length?this.pending.delete(s):this.pending.set(s,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.cleanupObservers()},e.prototype.ensureObserver=function(e){var t=this,r=e||"document";if(!this.observers.has(r)){var n=this.getObserverRoot(e),i=new MutationObserver(function(r){t.handleMutations(r,e)});i.observe(n,{childList:!0,subtree:!0}),this.observers.set(r,i),this.debug&&(0,a.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,a,l,s=this,c=[];try{for(var u=i(e),d=u.next();!d.done;d=u.next()){var h=d.value,g=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var u=t||"document";try{for(var d=(r=void 0,i(f.pending.entries())),h=d.next();!h.done;h=d.next()){var g=o(h.value,2),p=g[0],v=g[1];if(p.endsWith("-".concat(u))){var y=function(t){var r=t.change;if(e.matches(r.selector))return c.push(function(){return s.applyChange(e,t)}),"continue";e.querySelectorAll(r.selector).forEach(function(e){c.push(function(){return s.applyChange(e,t)})})};try{for(var m=(a=void 0,i(v)),b=m.next();!b.done;b=m.next()){y(b.value)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(l=m.return)&&l.call(m)}finally{if(a)throw a.error}}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}},f=this;try{for(var p=(a=void 0,i(h.addedNodes)),v=p.next();!v.done;v=p.next()){g(v.value)}}catch(e){a={error:e}}finally{try{v&&!v.done&&(l=p.return)&&l.call(p)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}c.length>0&&this.batchWork(c)},e.prototype.batchWork=function(e){var t=this;e.forEach(function(e){return t.batchedWork.add(e)}),this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(function(){t.processBatchedWork()},32)},e.prototype.processBatchedWork=function(){var e=Array.from(this.batchedWork);this.batchedWork.clear(),this.batchTimer=null,this.debug&&e.length>0&&(0,a.logDebug)("[ABsmartly] Processing batched work:",e.length,"items"),e.forEach(function(e){return e()})},e.prototype.applyChange=function(e,t){var r=t.change,n=t.experimentName,i=t.observerRoot,o="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(o)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(o);var l="".concat(r.selector,"-").concat(i||"document"),s=this.pending.get(l);if(s){var c=s.filter(function(e){return e.experimentName!==n||e.change.selector!==r.selector});0===c.length?this.pending.delete(l):this.pending.set(l,c)}this.checkObserverCleanup(i)}},e.prototype.getObserverRoot=function(e){if(!e)return document.documentElement;var t=document.querySelector(e);return t||document.documentElement},e.prototype.checkObserverCleanup=function(e){var t,r,n=e||"document",o=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next()){if(s.value.endsWith("-".concat(n))){o=!0;break}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}if(!o){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,a.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,o=this,l=[];try{for(var s=i(this.observers.keys()),c=s.next();!c.done;c=s.next()){var u=c.value,d=!1;try{for(var h=(r=void 0,i(this.pending.keys())),g=h.next();!g.done;g=h.next()){if(g.value.endsWith("-".concat(u))){d=!0;break}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}d||l.push(u)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}l.forEach(function(e){var t=o.observers.get(e);t&&(t.disconnect(),o.observers.delete(e),o.debug&&(0,a.logDebug)("[ABsmartly] Cleaned up observer for root:",e))})},e.prototype.destroy=function(){var e,t;this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null);try{for(var r=i(this.observers.values()),n=r.next();!n.done;n=r.next()){n.value.disconnect()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.observers.clear(),this.pending.clear(),this.appliedSelectors.clear(),this.batchedWork.clear(),this.debug&&(0,a.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){r+=o.value.length}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.getAppliedCount=function(){return this.appliedSelectors.size},e.prototype.hasPendingForExperiment=function(e){var t,r;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){if(o.value.some(function(t){return t.experimentName===e}))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},e}();t.PendingChangeManager=l},248:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},l=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPlugin=void 0;var u=r(44),d=r(609),h=function(e){function t(t){var r,n,i,o,a,l,s,c,u,h,g,f,p,v,y,m,b,x,w,k,C,S=e.call(this,{context:t.context,cookieName:t.cookieName,useQueryString:null!==(r=t.useQueryString)&&void 0!==r?r:"undefined"!=typeof window,queryPrefix:null!==(n=t.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(i=t.persistQueryToCookie)&&void 0!==i&&i,debug:null!==(o=t.debug)&&void 0!==o&&o})||this;if(S.onExperimentsAddedCallbacks=[],!t.context)throw new Error("[OverridesPlugin] Context is required");S.isServerSide="undefined"==typeof window;var E,O=t.sdkEndpoint;O||((E=t.context)._endpoint?O=E._endpoint:(null===(a=E._config)||void 0===a?void 0:a.endpoint)?O=E._config.endpoint:(null===(l=E._dataProvider)||void 0===l?void 0:l._endpoint)?O=E._dataProvider._endpoint:(null===(s=E._options)||void 0===s?void 0:s.endpoint)&&(O=E._options.endpoint.replace("/v1","")));if(!O&&!t.absmartlyEndpoint&&!((E=t.context)._endpoint||(null===(c=E._config)||void 0===c?void 0:c.endpoint)||(null===(u=E._dataProvider)||void 0===u?void 0:u._endpoint)||(null===(h=E._options)||void 0===h?void 0:h.endpoint)))throw new Error("[OverridesPlugin] SDK endpoint must be provided if not available from context");return S.fullConfig={context:t.context,cookieName:t.cookieName,cookieAdapter:t.cookieAdapter,cookieOptions:null!==(g=t.cookieOptions)&&void 0!==g?g:{path:"/"},useQueryString:null!==(f=t.useQueryString)&&void 0!==f?f:!S.isServerSide,queryPrefix:null!==(p=t.queryPrefix)&&void 0!==p?p:"_exp_",envParam:null!==(v=t.envParam)&&void 0!==v?v:"env",persistQueryToCookie:null!==(y=t.persistQueryToCookie)&&void 0!==y&&y,url:t.url,absmartlyEndpoint:null!==(m=t.absmartlyEndpoint)&&void 0!==m?m:"",sdkEndpoint:O||"",domChangesFieldName:null!==(b=t.domChangesFieldName)&&void 0!==b?b:"__dom_changes",sdkApiKey:null!==(x=t.sdkApiKey)&&void 0!==x?x:"",application:null!==(w=t.application)&&void 0!==w?w:"",environment:null!==(k=t.environment)&&void 0!==k?k:"",debug:null!==(C=t.debug)&&void 0!==C&&C},S.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Initialized with config:",{isServerSide:S.isServerSide,cookieName:S.fullConfig.cookieName,useQueryString:S.fullConfig.useQueryString,queryPrefix:S.fullConfig.queryPrefix,envParam:S.fullConfig.envParam,persistQueryToCookie:S.fullConfig.persistQueryToCookie,sdkEndpoint:S.fullConfig.sdkEndpoint,absmartlyEndpoint:S.fullConfig.absmartlyEndpoint}),S}return i(t,e),t.prototype.ready=function(){return a(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return this.initialized?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Already initialized, skipping re-initialization"),[2]):(this.initialized=!0,this.registerWithContext(),e=this.getOverrides(),0===Object.keys(e.overrides).length?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No overrides found"),[2]):[4,this.applyOverridesWithFetching(e.overrides,e.devEnv)]);case 1:return t.sent(),[2]}})})},t.prototype.initialize=function(){return a(this,void 0,void 0,function(){return l(this,function(e){return[2,this.ready()]})})},t.prototype.getOverrides=function(){var e={overrides:{},devEnv:null};if(this.fullConfig.cookieName){var t=this.getEnhancedCookieOverrides();e.overrides=o({},t.overrides),e.devEnv=t.devEnv}if(this.fullConfig.useQueryString){var r=this.getEnhancedQueryStringOverrides();Object.keys(r.overrides).length>0&&(e.overrides=o(o({},e.overrides),r.overrides),null!==r.devEnv&&(e.devEnv=r.devEnv),this.fullConfig.persistQueryToCookie&&this.fullConfig.cookieName&&this.persistEnhancedOverridesToCookie(e))}return e},t.prototype.getEnhancedQueryStringOverrides=function(){var e,t;try{var r=void 0;if(this.isServerSide){if(!this.fullConfig.url)return{overrides:{},devEnv:null};var n="string"==typeof this.fullConfig.url?new URL(this.fullConfig.url):this.fullConfig.url;r=new URLSearchParams(n.search)}else r=new URLSearchParams(window.location.search);var i={},o=null;if(this.fullConfig.envParam){var a=r.get(this.fullConfig.envParam);a&&(o=a)}var l=this.fullConfig.queryPrefix;try{for(var u=s(r.entries()),h=u.next();!h.done;h=u.next()){var g=c(h.value,2),f=g[0],p=g[1];if(f.startsWith(l)){var v=f.substring(l.length);if(v){var y=p.split(","),m=parseInt(y[0],10);isNaN(m)||(1===y.length?i[v]=m:i[v]={variant:m,env:y[1]?parseInt(y[1],10):void 0,id:y[2]?parseInt(y[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}return this.fullConfig.debug&&Object.keys(i).length>0&&(0,d.logDebug)("[OverridesPlugin] Query string overrides:",i,"env:",o),{overrides:i,devEnv:o}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing query string:",e),{overrides:{},devEnv:null}}},t.prototype.getEnhancedCookieOverrides=function(){var e,t;if(!this.fullConfig.cookieName)return{overrides:{},devEnv:null};var r=null;if(this.fullConfig.cookieAdapter)r=this.fullConfig.cookieAdapter.get(this.fullConfig.cookieName);else if("undefined"!=typeof document){var n=this.fullConfig.cookieName+"=",i=document.cookie.split(";");try{for(var o=s(i),a=o.next();!a.done;a=o.next()){var l=a.value;if(0===(l=l.trim()).indexOf(n)){r=decodeURIComponent(l.substring(n.length));break}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}this.fullConfig.debug&&r&&(0,d.logDebug)("[OverridesPlugin] Raw cookie value:",r);var c=this.parseEnhancedCookieValue(r);return this.fullConfig.debug&&Object.keys(c.overrides).length>0&&(0,d.logDebug)("[OverridesPlugin] Parsed cookie overrides:",c),c},t.prototype.parseEnhancedCookieValue=function(e){var t,r;if(!e)return{overrides:{},devEnv:null};try{var n=null,i=e;if(e.startsWith("devEnv=")){var o=e.split("|");n=decodeURIComponent(o[0].substring(7)),i=o[1]||""}var a={};if(i){var l=i.split(",");try{for(var u=s(l),h=u.next();!h.done;h=u.next()){var g=h.value,f=c(g.split(":"),2),p=f[0],v=f[1];if(p&&v){var y=decodeURIComponent(p),m=(o=v.split("."),parseInt(o[0],10));isNaN(m)||(1===o.length?a[y]=m:a[y]={variant:m,env:o[1]?parseInt(o[1],10):void 0,id:o[2]?parseInt(o[2],10):void 0})}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}}return{overrides:a,devEnv:n}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing overrides:",e),{overrides:{},devEnv:null}}},t.prototype.persistEnhancedOverridesToCookie=function(e){var t,r;if(this.fullConfig.cookieName){var n=[];e.devEnv&&n.push("devEnv=".concat(encodeURIComponent(e.devEnv)));var i=[];try{for(var a=s(Object.entries(e.overrides)),l=a.next();!l.done;l=a.next()){var u=c(l.value,2),h=u[0],g=u[1],f=encodeURIComponent(h);if("number"==typeof g)i.push("".concat(f,":").concat(g));else{var p=g,v="".concat(f,":").concat(p.variant);void 0!==p.env&&(v+=".".concat(p.env)),void 0!==p.id&&(v+=".".concat(p.id)),i.push(v)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var y=n.length>0?"".concat(n.join("|"),"|").concat(i.join(",")):i.join(",");if(this.fullConfig.cookieAdapter){var m=o({},this.fullConfig.cookieOptions);this.isServerSide&&(void 0===m.httpOnly&&(m.httpOnly=!0),void 0===m.secure&&(m.secure=!0),void 0===m.sameSite&&(m.sameSite="lax")),this.fullConfig.cookieAdapter.set(this.fullConfig.cookieName,y,m)}else if("undefined"!=typeof document){m=this.fullConfig.cookieOptions||{};var b="".concat(this.fullConfig.cookieName,"=").concat(encodeURIComponent(y));m.path&&(b+=";path=".concat(m.path)),m.maxAge&&(b+=";max-age=".concat(m.maxAge));var x=m;if(x.expires){var w=x.expires instanceof Date?x.expires.toUTCString():x.expires;b+=";expires=".concat(w)}m.domain&&(b+=";domain=".concat(m.domain)),m.secure&&(b+=";secure"),m.sameSite&&(b+=";samesite=".concat(m.sameSite)),document.cookie=b}this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Persisted to cookie:",y)}},t.prototype.applyOverridesWithFetching=function(e,t){return a(this,void 0,void 0,function(){var r,n,i,o,a,u,h,g,f,p,v,y,m,b,x,w,k,C;return l(this,function(l){switch(l.label){case 0:(0,d.logDebug)("[OverridesPlugin] Initializing with overrides:",e),(0,d.logDebug)("[OverridesPlugin] Dev environment:",t),r=[],n=new Set;try{for(i=s(Object.entries(e)),o=i.next();!o.done;o=i.next())a=c(o.value,2),u=a[0],m=a[1],1===(h="number"==typeof m?{variant:m}:m).env?((0,d.logDebug)("[OverridesPlugin] ".concat(u," categorized as DEV experiment (env=1)")),r.push([u,h])):2===h.env&&h.id?((0,d.logDebug)("[OverridesPlugin] ".concat(u," categorized as DRAFT experiment (env=2, id=").concat(h.id,")")),n.add(h.id)):(0,d.logDebug)("[OverridesPlugin] ".concat(u," categorized as RUNNING experiment (env=").concat(h.env||0,")"))}catch(e){x={error:e}}finally{try{o&&!o.done&&(w=i.return)&&w.call(i)}finally{if(x)throw x.error}}return(0,d.logDebug)("[OverridesPlugin] Categorization summary:",{total_overrides:Object.keys(e).length,dev_experiments:r.length,draft_experiments:n.size,running_experiments:Object.keys(e).length-r.length-n.size,dev_environment:t}),n.size>0?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(n.size," DRAFT experiments from API")),[4,this.fetchFromAPI(Array.from(n))]):[3,2];case 1:l.sent(),l.label=2;case 2:return g=t||this.fullConfig.environment||null,r.length>0&&g?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(r.length," DEV experiments for environment: ").concat(g)),[4,this.fetchFromDevSDK(r,g)]):[3,4];case 3:return l.sent(),[3,5];case 4:r.length>0&&(0,d.logDebug)("[OverridesPlugin] Have ".concat(r.length," DEV experiments but NO devEnv specified - NOT fetching")),l.label=5;case 5:try{for(f=s(Object.entries(e)),p=f.next();!p.done;p=f.next())v=c(p.value,2),y=v[0],m=v[1],b="number"==typeof m?m:m.variant,this.fullConfig.context.override(y,b),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Override: ".concat(y," -> variant ").concat(b))}catch(e){k={error:e}}finally{try{p&&!p.done&&(C=f.return)&&C.call(f)}finally{if(k)throw k.error}}return[2]}})})},t.prototype.fetchFromAPI=function(e){return a(this,void 0,void 0,function(){var t,r,n,i,o,a;return l(this,function(l){switch(l.label){case 0:if(0===e.length)return this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No experiment IDs to fetch from API"),[2];(t=this.fullConfig.absmartlyEndpoint)||(t=this.fullConfig.sdkEndpoint.replace(".absmartly.io",".absmartly.com")),t.endsWith("/v1")&&(t=t.slice(0,-3)),t.startsWith("http")||(t="https://".concat(t)),r="".concat(t,"/v1/experiments?ids=").concat(e.join(",")),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching non-running experiments from API:",r),l.label=1;case 1:return l.trys.push([1,4,,5]),n={"Content-Type":"application/json"},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(r,{method:"GET",credentials:"include",headers:n,mode:"cors"})];case 2:return i=l.sent(),(0,d.logDebug)("[OverridesPlugin] API Response status:",i.status,i.statusText),i.ok?[4,i.json()]:((0,d.logDebug)("[OverridesPlugin] API request failed with status ".concat(i.status)),401===i.status&&(0,d.logDebug)("[OverridesPlugin] Check if you need to log in to the ABsmartly console first"),[2]);case 3:return(o=l.sent()).experiments&&(this.injectExperimentsIntoContext(o.experiments),this.notifyExperimentsAdded()),[3,5];case 4:return a=l.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from API:",a),[3,5];case 5:return[2]}})})},t.prototype.fetchFromDevSDK=function(e,t){return a(this,void 0,void 0,function(){var e,r,n,i,a,s,u;return l(this,function(l){switch(l.label){case 0:(e=this.fullConfig.sdkEndpoint).startsWith("http")||(e="https://".concat(e)),e.endsWith("/v1")&&(e=e.slice(0,-3)),r="".concat(e,"/v1/context?environment=").concat(encodeURIComponent(t)),this.fullConfig.application&&(r+="&application=".concat(encodeURIComponent(this.fullConfig.application))),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching development experiments from SDK:",r),l.label=1;case 1:return l.trys.push([1,4,,5]),n={},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(r,{method:"GET",headers:n})];case 2:return i=l.sent(),(0,d.logDebug)("[OverridesPlugin] DEV Response status:",i.status,i.statusText),i.ok?[4,i.json()]:((0,d.logDebug)("[OverridesPlugin] DEV SDK request failed with status ".concat(i.status)),[2]);case 3:return(a=l.sent()).experiments&&(s=Object.entries(a.experiments).map(function(e){var t=c(e,2),r=t[0],n=t[1];return o(o({},n),{name:r})}),this.injectExperimentsIntoContext(s),this.notifyExperimentsAdded()),[3,5];case 4:return u=l.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from dev SDK:",u),[3,5];case 5:return[2]}})})},t.prototype.injectExperimentsIntoContext=function(e){var t,r,n,i,a,l=this.fullConfig.context.data.bind(this.fullConfig.context),u=new Map;try{for(var h=s(e),g=h.next();!g.done;g=h.next()){var f=g.value,p={id:f.id,name:f.name,unitType:(null===(i=f.unit_type)||void 0===i?void 0:i.name)||"user_id",iteration:f.iteration||1,seedHi:0,seedLo:0,split:f.split||[],trafficSeedHi:0,trafficSeedLo:0,trafficSplit:[0,1],fullOnVariant:0,applications:(null===(a=f.applications)||void 0===a?void 0:a.map(function(e){var t;return{name:(null===(t=e.application)||void 0===t?void 0:t.name)||e.name}}))||[],variants:[],audience:f.audience||"",audienceStrict:f.audience_strict||!1};if(f.variants&&Array.isArray(f.variants))for(var v=0;v<f.variants.length;v++){var y=f.variants[v],m={name:y.name||"Variant ".concat(v),config:"string"==typeof y.config?y.config:JSON.stringify(y.config||{})};if(y.variables)m.variables=y.variables;else if(y.config)try{var b="string"==typeof y.config?JSON.parse(y.config):y.config,x=this.fullConfig.domChangesFieldName;b[x]&&(m.variables=((n={})[x]=b[x],n),(0,d.logDebug)("[OverridesPlugin] Variant ".concat(v," has DOM changes field '").concat(x,"'")))}catch(e){(0,d.logDebug)("[OverridesPlugin] Failed to parse variant config:",e)}p.variants[v]=m}u.set(f.name,p)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}this.fullConfig.context.data=function(){var e,t,r=l();if(!r)return r;var n=r.experiments||[],i=new Set(n.map(function(e){return e.name})),a=function(e,t){if(i.has(e)){var r=n.findIndex(function(t){return t.name===e});r>=0&&(n[r]=t)}else n.push(t)};try{for(var d=s(u),h=d.next();!h.done;h=d.next()){var g=c(h.value,2);a(g[0],g[1])}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}return o(o({},r),{experiments:n})},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Injected ".concat(e.length," experiments into context"))},t.prototype.onExperimentsAdded=function(e){this.onExperimentsAddedCallbacks.push(e)},t.prototype.notifyExperimentsAdded=function(){var e,t;this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Notifying ".concat(this.onExperimentsAddedCallbacks.length," listeners about new experiments"));try{for(var r=s(this.onExperimentsAddedCallbacks),n=r.next();!n.done;n=r.next()){var i=n.value;try{i()}catch(e){(0,d.logDebug)("[OverridesPlugin] Error in experiments added callback:",e)}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.registerWithContext=function(){this.fullConfig.context&&(this.fullConfig.context.__plugins||(this.fullConfig.context.__plugins={}),this.fullConfig.context.__plugins.overridesPlugin={name:"OverridesPlugin",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides","api-fetch","dev-environments"],instance:this,timestamp:Date.now()},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Registered with context at __plugins.overridesPlugin"))},t.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.fullConfig.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.fullConfig.context.__plugins.overridesPlugin,this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Unregistered from context"))},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.unregisterFromContext(),this.onExperimentsAddedCallbacks=[]},t}(u.OverridesPluginLite);t.OverridesPlugin=h},253:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(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},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLInjector=void 0;var a=r(609),l=r(973),s=function(){function e(e){void 0===e&&(e=!1),this.injectedIds=new Set,this.debug=e}return e.prototype.parseInjectionKey=function(e){var t,r;try{for(var i=n(["headStart","headEnd","bodyStart","bodyEnd"]),o=i.next();!o.done;o=i.next()){var l=o.value;if(e===l)return{location:l,priority:0};if(e.startsWith(l)){var s=e.substring(l.length),c=parseInt(s,10);if(!isNaN(c))return{location:l,priority:c}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,o,s,c,u,d,h,g;void 0===t&&(t=window.location.href);var f=new Map;try{for(var p=n(e),v=p.next();!v.done;v=p.next()){var y=i(v.value,2),m=y[0],b=y[1];try{for(var x=(s=void 0,n(b)),w=x.next();!w.done;w=x.next()){var k=i(w.value,2),C=k[0],S=k[1];if(S&&"object"==typeof S){if(S.urlFilter)if(!l.URLMatcher.matches(S.urlFilter,t)){this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(C," - URL filter doesn't match:"),{currentUrl:t,urlFilter:S.urlFilter});continue}var E=S.data;if(E&&"object"==typeof E)try{for(var O=(u=void 0,n(Object.entries(E))),_=O.next();!_.done;_=O.next()){var A=i(_.value,2),D=A[0],P=A[1];if("string"==typeof P){var j=this.parseInjectionKey(D);if(j){var L={code:P,priority:j.priority,location:j.location};f.has(j.location)||f.set(j.location,[]),f.get(j.location).push(L),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:C,location:j.location,priority:j.priority,codeLength:P.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(D,":"),P)}}catch(e){u={error:e}}finally{try{_&&!_.done&&(d=O.return)&&d.call(O)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(C,":"),E)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(C,":"),S)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}try{for(var T=n(f),M=T.next();!M.done;M=T.next()){var I=i(M.value,2),N=I[0],B=I[1];B.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(N," injections by priority:"),{location:N,count:B.length,priorities:B.map(function(e){return e.priority})})}}catch(e){h={error:e}}finally{try{M&&!M.done&&(g=T.return)&&g.call(T)}finally{if(h)throw h.error}}return f},e.prototype.inject=function(e){var t,r,l,s;try{for(var c=n(e),u=c.next();!u.done;u=c.next()){var d=i(u.value,2),h=d[0],g=d[1],f="headStart"===h||"bodyStart"===h?o([],i(g),!1).reverse():g;try{for(var p=(l=void 0,n(f)),v=p.next();!v.done;v=p.next()){var y=v.value;this.injectAtLocation(h,y.code)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(s=p.return)&&s.call(p)}finally{if(l)throw l.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}this.debug&&(0,a.logDebug)("[HTMLInjector] All injections complete")},e.prototype.injectAtLocation=function(e,t){var r="absmartly-inject-".concat(e,"-").concat(Date.now(),"-").concat(Math.random());if(!this.injectedIds.has(r))try{switch(e){case"headStart":this.injectHeadStart(t,r);break;case"headEnd":this.injectHeadEnd(t,r);break;case"bodyStart":this.injectBodyStart(t,r);break;case"bodyEnd":this.injectBodyEnd(t,r)}this.injectedIds.add(r),this.debug&&(0,a.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:r})}catch(t){this.debug&&(0,a.logDebug)("[HTMLInjector] Error injecting at ".concat(e,":"),t)}},e.prototype.injectHeadStart=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.insertBefore(r,document.head.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headStart injection")},e.prototype.injectHeadEnd=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headEnd injection")},e.prototype.injectBodyStart=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.insertBefore(r,document.body.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyStart injection")},e.prototype.injectBodyEnd=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyEnd injection")},e.prototype.createContainer=function(e,t){var r=document.createElement("div");return r.id=t,r.setAttribute("data-absmartly-injection","true"),r.innerHTML=e,r},e.prototype.destroy=function(){var e,t;try{for(var r=n(this.injectedIds),i=r.next();!i.done;i=r.next()){var o=i.value,l=document.getElementById(o);l&&l.remove()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.injectedIds.clear(),this.debug&&(0,a.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},356:function(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(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},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VariantExtractor=void 0;var l=r(609),s=r(973),c=function(){function e(e,t,r,n){void 0===t&&(t="variable"),void 0===r&&(r="__dom_changes"),void 0===n&&(n=!1),this.cachedAllChanges=null,this.context=e,this.dataSource=t,this.dataFieldName=r,this.debug=n}return e.prototype.clearCache=function(){this.cachedAllChanges=null},e.prototype.extractAllChanges=function(){var e,t,r,n,s,c,u;if(this.cachedAllChanges)return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Returning cached changes"),this.cachedAllChanges;var d=new Map;try{var h=this.context.data();if((0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!h,contextKeys:h?Object.keys(h):[],experimentCount:(null===(r=null==h?void 0:h.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==h?void 0:h.experiments)||void 0===n?void 0:n[0])?{name:h.experiments[0].name,variantCount:(null===(s=h.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=h.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(h.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(h).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!h,experimentCount:(null===(u=null==h?void 0:h.experiments)||void 0===u?void 0:u.length)||0}),null==h?void 0:h.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",h.experiments.map(function(e){var t;return{name:e.name,hasVariants:!!e.variants,variantCount:(null===(t=e.variants)||void 0===t?void 0:t.length)||0}}));try{for(var g=i(h.experiments),f=g.next();!f.done;f=g.next()){var p=f.value,v=this.extractAllVariantsForExperiment(p);v.size>0?(d.set(p.name,v),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(p.name,"' has DOM changes:"),{variantsWithChanges:Array.from(v.keys()),changesByVariant:Array.from(v.entries()).map(function(e){var t=o(e,2),r=t[0],n=t[1];return{variant:r,changeCount:n.length,changeTypes:a([],o(new Set(n.map(function(e){return e.type}))),!1)}})})):this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(p.name,"' has no DOM changes"))}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=g.return)&&t.call(g)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=d,d},e.prototype.extractAllVariantsForExperiment=function(e){var t,r=new Map;if((0,l.logDebug)("[DEBUG] Processing experiment:",e.name,"with",(null===(t=e.variants)||void 0===t?void 0:t.length)||0,"variants"),!e.variants)return(0,l.logDebug)("[DEBUG] No variants found for experiment:",e.name),r;for(var n=0;n<e.variants.length;n++){var i=e.variants[n];if(i){var o=null;if("variable"===this.dataSource){if(i.variables&&i.variables[this.dataFieldName])o=i.variables[this.dataFieldName],(0,l.logDebug)("[VariantExtractor DEBUG] ✓ Found DOM changes in variables[".concat(this.dataFieldName,"]:"),o);else if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;a&&a[this.dataFieldName]?(o=a[this.dataFieldName],(0,l.logDebug)("[VariantExtractor DEBUG] ✓ Found DOM changes in config[".concat(this.dataFieldName,"]:"),o)):(0,l.logDebug)("[VariantExtractor DEBUG] ✗ No",this.dataFieldName,"field found in parsed config")}catch(e){(0,l.logDebug)("[VariantExtractor DEBUG] ✗ Failed to parse variant.config:",e,"Raw config:","string"==typeof i.config?i.config.substring(0,100):"")}if(o){var s=this.extractChangesFromData(o);s&&s.length>0&&r.set(n,s)}}}}return r},e.prototype.extractChangesFromData=function(e){if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(e&&"object"==typeof e&&!Array.isArray(e)&&"changes"in e){var t=e;return this.parseChanges(t.changes)}return this.parseChanges(e)},e.prototype.getExperimentChanges=function(e){var t=this.extractAllChanges().get(e);if(!t||0===t.size)return null;var r=this.context.peek(e);return null==r?(this.debug&&(0,l.logDebug)("[ABsmartly] No variant selected for ".concat(e)),null):t.get(r)||null},e.prototype.parseChanges=function(e){var t,r;if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(!Array.isArray(e))return this.debug&&(0,l.logDebug)("[ABsmartly] DOM changes data is not an array"),null;var n=[];try{for(var o=i(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.isValidChange(s)?n.push(s):this.debug&&(0,l.logDebug)("[ABsmartly] Invalid DOM change:",s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n.length>0?n:null},e.prototype.isValidChange=function(e){if(!e||"object"!=typeof e)return!1;var t=e;if(void 0===t.selector||null===t.selector||!t.type)return!1;if(!["text","html","style","class","attribute","javascript","move","create","delete","styleRules"].includes(t.type))return!1;switch(t.type){case"class":if(!t.add&&!t.remove)return!1;if(t.add&&!Array.isArray(t.add))return!1;if(t.remove&&!Array.isArray(t.remove))return!1;break;case"move":if(!t.targetSelector)return!1;break;case"create":if(!t.element||!t.targetSelector)return!1;break;case"style":case"attribute":if(!t.value||"object"!=typeof t.value)return!1}return!0},e.prototype.getAllVariantChanges=function(e){var t=this.extractAllChanges().get(e);if(!t)return[];for(var r=Math.max.apply(Math,a([],o(t.keys()),!1)),n=[],i=0;i<=r;i++)n.push(t.get(i)||[]);return n},e.prototype.getExperiment=function(e){try{var t=this.context.data();return t&&t.experiments&&t.experiments.find(function(t){return t.name===e})||null}catch(t){return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Failed to get experiment '".concat(e,"' - context may not be ready:"),t),null}},e.prototype.getAllVariantsData=function(e){var t=new Map;try{var r=this.context.data();if(!(null==r?void 0:r.experiments))return t;var n=r.experiments.find(function(t){return t.name===e});if(!(null==n?void 0:n.variants))return t;for(var i=0;i<n.variants.length;i++){var o=n.variants[i];if(o){var a=null;if("variable"===this.dataSource)if(o.variables&&o.variables[this.dataFieldName])a=o.variables[this.dataFieldName];else if(o.config)try{var s="string"==typeof o.config?JSON.parse(o.config):o.config;s&&s[this.dataFieldName]&&(a=s[this.dataFieldName])}catch(e){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(a){if("string"==typeof a)try{a=JSON.parse(a)}catch(e){(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,a)}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error getting all variants data:",e)}return t},e.prototype.anyVariantMatchesURL=function(e,t){var r,n;void 0===t&&(t=window.location.href);var a=this.getAllVariantsData(e),l=!1;try{for(var c=i(a),u=c.next();!u.done;u=c.next()){var d=o(u.value,2)[1];if(d&&"object"==typeof d&&!Array.isArray(d)&&"urlFilter"in d){var h=d;if(h.urlFilter&&(l=!0,s.URLMatcher.matches(h.urlFilter,t)))return!0}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return!l},e.prototype.extractAllInjectHTML=function(){var e,t,r=new Map;try{var n=this.context.data();if(this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting __inject_html from context"),null==n?void 0:n.experiments)try{for(var o=i(n.experiments),a=o.next();!a.done;a=o.next()){var s=a.value,c=this.extractInjectHTMLForExperiment(s);c.size>0&&(r.set(s.name,c),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(s.name,"' has HTML injections:"),{variantsWithInjections:Array.from(c.keys())}))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting __inject_html:",e)}return r},e.prototype.extractInjectHTMLForExperiment=function(e){var t=new Map;if(!e.variants)return t;for(var r=0;r<e.variants.length;r++){var i=e.variants[r];if(i&&(i.variables&&i.variables.__inject_html)){var o=i.variables.__inject_html;if("object"!=typeof o||Array.isArray(o))this.debug&&(0,l.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),o);else{var a=o,s=a.urlFilter,c=n(a,["urlFilter"]),u={data:c,urlFilter:s||void 0};t.set(r,u),this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(c),hasUrlFilter:!!s})}}}return t},e}();t.VariantExtractor=c},420:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},a=this&&this.__read||function(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},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsPlugin=void 0;var c=r(609),u=function(){function e(e){void 0===e&&(e={}),this.webVitalsLoaded=!1,this.metricsTracked=!1,this.context=e.context,this.debug=e.debug||!1,this.trackWebVitals=!1!==e.trackWebVitals,this.trackPageMetrics=!1!==e.trackPageMetrics,this.webVitalsUrl=e.webVitalsUrl||"https://unpkg.com/web-vitals@4/dist/web-vitals.iife.js",this.autoTrack=!1!==e.autoTrack}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&c.logDebug.apply(void 0,l(["[WebVitalsPlugin]"],a(e),!1))},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for WebVitalsPlugin")},e.prototype.loadWebVitalsLibrary=function(){return i(this,void 0,void 0,function(){var e=this;return o(this,function(t){return this.webVitalsLoaded||"undefined"==typeof window?[2]:[2,new Promise(function(t,r){var n=document.createElement("script");n.src=e.webVitalsUrl,n.onload=function(){e.webVitalsLoaded=!0,e.debugLog("Web Vitals library loaded"),t()},n.onerror=function(e){(0,c.logDebug)("[WebVitalsPlugin] Failed to load Web Vitals library:",e),r(e)},document.head.appendChild(n)})]})})},e.prototype.trackWebVitalsMetrics=function(e){return i(this,void 0,void 0,function(){var t,r,i,a=this;return o(this,function(o){switch(o.label){case 0:if(!(t=e||this.context))return(0,c.logDebug)("[WebVitalsPlugin] No context available for tracking web vitals"),[2];if(!this.trackWebVitals)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.loadWebVitalsLibrary()];case 2:return o.sent(),(r=window.webVitals)?(r.onCLS(function(e){a.debugLog("CLS:",e),t.track("cls_score",n({},e))}),r.onLCP(function(e){a.debugLog("LCP:",e),t.track("lcp_score",n({},e))}),r.onFCP(function(e){a.debugLog("FCP:",e),t.track("fcp_score",n({},e))}),r.onINP(function(e){a.debugLog("INP:",e),t.track("inp_score",n({},e))}),r.onTTFB(function(e){a.debugLog("TTFB:",e),t.track("ttfb_score",n({},e))}),this.debugLog("Web Vitals tracking initialized"),[3,4]):((0,c.logDebug)("[WebVitalsPlugin] Web Vitals library not available"),[2]);case 3:return i=o.sent(),(0,c.logDebug)("[WebVitalsPlugin] Error tracking web vitals:",i),t.track("vitals_tracking_error",{error:i.message,type:i.name}),[3,4];case 4:return[2]}})})},e.prototype.trackPageMetricsData=function(e){var t=this,r=e||this.context;if(r){if(this.trackPageMetrics&&!this.metricsTracked)try{this.trackImmediateMetrics(r),"complete"===document.readyState?this.trackLoadMetrics(r):window.addEventListener("load",function(){return t.trackLoadMetrics(r)}),this.metricsTracked=!0}catch(e){(0,c.logDebug)("[WebVitalsPlugin] Error tracking page metrics:",e),r.track("metrics_tracking_error",{error:e.message,type:e.name})}}else(0,c.logDebug)("[WebVitalsPlugin] No context available for tracking page metrics")},e.prototype.trackImmediateMetrics=function(e){var t,r,n,i,o=performance.getEntriesByType("navigation")[0];if(o){var l={dns:o.domainLookupEnd-o.domainLookupStart,tcp:o.connectEnd-o.connectStart,ttfb:o.responseStart-o.requestStart,download:o.responseEnd-o.responseStart,total_fetch:o.responseEnd-o.requestStart};try{for(var c=s(Object.entries(l)),u=c.next();!u.done;u=c.next()){var d=a(u.value,2),h=d[0],g=d[1];e.track("page_timing_".concat(h),{value:g,unit:"ms"}),this.debugLog("Page timing ".concat(h,":"),g)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var f={total_size:o.transferSize,header_size:o.transferSize-o.encodedBodySize,html_size:o.decodedBodySize,compressed_html_size:o.encodedBodySize};try{for(var p=s(Object.entries(f)),v=p.next();!v.done;v=p.next()){var y=a(v.value,2);h=y[0],g=y[1];e.track("page_".concat(h),{value:g,unit:"bytes"}),this.debugLog("Page ".concat(h,":"),g)}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}if(o.encodedBodySize>0){var m=o.decodedBodySize/o.encodedBodySize;e.track("page_compression_ratio",{value:m}),this.debugLog("Compression ratio:",m)}}else this.debugLog("Navigation timing not available")},e.prototype.trackLoadMetrics=function(e){var t,r,n=performance.getEntriesByType("navigation")[0];if(n){var i=n.domComplete-n.responseEnd;e.track("page_timing_dom_processing",{value:i,metric:"DOM Processing",unit:"ms",rating:i<=500?"good":i<=1e3?"needs-improvement":"poor"}),this.debugLog("DOM processing:",i);var o=n.loadEventEnd-n.fetchStart;e.track("page_timing_total_load",{value:o,metric:"Total Load",unit:"ms",rating:o<=2e3?"good":o<=4e3?"needs-improvement":"poor"}),this.debugLog("Total load:",o);var l={elements:document.getElementsByTagName("*").length,imageCount:document.getElementsByTagName("img").length,scriptCount:document.getElementsByTagName("script").length,styleCount:document.getElementsByTagName("style").length,linkCount:document.getElementsByTagName("link").length};try{for(var c=s(Object.entries(l)),u=c.next();!u.done;u=c.next()){var d=a(u.value,2),h=d[0],g=d[1];e.track("dom_".concat(h),{value:g,metric:h,unit:"count",rating:g<=1e3?"good":g<=2e3?"needs-improvement":"poor"}),this.debugLog("DOM ".concat(h,":"),g)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}}},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return this.debugLog("Initializing WebVitalsPlugin"),this.context?this.autoTrack?this.trackWebVitals?[4,this.trackWebVitalsMetrics()]:[3,2]:[3,3]:(this.debugLog("No context available during initialization"),[2]);case 1:e.sent(),e.label=2;case 2:this.trackPageMetrics&&this.trackPageMetricsData(),e.label=3;case 3:return this.debugLog("WebVitalsPlugin initialized successfully"),[2]}})})},e.prototype.reset=function(){this.metricsTracked=!1,this.debugLog("WebVitalsPlugin reset")},e}();t.WebVitalsPlugin=u},574:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},609:function(e,t){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},n=this&&this.__read||function(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},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var o=n(e,2),a=o[0],l=o[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a),l)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a))}else console.log.apply(console,i([],n(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=o,t.logChangeApplication=function(e,r,n,i,a){if(t.DEBUG){o("".concat(a?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:a})}},t.logChangeRemoval=function(e,r,n,i){if(t.DEBUG){o("Restored ".concat(i," element(s) to original state"),{experimentName:e,selector:r,changeType:n,elementsCount:i,action:"restore"})}},t.logExperimentSummary=function(e,r,n,i){if(t.DEBUG){o('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:r,successfulChanges:n,pendingChanges:i,successRate:r>0?"".concat(Math.round(n/r*100),"%"):"N/A"})}},t.logStateOperation=function(e,r,n,i){if(t.DEBUG){o("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})}},t.logVisibilityEvent=function(e,r,n){if(t.DEBUG){o(n?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:r.className||r.id||r.tagName,triggered:n,action:"visibility"})}},t.logMessage=function(e,r,n){if(t.DEBUG){o("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})}},t.logPerformance=function(e,n,i){if(t.DEBUG){o("Performance: ".concat(e," took ").concat(n,"ms"),r({operation:e,duration:n,performance:!0},i))}},t.DEBUG=!1},637:function(e,t){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserCookieAdapter=void 0;var i=function(){function e(){}return e.prototype.get=function(e){var t,r,i=e+"=",o=document.cookie.split(";");try{for(var a=n(o),l=a.next();!l.done;l=a.next()){var s=l.value;if(0===(s=s.trim()).indexOf(i))return decodeURIComponent(s.substring(i.length))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return null},e.prototype.set=function(e,t,r){var n="".concat(e,"=").concat(encodeURIComponent(t));r&&(r.path&&(n+="; path=".concat(r.path)),r.domain&&(n+="; domain=".concat(r.domain)),void 0!==r.maxAge&&(n+="; max-age=".concat(r.maxAge)),r.secure&&(n+="; secure"),r.sameSite&&(n+="; samesite=".concat(r.sameSite))),document.cookie=n},e.prototype.delete=function(e,t){this.set(e,"",r(r({},t),{maxAge:0}))},e}();t.BrowserCookieAdapter=i},639:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},693:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheetManager=void 0;var n=r(609),i=function(){function e(e,t){void 0===t&&(t=!1),this.id=e,this.styleEl=null,this.rules=new Map,this.debug=t}return e.prototype.ensure=function(){if(!(this.styleEl&&document.head.contains(this.styleEl)||(this.styleEl=document.getElementById(this.id),this.styleEl))){var e=document.createElement("style");e.id=this.id,e.setAttribute("data-absmartly-styles","true"),document.head.appendChild(e),this.styleEl=e,this.debug&&(0,n.logDebug)("[ABsmartly] Created stylesheet: ".concat(this.id))}return this.styleEl},e.prototype.setRule=function(e,t){this.rules.set(e,t),this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Set CSS rule for ".concat(e))},e.prototype.deleteRule=function(e){this.rules.delete(e)&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Deleted CSS rule for ".concat(e)))},e.prototype.hasRule=function(e){return this.rules.has(e)},e.prototype.clear=function(){var e=this.rules.size>0;this.rules.clear(),e&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Cleared all CSS rules from ".concat(this.id)))},e.prototype.destroy=function(){this.clear(),this.styleEl&&document.head.contains(this.styleEl)&&(this.styleEl.remove(),this.styleEl=null,this.debug&&(0,n.logDebug)("[ABsmartly] Destroyed stylesheet: ".concat(this.id)))},e.prototype.render=function(){var e=this.ensure(),t=Array.from(this.rules.values()).join("\n\n");e.textContent=t},e.prototype.getRulesCount=function(){return this.rules.size},e.prototype.getCssText=function(){return Array.from(this.rules.values()).join("\n\n")},e}();t.StyleSheetManager=i},702:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),d=r(713),h=r(253),g=r(609),f=r(973),p=function(){function e(e){var t,r,n,i,o,a,l,u,g,f;if(this.mutationObserver=null,this.exposedExperiments=new Set,this.eventListeners=new Map,this.styleManagers=new Map,this.initialized=!1,this.watchedElements=new WeakMap,this.persistenceObserver=null,this.reapplyingElements=new Set,this.reapplyLogThrottle=new Map,this.appliedStyleChanges=new Map,this.antiFlickerTimeout=null,this.antiFlickerStyleId="absmartly-antiflicker",this.config={context:e.context,autoApply:null===(t=e.autoApply)||void 0===t||t,spa:null===(r=e.spa)||void 0===r||r,visibilityTracking:null===(n=e.visibilityTracking)||void 0===n||n,extensionBridge:!1,dataSource:null!==(i=e.dataSource)&&void 0!==i?i:"variable",dataFieldName:null!==(o=e.dataFieldName)&&void 0!==o?o:"__dom_changes",debug:null!==(a=e.debug)&&void 0!==a&&a,hideUntilReady:null!==(l=e.hideUntilReady)&&void 0!==l&&l,hideTimeout:null!==(u=e.hideTimeout)&&void 0!==u?u:3e3,hideSelector:null!==(g=e.hideSelector)&&void 0!==g?g:"[data-absmartly-hide]",hideTransition:null!==(f=e.hideTransition)&&void 0!==f&&f},!this.config.context)throw new Error("[ABsmartly] Context is required");this.config.hideUntilReady&&this.hideContent(),this.domManipulator=new s.DOMManipulatorLite(this.config.debug,this),this.variantExtractor=new c.VariantExtractor(this.config.context,this.config.dataSource,this.config.dataFieldName,this.config.debug),this.exposureTracker=new d.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new h.HTMLInjector(this.config.debug)}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,g.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,g.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,dataSource:this.config.dataSource,DEBUG:g.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa&&(this.setupMutationObserver(),this.setupURLChangeListener()),this.config.autoApply?[4,this.applyInjectionsAndChanges()]:[3,3];case 2:i.sent(),i.label=3;case 3:return this.initialized=!0,this.registerWithContext(),this.emit("initialized"),r=performance.now()-t,(0,g.logPerformance)("Plugin initialization",r),(0,g.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,g.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,g.logDebug)("[ABsmartly] Failed to initialize plugin:",n),n;case 5:return[2]}})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2,this.ready()]})})},e.prototype.setupMutationObserver=function(){var e=new MutationObserver(function(){});e.observe(document.body,{childList:!0,subtree:!0}),this.mutationObserver=e},e.prototype.setupURLChangeListener=function(){var e=this,t=function(){return i(e,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,g.logDebug)("[ABsmartly] URL changed, re-evaluating experiments:",e),[4,this.removeAllChanges()];case 1:return t.sent(),[4,this.applyInjectionsAndChanges()];case 2:return t.sent(),[2]}})})};window.addEventListener("popstate",t);var r=history.pushState,n=history.replaceState;history.pushState=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(history,e),t()},history.replaceState=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.apply(history,e),t()},this.config.debug&&(0,g.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return this.exposedExperiments.clear(),this.styleManagers.clear(),this.appliedStyleChanges.clear(),this.htmlInjector.destroy(),this.variantExtractor.clearCache(),this.config.debug&&(0,g.logDebug)("[ABsmartly] All change tracking cleared for URL change"),[2]})})},e.prototype.applyInjectionsAndChanges=function(){return i(this,void 0,void 0,function(){var e,t,r,n,i;return o(this,function(o){switch(o.label){case 0:e=performance.now(),t=window.location.href,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),(0,g.logDebug)("[ABsmartly] Failed to wait for context ready:",r),[2];case 4:return n=this.variantExtractor.extractAllInjectHTML(),[4,Promise.all([this.applyHTMLInjections(n,t),this.applyChanges()])];case 5:return o.sent(),i=performance.now()-e,(0,g.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,g.logDebug)("[ABsmartly] HTML injections and DOM changes applied in parallel",{duration:"".concat(i.toFixed(2),"ms"),currentURL:t}),[2]}})})},e.prototype.applyHTMLInjections=function(e){return i(this,arguments,void 0,function(e,t){var r;return void 0===t&&(t=window.location.href),o(this,function(n){return 0===e.size?(this.config.debug&&(0,g.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,g.logDebug)("[ABsmartly] HTML injections complete",{experimentsWithInjections:e.size,totalLocations:r.size,currentUrl:t}),[2])})})},e.prototype.applyChanges=function(e){return i(this,void 0,void 0,function(){var t,r,n,i,s,c,u,d,h,f,p,v,y,m,b,x,w,k,C,S,E,O,_,A,D,P,j,L,T,M,I,N,B,F,R,U,V,z,W,H,q,G,Q,K,J;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,g.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,g.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,g.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,g.logDebug)("[ABsmartly] Current URL:",r),(0,g.logDebug)("[ABsmartly] Context ready:",!0)),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),(0,g.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,g.logDebug)("[ABsmartly] Experiments to process:",Array.from(i.keys())),(0,g.logDebug)("[ABsmartly] Total experiments with changes:",i.size);try{for(u=a(i),d=u.next();!d.done;d=u.next())if(h=l(d.value,2),f=h[0],p=h[1],!e||f===e)if(v=this.config.context.peek(f),y=p.variantData,m=p.urlFilter,b=p.globalDefaults,this.variantExtractor.anyVariantMatchesURL(f,r))if(x=this.shouldApplyVisualChanges(y,m,r),w=this.extractChangesFromData(y,b),k=this.extractAllVariantChanges(f),C=k.some(function(e){return e&&e.length>0}),C){if(S={total:(null==w?void 0:w.length)||0,success:0,pending:0},this.config.debug&&(0,g.logDebug)("[ABsmartly] Processing experiment '".concat(f,"' (variant ").concat(v,"):"),{urlMatches:x,changeCount:(null==w?void 0:w.length)||0,userVariantHasChanges:((null==w?void 0:w.length)||0)>0,changes:(null==w?void 0:w.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),E=!1,O=!1,x&&w&&w.length>0)try{for(z=void 0,_=a(w),A=_.next();!A.done;A=_.next())if(F=A.value,this.domManipulator.applyChange(F,f))s++,S.success++,F.trigger_on_view?O=!0:E=!0;else if("create"!==F.type&&"styleRules"!==F.type)try{0===document.querySelectorAll(F.selector).length&&(this.config.spa||F.waitForElement)&&(S.pending++,F.trigger_on_view&&(O=!0))}catch(e){this.config.debug&&(0,g.logDebug)("[ABsmartly] Invalid selector: ".concat(F.selector),e)}}catch(e){z={error:e}}finally{try{A&&!A.done&&(W=_.return)&&W.call(_)}finally{if(z)throw z.error}}else if(w&&w.length>0){try{for(H=void 0,D=a(w),P=D.next();!P.done;P=D.next())(F=P.value).trigger_on_view?O=!0:E=!0}catch(e){H={error:e}}finally{try{P&&!P.done&&(q=D.return)&&q.call(D)}finally{if(H)throw H.error}}(0,g.logDebug)("[ABsmartly] Experiment '".concat(f,"' variant ").concat(v," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"))}if(j=O,L=E,!O||!E)try{for(G=void 0,T=a(k),M=T.next();!M.done;M=T.next()){if((I=M.value)&&I.length>0)try{for(K=void 0,N=a(I),B=N.next();!B.done&&((F=B.value).trigger_on_view?j=!0:L=!0,!j||!L);B=N.next());}catch(e){K={error:e}}finally{try{B&&!B.done&&(J=N.return)&&J.call(N)}finally{if(K)throw K.error}}if(j&&L)break}}catch(e){G={error:e}}finally{try{M&&!M.done&&(Q=T.return)&&Q.call(T)}finally{if(G)throw G.error}}(j||L)&&this.exposureTracker.registerExperiment(f,v||0,w||[],k),c.set(f,S),(0,g.logExperimentSummary)(f,S.total,S.success,S.pending)}else this.config.debug&&(0,g.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,g.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variant matches URL: ").concat(r))}catch(e){U={error:e}}finally{try{d&&!d.done&&(V=u.return)&&V.call(u)}finally{if(U)throw U.error}}return R=performance.now()-t,(0,g.logPerformance)("Apply changes",R,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,g.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,g.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(R.toFixed(2),"ms"),experiments:Array.from(c.entries()).map(function(e){var t=l(e,2),r=t[0],n=t[1];return{name:r,total:n.total,success:n.success,pending:n.pending,pendingReason:n.pending>0?"Elements not found yet (SPA mode will retry)":void 0}})})),this.config.hideUntilReady&&this.showContent(),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var s=l(o.value,1)[0],c=this.config.context.peek(s);if(null!=c){var u=this.variantExtractor.getAllVariantsData(s).get(c);if(u){var d=null,h={};if(u&&"object"==typeof u&&!Array.isArray(u)&&"changes"in u){var g=u;d=g.urlFilter,h={waitForElement:g.waitForElement,persistStyle:g.persistStyle,important:g.important,observerRoot:g.observerRoot}}r.set(s,{variantData:u,urlFilter:d,globalDefaults:h})}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e.prototype.extractChangesFromData=function(e,t){var r=null;return Array.isArray(e)?r=e:e&&"object"==typeof e&&"changes"in e&&(r=e.changes),r&&0!==r.length?r.map(function(e){var r,i,o,a;return n(n({},e),{waitForElement:null!==(r=e.waitForElement)&&void 0!==r?r:t.waitForElement,persistStyle:null!==(i=e.persistStyle)&&void 0!==i?i:t.persistStyle,important:null!==(o=e.important)&&void 0!==o?o:t.important,observerRoot:null!==(a=e.observerRoot)&&void 0!==a?a:t.observerRoot})}):null},e.prototype.extractAllVariantChanges=function(e){for(var t=this.variantExtractor.getAllVariantChanges(e),r=this.variantExtractor.getAllVariantsData(e),i=[],o=function(e){var o=t[e],a=r.get(e);if(!o||0===o.length)return i.push([]),"continue";var l={};if(a&&"object"==typeof a&&!Array.isArray(a)&&"changes"in a){var s=a;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,important:s.important,observerRoot:s.observerRoot}}var c=o.map(function(e){var t,r,i,o;return n(n({},e),{waitForElement:null!==(t=e.waitForElement)&&void 0!==t?t:l.waitForElement,persistStyle:null!==(r=e.persistStyle)&&void 0!==r?r:l.persistStyle,important:null!==(i=e.important)&&void 0!==i?i:l.important,observerRoot:null!==(o=e.observerRoot)&&void 0!==o?o:l.observerRoot})});i.push(c)},a=0;a<t.length;a++)o(a);return i},e.prototype.shouldApplyVisualChanges=function(e,t,r){return!!Array.isArray(e)||(!t||f.URLMatcher.matches(t,r))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,g.logDebug)("Applying single change via public API",{experimentName:t,selector:e.selector,changeType:e.type});try{var r=this.domManipulator.applyChange(e,t);return r&&this.emit("change_applied",{experimentName:t,change:e}),r}catch(e){return this.config.debug&&(0,g.logDebug)("[ABsmartly] Error applying change:",e),!1}},e.prototype.on=function(e,t){var r=this.eventListeners.get(e)||[];r.push(t),this.eventListeners.set(e,r)},e.prototype.off=function(e,t){if(t){var r=this.eventListeners.get(e)||[],n=r.indexOf(t);-1!==n&&r.splice(n,1)}else this.eventListeners.delete(e)},e.prototype.emit=function(e,t){var r,n,i=this.eventListeners.get(e)||[];try{for(var o=a(i),l=o.next();!l.done;l=o.next()){var s=l.value;try{s(t)}catch(t){(0,g.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.getStyleManager=function(e){var t="absmartly-styles-".concat(e),r=this.styleManagers.get(e);return r||(r=new u.StyleSheetManager(t,this.config.debug),this.styleManagers.set(e,r)),r},e.prototype.buildCssRule=function(e,t,r){void 0===r&&(r=!0);var n=Object.entries(t).map(function(e){var t=l(e,2),n=t[0],i=t[1],o=n.replace(/([A-Z])/g,"-$1").toLowerCase(),a=r?" !important":"";return" ".concat(o,": ").concat(i).concat(a,";")}).join("\n");return"".concat(e," {\n").concat(n,"\n}")},e.prototype.buildStateRules=function(e,t,r){void 0===r&&(r=!0);var n=[];return t.normal&&n.push(this.buildCssRule(e,t.normal,r)),t.hover&&n.push(this.buildCssRule("".concat(e,":hover"),t.hover,r)),t.active&&n.push(this.buildCssRule("".concat(e,":active"),t.active,r)),t.focus&&n.push(this.buildCssRule("".concat(e,":focus"),t.focus,r)),n.join("\n\n")},e.prototype.refreshExperiments=function(){this.config.debug&&(0,g.logDebug)("[ABsmartly] Refreshing experiments and clearing cache"),this.variantExtractor.clearCache(),this.config.autoApply&&this.applyInjectionsAndChanges()},e.prototype.destroy=function(){this.domManipulator.destroy(),this.exposureTracker.destroy(),this.htmlInjector.destroy(),this.styleManagers.forEach(function(e){return e.destroy()}),this.styleManagers.clear(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.persistenceObserver&&(this.persistenceObserver.disconnect(),this.persistenceObserver=null),null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var e=document.getElementById(this.antiFlickerStyleId);e&&e.remove(),this.eventListeners.clear(),this.exposedExperiments.clear(),this.watchedElements=new WeakMap,this.appliedStyleChanges.clear(),this.reapplyingElements.clear(),this.reapplyLogThrottle.clear(),this.unregisterFromContext(),this.initialized=!1,this.config.debug&&(0,g.logDebug)("[ABsmartly] DOM Changes Plugin Lite destroyed")},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.domPlugin={name:"DOMChangesPluginLite",version:e.VERSION,initialized:!0,capabilities:["spa","visibility"],instance:this,timestamp:Date.now()},this.config.context.__domPlugin=this.config.context.__plugins.domPlugin,this.config.debug&&(0,g.logDebug)("[ABsmartly] DOMChangesPluginLite registered with context at __plugins.domPlugin"))},e.prototype.unregisterFromContext=function(){var e;this.config.context&&((null===(e=this.config.context.__plugins)||void 0===e?void 0:e.domPlugin)&&delete this.config.context.__plugins.domPlugin,this.config.context.__domPlugin&&delete this.config.context.__domPlugin,this.config.debug&&(0,g.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from context"))},e.prototype.hideContent=function(){var e=this,t=this.config.hideUntilReady;if(t&&!document.getElementById(this.antiFlickerStyleId)){var r=document.createElement("style");r.id=this.antiFlickerStyleId;var n=!1!==this.config.hideTransition,i="body"===t?"body":this.config.hideSelector||"[data-absmartly-hide]";r.textContent="\n ".concat(i,n?" {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n ":" {\n visibility: hidden !important;\n }\n "),document.head.appendChild(r),this.antiFlickerTimeout=window.setTimeout(function(){e.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker enabled (mode: ".concat(t,", transition: ").concat(n?this.config.hideTransition:"none",", timeout: ").concat(this.config.hideTimeout,"ms)"))}},e.prototype.showContent=function(){var e=this;null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var t=document.getElementById(this.antiFlickerStyleId);if(t)if(!1!==this.config.hideTransition){var r="body"===this.config.hideUntilReady?"body":this.config.hideSelector||"[data-absmartly-hide]";t.textContent="\n ".concat(r," {\n opacity: 0 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n "),t.offsetHeight,t.textContent="\n ".concat(r," {\n opacity: 1 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n ");var n=1e3*parseFloat(this.config.hideTransition);setTimeout(function(){t.remove(),e.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker removed, content now visible")},e.prototype.watchElement=function(e,t,r){var n=this.watchedElements.get(e);n||(n=new Set,this.watchedElements.set(e,n)),n.add(t),this.appliedStyleChanges.has(t)||this.appliedStyleChanges.set(t,[]);var i=this.appliedStyleChanges.get(t);!i.includes(r)&&(i.push(r),this.config.debug&&(0,g.logDebug)("[ABsmartly] Watching element for style persistence",{experimentName:t,selector:r.selector,element:e.tagName})),this.persistenceObserver||this.setupPersistenceObserver()},e.prototype.unwatchElement=function(e,t){var r=this.watchedElements.get(e);r&&(r.delete(t),0===r.size&&this.watchedElements.delete(e))},e.prototype.setupPersistenceObserver=function(){var e=this;this.persistenceObserver||(this.persistenceObserver=new MutationObserver(function(t){t.forEach(function(t){var r=t.target;if(!e.reapplyingElements.has(r)){var n=e.watchedElements.get(r);if(n){if(e.config.debug){var i="mutation:".concat(r.tagName,":").concat(r.getAttribute("name")||r.className),o=Date.now();o-(e.reapplyLogThrottle.get(i)||0)>5e3&&((0,g.logDebug)("[ABsmartly] Style mutation detected on watched element",{element:r.tagName,selector:r.getAttribute("name")||r.className,oldValue:t.oldValue}),e.reapplyLogThrottle.set(i,o))}n.forEach(function(t){var n=e.appliedStyleChanges.get(t);n&&n.forEach(function(n){var i,o;if("style"===n.type&&r.matches(n.selector))if(e.checkStyleOverwritten(r,n.value)){e.reapplyingElements.add(r),e.domManipulator.applyChange(n,t);var s="".concat(t,"-").concat(n.selector),c=Date.now(),u=e.reapplyLogThrottle.get(s)||0;if(e.config.debug&&c-u>5e3&&((0,g.logDebug)("Reapplied style after mutation (React/framework conflict detected)",{experimentName:t,selector:n.selector,note:"This happens when the page framework (React/Vue/etc) fights with DOM changes"}),e.reapplyLogThrottle.set(s,c),e.reapplyLogThrottle.size>100)){var d=c-6e4;try{for(var h=a(e.reapplyLogThrottle.entries()),f=h.next();!f.done;f=h.next()){var p=l(f.value,2),v=p[0];p[1]<d&&e.reapplyLogThrottle.delete(v)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}setTimeout(function(){e.reapplyingElements.delete(r)},0)}else e.config.debug&&(0,g.logDebug)("[ABsmartly] Style mutation detected but no reapply needed",{experimentName:t,selector:n.selector})})})}}})}),this.persistenceObserver.observe(document.body,{attributes:!0,attributeFilter:["style"],subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,g.logDebug)("[ABsmartly] Style persistence observer setup complete"))},e.prototype.checkStyleOverwritten=function(e,t){var r,n;try{for(var i=a(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=l(o.value,2),c=s[0],u=s[1],d=c.replace(/([A-Z])/g,"-$1").toLowerCase(),h=e.style.getPropertyValue(d),g=e.style.getPropertyPriority(d);if(h!==u||u.includes("!important")&&!g)return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.VERSION="1.0.0-lite",e}();t.DOMChangesPluginLite=p},713:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(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},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExposureTracker=void 0;var l=r(609),s=function(){function e(e,t){void 0===t&&(t=!1),this.context=e,this.experiments=new Map,this.trackedElements=new Map,this.mutationObserver=null,this.placeholders=new Map,this.debug=t,this.setupIntersectionObserver()}return e.prototype.registerExperiment=function(e,t,r,n){var i=this;this.debug&&(0,l.logDebug)("[ABsmartly] Registering experiment ".concat(e," for exposure tracking"));var s=new Set,c=new Set,u=new Map;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view&&("move"===e.type?(u.has(e.selector)||u.set(e.selector,new Set),e.targetSelector&&u.get(e.selector).add(e.targetSelector)):s.add(e.selector))})}),u.forEach(function(r,o){var a=[];n.forEach(function(e,t){var r=e.find(function(e){return"move"===e.type&&e.selector===o&&e.trigger_on_view});(null==r?void 0:r.targetSelector)&&a.push({targetSelector:r.targetSelector,position:r.position||"lastChild",variantIndex:t})});var l=a.findIndex(function(e){return e.variantIndex===t});l>=0?(s.add(o),a.forEach(function(t,r){r!==l&&i.createContainerPlaceholder(e,o,t.targetSelector,t.position)})):(s.add(o),a.forEach(function(t){i.createContainerPlaceholder(e,o,t.targetSelector,t.position)}))});var d=!1,h=!1;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view?h=!0:d=!0})});var g={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(a(a([],o(s),!1),o(c),!1)),triggered:!1,hasImmediateTrigger:d,hasViewportTrigger:h};this.experiments.set(e,g),this.debug&&(0,l.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(g.allPossibleSelectors)),d?this.triggerExposure(e).catch(function(t){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(e,":"),t)}):h&&this.observeSelectors(e,g.allPossibleSelectors)},e.prototype.createContainerPlaceholder=function(e,t,r,n){var i,o;void 0===n&&(n="lastChild");var a=document.querySelector(r);if(a){var s="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(!this.placeholders.has(s)){var c=document.createElement("span");switch(c.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",c.setAttribute("data-absmartly-placeholder","true"),c.setAttribute("data-absmartly-original-selector",t),c.setAttribute("data-absmartly-experiment",e),c.setAttribute("aria-hidden","true"),n){case"firstChild":a.insertBefore(c,a.firstChild);break;case"lastChild":default:a.appendChild(c);break;case"before":null===(i=a.parentElement)||void 0===i||i.insertBefore(c,a);break;case"after":null===(o=a.parentElement)||void 0===o||o.insertBefore(c,a.nextSibling)}this.placeholders.set(s,c),this.trackElement(c,e),this.debug&&(0,l.logDebug)("[ABsmartly] Created placeholder for ".concat(t," at ").concat(r," (").concat(n,")"))}}},e.prototype.getOriginalParentForMove=function(e){var t=document.querySelector(e);return(null==t?void 0:t.parentElement)?this.getStableParentSelector(t.parentElement):null},e.prototype.getStableParentSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t[0])}var r=e.parentElement;if(r){var n=Array.from(r.children).indexOf(e);return"".concat(e.tagName.toLowerCase(),":nth-child(").concat(n+1,")")}return null},e.prototype.observeSelectors=function(e,t){var r=this;t.forEach(function(t){var n=document.querySelectorAll(t);n.length>0?n.forEach(function(t){r.trackElement(t,e)}):r.watchForSelector(t,e)})},e.prototype.trackElement=function(e,t){this.trackedElements.has(e)?this.trackedElements.get(e).experiments.add(t):(this.trackedElements.set(e,{element:e,experiments:new Set([t]),isPlaceholder:e.hasAttribute("data-absmartly-placeholder")}),this.observer.observe(e))},e.prototype.watchForSelector=function(e,t){this.mutationObserver||this.setupMutationObserver()},e.prototype.setupIntersectionObserver=function(){var e=this;this.observer=new IntersectionObserver(function(t){t.forEach(function(t){t.isIntersecting&&e.handleElementVisible(t.target)})},{threshold:.01,rootMargin:"0px"})},e.prototype.setupMutationObserver=function(){var e=this;this.mutationObserver=new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){t instanceof Element&&e.checkNewElement(t)})})}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})},e.prototype.checkNewElement=function(e){var t=this;this.experiments.forEach(function(r,n){r.allPossibleSelectors.forEach(function(r){e.matches(r)&&t.trackElement(e,n),e.querySelectorAll(r).forEach(function(e){t.trackElement(e,n)})})})},e.prototype.handleElementVisible=function(e){var t=this,r=this.trackedElements.get(e);r&&r.experiments.forEach(function(n){var i=t.experiments.get(n);if(i&&!i.triggered&&(t.triggerExposure(n).catch(function(e){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(n,":"),e)}),t.debug)){var o=r.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):t.getElementSelector(e);(0,l.logDebug)("[ABsmartly] Triggering exposure for ".concat(n," via ").concat(o))}})},e.prototype.triggerExposure=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return!(t=this.experiments.get(e))||t.triggered?[2]:[4,this.context.ready()];case 1:return r.sent(),this.context.treatment(e),t.triggered=!0,this.debug&&(0,l.logDebug)("[ABsmartly] Exposure triggered for experiment: ".concat(e)),this.cleanupExperiment(e),[2]}})})},e.prototype.cleanupExperiment=function(e){var t=this;this.trackedElements.forEach(function(r,n){r.experiments.delete(e),0===r.experiments.size&&(t.observer.unobserve(n),t.trackedElements.delete(n))}),this.placeholders.forEach(function(r,n){n.startsWith("".concat(e,"-"))&&(r.remove(),t.placeholders.delete(n))});var r=this.experiments.get(e);r&&r.allPossibleSelectors.clear(),0===this.experiments.size&&this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)},e.prototype.getElementSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t.join("."))}return e.tagName.toLowerCase()},e.prototype.needsViewportTracking=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.hasViewportTrigger)&&void 0!==t&&t},e.prototype.isTriggered=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.triggered)&&void 0!==t&&t},e.prototype.destroy=function(){this.observer.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),this.placeholders.forEach(function(e){return e.remove()}),this.experiments.clear(),this.trackedElements.clear(),this.placeholders.clear(),this.debug&&(0,l.logDebug)("[ABsmartly] ExposureTracker destroyed")},e}();t.ExposureTracker=s},964:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(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},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMManipulatorLite=void 0;var a=r(609),l=r(214),s=function(){function e(e,t){void 0===e&&(e=!1);var r=this;this.appliedChanges=new Map,this.debug=e,this.plugin=t,this.pendingManager=new l.PendingChangeManager(function(e,t,n){return n?r.applyChangeToSpecificElement(e,t,n):r.applyChange(e,t)},e)}return e.prototype.applyChange=function(e,t){var r,n=this;if(!e.enabled&&void 0!==e.enabled)return(0,a.logDebug)("Skipping disabled change for experiment: ".concat(t),{experimentName:t,selector:e.selector,changeType:e.type}),!1;try{if("styleRules"===e.type)return this.applyStyleRules(e,t);if("create"===e.type){if(e.element&&e.targetSelector)if(this.createElement(e,t))return this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.targetSelector,e.type,1,!0),!0;return!1}var i=document.querySelectorAll(e.selector),o=[];if(0===i.length)return e.waitForElement||(null===(r=this.plugin.config)||void 0===r?void 0:r.spa)?(this.debug&&(0,a.logDebug)("[ABsmartly] Element not found, adding to pending: ".concat(e.selector)),this.pendingManager.addPending({change:e,experimentName:t,observerRoot:e.observerRoot}),!0):(this.debug&&(0,a.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,a.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);if(i.forEach(function(r){var i;if(n.applyChangeToElement(r,e),"javascript"===e.type){if(e.value)try{new Function("element",String(e.value))(r),o.push(r)}catch(e){(0,a.logDebug)("[ABsmartly] JavaScript execution error:",e)}}else if("move"===e.type){var l=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),s=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(l){var c=document.querySelector(l);c?(n.moveElement(r,c,s),o.push(r)):n.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(l))}}else o.push(r);"style"===e.type&&(e.persistStyle||(null===(i=n.plugin.config)||void 0===i?void 0:i.spa))&&n.plugin.watchElement(r,t,e)}),o.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var l=o.some(function(e){var t;return null===(t=n.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return l||(0,a.logChangeApplication)(t,e.selector,e.type,o.length,!0),!0}return(0,a.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,a.logDebug)("Error applying DOM change",{experimentName:t,selector:e.selector,changeType:e.type,error:r instanceof Error?r.message:"Unknown error"}),!1}},e.prototype.moveElement=function(e,t,r){var n,i,o;switch(r){case"before":null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t);break;case"after":t.nextSibling?null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling):null===(o=t.parentElement)||void 0===o||o.appendChild(e);break;case"firstChild":t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);break;default:t.appendChild(e)}},e.prototype.createElement=function(e,t){var r,i;if(!e.element||!e.targetSelector)return null;var o=document.querySelector(e.targetSelector);if(!o)return this.debug&&(0,a.logDebug)("[ABsmartly] Create target not found: ".concat(e.targetSelector)),null;var l=document.createElement("div");l.innerHTML=e.element;var s=Array.from(l.children);if(0===s.length)return null;try{for(var c=n(s),u=c.next();!u.done;u=c.next()){var d=u.value;this.moveElement(d,o,e.position)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return s[0]},e.prototype.applyStyleRules=function(e,t){try{var r=this.plugin.getStyleManager(t),n="".concat(e.selector,"::states"),i=void 0;if("string"==typeof e.value&&e.value.trim())i=e.value;else{if(!e.states)return!1;i=this.plugin.buildStateRules(e.selector,e.states,!1!==e.important)}return r.setRule(n,i),this.debug&&((0,a.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,a.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,n;switch(t.type){case"text":void 0!==t.value&&(e.textContent=String(t.value));break;case"html":void 0!==t.value&&(e.innerHTML=String(t.value));break;case"style":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(t){var r=i(t,2),n=r[0],o=r[1],a=n.replace(/([A-Z])/g,"-$1").toLowerCase();e.style.setProperty(a,String(o))});break;case"class":t.add&&Array.isArray(t.add)&&(r=e.classList).add.apply(r,o([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(n=e.classList).remove.apply(n,o([],i(t.remove),!1));break;case"attribute":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];null==o?e.removeAttribute(n):e.setAttribute(n,String(o))});break;case"move":if(t.value&&"object"==typeof t.value){var l=t.value,s=document.querySelector(l.targetSelector);s?this.moveElement(e,s,l.position):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(l.targetSelector))}break;case"delete":e.remove()}},e.prototype.applyChangeToSpecificElement=function(e,t,r){var n;try{if(this.applyChangeToElement(r,e),"javascript"===e.type&&e.value)try{new Function("element",String(e.value))(r)}catch(e){return(0,a.logDebug)("[ABsmartly] JavaScript execution error:",e),!1}else if("move"===e.type){var i=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),o=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(i){var l=document.querySelector(i);if(!l)return!1;this.moveElement(r,l,o)}}return"style"===e.type&&(e.persistStyle||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa))&&this.plugin.watchElement(r,t,e),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying change to specific element:",e),!1}},e.prototype.trackAppliedChange=function(e,t){var r=this.appliedChanges.get(e);r||(r=new Set,this.appliedChanges.set(e,r));var n="".concat(t.selector,"-").concat(t.type);r.add(n)},e.prototype.hasChanges=function(e){return this.appliedChanges.has(e)},e.prototype.clearTracking=function(e){e?this.appliedChanges.delete(e):this.appliedChanges.clear()},e.prototype.removeAllPending=function(e){this.pendingManager.removeAllPending(e)},e.prototype.destroy=function(){this.pendingManager.destroy(),this.appliedChanges.clear()},e}();t.DOMManipulatorLite=s},973:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var r=function(){function e(){}return e.matches=function(e,t){void 0===t&&(t=window.location.href);var r=this.normalizeFilter(e),n=this.extractURLPart(t,r.matchType);return(!r.exclude||!this.matchesPatterns(r.exclude,n,r.mode))&&(!r.include||0!==r.include.length&&this.matchesPatterns(r.include,n,r.mode))},e.extractURLPart=function(e,t){void 0===t&&(t="path");try{var r=new URL(e);switch(t){case"full-url":return r.href;case"path":default:return r.pathname+r.hash;case"domain":return r.hostname;case"query":return r.search;case"hash":return r.hash}}catch(t){return console.error("[ABsmartly] Failed to parse URL: ".concat(e),t),e}},e.matchesPatterns=function(e,t,r){var n=this;return void 0===r&&(r="simple"),e.some(function(e){if("regex"===r)try{return new RegExp(e).test(t)}catch(t){return console.error("[ABsmartly] Invalid regex pattern: ".concat(e),t),!1}return n.matchSimplePattern(e,t)})},e.matchSimplePattern=function(e,t){var r=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");try{return new RegExp("^".concat(r,"$")).test(t)}catch(t){return console.error("[ABsmartly] Invalid pattern: ".concat(e),t),!1}},e.normalizeFilter=function(e){return"string"==typeof e?{include:[e],exclude:[],mode:"simple",matchType:"path"}:Array.isArray(e)?{include:e.length>0?e:void 0,exclude:[],mode:"simple",matchType:"path"}:{include:e.include,exclude:e.exclude||[],mode:e.mode||"simple",matchType:e.matchType||"path"}},e}();t.URLMatcher=r},977:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginFull=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(248).OverridesPlugin);t.OverridesPluginFull=o}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(196);return r})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlySDKPlugins=t():e.ABsmartlySDKPlugins=t()}(this,()=>{return e={44:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginLite=void 0;var l=r(609),s=function(){function e(e){var t,r,n,i,o;if(this.initialized=!1,!e.context)throw new Error("[OverridesPluginLite] Context is required");this.config={context:e.context,cookieName:null!==(t=e.cookieName)&&void 0!==t?t:"absmartly_overrides",useQueryString:null===(r=e.useQueryString)||void 0===r||r,queryPrefix:null!==(n=e.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(i=e.persistQueryToCookie)&&void 0!==i&&i,debug:null!==(o=e.debug)&&void 0!==o&&o},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Initialized with config:",{cookieName:this.config.cookieName,useQueryString:this.config.useQueryString,queryPrefix:this.config.queryPrefix})}return e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e,t,r,n,s,c,u,d,h,g,p;return i(this,function(i){if(this.initialized)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Already initialized"),[2];if(this.initialized=!0,this.registerWithContext(),e={},this.config.useQueryString&&"undefined"!=typeof window&&(e=this.getQueryStringOverrides(),this.config.persistQueryToCookie&&this.config.cookieName&&Object.keys(e).length>0&&this.persistOverridesToCookie(e)),0===Object.keys(e).length&&this.config.cookieName&&(e=this.getCookieOverrides()),0===Object.keys(e).length)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] No overrides found"),[2];try{for(t=o(Object.entries(e)),r=t.next();!r.done;r=t.next())n=a(r.value,2),s=n[0],c=n[1],u="number"==typeof c?c:c.variant,isNaN(u)?this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Skipping invalid variant for ".concat(s,": ").concat(u)):(null===(p=(g=this.config.context).override)||void 0===p||p.call(g,s,u),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Override: ".concat(s," -> variant ").concat(u)))}catch(e){d={error:e}}finally{try{r&&!r.done&&(h=t.return)&&h.call(t)}finally{if(d)throw d.error}}return[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.ready()]})})},e.prototype.getQueryStringOverrides=function(){var e,t;if("undefined"==typeof window||!window.location)return{};var r=new URLSearchParams(window.location.search),n={},i=this.config.queryPrefix;try{for(var s=o(r.entries()),c=s.next();!c.done;c=s.next()){var u=a(c.value,2),d=u[0],h=u[1];if(d.startsWith(i)){var g=d.substring(i.length);if(g){var p=h.split(","),f=parseInt(p[0],10);isNaN(f)||(1===p.length?n[g]=f:n[g]={variant:f,env:p[1]?parseInt(p[1],10):void 0,id:p[2]?parseInt(p[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return this.config.debug&&Object.keys(n).length>0&&(0,l.logDebug)("[OverridesPluginLite] Query string overrides:",n),n},e.prototype.getCookieOverrides=function(){var e,t;if("undefined"==typeof document)return{};var r=this.config.cookieName+"=",n=document.cookie.split(";");try{for(var i=o(n),a=i.next();!a.done;a=i.next()){var l=a.value;if(0===(l=l.trim()).indexOf(r)){var s=decodeURIComponent(l.substring(r.length));return this.parseCookieValue(s)}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return{}},e.prototype.parseCookieValue=function(e){var t,r;if(!e)return{};var n={},i=e;if(e.includes("|")&&(i=(f=e.split("|"))[f.length-1]),!i)return{};var l=i.split(",");try{for(var s=o(l),c=s.next();!c.done;c=s.next()){var u=c.value,d=a(u.split(":"),2),h=d[0],g=d[1];if(h&&g){var p=decodeURIComponent(h),f=g.split("."),v=parseInt(f[0],10);isNaN(v)||(1===f.length?n[p]=v:n[p]={variant:v,env:f[1]?parseInt(f[1],10):void 0,id:f[2]?parseInt(f[2],10):void 0})}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return n},e.prototype.persistOverridesToCookie=function(e){var t,r;if(this.config.cookieName&&"undefined"!=typeof document){var n=[];try{for(var i=o(Object.entries(e)),s=i.next();!s.done;s=i.next()){var c=a(s.value,2),u=c[0],d=c[1],h=encodeURIComponent(u);if("number"==typeof d)n.push("".concat(h,":").concat(d));else{var g="".concat(h,":").concat(d.variant);void 0!==d.env&&(g+=".".concat(d.env)),void 0!==d.id&&(g+=".".concat(d.id)),n.push(g)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}var p=n.join(",");document.cookie="".concat(this.config.cookieName,"=").concat(encodeURIComponent(p),";path=/;max-age=").concat(86400),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Persisted to cookie:",p)}},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.overridesPlugin={name:"OverridesPluginLite",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides"],instance:this,timestamp:Date.now()},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Registered with context at __plugins.overridesPlugin"))},e.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.config.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.config.context.__plugins.overridesPlugin,this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Unregistered from context"))},e.prototype.destroy=function(){this.initialized=!1,this.unregisterFromContext()},e}();t.OverridesPluginLite=s},91:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(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},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var l=r(609),s=r(319),c=function(){function e(e){void 0===e&&(e={}),this.context=e.context,this.debug=e.debug||!1,this.cookieDomain=e.cookieDomain||".absmartly.com",this.cookiePath=e.cookiePath||"/",this.sameSite=e.sameSite||"Lax",this.secure=e.secure||!1,this.cookieExpiryDays=e.cookieExpiryDays||730,this.unitIdCookieName=e.unitIdCookieName||"abs",this.publicIdCookieName=e.publicIdCookieName||"abs_public",this.expiryCookieName=e.expiryCookieName||"abs_expiry",this.utmCookieName=e.utmCookieName||"abs_utm_params",this.utmParams=e.utmParamsList||["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.autoUpdateExpiry=!1!==e.autoUpdateExpiry,this.expiryCheckInterval=e.expiryCheckInterval||30}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&l.logDebug.apply(void 0,a(["[CookiePlugin]"],o(e),!1))},e.prototype.setCookie=function(e,t,r){var n=void 0!==r?r:this.cookieExpiryDays,i=(0,s.setCookie)(e,t,n,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return i&&this.debugLog("Set cookie ".concat(e,":"),t),i},e.prototype.deleteCookie=function(e){(0,s.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,s.isLocalStorageAvailable)(),r=null;return e&&(r=(0,s.getCookie)(this.unitIdCookieName)||(0,s.getCookie)(this.publicIdCookieName)),!r&&t&&(r=localStorage.getItem("abs_id")),r&&(this.unitId=r),r},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,r=(0,s.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),r&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,s.generateUniqueId)();return this.setUnitId(e),e},e.prototype.updateExpiryTimestamp=function(){if(navigator.cookieEnabled){var e=Date.now();this.setCookie(this.expiryCookieName,e.toString()),this.debugLog("Updated expiry timestamp:",e)}},e.prototype.isExpiryFresh=function(){if(!navigator.cookieEnabled)return!1;var e=(0,s.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),r=(Date.now()-t)/864e5,n=r<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:r,isFresh:n}),n}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e={},t=new URLSearchParams(window.location.search);if(this.utmParams.forEach(function(r){var n=t.get(r);n&&(e[r]=n)}),0===Object.keys(e).length&&document.referrer)try{var r=new URL(document.referrer);this.utmParams.forEach(function(t){var n=r.searchParams.get(t);n&&(e[t]=n)})}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(e).length){var n=this.getStoredUtmParams();if(n)return n}return e},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},r=navigator.cookieEnabled;if((0,s.isLocalStorageAvailable)())try{localStorage.setItem(this.utmCookieName,JSON.stringify(t)),this.debugLog("Stored UTM params in localStorage:",e)}catch(e){this.debugLog("Failed to store UTM params in localStorage:",e)}r&&(this.setCookie(this.utmCookieName,JSON.stringify(t),30),this.debugLog("Stored UTM params in cookie:",e))}},e.prototype.getStoredUtmParams=function(){var e=null,t=(0,s.isLocalStorageAvailable)(),r=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&r&&(e=(0,s.getCookie)(this.utmCookieName)),e)try{var n=JSON.parse(e);if(Date.now()-n.timestamp<2592e6)return n.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t=this,r=e||this.context;if(r){var n=this.getUtmParams();Object.keys(n).length>0&&this.storeUtmParams(n),Object.entries(n).forEach(function(e){var n=o(e,2),i=n[0],a=n[1],l=i.slice(4);r.attribute(l,a),t.debugLog("Set attribute ".concat(l,":"),a)})}else(0,l.logDebug)("[CookiePlugin] No context available to apply UTM attributes")},e.prototype.clearAllCookies=function(){this.deleteCookie(this.unitIdCookieName),this.deleteCookie(this.publicIdCookieName),this.deleteCookie(this.expiryCookieName),this.deleteCookie(this.utmCookieName),(0,s.isLocalStorageAvailable)()&&(localStorage.removeItem("abs_id"),localStorage.removeItem(this.utmCookieName)),this.unitId=void 0,this.debugLog("All cookies and storage cleared")},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){return this.debugLog("Initializing CookiePlugin"),(e=this.getUnitId())?(this.debugLog("Using existing unit ID:",e),this.autoUpdateExpiry&&!this.isExpiryFresh()&&this.updateExpiryTimestamp()):(e=this.generateAndSetUnitId(),this.debugLog("Generated new unit ID:",e)),this.context&&this.applyUtmAttributesToContext(),this.debugLog("CookiePlugin initialized successfully"),[2]})})},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for CookiePlugin")},e.prototype.needsWorkerCall=function(e){var t=e||new URLSearchParams(window.location.search);if(Array.from(t.keys()).some(function(e){return e.startsWith("exp_")}))return this.debugLog("Worker call needed due to experiment overrides"),!0;var r=this.getUnitId(),n=navigator.cookieEnabled,i=(0,s.isLocalStorageAvailable)();if(r){if(n&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(n||i){var o=(0,s.getCookie)(this.expiryCookieName);return this.debugLog(o?"No existing ID but expiry cookie exists - need worker call":"No existing ID and no expiry cookie - need worker call"),!0}return!1},e.prototype.trackLanding=function(e){var t=e||this.context;if(t){var r=new URLSearchParams(window.location.search),n=this.utmParams.some(function(e){return r.get(e)}),i=document.referrer,o=i&&!i.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||(0,s.isLocalStorageAvailable)(),c=!!((0,s.getCookie)(this.unitIdCookieName)||(0,s.getCookie)(this.publicIdCookieName)||(0,s.getCookie)(this.expiryCookieName)||(0,s.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(n||o||a&&!c){var u={referrer_url:i||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,s.isLocalStorageAvailable)(),has_utm:n};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,l.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=c},196:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsPlugin=t.CookiePlugin=t.BrowserCookieAdapter=t.OverridesPlugin=t.OverridesPluginFull=t.DOMChangesPlugin=t.DOMChangesPluginLite=void 0;var o=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}});var a=r(977);Object.defineProperty(t,"OverridesPluginFull",{enumerable:!0,get:function(){return a.OverridesPluginFull}}),Object.defineProperty(t,"OverridesPlugin",{enumerable:!0,get:function(){return a.OverridesPluginFull}});var l=r(637);Object.defineProperty(t,"BrowserCookieAdapter",{enumerable:!0,get:function(){return l.BrowserCookieAdapter}});var s=r(91);Object.defineProperty(t,"CookiePlugin",{enumerable:!0,get:function(){return s.CookiePlugin}});var c=r(420);Object.defineProperty(t,"WebVitalsPlugin",{enumerable:!0,get:function(){return c.WebVitalsPlugin}}),i(r(574),t),i(r(639),t),t.default=o.DOMChangesPluginLite},214:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var a=r(609),l=function(){function e(e,t){void 0===t&&(t=!1),this.applyFn=e,this.pending=new Map,this.observers=new Map,this.appliedSelectors=new Set,this.batchTimer=null,this.batchedWork=new Set,this.debug=t}return e.prototype.addPending=function(e){var t=e.change,r=e.observerRoot,i=r;r&&!document.querySelector(r)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var o="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,a.logDebug)("[ABsmartly] Adding pending change for selector:",t.selector);var l=this.getObserverRoot(i).querySelector(t.selector);if(l)this.applyChange(l,n(n({},e),{observerRoot:i}));else{var s=this.pending.get(o)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(o,s),this.ensureObserver(i)}},e.prototype.removePending=function(e,t,r){var n="".concat(e,"-").concat(r||"document"),i=this.pending.get(n);if(i){var o=i.filter(function(e){return e.experimentName!==t});0===o.length?this.pending.delete(n):this.pending.set(n,o)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),a=n.next();!a.done;a=n.next()){var l=o(a.value,2),s=l[0],c=l[1].filter(function(t){return t.experimentName!==e});0===c.length?this.pending.delete(s):this.pending.set(s,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.cleanupObservers()},e.prototype.ensureObserver=function(e){var t=this,r=e||"document";if(!this.observers.has(r)){var n=this.getObserverRoot(e),i=new MutationObserver(function(r){t.handleMutations(r,e)});i.observe(n,{childList:!0,subtree:!0}),this.observers.set(r,i),this.debug&&(0,a.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,a,l,s=this,c=[];try{for(var u=i(e),d=u.next();!d.done;d=u.next()){var h=d.value,g=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var u=t||"document";try{for(var d=(r=void 0,i(p.pending.entries())),h=d.next();!h.done;h=d.next()){var g=o(h.value,2),f=g[0],v=g[1];if(f.endsWith("-".concat(u))){var y=function(t){var r=t.change;if(e.matches(r.selector))return c.push(function(){return s.applyChange(e,t)}),"continue";e.querySelectorAll(r.selector).forEach(function(e){c.push(function(){return s.applyChange(e,t)})})};try{for(var m=(a=void 0,i(v)),b=m.next();!b.done;b=m.next())y(b.value)}catch(e){a={error:e}}finally{try{b&&!b.done&&(l=m.return)&&l.call(m)}finally{if(a)throw a.error}}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}},p=this;try{for(var f=(a=void 0,i(h.addedNodes)),v=f.next();!v.done;v=f.next())g(v.value)}catch(e){a={error:e}}finally{try{v&&!v.done&&(l=f.return)&&l.call(f)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}c.length>0&&this.batchWork(c)},e.prototype.batchWork=function(e){var t=this;e.forEach(function(e){return t.batchedWork.add(e)}),this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(function(){t.processBatchedWork()},32)},e.prototype.processBatchedWork=function(){var e=Array.from(this.batchedWork);this.batchedWork.clear(),this.batchTimer=null,this.debug&&e.length>0&&(0,a.logDebug)("[ABsmartly] Processing batched work:",e.length,"items"),e.forEach(function(e){return e()})},e.prototype.applyChange=function(e,t){var r=t.change,n=t.experimentName,i=t.observerRoot,o="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(o)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(o);var l="".concat(r.selector,"-").concat(i||"document"),s=this.pending.get(l);if(s){var c=s.filter(function(e){return e.experimentName!==n||e.change.selector!==r.selector});0===c.length?this.pending.delete(l):this.pending.set(l,c)}this.checkObserverCleanup(i)}},e.prototype.getObserverRoot=function(e){if(!e)return document.documentElement;var t=document.querySelector(e);return t||document.documentElement},e.prototype.checkObserverCleanup=function(e){var t,r,n=e||"document",o=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next())if(s.value.endsWith("-".concat(n))){o=!0;break}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}if(!o){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,a.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,o=this,l=[];try{for(var s=i(this.observers.keys()),c=s.next();!c.done;c=s.next()){var u=c.value,d=!1;try{for(var h=(r=void 0,i(this.pending.keys())),g=h.next();!g.done;g=h.next())if(g.value.endsWith("-".concat(u))){d=!0;break}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}d||l.push(u)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}l.forEach(function(e){var t=o.observers.get(e);t&&(t.disconnect(),o.observers.delete(e),o.debug&&(0,a.logDebug)("[ABsmartly] Cleaned up observer for root:",e))})},e.prototype.destroy=function(){var e,t;this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null);try{for(var r=i(this.observers.values()),n=r.next();!n.done;n=r.next())n.value.disconnect()}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.observers.clear(),this.pending.clear(),this.appliedSelectors.clear(),this.batchedWork.clear(),this.debug&&(0,a.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next())r+=o.value.length}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.getAppliedCount=function(){return this.appliedSelectors.size},e.prototype.hasPendingForExperiment=function(e){var t,r;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next())if(o.value.some(function(t){return t.experimentName===e}))return!0}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},e}();t.PendingChangeManager=l},248:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},l=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPlugin=void 0;var u=r(44),d=r(609),h=function(e){function t(t){var r,n,i,o,a,l,s,c,u,h,g,p,f,v,y,m,b,x,w,C,E,k=e.call(this,{context:t.context,cookieName:t.cookieName,useQueryString:null!==(r=t.useQueryString)&&void 0!==r?r:"undefined"!=typeof window,queryPrefix:null!==(n=t.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(i=t.persistQueryToCookie)&&void 0!==i&&i,debug:null!==(o=t.debug)&&void 0!==o&&o})||this;if(k.onExperimentsAddedCallbacks=[],!t.context)throw new Error("[OverridesPlugin] Context is required");k.isServerSide="undefined"==typeof window;var S,O=t.sdkEndpoint;if(O||((S=t.context)._endpoint?O=S._endpoint:(null===(a=S._config)||void 0===a?void 0:a.endpoint)?O=S._config.endpoint:(null===(l=S._dataProvider)||void 0===l?void 0:l._endpoint)?O=S._dataProvider._endpoint:(null===(s=S._options)||void 0===s?void 0:s.endpoint)&&(O=S._options.endpoint.replace("/v1",""))),!O&&!t.absmartlyEndpoint&&!((S=t.context)._endpoint||(null===(c=S._config)||void 0===c?void 0:c.endpoint)||(null===(u=S._dataProvider)||void 0===u?void 0:u._endpoint)||(null===(h=S._options)||void 0===h?void 0:h.endpoint)))throw new Error("[OverridesPlugin] SDK endpoint must be provided if not available from context");return k.fullConfig={context:t.context,cookieName:t.cookieName,cookieAdapter:t.cookieAdapter,cookieOptions:null!==(g=t.cookieOptions)&&void 0!==g?g:{path:"/"},useQueryString:null!==(p=t.useQueryString)&&void 0!==p?p:!k.isServerSide,queryPrefix:null!==(f=t.queryPrefix)&&void 0!==f?f:"_exp_",envParam:null!==(v=t.envParam)&&void 0!==v?v:"env",persistQueryToCookie:null!==(y=t.persistQueryToCookie)&&void 0!==y&&y,url:t.url,absmartlyEndpoint:null!==(m=t.absmartlyEndpoint)&&void 0!==m?m:"",sdkEndpoint:O||"",domChangesFieldName:null!==(b=t.domChangesFieldName)&&void 0!==b?b:"__dom_changes",sdkApiKey:null!==(x=t.sdkApiKey)&&void 0!==x?x:"",application:null!==(w=t.application)&&void 0!==w?w:"",environment:null!==(C=t.environment)&&void 0!==C?C:"",debug:null!==(E=t.debug)&&void 0!==E&&E},k.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Initialized with config:",{isServerSide:k.isServerSide,cookieName:k.fullConfig.cookieName,useQueryString:k.fullConfig.useQueryString,queryPrefix:k.fullConfig.queryPrefix,envParam:k.fullConfig.envParam,persistQueryToCookie:k.fullConfig.persistQueryToCookie,sdkEndpoint:k.fullConfig.sdkEndpoint,absmartlyEndpoint:k.fullConfig.absmartlyEndpoint}),k}return i(t,e),t.prototype.ready=function(){return a(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return this.initialized?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Already initialized, skipping re-initialization"),[2]):(this.initialized=!0,this.registerWithContext(),e=this.getOverrides(),0===Object.keys(e.overrides).length?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No overrides found"),[2]):[4,this.applyOverridesWithFetching(e.overrides,e.devEnv)]);case 1:return t.sent(),[2]}})})},t.prototype.initialize=function(){return a(this,void 0,void 0,function(){return l(this,function(e){return[2,this.ready()]})})},t.prototype.getOverrides=function(){var e={overrides:{},devEnv:null};if(this.fullConfig.cookieName){var t=this.getEnhancedCookieOverrides();e.overrides=o({},t.overrides),e.devEnv=t.devEnv}if(this.fullConfig.useQueryString){var r=this.getEnhancedQueryStringOverrides();Object.keys(r.overrides).length>0&&(e.overrides=o(o({},e.overrides),r.overrides),null!==r.devEnv&&(e.devEnv=r.devEnv),this.fullConfig.persistQueryToCookie&&this.fullConfig.cookieName&&this.persistEnhancedOverridesToCookie(e))}return e},t.prototype.getEnhancedQueryStringOverrides=function(){var e,t;try{var r=void 0;if(this.isServerSide){if(!this.fullConfig.url)return{overrides:{},devEnv:null};var n="string"==typeof this.fullConfig.url?new URL(this.fullConfig.url):this.fullConfig.url;r=new URLSearchParams(n.search)}else r=new URLSearchParams(window.location.search);var i={},o=null;if(this.fullConfig.envParam){var a=r.get(this.fullConfig.envParam);a&&(o=a)}var l=this.fullConfig.queryPrefix;try{for(var u=s(r.entries()),h=u.next();!h.done;h=u.next()){var g=c(h.value,2),p=g[0],f=g[1];if(p.startsWith(l)){var v=p.substring(l.length);if(v){var y=f.split(","),m=parseInt(y[0],10);isNaN(m)||(1===y.length?i[v]=m:i[v]={variant:m,env:y[1]?parseInt(y[1],10):void 0,id:y[2]?parseInt(y[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}return this.fullConfig.debug&&Object.keys(i).length>0&&(0,d.logDebug)("[OverridesPlugin] Query string overrides:",i,"env:",o),{overrides:i,devEnv:o}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing query string:",e),{overrides:{},devEnv:null}}},t.prototype.getEnhancedCookieOverrides=function(){var e,t;if(!this.fullConfig.cookieName)return{overrides:{},devEnv:null};var r=null;if(this.fullConfig.cookieAdapter)r=this.fullConfig.cookieAdapter.get(this.fullConfig.cookieName);else if("undefined"!=typeof document){var n=this.fullConfig.cookieName+"=",i=document.cookie.split(";");try{for(var o=s(i),a=o.next();!a.done;a=o.next()){var l=a.value;if(0===(l=l.trim()).indexOf(n)){r=decodeURIComponent(l.substring(n.length));break}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}this.fullConfig.debug&&r&&(0,d.logDebug)("[OverridesPlugin] Raw cookie value:",r);var c=this.parseEnhancedCookieValue(r);return this.fullConfig.debug&&Object.keys(c.overrides).length>0&&(0,d.logDebug)("[OverridesPlugin] Parsed cookie overrides:",c),c},t.prototype.parseEnhancedCookieValue=function(e){var t,r;if(!e)return{overrides:{},devEnv:null};try{var n=null,i=e;if(e.startsWith("devEnv=")){var o=e.split("|");n=decodeURIComponent(o[0].substring(7)),i=o[1]||""}var a={};if(i){var l=i.split(",");try{for(var u=s(l),h=u.next();!h.done;h=u.next()){var g=h.value,p=c(g.split(":"),2),f=p[0],v=p[1];if(f&&v){var y=decodeURIComponent(f),m=(o=v.split("."),parseInt(o[0],10));isNaN(m)||(1===o.length?a[y]=m:a[y]={variant:m,env:o[1]?parseInt(o[1],10):void 0,id:o[2]?parseInt(o[2],10):void 0})}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}}return{overrides:a,devEnv:n}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing overrides:",e),{overrides:{},devEnv:null}}},t.prototype.persistEnhancedOverridesToCookie=function(e){var t,r;if(this.fullConfig.cookieName){var n=[];e.devEnv&&n.push("devEnv=".concat(encodeURIComponent(e.devEnv)));var i=[];try{for(var a=s(Object.entries(e.overrides)),l=a.next();!l.done;l=a.next()){var u=c(l.value,2),h=u[0],g=u[1],p=encodeURIComponent(h);if("number"==typeof g)i.push("".concat(p,":").concat(g));else{var f=g,v="".concat(p,":").concat(f.variant);void 0!==f.env&&(v+=".".concat(f.env)),void 0!==f.id&&(v+=".".concat(f.id)),i.push(v)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var y=n.length>0?"".concat(n.join("|"),"|").concat(i.join(",")):i.join(",");if(this.fullConfig.cookieAdapter){var m=o({},this.fullConfig.cookieOptions);this.isServerSide&&(void 0===m.httpOnly&&(m.httpOnly=!0),void 0===m.secure&&(m.secure=!0),void 0===m.sameSite&&(m.sameSite="lax")),this.fullConfig.cookieAdapter.set(this.fullConfig.cookieName,y,m)}else if("undefined"!=typeof document){m=this.fullConfig.cookieOptions||{};var b="".concat(this.fullConfig.cookieName,"=").concat(encodeURIComponent(y));m.path&&(b+=";path=".concat(m.path)),m.maxAge&&(b+=";max-age=".concat(m.maxAge));var x=m;if(x.expires){var w=x.expires instanceof Date?x.expires.toUTCString():x.expires;b+=";expires=".concat(w)}m.domain&&(b+=";domain=".concat(m.domain)),m.secure&&(b+=";secure"),m.sameSite&&(b+=";samesite=".concat(m.sameSite)),document.cookie=b}this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Persisted to cookie:",y)}},t.prototype.applyOverridesWithFetching=function(e,t){return a(this,void 0,void 0,function(){var r,n,i,o,a,u,h,g,p,f,v,y,m,b,x,w,C,E;return l(this,function(l){switch(l.label){case 0:(0,d.logDebug)("[OverridesPlugin] Initializing with overrides:",e),(0,d.logDebug)("[OverridesPlugin] Dev environment:",t),r=[],n=new Set;try{for(i=s(Object.entries(e)),o=i.next();!o.done;o=i.next())a=c(o.value,2),u=a[0],m=a[1],1===(h="number"==typeof m?{variant:m}:m).env?((0,d.logDebug)("[OverridesPlugin] ".concat(u," categorized as DEV experiment (env=1)")),r.push([u,h])):2===h.env&&h.id?((0,d.logDebug)("[OverridesPlugin] ".concat(u," categorized as DRAFT experiment (env=2, id=").concat(h.id,")")),n.add(h.id)):(0,d.logDebug)("[OverridesPlugin] ".concat(u," categorized as RUNNING experiment (env=").concat(h.env||0,")"))}catch(e){x={error:e}}finally{try{o&&!o.done&&(w=i.return)&&w.call(i)}finally{if(x)throw x.error}}return(0,d.logDebug)("[OverridesPlugin] Categorization summary:",{total_overrides:Object.keys(e).length,dev_experiments:r.length,draft_experiments:n.size,running_experiments:Object.keys(e).length-r.length-n.size,dev_environment:t}),n.size>0?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(n.size," DRAFT experiments from API")),[4,this.fetchFromAPI(Array.from(n))]):[3,2];case 1:l.sent(),l.label=2;case 2:return g=t||this.fullConfig.environment||null,r.length>0&&g?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(r.length," DEV experiments for environment: ").concat(g)),[4,this.fetchFromDevSDK(r,g)]):[3,4];case 3:return l.sent(),[3,5];case 4:r.length>0&&(0,d.logDebug)("[OverridesPlugin] Have ".concat(r.length," DEV experiments but NO devEnv specified - NOT fetching")),l.label=5;case 5:try{for(p=s(Object.entries(e)),f=p.next();!f.done;f=p.next())v=c(f.value,2),y=v[0],m=v[1],b="number"==typeof m?m:m.variant,this.fullConfig.context.override(y,b),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Override: ".concat(y," -> variant ").concat(b))}catch(e){C={error:e}}finally{try{f&&!f.done&&(E=p.return)&&E.call(p)}finally{if(C)throw C.error}}return[2]}})})},t.prototype.fetchFromAPI=function(e){return a(this,void 0,void 0,function(){var t,r,n,i,o,a;return l(this,function(l){switch(l.label){case 0:if(0===e.length)return this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No experiment IDs to fetch from API"),[2];(t=this.fullConfig.absmartlyEndpoint)||(t=this.fullConfig.sdkEndpoint.replace(".absmartly.io",".absmartly.com")),t.endsWith("/v1")&&(t=t.slice(0,-3)),t.startsWith("http")||(t="https://".concat(t)),r="".concat(t,"/v1/experiments?ids=").concat(e.join(",")),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching non-running experiments from API:",r),l.label=1;case 1:return l.trys.push([1,4,,5]),n={"Content-Type":"application/json"},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(r,{method:"GET",credentials:"include",headers:n,mode:"cors"})];case 2:return i=l.sent(),(0,d.logDebug)("[OverridesPlugin] API Response status:",i.status,i.statusText),i.ok?[4,i.json()]:((0,d.logDebug)("[OverridesPlugin] API request failed with status ".concat(i.status)),401===i.status&&(0,d.logDebug)("[OverridesPlugin] Check if you need to log in to the ABsmartly console first"),[2]);case 3:return(o=l.sent()).experiments&&(this.injectExperimentsIntoContext(o.experiments),this.notifyExperimentsAdded()),[3,5];case 4:return a=l.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from API:",a),[3,5];case 5:return[2]}})})},t.prototype.fetchFromDevSDK=function(e,t){return a(this,void 0,void 0,function(){var e,r,n,i,a,s,u;return l(this,function(l){switch(l.label){case 0:(e=this.fullConfig.sdkEndpoint).startsWith("http")||(e="https://".concat(e)),e.endsWith("/v1")&&(e=e.slice(0,-3)),r="".concat(e,"/v1/context?environment=").concat(encodeURIComponent(t)),this.fullConfig.application&&(r+="&application=".concat(encodeURIComponent(this.fullConfig.application))),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching development experiments from SDK:",r),l.label=1;case 1:return l.trys.push([1,4,,5]),n={},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(r,{method:"GET",headers:n})];case 2:return i=l.sent(),(0,d.logDebug)("[OverridesPlugin] DEV Response status:",i.status,i.statusText),i.ok?[4,i.json()]:((0,d.logDebug)("[OverridesPlugin] DEV SDK request failed with status ".concat(i.status)),[2]);case 3:return(a=l.sent()).experiments&&(s=Object.entries(a.experiments).map(function(e){var t=c(e,2),r=t[0],n=t[1];return o(o({},n),{name:r})}),this.injectExperimentsIntoContext(s),this.notifyExperimentsAdded()),[3,5];case 4:return u=l.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from dev SDK:",u),[3,5];case 5:return[2]}})})},t.prototype.injectExperimentsIntoContext=function(e){var t,r,n,i,a,l=this.fullConfig.context.data.bind(this.fullConfig.context),u=new Map;try{for(var h=s(e),g=h.next();!g.done;g=h.next()){var p=g.value,f={id:p.id,name:p.name,unitType:(null===(i=p.unit_type)||void 0===i?void 0:i.name)||"user_id",iteration:p.iteration||1,seedHi:0,seedLo:0,split:p.split||[],trafficSeedHi:0,trafficSeedLo:0,trafficSplit:[0,1],fullOnVariant:0,applications:(null===(a=p.applications)||void 0===a?void 0:a.map(function(e){var t;return{name:(null===(t=e.application)||void 0===t?void 0:t.name)||e.name}}))||[],variants:[],audience:p.audience||"",audienceStrict:p.audience_strict||!1};if(p.variants&&Array.isArray(p.variants))for(var v=0;v<p.variants.length;v++){var y=p.variants[v],m={name:y.name||"Variant ".concat(v),config:"string"==typeof y.config?y.config:JSON.stringify(y.config||{})};if(y.variables)m.variables=y.variables;else if(y.config)try{var b="string"==typeof y.config?JSON.parse(y.config):y.config,x=this.fullConfig.domChangesFieldName;b[x]&&(m.variables=((n={})[x]=b[x],n),(0,d.logDebug)("[OverridesPlugin] Variant ".concat(v," has DOM changes field '").concat(x,"'")))}catch(e){(0,d.logDebug)("[OverridesPlugin] Failed to parse variant config:",e)}f.variants[v]=m}u.set(p.name,f)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}this.fullConfig.context.data=function(){var e,t,r=l();if(!r)return r;var n=r.experiments||[],i=new Set(n.map(function(e){return e.name})),a=function(e,t){if(i.has(e)){var r=n.findIndex(function(t){return t.name===e});r>=0&&(n[r]=t)}else n.push(t)};try{for(var d=s(u),h=d.next();!h.done;h=d.next()){var g=c(h.value,2);a(g[0],g[1])}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}return o(o({},r),{experiments:n})},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Injected ".concat(e.length," experiments into context"))},t.prototype.onExperimentsAdded=function(e){this.onExperimentsAddedCallbacks.push(e)},t.prototype.notifyExperimentsAdded=function(){var e,t;this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Notifying ".concat(this.onExperimentsAddedCallbacks.length," listeners about new experiments"));try{for(var r=s(this.onExperimentsAddedCallbacks),n=r.next();!n.done;n=r.next()){var i=n.value;try{i()}catch(e){(0,d.logDebug)("[OverridesPlugin] Error in experiments added callback:",e)}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.registerWithContext=function(){this.fullConfig.context&&(this.fullConfig.context.__plugins||(this.fullConfig.context.__plugins={}),this.fullConfig.context.__plugins.overridesPlugin={name:"OverridesPlugin",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides","api-fetch","dev-environments"],instance:this,timestamp:Date.now()},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Registered with context at __plugins.overridesPlugin"))},t.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.fullConfig.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.fullConfig.context.__plugins.overridesPlugin,this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Unregistered from context"))},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.unregisterFromContext(),this.onExperimentsAddedCallbacks=[]},t}(u.OverridesPluginLite);t.OverridesPlugin=h},253:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(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},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLInjector=void 0;var a=r(609),l=r(973),s=function(){function e(e){void 0===e&&(e=!1),this.injectedIds=new Set,this.debug=e}return e.prototype.parseInjectionKey=function(e){var t,r;try{for(var i=n(["headStart","headEnd","bodyStart","bodyEnd"]),o=i.next();!o.done;o=i.next()){var l=o.value;if(e===l)return{location:l,priority:0};if(e.startsWith(l)){var s=e.substring(l.length),c=parseInt(s,10);if(!isNaN(c))return{location:l,priority:c}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,o,s,c,u,d,h,g;void 0===t&&(t=window.location.href);var p=new Map;try{for(var f=n(e),v=f.next();!v.done;v=f.next()){var y=i(v.value,2),m=y[0],b=y[1];try{for(var x=(s=void 0,n(b)),w=x.next();!w.done;w=x.next()){var C=i(w.value,2),E=C[0],k=C[1];if(k&&"object"==typeof k){if(k.urlFilter&&!l.URLMatcher.matches(k.urlFilter,t)){this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(E," - URL filter doesn't match:"),{currentUrl:t,urlFilter:k.urlFilter});continue}var S=k.data;if(S&&"object"==typeof S)try{for(var O=(u=void 0,n(Object.entries(S))),A=O.next();!A.done;A=O.next()){var P=i(A.value,2),_=P[0],D=P[1];if("string"==typeof D){var T=this.parseInjectionKey(_);if(T){var j={code:D,priority:T.priority,location:T.location};p.has(T.location)||p.set(T.location,[]),p.get(T.location).push(j),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:E,location:T.location,priority:T.priority,codeLength:D.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(_,":"),D)}}catch(e){u={error:e}}finally{try{A&&!A.done&&(d=O.return)&&d.call(O)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(E,":"),S)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(E,":"),k)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var L=n(p),M=L.next();!M.done;M=L.next()){var I=i(M.value,2),N=I[0],B=I[1];B.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(N," injections by priority:"),{location:N,count:B.length,priorities:B.map(function(e){return e.priority})})}}catch(e){h={error:e}}finally{try{M&&!M.done&&(g=L.return)&&g.call(L)}finally{if(h)throw h.error}}return p},e.prototype.inject=function(e){var t,r,l,s;try{for(var c=n(e),u=c.next();!u.done;u=c.next()){var d=i(u.value,2),h=d[0],g=d[1],p="headStart"===h||"bodyStart"===h?o([],i(g),!1).reverse():g;try{for(var f=(l=void 0,n(p)),v=f.next();!v.done;v=f.next()){var y=v.value;this.injectAtLocation(h,y.code)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(s=f.return)&&s.call(f)}finally{if(l)throw l.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}this.debug&&(0,a.logDebug)("[HTMLInjector] All injections complete")},e.prototype.injectAtLocation=function(e,t){var r="absmartly-inject-".concat(e,"-").concat(Date.now(),"-").concat(Math.random());if(!this.injectedIds.has(r))try{switch(e){case"headStart":this.injectHeadStart(t,r);break;case"headEnd":this.injectHeadEnd(t,r);break;case"bodyStart":this.injectBodyStart(t,r);break;case"bodyEnd":this.injectBodyEnd(t,r)}this.injectedIds.add(r),this.debug&&(0,a.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:r})}catch(t){this.debug&&(0,a.logDebug)("[HTMLInjector] Error injecting at ".concat(e,":"),t)}},e.prototype.injectHeadStart=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.insertBefore(r,document.head.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headStart injection")},e.prototype.injectHeadEnd=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headEnd injection")},e.prototype.injectBodyStart=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.insertBefore(r,document.body.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyStart injection")},e.prototype.injectBodyEnd=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyEnd injection")},e.prototype.createContainer=function(e,t){var r=document.createElement("div");return r.id=t,r.setAttribute("data-absmartly-injection","true"),r.innerHTML=e,r},e.prototype.destroy=function(){var e,t;try{for(var r=n(this.injectedIds),i=r.next();!i.done;i=r.next()){var o=i.value,l=document.getElementById(o);l&&l.remove()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.injectedIds.clear(),this.debug&&(0,a.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},319:(e,t)=>{"use strict";function r(e,t,r,n){void 0===n&&(n={});try{var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3);var o="expires=".concat(i.toUTCString()),a=n.path||"/",l="".concat(e,"=").concat(t,";").concat(o,";path=").concat(a);n.domain&&"localhost"!==n.domain&&(l+=";domain=".concat(n.domain));var s=n.sameSite||"Lax";return l+=";SameSite=".concat(s),n.secure&&(l+=";Secure"),document.cookie=l,!0}catch(t){return console.error("Unable to set cookie ".concat(e,":"),t),!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=function(e){var t,r="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===r.length&&(null===(t=r.pop())||void 0===t?void 0:t.split(";").shift())||null},t.setCookie=r,t.deleteCookie=function(e,t){void 0===t&&(t={}),r(e,"",-1,t)},t.generateUniqueId=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t.isLocalStorageAvailable=function(){try{var e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}},356:function(e,t,r){"use strict";var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(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},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VariantExtractor=void 0;var l=r(609),s=r(973),c=function(){function e(e,t,r,n){void 0===t&&(t="variable"),void 0===r&&(r="__dom_changes"),void 0===n&&(n=!1),this.cachedAllChanges=null,this.context=e,this.dataSource=t,this.dataFieldName=r,this.debug=n}return e.prototype.clearCache=function(){this.cachedAllChanges=null},e.prototype.extractAllChanges=function(){var e,t,r,n,s,c,u;if(this.cachedAllChanges)return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Returning cached changes"),this.cachedAllChanges;var d=new Map;try{var h=this.context.data();if((0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!h,contextKeys:h?Object.keys(h):[],experimentCount:(null===(r=null==h?void 0:h.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==h?void 0:h.experiments)||void 0===n?void 0:n[0])?{name:h.experiments[0].name,variantCount:(null===(s=h.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=h.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(h.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(h).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!h,experimentCount:(null===(u=null==h?void 0:h.experiments)||void 0===u?void 0:u.length)||0}),null==h?void 0:h.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",h.experiments.map(function(e){var t;return{name:e.name,hasVariants:!!e.variants,variantCount:(null===(t=e.variants)||void 0===t?void 0:t.length)||0}}));try{for(var g=i(h.experiments),p=g.next();!p.done;p=g.next()){var f=p.value,v=this.extractAllVariantsForExperiment(f);v.size>0?(d.set(f.name,v),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has DOM changes:"),{variantsWithChanges:Array.from(v.keys()),changesByVariant:Array.from(v.entries()).map(function(e){var t=o(e,2),r=t[0],n=t[1];return{variant:r,changeCount:n.length,changeTypes:a([],o(new Set(n.map(function(e){return e.type}))),!1)}})})):this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has no DOM changes"))}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=g.return)&&t.call(g)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=d,d},e.prototype.extractAllVariantsForExperiment=function(e){var t,r=new Map;if((0,l.logDebug)("[DEBUG] Processing experiment:",e.name,"with",(null===(t=e.variants)||void 0===t?void 0:t.length)||0,"variants"),!e.variants)return(0,l.logDebug)("[DEBUG] No variants found for experiment:",e.name),r;for(var n=0;n<e.variants.length;n++){var i=e.variants[n];if(i){var o=null;if("variable"===this.dataSource){if(i.variables&&i.variables[this.dataFieldName])o=i.variables[this.dataFieldName],(0,l.logDebug)("[VariantExtractor DEBUG] ✓ Found DOM changes in variables[".concat(this.dataFieldName,"]:"),o);else if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;a&&a[this.dataFieldName]?(o=a[this.dataFieldName],(0,l.logDebug)("[VariantExtractor DEBUG] ✓ Found DOM changes in config[".concat(this.dataFieldName,"]:"),o)):(0,l.logDebug)("[VariantExtractor DEBUG] ✗ No",this.dataFieldName,"field found in parsed config")}catch(e){(0,l.logDebug)("[VariantExtractor DEBUG] ✗ Failed to parse variant.config:",e,"Raw config:","string"==typeof i.config?i.config.substring(0,100):"")}if(o){var s=this.extractChangesFromData(o);s&&s.length>0&&r.set(n,s)}}}}return r},e.prototype.extractChangesFromData=function(e){if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(e&&"object"==typeof e&&!Array.isArray(e)&&"changes"in e){var t=e;return this.parseChanges(t.changes)}return this.parseChanges(e)},e.prototype.getExperimentChanges=function(e){var t=this.extractAllChanges().get(e);if(!t||0===t.size)return null;var r=this.context.peek(e);return null==r?(this.debug&&(0,l.logDebug)("[ABsmartly] No variant selected for ".concat(e)),null):t.get(r)||null},e.prototype.parseChanges=function(e){var t,r;if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(!Array.isArray(e))return this.debug&&(0,l.logDebug)("[ABsmartly] DOM changes data is not an array"),null;var n=[];try{for(var o=i(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.isValidChange(s)?n.push(s):this.debug&&(0,l.logDebug)("[ABsmartly] Invalid DOM change:",s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n.length>0?n:null},e.prototype.isValidChange=function(e){if(!e||"object"!=typeof e)return!1;var t=e;if(void 0===t.selector||null===t.selector||!t.type)return!1;if(!["text","html","style","class","attribute","javascript","move","create","delete","styleRules"].includes(t.type))return!1;switch(t.type){case"class":if(!t.add&&!t.remove)return!1;if(t.add&&!Array.isArray(t.add))return!1;if(t.remove&&!Array.isArray(t.remove))return!1;break;case"move":if(!t.targetSelector)return!1;break;case"create":if(!t.element||!t.targetSelector)return!1;break;case"style":case"attribute":if(!t.value||"object"!=typeof t.value)return!1}return!0},e.prototype.getAllVariantChanges=function(e){var t=this.extractAllChanges().get(e);if(!t)return[];for(var r=Math.max.apply(Math,a([],o(t.keys()),!1)),n=[],i=0;i<=r;i++)n.push(t.get(i)||[]);return n},e.prototype.getExperiment=function(e){try{var t=this.context.data();return t&&t.experiments&&t.experiments.find(function(t){return t.name===e})||null}catch(t){return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Failed to get experiment '".concat(e,"' - context may not be ready:"),t),null}},e.prototype.getAllVariantsData=function(e){var t=new Map;try{var r=this.context.data();if(!(null==r?void 0:r.experiments))return t;var n=r.experiments.find(function(t){return t.name===e});if(!(null==n?void 0:n.variants))return t;for(var i=0;i<n.variants.length;i++){var o=n.variants[i];if(o){var a=null;if("variable"===this.dataSource)if(o.variables&&o.variables[this.dataFieldName])a=o.variables[this.dataFieldName];else if(o.config)try{var s="string"==typeof o.config?JSON.parse(o.config):o.config;s&&s[this.dataFieldName]&&(a=s[this.dataFieldName])}catch(e){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(a){if("string"==typeof a)try{a=JSON.parse(a)}catch(e){(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,a)}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error getting all variants data:",e)}return t},e.prototype.anyVariantMatchesURL=function(e,t){var r,n;void 0===t&&(t=window.location.href);var a=this.getAllVariantsData(e),l=!1;try{for(var c=i(a),u=c.next();!u.done;u=c.next()){var d=o(u.value,2)[1];if(d&&"object"==typeof d&&!Array.isArray(d)&&"urlFilter"in d){var h=d;if(h.urlFilter&&(l=!0,s.URLMatcher.matches(h.urlFilter,t)))return!0}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return!l},e.prototype.extractAllInjectHTML=function(){var e,t,r=new Map;try{var n=this.context.data();if(this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting __inject_html from context"),null==n?void 0:n.experiments)try{for(var o=i(n.experiments),a=o.next();!a.done;a=o.next()){var s=a.value,c=this.extractInjectHTMLForExperiment(s);c.size>0&&(r.set(s.name,c),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(s.name,"' has HTML injections:"),{variantsWithInjections:Array.from(c.keys())}))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting __inject_html:",e)}return r},e.prototype.extractInjectHTMLForExperiment=function(e){var t=new Map;if(!e.variants)return t;for(var r=0;r<e.variants.length;r++){var i=e.variants[r];if(i&&i.variables&&i.variables.__inject_html){var o=i.variables.__inject_html;if("object"!=typeof o||Array.isArray(o))this.debug&&(0,l.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),o);else{var a=o,s=a.urlFilter,c=n(a,["urlFilter"]),u={data:c,urlFilter:s||void 0};t.set(r,u),this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(c),hasUrlFilter:!!s})}}}return t},e}();t.VariantExtractor=c},420:function(e,t,r){"use strict";var n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i<r.length;i++)"default"!==r[i]&&o(t,e,r[i]);return a(t,e),t}),s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},c=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},u=this&&this.__read||function(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},d=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},h=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsPlugin=void 0;var g=r(609),p=function(){function e(e){void 0===e&&(e={}),this.webVitalsLoaded=!1,this.metricsTracked=!1,this.context=e.context,this.debug=e.debug||!1,this.trackWebVitals=!1!==e.trackWebVitals,this.trackPageMetrics=!1!==e.trackPageMetrics,this.autoTrack=!1!==e.autoTrack,"undefined"!=typeof window&&this.trackWebVitals&&(this.webVitalsPromise=this.loadWebVitalsLibrary(),this.debugLog("Started pre-loading web-vitals library"))}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&g.logDebug.apply(void 0,d(["[WebVitalsPlugin]"],u(e),!1))},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for WebVitalsPlugin")},e.prototype.loadWebVitalsLibrary=function(){return s(this,void 0,void 0,function(){var e,t;return c(this,function(n){switch(n.label){case 0:if(this.webVitalsLoaded||"undefined"==typeof window)return[2,null];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return l(r(796))})];case 2:return e=n.sent(),this.webVitalsLoaded=!0,this.debugLog("Web Vitals library loaded from bundle"),[2,e];case 3:throw t=n.sent(),(0,g.logDebug)("[WebVitalsPlugin] Failed to load Web Vitals library:",t),t;case 4:return[2]}})})},e.prototype.trackWebVitalsMetrics=function(e){return s(this,void 0,void 0,function(){var t,r,n,o=this;return c(this,function(a){switch(a.label){case 0:if(!(t=e||this.context))return(0,g.logDebug)("[WebVitalsPlugin] No context available for tracking web vitals"),[2];if(!this.trackWebVitals)return[2];a.label=1;case 1:return a.trys.push([1,6,,7]),r=void 0,this.webVitalsPromise?[4,this.webVitalsPromise]:[3,3];case 2:return r=a.sent(),[3,5];case 3:return[4,this.loadWebVitalsLibrary()];case 4:r=a.sent(),a.label=5;case 5:return r?(r.onCLS(function(e){o.debugLog("CLS:",e),t.track("cls_score",i({},e))}),r.onLCP(function(e){o.debugLog("LCP:",e),t.track("lcp_score",i({},e))}),r.onFCP(function(e){o.debugLog("FCP:",e),t.track("fcp_score",i({},e))}),r.onINP(function(e){o.debugLog("INP:",e),t.track("inp_score",i({},e))}),r.onTTFB(function(e){o.debugLog("TTFB:",e),t.track("ttfb_score",i({},e))}),this.debugLog("Web Vitals tracking initialized"),[3,7]):((0,g.logDebug)("[WebVitalsPlugin] Web Vitals library not available"),[2]);case 6:return n=a.sent(),(0,g.logDebug)("[WebVitalsPlugin] Error tracking web vitals:",n),t.track("vitals_tracking_error",{error:n.message,type:n.name}),[3,7];case 7:return[2]}})})},e.prototype.trackPageMetricsData=function(e){var t=this,r=e||this.context;if(r){if(this.trackPageMetrics&&!this.metricsTracked)try{this.trackImmediateMetrics(r),"complete"===document.readyState?this.trackLoadMetrics(r):window.addEventListener("load",function(){return t.trackLoadMetrics(r)}),this.metricsTracked=!0}catch(e){(0,g.logDebug)("[WebVitalsPlugin] Error tracking page metrics:",e),r.track("metrics_tracking_error",{error:e.message,type:e.name})}}else(0,g.logDebug)("[WebVitalsPlugin] No context available for tracking page metrics")},e.prototype.trackImmediateMetrics=function(e){var t,r,n,i,o=performance.getEntriesByType("navigation")[0];if(o){var a={dns:o.domainLookupEnd-o.domainLookupStart,tcp:o.connectEnd-o.connectStart,ttfb:o.responseStart-o.requestStart,download:o.responseEnd-o.responseStart,total_fetch:o.responseEnd-o.requestStart};try{for(var l=h(Object.entries(a)),s=l.next();!s.done;s=l.next()){var c=u(s.value,2),d=c[0],g=c[1];e.track("page_timing_".concat(d),{value:g,unit:"ms"}),this.debugLog("Page timing ".concat(d,":"),g)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}var p={total_size:o.transferSize,header_size:o.transferSize-o.encodedBodySize,html_size:o.decodedBodySize,compressed_html_size:o.encodedBodySize};try{for(var f=h(Object.entries(p)),v=f.next();!v.done;v=f.next()){var y=u(v.value,2);d=y[0],g=y[1],e.track("page_".concat(d),{value:g,unit:"bytes"}),this.debugLog("Page ".concat(d,":"),g)}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}if(o.encodedBodySize>0){var m=o.decodedBodySize/o.encodedBodySize;e.track("page_compression_ratio",{value:m}),this.debugLog("Compression ratio:",m)}}else this.debugLog("Navigation timing not available")},e.prototype.trackLoadMetrics=function(e){var t,r,n=performance.getEntriesByType("navigation")[0];if(n){var i=n.domComplete-n.responseEnd;e.track("page_timing_dom_processing",{value:i,metric:"DOM Processing",unit:"ms",rating:i<=500?"good":i<=1e3?"needs-improvement":"poor"}),this.debugLog("DOM processing:",i);var o=n.loadEventEnd-n.fetchStart;e.track("page_timing_total_load",{value:o,metric:"Total Load",unit:"ms",rating:o<=2e3?"good":o<=4e3?"needs-improvement":"poor"}),this.debugLog("Total load:",o);var a={elements:document.getElementsByTagName("*").length,imageCount:document.getElementsByTagName("img").length,scriptCount:document.getElementsByTagName("script").length,styleCount:document.getElementsByTagName("style").length,linkCount:document.getElementsByTagName("link").length};try{for(var l=h(Object.entries(a)),s=l.next();!s.done;s=l.next()){var c=u(s.value,2),d=c[0],g=c[1];e.track("dom_".concat(d),{value:g,metric:d,unit:"count",rating:g<=1e3?"good":g<=2e3?"needs-improvement":"poor"}),this.debugLog("DOM ".concat(d,":"),g)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}}},e.prototype.initialize=function(){return s(this,void 0,void 0,function(){return c(this,function(e){return this.debugLog("Initializing WebVitalsPlugin"),this.context?(this.autoTrack&&(this.trackWebVitals&&this.trackWebVitalsMetrics(),this.trackPageMetrics&&this.trackPageMetricsData()),this.debugLog("WebVitalsPlugin initialized successfully"),[2]):(this.debugLog("No context available during initialization"),[2])})})},e.prototype.reset=function(){this.metricsTracked=!1,this.debugLog("WebVitalsPlugin reset")},e}();t.WebVitalsPlugin=p},574:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},609:function(e,t){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},n=this&&this.__read||function(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},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var o=n(e,2),a=o[0],l=o[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a),l)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]",console.log("".concat(c," [").concat(s,"] ").concat(a))}else console.log.apply(console,i([],n(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=o,t.logChangeApplication=function(e,r,n,i,a){t.DEBUG&&o("".concat(a?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:a})},t.logChangeRemoval=function(e,r,n,i){t.DEBUG&&o("Restored ".concat(i," element(s) to original state"),{experimentName:e,selector:r,changeType:n,elementsCount:i,action:"restore"})},t.logExperimentSummary=function(e,r,n,i){t.DEBUG&&o('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:r,successfulChanges:n,pendingChanges:i,successRate:r>0?"".concat(Math.round(n/r*100),"%"):"N/A"})},t.logStateOperation=function(e,r,n,i){t.DEBUG&&o("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})},t.logVisibilityEvent=function(e,r,n){t.DEBUG&&o(n?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:r.className||r.id||r.tagName,triggered:n,action:"visibility"})},t.logMessage=function(e,r,n){t.DEBUG&&o("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})},t.logPerformance=function(e,n,i){t.DEBUG&&o("Performance: ".concat(e," took ").concat(n,"ms"),r({operation:e,duration:n,performance:!0},i))},t.DEBUG=!1},637:function(e,t){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserCookieAdapter=void 0;var i=function(){function e(){}return e.prototype.get=function(e){var t,r,i=e+"=",o=document.cookie.split(";");try{for(var a=n(o),l=a.next();!l.done;l=a.next()){var s=l.value;if(0===(s=s.trim()).indexOf(i))return decodeURIComponent(s.substring(i.length))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return null},e.prototype.set=function(e,t,r){var n="".concat(e,"=").concat(encodeURIComponent(t));r&&(r.path&&(n+="; path=".concat(r.path)),r.domain&&(n+="; domain=".concat(r.domain)),void 0!==r.maxAge&&(n+="; max-age=".concat(r.maxAge)),r.secure&&(n+="; secure"),r.sameSite&&(n+="; samesite=".concat(r.sameSite))),document.cookie=n},e.prototype.delete=function(e,t){this.set(e,"",r(r({},t),{maxAge:0}))},e}();t.BrowserCookieAdapter=i},639:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},693:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheetManager=void 0;var n=r(609),i=function(){function e(e,t){void 0===t&&(t=!1),this.id=e,this.styleEl=null,this.rules=new Map,this.debug=t}return e.prototype.ensure=function(){if(!(this.styleEl&&document.head.contains(this.styleEl)||(this.styleEl=document.getElementById(this.id),this.styleEl))){var e=document.createElement("style");e.id=this.id,e.setAttribute("data-absmartly-styles","true"),document.head.appendChild(e),this.styleEl=e,this.debug&&(0,n.logDebug)("[ABsmartly] Created stylesheet: ".concat(this.id))}return this.styleEl},e.prototype.setRule=function(e,t){this.rules.set(e,t),this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Set CSS rule for ".concat(e))},e.prototype.deleteRule=function(e){this.rules.delete(e)&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Deleted CSS rule for ".concat(e)))},e.prototype.hasRule=function(e){return this.rules.has(e)},e.prototype.clear=function(){var e=this.rules.size>0;this.rules.clear(),e&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Cleared all CSS rules from ".concat(this.id)))},e.prototype.destroy=function(){this.clear(),this.styleEl&&document.head.contains(this.styleEl)&&(this.styleEl.remove(),this.styleEl=null,this.debug&&(0,n.logDebug)("[ABsmartly] Destroyed stylesheet: ".concat(this.id)))},e.prototype.render=function(){var e=this.ensure(),t=Array.from(this.rules.values()).join("\n\n");e.textContent=t},e.prototype.getRulesCount=function(){return this.rules.size},e.prototype.getCssText=function(){return Array.from(this.rules.values()).join("\n\n")},e}();t.StyleSheetManager=i},702:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(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};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),d=r(713),h=r(253),g=r(609),p=r(973),f=function(){function e(e){var t,r,n,i,o,a,l,u,g,p;if(this.mutationObserver=null,this.exposedExperiments=new Set,this.eventListeners=new Map,this.styleManagers=new Map,this.initialized=!1,this.watchedElements=new WeakMap,this.persistenceObserver=null,this.reapplyingElements=new Set,this.reapplyLogThrottle=new Map,this.appliedChanges=new Map,this.antiFlickerTimeout=null,this.antiFlickerStyleId="absmartly-antiflicker",this.config={context:e.context,autoApply:null===(t=e.autoApply)||void 0===t||t,spa:null===(r=e.spa)||void 0===r||r,visibilityTracking:null===(n=e.visibilityTracking)||void 0===n||n,extensionBridge:!1,dataSource:null!==(i=e.dataSource)&&void 0!==i?i:"variable",dataFieldName:null!==(o=e.dataFieldName)&&void 0!==o?o:"__dom_changes",debug:null!==(a=e.debug)&&void 0!==a&&a,hideUntilReady:null!==(l=e.hideUntilReady)&&void 0!==l&&l,hideTimeout:null!==(u=e.hideTimeout)&&void 0!==u?u:3e3,hideSelector:null!==(g=e.hideSelector)&&void 0!==g?g:"[data-absmartly-hide]",hideTransition:null!==(p=e.hideTransition)&&void 0!==p&&p},!this.config.context)throw new Error("[ABsmartly] Context is required");this.config.hideUntilReady&&this.hideContent(),this.domManipulator=new s.DOMManipulatorLite(this.config.debug,this),this.variantExtractor=new c.VariantExtractor(this.config.context,this.config.dataSource,this.config.dataFieldName,this.config.debug),this.exposureTracker=new d.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new h.HTMLInjector(this.config.debug)}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,g.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,g.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,dataSource:this.config.dataSource,DEBUG:g.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa&&(this.setupMutationObserver(),this.setupURLChangeListener()),this.config.autoApply?[4,this.applyInjectionsAndChanges()]:[3,3];case 2:i.sent(),i.label=3;case 3:return this.initialized=!0,this.registerWithContext(),this.emit("initialized"),r=performance.now()-t,(0,g.logPerformance)("Plugin initialization",r),(0,g.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,g.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,g.logDebug)("[ABsmartly] Failed to initialize plugin:",n),n;case 5:return[2]}})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2,this.ready()]})})},e.prototype.setupMutationObserver=function(){var e=this,t=new MutationObserver(function(t){t.forEach(function(t){"childList"===t.type&&t.addedNodes.forEach(function(t){if(t.nodeType===Node.ELEMENT_NODE){var r=t;e.appliedChanges.forEach(function(t,n){t.forEach(function(t){try{(r.matches(t.selector)?[r]:Array.from(r.querySelectorAll(t.selector))).forEach(function(r){e.config.debug&&(0,g.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:n,selector:t.selector,element:r.tagName,changeType:t.type}),e.domManipulator.applyChange(t,n)})}catch(e){}})})}})})});t.observe(document.body,{childList:!0,subtree:!0}),this.mutationObserver=t},e.prototype.setupURLChangeListener=function(){var e=this,t=function(){return i(e,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,g.logDebug)("[ABsmartly] URL changed, re-evaluating experiments:",e),[4,this.removeAllChanges()];case 1:return t.sent(),[4,this.applyInjectionsAndChanges()];case 2:return t.sent(),[2]}})})};window.addEventListener("popstate",t);var r=history.pushState,n=history.replaceState;history.pushState=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(history,e),t()},history.replaceState=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.apply(history,e),t()},this.config.debug&&(0,g.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return this.exposedExperiments.clear(),this.styleManagers.clear(),this.appliedChanges.clear(),this.htmlInjector.destroy(),this.variantExtractor.clearCache(),this.config.debug&&(0,g.logDebug)("[ABsmartly] All change tracking cleared for URL change"),[2]})})},e.prototype.applyInjectionsAndChanges=function(){return i(this,void 0,void 0,function(){var e,t,r,n,i;return o(this,function(o){switch(o.label){case 0:e=performance.now(),t=window.location.href,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),(0,g.logDebug)("[ABsmartly] Failed to wait for context ready:",r),[2];case 4:return n=this.variantExtractor.extractAllInjectHTML(),[4,Promise.all([this.applyHTMLInjections(n,t),this.applyChanges()])];case 5:return o.sent(),i=performance.now()-e,(0,g.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,g.logDebug)("[ABsmartly] HTML injections and DOM changes applied in parallel",{duration:"".concat(i.toFixed(2),"ms"),currentURL:t}),[2]}})})},e.prototype.applyHTMLInjections=function(e){return i(this,arguments,void 0,function(e,t){var r;return void 0===t&&(t=window.location.href),o(this,function(n){return 0===e.size?(this.config.debug&&(0,g.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,g.logDebug)("[ABsmartly] HTML injections complete",{experimentsWithInjections:e.size,totalLocations:r.size,currentUrl:t}),[2])})})},e.prototype.applyChanges=function(e){return i(this,void 0,void 0,function(){var t,r,n,i,s,c,u,d,h,p,f,v,y,m,b,x,w,C,E,k,S,O,A,P,_,D,T,j,L,M,I,N,B,F,R,U,V,z,W,H,q,G,Q,K,J;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,g.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,g.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,g.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,g.logDebug)("[ABsmartly] Current URL:",r),(0,g.logDebug)("[ABsmartly] Context ready:",!0)),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),(0,g.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,g.logDebug)("[ABsmartly] Experiments to process:",Array.from(i.keys())),(0,g.logDebug)("[ABsmartly] Total experiments with changes:",i.size);try{for(u=a(i),d=u.next();!d.done;d=u.next())if(h=l(d.value,2),p=h[0],f=h[1],!e||p===e)if(v=this.config.context.peek(p),y=f.variantData,m=f.urlFilter,b=f.globalDefaults,this.variantExtractor.anyVariantMatchesURL(p,r))if(x=this.shouldApplyVisualChanges(y,m,r),w=this.extractChangesFromData(y,b),C=this.extractAllVariantChanges(p),E=C.some(function(e){return e&&e.length>0}),E){if(k={total:(null==w?void 0:w.length)||0,success:0,pending:0},this.config.debug&&(0,g.logDebug)("[ABsmartly] Processing experiment '".concat(p,"' (variant ").concat(v,"):"),{urlMatches:x,changeCount:(null==w?void 0:w.length)||0,userVariantHasChanges:((null==w?void 0:w.length)||0)>0,changes:(null==w?void 0:w.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),S=!1,O=!1,x&&w&&w.length>0)try{for(z=void 0,A=a(w),P=A.next();!P.done;P=A.next())if(F=P.value,this.domManipulator.applyChange(F,p))s++,k.success++,F.trigger_on_view?O=!0:S=!0;else if("create"!==F.type&&"styleRules"!==F.type)try{0===document.querySelectorAll(F.selector).length&&(this.config.spa||F.waitForElement)&&(k.pending++,F.trigger_on_view&&(O=!0))}catch(e){this.config.debug&&(0,g.logDebug)("[ABsmartly] Invalid selector: ".concat(F.selector),e)}}catch(e){z={error:e}}finally{try{P&&!P.done&&(W=A.return)&&W.call(A)}finally{if(z)throw z.error}}else if(w&&w.length>0){try{for(H=void 0,_=a(w),D=_.next();!D.done;D=_.next())(F=D.value).trigger_on_view?O=!0:S=!0}catch(e){H={error:e}}finally{try{D&&!D.done&&(q=_.return)&&q.call(_)}finally{if(H)throw H.error}}(0,g.logDebug)("[ABsmartly] Experiment '".concat(p,"' variant ").concat(v," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"))}if(T=O,j=S,!O||!S)try{for(G=void 0,L=a(C),M=L.next();!M.done;M=L.next()){if((I=M.value)&&I.length>0)try{for(K=void 0,N=a(I),B=N.next();!B.done&&((F=B.value).trigger_on_view?T=!0:j=!0,!T||!j);B=N.next());}catch(e){K={error:e}}finally{try{B&&!B.done&&(J=N.return)&&J.call(N)}finally{if(K)throw K.error}}if(T&&j)break}}catch(e){G={error:e}}finally{try{M&&!M.done&&(Q=L.return)&&Q.call(L)}finally{if(G)throw G.error}}(T||j)&&this.exposureTracker.registerExperiment(p,v||0,w||[],C),c.set(p,k),(0,g.logExperimentSummary)(p,k.total,k.success,k.pending)}else this.config.debug&&(0,g.logDebug)("[ABsmartly] Skipping experiment '".concat(p,"' - no variants have changes"));else(0,g.logDebug)("[ABsmartly] Skipping experiment '".concat(p,"' - no variant matches URL: ").concat(r))}catch(e){U={error:e}}finally{try{d&&!d.done&&(V=u.return)&&V.call(u)}finally{if(U)throw U.error}}return R=performance.now()-t,(0,g.logPerformance)("Apply changes",R,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,g.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,g.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(R.toFixed(2),"ms"),experiments:Array.from(c.entries()).map(function(e){var t=l(e,2),r=t[0],n=t[1];return{name:r,total:n.total,success:n.success,pending:n.pending,pendingReason:n.pending>0?"Elements not found yet (SPA mode will retry)":void 0}})})),this.config.hideUntilReady&&this.showContent(),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var s=l(o.value,1)[0],c=this.config.context.peek(s);if(null!=c){var u=this.variantExtractor.getAllVariantsData(s).get(c);if(u){var d=null,h={};if(u&&"object"==typeof u&&!Array.isArray(u)&&"changes"in u){var g=u;d=g.urlFilter,h={waitForElement:g.waitForElement,persistStyle:g.persistStyle,important:g.important,observerRoot:g.observerRoot}}r.set(s,{variantData:u,urlFilter:d,globalDefaults:h})}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e.prototype.extractChangesFromData=function(e,t){var r=null;return Array.isArray(e)?r=e:e&&"object"==typeof e&&"changes"in e&&(r=e.changes),r&&0!==r.length?r.map(function(e){var r,i,o,a;return n(n({},e),{waitForElement:null!==(r=e.waitForElement)&&void 0!==r?r:t.waitForElement,persistStyle:null!==(i=e.persistStyle)&&void 0!==i?i:t.persistStyle,important:null!==(o=e.important)&&void 0!==o?o:t.important,observerRoot:null!==(a=e.observerRoot)&&void 0!==a?a:t.observerRoot})}):null},e.prototype.extractAllVariantChanges=function(e){for(var t=this.variantExtractor.getAllVariantChanges(e),r=this.variantExtractor.getAllVariantsData(e),i=[],o=function(e){var o=t[e],a=r.get(e);if(!o||0===o.length)return i.push([]),"continue";var l={};if(a&&"object"==typeof a&&!Array.isArray(a)&&"changes"in a){var s=a;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,important:s.important,observerRoot:s.observerRoot}}var c=o.map(function(e){var t,r,i,o;return n(n({},e),{waitForElement:null!==(t=e.waitForElement)&&void 0!==t?t:l.waitForElement,persistStyle:null!==(r=e.persistStyle)&&void 0!==r?r:l.persistStyle,important:null!==(i=e.important)&&void 0!==i?i:l.important,observerRoot:null!==(o=e.observerRoot)&&void 0!==o?o:l.observerRoot})});i.push(c)},a=0;a<t.length;a++)o(a);return i},e.prototype.shouldApplyVisualChanges=function(e,t,r){return!!Array.isArray(e)||!t||p.URLMatcher.matches(t,r)},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,g.logDebug)("Applying single change via public API",{experimentName:t,selector:e.selector,changeType:e.type});try{var r=this.domManipulator.applyChange(e,t);return r&&this.emit("change_applied",{experimentName:t,change:e}),r}catch(e){return this.config.debug&&(0,g.logDebug)("[ABsmartly] Error applying change:",e),!1}},e.prototype.on=function(e,t){var r=this.eventListeners.get(e)||[];r.push(t),this.eventListeners.set(e,r)},e.prototype.off=function(e,t){if(t){var r=this.eventListeners.get(e)||[],n=r.indexOf(t);-1!==n&&r.splice(n,1)}else this.eventListeners.delete(e)},e.prototype.emit=function(e,t){var r,n,i=this.eventListeners.get(e)||[];try{for(var o=a(i),l=o.next();!l.done;l=o.next()){var s=l.value;try{s(t)}catch(t){(0,g.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.getStyleManager=function(e){var t="absmartly-styles-".concat(e),r=this.styleManagers.get(e);return r||(r=new u.StyleSheetManager(t,this.config.debug),this.styleManagers.set(e,r)),r},e.prototype.buildCssRule=function(e,t,r){void 0===r&&(r=!0);var n=Object.entries(t).map(function(e){var t=l(e,2),n=t[0],i=t[1],o=n.replace(/([A-Z])/g,"-$1").toLowerCase(),a=r?" !important":"";return" ".concat(o,": ").concat(i).concat(a,";")}).join("\n");return"".concat(e," {\n").concat(n,"\n}")},e.prototype.buildStateRules=function(e,t,r){void 0===r&&(r=!0);var n=[];return t.normal&&n.push(this.buildCssRule(e,t.normal,r)),t.hover&&n.push(this.buildCssRule("".concat(e,":hover"),t.hover,r)),t.active&&n.push(this.buildCssRule("".concat(e,":active"),t.active,r)),t.focus&&n.push(this.buildCssRule("".concat(e,":focus"),t.focus,r)),n.join("\n\n")},e.prototype.refreshExperiments=function(){this.config.debug&&(0,g.logDebug)("[ABsmartly] Refreshing experiments and clearing cache"),this.variantExtractor.clearCache(),this.config.autoApply&&this.applyInjectionsAndChanges()},e.prototype.destroy=function(){this.domManipulator.destroy(),this.exposureTracker.destroy(),this.htmlInjector.destroy(),this.styleManagers.forEach(function(e){return e.destroy()}),this.styleManagers.clear(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.persistenceObserver&&(this.persistenceObserver.disconnect(),this.persistenceObserver=null),null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var e=document.getElementById(this.antiFlickerStyleId);e&&e.remove(),this.eventListeners.clear(),this.exposedExperiments.clear(),this.watchedElements=new WeakMap,this.appliedChanges.clear(),this.reapplyingElements.clear(),this.reapplyLogThrottle.clear(),this.unregisterFromContext(),this.initialized=!1,this.config.debug&&(0,g.logDebug)("[ABsmartly] DOM Changes Plugin Lite destroyed")},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.domPlugin={name:"DOMChangesPluginLite",version:e.VERSION,initialized:!0,capabilities:["spa","visibility"],instance:this,timestamp:Date.now()},this.config.context.__domPlugin=this.config.context.__plugins.domPlugin,this.config.debug&&(0,g.logDebug)("[ABsmartly] DOMChangesPluginLite registered with context at __plugins.domPlugin"))},e.prototype.unregisterFromContext=function(){var e;this.config.context&&((null===(e=this.config.context.__plugins)||void 0===e?void 0:e.domPlugin)&&delete this.config.context.__plugins.domPlugin,this.config.context.__domPlugin&&delete this.config.context.__domPlugin,this.config.debug&&(0,g.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from context"))},e.prototype.hideContent=function(){var e=this,t=this.config.hideUntilReady;if(t&&!document.getElementById(this.antiFlickerStyleId)){var r=document.createElement("style");r.id=this.antiFlickerStyleId;var n=!1!==this.config.hideTransition,i="body"===t?"body":this.config.hideSelector||"[data-absmartly-hide]";r.textContent="\n ".concat(i,n?" {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n ":" {\n visibility: hidden !important;\n }\n "),document.head.appendChild(r),this.antiFlickerTimeout=window.setTimeout(function(){e.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker enabled (mode: ".concat(t,", transition: ").concat(n?this.config.hideTransition:"none",", timeout: ").concat(this.config.hideTimeout,"ms)"))}},e.prototype.showContent=function(){var e=this;null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var t=document.getElementById(this.antiFlickerStyleId);if(t)if(!1!==this.config.hideTransition){var r="body"===this.config.hideUntilReady?"body":this.config.hideSelector||"[data-absmartly-hide]";t.textContent="\n ".concat(r," {\n opacity: 0 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n "),t.offsetHeight,t.textContent="\n ".concat(r," {\n opacity: 1 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n ");var n=1e3*parseFloat(this.config.hideTransition);setTimeout(function(){t.remove(),e.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,g.logDebug)("[ABsmartly] Anti-flicker removed, content now visible")},e.prototype.watchElement=function(e,t,r){var n=this.watchedElements.get(e);n||(n=new Set,this.watchedElements.set(e,n)),n.add(t),this.appliedChanges.has(t)||this.appliedChanges.set(t,[]);var i=this.appliedChanges.get(t);if(!i.includes(r)&&(i.push(r),this.config.debug)){var o={};r.value&&"object"==typeof r.value&&Object.keys(r.value).forEach(function(t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();o[r]=e.style.getPropertyValue(r)}),(0,g.logDebug)("[WATCH-ELEMENT] Started watching element for persistence/hydration recovery",{experimentName:t,selector:r.selector,element:e.tagName,changeType:r.type,value:r.value,currentStyles:"style"===r.type?o:void 0,timestamp:Date.now()})}this.persistenceObserver||this.setupPersistenceObserver()},e.prototype.unwatchElement=function(e,t){var r=this.watchedElements.get(e);r&&(r.delete(t),0===r.size&&this.watchedElements.delete(e))},e.prototype.setupPersistenceObserver=function(){var e=this;this.persistenceObserver||(this.config.debug&&(0,g.logDebug)("[PERSISTENCE-OBSERVER] Setting up persistence observer",{timestamp:Date.now(),watchedElementsCount:this.watchedElements?"has WeakMap":"no WeakMap"}),this.persistenceObserver=new MutationObserver(function(t){e.config.debug&&(0,g.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now(),mutations:t.map(function(e){var t;return{target:e.target.tagName,oldValue:null===(t=e.oldValue)||void 0===t?void 0:t.substring(0,100)}})}),t.forEach(function(t){var r=t.target;if(e.reapplyingElements.has(r))e.config.debug&&(0,g.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:r.tagName});else{var n=e.watchedElements.get(r);if(n){if(e.config.debug){var i="mutation:".concat(r.tagName,":").concat(r.getAttribute("name")||r.className),o=Date.now();o-(e.reapplyLogThrottle.get(i)||0)>5e3&&((0,g.logDebug)("[MUTATION-ON-WATCHED] Style mutation detected on watched element",{element:r.tagName,selector:r.getAttribute("name")||r.className,oldValue:t.oldValue,newValue:r.getAttribute("style"),experiments:Array.from(n)}),e.reapplyLogThrottle.set(i,o))}n.forEach(function(t){var n=e.appliedChanges.get(t);n&&n.forEach(function(n){var i,o;if("style"===n.type)if(e.checkStyleOverwritten(r,n.value)){e.reapplyingElements.add(r);var s="".concat(t,"-").concat(n.selector),c=Date.now(),u=e.reapplyLogThrottle.get(s)||0;if(e.config.debug&&c-u>5e3&&((0,g.logDebug)("[REAPPLY-TRIGGERED] Reapplying style after mutation (React/framework conflict detected)",{experimentName:t,selector:n.selector,element:r.tagName,timestamp:c,note:"This happens when the page framework (React/Vue/etc) fights with DOM changes"}),e.reapplyLogThrottle.set(s,c),e.reapplyLogThrottle.size>100)){var d=c-6e4;try{for(var h=a(e.reapplyLogThrottle.entries()),p=h.next();!p.done;p=h.next()){var f=l(p.value,2),v=f[0];f[1]<d&&e.reapplyLogThrottle.delete(v)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}e.domManipulator.applyChange(n,t),setTimeout(function(){e.reapplyingElements.delete(r)},0)}else e.config.debug&&(0,g.logDebug)("[MUTATION-NO-REAPPLY] Style mutation detected but no reapply needed",{experimentName:t,selector:n.selector})})})}}})}),this.persistenceObserver.observe(document.body,{attributes:!0,attributeFilter:["style"],subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,g.logDebug)("[PERSISTENCE-OBSERVER] Setup complete - now observing style mutations",{target:"document.body",attributeFilter:["style"],subtree:!0,attributeOldValue:!0,timestamp:Date.now()}))},e.prototype.checkStyleOverwritten=function(e,t){var r,n;try{for(var i=a(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=l(o.value,2),c=s[0],u=s[1],d=c.replace(/([A-Z])/g,"-$1").toLowerCase(),h=e.style.getPropertyValue(d),g=e.style.getPropertyPriority(d);if(h!==u||u.includes("!important")&&!g)return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.VERSION="1.0.0-lite",e}();t.DOMChangesPluginLite=f},713:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(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},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExposureTracker=void 0;var l=r(609),s=function(){function e(e,t){void 0===t&&(t=!1),this.context=e,this.experiments=new Map,this.trackedElements=new Map,this.mutationObserver=null,this.placeholders=new Map,this.debug=t,this.setupIntersectionObserver()}return e.prototype.registerExperiment=function(e,t,r,n){var i=this;this.debug&&(0,l.logDebug)("[ABsmartly] Registering experiment ".concat(e," for exposure tracking"));var s=new Set,c=new Set,u=new Map;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view&&("move"===e.type?(u.has(e.selector)||u.set(e.selector,new Set),e.targetSelector&&u.get(e.selector).add(e.targetSelector)):s.add(e.selector))})}),u.forEach(function(r,o){var a=[];n.forEach(function(e,t){var r=e.find(function(e){return"move"===e.type&&e.selector===o&&e.trigger_on_view});(null==r?void 0:r.targetSelector)&&a.push({targetSelector:r.targetSelector,position:r.position||"lastChild",variantIndex:t})});var l=a.findIndex(function(e){return e.variantIndex===t});l>=0?(s.add(o),a.forEach(function(t,r){r!==l&&i.createContainerPlaceholder(e,o,t.targetSelector,t.position)})):(s.add(o),a.forEach(function(t){i.createContainerPlaceholder(e,o,t.targetSelector,t.position)}))});var d=!1,h=!1;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view?h=!0:d=!0})});var g={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(a(a([],o(s),!1),o(c),!1)),triggered:!1,hasImmediateTrigger:d,hasViewportTrigger:h};this.experiments.set(e,g),this.debug&&(0,l.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(g.allPossibleSelectors)),d?this.triggerExposure(e).catch(function(t){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(e,":"),t)}):h&&this.observeSelectors(e,g.allPossibleSelectors)},e.prototype.createContainerPlaceholder=function(e,t,r,n){var i,o;void 0===n&&(n="lastChild");var a=document.querySelector(r);if(a){var s="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(!this.placeholders.has(s)){var c=document.createElement("span");switch(c.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",c.setAttribute("data-absmartly-placeholder","true"),c.setAttribute("data-absmartly-original-selector",t),c.setAttribute("data-absmartly-experiment",e),c.setAttribute("aria-hidden","true"),n){case"firstChild":a.insertBefore(c,a.firstChild);break;case"lastChild":default:a.appendChild(c);break;case"before":null===(i=a.parentElement)||void 0===i||i.insertBefore(c,a);break;case"after":null===(o=a.parentElement)||void 0===o||o.insertBefore(c,a.nextSibling)}this.placeholders.set(s,c),this.trackElement(c,e),this.debug&&(0,l.logDebug)("[ABsmartly] Created placeholder for ".concat(t," at ").concat(r," (").concat(n,")"))}}},e.prototype.getOriginalParentForMove=function(e){var t=document.querySelector(e);return(null==t?void 0:t.parentElement)?this.getStableParentSelector(t.parentElement):null},e.prototype.getStableParentSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t[0])}var r=e.parentElement;if(r){var n=Array.from(r.children).indexOf(e);return"".concat(e.tagName.toLowerCase(),":nth-child(").concat(n+1,")")}return null},e.prototype.observeSelectors=function(e,t){var r=this;t.forEach(function(t){var n=document.querySelectorAll(t);n.length>0?n.forEach(function(t){r.trackElement(t,e)}):r.watchForSelector(t,e)})},e.prototype.trackElement=function(e,t){this.trackedElements.has(e)?this.trackedElements.get(e).experiments.add(t):(this.trackedElements.set(e,{element:e,experiments:new Set([t]),isPlaceholder:e.hasAttribute("data-absmartly-placeholder")}),this.observer.observe(e))},e.prototype.watchForSelector=function(e,t){this.mutationObserver||this.setupMutationObserver()},e.prototype.setupIntersectionObserver=function(){var e=this;this.observer=new IntersectionObserver(function(t){t.forEach(function(t){t.isIntersecting&&e.handleElementVisible(t.target)})},{threshold:.01,rootMargin:"0px"})},e.prototype.setupMutationObserver=function(){var e=this;this.mutationObserver=new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){t instanceof Element&&e.checkNewElement(t)})})}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})},e.prototype.checkNewElement=function(e){var t=this;this.experiments.forEach(function(r,n){r.allPossibleSelectors.forEach(function(r){e.matches(r)&&t.trackElement(e,n),e.querySelectorAll(r).forEach(function(e){t.trackElement(e,n)})})})},e.prototype.handleElementVisible=function(e){var t=this,r=this.trackedElements.get(e);r&&r.experiments.forEach(function(n){var i=t.experiments.get(n);if(i&&!i.triggered&&(t.triggerExposure(n).catch(function(e){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(n,":"),e)}),t.debug)){var o=r.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):t.getElementSelector(e);(0,l.logDebug)("[ABsmartly] Triggering exposure for ".concat(n," via ").concat(o))}})},e.prototype.triggerExposure=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return!(t=this.experiments.get(e))||t.triggered?[2]:[4,this.context.ready()];case 1:return r.sent(),this.context.treatment(e),t.triggered=!0,this.debug&&(0,l.logDebug)("[ABsmartly] Exposure triggered for experiment: ".concat(e)),this.cleanupExperiment(e),[2]}})})},e.prototype.cleanupExperiment=function(e){var t=this;this.trackedElements.forEach(function(r,n){r.experiments.delete(e),0===r.experiments.size&&(t.observer.unobserve(n),t.trackedElements.delete(n))}),this.placeholders.forEach(function(r,n){n.startsWith("".concat(e,"-"))&&(r.remove(),t.placeholders.delete(n))});var r=this.experiments.get(e);r&&r.allPossibleSelectors.clear(),0===this.experiments.size&&this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)},e.prototype.getElementSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t.join("."))}return e.tagName.toLowerCase()},e.prototype.needsViewportTracking=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.hasViewportTrigger)&&void 0!==t&&t},e.prototype.isTriggered=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.triggered)&&void 0!==t&&t},e.prototype.destroy=function(){this.observer.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),this.placeholders.forEach(function(e){return e.remove()}),this.experiments.clear(),this.trackedElements.clear(),this.placeholders.clear(),this.debug&&(0,l.logDebug)("[ABsmartly] ExposureTracker destroyed")},e}();t.ExposureTracker=s},796:function(e,t){!function(e){"use strict";let t=-1;const r=e=>{addEventListener("pageshow",r=>{r.persisted&&(t=r.timeStamp,e(r))},!0)},n=(e,t,r,n)=>{let i,o;return a=>{t.value>=0&&(a||n)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},i=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},o=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},a=()=>{const e=o();return e?.activationStart??0},l=(e,r=-1)=>{const n=o();let i="navigate";return t>=0?i="back-forward-cache":n&&(document.prerendering||a()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:r,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},s=new WeakMap;function c(e,t){return s.get(e)||s.set(e,new t),s.get(e)}class u{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const d=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},h=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let g=-1;const p=new Set,f=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,v=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of p)e();isFinite(g)||(g="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",v,!0))}},y=()=>{if(g<0){const e=a(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;g=t??f(),addEventListener("visibilitychange",v,!0),addEventListener("prerenderingchange",v,!0),r(()=>{setTimeout(()=>{g=f()})})}return{get firstHiddenTime(){return g},onHidden(e){p.add(e)}}},m=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},b=[1800,3e3],x=(e,t={})=>{m(()=>{const o=y();let s,c=l("FCP");const u=d("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(u.disconnect(),t.startTime<o.firstHiddenTime&&(c.value=Math.max(t.startTime-a(),0),c.entries.push(t),s(!0)))});u&&(s=n(e,c,b,t.reportAllChanges),r(r=>{c=l("FCP"),s=n(e,c,b,t.reportAllChanges),i(()=>{c.value=performance.now()-r.timeStamp,s(!0)})}))})},w=[.1,.25];let C=0,E=1/0,k=0;const S=e=>{for(const t of e)t.interactionId&&(E=Math.min(E,t.interactionId),k=Math.max(k,t.interactionId),C=k?(k-E)/7+1:0)};let O;const A=()=>O?C:performance.interactionCount??0,P=()=>{"interactionCount"in performance||O||(O=d("event",S,{type:"event",buffered:!0,durationThreshold:0}))};let _=0;class D{u=[];l=new Map;p;m;v(){_=A(),this.u.length=0,this.l.clear()}T(){const e=Math.min(this.u.length-1,Math.floor((A()-_)/50));return this.u[e]}h(e){if(this.p?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.L){if(r?e.duration>r.L?(r.entries=[e],r.L=e.duration):e.duration===r.L&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],L:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.L-e.L),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.m?.(r)}}}const T=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=h(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},j=[200,500];class L{p;h(e){this.p?.(e)}}const M=[2500,4e3],I=[800,1800],N=e=>{document.prerendering?m(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};e.CLSThresholds=w,e.FCPThresholds=b,e.INPThresholds=j,e.LCPThresholds=M,e.TTFBThresholds=I,e.onCLS=(e,t={})=>{const o=y();x(h(()=>{let a,s=l("CLS",0);const h=c(t,u),g=e=>{for(const t of e)h.h(t);h.i>s.value&&(s.value=h.i,s.entries=h.o,a())},p=d("layout-shift",g);p&&(a=n(e,s,w,t.reportAllChanges),o.onHidden(()=>{g(p.takeRecords()),a(!0)}),r(()=>{h.i=0,s=l("CLS",0),a=n(e,s,w,t.reportAllChanges),i(()=>a())}),setTimeout(a))}))},e.onFCP=x,e.onINP=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=y();m(()=>{P();let o,a=l("INP");const s=c(t,D),u=e=>{T(()=>{for(const t of e)s.h(t);const t=s.T();t&&t.L!==a.value&&(a.value=t.L,a.entries=t.entries,o())})},h=d("event",u,{durationThreshold:t.durationThreshold??40});o=n(e,a,j,t.reportAllChanges),h&&(h.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{u(h.takeRecords()),o(!0)}),r(()=>{s.v(),a=l("INP"),o=n(e,a,j,t.reportAllChanges)}))})},e.onLCP=(e,t={})=>{m(()=>{const o=y();let s,u=l("LCP");const g=c(t,L),p=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)g.h(t),t.startTime<o.firstHiddenTime&&(u.value=Math.max(t.startTime-a(),0),u.entries=[t],s())},f=d("largest-contentful-paint",p);if(f){s=n(e,u,M,t.reportAllChanges);const o=h(()=>{p(f.takeRecords()),f.disconnect(),s(!0)}),a=e=>{e.isTrusted&&(T(o),removeEventListener(e.type,a,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,a,{capture:!0});r(r=>{u=l("LCP"),s=n(e,u,M,t.reportAllChanges),i(()=>{u.value=performance.now()-r.timeStamp,s(!0)})})}})},e.onTTFB=(e,t={})=>{let i=l("TTFB"),s=n(e,i,I,t.reportAllChanges);N(()=>{const c=o();c&&(i.value=Math.max(c.responseStart-a(),0),i.entries=[c],s(!0),r(()=>{i=l("TTFB",0),s=n(e,i,I,t.reportAllChanges),s(!0)}))})}}(t)},964:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(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},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMManipulatorLite=void 0;var a=r(609),l=r(214),s=function(){function e(e,t){void 0===e&&(e=!1);var r=this;this.appliedChanges=new Map,this.debug=e,this.plugin=t,this.pendingManager=new l.PendingChangeManager(function(e,t,n){return n?r.applyChangeToSpecificElement(e,t,n):r.applyChange(e,t)},e)}return e.prototype.applyChange=function(e,t){var r,n,i=this;if(!e.enabled&&void 0!==e.enabled)return(0,a.logDebug)("Skipping disabled change for experiment: ".concat(t),{experimentName:t,selector:e.selector,changeType:e.type}),!1;var o=!!this.plugin.reapplyingElements&&Array.from(this.plugin.reapplyingElements).length>0;this.debug&&(0,a.logDebug)("[DOM-APPLY] ".concat(o?"RE-APPLYING":"APPLYING"," change"),{experimentName:t,selector:e.selector,type:e.type,timestamp:Date.now(),callStack:null===(r=(new Error).stack)||void 0===r?void 0:r.split("\n").slice(2,4).join("\n")});try{if("styleRules"===e.type)return this.applyStyleRules(e,t);if("create"===e.type)return!!(e.element&&e.targetSelector&&this.createElement(e,t))&&(this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.targetSelector,e.type,1,!0),!0);var l=document.querySelectorAll(e.selector),s=[];if(0===l.length)return e.waitForElement||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa)?(this.debug&&(0,a.logDebug)("[ABsmartly] Element not found, adding to pending: ".concat(e.selector)),this.pendingManager.addPending({change:e,experimentName:t,observerRoot:e.observerRoot}),!0):(this.debug&&(0,a.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,a.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);if(l.forEach(function(r){var n,o;if(i.debug&&"style"===e.type){var l={};e.value&&"object"==typeof e.value&&Object.keys(e.value).forEach(function(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();l[t]=r.style.getPropertyValue(t)}),(0,a.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:r.tagName,oldStyles:l,newStyles:e.value})}if(i.applyChangeToElement(r,e),i.debug&&"style"===e.type){var c={};e.value&&"object"==typeof e.value&&Object.keys(e.value).forEach(function(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();c[t]=r.style.getPropertyValue(t)}),(0,a.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:r.tagName,appliedStyles:c})}if("javascript"===e.type){if(e.value)try{new Function("element",String(e.value))(r),s.push(r)}catch(e){(0,a.logDebug)("[ABsmartly] JavaScript execution error:",e)}}else if("move"===e.type){var u=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),d=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(u){var h=document.querySelector(u);h?(i.moveElement(r,h,d),s.push(r)):i.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(u))}}else s.push(r);"style"===e.type&&e.persistStyle||(null===(n=i.plugin.config)||void 0===n?void 0:n.spa)?i.plugin.watchElement(r,t,e):"style"===e.type&&i.debug&&(0,a.logDebug)("[WATCH-SKIP] NOT watching element - persistStyle and SPA both disabled",{experimentName:t,selector:e.selector,element:r.tagName,persistStyle:e.persistStyle,spaMode:null===(o=i.plugin.config)||void 0===o?void 0:o.spa})}),s.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var c=s.some(function(e){var t;return null===(t=i.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return c||(0,a.logChangeApplication)(t,e.selector,e.type,s.length,!0),!0}return(0,a.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,a.logDebug)("Error applying DOM change",{experimentName:t,selector:e.selector,changeType:e.type,error:r instanceof Error?r.message:"Unknown error"}),!1}},e.prototype.moveElement=function(e,t,r){var n,i,o;switch(r){case"before":null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t);break;case"after":t.nextSibling?null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling):null===(o=t.parentElement)||void 0===o||o.appendChild(e);break;case"firstChild":t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);break;default:t.appendChild(e)}},e.prototype.createElement=function(e,t){var r,i;if(!e.element||!e.targetSelector)return null;var o=document.querySelector(e.targetSelector);if(!o)return this.debug&&(0,a.logDebug)("[ABsmartly] Create target not found: ".concat(e.targetSelector)),null;var l=document.createElement("div");l.innerHTML=e.element;var s=Array.from(l.children);if(0===s.length)return null;try{for(var c=n(s),u=c.next();!u.done;u=c.next()){var d=u.value;this.moveElement(d,o,e.position)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return s[0]},e.prototype.applyStyleRules=function(e,t){try{var r=this.plugin.getStyleManager(t),n="".concat(e.selector,"::states"),i=void 0;if("string"==typeof e.value&&e.value.trim())i=e.value;else{if(!e.states)return!1;i=this.plugin.buildStateRules(e.selector,e.states,!1!==e.important)}return r.setRule(n,i),this.debug&&((0,a.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,a.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,n;switch(t.type){case"text":void 0!==t.value&&(e.textContent=String(t.value));break;case"html":void 0!==t.value&&(e.innerHTML=String(t.value));break;case"style":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(t){var r=i(t,2),n=r[0],o=r[1],a=n.replace(/([A-Z])/g,"-$1").toLowerCase();e.style.setProperty(a,String(o))});break;case"class":t.add&&Array.isArray(t.add)&&(r=e.classList).add.apply(r,o([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(n=e.classList).remove.apply(n,o([],i(t.remove),!1));break;case"attribute":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];null==o?e.removeAttribute(n):e.setAttribute(n,String(o))});break;case"move":if(t.value&&"object"==typeof t.value){var l=t.value,s=document.querySelector(l.targetSelector);s?this.moveElement(e,s,l.position):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(l.targetSelector))}break;case"delete":e.remove()}},e.prototype.applyChangeToSpecificElement=function(e,t,r){var n;try{if(this.applyChangeToElement(r,e),"javascript"===e.type&&e.value)try{new Function("element",String(e.value))(r)}catch(e){return(0,a.logDebug)("[ABsmartly] JavaScript execution error:",e),!1}else if("move"===e.type){var i=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),o=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(i){var l=document.querySelector(i);if(!l)return!1;this.moveElement(r,l,o)}}return("style"===e.type&&e.persistStyle||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa))&&this.plugin.watchElement(r,t,e),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying change to specific element:",e),!1}},e.prototype.trackAppliedChange=function(e,t){var r=this.appliedChanges.get(e);r||(r=new Set,this.appliedChanges.set(e,r));var n="".concat(t.selector,"-").concat(t.type);r.add(n)},e.prototype.hasChanges=function(e){return this.appliedChanges.has(e)},e.prototype.clearTracking=function(e){e?this.appliedChanges.delete(e):this.appliedChanges.clear()},e.prototype.removeAllPending=function(e){this.pendingManager.removeAllPending(e)},e.prototype.destroy=function(){this.pendingManager.destroy(),this.appliedChanges.clear()},e}();t.DOMManipulatorLite=s},973:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var r=function(){function e(){}return e.matches=function(e,t){void 0===t&&(t=window.location.href);var r=this.normalizeFilter(e),n=this.extractURLPart(t,r.matchType);return(!r.exclude||!this.matchesPatterns(r.exclude,n,r.mode))&&(!r.include||0!==r.include.length&&this.matchesPatterns(r.include,n,r.mode))},e.extractURLPart=function(e,t){void 0===t&&(t="path");try{var r=new URL(e);switch(t){case"full-url":return r.href;case"path":default:return r.pathname+r.hash;case"domain":return r.hostname;case"query":return r.search;case"hash":return r.hash}}catch(t){return console.error("[ABsmartly] Failed to parse URL: ".concat(e),t),e}},e.matchesPatterns=function(e,t,r){var n=this;return void 0===r&&(r="simple"),e.some(function(e){if("regex"===r)try{return new RegExp(e).test(t)}catch(t){return console.error("[ABsmartly] Invalid regex pattern: ".concat(e),t),!1}return n.matchSimplePattern(e,t)})},e.matchSimplePattern=function(e,t){var r=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");try{return new RegExp("^".concat(r,"$")).test(t)}catch(t){return console.error("[ABsmartly] Invalid pattern: ".concat(e),t),!1}},e.normalizeFilter=function(e){return"string"==typeof e?{include:[e],exclude:[],mode:"simple",matchType:"path"}:Array.isArray(e)?{include:e.length>0?e:void 0,exclude:[],mode:"simple",matchType:"path"}:{include:e.include,exclude:e.exclude||[],mode:e.mode||"simple",matchType:e.matchType||"path"}},e}();t.URLMatcher=r},977:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginFull=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(248).OverridesPlugin);t.OverridesPluginFull=o}},t={},function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(196);var e,t});