@absmartly/sdk-plugins 1.1.2 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/absmartly-cookie.min.js +1 -1
  2. package/dist/absmartly-dom-changes-core.min.js +1 -1
  3. package/dist/absmartly-dom-changes-lite.min.js +1 -1
  4. package/dist/absmartly-overrides-full.min.js +1 -1
  5. package/dist/absmartly-overrides-lite.min.js +1 -1
  6. package/dist/absmartly-sdk-plugins.min.js +1 -1
  7. package/dist/absmartly-vitals.min.js +1 -1
  8. package/es/cookies/cookieUtils.js +2 -1
  9. package/es/cookies/cookieUtils.js.map +1 -1
  10. package/es/core/DOMChangesPluginLite.js +195 -221
  11. package/es/core/DOMChangesPluginLite.js.map +1 -1
  12. package/es/core/DOMManipulatorLite.js +76 -10
  13. package/es/core/DOMManipulatorLite.js.map +1 -1
  14. package/es/core/ExposureTracker.js +136 -11
  15. package/es/core/ExposureTracker.js.map +1 -1
  16. package/es/core/PendingChangeManager.js +14 -14
  17. package/es/core/PendingChangeManager.js.map +1 -1
  18. package/es/entries/dom-with-overrides-lite.js +3 -0
  19. package/es/entries/dom-with-overrides-lite.js.map +1 -1
  20. package/es/generated/buildInfo.js +3 -0
  21. package/es/generated/buildInfo.js.map +1 -0
  22. package/es/index.js +9 -2
  23. package/es/index.js.map +1 -1
  24. package/es/overrides/OverridesPlugin.js +2 -2
  25. package/es/overrides/OverridesPlugin.js.map +1 -1
  26. package/es/overrides/OverridesPluginLite.js +29 -1
  27. package/es/overrides/OverridesPluginLite.js.map +1 -1
  28. package/es/overrides/overridesUtils.js +27 -18
  29. package/es/overrides/overridesUtils.js.map +1 -1
  30. package/es/parsers/VariantExtractor.js +14 -7
  31. package/es/parsers/VariantExtractor.js.map +1 -1
  32. package/es/url-redirect/URLRedirectExtractor.js +185 -0
  33. package/es/url-redirect/URLRedirectExtractor.js.map +1 -0
  34. package/es/url-redirect/URLRedirectMatcher.js +116 -0
  35. package/es/url-redirect/URLRedirectMatcher.js.map +1 -0
  36. package/es/url-redirect/URLRedirectPlugin.js +351 -0
  37. package/es/url-redirect/URLRedirectPlugin.js.map +1 -0
  38. package/es/url-redirect/index.js +5 -0
  39. package/es/url-redirect/index.js.map +1 -0
  40. package/es/url-redirect/types.js +2 -0
  41. package/es/url-redirect/types.js.map +1 -0
  42. package/es/utils/URLMatcher.js +4 -3
  43. package/es/utils/URLMatcher.js.map +1 -1
  44. package/es/utils/debug.js +4 -3
  45. package/es/utils/debug.js.map +1 -1
  46. package/es/utils/persistence.js +278 -0
  47. package/es/utils/persistence.js.map +1 -0
  48. package/es/utils/plugin-registry.js +47 -0
  49. package/es/utils/plugin-registry.js.map +1 -0
  50. package/lib/cookies/cookieUtils.d.ts +0 -4
  51. package/lib/cookies/cookieUtils.js +6 -5
  52. package/lib/cookies/cookieUtils.js.map +1 -1
  53. package/lib/core/DOMChangesPluginLite.d.ts +10 -7
  54. package/lib/core/DOMChangesPluginLite.js +195 -221
  55. package/lib/core/DOMChangesPluginLite.js.map +1 -1
  56. package/lib/core/DOMManipulatorLite.js +76 -10
  57. package/lib/core/DOMManipulatorLite.js.map +1 -1
  58. package/lib/core/ExposureTracker.d.ts +6 -0
  59. package/lib/core/ExposureTracker.js +136 -11
  60. package/lib/core/ExposureTracker.js.map +1 -1
  61. package/lib/core/PendingChangeManager.d.ts +0 -1
  62. package/lib/core/PendingChangeManager.js +14 -14
  63. package/lib/core/PendingChangeManager.js.map +1 -1
  64. package/lib/entries/dom-with-overrides-lite.d.ts +2 -0
  65. package/lib/entries/dom-with-overrides-lite.js +3 -1
  66. package/lib/entries/dom-with-overrides-lite.js.map +1 -1
  67. package/lib/generated/buildInfo.d.ts +2 -0
  68. package/lib/generated/buildInfo.js +6 -0
  69. package/lib/generated/buildInfo.js.map +1 -0
  70. package/lib/index.d.ts +8 -2
  71. package/lib/index.js +17 -1
  72. package/lib/index.js.map +1 -1
  73. package/lib/overrides/OverridesPlugin.js +2 -2
  74. package/lib/overrides/OverridesPlugin.js.map +1 -1
  75. package/lib/overrides/OverridesPluginLite.d.ts +8 -0
  76. package/lib/overrides/OverridesPluginLite.js +29 -1
  77. package/lib/overrides/OverridesPluginLite.js.map +1 -1
  78. package/lib/overrides/overridesUtils.d.ts +10 -5
  79. package/lib/overrides/overridesUtils.js +28 -18
  80. package/lib/overrides/overridesUtils.js.map +1 -1
  81. package/lib/parsers/VariantExtractor.js +14 -7
  82. package/lib/parsers/VariantExtractor.js.map +1 -1
  83. package/lib/types/index.d.ts +1 -0
  84. package/lib/url-redirect/URLRedirectExtractor.d.ts +16 -0
  85. package/lib/url-redirect/URLRedirectExtractor.js +188 -0
  86. package/lib/url-redirect/URLRedirectExtractor.js.map +1 -0
  87. package/lib/url-redirect/URLRedirectMatcher.d.ts +8 -0
  88. package/lib/url-redirect/URLRedirectMatcher.js +119 -0
  89. package/lib/url-redirect/URLRedirectMatcher.js.map +1 -0
  90. package/lib/url-redirect/URLRedirectPlugin.d.ts +21 -0
  91. package/lib/url-redirect/URLRedirectPlugin.js +354 -0
  92. package/lib/url-redirect/URLRedirectPlugin.js.map +1 -0
  93. package/lib/url-redirect/index.d.ts +4 -0
  94. package/lib/url-redirect/index.js +25 -0
  95. package/lib/url-redirect/index.js.map +1 -0
  96. package/lib/url-redirect/types.d.ts +29 -0
  97. package/lib/url-redirect/types.js +3 -0
  98. package/lib/url-redirect/types.js.map +1 -0
  99. package/lib/utils/URLMatcher.js +4 -3
  100. package/lib/utils/URLMatcher.js.map +1 -1
  101. package/lib/utils/debug.d.ts +1 -1
  102. package/lib/utils/debug.js +4 -3
  103. package/lib/utils/debug.js.map +1 -1
  104. package/lib/utils/persistence.d.ts +23 -0
  105. package/lib/utils/persistence.js +281 -0
  106. package/lib/utils/persistence.js.map +1 -0
  107. package/lib/utils/plugin-registry.d.ts +40 -0
  108. package/lib/utils/plugin-registry.js +53 -0
  109. package/lib/utils/plugin-registry.js.map +1 -0
  110. package/package.json +64 -6
  111. package/types/cookies/cookieUtils.d.ts +0 -4
  112. package/types/core/DOMChangesPluginLite.d.ts +10 -7
  113. package/types/core/ExposureTracker.d.ts +6 -0
  114. package/types/core/PendingChangeManager.d.ts +0 -1
  115. package/types/entries/dom-with-overrides-lite.d.ts +2 -0
  116. package/types/generated/buildInfo.d.ts +2 -0
  117. package/types/index.d.ts +8 -2
  118. package/types/overrides/OverridesPluginLite.d.ts +8 -0
  119. package/types/overrides/overridesUtils.d.ts +10 -5
  120. package/types/types/index.d.ts +1 -0
  121. package/types/url-redirect/URLRedirectExtractor.d.ts +16 -0
  122. package/types/url-redirect/URLRedirectMatcher.d.ts +8 -0
  123. package/types/url-redirect/URLRedirectPlugin.d.ts +21 -0
  124. package/types/url-redirect/index.d.ts +4 -0
  125. package/types/url-redirect/types.d.ts +29 -0
  126. package/types/utils/debug.d.ts +1 -1
  127. package/types/utils/persistence.d.ts +23 -0
  128. package/types/utils/plugin-registry.d.ts +40 -0
@@ -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.ABsmartlyVitals=t():e.ABsmartlyVitals=t()}(this,()=>(()=>{var e={420:function(e,t,r){"use strict";var n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i<r.length;i++)"default"!==r[i]&&o(t,e,r[i]);return a(t,e),t}),c=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},l=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},u=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},d=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},f=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsPlugin=void 0;var g=r(609),h=function(){function e(e){void 0===e&&(e={}),this.webVitalsLoaded=!1,this.metricsTracked=!1,this.context=e.context,this.debug=e.debug||!1,this.trackWebVitals=!1!==e.trackWebVitals,this.trackPageMetrics=!1!==e.trackPageMetrics,this.autoTrack=!1!==e.autoTrack,"undefined"!=typeof window&&this.trackWebVitals&&(this.webVitalsPromise=this.loadWebVitalsLibrary(),this.debugLog("Started pre-loading web-vitals library"))}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&g.logDebug.apply(void 0,d(["[WebVitalsPlugin]"],u(e),!1))},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for WebVitalsPlugin")},e.prototype.loadWebVitalsLibrary=function(){return c(this,void 0,void 0,function(){var e,t;return l(this,function(n){switch(n.label){case 0:if(this.webVitalsLoaded||"undefined"==typeof window)return[2,null];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return s(r(796))})];case 2:return e=n.sent(),this.webVitalsLoaded=!0,this.debugLog("Web Vitals library loaded from bundle"),[2,e];case 3:throw t=n.sent(),(0,g.logDebug)("[WebVitalsPlugin] Failed to load Web Vitals library:",t),t;case 4:return[2]}})})},e.prototype.trackWebVitalsMetrics=function(e){return c(this,void 0,void 0,function(){var t,r,n,o=this;return l(this,function(a){switch(a.label){case 0:if(!(t=e||this.context))return(0,g.logDebug)("[WebVitalsPlugin] No context available for tracking web vitals"),[2];if(!this.trackWebVitals)return[2];a.label=1;case 1:return a.trys.push([1,6,,7]),r=void 0,this.webVitalsPromise?[4,this.webVitalsPromise]:[3,3];case 2:return r=a.sent(),[3,5];case 3:return[4,this.loadWebVitalsLibrary()];case 4:r=a.sent(),a.label=5;case 5:return r?(r.onCLS(function(e){o.debugLog("CLS:",e),t.track("cls_score",i({},e))}),r.onLCP(function(e){o.debugLog("LCP:",e),t.track("lcp_score",i({},e))}),r.onFCP(function(e){o.debugLog("FCP:",e),t.track("fcp_score",i({},e))}),r.onINP(function(e){o.debugLog("INP:",e),t.track("inp_score",i({},e))}),r.onTTFB(function(e){o.debugLog("TTFB:",e),t.track("ttfb_score",i({},e))}),this.debugLog("Web Vitals tracking initialized"),[3,7]):((0,g.logDebug)("[WebVitalsPlugin] Web Vitals library not available"),[2]);case 6:return n=a.sent(),(0,g.logDebug)("[WebVitalsPlugin] Error tracking web vitals:",n),t.track("vitals_tracking_error",{error:n.message,type:n.name}),[3,7];case 7:return[2]}})})},e.prototype.trackPageMetricsData=function(e){var t=this,r=e||this.context;if(r){if(this.trackPageMetrics&&!this.metricsTracked)try{this.trackImmediateMetrics(r),"complete"===document.readyState?this.trackLoadMetrics(r):window.addEventListener("load",function(){return t.trackLoadMetrics(r)}),this.metricsTracked=!0}catch(e){(0,g.logDebug)("[WebVitalsPlugin] Error tracking page metrics:",e),r.track("metrics_tracking_error",{error:e.message,type:e.name})}}else(0,g.logDebug)("[WebVitalsPlugin] No context available for tracking page metrics")},e.prototype.trackImmediateMetrics=function(e){var t,r,n,i,o=performance.getEntriesByType("navigation")[0];if(o){var a={dns:o.domainLookupEnd-o.domainLookupStart,tcp:o.connectEnd-o.connectStart,ttfb:o.responseStart-o.requestStart,download:o.responseEnd-o.responseStart,total_fetch:o.responseEnd-o.requestStart};try{for(var s=f(Object.entries(a)),c=s.next();!c.done;c=s.next()){var l=u(c.value,2),d=l[0],g=l[1];e.track("page_timing_".concat(d),{value:g,unit:"ms"}),this.debugLog("Page timing ".concat(d,":"),g)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var h={total_size:o.transferSize,header_size:o.transferSize-o.encodedBodySize,html_size:o.decodedBodySize,compressed_html_size:o.encodedBodySize};try{for(var p=f(Object.entries(h)),m=p.next();!m.done;m=p.next()){var v=u(m.value,2);d=v[0],g=v[1];e.track("page_".concat(d),{value:g,unit:"bytes"}),this.debugLog("Page ".concat(d,":"),g)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}if(o.encodedBodySize>0){var y=o.decodedBodySize/o.encodedBodySize;e.track("page_compression_ratio",{value:y}),this.debugLog("Compression ratio:",y)}}else this.debugLog("Navigation timing not available")},e.prototype.trackLoadMetrics=function(e){var t,r,n=performance.getEntriesByType("navigation")[0];if(n){var i=n.domComplete-n.responseEnd;e.track("page_timing_dom_processing",{value:i,metric:"DOM Processing",unit:"ms",rating:i<=500?"good":i<=1e3?"needs-improvement":"poor"}),this.debugLog("DOM processing:",i);var o=n.loadEventEnd-n.fetchStart;e.track("page_timing_total_load",{value:o,metric:"Total Load",unit:"ms",rating:o<=2e3?"good":o<=4e3?"needs-improvement":"poor"}),this.debugLog("Total load:",o);var a={elements:document.getElementsByTagName("*").length,imageCount:document.getElementsByTagName("img").length,scriptCount:document.getElementsByTagName("script").length,styleCount:document.getElementsByTagName("style").length,linkCount:document.getElementsByTagName("link").length};try{for(var s=f(Object.entries(a)),c=s.next();!c.done;c=s.next()){var l=u(c.value,2),d=l[0],g=l[1];e.track("dom_".concat(d),{value:g,metric:d,unit:"count",rating:g<=1e3?"good":g<=2e3?"needs-improvement":"poor"}),this.debugLog("DOM ".concat(d,":"),g)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}},e.prototype.start=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return this.debugLog("Starting WebVitalsPlugin"),this.context?(this.autoTrack&&(this.trackWebVitals&&this.trackWebVitalsMetrics(),this.trackPageMetrics&&this.trackPageMetricsData()),this.debugLog("WebVitalsPlugin started successfully"),[2]):(this.debugLog("No context available during start"),[2])})})},e.prototype.ready=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.start()]})})},e.prototype.initialize=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.start()]})})},e.prototype.reset=function(){this.metricsTracked=!1,this.debugLog("WebVitalsPlugin reset")},e}();t.WebVitalsPlugin=h},609:function(e,t){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var o=n(e,2),a=o[0],s=o[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a),s)}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;c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").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},796:function(e,t){!function(e){"use strict";let t=-1;const r=e=>{addEventListener("pageshow",r=>{r.persisted&&(t=r.timeStamp,e(r))},!0)},n=(e,t,r,n)=>{let i,o;return a=>{t.value>=0&&(a||n)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},i=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},o=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},a=()=>{const e=o();return e?.activationStart??0},s=(e,r=-1)=>{const n=o();let i="navigate";return t>=0?i="back-forward-cache":n&&(document.prerendering||a()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:r,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},c=new WeakMap;function l(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class u{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const d=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},f=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let g=-1;const h=new Set,p=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,m=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of h)e();isFinite(g)||(g="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",m,!0))}},v=()=>{if(g<0){const e=a(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;g=t??p(),addEventListener("visibilitychange",m,!0),addEventListener("prerenderingchange",m,!0),r(()=>{setTimeout(()=>{g=p()})})}return{get firstHiddenTime(){return g},onHidden(e){h.add(e)}}},y=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},b=[1800,3e3],T=(e,t={})=>{y(()=>{const o=v();let c,l=s("FCP");const u=d("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(u.disconnect(),t.startTime<o.firstHiddenTime&&(l.value=Math.max(t.startTime-a(),0),l.entries.push(t),c(!0)))});u&&(c=n(e,l,b,t.reportAllChanges),r(r=>{l=s("FCP"),c=n(e,l,b,t.reportAllChanges),i(()=>{l.value=performance.now()-r.timeStamp,c(!0)})}))})},P=[.1,.25];let L=0,k=1/0,_=0;const w=e=>{for(const t of e)t.interactionId&&(k=Math.min(k,t.interactionId),_=Math.max(_,t.interactionId),L=_?(_-k)/7+1:0)};let S;const E=()=>S?L:performance.interactionCount??0,x=()=>{"interactionCount"in performance||S||(S=d("event",w,{type:"event",buffered:!0,durationThreshold:0}))};let C=0;class M{u=[];l=new Map;p;m;v(){C=E(),this.u.length=0,this.l.clear()}T(){const e=Math.min(this.u.length-1,Math.floor((E()-C)/50));return this.u[e]}h(e){if(this.p?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.L){if(r?e.duration>r.L?(r.entries=[e],r.L=e.duration):e.duration===r.L&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],L:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.L-e.L),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.m?.(r)}}}const V=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=f(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},B=[200,500];class O{p;h(e){this.p?.(e)}}const W=[2500,4e3],D=[800,1800],A=e=>{document.prerendering?y(()=>A(e)):"complete"!==document.readyState?addEventListener("load",()=>A(e),!0):setTimeout(e)};e.CLSThresholds=P,e.FCPThresholds=b,e.INPThresholds=B,e.LCPThresholds=W,e.TTFBThresholds=D,e.onCLS=(e,t={})=>{const o=v();T(f(()=>{let a,c=s("CLS",0);const f=l(t,u),g=e=>{for(const t of e)f.h(t);f.i>c.value&&(c.value=f.i,c.entries=f.o,a())},h=d("layout-shift",g);h&&(a=n(e,c,P,t.reportAllChanges),o.onHidden(()=>{g(h.takeRecords()),a(!0)}),r(()=>{f.i=0,c=s("CLS",0),a=n(e,c,P,t.reportAllChanges),i(()=>a())}),setTimeout(a))}))},e.onFCP=T,e.onINP=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=v();y(()=>{x();let o,a=s("INP");const c=l(t,M),u=e=>{V(()=>{for(const t of e)c.h(t);const t=c.T();t&&t.L!==a.value&&(a.value=t.L,a.entries=t.entries,o())})},f=d("event",u,{durationThreshold:t.durationThreshold??40});o=n(e,a,B,t.reportAllChanges),f&&(f.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{u(f.takeRecords()),o(!0)}),r(()=>{c.v(),a=s("INP"),o=n(e,a,B,t.reportAllChanges)}))})},e.onLCP=(e,t={})=>{y(()=>{const o=v();let c,u=s("LCP");const g=l(t,O),h=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)g.h(t),t.startTime<o.firstHiddenTime&&(u.value=Math.max(t.startTime-a(),0),u.entries=[t],c())},p=d("largest-contentful-paint",h);if(p){c=n(e,u,W,t.reportAllChanges);const o=f(()=>{h(p.takeRecords()),p.disconnect(),c(!0)}),a=e=>{e.isTrusted&&(V(o),removeEventListener(e.type,a,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,a,{capture:!0});r(r=>{u=s("LCP"),c=n(e,u,W,t.reportAllChanges),i(()=>{u.value=performance.now()-r.timeStamp,c(!0)})})}})},e.onTTFB=(e,t={})=>{let i=s("TTFB"),c=n(e,i,D,t.reportAllChanges);A(()=>{const l=o();l&&(i.value=Math.max(l.responseStart-a(),0),i.entries=[l],c(!0),r(()=>{i=s("TTFB",0),c=n(e,i,D,t.reportAllChanges),c(!0)}))})}}(t)}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};return(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.WebVitalsPlugin=void 0;var t=r(420);Object.defineProperty(e,"WebVitalsPlugin",{enumerable:!0,get:function(){return t.WebVitalsPlugin}}),e.default=t.WebVitalsPlugin})(),n})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlyVitals=t():e.ABsmartlyVitals=t()}(this,()=>(()=>{var e={420:function(e,t,r){"use strict";var n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i<r.length;i++)"default"!==r[i]&&o(t,e,r[i]);return a(t,e),t}),c=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},l=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},u=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},d=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},f=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsPlugin=void 0;var g=r(609),h=function(){function e(e){void 0===e&&(e={}),this.webVitalsLoaded=!1,this.metricsTracked=!1,this.context=e.context,this.debug=e.debug||!1,this.trackWebVitals=!1!==e.trackWebVitals,this.trackPageMetrics=!1!==e.trackPageMetrics,this.autoTrack=!1!==e.autoTrack,"undefined"!=typeof window&&this.trackWebVitals&&(this.webVitalsPromise=this.loadWebVitalsLibrary(),this.debugLog("Started pre-loading web-vitals library"))}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&g.logDebug.apply(void 0,d(["[WebVitalsPlugin]"],u(e),!1))},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for WebVitalsPlugin")},e.prototype.loadWebVitalsLibrary=function(){return c(this,void 0,void 0,function(){var e,t;return l(this,function(n){switch(n.label){case 0:if(this.webVitalsLoaded||"undefined"==typeof window)return[2,null];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return s(r(796))})];case 2:return e=n.sent(),this.webVitalsLoaded=!0,this.debugLog("Web Vitals library loaded from bundle"),[2,e];case 3:throw t=n.sent(),(0,g.logDebug)("[WebVitalsPlugin] Failed to load Web Vitals library:",t),t;case 4:return[2]}})})},e.prototype.trackWebVitalsMetrics=function(e){return c(this,void 0,void 0,function(){var t,r,n,o=this;return l(this,function(a){switch(a.label){case 0:if(!(t=e||this.context))return(0,g.logDebug)("[WebVitalsPlugin] No context available for tracking web vitals"),[2];if(!this.trackWebVitals)return[2];a.label=1;case 1:return a.trys.push([1,6,,7]),r=void 0,this.webVitalsPromise?[4,this.webVitalsPromise]:[3,3];case 2:return r=a.sent(),[3,5];case 3:return[4,this.loadWebVitalsLibrary()];case 4:r=a.sent(),a.label=5;case 5:return r?(r.onCLS(function(e){o.debugLog("CLS:",e),t.track("cls_score",i({},e))}),r.onLCP(function(e){o.debugLog("LCP:",e),t.track("lcp_score",i({},e))}),r.onFCP(function(e){o.debugLog("FCP:",e),t.track("fcp_score",i({},e))}),r.onINP(function(e){o.debugLog("INP:",e),t.track("inp_score",i({},e))}),r.onTTFB(function(e){o.debugLog("TTFB:",e),t.track("ttfb_score",i({},e))}),this.debugLog("Web Vitals tracking initialized"),[3,7]):((0,g.logDebug)("[WebVitalsPlugin] Web Vitals library not available"),[2]);case 6:return n=a.sent(),(0,g.logDebug)("[WebVitalsPlugin] Error tracking web vitals:",n),t.track("vitals_tracking_error",{error:n.message,type:n.name}),[3,7];case 7:return[2]}})})},e.prototype.trackPageMetricsData=function(e){var t=this,r=e||this.context;if(r){if(this.trackPageMetrics&&!this.metricsTracked)try{this.trackImmediateMetrics(r),"complete"===document.readyState?this.trackLoadMetrics(r):window.addEventListener("load",function(){return t.trackLoadMetrics(r)}),this.metricsTracked=!0}catch(e){(0,g.logDebug)("[WebVitalsPlugin] Error tracking page metrics:",e),r.track("metrics_tracking_error",{error:e.message,type:e.name})}}else(0,g.logDebug)("[WebVitalsPlugin] No context available for tracking page metrics")},e.prototype.trackImmediateMetrics=function(e){var t,r,n,i,o=performance.getEntriesByType("navigation")[0];if(o){var a={dns:o.domainLookupEnd-o.domainLookupStart,tcp:o.connectEnd-o.connectStart,ttfb:o.responseStart-o.requestStart,download:o.responseEnd-o.responseStart,total_fetch:o.responseEnd-o.requestStart};try{for(var s=f(Object.entries(a)),c=s.next();!c.done;c=s.next()){var l=u(c.value,2),d=l[0],g=l[1];e.track("page_timing_".concat(d),{value:g,unit:"ms"}),this.debugLog("Page timing ".concat(d,":"),g)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var h={total_size:o.transferSize,header_size:o.transferSize-o.encodedBodySize,html_size:o.decodedBodySize,compressed_html_size:o.encodedBodySize};try{for(var p=f(Object.entries(h)),m=p.next();!m.done;m=p.next()){var v=u(m.value,2);d=v[0],g=v[1];e.track("page_".concat(d),{value:g,unit:"bytes"}),this.debugLog("Page ".concat(d,":"),g)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}if(o.encodedBodySize>0){var y=o.decodedBodySize/o.encodedBodySize;e.track("page_compression_ratio",{value:y}),this.debugLog("Compression ratio:",y)}}else this.debugLog("Navigation timing not available")},e.prototype.trackLoadMetrics=function(e){var t,r,n=performance.getEntriesByType("navigation")[0];if(n){var i=n.domComplete-n.responseEnd;e.track("page_timing_dom_processing",{value:i,metric:"DOM Processing",unit:"ms",rating:i<=500?"good":i<=1e3?"needs-improvement":"poor"}),this.debugLog("DOM processing:",i);var o=n.loadEventEnd-n.fetchStart;e.track("page_timing_total_load",{value:o,metric:"Total Load",unit:"ms",rating:o<=2e3?"good":o<=4e3?"needs-improvement":"poor"}),this.debugLog("Total load:",o);var a={elements:document.getElementsByTagName("*").length,imageCount:document.getElementsByTagName("img").length,scriptCount:document.getElementsByTagName("script").length,styleCount:document.getElementsByTagName("style").length,linkCount:document.getElementsByTagName("link").length};try{for(var s=f(Object.entries(a)),c=s.next();!c.done;c=s.next()){var l=u(c.value,2),d=l[0],g=l[1];e.track("dom_".concat(d),{value:g,metric:d,unit:"count",rating:g<=1e3?"good":g<=2e3?"needs-improvement":"poor"}),this.debugLog("DOM ".concat(d,":"),g)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}},e.prototype.start=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return this.debugLog("Starting WebVitalsPlugin"),this.context?(this.autoTrack&&(this.trackWebVitals&&this.trackWebVitalsMetrics(),this.trackPageMetrics&&this.trackPageMetricsData()),this.debugLog("WebVitalsPlugin started successfully"),[2]):(this.debugLog("No context available during start"),[2])})})},e.prototype.ready=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.start()]})})},e.prototype.initialize=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.start()]})})},e.prototype.reset=function(){this.metricsTracked=!1,this.debugLog("WebVitalsPlugin reset")},e}();t.WebVitalsPlugin=h},609:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__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.DEBUG=void 0,t.logDebug=s,t.logChangeApplication=function(e,r,n,i,o){if(t.DEBUG){s("".concat(o?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:o})}},t.logChangeRemoval=function(e,r,n,i){if(t.DEBUG){s("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){s('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){s("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})}},t.logVisibilityEvent=function(e,r,n){if(t.DEBUG){s(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){s("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})}},t.logPerformance=function(e,r,i){if(t.DEBUG){s("Performance: ".concat(e," took ").concat(r,"ms"),n({operation:e,duration:r,performance:!0},i))}};var a=r(834);function s(){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 n=i(e,2),a=n[0],s=n[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a),s)}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;c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a))}else console.log.apply(console,o([],i(e),!1))}t.DEBUG=a.BUILD_DEBUG},796:function(e,t){!function(e){"use strict";let t=-1;const r=e=>{addEventListener("pageshow",r=>{r.persisted&&(t=r.timeStamp,e(r))},!0)},n=(e,t,r,n)=>{let i,o;return a=>{t.value>=0&&(a||n)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},i=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},o=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},a=()=>{const e=o();return e?.activationStart??0},s=(e,r=-1)=>{const n=o();let i="navigate";return t>=0?i="back-forward-cache":n&&(document.prerendering||a()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:r,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},c=new WeakMap;function l(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class u{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const d=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},f=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let g=-1;const h=new Set,p=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,m=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of h)e();isFinite(g)||(g="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",m,!0))}},v=()=>{if(g<0){const e=a(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;g=t??p(),addEventListener("visibilitychange",m,!0),addEventListener("prerenderingchange",m,!0),r(()=>{setTimeout(()=>{g=p()})})}return{get firstHiddenTime(){return g},onHidden(e){h.add(e)}}},y=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},b=[1800,3e3],T=(e,t={})=>{y(()=>{const o=v();let c,l=s("FCP");const u=d("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(u.disconnect(),t.startTime<o.firstHiddenTime&&(l.value=Math.max(t.startTime-a(),0),l.entries.push(t),c(!0)))});u&&(c=n(e,l,b,t.reportAllChanges),r(r=>{l=s("FCP"),c=n(e,l,b,t.reportAllChanges),i(()=>{l.value=performance.now()-r.timeStamp,c(!0)})}))})},L=[.1,.25];let P=0,_=1/0,k=0;const w=e=>{for(const t of e)t.interactionId&&(_=Math.min(_,t.interactionId),k=Math.max(k,t.interactionId),P=k?(k-_)/7+1:0)};let S;const E=()=>S?P:performance.interactionCount??0,x=()=>{"interactionCount"in performance||S||(S=d("event",w,{type:"event",buffered:!0,durationThreshold:0}))};let C=0;class B{u=[];l=new Map;p;m;v(){C=E(),this.u.length=0,this.l.clear()}T(){const e=Math.min(this.u.length-1,Math.floor((E()-C)/50));return this.u[e]}h(e){if(this.p?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.L){if(r?e.duration>r.L?(r.entries=[e],r.L=e.duration):e.duration===r.L&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],L:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.L-e.L),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.m?.(r)}}}const V=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=f(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},M=[200,500];class D{p;h(e){this.p?.(e)}}const O=[2500,4e3],W=[800,1800],I=e=>{document.prerendering?y(()=>I(e)):"complete"!==document.readyState?addEventListener("load",()=>I(e),!0):setTimeout(e)};e.CLSThresholds=L,e.FCPThresholds=b,e.INPThresholds=M,e.LCPThresholds=O,e.TTFBThresholds=W,e.onCLS=(e,t={})=>{const o=v();T(f(()=>{let a,c=s("CLS",0);const f=l(t,u),g=e=>{for(const t of e)f.h(t);f.i>c.value&&(c.value=f.i,c.entries=f.o,a())},h=d("layout-shift",g);h&&(a=n(e,c,L,t.reportAllChanges),o.onHidden(()=>{g(h.takeRecords()),a(!0)}),r(()=>{f.i=0,c=s("CLS",0),a=n(e,c,L,t.reportAllChanges),i(()=>a())}),setTimeout(a))}))},e.onFCP=T,e.onINP=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=v();y(()=>{x();let o,a=s("INP");const c=l(t,B),u=e=>{V(()=>{for(const t of e)c.h(t);const t=c.T();t&&t.L!==a.value&&(a.value=t.L,a.entries=t.entries,o())})},f=d("event",u,{durationThreshold:t.durationThreshold??40});o=n(e,a,M,t.reportAllChanges),f&&(f.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{u(f.takeRecords()),o(!0)}),r(()=>{c.v(),a=s("INP"),o=n(e,a,M,t.reportAllChanges)}))})},e.onLCP=(e,t={})=>{y(()=>{const o=v();let c,u=s("LCP");const g=l(t,D),h=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)g.h(t),t.startTime<o.firstHiddenTime&&(u.value=Math.max(t.startTime-a(),0),u.entries=[t],c())},p=d("largest-contentful-paint",h);if(p){c=n(e,u,O,t.reportAllChanges);const o=f(()=>{h(p.takeRecords()),p.disconnect(),c(!0)}),a=e=>{e.isTrusted&&(V(o),removeEventListener(e.type,a,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,a,{capture:!0});r(r=>{u=s("LCP"),c=n(e,u,O,t.reportAllChanges),i(()=>{u.value=performance.now()-r.timeStamp,c(!0)})})}})},e.onTTFB=(e,t={})=>{let i=s("TTFB"),c=n(e,i,W,t.reportAllChanges);I(()=>{const l=o();l&&(i.value=Math.max(l.responseStart-a(),0),i.entries=[l],c(!0),r(()=>{i=s("TTFB",0),c=n(e,i,W,t.reportAllChanges),c(!0)}))})}}(t)},834:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BUILD_DEBUG=t.BUILD_VERSION=void 0,t.BUILD_VERSION="1.2.2",t.BUILD_DEBUG=!1}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};return(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.WebVitalsPlugin=void 0;var t=r(420);Object.defineProperty(e,"WebVitalsPlugin",{enumerable:!0,get:function(){return t.WebVitalsPlugin}}),e.default=t.WebVitalsPlugin})(),n})());
@@ -2,6 +2,7 @@
2
2
  * Cookie utility functions extracted from CookiePlugin
3
3
  * These can be used independently for lightweight cookie operations
4
4
  */
5
+ import { logDebug } from '../utils/debug';
5
6
  /**
6
7
  * Get a cookie value by name
7
8
  */
@@ -38,7 +39,7 @@ export function setCookie(name, value, days, options) {
38
39
  return true;
39
40
  }
40
41
  catch (e) {
41
- console.error("Unable to set cookie ".concat(name, ":"), e);
42
+ logDebug("Unable to set cookie ".concat(name, ":"), e);
42
43
  return false;
43
44
  }
44
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cookieUtils.js","sourceRoot":"","sources":["../../src/cookies/cookieUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;;IACpC,IAAM,KAAK,GAAG,YAAK,QAAQ,CAAC,MAAM,CAAE,CAAC;IACrC,IAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,YAAK,IAAI,MAAG,CAAC,CAAC;IACxC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,IAAM,WAAW,GAAG,MAAA,KAAK,CAAC,GAAG,EAAE,0CAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;QACpD,OAAO,WAAW,IAAI,IAAI,CAAC;IAC7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