@abtasty/countdown 3.7.4 → 3.7.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main.js +1 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";const t=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),e=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},n=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),o=()=>window.ABTasty&&!0===window.ABTasty.consentReady,s="remove",i="rebuild",a="update",r=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},c=()=>{const t=r();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},d=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,l=n=>{if((()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})()){const t=c();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${n}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},h=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},u=(t,e)=>{const n=()=>{try{return document.querySelector(t)}catch(t){return null}};let o=n();const s=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],i=()=>r.disconnect(),a=()=>r.observe(...s),r=new MutationObserver(()=>(o=n(),o&&!i()&&e(o)));return o?setTimeout(()=>e(o),0):a(),{selector:t,clear:i,observe:a}};function m(t,e){return e(t)||!t.parentElement?t:m(t.parentElement,e)}const g=e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},y=(t,e)=>[...document.querySelectorAll(e)].some(n=>n.isSameNode(t)||!!t.closest(e));class b{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&t.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),t}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:o})=>{if(n.isSameNode(t))return!0;const s=[...t.querySelectorAll(o)];if(s.length&&s.includes(n))return!0;if(e.includes(n))return!0;const i=[...t.parentElement.children],a=i.findIndex(e=>e.isSameNode(t)),r=i.filter((t,e)=>e>a);if(r.length){if(r.includes(n))return!0;if(r.some(t=>[...t.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:o}=n,s=this.targets.find(e=>e.selector===t&&e.uniqueId===o);s&&s.resolve(e),this.clear(t,o)}}mouseOverHandler(){const t=["mouseover",t=>setTimeout(()=>this.onMouseOver(t),50),!0];return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===m(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let o=!1,s=0;for(;!o&&s<n.length;){const e=document.elementFromPoint(...n[s]);o=t===e||t.contains(e),s+=1}return o}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const o=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return o&&o.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n});const o=()=>{this.startMutationObserver(),this.checkElements()};document.body?o():u("body",o)}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:o})=>n!==t&&o!==e));const n=document.querySelector(t);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class w{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[],this.socialProofStore={}}async onElementVisible({promise:t,resolve:e}){const n=h(`${this.event}DomReady`);this.promises.push(n);const o=await this.onPageLoad(n),s=await async function(){let t;return t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||new Promise((t,e)=>{const n=window.document.getElementsByTagName("script")[0],o=window.document.createElement("script");o.src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",n.parentNode.insertBefore(o,n),o.onload=t,o.onerror=e})),t}(),i=new b;if(this.visibilityObservers.push(i),s&&o){const t=d();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const o=["readystatechange",({isTrusted:t})=>t&&n()&&e(!0),{passive:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id=`Click_${d()}`,n.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(n),this.elementsSelectors.push(`#${n.id}`);const o=["click",({isTrusted:t,target:n})=>t&&y(n,this.selector)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}onHover({promise:t,resolve:e}){const n=["mouseenter",({isTrusted:t,target:n})=>t&&y(n,this.selector)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...n]),document.documentElement.addEventListener(...n),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",({isTrusted:t,clientY:n})=>{t&&n<=0&&e(!0)},{passive:!0}],o=u("body",t=>{this.eventsListeners.push([t,...n]),t.addEventListener(...n),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==o)});return this.elementsWaiters.push(o),t}onReengage({promise:t,resolve:e}){const n=this.delay;let o=n;const s=[({isTrusted:t})=>{t&&(o=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{this.eventsListeners.push([document,t,...s]),document.addEventListener(t,...s)});const i=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(i),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}onScrollUp({promise:t,resolve:e}){let n=0;const o=["scroll",({isTrusted:t})=>{t&&(window.pageYOffset<n?e(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}onScrollPercentReached({promise:t,resolve:e}){const{triggerEventScrollPercent:n}=DATA,o=["scroll",({isTrusted:t})=>{if(!t)return;const o=(()=>{const{documentElement:t,body:e}=document,n=t.scrollTop||e.scrollTop,o=t.scrollHeight||e.scrollHeight;return Math.trunc(n/(o-t.clientHeight)*100,10)})();n<o&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}checkSocialProofConditions(t,e,n,o){const s=(()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t})(),{viewInterval:i,spNoTrim:a}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?o(`${this.socialProofStore[t][i]}`):o(!1);else if(t&&s){const r=e=>(this.socialProofStore[t]=e,o(!!n(e)&&`${e[i]}`));fetch(`https://api-social-proof.abtasty.com/clients/${s}/metrics/${e}?key=${t}${a?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(r).catch(()=>l("Failed to fetch datas from server."))}else o(!1)}getSocialProofPurchases({promise:t,resolve:e}){const n=window.ABTastyProductKey,{viewInterval:o,triggerSocialProofMinPurchases:s}=DATA;return n||(l("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://abtasty.elevio.help/en/articles/190-social-proof-prerequisites"),e(!1)),this.checkSocialProofConditions(n,"i",t=>{if(void 0===o||void 0===s)return!1;const e=void 0!==t[o]&&t[o]>=s;return e||l(`Widget will not be shown, product has been purchased ${t[o]} times while ${s} are required`),e},e),t}getSocialProofPageViews({promise:t,resolve:e}){const{viewInterval:n,triggerSocialProofMinPageViews:o,spNoTrim:s}=DATA,i=encodeURIComponent(s?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`);return this.checkSocialProofConditions(i,"pv",t=>{if(void 0===n||void 0===o)return!1;const e=void 0!==t[n]&&t[n]>=o;return e||l(`Widget will not be shown, page has been seen ${t[n]} times while ${o} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!o()){const n=["abtasty_consentValid",()=>e(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),t}return e(!0),t}onTrackingSent({promise:t,resolve:e}){const{triggerEventTrackingSent:n}=DATA;let o=localStorage.getItem("ABTastyData");const s=()=>JSON.parse(o).ActionTracking.find(({name:t})=>t===n),i=["storage",()=>{o=localStorage.getItem("ABTastyData"),s()&&e(!0)},{passive:!0,capture:!0}];return o&&s()?e(!0):(()=>{this.eventsListeners.push([window,...i]),window.addEventListener(...i)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let o=localStorage.getItem("ABTastyData");const s=()=>n<=(o?JSON.parse(o).VisitedPages.length:0),i=["storage",()=>{o=localStorage.getItem("ABTastyData"),s()&&e(!0)},{passive:!0,capture:!0}];return o&&s()?e(!0):(()=>{this.eventsListeners.push([window,...i]),window.addEventListener(...i)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:o}=DATA;let s=0,i=!1;const a=["click",({isTrusted:t})=>{t&&(s+=1,s>=n&&e(!0),i||(i=!0,setTimeout(()=>{s=0,i=!1},o)))},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...a]),document.addEventListener(...a),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]=t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.visibilityObservers.length){const t=d();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const t=h(this.event);this.promises.push(t);const e={consent:()=>this.onConsent(t),direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),hover:()=>this.onHover(t),scrollUp:()=>this.onScrollUp(t),scrollPercent:()=>this.onScrollPercentReached(t),rageClick:()=>this.onRageClick(t),minPagesViewed:()=>this.onMinPagesViewed(t),trackingSent:()=>this.onTrackingSent(t),socialProofPurchases:()=>this.getSocialProofPurchases(t),socialProofPageViews:()=>this.getSocialProofPageViews(t)},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=h(`${this.event}Delay`);return this.promises.push(t),setTimeout(()=>{t.resolve(!0),this.clear()},this.delay),t.promise})():n}}const p="closing",v="validation",f="ABTastyWidgets",x="ABTastyWidgetsTemporary";class T{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},o){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=o,this.widgetName=r(),this.uniqueId=d(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:t}){const e=localStorage.getItem(x),n=sessionStorage.getItem(f);"ABTastyData"===t&&!e&&n&&localStorage.setItem(x,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(f);return JSON.parse(e)}catch(e){return t.removeItem(f),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...o}=e;return Object.entries(o).length?(t.setItem(f,JSON.stringify(o)),o):(t.removeItem(f),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem(x),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(f,t),localStorage.removeItem(x));const n=this.getLocalRecurrence(),o=(n?parseFloat(n.stamp):0)<(new Date).getTime();return o&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&o&&!this.getLocalRecurrence()&&!e}setRecurrence(t,n){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const s=this.getTypeOfStorage(t);if(e()||!s&&"object"!=typeof s)return!1;const{storageString:i,storageMethod:a}=s,r=this.getStamp(t),c={type:n,stamp:r},{type:d}=this.getCurrentRecurrence(),l=async()=>{if(!o()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new w({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===i?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const s=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};a.setItem(f,JSON.stringify(s)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!a)return!1;if(d&&n!==v)if(n===p&&d!==v)l();else{if("display"!==n||d===v||d===p)return!1;l()}else l();return r}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class S{constructor(t,e,n,o){this.recurrence=t,this.isWidgetApplied=e,this.callback=n,this.shouldUpdate=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(t){const e=n(),{type:o}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let r;const c=this.isWidgetApplied(),d=(()=>{const e=this.recurrenceIsDone();return t&&"display"===o||e})(),l=!c&&e&&d,h=c&&(!e||!d),u=!c&&!e,m=this.shouldUpdate&&!t&&e&&d;return m?r=a:l?r=i:h||u?r=s:m&&(r=a),"string"==typeof r&&(this.clearWatcher(),this.callback(r,t),this.watch()),this}eventHandler(){let t=n();return[250,500].forEach(e=>{setTimeout(()=>{const o=n();return 500===e&&o===t?this:(t=o,this.decisionHandler(!1))},e)}),this}observerHandler(t){return t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler(!0):this}watch(){if(t())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const e=()=>{const t=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...t)};return document.body?e():(()=>{const t=u("body",()=>{e(),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});this.elementsWaiters.push(t)})(),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const $=/.+\/([^.]+)\.(otf|ttf)$/,C=["socialProofPurchases","socialProofPageViews"];class A{constructor(){this.children=void 0,this.uniqueId=d(),this.widgetName=r(),this.prettyName=c(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:o}=DATA;if(t()||!e&&!n&&!o)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[`${t}_day`],week:t=>7*DATA[`${t}_week`],month:t=>30.5*DATA[`${t}_month`]},i={};return e&&(i.displayRecurrence=s[e]("displayRecurrence")),n&&(i.closingRecurrence=s[n]("closingRecurrence")),o&&(i.validationRecurrence=s[o]("validationRecurrence")),i})(),this.triggerParams=(()=>{let{triggerEvent:e}=DATA;const{triggerEventClick:n,triggerEventHover:o,triggerEventReengageDelay:s,socialProofContentType:i,triggerEventElementVisible:a,triggerEventDelay:r}=DATA;if(t()||!e&&!i)return!1;const c={click:()=>n,hover:()=>o,elementVisible:()=>a},d=Object.prototype.hasOwnProperty.call(c,e)?c[e]():"body",l="reengage"===e?s:r;return i&&(e=1===i?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:e,triggerSelector:d,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new T(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new w(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&C.includes(this.triggerParams.triggerEvent),this.pageWatcher=new S(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;return!e||!["click","hover","scrollUp","script"].includes(e)||t})(),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(t=>document.removeEventListener(...t)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const t=new Promise(t=>{const e=u("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(({selector:t})=>"head"!==t),t(e.appendChild(this.styleElement))});this.elementsWaiters.push(e)}),e=new Promise(t=>{const{elementReferrer:e="body",referrerInsertType:n="beforeend"}="free"===DATA.layout?DATA:{},o=u(e,o=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==e),this.removeOldDomElement(),t(o.insertAdjacentElement(n,this.domElement))});this.elementsWaiters.push(o)});return Promise.all([e,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(t=>t&&t.isConnected&&t.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():t()||this.init().then(({response:t})=>t?this.show():this),this}show(){return t()||this.hasBeenShown&&this.hasOncePerPageTrigger||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(e=!0){return!t()&&this.hasBeenShown&&e&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),e&&(this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(e){const o=t(),s=n(),i=this.trigger&&this.trigger.promises.length,a=!this.recurrence||this.recurrence.isOver();if(!o&&!s||i||!a)return!1;this.pageWatcher.watch();const r=o||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!r&&(await this.insert(),this.addCloseEvent(),o||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(r),{container:this,response:r})}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>t?this.show():this.hide(!1));e||(this.hasBeenShown=!1);const o=this.isWidgetApplied(),r={[s]:()=>{o?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch())},[i]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():o||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):n()},[a]:n};"function"==typeof r[t]&&r[t]()}addCloseEvent(...e){const{closeButton:n,overlay:o,overlayClickable:s,layout:i,animationDuration:a=1e3}=DATA,r=[];if(void 0!==o&&!0!==o||!0!==s||"popin"!==i||r.push(`.${this.overlayClassName}`),void 0!==n&&n&&r.push(`.${this.closeButtonClassName}`),!r.length)return this;const c=this.domElement.querySelectorAll(r.join(", "));return c.length?(e.push(...c),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.addEventListener("click",t=>{g(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*a)},{once:!0,capture:!0})}),this):this}getDom(){const{closeButton:t,layout:e,overlay:n=!0}=DATA,o=document.createElement("div");return o.className=`${this.basicClassName} ${this.hideClassName}`,o.id=this.widgetContainerId,o.innerHTML=`\n\t\t\t${"popin"===e&&!0===n?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}"><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}loadFont(t,e){if(!t||"inherit"===t)return;const n=document.createElement("style"),o=e.match($)?e.match($)[1]:"";n.innerHTML=`@font-face { font-family: '${t}_${o}'; src: url('${e}'); font-display: swap; }`,document.head.appendChild(n)}getStyleTag(e="",n=DATA){const{noStyles:o,layout:s}=n,{backgroundColor:i,isBackgroundImage:a,backgroundImage:r,backgroundSize:c,backgroundPosition:d,backgroundRepeat:l,borderColor:h,borderRadius:u,borderWidth:m,textColor:g,textAlign:y,fontName:b,fontStyle:w,fontSize:p,isTitle:v,titleTextAlign:f,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:C,overlay:A,overlayColor:E,dropShadow:k,dropShadowColor:B,dropShadowBlur:L,containerMargin:I,containerPadding:P,closeButton:N,closeButtonPosition:_,closeButtonSize:R,closeButtonBorderRadius:D,closeButtonBorderWidth:O,closeButtonBorderColor:W,closeButtonColor:q,closeButtonBackgroundColor:V,buttonsAlign:H,buttonsBorderWidth:M,buttonsBorderColor:j,buttonsBorderRadius:F,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:Y,buttonsFontStyle:G,buttonsFontSize:K,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:Z,secondLinkBorderRadius:X,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:ot,secondLinkFontSize:st,animation:it,animationDuration:at,animationBehaviour:rt,animationSlideDirection:ct}=o?{}:n,dt=document.createElement("style");dt.type="text/css",t()&&dt.setAttribute("abtasty-script-added","true"),this.loadFont(b,w),this.loadFont(T,S),this.loadFont(Y,G),this.loadFont(nt,ot);const lt=`background: ${["string"==typeof i?i:"rgba(255, 255, 255, 1)",a&&"string"==typeof r&&r.length?`url(${r})`:"",a&&"string"==typeof d&&"100% 100%"!==c?d:"0 0",a&&"string"==typeof c?`/ ${c}`:"/ auto",a&&l&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ht="number"==typeof m&&m>0,ut=`border: ${[ht?`${m}px`:"unset",ht?"solid":"",ht&&"string"==typeof h&&h.length?h:""].join(" ").trim()};`,mt=void 0!==u?`border-radius: ${u}px;`:"",gt=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",yt=void 0!==y?`text-align: ${y};`:"",bt=b&&"inherit"!==b?`font-family:${b}_${w.match($)?w.match($)[1]:""};`:w||"",wt=p?`font-size: ${p}px;`:"",pt=void 0!==k&&k?`box-shadow: 0 5px ${L}px 0 ${B};`:"",vt=I instanceof Array&&1===I.length&&I[0],ft=vt?`margin: ${vt.top}px ${vt.right}px ${vt.bottom}px ${vt.left}px;`:"",xt=vt?`margin: calc(${vt.top}px * 0.5) calc(${vt.right}px * 0.5) calc(${vt.bottom}px * 0.5) calc(${vt.left}px * 0.5);`:"",Tt=P instanceof Array&&1===P.length&&P[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",$t=Tt?`padding: calc(${Tt.top}px * 0.5) calc(${Tt.right}px * 0.5) calc(${Tt.bottom}px * 0.5) calc(${Tt.left}px * 0.5);`:"",Ct=void 0!==M&&M?`border-width: ${M}px; border-style: solid;`:"",At=[j,M].every(t=>void 0!==t)&&M?`border-color: ${j};`:"",Et=void 0!==F?`border-radius: ${F}px;`:"",kt=void 0!==z?`background-color: ${z};`:"",Bt=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Lt=Y&&"inherit"!==Y?`font-family:${Y}_${G.match($)?G.match($)[1]:""};`:G||"",It=K?`font-size: ${K}px;`:"",Pt=void 0!==Q&&Q?`border-width: ${Q}px; border-style: solid;`:"",Nt=[Z,Q].every(t=>void 0!==t)&&Q?`border-color: ${Z};`:"",_t=void 0!==X?`border-radius: ${X}px;`:"",Rt=void 0!==tt?`background-color: ${tt};`:"",Dt=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Ot=nt&&"inherit"!==nt?`font-family:${nt}_${ot.match($)?ot.match($)[1]:""};`:ot||"",Wt=st?`font-size: ${st}px;`:"",qt="popin"!==s||void 0!==A&&!0!==A?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==E?E:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Vt="number"==typeof R?R:16,Ht=Vt/2,Mt=o||void 0!==N&&N?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===_?`bottom: calc(100% + ${Ht}px)`:`top: ${Ht}px`)+";",`right: ${Ht}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof D?`border-radius: ${D}px;`:"","number"==typeof O&&O>0?`border: ${O}px solid ${void 0!==W?W:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Vt}px;`,`height: ${Vt}px;`,"string"==typeof q?`fill: ${q};`:"","}"].join(""):"",jt=v&&"string"==typeof x?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${x}; fill: ${x}; -webkit-text-fill-color: ${x};`,void 0!==f?`text-align: ${f};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match($)?S.match($)[1]:""};`:S||"",C?`font-size: ${C}px;`:"","}"].join(""):"";let Ft="";if("string"==typeof it){const e=(at/1e3).toFixed(2),n=["top","bottom"].includes(ct),o=Number(n),s=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[o]:"0"];n&&s.reverse(),Ft={none:[],fade:[`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${rt};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${rt};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${s.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${rt};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":it].join("")}const zt=[`#${this.widgetContainerId} .${this.contentClassName} > * a:nth-child(2), `,`#${this.widgetContainerId} .${this.contentClassName} > * button:nth-child(2) {`,`margin-${"fill"===H?"top":"left"}: 8px;`,Pt,Nt,_t,Rt,Dt,Ot,Wt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a:nth-child(2) *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button:nth-child(2) * {`,Dt,Ot,Wt,"}"];return dt.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,lt,mt,ut,gt,yt,pt,ft,bt,wt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,gt,yt,bt,wt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",St,bt,wt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,"box-sizing: border-box;","display: inline-block;",Ct,At,Et,kt,Bt,Lt,It,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,Bt,Lt,It,"}",...J?zt:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,xt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,$t,"}","}",qt,Mt,jt,Ft,`${e}`].join(""),dt}}const E=["top: 0;","top: 50%;","bottom: 0;"],k=["left: 0;","left: 50%;","right: 0;"],B=t=>1===t?"-50%":0,L=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${B(e)}, ${B(t)});`;return`${E[t]}${k[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},I=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,P=()=>{if(I())return"width: auto; height: auto; min-width: max-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:o,popinPercentHeight:s,popinPixelsHeight:i,heightUnit:a}=DATA;return`width: ${"px"===n?e:t}${n};height: ${o?"auto":`${"px"===a?i:s}${a}`};`};class N extends A{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(t=>B(t)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e,overlay:n}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===t?e:t};`,"background: none;","pointer-events: "+(!1===n?"none":"all"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",L(),P(),"pointer-events: all","}",`${I()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!I()&&["px","em"].includes(widthUnit)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class _ extends A{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===t?e:t};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class R extends A{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}t()&&Number(ABTASTY_S.USER.additionalInformation.account_iframe_less_mode);const D=["fr","en","de","es"],O=["day","hour","minute","second"],W={day:{en:"Day",fr:"Jour",es:"Dia",de:"Tag"},days:{en:"Days",fr:"Jours",es:"Dias",de:"Tage"},hour:{en:"Hour",fr:"Heure",es:"Hora",de:"Zeit"},hours:{en:"Hours",fr:"Heures",es:"Horas",de:"Stunden"},minute:"Min",second:{en:"Sec",fr:"Sec",es:"Seg",de:"Sek"}},q="line",V=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",H=(t=>D.indexOf(t)>-1)(V)?V:"en",M={day:W.day[H],days:W.days[H],hour:W.hour[H],hours:W.hours[H],minute:W.minute,minutes:W.minute,second:W.second[H],seconds:W.second[H]};let j=function(){function e(t,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.testId=t,this.data=n,this.targetselector=n.selector,this.container=this.createContainer(),this.digitElements={},this.textElements={},this.timeElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=M,this.fonts=[],this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})}var n,o;return n=e,o=[{key:"getFonts",value:function(){return[{name:this.data.messageFontName,style:this.data.messageFontStyle},{name:this.data.numbersfontName,style:this.data.numbersfontStyle},{name:this.data.legendfontName,style:this.data.legendfontStyle}]}},{key:"remove",value:function(){const{animationDuration:t}=DATA;setTimeout(()=>this.parentContainer.remove(),1.05*t)}},{key:"addCloseEvent",value:function(e){e&&e.addEventListener("click",e=>{g(e),t()||this.parentContainer.recurrence.setClosingRecurrence(),this.parentContainer.hide(),this.remove()},{capture:!0,passive:!1})}},{key:"addRedirectionEvent",value:function(e){!t()&&e&&e.addEventListener("click",()=>{const{autoHide:t,timeHide:e}=DATA;t&&setTimeout(()=>{this.parentContainer.hide(),this.remove()},1e3*e),this.parentContainer.recurrence.setValidationRecurrence()},{useCapture:!0,once:!0})}},{key:"createContainer",value:function(){const{linkType:t,redirectionUrl:e,openInNewTab:n}=DATA,o=document.createElement(t&&t.includes("widget")?"a":"div");switch(o.classList.add("abtasty-countdown"),t){case"widget":o.href=e,o.target=n?"_blank":"_self",this.addRedirectionEvent(o);break;case"widgetClose":o.href="#",o.dataset.abtastyActionnable="true",this.addCloseEvent(o)}return o}},{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){O.forEach(e=>{let n=t[e];String(n).length<2&&(n="0".concat(n)),this.digitElements[e].textContent=n,this.textElements[e].textContent=1===n?this.unitsText[e]:this.unitsText["".concat(e,"s")],this.maxWidth<this.digitElements[e].offsetWidth&&(this.maxWidth=this.digitElements[e].offsetWidth,this.digitElements[e].style.minWidth="".concat(this.maxWidth,"px"),window.requestAnimationFrame(()=>{this.setText(t)})),this.digitElements[e].style.minWidth="".concat(this.maxWidth,"px")})}},{key:"onTimeEnd",value:function(){const{endSettings:t}=this.data;if(clearInterval(this.timeLoop),"hideWidget"===t)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");const e={endText:!0,endCountdown:["showText","showTextAndButton"].includes(t),endButton:["hideCountdownAndShowTextAndButton","showTextAndButton"].includes(t)},n=["abtasty-countdown-".concat(t),"abtasty-countdown-finish"];Object.keys(e).forEach(t=>{const o="abtasty-countdown-".concat(t),s=e[t]?"show":"hide";n.push("".concat(o,"-").concat(s))}),this.container.classList.add(...n)}},{key:"setCountdown",value:function(){const e=new Date;let n=function(e,n){switch(e.type){case"global":return e.timestamp-n.getTime();case"local":if(t())return e.previewTimestamp-n.getTime();const{year:o,month:s,day:i,hour:a,minute:r}=e.timecomponents;return new Date(o,s-1,i,a,r).getTime()-n.getTime();default:return 0}}(this.data.dateTime,e)/1e3;if(window.ABTastyEditor&&("ifEnded"===this.data.previewBlock&&(n=-1),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();const o=Math.floor(n/86400);n-=86400*o;const s=Math.floor(n/3600);n-=3600*s;const i=Math.floor(n/60);n-=60*i;const a=Math.floor(n);this.setText({day:o,hour:s,minute:i,second:a})}},{key:"getStyle",value:function(){this.loadFonts();const{buttonsAlign:t}=DATA,e=void 0!==t&&"fill"!==t?"text-align: ".concat(t,";"):"";return"\n .abtasty-countdown-bottom-button,\n .abtasty-countdown-finish-button {\n ".concat(e,"\n }\n .abtasty-countdown-bottom-button a,\n .abtasty-countdown-finish-button a {\n width: ").concat("fill"===t?"100%":"auto",";\n }\n\n .abtasty-countdown .abtasty-countdown-finish-text,\n .abtasty-countdown .abtasty-countdown-top-message,\n .abtasty-countdown .abtasty-countdown-finish-text *,\n .abtasty-countdown .abtasty-countdown-top-message * {\n white-space: pre-line;\n text-align: ").concat(this.data.messageAlign," !important;\n color: ").concat(this.data.textColor,";\n font-size: ").concat(this.data.messageFontSize,"px; \n ").concat(this.data.messageFontName&&"inherit"!==this.data.messageFontName?"font-family:".concat(this.data.messageFontName,"_").concat(this.data.messageFontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.messageFontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number,\n .abtasty-countdown .abtasty-countdown-elm-number * {\n font-size: ").concat(this.data.numbersfontSize,"px; \n color: ").concat(this.data.numberstextColor,";\n -webkit-text-fill-color: ").concat(this.data.numberstextColor,";\n font-weight: initial;\n ").concat(this.data.numbersfontName&&"inherit"!==this.data.numbersfontName?"font-family:".concat(this.data.numbersfontName,"_").concat(this.data.numbersfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.numbersfontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text,\n .abtasty-countdown .abtasty-countdown-elm-text * {\n ").concat(this.data.legendfontName&&"inherit"!==this.data.legendfontName?"font-family:".concat(this.data.legendfontName,"_").concat(this.data.legendfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.legendfontStyle||"",";\n font-size: ").concat(this.data.legendfontSize,"px; \n color: ").concat(this.data.legendtextColor,";\n -webkit-text-fill-color: ").concat(this.data.legendtextColor,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ").concat(this.data.countdownBorderRadius,"px;\n border: ").concat(this.data.countdownBorderWidth,"px solid ").concat(this.data.countdownBorderColor,";\n background-color: ").concat(this.data.numbersBackgroundColor,"; \n } \n ")}},{key:"setButton",value:function(){const t=(t,e,n,o)=>{const{uniqueId:s}=this.parentContainer,i=document.createElement("a");return i.className="popin_link_".concat(s),i.innerHTML="<span>".concat(t,"</span>"),i.href="button"===e?n:"#","button"===e?(i.target=o?"_blank":"_self",this.addRedirectionEvent(i)):(i.dataset.abtastyActionnable="true",this.addCloseEvent(i)),i},{linkType:e,buttonText:n,redirectionUrl:o,openInNewTab:s,secondLink:i,secondLinkText:a,secondLinkType:r,secondLinkURL:c,secondLinkOpenInNewTab:d,endBtnTargetBlank:l,endBtnLabel:h,endBtnLink:u}=DATA,m=this.container.querySelector(".abtasty-countdown-bottom-button"),g=[];if(e&&e.includes("button")){const l=t(n,e,o,s);if(g.push(l),i){const e=t(a,r,c,d);g.push(e)}}g.forEach(t=>m.appendChild(t));const y=this.container.querySelector(".abtasty-countdown-finish-button"),b=document.createElement("a");b.href=u,b.target=l?"_blank":"_self",b.innerHTML=h,y.appendChild(b)}},{key:"setContent",value:function(){const t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("p");e.innerHTML=this.data.message,t.appendChild(e);const n=this.container.querySelector(".abtasty-countdown-finish-text"),o=document.createElement("div");o.innerHTML=this.data.endMessage,n.appendChild(o)}},{key:"init",value:function(t){const{layout:e,inlineLayoutContent:n,imageOn:o,imagePosition:s}=this.data;try{this.parentContainer=t;const i=["free","popin"].includes(e);(n=>{this.container.classList.add("abtasty-countdown-layout-".concat(n)),n===q&&(i&&(this.parentContainer.domElement.querySelector(".".concat(t.contentClassName)).classList.add("abtasty-countdown-content-".concat(e,"-inline")),this.container.classList.add("abtasty-countdown-layout-".concat(e,"-inline"))),this.parentContainer.domElement.querySelectorAll(".".concat(t.closeButtonClassName)).forEach(t=>t.classList.add("abtasty-countdown-close-inline")))})(i&&!n?"free":q);const a="popin"===e||"free"===e&&!n;if(o){const{image:t}=this.data,e=new Image;e.src=t;const n=["abtasty-countdown-image"];a&&n.push("abtasty-countdown-image-popin-layout"),e.classList.add(...n),e.onload=async()=>{document.querySelector(".countdown_".concat(a?"popin":"banner","_img_container")).appendChild(e)}}const r=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"popin";return t?'<div class="countdown_'.concat(e,'_img_container"></div>'):""};this.container.innerHTML="\n ".concat(r(a&&!("popin"===e&&n),"popin"),'\n <div class="abtasty-countdown-layout-').concat(e,'">\n ').concat(r("before"===s,"banner"),'\n <div class="abtasty-countdown-clock">\n <div class="abtasty-countdown-days abtasty-countdown-elm-time">\n <div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n <div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n <div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n <div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n </div>\n </div>\n ').concat(r("after"===s,"banner"),'\n <div class="abtasty-countdown-top-message"></div>\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button"></div>\n </div>\n '),this.container.insertAdjacentElement("afterbegin",function(t){const e=document.createElement("style");return e.type="text/css",e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),e}("".concat("@media (max-width:579px){.ab_widget_container_countdown_content{width:100vw}}.abtasty-countdown,.abtasty-countdown>div{display:inline-block;text-align:center}.abtasty-countdown>div{margin:10px;overflow:auto;white-space:normal}.abtasty-countdown .countdown_popin_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;width:100%}.abtasty-countdown .countdown_popin_img_container:empty{display:none}.abtasty-countdown .abtasty-countdown-finish-text,.abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}.abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;margin:6px 6px 15px;padding:6px}.abtasty-countdown .abtasty-countdown-elm-text{text-align:center}.abtasty-countdown .abtasty-countdown-elm-number,.abtasty-countdown .abtasty-countdown-elm-text{font-stretch:normal;font-style:normal;font-weight:700;letter-spacing:normal;line-height:normal}.abtasty-countdown .abtasty-countdown-bottom-button a,.abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;display:block;display:inline-block;padding:6px 10px;text-align:center;text-decoration:none}.abtasty-countdown-layout-line>div{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:stretch;-ms-flex-pack:stretch;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:stretch}.abtasty-countdown-layout-line>div>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.abtasty-countdown-layout-free{display:block;text-align:center}.abtasty-countdown-layout-line>div{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-finish-text,.abtasty-countdown-layout-line .abtasty-countdown-top-message{-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:0;padding:0 5px 0 15px}.abtasty-countdown-layout-line .abtasty-countdown-top-message p{margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line{-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button,.abtasty-countdown-layout-line .abtasty-countdown-clock,.abtasty-countdown-layout-line .abtasty-countdown-finish-button{-ms-flex-negative:0;flex-shrink:0}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:55%!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:45%!important}.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:30%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:35%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:65%}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop{width:100%}.abtasty-countdown-content-popin-inline{max-width:inherit;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content}.abtasty-countdown-content-free-inline{max-width:100%}.abtasty-countdown-image-popin-layout{margin-bottom:20px}@media (max-width:740px){.abtasty-countdown-layout-line>div:not(.abtasty-countdown-layout-popin){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.abtasty-countdown-layout-line div.abtasty-countdown-finish-text,.abtasty-countdown-layout-line div.abtasty-countdown-top-message{margin-bottom:20px;margin-top:20px}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}.countdown_banner_img_container{display:none!important}}@media (max-width:570px){.abtasty-countdown-layout-free,.abtasty-countdown-layout-popin{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important;margin:10px 0!important}}.abtasty-countdown-layout-popin{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content}.countdown_banner_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;padding:0 15px}.countdown_banner_img_container img{max-height:67px;max-width:200px}"," ").concat(this.getStyle()))),O.forEach(t=>{const e=this.container.querySelector(".abtasty-countdown-".concat(t,"s")),[n,o]=e.children;this.digitElements[t]=n,this.textElements[t]=o,this.timeElements[t]=e}),this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),setTimeout(()=>{this.setCountdown()},100),this.setCountdown()}catch(t){console.warn("Countdown error occured during widget rendering:",t)}}},{key:"loadFonts",value:function(){this.getFonts().forEach(t=>{let{name:e,style:n}=t;if(!e||"inherit"===e)return;const o=document.createElement("style");o.appendChild(document.createTextNode(" @font-face { font-family: '".concat(e,"_").concat(n.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],"'; src: url('").concat(n,"'); } "))),document.head.appendChild(o)})}}],o&&function(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),e}();!async function(){const t=(()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new N;break;case"bannerTop":case"bannerBottom":e=new _;break;case"free":e=new R;break;default:e=new A}return e})();await t.init();const e=t.domElement.querySelector(".".concat(t.contentClassName)),n=new j(TEST_ID,DATA);n.init(t),n.insert(e,"beforeend"),t.show()}()}();
|
1
|
+
!function(){"use strict";const t=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),e=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},n=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),o=()=>window.ABTasty&&!0===window.ABTasty.consentReady,s="remove",i="rebuild",a="update",r=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},c=()=>{const t=r();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},d=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,l=n=>{if((()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})()){const t=c();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${n}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},h=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},u=(t,e)=>{const n=()=>{try{return document.querySelector(t)}catch(t){return null}};let o=n();const s=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],i=()=>r.disconnect(),a=()=>r.observe(...s),r=new MutationObserver(()=>(o=n(),o&&!i()&&e(o)));return o?setTimeout(()=>e(o),0):a(),{selector:t,clear:i,observe:a}};function m(t,e){return e(t)||!t.parentElement?t:m(t.parentElement,e)}const g=e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},y=(t,e)=>[...document.querySelectorAll(e)].some(n=>n.isSameNode(t)||!!t.closest(e));class b{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&t.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),t}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:o})=>{if(n.isSameNode(t))return!0;const s=[...t.querySelectorAll(o)];if(s.length&&s.includes(n))return!0;if(e.includes(n))return!0;const i=[...t.parentElement.children],a=i.findIndex(e=>e.isSameNode(t)),r=i.filter((t,e)=>e>a);if(r.length){if(r.includes(n))return!0;if(r.some(t=>[...t.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:o}=n,s=this.targets.find(e=>e.selector===t&&e.uniqueId===o);s&&s.resolve(e),this.clear(t,o)}}mouseOverHandler(){const t=["mouseover",t=>setTimeout(()=>this.onMouseOver(t),50),!0];return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===m(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let o=!1,s=0;for(;!o&&s<n.length;){const e=document.elementFromPoint(...n[s]);o=t===e||t.contains(e),s+=1}return o}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const o=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return o&&o.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n});const o=()=>{this.startMutationObserver(),this.checkElements()};document.body?o():u("body",o)}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:o})=>n!==t&&o!==e));const n=document.querySelector(t);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class w{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[],this.socialProofStore={}}async onElementVisible({promise:t,resolve:e}){const n=h(`${this.event}DomReady`);this.promises.push(n);const o=await this.onPageLoad(n),s=await async function(){let t;return t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||new Promise((t,e)=>{const n=window.document.getElementsByTagName("script")[0],o=window.document.createElement("script");o.src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",n.parentNode.insertBefore(o,n),o.onload=t,o.onerror=e})),t}(),i=new b;if(this.visibilityObservers.push(i),s&&o){const t=d();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const o=["readystatechange",({isTrusted:t})=>t&&n()&&e(!0),{passive:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id=`Click_${d()}`,n.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(n),this.elementsSelectors.push(`#${n.id}`);const o=["click",({isTrusted:t,target:n})=>t&&y(n,this.selector)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}onHover({promise:t,resolve:e}){const n=["mouseenter",({isTrusted:t,target:n})=>t&&y(n,this.selector)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...n]),document.documentElement.addEventListener(...n),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",({isTrusted:t,clientY:n})=>{t&&n<=0&&e(!0)},{passive:!0}],o=u("body",t=>{this.eventsListeners.push([t,...n]),t.addEventListener(...n),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==o)});return this.elementsWaiters.push(o),t}onReengage({promise:t,resolve:e}){const n=this.delay;let o=n;const s=[({isTrusted:t})=>{t&&(o=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{this.eventsListeners.push([document,t,...s]),document.addEventListener(t,...s)});const i=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(i),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}onScrollUp({promise:t,resolve:e}){let n=0;const o=["scroll",({isTrusted:t})=>{t&&(window.pageYOffset<n?e(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}onScrollPercentReached({promise:t,resolve:e}){const{triggerEventScrollPercent:n}=DATA,o=["scroll",({isTrusted:t})=>{if(!t)return;const o=(()=>{const{documentElement:t,body:e}=document,n=t.scrollTop||e.scrollTop,o=t.scrollHeight||e.scrollHeight;return Math.trunc(n/(o-t.clientHeight)*100,10)})();n<o&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}checkSocialProofConditions(t,e,n,o){const s=(()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t})(),{viewInterval:i,spNoTrim:a}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?o(`${this.socialProofStore[t][i]}`):o(!1);else if(t&&s){const r=e=>(this.socialProofStore[t]=e,o(!!n(e)&&`${e[i]}`));fetch(`https://api-social-proof.abtasty.com/clients/${s}/metrics/${e}?key=${t}${a?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(r).catch(()=>l("Failed to fetch datas from server."))}else o(!1)}getSocialProofPurchases({promise:t,resolve:e}){const n=window.ABTastyProductKey,{viewInterval:o,triggerSocialProofMinPurchases:s}=DATA;return n||(l("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://abtasty.elevio.help/en/articles/190-social-proof-prerequisites"),e(!1)),this.checkSocialProofConditions(n,"i",t=>{if(void 0===o||void 0===s)return!1;const e=void 0!==t[o]&&t[o]>=s;return e||l(`Widget will not be shown, product has been purchased ${t[o]} times while ${s} are required`),e},e),t}getSocialProofPageViews({promise:t,resolve:e}){const{viewInterval:n,triggerSocialProofMinPageViews:o,spNoTrim:s}=DATA,i=encodeURIComponent(s?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`);return this.checkSocialProofConditions(i,"pv",t=>{if(void 0===n||void 0===o)return!1;const e=void 0!==t[n]&&t[n]>=o;return e||l(`Widget will not be shown, page has been seen ${t[n]} times while ${o} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!o()){const n=["abtasty_consentValid",()=>e(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),t}return e(!0),t}onTrackingSent({promise:t,resolve:e}){const{triggerEventTrackingSent:n}=DATA;let o=localStorage.getItem("ABTastyData");const s=()=>JSON.parse(o).ActionTracking.find(({name:t})=>t===n),i=["storage",()=>{o=localStorage.getItem("ABTastyData"),s()&&e(!0)},{passive:!0,capture:!0}];return o&&s()?e(!0):(()=>{this.eventsListeners.push([window,...i]),window.addEventListener(...i)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let o=localStorage.getItem("ABTastyData");const s=()=>n<=(o?JSON.parse(o).VisitedPages.length:0),i=["storage",()=>{o=localStorage.getItem("ABTastyData"),s()&&e(!0)},{passive:!0,capture:!0}];return o&&s()?e(!0):(()=>{this.eventsListeners.push([window,...i]),window.addEventListener(...i)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:o}=DATA;let s=0,i=!1;const a=["click",({isTrusted:t})=>{t&&(s+=1,s>=n&&e(!0),i||(i=!0,setTimeout(()=>{s=0,i=!1},o)))},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...a]),document.addEventListener(...a),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]=t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.visibilityObservers.length){const t=d();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const t=h(this.event);this.promises.push(t);const e={consent:()=>this.onConsent(t),direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),hover:()=>this.onHover(t),scrollUp:()=>this.onScrollUp(t),scrollPercent:()=>this.onScrollPercentReached(t),rageClick:()=>this.onRageClick(t),minPagesViewed:()=>this.onMinPagesViewed(t),trackingSent:()=>this.onTrackingSent(t),socialProofPurchases:()=>this.getSocialProofPurchases(t),socialProofPageViews:()=>this.getSocialProofPageViews(t)},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=h(`${this.event}Delay`);return this.promises.push(t),setTimeout(()=>{t.resolve(!0),this.clear()},this.delay),t.promise})():n}}const p="closing",v="validation",f="ABTastyWidgets",x="ABTastyWidgetsTemporary";class T{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},o){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=o,this.widgetName=r(),this.uniqueId=d(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:t}){const e=localStorage.getItem(x),n=sessionStorage.getItem(f);"ABTastyData"===t&&!e&&n&&localStorage.setItem(x,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(f);return JSON.parse(e)}catch(e){return t.removeItem(f),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...o}=e;return Object.entries(o).length?(t.setItem(f,JSON.stringify(o)),o):(t.removeItem(f),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem(x),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(f,t),localStorage.removeItem(x));const n=this.getLocalRecurrence(),o=(n?parseFloat(n.stamp):0)<(new Date).getTime();return o&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&o&&!this.getLocalRecurrence()&&!e}setRecurrence(t,n){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const s=this.getTypeOfStorage(t);if(e()||!s&&"object"!=typeof s)return!1;const{storageString:i,storageMethod:a}=s,r=this.getStamp(t),c={type:n,stamp:r},{type:d}=this.getCurrentRecurrence(),l=async()=>{if(!o()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new w({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===i?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const s=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};a.setItem(f,JSON.stringify(s)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!a)return!1;if(d&&n!==v)if(n===p&&d!==v)l();else{if("display"!==n||d===v||d===p)return!1;l()}else l();return r}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class S{constructor(t,e,n,o){this.recurrence=t,this.isWidgetApplied=e,this.callback=n,this.shouldUpdate=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(t){const e=n(),{type:o}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let r;const c=this.isWidgetApplied(),d=(()=>{const e=this.recurrenceIsDone();return t&&"display"===o||e})(),l=!c&&e&&d,h=c&&(!e||!d),u=!c&&!e;return this.shouldUpdate&&!t&&e&&d?r=a:l?r=i:(h||u)&&(r=s),"string"==typeof r&&(this.clearWatcher(),this.callback(r,t),this.watch()),this}eventHandler(){let t=n();return[250,500].forEach(e=>{setTimeout(()=>{const o=n();return 500===e&&o===t?this:(t=o,this.decisionHandler(!1))},e)}),this}observerHandler(t){return t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler(!0):this}watch(){if(t())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const e=()=>{const t=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...t)};return document.body?e():(()=>{const t=u("body",()=>{e(),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});this.elementsWaiters.push(t)})(),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const $=/.+\/([^.]+)\.(otf|ttf)$/,C=["socialProofPurchases","socialProofPageViews"];class A{constructor(){this.children=void 0,this.uniqueId=d(),this.widgetName=r(),this.prettyName=c(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:o}=DATA;if(t()||!e&&!n&&!o)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[`${t}_day`],week:t=>7*DATA[`${t}_week`],month:t=>30.5*DATA[`${t}_month`]},i={};return e&&(i.displayRecurrence=s[e]("displayRecurrence")),n&&(i.closingRecurrence=s[n]("closingRecurrence")),o&&(i.validationRecurrence=s[o]("validationRecurrence")),i})(),this.triggerParams=(()=>{let{triggerEvent:e}=DATA;const{triggerEventClick:n,triggerEventHover:o,triggerEventReengageDelay:s,socialProofContentType:i,triggerEventElementVisible:a,triggerEventDelay:r}=DATA;if(t()||!e&&!i)return!1;const c={click:()=>n,hover:()=>o,elementVisible:()=>a},d=Object.prototype.hasOwnProperty.call(c,e)?c[e]():"body",l="reengage"===e?s:r;return i&&(e=1===i?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:e,triggerSelector:d,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new T(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new w(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&C.includes(this.triggerParams.triggerEvent),this.pageWatcher=new S(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;return!e||!["click","hover","scrollUp","script"].includes(e)||t})(),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(t=>document.removeEventListener(...t)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const t=new Promise(t=>{const e=u("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(({selector:t})=>"head"!==t),t(e.appendChild(this.styleElement))});this.elementsWaiters.push(e)}),e=new Promise(t=>{const{elementReferrer:e="body",referrerInsertType:n="beforeend"}="free"===DATA.layout?DATA:{},o=u(e,o=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==e),this.removeOldDomElement(),t(o.insertAdjacentElement(n,this.domElement))});this.elementsWaiters.push(o)});return Promise.all([e,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(t=>t&&t.isConnected&&t.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():t()||this.init().then(({response:t})=>t?this.show():this),this}show(){return t()||this.hasBeenShown&&this.hasOncePerPageTrigger||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(e=!0){return!t()&&this.hasBeenShown&&e&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),e&&(this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(e){const o=t(),s=n(),i=this.trigger&&this.trigger.promises.length,a=!this.recurrence||this.recurrence.isOver();if(!o&&!s||i||!a)return{container:this,response:!1};this.pageWatcher.watch();const r=o||!this.trigger||this.trigger&&await this.trigger.isTriggered(),c={container:this,response:r};return r?(await this.insert(),this.addCloseEvent(),o||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(r),c):c}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>t?this.show():this.hide(!1));e||(this.hasBeenShown=!1);const o=this.isWidgetApplied(),r={[s]:()=>{o?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch())},[i]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():o||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):n()},[a]:n};"function"==typeof r[t]&&r[t]()}addCloseEvent(...e){const{closeButton:n,overlay:o,overlayClickable:s,layout:i,animationDuration:a=1e3}=DATA,r=[];if(void 0!==o&&!0!==o||!0!==s||"popin"!==i||r.push(`.${this.overlayClassName}`),void 0!==n&&n&&r.push(`.${this.closeButtonClassName}`),!r.length)return this;const c=this.domElement.querySelectorAll(r.join(", "));if(!c.length)return this;const d=["click",t=>{g(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*a)},{once:!0,capture:!0}];return e.push(...c),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.removeEventListener(...d),e.addEventListener(...d)}),this}getDom(){const{closeButton:t,layout:e,overlay:n=!0}=DATA,o=document.createElement("div");return o.className=`${this.basicClassName} ${this.hideClassName}`,o.id=this.widgetContainerId,o.innerHTML=`\n\t\t\t${"popin"===e&&!0===n?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}"><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}loadFont(t,e){if(!t||"inherit"===t)return;const n=document.createElement("style"),o=e.match($)?e.match($)[1]:"";n.innerHTML=`@font-face { font-family: '${t}_${o}'; src: url('${e}'); font-display: swap; }`,document.head.appendChild(n)}getStyleTag(e="",n=DATA){const{noStyles:o,layout:s}=n,{backgroundColor:i,isBackgroundImage:a,backgroundImage:r,backgroundSize:c,backgroundPosition:d,backgroundRepeat:l,borderColor:h,borderRadius:u,borderWidth:m,textColor:g,textAlign:y,fontName:b,fontStyle:w,fontSize:p,isTitle:v,titleTextAlign:f,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:C,overlay:A,overlayColor:E,dropShadow:k,dropShadowColor:B,dropShadowBlur:L,containerMargin:I,containerPadding:P,closeButton:N,closeButtonPosition:_,closeButtonSize:R,closeButtonBorderRadius:D,closeButtonBorderWidth:O,closeButtonBorderColor:W,closeButtonColor:q,closeButtonBackgroundColor:V,buttonsAlign:H,buttonsBorderWidth:M,buttonsBorderColor:j,buttonsBorderRadius:F,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:Y,buttonsFontStyle:G,buttonsFontSize:K,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:Z,secondLinkBorderRadius:X,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:ot,secondLinkFontSize:st,animation:it,animationDuration:at,animationBehaviour:rt,animationSlideDirection:ct}=o?{}:n,dt=document.createElement("style");dt.type="text/css",t()&&dt.setAttribute("abtasty-script-added","true"),this.loadFont(b,w),this.loadFont(T,S),this.loadFont(Y,G),this.loadFont(nt,ot);const lt=`background: ${["string"==typeof i?i:"rgba(255, 255, 255, 1)",a&&"string"==typeof r&&r.length?`url(${r})`:"",a&&"string"==typeof d&&"100% 100%"!==c?d:"0 0",a&&"string"==typeof c?`/ ${c}`:"/ auto",a&&l&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ht="number"==typeof m&&m>0,ut=`border: ${[ht?`${m}px`:"unset",ht?"solid":"",ht&&"string"==typeof h&&h.length?h:""].join(" ").trim()};`,mt=void 0!==u?`border-radius: ${u}px;`:"",gt=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",yt=void 0!==y?`text-align: ${y};`:"",bt=b&&"inherit"!==b?`font-family:${b}_${w.match($)?w.match($)[1]:""};`:w||"",wt=p?`font-size: ${p}px;`:"",pt=void 0!==k&&k?`box-shadow: 0 5px ${L}px 0 ${B};`:"",vt=I instanceof Array&&1===I.length&&I[0],ft=vt?`margin: ${vt.top}px ${vt.right}px ${vt.bottom}px ${vt.left}px;`:"",xt=vt?`margin: calc(${vt.top}px * 0.5) calc(${vt.right}px * 0.5) calc(${vt.bottom}px * 0.5) calc(${vt.left}px * 0.5);`:"",Tt=P instanceof Array&&1===P.length&&P[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",$t=Tt?`padding: calc(${Tt.top}px * 0.5) calc(${Tt.right}px * 0.5) calc(${Tt.bottom}px * 0.5) calc(${Tt.left}px * 0.5);`:"",Ct=void 0!==M&&M?`border-width: ${M}px; border-style: solid;`:"",At=[j,M].every(t=>void 0!==t)&&M?`border-color: ${j};`:"",Et=void 0!==F?`border-radius: ${F}px;`:"",kt=void 0!==z?`background-color: ${z};`:"",Bt=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Lt=Y&&"inherit"!==Y?`font-family:${Y}_${G.match($)?G.match($)[1]:""};`:G||"",It=K?`font-size: ${K}px;`:"",Pt=void 0!==Q&&Q?`border-width: ${Q}px; border-style: solid;`:"",Nt=[Z,Q].every(t=>void 0!==t)&&Q?`border-color: ${Z};`:"",_t=void 0!==X?`border-radius: ${X}px;`:"",Rt=void 0!==tt?`background-color: ${tt};`:"",Dt=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Ot=nt&&"inherit"!==nt?`font-family:${nt}_${ot.match($)?ot.match($)[1]:""};`:ot||"",Wt=st?`font-size: ${st}px;`:"",qt="popin"!==s||void 0!==A&&!0!==A?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==E?E:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Vt="number"==typeof R?R:16,Ht=Vt/2,Mt=o||void 0!==N&&N?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===_?`bottom: calc(100% + ${Ht}px)`:`top: ${Ht}px`)+";",`right: ${Ht}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof D?`border-radius: ${D}px;`:"","number"==typeof O&&O>0?`border: ${O}px solid ${void 0!==W?W:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Vt}px;`,`height: ${Vt}px;`,"string"==typeof q?`fill: ${q};`:"","}"].join(""):"",jt=v&&"string"==typeof x?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${x}; fill: ${x}; -webkit-text-fill-color: ${x};`,void 0!==f?`text-align: ${f};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match($)?S.match($)[1]:""};`:S||"",C?`font-size: ${C}px;`:"","}"].join(""):"";let Ft="";if("string"==typeof it){const e=(at/1e3).toFixed(2),n=["top","bottom"].includes(ct),o=Number(n),s=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[o]:"0"];n&&s.reverse(),Ft={none:[],fade:[`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${rt};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${rt};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${s.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${rt};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":it].join("")}const zt=[`#${this.widgetContainerId} .${this.contentClassName} > * a:nth-child(2), `,`#${this.widgetContainerId} .${this.contentClassName} > * button:nth-child(2) {`,`margin-${"fill"===H?"top":"left"}: 8px;`,Pt,Nt,_t,Rt,Dt,Ot,Wt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a:nth-child(2) *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button:nth-child(2) * {`,Dt,Ot,Wt,"}"];return dt.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,lt,mt,ut,gt,yt,pt,ft,bt,wt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,gt,yt,bt,wt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",St,bt,wt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,"box-sizing: border-box;","display: inline-block;",Ct,At,Et,kt,Bt,Lt,It,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,Bt,Lt,It,"}",...J?zt:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,xt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,$t,"}","}",qt,Mt,jt,Ft,`${e}`].join(""),dt}}const E=["top: 0;","top: 50%;","bottom: 0;"],k=["left: 0;","left: 50%;","right: 0;"],B=t=>1===t?"-50%":0,L=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${B(e)}, ${B(t)});`;return`${E[t]}${k[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},I=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,P=()=>{if(I())return"width: auto; height: auto; min-width: max-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:o,popinPercentHeight:s,popinPixelsHeight:i,heightUnit:a}=DATA;return`width: ${"px"===n?e:t}${n};height: ${o?"auto":`${"px"===a?i:s}${a}`};`};class N extends A{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(t=>B(t)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e,overlay:n,widthUnit:o}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===t?e:t};`,"background: none;","pointer-events: "+(!1===n?"none":"all"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",L(),P(),"pointer-events: all","}",`${I()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!I()&&["px","em"].includes(o)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class _ extends A{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===t?e:t};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class R extends A{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}t()&&Number(ABTASTY_S.USER.additionalInformation.account_iframe_less_mode);const D=["fr","en","de","es"],O=["day","hour","minute","second"],W={day:{en:"Day",fr:"Jour",es:"Dia",de:"Tag"},days:{en:"Days",fr:"Jours",es:"Dias",de:"Tage"},hour:{en:"Hour",fr:"Heure",es:"Hora",de:"Zeit"},hours:{en:"Hours",fr:"Heures",es:"Horas",de:"Stunden"},minute:"Min",second:{en:"Sec",fr:"Sec",es:"Seg",de:"Sek"}},q="line",V=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",H=(t=>D.indexOf(t)>-1)(V)?V:"en",M={day:W.day[H],days:W.days[H],hour:W.hour[H],hours:W.hours[H],minute:W.minute,minutes:W.minute,second:W.second[H],seconds:W.second[H]};let j=function(){function e(t,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.testId=t,this.data=n,this.targetselector=n.selector,this.container=this.createContainer(),this.digitElements={},this.textElements={},this.timeElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=M,this.fonts=[],this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})}var n,o;return n=e,o=[{key:"getFonts",value:function(){return[{name:this.data.messageFontName,style:this.data.messageFontStyle},{name:this.data.numbersfontName,style:this.data.numbersfontStyle},{name:this.data.legendfontName,style:this.data.legendfontStyle}]}},{key:"remove",value:function(){const{animationDuration:t}=DATA;setTimeout(()=>this.parentContainer.remove(),1.05*t)}},{key:"addCloseEvent",value:function(e){e&&e.addEventListener("click",e=>{g(e),t()||this.parentContainer.recurrence.setClosingRecurrence(),this.parentContainer.hide(),this.remove()},{capture:!0,passive:!1})}},{key:"addRedirectionEvent",value:function(e){!t()&&e&&e.addEventListener("click",()=>{const{autoHide:t,timeHide:e}=DATA;t&&setTimeout(()=>{this.parentContainer.hide(),this.remove()},1e3*e),this.parentContainer.recurrence.setValidationRecurrence()},{useCapture:!0,once:!0})}},{key:"createContainer",value:function(){const{linkType:t,redirectionUrl:e,openInNewTab:n}=DATA,o=document.createElement(t&&t.includes("widget")?"a":"div");switch(o.classList.add("abtasty-countdown"),t){case"widget":o.href=e,o.target=n?"_blank":"_self",this.addRedirectionEvent(o);break;case"widgetClose":o.href="#",o.dataset.abtastyActionnable="true",this.addCloseEvent(o)}return o}},{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){O.forEach(e=>{let n=t[e];String(n).length<2&&(n="0".concat(n)),this.digitElements[e].textContent=n,this.textElements[e].textContent=1===n?this.unitsText[e]:this.unitsText["".concat(e,"s")],this.maxWidth<this.digitElements[e].offsetWidth&&(this.maxWidth=this.digitElements[e].offsetWidth,this.digitElements[e].style.minWidth="".concat(this.maxWidth,"px"),window.requestAnimationFrame(()=>{this.setText(t)})),this.digitElements[e].style.minWidth="".concat(this.maxWidth,"px")})}},{key:"onTimeEnd",value:function(){const{endSettings:t}=this.data;if(clearInterval(this.timeLoop),"hideWidget"===t)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");const e={endText:!0,endCountdown:["showText","showTextAndButton"].includes(t),endButton:["hideCountdownAndShowTextAndButton","showTextAndButton"].includes(t)},n=["abtasty-countdown-".concat(t),"abtasty-countdown-finish"];Object.keys(e).forEach(t=>{const o="abtasty-countdown-".concat(t),s=e[t]?"show":"hide";n.push("".concat(o,"-").concat(s))}),this.container.classList.add(...n)}},{key:"setCountdown",value:function(){const e=new Date;let n=function(e,n){switch(e.type){case"global":return e.timestamp-n.getTime();case"local":if(t())return e.previewTimestamp-n.getTime();const{year:o,month:s,day:i,hour:a,minute:r}=e.timecomponents;return new Date(o,s-1,i,a,r).getTime()-n.getTime();default:return 0}}(this.data.dateTime,e)/1e3;if(window.ABTastyEditor&&("ifEnded"===this.data.previewBlock&&(n=-1),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();const o=Math.floor(n/86400);n-=86400*o;const s=Math.floor(n/3600);n-=3600*s;const i=Math.floor(n/60);n-=60*i;const a=Math.floor(n);this.setText({day:o,hour:s,minute:i,second:a})}},{key:"getStyle",value:function(){this.loadFonts();const{buttonsAlign:t}=DATA,e=void 0!==t&&"fill"!==t?"text-align: ".concat(t,";"):"";return"\n .abtasty-countdown-bottom-button,\n .abtasty-countdown-finish-button {\n ".concat(e,"\n }\n .abtasty-countdown-bottom-button a,\n .abtasty-countdown-finish-button a {\n width: ").concat("fill"===t?"100%":"auto",";\n }\n\n .abtasty-countdown .abtasty-countdown-finish-text,\n .abtasty-countdown .abtasty-countdown-top-message,\n .abtasty-countdown .abtasty-countdown-finish-text *,\n .abtasty-countdown .abtasty-countdown-top-message * {\n white-space: pre-line;\n text-align: ").concat(this.data.messageAlign," !important;\n color: ").concat(this.data.textColor,";\n font-size: ").concat(this.data.messageFontSize,"px; \n ").concat(this.data.messageFontName&&"inherit"!==this.data.messageFontName?"font-family:".concat(this.data.messageFontName,"_").concat(this.data.messageFontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.messageFontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number,\n .abtasty-countdown .abtasty-countdown-elm-number * {\n font-size: ").concat(this.data.numbersfontSize,"px; \n color: ").concat(this.data.numberstextColor,";\n -webkit-text-fill-color: ").concat(this.data.numberstextColor,";\n font-weight: initial;\n ").concat(this.data.numbersfontName&&"inherit"!==this.data.numbersfontName?"font-family:".concat(this.data.numbersfontName,"_").concat(this.data.numbersfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.numbersfontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text,\n .abtasty-countdown .abtasty-countdown-elm-text * {\n ").concat(this.data.legendfontName&&"inherit"!==this.data.legendfontName?"font-family:".concat(this.data.legendfontName,"_").concat(this.data.legendfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],";"):this.data.legendfontStyle||"",";\n font-size: ").concat(this.data.legendfontSize,"px; \n color: ").concat(this.data.legendtextColor,";\n -webkit-text-fill-color: ").concat(this.data.legendtextColor,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ").concat(this.data.countdownBorderRadius,"px;\n border: ").concat(this.data.countdownBorderWidth,"px solid ").concat(this.data.countdownBorderColor,";\n background-color: ").concat(this.data.numbersBackgroundColor,"; \n } \n ")}},{key:"setButton",value:function(){const t=(t,e,n,o)=>{const{uniqueId:s}=this.parentContainer,i=document.createElement("a");return i.className="popin_link_".concat(s),i.innerHTML="<span>".concat(t,"</span>"),i.href="button"===e?n:"#","button"===e?(i.target=o?"_blank":"_self",this.addRedirectionEvent(i)):(i.dataset.abtastyActionnable="true",this.addCloseEvent(i)),i},{linkType:e,buttonText:n,redirectionUrl:o,openInNewTab:s,secondLink:i,secondLinkText:a,secondLinkType:r,secondLinkURL:c,secondLinkOpenInNewTab:d,endBtnTargetBlank:l,endBtnLabel:h,endBtnLink:u}=DATA,m=this.container.querySelector(".abtasty-countdown-bottom-button"),g=[];if(e&&e.includes("button")){const l=t(n,e,o,s);if(g.push(l),i){const e=t(a,r,c,d);g.push(e)}}g.forEach(t=>m.appendChild(t));const y=this.container.querySelector(".abtasty-countdown-finish-button"),b=document.createElement("a");b.href=u,b.target=l?"_blank":"_self",b.innerHTML=h,y.appendChild(b)}},{key:"setContent",value:function(){const t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("p");e.innerHTML=this.data.message,t.appendChild(e);const n=this.container.querySelector(".abtasty-countdown-finish-text"),o=document.createElement("div");o.innerHTML=this.data.endMessage,n.appendChild(o)}},{key:"init",value:function(t){const{layout:e,inlineLayoutContent:n,imageOn:o,imagePosition:s}=this.data;try{this.parentContainer=t;const i=["free","popin"].includes(e);(n=>{this.container.classList.add("abtasty-countdown-layout-".concat(n)),n===q&&(i&&(this.parentContainer.domElement.querySelector(".".concat(t.contentClassName)).classList.add("abtasty-countdown-content-".concat(e,"-inline")),this.container.classList.add("abtasty-countdown-layout-".concat(e,"-inline"))),this.parentContainer.domElement.querySelectorAll(".".concat(t.closeButtonClassName)).forEach(t=>t.classList.add("abtasty-countdown-close-inline")))})(i&&!n?"free":q);const a="popin"===e||"free"===e&&!n;if(o){const{image:t}=this.data,e=new Image;e.src=t;const n=["abtasty-countdown-image"];a&&n.push("abtasty-countdown-image-popin-layout"),e.classList.add(...n),e.onload=async()=>{document.querySelector(".countdown_".concat(a?"popin":"banner","_img_container")).appendChild(e)}}const r=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"popin";return t?'<div class="countdown_'.concat(e,'_img_container"></div>'):""};this.container.innerHTML="\n ".concat(r(a&&!("popin"===e&&n),"popin"),'\n <div class="abtasty-countdown-layout-').concat(e,'">\n ').concat(r("before"===s,"banner"),'\n <div class="abtasty-countdown-clock">\n <div class="abtasty-countdown-days abtasty-countdown-elm-time">\n <div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n <div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n <div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n <div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n </div>\n </div>\n ').concat(r("after"===s,"banner"),'\n <div class="abtasty-countdown-top-message"></div>\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button"></div>\n </div>\n '),this.container.insertAdjacentElement("afterbegin",function(t){const e=document.createElement("style");return e.type="text/css",e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),e}("".concat("@media (max-width:579px){.ab_widget_container_countdown_content{width:100vw}}.abtasty-countdown,.abtasty-countdown>div{display:inline-block;text-align:center}.abtasty-countdown>div{margin:10px;overflow:auto;white-space:normal}.abtasty-countdown .countdown_popin_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;max-width:100%}.abtasty-countdown .countdown_popin_img_container:empty{display:none}.abtasty-countdown .abtasty-countdown-finish-text,.abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}.abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;margin:6px 6px 15px;padding:6px}.abtasty-countdown .abtasty-countdown-elm-number,.abtasty-countdown .abtasty-countdown-elm-text{font-stretch:normal;font-style:normal;font-weight:700;letter-spacing:normal;line-height:normal;text-align:center}.abtasty-countdown .abtasty-countdown-bottom-button a,.abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;display:block;display:inline-block;padding:6px 10px;text-align:center;text-decoration:none}.abtasty-countdown-layout-line>div{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:stretch;-ms-flex-pack:stretch;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:stretch}.abtasty-countdown-layout-line>div>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.abtasty-countdown-layout-free{display:block;text-align:center}.abtasty-countdown-layout-line>div{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-finish-text,.abtasty-countdown-layout-line .abtasty-countdown-top-message{-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:0;padding:0 5px 0 15px}.abtasty-countdown-layout-line .abtasty-countdown-top-message p{margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line{-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button,.abtasty-countdown-layout-line .abtasty-countdown-clock,.abtasty-countdown-layout-line .abtasty-countdown-finish-button{-ms-flex-negative:0;flex-shrink:0}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:55%!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:45%!important}.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:30%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:35%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:65%}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop{width:100%}.abtasty-countdown-content-popin-inline,.abtasty-countdown-content-popin-inline .abtasty-countdown-layout-popin{max-width:inherit;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content}.abtasty-countdown-content-free-inline{max-width:100%}.abtasty-countdown-image-popin-layout{margin-bottom:20px}@media (max-width:740px){.abtasty-countdown-layout-line>div:not(.abtasty-countdown-layout-popin){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.abtasty-countdown-layout-line div.abtasty-countdown-finish-text,.abtasty-countdown-layout-line div.abtasty-countdown-top-message{margin-bottom:20px;margin-top:20px}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}.countdown_banner_img_container{display:none!important}}@media (max-width:570px){.abtasty-countdown-layout-free,.abtasty-countdown-layout-popin{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important;margin:10px 0!important}}.abtasty-countdown-layout-popin{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.countdown_banner_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;padding:0 15px}.countdown_banner_img_container img{max-height:67px;max-width:200px}"," ").concat(this.getStyle()))),O.forEach(t=>{const e=this.container.querySelector(".abtasty-countdown-".concat(t,"s")),[n,o]=e.children;this.digitElements[t]=n,this.textElements[t]=o,this.timeElements[t]=e}),this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),setTimeout(()=>{this.setCountdown()},100),this.setCountdown()}catch(t){console.warn("Countdown error occured during widget rendering:",t)}}},{key:"loadFonts",value:function(){this.getFonts().forEach(t=>{let{name:e,style:n}=t;if(!e||"inherit"===e)return;const o=document.createElement("style");o.appendChild(document.createTextNode(" @font-face { font-family: '".concat(e,"_").concat(n.match(/.+\/([^.]+)\.(otf|ttf)$/)[1],"'; src: url('").concat(n,"'); } "))),document.head.appendChild(o)})}}],o&&function(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),e}();!async function(){l("Widget launch");const t=(()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new N;break;case"bannerTop":case"bannerBottom":e=new _;break;case"free":e=new R;break;default:e=new A}return e})(),{response:e}=await t.init(!0),n=t.domElement.querySelector(".".concat(t.contentClassName)),o=new j(TEST_ID,DATA);o.init(t),o.insert(n,"beforeend"),e&&t.show()}()}();
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@abtasty/countdown",
|
3
3
|
"description": "Widget for AB Tasty",
|
4
|
-
"version": "3.7.
|
4
|
+
"version": "3.7.7",
|
5
5
|
"form": "dist/form.js",
|
6
6
|
"main": "dist/main.js",
|
7
7
|
"files": [
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"snowpack": "^3.8.8"
|
46
46
|
},
|
47
47
|
"dependencies": {
|
48
|
-
"@abtasty/widget-utils": "^1.18.
|
48
|
+
"@abtasty/widget-utils": "^1.18.35"
|
49
49
|
},
|
50
50
|
"snowpack": {
|
51
51
|
"webDependencies": [
|