@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.
- package/dist/absmartly-cookie.min.js +1 -1
- package/dist/absmartly-dom-changes-core.min.js +1 -1
- package/dist/absmartly-dom-changes-lite.min.js +1 -1
- package/dist/absmartly-overrides-full.min.js +1 -1
- package/dist/absmartly-sdk-plugins.min.js +1 -1
- package/dist/absmartly-vitals.min.js +1 -1
- package/es/cookies/CookiePlugin.js +31 -61
- package/es/cookies/CookiePlugin.js.map +1 -1
- package/es/cookies/cookieUtils.js +82 -0
- package/es/cookies/cookieUtils.js.map +1 -0
- package/es/cookies/index.js +1 -0
- package/es/cookies/index.js.map +1 -1
- package/es/core/DOMChangesPluginLite.js +103 -20
- package/es/core/DOMChangesPluginLite.js.map +1 -1
- package/es/core/DOMManipulatorLite.js +64 -9
- package/es/core/DOMManipulatorLite.js.map +1 -1
- package/es/entries/dom-with-overrides-lite.js +6 -1
- package/es/entries/dom-with-overrides-lite.js.map +1 -1
- package/es/index.js +4 -0
- package/es/index.js.map +1 -1
- package/es/overrides/index.js +1 -0
- package/es/overrides/index.js.map +1 -1
- package/es/overrides/overridesUtils.js +255 -0
- package/es/overrides/overridesUtils.js.map +1 -0
- package/es/utils/debug.js +2 -1
- package/es/utils/debug.js.map +1 -1
- package/es/vitals/WebVitalsPlugin.js +65 -54
- package/es/vitals/WebVitalsPlugin.js.map +1 -1
- package/lib/cookies/CookiePlugin.d.ts +0 -3
- package/lib/cookies/CookiePlugin.js +31 -61
- package/lib/cookies/CookiePlugin.js.map +1 -1
- package/lib/cookies/cookieUtils.d.ts +34 -0
- package/lib/cookies/cookieUtils.js +90 -0
- package/lib/cookies/cookieUtils.js.map +1 -0
- package/lib/cookies/index.d.ts +2 -0
- package/lib/cookies/index.js +8 -1
- package/lib/cookies/index.js.map +1 -1
- package/lib/core/DOMChangesPluginLite.d.ts +1 -1
- package/lib/core/DOMChangesPluginLite.js +103 -20
- package/lib/core/DOMChangesPluginLite.js.map +1 -1
- package/lib/core/DOMManipulatorLite.js +64 -9
- package/lib/core/DOMManipulatorLite.js.map +1 -1
- package/lib/entries/dom-with-overrides-lite.d.ts +7 -1
- package/lib/entries/dom-with-overrides-lite.js +19 -1
- package/lib/entries/dom-with-overrides-lite.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +17 -1
- package/lib/index.js.map +1 -1
- package/lib/overrides/index.d.ts +2 -0
- package/lib/overrides/index.js +8 -1
- package/lib/overrides/index.js.map +1 -1
- package/lib/overrides/overridesUtils.d.ts +48 -0
- package/lib/overrides/overridesUtils.js +263 -0
- package/lib/overrides/overridesUtils.js.map +1 -0
- package/lib/utils/debug.js +2 -1
- package/lib/utils/debug.js.map +1 -1
- package/lib/vitals/WebVitalsPlugin.d.ts +1 -2
- package/lib/vitals/WebVitalsPlugin.js +98 -54
- package/lib/vitals/WebVitalsPlugin.js.map +1 -1
- package/package.json +4 -1
- package/types/cookies/CookiePlugin.d.ts +0 -3
- package/types/cookies/cookieUtils.d.ts +34 -0
- package/types/cookies/index.d.ts +2 -0
- package/types/core/DOMChangesPluginLite.d.ts +1 -1
- package/types/entries/dom-with-overrides-lite.d.ts +7 -1
- package/types/index.d.ts +4 -0
- package/types/overrides/index.d.ts +2 -0
- package/types/overrides/overridesUtils.d.ts +48 -0
- 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.ABsmartlyCookie=t():e.ABsmartlyCookie=t()}(this,()=>(()=>{"use strict";var e={91:function(e,t,o){var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))(function(r,a){function n(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(n,s)}c((i=i.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var o,i,r,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},n=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return n.next=s(0),n.throw=s(1),n.return=s(2),"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(o=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,a=o.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)n.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return n},n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,a=t.length;r<a;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var s=o(609),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&&s.logDebug.apply(void 0,n(["[CookiePlugin]"],a(e),!1))},e.prototype.getCookie=function(e){var t,o="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===o.length&&(null===(t=o.pop())||void 0===t?void 0:t.split(";").shift())||null},e.prototype.setCookie=function(e,t,o){try{var i=new Date,r=void 0!==o?o:this.cookieExpiryDays;i.setTime(i.getTime()+24*r*60*60*1e3);var a="expires=".concat(i.toUTCString()),n="".concat(e,"=").concat(t,";").concat(a,";path=").concat(this.cookiePath);return this.cookieDomain&&"localhost"!==this.cookieDomain&&(n+=";domain=".concat(this.cookieDomain)),n+=";SameSite=".concat(this.sameSite),this.secure&&(n+=";Secure"),document.cookie=n,this.debugLog("Set cookie ".concat(e,":"),t),!0}catch(t){return(0,s.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(),o=null;return e&&(o=this.getCookie(this.unitIdCookieName)||this.getCookie(this.publicIdCookieName)),!o&&t&&(o=localStorage.getItem("abs_id")),o&&(this.unitId=o),o},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,o=this.isLocalStorageAvailable();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),o&&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),o=(Date.now()-t)/864e5,i=o<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:o,isFresh:i}),i}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(o){var i=t.get(o);i&&(e[o]=i)}),0===Object.keys(e).length&&document.referrer)try{var o=new URL(document.referrer);this.utmParams.forEach(function(t){var i=o.searchParams.get(t);i&&(e[t]=i)})}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(e).length){var i=this.getStoredUtmParams();if(i)return i}return e},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},o=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)}o&&(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(),o=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&o&&(e=this.getCookie(this.utmCookieName)),e)try{var i=JSON.parse(e);if(Date.now()-i.timestamp<2592e6)return i.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t=this,o=e||this.context;if(o){var i=this.getUtmParams();Object.keys(i).length>0&&this.storeUtmParams(i),Object.entries(i).forEach(function(e){var i=a(e,2),r=i[0],n=i[1],s=r.slice(4);o.attribute(s,n),t.debugLog("Set attribute ".concat(s,":"),n)})}else(0,s.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 i(this,void 0,void 0,function(){var e;return r(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 o=this.getUnitId(),i=navigator.cookieEnabled,r=this.isLocalStorageAvailable();if(o){if(i&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(i||r){var a=this.getCookie(this.expiryCookieName);return this.debugLog(a?"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 o=new URLSearchParams(window.location.search),i=this.utmParams.some(function(e){return o.get(e)}),r=document.referrer,a=r&&!r.includes(this.cookieDomain.replace(".","")),n=navigator.cookieEnabled||this.isLocalStorageAvailable(),c=!!(this.getCookie(this.unitIdCookieName)||this.getCookie(this.publicIdCookieName)||this.getCookie(this.expiryCookieName)||this.isLocalStorageAvailable()&&localStorage.getItem("abs_id"));if(i||a||n&&!c){var l={referrer_url:r||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:this.isLocalStorageAvailable(),has_utm:i};this.debugLog("Tracking landing:",l),t.track("landing",l)}}else(0,s.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=c},609:function(e,t){var o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)},i=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,a=o.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)n.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return n},r=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,a=t.length;r<a;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};function a(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var a=i(e,2),n=a[0],s=a[1];if(n.includes("Original state already stored"))return;if(n.includes("State store operation"))return;if(n.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(n.includes("Message sent:")||n.includes("Message received:"))return;var c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(n),s)}else if(1===e.length&&"string"==typeof e[0]){if((n=e[0]).includes("Original state already stored"))return;if(n.includes("State store operation"))return;if(n.includes("Message sent:")||n.includes("Message received:"))return;c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(n))}else console.log.apply(console,r([],i(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=a,t.logChangeApplication=function(e,o,i,r,n){if(t.DEBUG){a("".concat(n?"✓":"✗"," Applied ").concat(i," change to ").concat(r," element(s)"),{experimentName:e,selector:o,changeType:i,elementsCount:r,success:n})}},t.logChangeRemoval=function(e,o,i,r){if(t.DEBUG){a("Restored ".concat(r," element(s) to original state"),{experimentName:e,selector:o,changeType:i,elementsCount:r,action:"restore"})}},t.logExperimentSummary=function(e,o,i,r){if(t.DEBUG){a('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:o,successfulChanges:i,pendingChanges:r,successRate:o>0?"".concat(Math.round(i/o*100),"%"):"N/A"})}},t.logStateOperation=function(e,o,i,r){if(t.DEBUG){a("State ".concat(e," operation"),{operation:e,selector:o,changeType:i,experimentName:r})}},t.logVisibilityEvent=function(e,o,i){if(t.DEBUG){a(i?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:o.className||o.id||o.tagName,triggered:i,action:"visibility"})}},t.logMessage=function(e,o,i){if(t.DEBUG){a("Message ".concat(e,": ").concat(o),{direction:e,messageType:o,payload:i,bridge:"extension"})}},t.logPerformance=function(e,i,r){if(t.DEBUG){a("Performance: ".concat(e," took ").concat(i,"ms"),o({operation:e,duration:i,performance:!0},r))}},t.DEBUG=!1}},t={};function o(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,o),a.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.CookiePlugin=void 0;var t=o(91);Object.defineProperty(e,"CookiePlugin",{enumerable:!0,get:function(){return t.CookiePlugin}}),e.default=t.CookiePlugin})(),i})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlyCookie=t():e.ABsmartlyCookie=t()}(this,()=>(()=>{"use strict";var e={91:function(e,t,o){var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))(function(r,a){function n(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(n,s)}c((i=i.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var o,i,r,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},n=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return n.next=s(0),n.throw=s(1),n.return=s(2),"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(o=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,a=o.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)n.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return n},n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,a=t.length;r<a;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var s=o(609),c=o(319),l=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&&s.logDebug.apply(void 0,n(["[CookiePlugin]"],a(e),!1))},e.prototype.setCookie=function(e,t,o){var i=void 0!==o?o:this.cookieExpiryDays,r=(0,c.setCookie)(e,t,i,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return r&&this.debugLog("Set cookie ".concat(e,":"),t),r},e.prototype.deleteCookie=function(e){(0,c.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,c.isLocalStorageAvailable)(),o=null;return e&&(o=(0,c.getCookie)(this.unitIdCookieName)||(0,c.getCookie)(this.publicIdCookieName)),!o&&t&&(o=localStorage.getItem("abs_id")),o&&(this.unitId=o),o},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,o=(0,c.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),o&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,c.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,c.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),o=(Date.now()-t)/864e5,i=o<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:o,isFresh:i}),i}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(o){var i=t.get(o);i&&(e[o]=i)}),0===Object.keys(e).length&&document.referrer)try{var o=new URL(document.referrer);this.utmParams.forEach(function(t){var i=o.searchParams.get(t);i&&(e[t]=i)})}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(e).length){var i=this.getStoredUtmParams();if(i)return i}return e},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},o=navigator.cookieEnabled;if((0,c.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)}o&&(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,c.isLocalStorageAvailable)(),o=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&o&&(e=(0,c.getCookie)(this.utmCookieName)),e)try{var i=JSON.parse(e);if(Date.now()-i.timestamp<2592e6)return i.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t=this,o=e||this.context;if(o){var i=this.getUtmParams();Object.keys(i).length>0&&this.storeUtmParams(i),Object.entries(i).forEach(function(e){var i=a(e,2),r=i[0],n=i[1],s=r.slice(4);o.attribute(s,n),t.debugLog("Set attribute ".concat(s,":"),n)})}else(0,s.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,c.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 i(this,void 0,void 0,function(){var e;return r(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 o=this.getUnitId(),i=navigator.cookieEnabled,r=(0,c.isLocalStorageAvailable)();if(o){if(i&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(i||r){var a=(0,c.getCookie)(this.expiryCookieName);return this.debugLog(a?"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 o=new URLSearchParams(window.location.search),i=this.utmParams.some(function(e){return o.get(e)}),r=document.referrer,a=r&&!r.includes(this.cookieDomain.replace(".","")),n=navigator.cookieEnabled||(0,c.isLocalStorageAvailable)(),l=!!((0,c.getCookie)(this.unitIdCookieName)||(0,c.getCookie)(this.publicIdCookieName)||(0,c.getCookie)(this.expiryCookieName)||(0,c.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(i||a||n&&!l){var u={referrer_url:r||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,c.isLocalStorageAvailable)(),has_utm:i};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,s.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=l},319:(e,t)=>{function o(e,t,o,i){void 0===i&&(i={});try{var r=new Date;r.setTime(r.getTime()+24*o*60*60*1e3);var a="expires=".concat(r.toUTCString()),n=i.path||"/",s="".concat(e,"=").concat(t,";").concat(a,";path=").concat(n);i.domain&&"localhost"!==i.domain&&(s+=";domain=".concat(i.domain));var c=i.sameSite||"Lax";return s+=";SameSite=".concat(c),i.secure&&(s+=";Secure"),document.cookie=s,!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,o="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===o.length){return(null===(t=o.pop())||void 0===t?void 0:t.split(";").shift())||null}return null},t.setCookie=o,t.deleteCookie=function(e,t){void 0===t&&(t={});o(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}}},609:function(e,t){var o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)},i=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,a=o.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)n.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return n},r=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,a=t.length;r<a;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};function a(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var a=i(e,2),n=a[0],s=a[1];if(n.includes("Original state already stored"))return;if(n.includes("State store operation"))return;if(n.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(n.includes("Message sent:")||n.includes("Message received:"))return;var c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(n),s)}else if(1===e.length&&"string"==typeof e[0]){if((n=e[0]).includes("Original state already stored"))return;if(n.includes("State store operation"))return;if(n.includes("Message sent:")||n.includes("Message received:"))return;c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(n))}else console.log.apply(console,r([],i(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=a,t.logChangeApplication=function(e,o,i,r,n){if(t.DEBUG){a("".concat(n?"✓":"✗"," Applied ").concat(i," change to ").concat(r," element(s)"),{experimentName:e,selector:o,changeType:i,elementsCount:r,success:n})}},t.logChangeRemoval=function(e,o,i,r){if(t.DEBUG){a("Restored ".concat(r," element(s) to original state"),{experimentName:e,selector:o,changeType:i,elementsCount:r,action:"restore"})}},t.logExperimentSummary=function(e,o,i,r){if(t.DEBUG){a('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:o,successfulChanges:i,pendingChanges:r,successRate:o>0?"".concat(Math.round(i/o*100),"%"):"N/A"})}},t.logStateOperation=function(e,o,i,r){if(t.DEBUG){a("State ".concat(e," operation"),{operation:e,selector:o,changeType:i,experimentName:r})}},t.logVisibilityEvent=function(e,o,i){if(t.DEBUG){a(i?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:o.className||o.id||o.tagName,triggered:i,action:"visibility"})}},t.logMessage=function(e,o,i){if(t.DEBUG){a("Message ".concat(e,": ").concat(o),{direction:e,messageType:o,payload:i,bridge:"extension"})}},t.logPerformance=function(e,i,r){if(t.DEBUG){a("Performance: ".concat(e," took ").concat(i,"ms"),o({operation:e,duration:i,performance:!0},r))}},t.DEBUG=!1}},t={};function o(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,o),a.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.CookiePlugin=void 0;var t=o(91);Object.defineProperty(e,"CookiePlugin",{enumerable:!0,get:function(){return t.CookiePlugin}}),e.default=t.CookiePlugin})(),i})());
|
|
@@ -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.ABsmartlyDOM=t():e.ABsmartlyDOM=t()}(this,()=>(()=>{"use strict";var e={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),h=u.next();!h.done;h=u.next()){var d=h.value,p=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var u=t||"document";try{for(var h=(r=void 0,i(g.pending.entries())),d=h.next();!d.done;d=h.next()){var p=o(d.value,2),f=p[0],y=p[1];if(f.endsWith("-".concat(u))){var v=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(y)),b=m.next();!b.done;b=m.next()){v(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{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}},g=this;try{for(var f=(a=void 0,i(d.addedNodes)),y=f.next();!y.done;y=f.next()){p(y.value)}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{h&&!h.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,h=!1;try{for(var d=(r=void 0,i(this.pending.keys())),p=d.next();!p.done;p=d.next()){if(p.value.endsWith("-".concat(u))){h=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}h||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},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,h,d,p;void 0===t&&(t=window.location.href);var g=new Map;try{for(var f=n(e),y=f.next();!y.done;y=f.next()){var v=i(y.value,2),m=v[0],b=v[1];try{for(var x=(s=void 0,n(b)),E=x.next();!E.done;E=x.next()){var w=i(E.value,2),A=w[0],S=w[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(A," - URL filter doesn't match:"),{currentUrl:t,urlFilter:S.urlFilter});continue}var D=S.data;if(D&&"object"==typeof D)try{for(var C=(u=void 0,n(Object.entries(D))),M=C.next();!M.done;M=C.next()){var O=i(M.value,2),j=O[0],_=O[1];if("string"==typeof _){var B=this.parseInjectionKey(j);if(B){var k={code:_,priority:B.priority,location:B.location};g.has(B.location)||g.set(B.location,[]),g.get(B.location).push(k),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:A,location:B.location,priority:B.priority,codeLength:_.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(j,":"),_)}}catch(e){u={error:e}}finally{try{M&&!M.done&&(h=C.return)&&h.call(C)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(A,":"),D)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(A,":"),S)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var T=n(g),L=T.next();!L.done;L=T.next()){var P=i(L.value,2),F=P[0],I=P[1];I.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(F," injections by priority:"),{location:F,count:I.length,priorities:I.map(function(e){return e.priority})})}}catch(e){d={error:e}}finally{try{L&&!L.done&&(p=T.return)&&p.call(T)}finally{if(d)throw d.error}}return g},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 h=i(u.value,2),d=h[0],p=h[1],g="headStart"===d||"bodyStart"===d?o([],i(p),!1).reverse():p;try{for(var f=(l=void 0,n(g)),y=f.next();!y.done;y=f.next()){var v=y.value;this.injectAtLocation(d,v.code)}}catch(e){l={error:e}}finally{try{y&&!y.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},254: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.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}}),i(r(574),t),t.default=o.DOMChangesPluginLite},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 h=new Map;try{var d=this.context.data();if((0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!d,contextKeys:d?Object.keys(d):[],experimentCount:(null===(r=null==d?void 0:d.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==d?void 0:d.experiments)||void 0===n?void 0:n[0])?{name:d.experiments[0].name,variantCount:(null===(s=d.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=d.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(d.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(d).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!d,experimentCount:(null===(u=null==d?void 0:d.experiments)||void 0===u?void 0:u.length)||0}),null==d?void 0:d.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",d.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 p=i(d.experiments),g=p.next();!g.done;g=p.next()){var f=g.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(h.set(f.name,y),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has DOM changes:"),{variantsWithChanges:Array.from(y.keys()),changesByVariant:Array.from(y.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{g&&!g.done&&(t=p.return)&&t.call(p)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=h,h},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 h=o(u.value,2)[1];if(h&&"object"==typeof h&&!Array.isArray(h)&&"urlFilter"in h){var d=h;if(d.urlFilter&&(l=!0,s.URLMatcher.matches(d.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},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},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),h=r(713),d=r(253),p=r(609),g=r(973),f=function(){function e(e){var t,r,n,i,o,a,l,u,p,g;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!==(p=e.hideSelector)&&void 0!==p?p:"[data-absmartly-hide]",hideTransition:null!==(g=e.hideTransition)&&void 0!==g&&g},!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 h.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new d.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,p.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,p.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:p.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,p.logPerformance)("Plugin initialization",r),(0,p.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,p.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,p.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,p.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,p.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,p.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,p.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,p.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,p.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,p.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,p.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,h,d,g,f,y,v,m,b,x,E,w,A,S,D,C,M,O,j,_,B,k,T,L,P,F,I,R,N,V,U,H,z,W,G,q,J,$,K;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,p.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,p.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,p.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,p.logDebug)("[ABsmartly] Current URL:",r),(0,p.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,p.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,p.logDebug)("[ABsmartly] Experiments to process:",Array.from(i.keys())),(0,p.logDebug)("[ABsmartly] Total experiments with changes:",i.size);try{for(u=a(i),h=u.next();!h.done;h=u.next())if(d=l(h.value,2),g=d[0],f=d[1],!e||g===e)if(y=this.config.context.peek(g),v=f.variantData,m=f.urlFilter,b=f.globalDefaults,this.variantExtractor.anyVariantMatchesURL(g,r))if(x=this.shouldApplyVisualChanges(v,m,r),E=this.extractChangesFromData(v,b),w=this.extractAllVariantChanges(g),A=w.some(function(e){return e&&e.length>0}),A){if(S={total:(null==E?void 0:E.length)||0,success:0,pending:0},this.config.debug&&(0,p.logDebug)("[ABsmartly] Processing experiment '".concat(g,"' (variant ").concat(y,"):"),{urlMatches:x,changeCount:(null==E?void 0:E.length)||0,userVariantHasChanges:((null==E?void 0:E.length)||0)>0,changes:(null==E?void 0:E.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),D=!1,C=!1,x&&E&&E.length>0)try{for(H=void 0,M=a(E),O=M.next();!O.done;O=M.next())if(R=O.value,this.domManipulator.applyChange(R,g))s++,S.success++,R.trigger_on_view?C=!0:D=!0;else if("create"!==R.type&&"styleRules"!==R.type)try{0===document.querySelectorAll(R.selector).length&&(this.config.spa||R.waitForElement)&&(S.pending++,R.trigger_on_view&&(C=!0))}catch(e){this.config.debug&&(0,p.logDebug)("[ABsmartly] Invalid selector: ".concat(R.selector),e)}}catch(e){H={error:e}}finally{try{O&&!O.done&&(z=M.return)&&z.call(M)}finally{if(H)throw H.error}}else if(E&&E.length>0){try{for(W=void 0,j=a(E),_=j.next();!_.done;_=j.next())(R=_.value).trigger_on_view?C=!0:D=!0}catch(e){W={error:e}}finally{try{_&&!_.done&&(G=j.return)&&G.call(j)}finally{if(W)throw W.error}}(0,p.logDebug)("[ABsmartly] Experiment '".concat(g,"' variant ").concat(y," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"))}if(B=C,k=D,!C||!D)try{for(q=void 0,T=a(w),L=T.next();!L.done;L=T.next()){if((P=L.value)&&P.length>0)try{for($=void 0,F=a(P),I=F.next();!I.done&&((R=I.value).trigger_on_view?B=!0:k=!0,!B||!k);I=F.next());}catch(e){$={error:e}}finally{try{I&&!I.done&&(K=F.return)&&K.call(F)}finally{if($)throw $.error}}if(B&&k)break}}catch(e){q={error:e}}finally{try{L&&!L.done&&(J=T.return)&&J.call(T)}finally{if(q)throw q.error}}(B||k)&&this.exposureTracker.registerExperiment(g,y||0,E||[],w),c.set(g,S),(0,p.logExperimentSummary)(g,S.total,S.success,S.pending)}else this.config.debug&&(0,p.logDebug)("[ABsmartly] Skipping experiment '".concat(g,"' - no variants have changes"));else(0,p.logDebug)("[ABsmartly] Skipping experiment '".concat(g,"' - no variant matches URL: ").concat(r))}catch(e){V={error:e}}finally{try{h&&!h.done&&(U=u.return)&&U.call(u)}finally{if(V)throw V.error}}return N=performance.now()-t,(0,p.logPerformance)("Apply changes",N,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,p.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,p.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(N.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 h=null,d={};if(u&&"object"==typeof u&&!Array.isArray(u)&&"changes"in u){var p=u;h=p.urlFilter,d={waitForElement:p.waitForElement,persistStyle:p.persistStyle,important:p.important,observerRoot:p.observerRoot}}r.set(s,{variantData:u,urlFilter:h,globalDefaults:d})}}}}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||g.URLMatcher.matches(t,r))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,p.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,p.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,p.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,p.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,p.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,p.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,p.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,p.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,p.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,p.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,p.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,p.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,p.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,p.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,p.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 h=c-6e4;try{for(var d=a(e.reapplyLogThrottle.entries()),g=d.next();!g.done;g=d.next()){var f=l(g.value,2),y=f[0];f[1]<h&&e.reapplyLogThrottle.delete(y)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}setTimeout(function(){e.reapplyingElements.delete(r)},0)}else e.config.debug&&(0,p.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,p.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],h=c.replace(/([A-Z])/g,"-$1").toLowerCase(),d=e.style.getPropertyValue(h),p=e.style.getPropertyPriority(h);if(d!==u||u.includes("!important")&&!p)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){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 h=!1,d=!1;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view?d=!0:h=!0})});var p={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(a(a([],o(s),!1),o(c),!1)),triggered:!1,hasImmediateTrigger:h,hasViewportTrigger:d};this.experiments.set(e,p),this.debug&&(0,l.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(p.allPossibleSelectors)),h?this.triggerExposure(e).catch(function(t){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(e,":"),t)}):d&&this.observeSelectors(e,p.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 h=u.value;this.moveElement(h,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}},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}(254);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.ABsmartlyDOM=t():e.ABsmartlyDOM=t()}(this,()=>(()=>{"use strict";var e={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),h=u.next();!h.done;h=u.next()){var p=h.value,d=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var u=t||"document";try{for(var h=(r=void 0,i(g.pending.entries())),p=h.next();!p.done;p=h.next()){var d=o(p.value,2),f=d[0],y=d[1];if(f.endsWith("-".concat(u))){var v=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(y)),b=m.next();!b.done;b=m.next()){v(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{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}},g=this;try{for(var f=(a=void 0,i(p.addedNodes)),y=f.next();!y.done;y=f.next()){d(y.value)}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{h&&!h.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,h=!1;try{for(var p=(r=void 0,i(this.pending.keys())),d=p.next();!d.done;d=p.next()){if(d.value.endsWith("-".concat(u))){h=!0;break}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}h||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},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,h,p,d;void 0===t&&(t=window.location.href);var g=new Map;try{for(var f=n(e),y=f.next();!y.done;y=f.next()){var v=i(y.value,2),m=v[0],b=v[1];try{for(var x=(s=void 0,n(b)),E=x.next();!E.done;E=x.next()){var A=i(E.value,2),w=A[0],S=A[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(w," - URL filter doesn't match:"),{currentUrl:t,urlFilter:S.urlFilter});continue}var D=S.data;if(D&&"object"==typeof D)try{for(var C=(u=void 0,n(Object.entries(D))),O=C.next();!O.done;O=C.next()){var M=i(O.value,2),j=M[0],T=M[1];if("string"==typeof T){var _=this.parseInjectionKey(j);if(_){var B={code:T,priority:_.priority,location:_.location};g.has(_.location)||g.set(_.location,[]),g.get(_.location).push(B),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:w,location:_.location,priority:_.priority,codeLength:T.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(j,":"),T)}}catch(e){u={error:e}}finally{try{O&&!O.done&&(h=C.return)&&h.call(C)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(w,":"),D)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(w,":"),S)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var k=n(g),P=k.next();!P.done;P=k.next()){var L=i(P.value,2),N=L[0],R=L[1];R.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(N," injections by priority:"),{location:N,count:R.length,priorities:R.map(function(e){return e.priority})})}}catch(e){p={error:e}}finally{try{P&&!P.done&&(d=k.return)&&d.call(k)}finally{if(p)throw p.error}}return g},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 h=i(u.value,2),p=h[0],d=h[1],g="headStart"===p||"bodyStart"===p?o([],i(d),!1).reverse():d;try{for(var f=(l=void 0,n(g)),y=f.next();!y.done;y=f.next()){var v=y.value;this.injectAtLocation(p,v.code)}}catch(e){l={error:e}}finally{try{y&&!y.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},254: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.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}}),i(r(574),t),t.default=o.DOMChangesPluginLite},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 h=new Map;try{var p=this.context.data();if((0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!p,contextKeys:p?Object.keys(p):[],experimentCount:(null===(r=null==p?void 0:p.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==p?void 0:p.experiments)||void 0===n?void 0:n[0])?{name:p.experiments[0].name,variantCount:(null===(s=p.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=p.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(p.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(p).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!p,experimentCount:(null===(u=null==p?void 0:p.experiments)||void 0===u?void 0:u.length)||0}),null==p?void 0:p.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",p.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 d=i(p.experiments),g=d.next();!g.done;g=d.next()){var f=g.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(h.set(f.name,y),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has DOM changes:"),{variantsWithChanges:Array.from(y.keys()),changesByVariant:Array.from(y.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{g&&!g.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=h,h},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 h=o(u.value,2)[1];if(h&&"object"==typeof h&&!Array.isArray(h)&&"urlFilter"in h){var p=h;if(p.urlFilter&&(l=!0,s.URLMatcher.matches(p.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},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},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),h=r(713),p=r(253),d=r(609),g=r(973),f=function(){function e(e){var t,r,n,i,o,a,l,u,d,g;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!==(d=e.hideSelector)&&void 0!==d?d:"[data-absmartly-hide]",hideTransition:null!==(g=e.hideTransition)&&void 0!==g&&g},!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 h.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new p.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,d.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,d.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:d.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,d.logPerformance)("Plugin initialization",r),(0,d.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,d.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,d.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,d.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,d.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,d.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,d.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,d.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,d.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,d.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,d.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,d.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,h,p,g,f,y,v,m,b,x,E,A,w,S,D,C,O,M,j,T,_,B,k,P,L,N,R,F,I,V,U,H,z,W,G,q,J,$,Y;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,d.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,d.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,d.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,d.logDebug)("[ABsmartly] Current URL:",r),(0,d.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,d.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,d.logDebug)("[ABsmartly] Experiments to process:",Array.from(i.keys())),(0,d.logDebug)("[ABsmartly] Total experiments with changes:",i.size);try{for(u=a(i),h=u.next();!h.done;h=u.next())if(p=l(h.value,2),g=p[0],f=p[1],!e||g===e)if(y=this.config.context.peek(g),v=f.variantData,m=f.urlFilter,b=f.globalDefaults,this.variantExtractor.anyVariantMatchesURL(g,r))if(x=this.shouldApplyVisualChanges(v,m,r),E=this.extractChangesFromData(v,b),A=this.extractAllVariantChanges(g),w=A.some(function(e){return e&&e.length>0}),w){if(S={total:(null==E?void 0:E.length)||0,success:0,pending:0},this.config.debug&&(0,d.logDebug)("[ABsmartly] Processing experiment '".concat(g,"' (variant ").concat(y,"):"),{urlMatches:x,changeCount:(null==E?void 0:E.length)||0,userVariantHasChanges:((null==E?void 0:E.length)||0)>0,changes:(null==E?void 0:E.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),D=!1,C=!1,x&&E&&E.length>0)try{for(H=void 0,O=a(E),M=O.next();!M.done;M=O.next())if(F=M.value,this.domManipulator.applyChange(F,g))s++,S.success++,F.trigger_on_view?C=!0:D=!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&&(C=!0))}catch(e){this.config.debug&&(0,d.logDebug)("[ABsmartly] Invalid selector: ".concat(F.selector),e)}}catch(e){H={error:e}}finally{try{M&&!M.done&&(z=O.return)&&z.call(O)}finally{if(H)throw H.error}}else if(E&&E.length>0){try{for(W=void 0,j=a(E),T=j.next();!T.done;T=j.next())(F=T.value).trigger_on_view?C=!0:D=!0}catch(e){W={error:e}}finally{try{T&&!T.done&&(G=j.return)&&G.call(j)}finally{if(W)throw W.error}}(0,d.logDebug)("[ABsmartly] Experiment '".concat(g,"' variant ").concat(y," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"))}if(_=C,B=D,!C||!D)try{for(q=void 0,k=a(A),P=k.next();!P.done;P=k.next()){if((L=P.value)&&L.length>0)try{for($=void 0,N=a(L),R=N.next();!R.done&&((F=R.value).trigger_on_view?_=!0:B=!0,!_||!B);R=N.next());}catch(e){$={error:e}}finally{try{R&&!R.done&&(Y=N.return)&&Y.call(N)}finally{if($)throw $.error}}if(_&&B)break}}catch(e){q={error:e}}finally{try{P&&!P.done&&(J=k.return)&&J.call(k)}finally{if(q)throw q.error}}(_||B)&&this.exposureTracker.registerExperiment(g,y||0,E||[],A),c.set(g,S),(0,d.logExperimentSummary)(g,S.total,S.success,S.pending)}else this.config.debug&&(0,d.logDebug)("[ABsmartly] Skipping experiment '".concat(g,"' - no variants have changes"));else(0,d.logDebug)("[ABsmartly] Skipping experiment '".concat(g,"' - no variant matches URL: ").concat(r))}catch(e){V={error:e}}finally{try{h&&!h.done&&(U=u.return)&&U.call(u)}finally{if(V)throw V.error}}return I=performance.now()-t,(0,d.logPerformance)("Apply changes",I,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,d.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,d.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(I.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 h=null,p={};if(u&&"object"==typeof u&&!Array.isArray(u)&&"changes"in u){var d=u;h=d.urlFilter,p={waitForElement:d.waitForElement,persistStyle:d.persistStyle,important:d.important,observerRoot:d.observerRoot}}r.set(s,{variantData:u,urlFilter:h,globalDefaults:p})}}}}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||g.URLMatcher.matches(t,r))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,d.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,d.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,d.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,d.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,d.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,d.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,d.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,d.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,d.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,d.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,d.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,d.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,d.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,d.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,d.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,d.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,d.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,d.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 h=c-6e4;try{for(var p=a(e.reapplyLogThrottle.entries()),g=p.next();!g.done;g=p.next()){var f=l(g.value,2),y=f[0];f[1]<h&&e.reapplyLogThrottle.delete(y)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}e.domManipulator.applyChange(n,t),setTimeout(function(){e.reapplyingElements.delete(r)},0)}else e.config.debug&&(0,d.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,d.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],h=c.replace(/([A-Z])/g,"-$1").toLowerCase(),p=e.style.getPropertyValue(h),d=e.style.getPropertyPriority(h);if(p!==u||u.includes("!important")&&!d)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){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 h=!1,p=!1;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view?p=!0:h=!0})});var d={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(a(a([],o(s),!1),o(c),!1)),triggered:!1,hasImmediateTrigger:h,hasViewportTrigger:p};this.experiments.set(e,d),this.debug&&(0,l.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(d.allPossibleSelectors)),h?this.triggerExposure(e).catch(function(t){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(e,":"),t)}):p&&this.observeSelectors(e,d.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,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){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 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),h=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(u){var p=document.querySelector(u);p?(i.moveElement(r,p,h),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 h=u.value;this.moveElement(h,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}},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}(254);return r})());
|