New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@abtasty/widget-utils

Package Overview
Dependencies
Maintainers
21
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/widget-utils - npm Package Compare versions

Comparing version 1.16.5 to 1.16.6-0

2

dist/widget-utils.cjs.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");function t(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}const o=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},r=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},i=()=>window.ABTastyProductKey,s=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID]||r(),n=()=>{if(e())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0},a="style",l="conditions",c="slider",d="group",g="https://widgets-images.abtasty.com/",h="rgba(255, 255, 255, 1)",p="rgba(247, 247, 247, 1)",u="https://social-proof-api.abtasty.com/clients/",m=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},y=()=>{const e=m();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},b=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,_=()=>{const{displayRecurrence:t,closingRecurrence:o,validationRecurrence:r}=DATA;if(e()||!t&&!o&&!r)return!1;const i={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},s={};return t&&(s.displayRecurrence=i[t]("displayRecurrence")),o&&(s.closingRecurrence=i[o]("closingRecurrence")),r&&(s.validationRecurrence=i[r]("validationRecurrence")),s},v=()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:o,triggerEventReengageDelay:r,socialProofContentType:i,triggerEventElementVisible:s,triggerEventDelay:n}=DATA;if(e()||!t&&!i)return!1;const a={click:()=>o,elementVisible:()=>s},l=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",c="reengage"===t?r:n;return i&&(t=1===i?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:l,triggerDelay:c}},w=()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!(!e||!["click","script"].includes(t))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(e=>e===t)},x=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},f=e=>{if(n()){const t=y();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${e}`,`background-color: rgba(0, 127, 145, 1); color: ${p}`)}},T=()=>{let e=document.location.hostname.split("").reverse().join("");if(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9-]+(?:\.|$)/i),null===e)e=document.location.hostname;else{"."!==e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join("")}return e},E=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,o)=>{t.resolve=e,t.reject=o}),t},S=(e,t,o)=>{let r=0,i=0;try{document.querySelector(e)}catch(t){const r=`Selector «${e}» not valid.`;return x(r),"function"==typeof o&&o(r)}function s(){clearInterval(i),clearTimeout(r)}return r=setTimeout(()=>{s();const t=`Can't find element «${e}».`;return x(t),"function"==typeof o&&o(t)},1e4),i=setInterval(()=>{const o=document.querySelector(e);return null!==o?(s(),"function"==typeof t&&t(o)):o},200),{clear:s}};function A(e,t){return t(e)||!e.parentElement?e:A(e.parentElement,t)}let C;function $(e){return new Promise((t,o)=>{const r=window.document.getElementsByTagName("script")[0],i=window.document.createElement("script");i.src=e,r.parentNode.insertBefore(i,r),i.onload=t,i.onerror=o})}async function N(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||$("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:t=!0}return t}class I{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:o},r){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(o),this.onSetCallback=r,this.widgetName=m(),this.uniqueId=b(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:o,...r}=t;return Object.entries(r).length?(e.setItem("ABTastyWidgets",JSON.stringify(r)),r):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const o=this.getTypeOfStorage(e);if(!o&&"object"!=typeof o)return!1;const{storageString:r,storageMethod:i}=o,s=this.getStamp(e),n={type:t,stamp:s},{type:a}=this.getCurrentRecurrence(),l=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let o;"session"===r?e?o=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),o=this.getSessionRecurrenceStorageParsed()):"local"===r&&(t?o=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),o=this.getLocalRecurrenceStorageParsed()));const s=o?{[this.recurrenceKey]:n,...o}:{[this.recurrenceKey]:n};i.setItem("ABTastyWidgets",JSON.stringify(s)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!i)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)l();else{if("display"!==t||"validation"===a||"closing"===a)return!1;l()}else l();return s}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class R{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const o=this.inViewportTargets.find(({element:o,selector:r})=>{if(o.isSameNode(e))return!0;const i=[...e.querySelectorAll(r)];if(i.length){if(i.includes(o))return!0}if(t.includes(o))return!0;const s=[...e.parentElement.children],n=s.findIndex(t=>t.isSameNode(e)),a=s.filter((e,t)=>t>n);if(a.length){if(a.includes(o))return!0;if(a.some(e=>[...e.querySelectorAll(r)].includes(o)))return!0}return!1});if(o&&this.isElementVisible(o.element)){const{selector:e,element:t,uniqueId:r}=o,i=this.targets.find(t=>t.selector===e&&t.uniqueId===r);i&&i.resolve(t),this.clear(e,r)}}mouseOverHandler(){const e=["mouseover",e=>setTimeout(()=>this.onMouseOver(e),50),!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===A(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),o=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let r=!1,i=0;for(;!r&&i<o.length;){const t=document.elementFromPoint(...o[i]);r=e===t||e.contains(t),i+=1}return r}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const o=document.querySelector(e);o&&!this.existingTargets.find(e=>e.element===o&&e.uniqueId===t)&&(this.existingTargets.push({element:o,selector:e,uniqueId:t}),this.visibilityObserver.observe(o))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:o})=>{if(t.matches(e)&&this.isElementVisible(t)){const r=this.targets.find(t=>t.selector===e&&t.uniqueId===o);return r&&r.resolve(t),this.clear(e,o),!1}return!0})}watch(e,t,o){this.targets.push({selector:e,resolve:t,uniqueId:o}),this.startMutationObserver(),this.checkElements()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(o=>o.filter(({selector:o,uniqueId:r})=>o!==e&&r!==t)),this.visibilityObserver.unobserve(document.querySelector(e)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class P{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:o}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*o,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:o}){const r=E(`${this.event}DomReady`);this.promises.push(r);const i=await this.onPageLoad(r),s=await N("IntersectionObserver"),n=t("VisibilityObserver",R);if(this.visibilityObservers.push(n),s&&i){const e=b();n.watch(this.selector,o,e)}return e}onPageLoad({promise:e,resolve:t}){const o=()=>"complete"===document.readyState;if(!o()){const e=["readystatechange",()=>o()&&t(!0),{passive:!0}];this.eventsListeners.push(e),document.addEventListener(...e)}return t(!0),e}onClick({promise:e,resolve:t}){const o=document.createElement("style");o.type="text/css",o.id=`Click_${b()}`,o.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(o),this.elementsSelectors.push(`#${o.id}`);const r=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),i=["click",({target:e})=>r(e)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(i),document.addEventListener(...i),e}onExitIntent({promise:e,resolve:t}){const o=["mouseleave",async({clientY:e})=>{e<=0&&t(!0)},{passive:!0}],r=S("body",e=>{e.addEventListener(...o),this.eventsListeners.push([e,...o]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==r)});return this.elementsWaiters.push(r),e}onReengage({promise:e,resolve:t}){const o=this.delay;let r=o;const i=[()=>(r=o,r),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...i),this.eventsListeners.push([e,...i])});const s=setInterval(()=>{r<=0?t(!0):r-=100},100);return this.intervals.push(s),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:o}=DATA;return new Function(`return new Promise(async resolve => {${o}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:t}){const r=i(),s=o(),{viewInterval:n,triggerSocialProofMinPurchases:a,spNoTrim:l}=DATA;if(r||(f("Not able to find ABTastyProductKey, impossible to call the API."),t(!1)),r&&s){fetch(`${u}${s}/metrics/i?key=${r}${l?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===n||void 0===a)return!1;const t=e[n]&&e[n]>=a;return t||f(`Widget will not be shown, product has been purchased ${e[n]} times while ${a} are required`),t})(e)&&t(e[n])).catch(()=>f("Failed to fetch datas from server."))}else t(!1);return e}getSocialProofPageViews({promise:e,resolve:t}){const r=encodeURIComponent(`${window.location.pathname}`),i=o(),{viewInterval:s,triggerSocialProofMinPageViews:n}=DATA;if(r&&i){fetch(`${u}${i}/metrics/pv?key=${r}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===s||void 0===n)return!1;const t=e[s]&&e[s]>=n;return t||f(`Widget will not be shown, page has been seen ${e[s]} times while ${n} are required`),t})(e)&&t(e[s])).catch(()=>f("Failed to fetch datas from server."))}else t(!1);return e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...o]="string"==typeof e[0]?[document,...e]:e;t&&o.length>1&&t.removeEventListener(...o)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=b();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=E(this.event);this.promises.push(e);const t={direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),socialProofPurchases:()=>this.getSocialProofPurchases(e),socialProofPageViews:()=>this.getSocialProofPageViews(e)},o=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();this.clear();return"reengage"!==this.event&&this.delay?o&&await(async()=>{const e=E(`${this.event}Delay`);return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():o}}class k{constructor(e,t,o){this.recurrence=e,this.isWidgetApplied=t,this.callback=o,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=s(),{type:o}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},r=()=>e&&"display"===o||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&r()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&r())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=s();return[250,500].forEach(t=>setTimeout(()=>500===t&&s()===e?this:(e=s(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),o=e.some(({addedNodes:e})=>e&&e.length);return t||o?(this.decisionHandler(!0),this):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=S("body",e=>{const o=[e,{childList:!0,subtree:!0}];this.observer.observe(...o),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class O{constructor(){this.children=void 0,this.uniqueId=b(),this.widgetName=m(),this.prettyName=y(),this.recurrenceParams=_(),this.triggerParams=v(),this.recurrence=!!this.recurrenceParams&&new I(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new P(this.triggerParams),this.pageWatcher=new k(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=w(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){const e=(e,t,o)=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),f(e),o(e)},t=new Promise((t,o)=>{const r=S("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==r),t(e.appendChild(this.styleElement))},t=>e(t,r,o));this.elementsWaiters.push(r)}),o=new Promise((t,o)=>{const{layout:r,elementReferrer:i,referrerInsertType:s}=DATA,{selector:n,position:a}="string"==typeof r&&"free"===r&&"string"==typeof i&&"string"==typeof s?{selector:i,position:s}:{selector:"body",position:"beforeend"},l=S(n,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==l),this.removeOldDomElement(),t(e.insertAdjacentElement(a,this.domElement))},t=>e(t,l,o));this.elementsWaiters.push(l)});return Promise.all([o,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return this.hasBeenShown||e()||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!e()&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!e()&&!s())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const o=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!o)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const r=e()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!r&&(await this.insert(),this.addCloseEvent(),e()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(r),{container:this,response:r})}onPageChange(e,t){const o=()=>this.init().then(({response:e})=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):o()}}addCloseEvent(...e){const{closeButton:t,overlayClickable:o,layout:r}=DATA,i=[];if(void 0!==o&&o&&void 0!==r&&"popin"===r&&i.push(`.${this.overlayClassName}`),void 0!==t&&t&&i.push(`.${this.closeButtonClassName}`),!i.length)return this;const s=this.domElement.querySelectorAll(i.join(", "));return s.length?(e.push(...s),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:t,layout:o}=DATA,r=document.createElement("div");return r.className=`${this.basicClassName} ${this.hideClassName}`,r.id=this.widgetContainerId,r.innerHTML=`\n\t\t\t${void 0!==o&&"popin"===o?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t${t?`<button class="${this.closeButtonClassName}" ${e()?"data-abtasty-actionnable":""}><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,r}getStyleTag(t=""){const{noStyles:o,layout:r}=DATA,{backgroundColor:i,backgroundImage:s,borderColor:n,borderRadius:a,borderWidth:l,textColor:c,textAlign:d,overlayColor:g,dropShadow:p,dropShadowColor:u,dropShadowBlur:m,containerMargin:y,containerPadding:b,closeButton:_,buttonsBorderWidth:v,buttonsBorderColor:w,buttonsBorderRadius:x,buttonsBackgroundColor:f,buttonsTextColor:T}=o?{}:DATA,E=document.createElement("style");E.type="text/css",e()&&E.setAttribute("abtasty-script-added","true");const S=`background-color: ${void 0!==i?i:h};`,A=void 0!==s?`background-image: url(${s});`:"",C=void 0!==a?`border-radius: ${a}px;`:"",$=void 0!==l&&l?`border-width: ${l}px; border-style: solid;`:"",N=[n,l].every(e=>void 0!==e)&&l?`border-color: ${n};`:"",I=void 0!==c?`color: ${c}; fill: ${c};`:"",R=void 0!==d?`text-align: ${d};`:"",P=void 0!==p&&p?`box-shadow: 0 5px ${m}px 0 ${u};`:"",k=y instanceof Array&&1===y.length&&y[0],O=k?`margin: ${k.top}px ${k.right}px ${k.bottom}px ${k.left}px;`:"",B=k?`margin: calc(${k.top}px * 0.5) calc(${k.right}px * 0.5) calc(${k.bottom}px * 0.5) calc(${k.left}px * 0.5);`:"",L=b instanceof Array&&1===b.length&&b[0],W=L?`padding: ${L.top}px ${L.right}px ${L.bottom}px ${L.left}px;`:"",D=L?`padding: calc(${L.top}px * 0.5) calc(${L.right}px * 0.5) calc(${L.bottom}px * 0.5) calc(${L.left}px * 0.5);`:"",F=void 0!==v&&v?`border-width: ${v}px; border-style: solid;`:"",V=[w,v].every(e=>void 0!==e)&&v?`border-color: ${w};`:"",G=void 0!==x?`border-radius: ${x}px;`:"",q=void 0!==f?`background-color: ${f};`:"",U=void 0!==T?`color: ${T};`:"",M=void 0!==r&&"popin"===r?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==g?g:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",H=o||void 0!==_&&_?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",I,"}"].join(""):"";return E.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,S,A,C,$,N,I,R,P,O,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;",W,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,F,V,G,q,U,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,B,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,D,"}","}",M,H,`${t}`].join(""),E}}class B extends O{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class L extends O{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class W extends O{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const D=[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],F={category:l,type:c,min:1},V=[{...F,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...F,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...F,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],G={category:l,type:"select",options:D,value:"everytime"},q={...G,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},U=V.map(e=>({...e,propName:`${q.propName}_${e.propName}`,conditions:[{field:q.propName,value:e.propName}]})),M={...G,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},H=V.map(e=>({...e,propName:`${M.propName}_${e.propName}`,conditions:[{field:M.propName,value:e.propName}]})),j={...G,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},Y=V.map(e=>({...e,propName:`${j.propName}_${e.propName}`,conditions:[{field:j.propName,value:e.propName}]})),K={category:l,type:d,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[q,...U,M,...H,j,...Y]},X={category:l,type:c,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},z={...X,propName:"triggerEventReengageDelay",value:10,max:180},J={category:l,type:"selectelement",propName:"triggerEventClick",value:"body"},Q={...J,propName:"triggerEventElementVisible"},Z={category:l,type:"textarea",label:"widget_common_conditions_triggering_option_customTrigger",propName:"triggerEventCustomScript",value:"/* In this example snippet, the widget will be triggered as soon as any scroll is detected.\nCreate your own by resolving resolve() with true (which does trigger) or false (which doesn't trigger) */\n\nfunction launchIfScroll() {\n\treturn new Promise(resolve => {\n\t\tdocument.addEventListener('scroll', () => resolve(true), {once: true});\n\t});\n}\n\nconst result = await launchIfScroll();\nreturn resolve(result);",rows:15},ee={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},te={category:l,type:"switch",propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},oe={category:l,type:"switch",propName:"autoHide",value:!0,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterRedirection"},re={category:l,type:c,propName:"timeHide",value:2,max:120,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterXSeconds",conditions:[{field:"autoHide",value:!0}]},ie={category:l,type:"select",label:"widget_common_conditions_triggering_label",options:Object.keys(ee).map(e=>ee[e]),propName:"triggerEvent",value:"pageLoad"};J.conditions=[{field:"triggerEvent",value:"click"}],z.conditions=[{field:"triggerEvent",value:"reengage"}],Q.conditions=[{field:"triggerEvent",value:"elementVisible"}],Z.conditions=[{field:"triggerEvent",value:"script"}],X.conditions=[{field:"triggerEvent",value:e=>"reengage"!==e}],te.conditions=[{field:"triggerEvent",value:e=>"click"===e||"script"===e}];const se=[J,Q,Z,te,z,X],ne={category:l,type:d,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[ie,...se]};const ae={category:"content",propName:"button",type:"switch",value:!1,label:"widget_common_content_toggler_label_displayButton"},le={category:"content",propName:"buttonText",type:"text",label:"widget_common_content_label_buttonText",value:"widget_common_content_buttonText_default"},ce={category:"content",propName:"buttonLink",type:"text",label:"widget_common_content_label_buttonUrl",value:location.origin,conditions:[{field:"button"}]},de={category:"content",propName:"buttonTargetType",type:"switch",label:"widget_common_content_button_label_openLinkNewTab",value:!1,conditions:[{field:"button"}]},ge=[{field:"button"}];le.conditions=ge,ce.conditions=ge,de.conditions=ge;const he={category:"content",type:d,label:"widget_common_tabName_content",collapsible:!1,children:[ae,le,ce,de]},pe={category:"layout",type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:`${g}layout/icon-layout-modal.png`},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:`${g}layout/icon-layout-topBanner.png`},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:`${g}layout/icon-layout-bottomBanner.png`},{label:"widget_common_layout_option_freePlacement",value:"free",src:`${g}layout/icon-layout-freePlacement.png`}]},ue={category:"layout",type:"selectelement",propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},me={category:"layout",type:"radio",propName:"referrerInsertType",value:"afterbegin",label:"widget_common_layout_positioning_label_selectPosition",options:[{label:"widget_common_layout_positioning_option_before",value:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheBeginning",value:"afterbegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},ye=[{field:"layout",value:"free"}];ue.conditions=ye,me.conditions=ye;const be={category:"layout",type:d,label:"widget_common_tabName_layout",collapsible:!0,children:[pe,ue,me]},_e={category:a,type:"colorpicker",label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:p},ve={category:a,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:""},we={category:a,type:"colorpicker",label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},xe={category:a,type:c,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},fe={category:a,type:c,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},Te={category:a,type:"colorpicker",label:"widget_common_style_text_label_textColor",propName:"textColor",value:"rgba(57, 57, 57, 1)"},Ee={category:a,type:"radioImage",label:"widget_common_style_text_label_textAlignment",propName:"textAlign",value:"center",style:"little",options:[{label:"widget_common_style_text_textAlignment_option_left",value:"left",src:`${g}style/icon-text-alignLeft.png`},{label:"widget_common_style_text_textAlignment_option_center",value:"center",src:`${g}style/icon-text-alignCenter.png`},{label:"widget_common_style_text_textAlignment_option_right",value:"right",src:`${g}style/icon-text-alignRight.png`}]},Se={category:a,type:"areainput"},Ae={...Se,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},Ce={...Se,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},$e={category:a,type:"switch",label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},Ne={category:a,type:"colorpicker",label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},Ie={category:a,type:c,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},Re={category:a,type:"switch",label:"widget_common_style_container_label_displayCloseButton",propName:"closeButton",value:!0},Pe={category:a,type:"colorpicker",label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},ke={category:a,type:"switch",label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},Oe={category:a,type:c,label:"widget_common_style_buttons_label_buttonBorderThickness",propName:"buttonsBorderWidth",value:1,min:0,max:30,unit:"px"},Be={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBorderColor",propName:"buttonsBorderColor",value:"rgba(87, 184, 199, 1)"},Le={category:a,type:c,label:"widget_common_style_buttons_label_buttonBorderRadius",propName:"buttonsBorderRadius",value:4,min:0,max:30,unit:"px"},We={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBackgroundColor",propName:"buttonsBackgroundColor",value:"rgba(0, 127, 145, 1)"},De={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonTextColor",propName:"buttonsTextColor",value:p},Fe={category:a,type:d,label:"widget_stickyElement_content_positionOn_option_background",collapsible:!0,children:[_e,ve]},Ve=[{field:fe.propName,value:e=>e>0}];we.conditions=Ve;const Ge={category:a,type:d,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[fe,we,xe]},qe={category:a,type:d,label:"widget_common_style_blockTitle_text",collapsible:!0,children:[Ee,Te]},Ue=[{field:"dropShadow",value:!0}];Ne.conditions=Ue,Ie.conditions=Ue;const Me={category:a,type:d,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[Ae,Ce,_e,$e,Ne,Ie,Re]},He={category:a,type:d,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[Pe,ke],conditions:[{field:"layout",value:"popin"}]},je=[{field:Oe.propName,value:e=>e>0}];Be.conditions=je;const Ye={category:a,type:d,label:"widget_common_style_blockTitle_buttons",collapsible:!0,children:[Oe,Be,Le,We,De]};exports.ABTASTY_IMAGES_ROUTE=g,exports.AREAINPUT="areainput",exports.BLACK="rgba(0, 0, 0, 1)",exports.Banner=L,exports.CHECKBOX="checkbox",exports.COLOR_PICKER="colorpicker",exports.CONDITIONS=l,exports.CONTENT="content",exports.DARK_GRAY="rgba(57, 57, 57, 1)",exports.DARK_TURQUOISE="rgba(0, 127, 145, 1)",exports.DATE_PICKER="datepicker",exports.DATE_RANGE_PICKER="dateRangePicker",exports.Free=W,exports.GROUP=d,exports.HIDDEN="hidden",exports.INLINE_NOTIFICATION="inlinenotification",exports.LAYOUT="layout",exports.LIGHT_GREY=p,exports.LIGHT_TURQUOISE="rgba(87, 184, 199, 1)",exports.MEDIA_UPLOAD="mediaupload",exports.NUMBER="number",exports.PARAGRAPH="paragraph",exports.PageWatcher=k,exports.Popin=B,exports.RADIO_BUTTON="radio",exports.RADIO_IMAGE="radioImage",exports.REBUILD_WIDGET="rebuild",exports.REMOVE_WIDGET="remove",exports.Recurrence=I,exports.SELECT="select",exports.SELECT_ELEMENT="selectelement",exports.SEPARATOR="separator",exports.SHORT_SEPARATOR="short-separator",exports.SLIDER=c,exports.SOCIAL_PROOF_API_BASE=u,exports.STYLE=a,exports.SWITCH="switch",exports.TAG_RESET_EVENT="abtasty_resetActionTracking",exports.TASTY_GREEN="rgba(28, 191, 151, 1)",exports.TASTY_RED="rgba(213, 64, 64, 1)",exports.TASTY_YELLOW="rgba(224, 185, 10, 1)",exports.TEXT_AREA="textarea",exports.TEXT_FIELD="text",exports.TIME_PICKER="timepicker",exports.Trigger=P,exports.URL_FIELD="url",exports.VARIABLES_INPUT="variablesinput",exports.WHITE=h,exports.WYSIWYG="wysiwyg",exports.WidgetContainer=O,exports.addGlobalUtil=t,exports.addPolyfill=N,exports.allowGlobalScroll=function(){S("body",()=>{const{body:e}=document;C&&(e.style.overflowY=C)},e=>x(e))},exports.asyncRequest=function(e,t){return new Promise((o,r)=>{const i=new XMLHttpRequest;i.open(e,t,!0),i.onload=function(){this.status>=200&&this.status<300?o(i.response):r({status:this.status,statusText:i.statusText})},i.onerror=function(){r({status:this.status,statusText:i.statusText})},i.send()})},exports.autoHideForm=oe,exports.backgroundColorForm=_e,exports.backgroundImageForm=ve,exports.backgroundsGroup=Fe,exports.borderColorForm=we,exports.borderRadiusForm=xe,exports.borderWidthForm=fe,exports.bordersGroup=Ge,exports.buttonLinkForm=ce,exports.buttonLinkGroup=he,exports.buttonTargetTypeForm=de,exports.buttonTextForm=le,exports.buttonsBackgroundColorForm=We,exports.buttonsBorderColorForm=Be,exports.buttonsBorderRadiusForm=Le,exports.buttonsBorderWidthForm=Oe,exports.buttonsGroup=Ye,exports.buttonsTextColorForm=De,exports.closingRecurrenceForm=M,exports.containerGroup=Me,exports.displayCloseButtonSwitchForm=Re,exports.displayRecurrenceForm=q,exports.dropShadowBlurForm=Ie,exports.dropShadowColorForm=Ne,exports.dropShadowSwitchForm=$e,exports.elementReferrerForm=ue,exports.findParent=A,exports.getAccountIdentifier=o,exports.getCookie=e=>{const t=`${e}=`,o=document.cookie.split(";");for(let e=0;e<o.length;e+=1){let r=o[e];for(;" "===r.charAt(0);)r=r.substring(1);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return""},exports.getCustomTriggersGroup=function(e){const t=e.reduce((e,t)=>[...e,ee[t]],[]),o=se.reduce((t,o)=>{const{conditions:r}=o;return r&&r.some(({value:t})=>e.includes(t))?[...t,o]:t},[]),r={...ie,options:t,value:e[0]};return{category:l,type:d,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[r,...o]}},exports.getGroupSettedValues=(e,t)=>{if("object"!=typeof t)return e;const{type:o,children:r}=e,i=Object.keys(t);if(!i.length)return e;if("object"!=typeof e||!o||"group"!==o||!r||!Array.isArray(r)||Array.isArray(r)&&!r.length)return{};const s=r.map(e=>{const{propName:o,value:r}=e;return i.includes(o)&&typeof r==typeof t[o]?{...e,value:t[o]}:e});return{...e,children:s}},exports.getHostname=T,exports.getPrettyWidgetName=y,exports.getProductKey=i,exports.getRecurrenceParams=_,exports.getTriggerParams=v,exports.getUniqueId=b,exports.getVisitorId=()=>window.ABTasty&&window.ABTasty.visitor?window.ABTasty.visitor.id:void 0,exports.getWidgetContainer=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new B;break;case"bannerTop":case"bannerBottom":t=new L;break;case"free":t=new W;break;default:t=new O}return t},exports.getWidgetName=m,exports.isAffected=s,exports.isInQaMode=n,exports.isOnEditor=e,exports.isOnPreview=r,exports.isTouch=()=>void 0!==window.ontouchstart,exports.isTriggerOncePerPage=w,exports.layoutGroup=be,exports.layoutsForm=pe,exports.loadImage=e=>new Promise((t,o)=>{const r=new Image;r.onload=()=>{t(r)},r.src=e,r.onerror=()=>{const t=new Error(`Image ${e} is not loaded.`);return o(t)}}),exports.loadJS=$,exports.log=x,exports.marginForm=Ae,exports.olverlayCloseOnClickForm=ke,exports.overlayColorForm=Pe,exports.overlayGroup=He,exports.paddingForm=Ce,exports.preventGlobalScroll=function(){S("body",()=>{const{body:e}=document;C=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"},e=>x(e))},exports.promiseDeferrer=E,exports.recurrencesGroup=K,exports.referrerInsertTypeForm=me,exports.setCookie=(e,t,o)=>{let r="";if(o){const e=new Date;e.setTime(e.getTime()+24*o*60*60*1e3),r=`expires=${e.toUTCString()}`}const i=`domain=${T()}`;document.cookie=`${e}=${t}; ${r};${i};path=/`},exports.switchButtonForm=ae,exports.syncRequest=function(e,t){const o=new XMLHttpRequest;return o.open(e,t,!1),o.send(null),o},exports.textAlignmentForm=Ee,exports.textColorForm=Te,exports.textGroup=qe,exports.timeHideForm=re,exports.triggerDelay=X,exports.triggerEventCustomScript=Z,exports.triggerEventElementVisible=Q,exports.triggerEventReengageDelay=z,exports.triggerOncePerPage=te,exports.triggersForm=ie,exports.triggersGroup=ne,exports.triggersOptions=ee,exports.validationRecurrenceForm=j,exports.waitForElement=S,exports.widgetLog=f;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");function t(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}const o=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},r=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},i=()=>window.ABTastyProductKey,s=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID]||r(),n=()=>{if(e())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0},a="style",l="conditions",c="slider",d="group",g="https://widgets-images.abtasty.com/",h="rgba(255, 255, 255, 1)",p="rgba(247, 247, 247, 1)",u="https://social-proof-api.abtasty.com/clients/",m=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},y=()=>{const e=m();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},b=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,_=()=>{const{displayRecurrence:t,closingRecurrence:o,validationRecurrence:r}=DATA;if(e()||!t&&!o&&!r)return!1;const i={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},s={};return t&&(s.displayRecurrence=i[t]("displayRecurrence")),o&&(s.closingRecurrence=i[o]("closingRecurrence")),r&&(s.validationRecurrence=i[r]("validationRecurrence")),s},v=()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:o,triggerEventReengageDelay:r,socialProofContentType:i,triggerEventElementVisible:s,triggerEventDelay:n}=DATA;if(e()||!t&&!i)return!1;const a={click:()=>o,elementVisible:()=>s},l=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",c="reengage"===t?r:n;return i&&(t=1===i?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:l,triggerDelay:c}},w=()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!(!e||!["click","script"].includes(t))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(e=>e===t)},x=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},f=e=>{if(n()){const t=y();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${e}`,`background-color: rgba(0, 127, 145, 1); color: ${p}`)}},T=()=>{let e=document.location.hostname.split("").reverse().join("");if(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9-]+(?:\.|$)/i),null===e)e=document.location.hostname;else{"."!==e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join("")}return e},E=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,o)=>{t.resolve=e,t.reject=o}),t},S=(e,t,o)=>{let r=0,i=0;try{document.querySelector(e)}catch(t){const r=`Selector «${e}» not valid.`;return x(r),"function"==typeof o&&o(r)}function s(){clearInterval(i),clearTimeout(r)}return r=setTimeout(()=>{s();const t=`Can't find element «${e}».`;return x(t),"function"==typeof o&&o(t)},1e4),i=setInterval(()=>{const o=document.querySelector(e);return null!==o?(s(),"function"==typeof t&&t(o)):o},200),{clear:s}};function A(e,t){return t(e)||!e.parentElement?e:A(e.parentElement,t)}let C;function $(e){return new Promise((t,o)=>{const r=window.document.getElementsByTagName("script")[0],i=window.document.createElement("script");i.src=e,r.parentNode.insertBefore(i,r),i.onload=t,i.onerror=o})}async function N(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||$("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:t=!0}return t}class I{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:o},r){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(o),this.onSetCallback=r,this.widgetName=m(),this.uniqueId=b(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:o,...r}=t;return Object.entries(r).length?(e.setItem("ABTastyWidgets",JSON.stringify(r)),r):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const o=this.getTypeOfStorage(e);if(!o&&"object"!=typeof o)return!1;const{storageString:r,storageMethod:i}=o,s=this.getStamp(e),n={type:t,stamp:s},{type:a}=this.getCurrentRecurrence(),l=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let o;"session"===r?e?o=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),o=this.getSessionRecurrenceStorageParsed()):"local"===r&&(t?o=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),o=this.getLocalRecurrenceStorageParsed()));const s=o?{[this.recurrenceKey]:n,...o}:{[this.recurrenceKey]:n};i.setItem("ABTastyWidgets",JSON.stringify(s)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!i)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)l();else{if("display"!==t||"validation"===a||"closing"===a)return!1;l()}else l();return s}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class R{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this)),t=()=>e.observe(document.body,{attributes:!0,childList:!0,subtree:!0});return document.body?t():S("body",t),e}onMouseOver({target:e,path:t}){const o=this.inViewportTargets.find(({element:o,selector:r})=>{if(o.isSameNode(e))return!0;const i=[...e.querySelectorAll(r)];if(i.length){if(i.includes(o))return!0}if(t.includes(o))return!0;const s=[...e.parentElement.children],n=s.findIndex(t=>t.isSameNode(e)),a=s.filter((e,t)=>t>n);if(a.length){if(a.includes(o))return!0;if(a.some(e=>[...e.querySelectorAll(r)].includes(o)))return!0}return!1});if(o&&this.isElementVisible(o.element)){const{selector:e,element:t,uniqueId:r}=o,i=this.targets.find(t=>t.selector===e&&t.uniqueId===r);i&&i.resolve(t),this.clear(e,r)}}mouseOverHandler(){const e=["mouseover",e=>setTimeout(()=>this.onMouseOver(e),50),!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===A(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),o=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let r=!1,i=0;for(;!r&&i<o.length;){const t=document.elementFromPoint(...o[i]);r=e===t||e.contains(t),i+=1}return r}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const o=document.querySelector(e);o&&!this.existingTargets.find(e=>e.element===o&&e.uniqueId===t)&&(this.existingTargets.push({element:o,selector:e,uniqueId:t}),this.visibilityObserver.observe(o))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:o})=>{if(t.matches(e)&&this.isElementVisible(t)){const r=this.targets.find(t=>t.selector===e&&t.uniqueId===o);return r&&r.resolve(t),this.clear(e,o),!1}return!0})}watch(e,t,o){this.targets.push({selector:e,resolve:t,uniqueId:o}),this.startMutationObserver(),this.checkElements()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(o=>o.filter(({selector:o,uniqueId:r})=>o!==e&&r!==t)),this.visibilityObserver.unobserve(document.querySelector(e)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class P{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:o}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*o,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:o}){const r=E(`${this.event}DomReady`);this.promises.push(r);const i=await this.onPageLoad(r),s=await N("IntersectionObserver"),n=t("VisibilityObserver",R);if(this.visibilityObservers.push(n),s&&i){const e=b();n.watch(this.selector,o,e)}return e}onPageLoad({promise:e,resolve:t}){const o=()=>"complete"===document.readyState;if(!o()){const e=["readystatechange",()=>o()&&t(!0),{passive:!0}];this.eventsListeners.push(e),document.addEventListener(...e)}return t(!0),e}onClick({promise:e,resolve:t}){const o=document.createElement("style");o.type="text/css",o.id=`Click_${b()}`,o.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(o),this.elementsSelectors.push(`#${o.id}`);const r=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),i=["click",({target:e})=>r(e)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(i),document.addEventListener(...i),e}onExitIntent({promise:e,resolve:t}){const o=["mouseleave",async({clientY:e})=>{e<=0&&t(!0)},{passive:!0}],r=S("body",e=>{e.addEventListener(...o),this.eventsListeners.push([e,...o]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==r)});return this.elementsWaiters.push(r),e}onReengage({promise:e,resolve:t}){const o=this.delay;let r=o;const i=[()=>(r=o,r),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...i),this.eventsListeners.push([e,...i])});const s=setInterval(()=>{r<=0?t(!0):r-=100},100);return this.intervals.push(s),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:o}=DATA;return new Function(`return new Promise(async resolve => {${o}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:t}){const r=i(),s=o(),{viewInterval:n,triggerSocialProofMinPurchases:a,spNoTrim:l}=DATA;if(r||(f("Not able to find ABTastyProductKey, impossible to call the API."),t(!1)),r&&s){fetch(`${u}${s}/metrics/i?key=${r}${l?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===n||void 0===a)return!1;const t=e[n]&&e[n]>=a;return t||f(`Widget will not be shown, product has been purchased ${e[n]} times while ${a} are required`),t})(e)&&t(e[n])).catch(()=>f("Failed to fetch datas from server."))}else t(!1);return e}getSocialProofPageViews({promise:e,resolve:t}){const r=encodeURIComponent(`${window.location.pathname}`),i=o(),{viewInterval:s,triggerSocialProofMinPageViews:n}=DATA;if(r&&i){fetch(`${u}${i}/metrics/pv?key=${r}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===s||void 0===n)return!1;const t=e[s]&&e[s]>=n;return t||f(`Widget will not be shown, page has been seen ${e[s]} times while ${n} are required`),t})(e)&&t(e[s])).catch(()=>f("Failed to fetch datas from server."))}else t(!1);return e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...o]="string"==typeof e[0]?[document,...e]:e;t&&o.length>1&&t.removeEventListener(...o)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=b();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=E(this.event);this.promises.push(e);const t={direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),socialProofPurchases:()=>this.getSocialProofPurchases(e),socialProofPageViews:()=>this.getSocialProofPageViews(e)},o=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();this.clear();return"reengage"!==this.event&&this.delay?o&&await(async()=>{const e=E(`${this.event}Delay`);return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():o}}class k{constructor(e,t,o){this.recurrence=e,this.isWidgetApplied=t,this.callback=o,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=s(),{type:o}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},r=()=>e&&"display"===o||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&r()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&r())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=s();return[250,500].forEach(t=>setTimeout(()=>500===t&&s()===e?this:(e=s(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),o=e.some(({addedNodes:e})=>e&&e.length);return t||o?(this.decisionHandler(!0),this):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=S("body",e=>{const o=[e,{childList:!0,subtree:!0}];this.observer.observe(...o),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class O{constructor(){this.children=void 0,this.uniqueId=b(),this.widgetName=m(),this.prettyName=y(),this.recurrenceParams=_(),this.triggerParams=v(),this.recurrence=!!this.recurrenceParams&&new I(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new P(this.triggerParams),this.pageWatcher=new k(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=w(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){const e=(e,t,o)=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),f(e),o(e)},t=new Promise((t,o)=>{const r=S("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==r),t(e.appendChild(this.styleElement))},t=>e(t,r,o));this.elementsWaiters.push(r)}),o=new Promise((t,o)=>{const{layout:r,elementReferrer:i,referrerInsertType:s}=DATA,{selector:n,position:a}="string"==typeof r&&"free"===r&&"string"==typeof i&&"string"==typeof s?{selector:i,position:s}:{selector:"body",position:"beforeend"},l=S(n,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==l),this.removeOldDomElement(),t(e.insertAdjacentElement(a,this.domElement))},t=>e(t,l,o));this.elementsWaiters.push(l)});return Promise.all([o,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return this.hasBeenShown||e()||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!e()&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!e()&&!s())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const o=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!o)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const r=e()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!r&&(await this.insert(),this.addCloseEvent(),e()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(r),{container:this,response:r})}onPageChange(e,t){const o=()=>this.init().then(({response:e})=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):o()}}addCloseEvent(...e){const{closeButton:t,overlayClickable:o,layout:r}=DATA,i=[];if(void 0!==o&&o&&void 0!==r&&"popin"===r&&i.push(`.${this.overlayClassName}`),void 0!==t&&t&&i.push(`.${this.closeButtonClassName}`),!i.length)return this;const s=this.domElement.querySelectorAll(i.join(", "));return s.length?(e.push(...s),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:t,layout:o}=DATA,r=document.createElement("div");return r.className=`${this.basicClassName} ${this.hideClassName}`,r.id=this.widgetContainerId,r.innerHTML=`\n\t\t\t${void 0!==o&&"popin"===o?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t${t?`<button class="${this.closeButtonClassName}" ${e()?"data-abtasty-actionnable":""}><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,r}getStyleTag(t=""){const{noStyles:o,layout:r}=DATA,{backgroundColor:i,backgroundImage:s,borderColor:n,borderRadius:a,borderWidth:l,textColor:c,textAlign:d,overlayColor:g,dropShadow:p,dropShadowColor:u,dropShadowBlur:m,containerMargin:y,containerPadding:b,closeButton:_,buttonsBorderWidth:v,buttonsBorderColor:w,buttonsBorderRadius:x,buttonsBackgroundColor:f,buttonsTextColor:T}=o?{}:DATA,E=document.createElement("style");E.type="text/css",e()&&E.setAttribute("abtasty-script-added","true");const S=`background-color: ${void 0!==i?i:h};`,A=void 0!==s?`background-image: url(${s});`:"",C=void 0!==a?`border-radius: ${a}px;`:"",$=void 0!==l&&l?`border-width: ${l}px; border-style: solid;`:"",N=[n,l].every(e=>void 0!==e)&&l?`border-color: ${n};`:"",I=void 0!==c?`color: ${c}; fill: ${c};`:"",R=void 0!==d?`text-align: ${d};`:"",P=void 0!==p&&p?`box-shadow: 0 5px ${m}px 0 ${u};`:"",k=y instanceof Array&&1===y.length&&y[0],O=k?`margin: ${k.top}px ${k.right}px ${k.bottom}px ${k.left}px;`:"",B=k?`margin: calc(${k.top}px * 0.5) calc(${k.right}px * 0.5) calc(${k.bottom}px * 0.5) calc(${k.left}px * 0.5);`:"",L=b instanceof Array&&1===b.length&&b[0],W=L?`padding: ${L.top}px ${L.right}px ${L.bottom}px ${L.left}px;`:"",D=L?`padding: calc(${L.top}px * 0.5) calc(${L.right}px * 0.5) calc(${L.bottom}px * 0.5) calc(${L.left}px * 0.5);`:"",F=void 0!==v&&v?`border-width: ${v}px; border-style: solid;`:"",V=[w,v].every(e=>void 0!==e)&&v?`border-color: ${w};`:"",G=void 0!==x?`border-radius: ${x}px;`:"",q=void 0!==f?`background-color: ${f};`:"",U=void 0!==T?`color: ${T};`:"",M=void 0!==r&&"popin"===r?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==g?g:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",H=o||void 0!==_&&_?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",I,"}"].join(""):"";return E.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,S,A,C,$,N,I,R,P,O,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;",W,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,F,V,G,q,U,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,B,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,D,"}","}",M,H,`${t}`].join(""),E}}class B extends O{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class L extends O{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class W extends O{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const D=[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],F={category:l,type:c,min:1},V=[{...F,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...F,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...F,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],G={category:l,type:"select",options:D,value:"everytime"},q={...G,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},U=V.map(e=>({...e,propName:`${q.propName}_${e.propName}`,conditions:[{field:q.propName,value:e.propName}]})),M={...G,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},H=V.map(e=>({...e,propName:`${M.propName}_${e.propName}`,conditions:[{field:M.propName,value:e.propName}]})),j={...G,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},Y=V.map(e=>({...e,propName:`${j.propName}_${e.propName}`,conditions:[{field:j.propName,value:e.propName}]})),K={category:l,type:d,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[q,...U,M,...H,j,...Y]},X={category:l,type:c,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},z={...X,propName:"triggerEventReengageDelay",value:10,max:180},J={category:l,type:"selectelement",propName:"triggerEventClick",value:"body"},Q={...J,propName:"triggerEventElementVisible"},Z={category:l,type:"textarea",label:"widget_common_conditions_triggering_option_customTrigger",propName:"triggerEventCustomScript",value:"/* In this example snippet, the widget will be triggered as soon as any scroll is detected.\nCreate your own by resolving resolve() with true (which does trigger) or false (which doesn't trigger) */\n\nfunction launchIfScroll() {\n\treturn new Promise(resolve => {\n\t\tdocument.addEventListener('scroll', () => resolve(true), {once: true});\n\t});\n}\n\nconst result = await launchIfScroll();\nreturn resolve(result);",rows:15},ee={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},te={category:l,type:"switch",propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},oe={category:l,type:"switch",propName:"autoHide",value:!0,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterRedirection"},re={category:l,type:c,propName:"timeHide",value:2,max:120,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterXSeconds",conditions:[{field:"autoHide",value:!0}]},ie={category:l,type:"select",label:"widget_common_conditions_triggering_label",options:Object.keys(ee).map(e=>ee[e]),propName:"triggerEvent",value:"pageLoad"};J.conditions=[{field:"triggerEvent",value:"click"}],z.conditions=[{field:"triggerEvent",value:"reengage"}],Q.conditions=[{field:"triggerEvent",value:"elementVisible"}],Z.conditions=[{field:"triggerEvent",value:"script"}],X.conditions=[{field:"triggerEvent",value:e=>"reengage"!==e}],te.conditions=[{field:"triggerEvent",value:e=>"click"===e||"script"===e}];const se=[J,Q,Z,te,z,X],ne={category:l,type:d,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[ie,...se]};const ae={category:"content",propName:"button",type:"switch",value:!1,label:"widget_common_content_toggler_label_displayButton"},le={category:"content",propName:"buttonText",type:"text",label:"widget_common_content_label_buttonText",value:"widget_common_content_buttonText_default"},ce={category:"content",propName:"buttonLink",type:"text",label:"widget_common_content_label_buttonUrl",value:location.origin,conditions:[{field:"button"}]},de={category:"content",propName:"buttonTargetType",type:"switch",label:"widget_common_content_button_label_openLinkNewTab",value:!1,conditions:[{field:"button"}]},ge=[{field:"button"}];le.conditions=ge,ce.conditions=ge,de.conditions=ge;const he={category:"content",type:d,label:"widget_common_tabName_content",collapsible:!1,children:[ae,le,ce,de]},pe={category:"layout",type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:`${g}layout/icon-layout-modal.png`},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:`${g}layout/icon-layout-topBanner.png`},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:`${g}layout/icon-layout-bottomBanner.png`},{label:"widget_common_layout_option_freePlacement",value:"free",src:`${g}layout/icon-layout-freePlacement.png`}]},ue={category:"layout",type:"selectelement",propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},me={category:"layout",type:"radio",propName:"referrerInsertType",value:"afterbegin",label:"widget_common_layout_positioning_label_selectPosition",options:[{label:"widget_common_layout_positioning_option_before",value:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheBeginning",value:"afterbegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},ye=[{field:"layout",value:"free"}];ue.conditions=ye,me.conditions=ye;const be={category:"layout",type:d,label:"widget_common_tabName_layout",collapsible:!0,children:[pe,ue,me]},_e={category:a,type:"colorpicker",label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:p},ve={category:a,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:""},we={category:a,type:"colorpicker",label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},xe={category:a,type:c,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},fe={category:a,type:c,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},Te={category:a,type:"colorpicker",label:"widget_common_style_text_label_textColor",propName:"textColor",value:"rgba(57, 57, 57, 1)"},Ee={category:a,type:"radioImage",label:"widget_common_style_text_label_textAlignment",propName:"textAlign",value:"center",style:"little",options:[{label:"widget_common_style_text_textAlignment_option_left",value:"left",src:`${g}style/icon-text-alignLeft.png`},{label:"widget_common_style_text_textAlignment_option_center",value:"center",src:`${g}style/icon-text-alignCenter.png`},{label:"widget_common_style_text_textAlignment_option_right",value:"right",src:`${g}style/icon-text-alignRight.png`}]},Se={category:a,type:"areainput"},Ae={...Se,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},Ce={...Se,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},$e={category:a,type:"switch",label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},Ne={category:a,type:"colorpicker",label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},Ie={category:a,type:c,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},Re={category:a,type:"switch",label:"widget_common_style_container_label_displayCloseButton",propName:"closeButton",value:!0},Pe={category:a,type:"colorpicker",label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},ke={category:a,type:"switch",label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},Oe={category:a,type:c,label:"widget_common_style_buttons_label_buttonBorderThickness",propName:"buttonsBorderWidth",value:1,min:0,max:30,unit:"px"},Be={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBorderColor",propName:"buttonsBorderColor",value:"rgba(87, 184, 199, 1)"},Le={category:a,type:c,label:"widget_common_style_buttons_label_buttonBorderRadius",propName:"buttonsBorderRadius",value:4,min:0,max:30,unit:"px"},We={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBackgroundColor",propName:"buttonsBackgroundColor",value:"rgba(0, 127, 145, 1)"},De={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonTextColor",propName:"buttonsTextColor",value:p},Fe={category:a,type:d,label:"widget_stickyElement_content_positionOn_option_background",collapsible:!0,children:[_e,ve]},Ve=[{field:fe.propName,value:e=>e>0}];we.conditions=Ve;const Ge={category:a,type:d,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[fe,we,xe]},qe={category:a,type:d,label:"widget_common_style_blockTitle_text",collapsible:!0,children:[Ee,Te]},Ue=[{field:"dropShadow",value:!0}];Ne.conditions=Ue,Ie.conditions=Ue;const Me={category:a,type:d,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[Ae,Ce,_e,$e,Ne,Ie,Re]},He={category:a,type:d,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[Pe,ke],conditions:[{field:"layout",value:"popin"}]},je=[{field:Oe.propName,value:e=>e>0}];Be.conditions=je;const Ye={category:a,type:d,label:"widget_common_style_blockTitle_buttons",collapsible:!0,children:[Oe,Be,Le,We,De]};exports.ABTASTY_IMAGES_ROUTE=g,exports.AREAINPUT="areainput",exports.BLACK="rgba(0, 0, 0, 1)",exports.Banner=L,exports.CHECKBOX="checkbox",exports.COLOR_PICKER="colorpicker",exports.CONDITIONS=l,exports.CONTENT="content",exports.DARK_GRAY="rgba(57, 57, 57, 1)",exports.DARK_TURQUOISE="rgba(0, 127, 145, 1)",exports.DATE_PICKER="datepicker",exports.DATE_RANGE_PICKER="dateRangePicker",exports.Free=W,exports.GROUP=d,exports.HIDDEN="hidden",exports.INLINE_NOTIFICATION="inlinenotification",exports.LAYOUT="layout",exports.LIGHT_GREY=p,exports.LIGHT_TURQUOISE="rgba(87, 184, 199, 1)",exports.MEDIA_UPLOAD="mediaupload",exports.NUMBER="number",exports.PARAGRAPH="paragraph",exports.PageWatcher=k,exports.Popin=B,exports.RADIO_BUTTON="radio",exports.RADIO_IMAGE="radioImage",exports.REBUILD_WIDGET="rebuild",exports.REMOVE_WIDGET="remove",exports.Recurrence=I,exports.SELECT="select",exports.SELECT_ELEMENT="selectelement",exports.SEPARATOR="separator",exports.SHORT_SEPARATOR="short-separator",exports.SLIDER=c,exports.SOCIAL_PROOF_API_BASE=u,exports.STYLE=a,exports.SWITCH="switch",exports.TAG_RESET_EVENT="abtasty_resetActionTracking",exports.TASTY_GREEN="rgba(28, 191, 151, 1)",exports.TASTY_RED="rgba(213, 64, 64, 1)",exports.TASTY_YELLOW="rgba(224, 185, 10, 1)",exports.TEXT_AREA="textarea",exports.TEXT_FIELD="text",exports.TIME_PICKER="timepicker",exports.Trigger=P,exports.URL_FIELD="url",exports.VARIABLES_INPUT="variablesinput",exports.WHITE=h,exports.WYSIWYG="wysiwyg",exports.WidgetContainer=O,exports.addGlobalUtil=t,exports.addPolyfill=N,exports.allowGlobalScroll=function(){S("body",()=>{const{body:e}=document;C&&(e.style.overflowY=C)},e=>x(e))},exports.asyncRequest=function(e,t){return new Promise((o,r)=>{const i=new XMLHttpRequest;i.open(e,t,!0),i.onload=function(){this.status>=200&&this.status<300?o(i.response):r({status:this.status,statusText:i.statusText})},i.onerror=function(){r({status:this.status,statusText:i.statusText})},i.send()})},exports.autoHideForm=oe,exports.backgroundColorForm=_e,exports.backgroundImageForm=ve,exports.backgroundsGroup=Fe,exports.borderColorForm=we,exports.borderRadiusForm=xe,exports.borderWidthForm=fe,exports.bordersGroup=Ge,exports.buttonLinkForm=ce,exports.buttonLinkGroup=he,exports.buttonTargetTypeForm=de,exports.buttonTextForm=le,exports.buttonsBackgroundColorForm=We,exports.buttonsBorderColorForm=Be,exports.buttonsBorderRadiusForm=Le,exports.buttonsBorderWidthForm=Oe,exports.buttonsGroup=Ye,exports.buttonsTextColorForm=De,exports.closingRecurrenceForm=M,exports.containerGroup=Me,exports.displayCloseButtonSwitchForm=Re,exports.displayRecurrenceForm=q,exports.dropShadowBlurForm=Ie,exports.dropShadowColorForm=Ne,exports.dropShadowSwitchForm=$e,exports.elementReferrerForm=ue,exports.findParent=A,exports.getAccountIdentifier=o,exports.getCookie=e=>{const t=`${e}=`,o=document.cookie.split(";");for(let e=0;e<o.length;e+=1){let r=o[e];for(;" "===r.charAt(0);)r=r.substring(1);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return""},exports.getCustomTriggersGroup=function(e){const t=e.reduce((e,t)=>[...e,ee[t]],[]),o=se.reduce((t,o)=>{const{conditions:r}=o;return r&&r.some(({value:t})=>e.includes(t))?[...t,o]:t},[]),r={...ie,options:t,value:e[0]};return{category:l,type:d,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[r,...o]}},exports.getGroupSettedValues=(e,t)=>{if("object"!=typeof t)return e;const{type:o,children:r}=e,i=Object.keys(t);if(!i.length)return e;if("object"!=typeof e||!o||"group"!==o||!r||!Array.isArray(r)||Array.isArray(r)&&!r.length)return{};const s=r.map(e=>{const{propName:o,value:r}=e;return i.includes(o)&&typeof r==typeof t[o]?{...e,value:t[o]}:e});return{...e,children:s}},exports.getHostname=T,exports.getPrettyWidgetName=y,exports.getProductKey=i,exports.getRecurrenceParams=_,exports.getTriggerParams=v,exports.getUniqueId=b,exports.getVisitorId=()=>window.ABTasty&&window.ABTasty.visitor?window.ABTasty.visitor.id:void 0,exports.getWidgetContainer=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new B;break;case"bannerTop":case"bannerBottom":t=new L;break;case"free":t=new W;break;default:t=new O}return t},exports.getWidgetName=m,exports.isAffected=s,exports.isInQaMode=n,exports.isOnEditor=e,exports.isOnPreview=r,exports.isTouch=()=>void 0!==window.ontouchstart,exports.isTriggerOncePerPage=w,exports.layoutGroup=be,exports.layoutsForm=pe,exports.loadImage=e=>new Promise((t,o)=>{const r=new Image;r.onload=()=>{t(r)},r.src=e,r.onerror=()=>{const t=new Error(`Image ${e} is not loaded.`);return o(t)}}),exports.loadJS=$,exports.log=x,exports.marginForm=Ae,exports.olverlayCloseOnClickForm=ke,exports.overlayColorForm=Pe,exports.overlayGroup=He,exports.paddingForm=Ce,exports.preventGlobalScroll=function(){S("body",()=>{const{body:e}=document;C=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"},e=>x(e))},exports.promiseDeferrer=E,exports.recurrencesGroup=K,exports.referrerInsertTypeForm=me,exports.setCookie=(e,t,o)=>{let r="";if(o){const e=new Date;e.setTime(e.getTime()+24*o*60*60*1e3),r=`expires=${e.toUTCString()}`}const i=`domain=${T()}`;document.cookie=`${e}=${t}; ${r};${i};path=/`},exports.switchButtonForm=ae,exports.syncRequest=function(e,t){const o=new XMLHttpRequest;return o.open(e,t,!1),o.send(null),o},exports.textAlignmentForm=Ee,exports.textColorForm=Te,exports.textGroup=qe,exports.timeHideForm=re,exports.triggerDelay=X,exports.triggerEventCustomScript=Z,exports.triggerEventElementVisible=Q,exports.triggerEventReengageDelay=z,exports.triggerOncePerPage=te,exports.triggersForm=ie,exports.triggersGroup=ne,exports.triggersOptions=ee,exports.validationRecurrenceForm=j,exports.waitForElement=S,exports.widgetLog=f;

@@ -1,1 +0,1 @@

const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");function t(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}const i=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},o=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},r=()=>window.ABTasty&&window.ABTasty.visitor?window.ABTasty.visitor.id:void 0,s=()=>window.ABTastyProductKey,n=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID]||o(),a=()=>{if(e())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0},l="style",c="layout",d="content",h="conditions",g="hidden",u="separator",m="short-separator",p="paragraph",y="text",b="url",_="select",v="checkbox",w="wysiwyg",f="colorpicker",T="datepicker",S="timepicker",$="number",E="textarea",C="variablesinput",N="selectelement",A="radio",x="radioImage",k="switch",I="slider",P="mediaupload",B="dateRangePicker",R="group",O="areainput",L="inlinenotification",W="https://widgets-images.abtasty.com/",D="abtasty_resetActionTracking",V="remove",q="rebuild",j="rgba(255, 255, 255, 1)",M="rgba(0, 0, 0, 1)",H="rgba(247, 247, 247, 1)",U="rgba(57, 57, 57, 1)",G="rgba(0, 127, 145, 1)",K="rgba(87, 184, 199, 1)",Y="rgba(213, 64, 64, 1)",z="rgba(28, 191, 151, 1)",F="rgba(224, 185, 10, 1)",X="https://social-proof-api.abtasty.com/clients/",J=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},Q=()=>{const e=J();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},Z=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,ee=()=>{const{displayRecurrence:t,closingRecurrence:i,validationRecurrence:o}=DATA;if(e()||!t&&!i&&!o)return!1;const r={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},s={};return t&&(s.displayRecurrence=r[t]("displayRecurrence")),i&&(s.closingRecurrence=r[i]("closingRecurrence")),o&&(s.validationRecurrence=r[o]("validationRecurrence")),s},te=()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:i,triggerEventReengageDelay:o,socialProofContentType:r,triggerEventElementVisible:s,triggerEventDelay:n}=DATA;if(e()||!t&&!r)return!1;const a={click:()=>i,elementVisible:()=>s},l=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",c="reengage"===t?o:n;return r&&(t=1===r?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:l,triggerDelay:c}},ie=()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!(!e||!["click","script"].includes(t))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(e=>e===t)},oe=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},re=e=>{if(a()){const t=Q();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${e}`,`background-color: rgba(0, 127, 145, 1); color: ${H}`)}},se=()=>{let e=document.location.hostname.split("").reverse().join("");if(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9-]+(?:\.|$)/i),null===e)e=document.location.hostname;else{"."!==e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join("")}return e},ne=(e,t)=>{if("object"!=typeof t)return e;const{type:i,children:o}=e,r=Object.keys(t);if(!r.length)return e;if("object"!=typeof e||!i||"group"!==i||!o||!Array.isArray(o)||Array.isArray(o)&&!o.length)return{};const s=o.map(e=>{const{propName:i,value:o}=e;return r.includes(i)&&typeof o==typeof t[i]?{...e,value:t[i]}:e});return{...e,children:s}},ae=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,i)=>{t.resolve=e,t.reject=i}),t},le=(e,t,i)=>{let o=0,r=0;try{document.querySelector(e)}catch(t){const o=`Selector «${e}» not valid.`;return oe(o),"function"==typeof i&&i(o)}function s(){clearInterval(r),clearTimeout(o)}return o=setTimeout(()=>{s();const t=`Can't find element «${e}».`;return oe(t),"function"==typeof i&&i(t)},1e4),r=setInterval(()=>{const i=document.querySelector(e);return null!==i?(s(),"function"==typeof t&&t(i)):i},200),{clear:s}};function ce(e,t){return t(e)||!e.parentElement?e:ce(e.parentElement,t)}let de;function he(){le("body",()=>{const{body:e}=document;de=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"},e=>oe(e))}function ge(){le("body",()=>{const{body:e}=document;de&&(e.style.overflowY=de)},e=>oe(e))}const ue=e=>new Promise((t,i)=>{const o=new Image;o.onload=()=>{t(o)},o.src=e,o.onerror=()=>{const t=new Error(`Image ${e} is not loaded.`);return i(t)}}),me=()=>void 0!==window.ontouchstart;function pe(e,t){const i=new XMLHttpRequest;return i.open(e,t,!1),i.send(null),i}function ye(e,t){return new Promise((i,o)=>{const r=new XMLHttpRequest;r.open(e,t,!0),r.onload=function(){this.status>=200&&this.status<300?i(r.response):o({status:this.status,statusText:r.statusText})},r.onerror=function(){o({status:this.status,statusText:r.statusText})},r.send()})}function be(e){return new Promise((t,i)=>{const o=window.document.getElementsByTagName("script")[0],r=window.document.createElement("script");r.src=e,o.parentNode.insertBefore(r,o),r.onload=t,r.onerror=i})}async function _e(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||be("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:t=!0}return t}const ve=(e,t,i)=>{let o="";if(i){const e=new Date;e.setTime(e.getTime()+24*i*60*60*1e3),o=`expires=${e.toUTCString()}`}const r=`domain=${se()}`;document.cookie=`${e}=${t}; ${o};${r};path=/`},we=e=>{const t=`${e}=`,i=document.cookie.split(";");for(let e=0;e<i.length;e+=1){let o=i[e];for(;" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};class fe{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:i},o){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(i),this.onSetCallback=o,this.widgetName=J(),this.uniqueId=Z(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:i,...o}=t;return Object.entries(o).length?(e.setItem("ABTastyWidgets",JSON.stringify(o)),o):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const i=this.getTypeOfStorage(e);if(!i&&"object"!=typeof i)return!1;const{storageString:o,storageMethod:r}=i,s=this.getStamp(e),n={type:t,stamp:s},{type:a}=this.getCurrentRecurrence(),l=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let i;"session"===o?e?i=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),i=this.getSessionRecurrenceStorageParsed()):"local"===o&&(t?i=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),i=this.getLocalRecurrenceStorageParsed()));const s=i?{[this.recurrenceKey]:n,...i}:{[this.recurrenceKey]:n};r.setItem("ABTastyWidgets",JSON.stringify(s)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!r)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)l();else{if("display"!==t||"validation"===a||"closing"===a)return!1;l()}else l();return s}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class Te{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const i=this.inViewportTargets.find(({element:i,selector:o})=>{if(i.isSameNode(e))return!0;const r=[...e.querySelectorAll(o)];if(r.length){if(r.includes(i))return!0}if(t.includes(i))return!0;const s=[...e.parentElement.children],n=s.findIndex(t=>t.isSameNode(e)),a=s.filter((e,t)=>t>n);if(a.length){if(a.includes(i))return!0;if(a.some(e=>[...e.querySelectorAll(o)].includes(i)))return!0}return!1});if(i&&this.isElementVisible(i.element)){const{selector:e,element:t,uniqueId:o}=i,r=this.targets.find(t=>t.selector===e&&t.uniqueId===o);r&&r.resolve(t),this.clear(e,o)}}mouseOverHandler(){const e=["mouseover",e=>setTimeout(()=>this.onMouseOver(e),50),!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===ce(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),i=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let o=!1,r=0;for(;!o&&r<i.length;){const t=document.elementFromPoint(...i[r]);o=e===t||e.contains(t),r+=1}return o}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const i=document.querySelector(e);i&&!this.existingTargets.find(e=>e.element===i&&e.uniqueId===t)&&(this.existingTargets.push({element:i,selector:e,uniqueId:t}),this.visibilityObserver.observe(i))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:i})=>{if(t.matches(e)&&this.isElementVisible(t)){const o=this.targets.find(t=>t.selector===e&&t.uniqueId===i);return o&&o.resolve(t),this.clear(e,i),!1}return!0})}watch(e,t,i){this.targets.push({selector:e,resolve:t,uniqueId:i}),this.startMutationObserver(),this.checkElements()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(i=>i.filter(({selector:i,uniqueId:o})=>i!==e&&o!==t)),this.visibilityObserver.unobserve(document.querySelector(e)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class Se{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:i}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*i,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:i}){const o=ae(`${this.event}DomReady`);this.promises.push(o);const r=await this.onPageLoad(o),s=await _e("IntersectionObserver"),n=t("VisibilityObserver",Te);if(this.visibilityObservers.push(n),s&&r){const e=Z();n.watch(this.selector,i,e)}return e}onPageLoad({promise:e,resolve:t}){const i=()=>"complete"===document.readyState;if(!i()){const e=["readystatechange",()=>i()&&t(!0),{passive:!0}];this.eventsListeners.push(e),document.addEventListener(...e)}return t(!0),e}onClick({promise:e,resolve:t}){const i=document.createElement("style");i.type="text/css",i.id=`Click_${Z()}`,i.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(i),this.elementsSelectors.push(`#${i.id}`);const o=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),r=["click",({target:e})=>o(e)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(r),document.addEventListener(...r),e}onExitIntent({promise:e,resolve:t}){const i=["mouseleave",async({clientY:e})=>{e<=0&&t(!0)},{passive:!0}],o=le("body",e=>{e.addEventListener(...i),this.eventsListeners.push([e,...i]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==o)});return this.elementsWaiters.push(o),e}onReengage({promise:e,resolve:t}){const i=this.delay;let o=i;const r=[()=>(o=i,o),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...r),this.eventsListeners.push([e,...r])});const s=setInterval(()=>{o<=0?t(!0):o-=100},100);return this.intervals.push(s),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:i}=DATA;return new Function(`return new Promise(async resolve => {${i}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:t}){const o=s(),r=i(),{viewInterval:n,triggerSocialProofMinPurchases:a,spNoTrim:l}=DATA;if(o||(re("Not able to find ABTastyProductKey, impossible to call the API."),t(!1)),o&&r){fetch(`${X}${r}/metrics/i?key=${o}${l?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===n||void 0===a)return!1;const t=e[n]&&e[n]>=a;return t||re(`Widget will not be shown, product has been purchased ${e[n]} times while ${a} are required`),t})(e)&&t(e[n])).catch(()=>re("Failed to fetch datas from server."))}else t(!1);return e}getSocialProofPageViews({promise:e,resolve:t}){const o=encodeURIComponent(`${window.location.pathname}`),r=i(),{viewInterval:s,triggerSocialProofMinPageViews:n}=DATA;if(o&&r){fetch(`${X}${r}/metrics/pv?key=${o}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===s||void 0===n)return!1;const t=e[s]&&e[s]>=n;return t||re(`Widget will not be shown, page has been seen ${e[s]} times while ${n} are required`),t})(e)&&t(e[s])).catch(()=>re("Failed to fetch datas from server."))}else t(!1);return e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...i]="string"==typeof e[0]?[document,...e]:e;t&&i.length>1&&t.removeEventListener(...i)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=Z();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=ae(this.event);this.promises.push(e);const t={direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),socialProofPurchases:()=>this.getSocialProofPurchases(e),socialProofPageViews:()=>this.getSocialProofPageViews(e)},i=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();this.clear();return"reengage"!==this.event&&this.delay?i&&await(async()=>{const e=ae(`${this.event}Delay`);return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():i}}class $e{constructor(e,t,i){this.recurrence=e,this.isWidgetApplied=t,this.callback=i,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=n(),{type:i}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},o=()=>e&&"display"===i||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&o()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&o())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=n();return[250,500].forEach(t=>setTimeout(()=>500===t&&n()===e?this:(e=n(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),i=e.some(({addedNodes:e})=>e&&e.length);return t||i?(this.decisionHandler(!0),this):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=le("body",e=>{const i=[e,{childList:!0,subtree:!0}];this.observer.observe(...i),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class Ee{constructor(){this.children=void 0,this.uniqueId=Z(),this.widgetName=J(),this.prettyName=Q(),this.recurrenceParams=ee(),this.triggerParams=te(),this.recurrence=!!this.recurrenceParams&&new fe(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new Se(this.triggerParams),this.pageWatcher=new $e(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=ie(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){const e=(e,t,i)=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),re(e),i(e)},t=new Promise((t,i)=>{const o=le("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==o),t(e.appendChild(this.styleElement))},t=>e(t,o,i));this.elementsWaiters.push(o)}),i=new Promise((t,i)=>{const{layout:o,elementReferrer:r,referrerInsertType:s}=DATA,{selector:n,position:a}="string"==typeof o&&"free"===o&&"string"==typeof r&&"string"==typeof s?{selector:r,position:s}:{selector:"body",position:"beforeend"},l=le(n,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==l),this.removeOldDomElement(),t(e.insertAdjacentElement(a,this.domElement))},t=>e(t,l,i));this.elementsWaiters.push(l)});return Promise.all([i,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return this.hasBeenShown||e()||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!e()&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!e()&&!n())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const i=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!i)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const o=e()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!o&&(await this.insert(),this.addCloseEvent(),e()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(o),{container:this,response:o})}onPageChange(e,t){const i=()=>this.init().then(({response:e})=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):i()}}addCloseEvent(...e){const{closeButton:t,overlayClickable:i,layout:o}=DATA,r=[];if(void 0!==i&&i&&void 0!==o&&"popin"===o&&r.push(`.${this.overlayClassName}`),void 0!==t&&t&&r.push(`.${this.closeButtonClassName}`),!r.length)return this;const s=this.domElement.querySelectorAll(r.join(", "));return s.length?(e.push(...s),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:t,layout:i}=DATA,o=document.createElement("div");return o.className=`${this.basicClassName} ${this.hideClassName}`,o.id=this.widgetContainerId,o.innerHTML=`\n\t\t\t${void 0!==i&&"popin"===i?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t${t?`<button class="${this.closeButtonClassName}" ${e()?"data-abtasty-actionnable":""}><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,o}getStyleTag(t=""){const{noStyles:i,layout:o}=DATA,{backgroundColor:r,backgroundImage:s,borderColor:n,borderRadius:a,borderWidth:l,textColor:c,textAlign:d,overlayColor:h,dropShadow:g,dropShadowColor:u,dropShadowBlur:m,containerMargin:p,containerPadding:y,closeButton:b,buttonsBorderWidth:_,buttonsBorderColor:v,buttonsBorderRadius:w,buttonsBackgroundColor:f,buttonsTextColor:T}=i?{}:DATA,S=document.createElement("style");S.type="text/css",e()&&S.setAttribute("abtasty-script-added","true");const $=`background-color: ${void 0!==r?r:j};`,E=void 0!==s?`background-image: url(${s});`:"",C=void 0!==a?`border-radius: ${a}px;`:"",N=void 0!==l&&l?`border-width: ${l}px; border-style: solid;`:"",A=[n,l].every(e=>void 0!==e)&&l?`border-color: ${n};`:"",x=void 0!==c?`color: ${c}; fill: ${c};`:"",k=void 0!==d?`text-align: ${d};`:"",I=void 0!==g&&g?`box-shadow: 0 5px ${m}px 0 ${u};`:"",P=p instanceof Array&&1===p.length&&p[0],B=P?`margin: ${P.top}px ${P.right}px ${P.bottom}px ${P.left}px;`:"",R=P?`margin: calc(${P.top}px * 0.5) calc(${P.right}px * 0.5) calc(${P.bottom}px * 0.5) calc(${P.left}px * 0.5);`:"",O=y instanceof Array&&1===y.length&&y[0],L=O?`padding: ${O.top}px ${O.right}px ${O.bottom}px ${O.left}px;`:"",W=O?`padding: calc(${O.top}px * 0.5) calc(${O.right}px * 0.5) calc(${O.bottom}px * 0.5) calc(${O.left}px * 0.5);`:"",D=void 0!==_&&_?`border-width: ${_}px; border-style: solid;`:"",V=[v,_].every(e=>void 0!==e)&&_?`border-color: ${v};`:"",q=void 0!==w?`border-radius: ${w}px;`:"",M=void 0!==f?`background-color: ${f};`:"",H=void 0!==T?`color: ${T};`:"",U=void 0!==o&&"popin"===o?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==h?h:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",G=i||void 0!==b&&b?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",x,"}"].join(""):"";return S.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,$,E,C,N,A,x,k,I,B,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;",L,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,D,V,q,M,H,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,R,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,W,"}","}",U,G,`${t}`].join(""),S}}class Ce extends Ee{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class Ne extends Ee{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class Ae extends Ee{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const xe=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new Ce;break;case"bannerTop":case"bannerBottom":t=new Ne;break;case"free":t=new Ae;break;default:t=new Ee}return t},ke=[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],Ie={category:h,type:I,min:1},Pe=[{...Ie,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...Ie,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...Ie,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],Be={category:h,type:"select",options:ke,value:"everytime"},Re={...Be,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},Oe=Pe.map(e=>({...e,propName:`${Re.propName}_${e.propName}`,conditions:[{field:Re.propName,value:e.propName}]})),Le={...Be,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},We=Pe.map(e=>({...e,propName:`${Le.propName}_${e.propName}`,conditions:[{field:Le.propName,value:e.propName}]})),De={...Be,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},Ve=Pe.map(e=>({...e,propName:`${De.propName}_${e.propName}`,conditions:[{field:De.propName,value:e.propName}]})),qe={category:h,type:R,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[Re,...Oe,Le,...We,De,...Ve]},je={category:h,type:I,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},Me={...je,propName:"triggerEventReengageDelay",value:10,max:180},He={category:h,type:"selectelement",propName:"triggerEventClick",value:"body"},Ue={...He,propName:"triggerEventElementVisible"},Ge={category:h,type:"textarea",label:"widget_common_conditions_triggering_option_customTrigger",propName:"triggerEventCustomScript",value:"/* In this example snippet, the widget will be triggered as soon as any scroll is detected.\nCreate your own by resolving resolve() with true (which does trigger) or false (which doesn't trigger) */\n\nfunction launchIfScroll() {\n\treturn new Promise(resolve => {\n\t\tdocument.addEventListener('scroll', () => resolve(true), {once: true});\n\t});\n}\n\nconst result = await launchIfScroll();\nreturn resolve(result);",rows:15},Ke={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},Ye={category:h,type:"switch",propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},ze={category:h,type:"switch",propName:"autoHide",value:!0,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterRedirection"},Fe={category:h,type:I,propName:"timeHide",value:2,max:120,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterXSeconds",conditions:[{field:"autoHide",value:!0}]},Xe={category:h,type:"select",label:"widget_common_conditions_triggering_label",options:Object.keys(Ke).map(e=>Ke[e]),propName:"triggerEvent",value:"pageLoad"};He.conditions=[{field:"triggerEvent",value:"click"}],Me.conditions=[{field:"triggerEvent",value:"reengage"}],Ue.conditions=[{field:"triggerEvent",value:"elementVisible"}],Ge.conditions=[{field:"triggerEvent",value:"script"}],je.conditions=[{field:"triggerEvent",value:e=>"reengage"!==e}],Ye.conditions=[{field:"triggerEvent",value:e=>"click"===e||"script"===e}];const Je=[He,Ue,Ge,Ye,Me,je],Qe={category:h,type:R,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[Xe,...Je]};function Ze(e){const t=e.reduce((e,t)=>[...e,Ke[t]],[]),i=Je.reduce((t,i)=>{const{conditions:o}=i;return o&&o.some(({value:t})=>e.includes(t))?[...t,i]:t},[]),o={...Xe,options:t,value:e[0]};return{category:h,type:R,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[o,...i]}}const et={category:"content",propName:"button",type:"switch",value:!1,label:"widget_common_content_toggler_label_displayButton"},tt={category:"content",propName:"buttonText",type:"text",label:"widget_common_content_label_buttonText",value:"widget_common_content_buttonText_default"},it={category:"content",propName:"buttonLink",type:"text",label:"widget_common_content_label_buttonUrl",value:location.origin,conditions:[{field:"button"}]},ot={category:"content",propName:"buttonTargetType",type:"switch",label:"widget_common_content_button_label_openLinkNewTab",value:!1,conditions:[{field:"button"}]},rt=[{field:"button"}];tt.conditions=rt,it.conditions=rt,ot.conditions=rt;const st={category:"content",type:R,label:"widget_common_tabName_content",collapsible:!1,children:[et,tt,it,ot]},nt={category:"layout",type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:`${W}layout/icon-layout-modal.png`},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:`${W}layout/icon-layout-topBanner.png`},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:`${W}layout/icon-layout-bottomBanner.png`},{label:"widget_common_layout_option_freePlacement",value:"free",src:`${W}layout/icon-layout-freePlacement.png`}]},at={category:"layout",type:"selectelement",propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},lt={category:"layout",type:"radio",propName:"referrerInsertType",value:"afterbegin",label:"widget_common_layout_positioning_label_selectPosition",options:[{label:"widget_common_layout_positioning_option_before",value:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheBeginning",value:"afterbegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},ct=[{field:"layout",value:"free"}];at.conditions=ct,lt.conditions=ct;const dt={category:"layout",type:R,label:"widget_common_tabName_layout",collapsible:!0,children:[nt,at,lt]},ht={category:l,type:"colorpicker",label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:H},gt={category:l,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:""},ut={category:l,type:"colorpicker",label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},mt={category:l,type:I,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},pt={category:l,type:I,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},yt={category:l,type:"colorpicker",label:"widget_common_style_text_label_textColor",propName:"textColor",value:"rgba(57, 57, 57, 1)"},bt={category:l,type:"radioImage",label:"widget_common_style_text_label_textAlignment",propName:"textAlign",value:"center",style:"little",options:[{label:"widget_common_style_text_textAlignment_option_left",value:"left",src:`${W}style/icon-text-alignLeft.png`},{label:"widget_common_style_text_textAlignment_option_center",value:"center",src:`${W}style/icon-text-alignCenter.png`},{label:"widget_common_style_text_textAlignment_option_right",value:"right",src:`${W}style/icon-text-alignRight.png`}]},_t={category:l,type:"areainput"},vt={..._t,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},wt={..._t,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},ft={category:l,type:"switch",label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},Tt={category:l,type:"colorpicker",label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},St={category:l,type:I,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},$t={category:l,type:"switch",label:"widget_common_style_container_label_displayCloseButton",propName:"closeButton",value:!0},Et={category:l,type:"colorpicker",label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Ct={category:l,type:"switch",label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},Nt={category:l,type:I,label:"widget_common_style_buttons_label_buttonBorderThickness",propName:"buttonsBorderWidth",value:1,min:0,max:30,unit:"px"},At={category:l,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBorderColor",propName:"buttonsBorderColor",value:"rgba(87, 184, 199, 1)"},xt={category:l,type:I,label:"widget_common_style_buttons_label_buttonBorderRadius",propName:"buttonsBorderRadius",value:4,min:0,max:30,unit:"px"},kt={category:l,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBackgroundColor",propName:"buttonsBackgroundColor",value:"rgba(0, 127, 145, 1)"},It={category:l,type:"colorpicker",label:"widget_common_style_buttons_label_buttonTextColor",propName:"buttonsTextColor",value:H},Pt={category:l,type:R,label:"widget_stickyElement_content_positionOn_option_background",collapsible:!0,children:[ht,gt]},Bt=[{field:pt.propName,value:e=>e>0}];ut.conditions=Bt;const Rt={category:l,type:R,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[pt,ut,mt]},Ot={category:l,type:R,label:"widget_common_style_blockTitle_text",collapsible:!0,children:[bt,yt]},Lt=[{field:"dropShadow",value:!0}];Tt.conditions=Lt,St.conditions=Lt;const Wt={category:l,type:R,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[vt,wt,ht,ft,Tt,St,$t]},Dt={category:l,type:R,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[Et,Ct],conditions:[{field:"layout",value:"popin"}]},Vt=[{field:Nt.propName,value:e=>e>0}];At.conditions=Vt;const qt={category:l,type:R,label:"widget_common_style_blockTitle_buttons",collapsible:!0,children:[Nt,At,xt,kt,It]};export{W as ABTASTY_IMAGES_ROUTE,O as AREAINPUT,M as BLACK,Ne as Banner,v as CHECKBOX,f as COLOR_PICKER,h as CONDITIONS,d as CONTENT,U as DARK_GRAY,G as DARK_TURQUOISE,T as DATE_PICKER,B as DATE_RANGE_PICKER,Ae as Free,R as GROUP,g as HIDDEN,L as INLINE_NOTIFICATION,c as LAYOUT,H as LIGHT_GREY,K as LIGHT_TURQUOISE,P as MEDIA_UPLOAD,$ as NUMBER,p as PARAGRAPH,$e as PageWatcher,Ce as Popin,A as RADIO_BUTTON,x as RADIO_IMAGE,q as REBUILD_WIDGET,V as REMOVE_WIDGET,fe as Recurrence,_ as SELECT,N as SELECT_ELEMENT,u as SEPARATOR,m as SHORT_SEPARATOR,I as SLIDER,X as SOCIAL_PROOF_API_BASE,l as STYLE,k as SWITCH,D as TAG_RESET_EVENT,z as TASTY_GREEN,Y as TASTY_RED,F as TASTY_YELLOW,E as TEXT_AREA,y as TEXT_FIELD,S as TIME_PICKER,Se as Trigger,b as URL_FIELD,C as VARIABLES_INPUT,j as WHITE,w as WYSIWYG,Ee as WidgetContainer,t as addGlobalUtil,_e as addPolyfill,ge as allowGlobalScroll,ye as asyncRequest,ze as autoHideForm,ht as backgroundColorForm,gt as backgroundImageForm,Pt as backgroundsGroup,ut as borderColorForm,mt as borderRadiusForm,pt as borderWidthForm,Rt as bordersGroup,it as buttonLinkForm,st as buttonLinkGroup,ot as buttonTargetTypeForm,tt as buttonTextForm,kt as buttonsBackgroundColorForm,At as buttonsBorderColorForm,xt as buttonsBorderRadiusForm,Nt as buttonsBorderWidthForm,qt as buttonsGroup,It as buttonsTextColorForm,Le as closingRecurrenceForm,Wt as containerGroup,$t as displayCloseButtonSwitchForm,Re as displayRecurrenceForm,St as dropShadowBlurForm,Tt as dropShadowColorForm,ft as dropShadowSwitchForm,at as elementReferrerForm,ce as findParent,i as getAccountIdentifier,we as getCookie,Ze as getCustomTriggersGroup,ne as getGroupSettedValues,se as getHostname,Q as getPrettyWidgetName,s as getProductKey,ee as getRecurrenceParams,te as getTriggerParams,Z as getUniqueId,r as getVisitorId,xe as getWidgetContainer,J as getWidgetName,n as isAffected,a as isInQaMode,e as isOnEditor,o as isOnPreview,me as isTouch,ie as isTriggerOncePerPage,dt as layoutGroup,nt as layoutsForm,ue as loadImage,be as loadJS,oe as log,vt as marginForm,Ct as olverlayCloseOnClickForm,Et as overlayColorForm,Dt as overlayGroup,wt as paddingForm,he as preventGlobalScroll,ae as promiseDeferrer,qe as recurrencesGroup,lt as referrerInsertTypeForm,ve as setCookie,et as switchButtonForm,pe as syncRequest,bt as textAlignmentForm,yt as textColorForm,Ot as textGroup,Fe as timeHideForm,je as triggerDelay,Ge as triggerEventCustomScript,Ue as triggerEventElementVisible,Me as triggerEventReengageDelay,Ye as triggerOncePerPage,Xe as triggersForm,Qe as triggersGroup,Ke as triggersOptions,De as validationRecurrenceForm,le as waitForElement,re as widgetLog};
const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");function t(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}const i=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},o=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},r=()=>window.ABTasty&&window.ABTasty.visitor?window.ABTasty.visitor.id:void 0,s=()=>window.ABTastyProductKey,n=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID]||o(),a=()=>{if(e())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0},l="style",c="layout",d="content",h="conditions",g="hidden",u="separator",m="short-separator",p="paragraph",y="text",b="url",_="select",v="checkbox",w="wysiwyg",f="colorpicker",T="datepicker",S="timepicker",$="number",E="textarea",C="variablesinput",N="selectelement",A="radio",x="radioImage",k="switch",I="slider",P="mediaupload",B="dateRangePicker",R="group",O="areainput",L="inlinenotification",W="https://widgets-images.abtasty.com/",D="abtasty_resetActionTracking",V="remove",q="rebuild",j="rgba(255, 255, 255, 1)",M="rgba(0, 0, 0, 1)",H="rgba(247, 247, 247, 1)",U="rgba(57, 57, 57, 1)",G="rgba(0, 127, 145, 1)",K="rgba(87, 184, 199, 1)",Y="rgba(213, 64, 64, 1)",z="rgba(28, 191, 151, 1)",F="rgba(224, 185, 10, 1)",X="https://social-proof-api.abtasty.com/clients/",J=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},Q=()=>{const e=J();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},Z=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,ee=()=>{const{displayRecurrence:t,closingRecurrence:i,validationRecurrence:o}=DATA;if(e()||!t&&!i&&!o)return!1;const r={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},s={};return t&&(s.displayRecurrence=r[t]("displayRecurrence")),i&&(s.closingRecurrence=r[i]("closingRecurrence")),o&&(s.validationRecurrence=r[o]("validationRecurrence")),s},te=()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:i,triggerEventReengageDelay:o,socialProofContentType:r,triggerEventElementVisible:s,triggerEventDelay:n}=DATA;if(e()||!t&&!r)return!1;const a={click:()=>i,elementVisible:()=>s},l=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",c="reengage"===t?o:n;return r&&(t=1===r?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:l,triggerDelay:c}},ie=()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!(!e||!["click","script"].includes(t))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(e=>e===t)},oe=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},re=e=>{if(a()){const t=Q();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${e}`,`background-color: rgba(0, 127, 145, 1); color: ${H}`)}},se=()=>{let e=document.location.hostname.split("").reverse().join("");if(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9-]+(?:\.|$)/i),null===e)e=document.location.hostname;else{"."!==e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join("")}return e},ne=(e,t)=>{if("object"!=typeof t)return e;const{type:i,children:o}=e,r=Object.keys(t);if(!r.length)return e;if("object"!=typeof e||!i||"group"!==i||!o||!Array.isArray(o)||Array.isArray(o)&&!o.length)return{};const s=o.map(e=>{const{propName:i,value:o}=e;return r.includes(i)&&typeof o==typeof t[i]?{...e,value:t[i]}:e});return{...e,children:s}},ae=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,i)=>{t.resolve=e,t.reject=i}),t},le=(e,t,i)=>{let o=0,r=0;try{document.querySelector(e)}catch(t){const o=`Selector «${e}» not valid.`;return oe(o),"function"==typeof i&&i(o)}function s(){clearInterval(r),clearTimeout(o)}return o=setTimeout(()=>{s();const t=`Can't find element «${e}».`;return oe(t),"function"==typeof i&&i(t)},1e4),r=setInterval(()=>{const i=document.querySelector(e);return null!==i?(s(),"function"==typeof t&&t(i)):i},200),{clear:s}};function ce(e,t){return t(e)||!e.parentElement?e:ce(e.parentElement,t)}let de;function he(){le("body",()=>{const{body:e}=document;de=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"},e=>oe(e))}function ge(){le("body",()=>{const{body:e}=document;de&&(e.style.overflowY=de)},e=>oe(e))}const ue=e=>new Promise((t,i)=>{const o=new Image;o.onload=()=>{t(o)},o.src=e,o.onerror=()=>{const t=new Error(`Image ${e} is not loaded.`);return i(t)}}),me=()=>void 0!==window.ontouchstart;function pe(e,t){const i=new XMLHttpRequest;return i.open(e,t,!1),i.send(null),i}function ye(e,t){return new Promise((i,o)=>{const r=new XMLHttpRequest;r.open(e,t,!0),r.onload=function(){this.status>=200&&this.status<300?i(r.response):o({status:this.status,statusText:r.statusText})},r.onerror=function(){o({status:this.status,statusText:r.statusText})},r.send()})}function be(e){return new Promise((t,i)=>{const o=window.document.getElementsByTagName("script")[0],r=window.document.createElement("script");r.src=e,o.parentNode.insertBefore(r,o),r.onload=t,r.onerror=i})}async function _e(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||be("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:t=!0}return t}const ve=(e,t,i)=>{let o="";if(i){const e=new Date;e.setTime(e.getTime()+24*i*60*60*1e3),o=`expires=${e.toUTCString()}`}const r=`domain=${se()}`;document.cookie=`${e}=${t}; ${o};${r};path=/`},we=e=>{const t=`${e}=`,i=document.cookie.split(";");for(let e=0;e<i.length;e+=1){let o=i[e];for(;" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};class fe{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:i},o){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(i),this.onSetCallback=o,this.widgetName=J(),this.uniqueId=Z(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:i,...o}=t;return Object.entries(o).length?(e.setItem("ABTastyWidgets",JSON.stringify(o)),o):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const i=this.getTypeOfStorage(e);if(!i&&"object"!=typeof i)return!1;const{storageString:o,storageMethod:r}=i,s=this.getStamp(e),n={type:t,stamp:s},{type:a}=this.getCurrentRecurrence(),l=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let i;"session"===o?e?i=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),i=this.getSessionRecurrenceStorageParsed()):"local"===o&&(t?i=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),i=this.getLocalRecurrenceStorageParsed()));const s=i?{[this.recurrenceKey]:n,...i}:{[this.recurrenceKey]:n};r.setItem("ABTastyWidgets",JSON.stringify(s)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!r)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)l();else{if("display"!==t||"validation"===a||"closing"===a)return!1;l()}else l();return s}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class Te{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this)),t=()=>e.observe(document.body,{attributes:!0,childList:!0,subtree:!0});return document.body?t():le("body",t),e}onMouseOver({target:e,path:t}){const i=this.inViewportTargets.find(({element:i,selector:o})=>{if(i.isSameNode(e))return!0;const r=[...e.querySelectorAll(o)];if(r.length){if(r.includes(i))return!0}if(t.includes(i))return!0;const s=[...e.parentElement.children],n=s.findIndex(t=>t.isSameNode(e)),a=s.filter((e,t)=>t>n);if(a.length){if(a.includes(i))return!0;if(a.some(e=>[...e.querySelectorAll(o)].includes(i)))return!0}return!1});if(i&&this.isElementVisible(i.element)){const{selector:e,element:t,uniqueId:o}=i,r=this.targets.find(t=>t.selector===e&&t.uniqueId===o);r&&r.resolve(t),this.clear(e,o)}}mouseOverHandler(){const e=["mouseover",e=>setTimeout(()=>this.onMouseOver(e),50),!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===ce(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),i=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let o=!1,r=0;for(;!o&&r<i.length;){const t=document.elementFromPoint(...i[r]);o=e===t||e.contains(t),r+=1}return o}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const i=document.querySelector(e);i&&!this.existingTargets.find(e=>e.element===i&&e.uniqueId===t)&&(this.existingTargets.push({element:i,selector:e,uniqueId:t}),this.visibilityObserver.observe(i))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:i})=>{if(t.matches(e)&&this.isElementVisible(t)){const o=this.targets.find(t=>t.selector===e&&t.uniqueId===i);return o&&o.resolve(t),this.clear(e,i),!1}return!0})}watch(e,t,i){this.targets.push({selector:e,resolve:t,uniqueId:i}),this.startMutationObserver(),this.checkElements()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(i=>i.filter(({selector:i,uniqueId:o})=>i!==e&&o!==t)),this.visibilityObserver.unobserve(document.querySelector(e)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class Se{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:i}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*i,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:i}){const o=ae(`${this.event}DomReady`);this.promises.push(o);const r=await this.onPageLoad(o),s=await _e("IntersectionObserver"),n=t("VisibilityObserver",Te);if(this.visibilityObservers.push(n),s&&r){const e=Z();n.watch(this.selector,i,e)}return e}onPageLoad({promise:e,resolve:t}){const i=()=>"complete"===document.readyState;if(!i()){const e=["readystatechange",()=>i()&&t(!0),{passive:!0}];this.eventsListeners.push(e),document.addEventListener(...e)}return t(!0),e}onClick({promise:e,resolve:t}){const i=document.createElement("style");i.type="text/css",i.id=`Click_${Z()}`,i.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(i),this.elementsSelectors.push(`#${i.id}`);const o=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),r=["click",({target:e})=>o(e)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(r),document.addEventListener(...r),e}onExitIntent({promise:e,resolve:t}){const i=["mouseleave",async({clientY:e})=>{e<=0&&t(!0)},{passive:!0}],o=le("body",e=>{e.addEventListener(...i),this.eventsListeners.push([e,...i]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==o)});return this.elementsWaiters.push(o),e}onReengage({promise:e,resolve:t}){const i=this.delay;let o=i;const r=[()=>(o=i,o),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...r),this.eventsListeners.push([e,...r])});const s=setInterval(()=>{o<=0?t(!0):o-=100},100);return this.intervals.push(s),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:i}=DATA;return new Function(`return new Promise(async resolve => {${i}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:t}){const o=s(),r=i(),{viewInterval:n,triggerSocialProofMinPurchases:a,spNoTrim:l}=DATA;if(o||(re("Not able to find ABTastyProductKey, impossible to call the API."),t(!1)),o&&r){fetch(`${X}${r}/metrics/i?key=${o}${l?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===n||void 0===a)return!1;const t=e[n]&&e[n]>=a;return t||re(`Widget will not be shown, product has been purchased ${e[n]} times while ${a} are required`),t})(e)&&t(e[n])).catch(()=>re("Failed to fetch datas from server."))}else t(!1);return e}getSocialProofPageViews({promise:e,resolve:t}){const o=encodeURIComponent(`${window.location.pathname}`),r=i(),{viewInterval:s,triggerSocialProofMinPageViews:n}=DATA;if(o&&r){fetch(`${X}${r}/metrics/pv?key=${o}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===s||void 0===n)return!1;const t=e[s]&&e[s]>=n;return t||re(`Widget will not be shown, page has been seen ${e[s]} times while ${n} are required`),t})(e)&&t(e[s])).catch(()=>re("Failed to fetch datas from server."))}else t(!1);return e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...i]="string"==typeof e[0]?[document,...e]:e;t&&i.length>1&&t.removeEventListener(...i)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=Z();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=ae(this.event);this.promises.push(e);const t={direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),socialProofPurchases:()=>this.getSocialProofPurchases(e),socialProofPageViews:()=>this.getSocialProofPageViews(e)},i=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();this.clear();return"reengage"!==this.event&&this.delay?i&&await(async()=>{const e=ae(`${this.event}Delay`);return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():i}}class $e{constructor(e,t,i){this.recurrence=e,this.isWidgetApplied=t,this.callback=i,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=n(),{type:i}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},o=()=>e&&"display"===i||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&o()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&o())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=n();return[250,500].forEach(t=>setTimeout(()=>500===t&&n()===e?this:(e=n(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),i=e.some(({addedNodes:e})=>e&&e.length);return t||i?(this.decisionHandler(!0),this):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=le("body",e=>{const i=[e,{childList:!0,subtree:!0}];this.observer.observe(...i),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class Ee{constructor(){this.children=void 0,this.uniqueId=Z(),this.widgetName=J(),this.prettyName=Q(),this.recurrenceParams=ee(),this.triggerParams=te(),this.recurrence=!!this.recurrenceParams&&new fe(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new Se(this.triggerParams),this.pageWatcher=new $e(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=ie(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){const e=(e,t,i)=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),re(e),i(e)},t=new Promise((t,i)=>{const o=le("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==o),t(e.appendChild(this.styleElement))},t=>e(t,o,i));this.elementsWaiters.push(o)}),i=new Promise((t,i)=>{const{layout:o,elementReferrer:r,referrerInsertType:s}=DATA,{selector:n,position:a}="string"==typeof o&&"free"===o&&"string"==typeof r&&"string"==typeof s?{selector:r,position:s}:{selector:"body",position:"beforeend"},l=le(n,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==l),this.removeOldDomElement(),t(e.insertAdjacentElement(a,this.domElement))},t=>e(t,l,i));this.elementsWaiters.push(l)});return Promise.all([i,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return this.hasBeenShown||e()||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!e()&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!e()&&!n())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const i=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!i)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const o=e()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!o&&(await this.insert(),this.addCloseEvent(),e()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(o),{container:this,response:o})}onPageChange(e,t){const i=()=>this.init().then(({response:e})=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):i()}}addCloseEvent(...e){const{closeButton:t,overlayClickable:i,layout:o}=DATA,r=[];if(void 0!==i&&i&&void 0!==o&&"popin"===o&&r.push(`.${this.overlayClassName}`),void 0!==t&&t&&r.push(`.${this.closeButtonClassName}`),!r.length)return this;const s=this.domElement.querySelectorAll(r.join(", "));return s.length?(e.push(...s),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:t,layout:i}=DATA,o=document.createElement("div");return o.className=`${this.basicClassName} ${this.hideClassName}`,o.id=this.widgetContainerId,o.innerHTML=`\n\t\t\t${void 0!==i&&"popin"===i?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t${t?`<button class="${this.closeButtonClassName}" ${e()?"data-abtasty-actionnable":""}><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,o}getStyleTag(t=""){const{noStyles:i,layout:o}=DATA,{backgroundColor:r,backgroundImage:s,borderColor:n,borderRadius:a,borderWidth:l,textColor:c,textAlign:d,overlayColor:h,dropShadow:g,dropShadowColor:u,dropShadowBlur:m,containerMargin:p,containerPadding:y,closeButton:b,buttonsBorderWidth:_,buttonsBorderColor:v,buttonsBorderRadius:w,buttonsBackgroundColor:f,buttonsTextColor:T}=i?{}:DATA,S=document.createElement("style");S.type="text/css",e()&&S.setAttribute("abtasty-script-added","true");const $=`background-color: ${void 0!==r?r:j};`,E=void 0!==s?`background-image: url(${s});`:"",C=void 0!==a?`border-radius: ${a}px;`:"",N=void 0!==l&&l?`border-width: ${l}px; border-style: solid;`:"",A=[n,l].every(e=>void 0!==e)&&l?`border-color: ${n};`:"",x=void 0!==c?`color: ${c}; fill: ${c};`:"",k=void 0!==d?`text-align: ${d};`:"",I=void 0!==g&&g?`box-shadow: 0 5px ${m}px 0 ${u};`:"",P=p instanceof Array&&1===p.length&&p[0],B=P?`margin: ${P.top}px ${P.right}px ${P.bottom}px ${P.left}px;`:"",R=P?`margin: calc(${P.top}px * 0.5) calc(${P.right}px * 0.5) calc(${P.bottom}px * 0.5) calc(${P.left}px * 0.5);`:"",O=y instanceof Array&&1===y.length&&y[0],L=O?`padding: ${O.top}px ${O.right}px ${O.bottom}px ${O.left}px;`:"",W=O?`padding: calc(${O.top}px * 0.5) calc(${O.right}px * 0.5) calc(${O.bottom}px * 0.5) calc(${O.left}px * 0.5);`:"",D=void 0!==_&&_?`border-width: ${_}px; border-style: solid;`:"",V=[v,_].every(e=>void 0!==e)&&_?`border-color: ${v};`:"",q=void 0!==w?`border-radius: ${w}px;`:"",M=void 0!==f?`background-color: ${f};`:"",H=void 0!==T?`color: ${T};`:"",U=void 0!==o&&"popin"===o?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==h?h:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",G=i||void 0!==b&&b?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",x,"}"].join(""):"";return S.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,$,E,C,N,A,x,k,I,B,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;",L,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,D,V,q,M,H,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,R,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,W,"}","}",U,G,`${t}`].join(""),S}}class Ce extends Ee{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class Ne extends Ee{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class Ae extends Ee{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const xe=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new Ce;break;case"bannerTop":case"bannerBottom":t=new Ne;break;case"free":t=new Ae;break;default:t=new Ee}return t},ke=[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],Ie={category:h,type:I,min:1},Pe=[{...Ie,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...Ie,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...Ie,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],Be={category:h,type:"select",options:ke,value:"everytime"},Re={...Be,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},Oe=Pe.map(e=>({...e,propName:`${Re.propName}_${e.propName}`,conditions:[{field:Re.propName,value:e.propName}]})),Le={...Be,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},We=Pe.map(e=>({...e,propName:`${Le.propName}_${e.propName}`,conditions:[{field:Le.propName,value:e.propName}]})),De={...Be,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},Ve=Pe.map(e=>({...e,propName:`${De.propName}_${e.propName}`,conditions:[{field:De.propName,value:e.propName}]})),qe={category:h,type:R,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[Re,...Oe,Le,...We,De,...Ve]},je={category:h,type:I,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},Me={...je,propName:"triggerEventReengageDelay",value:10,max:180},He={category:h,type:"selectelement",propName:"triggerEventClick",value:"body"},Ue={...He,propName:"triggerEventElementVisible"},Ge={category:h,type:"textarea",label:"widget_common_conditions_triggering_option_customTrigger",propName:"triggerEventCustomScript",value:"/* In this example snippet, the widget will be triggered as soon as any scroll is detected.\nCreate your own by resolving resolve() with true (which does trigger) or false (which doesn't trigger) */\n\nfunction launchIfScroll() {\n\treturn new Promise(resolve => {\n\t\tdocument.addEventListener('scroll', () => resolve(true), {once: true});\n\t});\n}\n\nconst result = await launchIfScroll();\nreturn resolve(result);",rows:15},Ke={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},Ye={category:h,type:"switch",propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},ze={category:h,type:"switch",propName:"autoHide",value:!0,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterRedirection"},Fe={category:h,type:I,propName:"timeHide",value:2,max:120,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterXSeconds",conditions:[{field:"autoHide",value:!0}]},Xe={category:h,type:"select",label:"widget_common_conditions_triggering_label",options:Object.keys(Ke).map(e=>Ke[e]),propName:"triggerEvent",value:"pageLoad"};He.conditions=[{field:"triggerEvent",value:"click"}],Me.conditions=[{field:"triggerEvent",value:"reengage"}],Ue.conditions=[{field:"triggerEvent",value:"elementVisible"}],Ge.conditions=[{field:"triggerEvent",value:"script"}],je.conditions=[{field:"triggerEvent",value:e=>"reengage"!==e}],Ye.conditions=[{field:"triggerEvent",value:e=>"click"===e||"script"===e}];const Je=[He,Ue,Ge,Ye,Me,je],Qe={category:h,type:R,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[Xe,...Je]};function Ze(e){const t=e.reduce((e,t)=>[...e,Ke[t]],[]),i=Je.reduce((t,i)=>{const{conditions:o}=i;return o&&o.some(({value:t})=>e.includes(t))?[...t,i]:t},[]),o={...Xe,options:t,value:e[0]};return{category:h,type:R,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[o,...i]}}const et={category:"content",propName:"button",type:"switch",value:!1,label:"widget_common_content_toggler_label_displayButton"},tt={category:"content",propName:"buttonText",type:"text",label:"widget_common_content_label_buttonText",value:"widget_common_content_buttonText_default"},it={category:"content",propName:"buttonLink",type:"text",label:"widget_common_content_label_buttonUrl",value:location.origin,conditions:[{field:"button"}]},ot={category:"content",propName:"buttonTargetType",type:"switch",label:"widget_common_content_button_label_openLinkNewTab",value:!1,conditions:[{field:"button"}]},rt=[{field:"button"}];tt.conditions=rt,it.conditions=rt,ot.conditions=rt;const st={category:"content",type:R,label:"widget_common_tabName_content",collapsible:!1,children:[et,tt,it,ot]},nt={category:"layout",type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:`${W}layout/icon-layout-modal.png`},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:`${W}layout/icon-layout-topBanner.png`},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:`${W}layout/icon-layout-bottomBanner.png`},{label:"widget_common_layout_option_freePlacement",value:"free",src:`${W}layout/icon-layout-freePlacement.png`}]},at={category:"layout",type:"selectelement",propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},lt={category:"layout",type:"radio",propName:"referrerInsertType",value:"afterbegin",label:"widget_common_layout_positioning_label_selectPosition",options:[{label:"widget_common_layout_positioning_option_before",value:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheBeginning",value:"afterbegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},ct=[{field:"layout",value:"free"}];at.conditions=ct,lt.conditions=ct;const dt={category:"layout",type:R,label:"widget_common_tabName_layout",collapsible:!0,children:[nt,at,lt]},ht={category:l,type:"colorpicker",label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:H},gt={category:l,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:""},ut={category:l,type:"colorpicker",label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},mt={category:l,type:I,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},pt={category:l,type:I,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},yt={category:l,type:"colorpicker",label:"widget_common_style_text_label_textColor",propName:"textColor",value:"rgba(57, 57, 57, 1)"},bt={category:l,type:"radioImage",label:"widget_common_style_text_label_textAlignment",propName:"textAlign",value:"center",style:"little",options:[{label:"widget_common_style_text_textAlignment_option_left",value:"left",src:`${W}style/icon-text-alignLeft.png`},{label:"widget_common_style_text_textAlignment_option_center",value:"center",src:`${W}style/icon-text-alignCenter.png`},{label:"widget_common_style_text_textAlignment_option_right",value:"right",src:`${W}style/icon-text-alignRight.png`}]},_t={category:l,type:"areainput"},vt={..._t,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},wt={..._t,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},ft={category:l,type:"switch",label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},Tt={category:l,type:"colorpicker",label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},St={category:l,type:I,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},$t={category:l,type:"switch",label:"widget_common_style_container_label_displayCloseButton",propName:"closeButton",value:!0},Et={category:l,type:"colorpicker",label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Ct={category:l,type:"switch",label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},Nt={category:l,type:I,label:"widget_common_style_buttons_label_buttonBorderThickness",propName:"buttonsBorderWidth",value:1,min:0,max:30,unit:"px"},At={category:l,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBorderColor",propName:"buttonsBorderColor",value:"rgba(87, 184, 199, 1)"},xt={category:l,type:I,label:"widget_common_style_buttons_label_buttonBorderRadius",propName:"buttonsBorderRadius",value:4,min:0,max:30,unit:"px"},kt={category:l,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBackgroundColor",propName:"buttonsBackgroundColor",value:"rgba(0, 127, 145, 1)"},It={category:l,type:"colorpicker",label:"widget_common_style_buttons_label_buttonTextColor",propName:"buttonsTextColor",value:H},Pt={category:l,type:R,label:"widget_stickyElement_content_positionOn_option_background",collapsible:!0,children:[ht,gt]},Bt=[{field:pt.propName,value:e=>e>0}];ut.conditions=Bt;const Rt={category:l,type:R,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[pt,ut,mt]},Ot={category:l,type:R,label:"widget_common_style_blockTitle_text",collapsible:!0,children:[bt,yt]},Lt=[{field:"dropShadow",value:!0}];Tt.conditions=Lt,St.conditions=Lt;const Wt={category:l,type:R,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[vt,wt,ht,ft,Tt,St,$t]},Dt={category:l,type:R,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[Et,Ct],conditions:[{field:"layout",value:"popin"}]},Vt=[{field:Nt.propName,value:e=>e>0}];At.conditions=Vt;const qt={category:l,type:R,label:"widget_common_style_blockTitle_buttons",collapsible:!0,children:[Nt,At,xt,kt,It]};export{W as ABTASTY_IMAGES_ROUTE,O as AREAINPUT,M as BLACK,Ne as Banner,v as CHECKBOX,f as COLOR_PICKER,h as CONDITIONS,d as CONTENT,U as DARK_GRAY,G as DARK_TURQUOISE,T as DATE_PICKER,B as DATE_RANGE_PICKER,Ae as Free,R as GROUP,g as HIDDEN,L as INLINE_NOTIFICATION,c as LAYOUT,H as LIGHT_GREY,K as LIGHT_TURQUOISE,P as MEDIA_UPLOAD,$ as NUMBER,p as PARAGRAPH,$e as PageWatcher,Ce as Popin,A as RADIO_BUTTON,x as RADIO_IMAGE,q as REBUILD_WIDGET,V as REMOVE_WIDGET,fe as Recurrence,_ as SELECT,N as SELECT_ELEMENT,u as SEPARATOR,m as SHORT_SEPARATOR,I as SLIDER,X as SOCIAL_PROOF_API_BASE,l as STYLE,k as SWITCH,D as TAG_RESET_EVENT,z as TASTY_GREEN,Y as TASTY_RED,F as TASTY_YELLOW,E as TEXT_AREA,y as TEXT_FIELD,S as TIME_PICKER,Se as Trigger,b as URL_FIELD,C as VARIABLES_INPUT,j as WHITE,w as WYSIWYG,Ee as WidgetContainer,t as addGlobalUtil,_e as addPolyfill,ge as allowGlobalScroll,ye as asyncRequest,ze as autoHideForm,ht as backgroundColorForm,gt as backgroundImageForm,Pt as backgroundsGroup,ut as borderColorForm,mt as borderRadiusForm,pt as borderWidthForm,Rt as bordersGroup,it as buttonLinkForm,st as buttonLinkGroup,ot as buttonTargetTypeForm,tt as buttonTextForm,kt as buttonsBackgroundColorForm,At as buttonsBorderColorForm,xt as buttonsBorderRadiusForm,Nt as buttonsBorderWidthForm,qt as buttonsGroup,It as buttonsTextColorForm,Le as closingRecurrenceForm,Wt as containerGroup,$t as displayCloseButtonSwitchForm,Re as displayRecurrenceForm,St as dropShadowBlurForm,Tt as dropShadowColorForm,ft as dropShadowSwitchForm,at as elementReferrerForm,ce as findParent,i as getAccountIdentifier,we as getCookie,Ze as getCustomTriggersGroup,ne as getGroupSettedValues,se as getHostname,Q as getPrettyWidgetName,s as getProductKey,ee as getRecurrenceParams,te as getTriggerParams,Z as getUniqueId,r as getVisitorId,xe as getWidgetContainer,J as getWidgetName,n as isAffected,a as isInQaMode,e as isOnEditor,o as isOnPreview,me as isTouch,ie as isTriggerOncePerPage,dt as layoutGroup,nt as layoutsForm,ue as loadImage,be as loadJS,oe as log,vt as marginForm,Ct as olverlayCloseOnClickForm,Et as overlayColorForm,Dt as overlayGroup,wt as paddingForm,he as preventGlobalScroll,ae as promiseDeferrer,qe as recurrencesGroup,lt as referrerInsertTypeForm,ve as setCookie,et as switchButtonForm,pe as syncRequest,bt as textAlignmentForm,yt as textColorForm,Ot as textGroup,Fe as timeHideForm,je as triggerDelay,Ge as triggerEventCustomScript,Ue as triggerEventElementVisible,Me as triggerEventReengageDelay,Ye as triggerOncePerPage,Xe as triggersForm,Qe as triggersGroup,Ke as triggersOptions,De as validationRecurrenceForm,le as waitForElement,re as widgetLog};
{
"name": "@abtasty/widget-utils",
"version": "1.16.5",
"version": "1.16.6-0",
"main": "dist/widget-utils.cjs.js",

@@ -5,0 +5,0 @@ "module": "dist/widget-utils.esm.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc