@abtasty/countdown 3.9.3 → 3.9.4-0

Sign up to get free protection for your applications and to get access to all the features.
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=>new Function(`try {\n\t\t${t}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),o=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),i=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),s=()=>window.ABTasty&&!0===window.ABTasty.consentReady,r="remove",a="rebuild",c="update",l=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},d=()=>{const t=l();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,h=n=>{const o=(()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),i=document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(o||i){const t=d();window.console.log(`%c${t} - ${o?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${n}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},m=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},y=(t,e)=>{const n=()=>{try{return document.querySelector(t)}catch(t){return null}};let o=n();const i=[document.querySelector("body")||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],s=()=>a.disconnect(),r=()=>a.observe(...i),a=new MutationObserver(()=>(o=n(),o&&!s()&&e(o)));return o?setTimeout(()=>e(o),0):r(),{selector:t,clear:s,observe:r}};function p(t,e){return e(t)||!t.parentElement?t:p(t.parentElement,e)}const g=e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},b=(t,e)=>[...document.querySelectorAll(e)].some(n=>n===t||!!t.closest(e)),w=(t,e)=>{let n=Date.now();return()=>{n+e-Date.now()<=0&&(t(),n=Date.now())}};class f{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=null,this.mouseOverEvent=this.mouseOverHandler(),this.scrollEvent=this.scrollEventHandler(),this.onTransitionEnd=this.transitionOverHandler()}transitionOverHandler(){const t=["transitionend",this.checkElements.bind(this),!0];return this.getEvents(t)}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){this.mutationObserver??=new MutationObserver(this.checkElements.bind(this));const{clear:t}=y("body",e=>{t(),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0})});return this.mutationObserver}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:o})=>{if(n.isSameNode(t))return!0;const i=[...t.querySelectorAll(o)];if(i.length&&i.includes(n))return!0;if(e.includes(n))return!0;const s=[...t.parentElement.children],r=s.findIndex(e=>e.isSameNode(t)),a=s.filter((t,e)=>e>r);if(a.length){if(a.includes(n))return!0;if(a.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,i=this.targets.find(e=>e.selector===t&&e.uniqueId===o);i&&i.resolve(e),this.clear(t,o)}}getEvents(t){return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}mouseOverHandler(){const t=["ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",t=>{const e=t.composedPath(),{target:n}=t;setTimeout(()=>this.onMouseOver({target:n,path:e}),50)},!0];return this.getEvents(t)}scrollEventHandler(){const t=["scroll",w(this.checkElements.bind(this),50),{passive:!0}];return this.getEvents(t)}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===p(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,i=0;for(;!o&&i<n.length;){const e=document.elementFromPoint(...n[i]);o=t===e||t.contains(e),i+=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}),this.startMutationObserver(),this.checkElements()}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(),this.scrollEvent.clear(),this.onTransitionEnd.clear())}}class v{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n,triggerTarget:o}){this.event=t,this.selector=e&&e.length?e:"body",this.target=o,this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={}}async onElementVisible({promise:t,resolve:e}){const n=m(`${this.event}DomReady`);this.promises.push(n);const o=await this.onPageLoad(n),i=new f;if(this.visibilityObservers.push(i),o){const t=u();i.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const o=["readystatechange",()=>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_${u()}`,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})=>{const o=n.isEqualNode(this.target)||b(n,this.selector);return t&&o&&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})=>{const o=this.target?n.isEqualNode(this.target):b(n,this.selector);return t&&o&&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}],{clear:o}=y("html",t=>{o(),this.eventsListeners.push([t,...n]),t.addEventListener(...n)});return t}onReengage({promise:t,resolve:e}){const n=this.delay;let o=n;const i=[({isTrusted:t})=>{t&&(o=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{this.eventsListeners.push([document,t,...i]),document.addEventListener(t,...i)});const s=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(s),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 i=(()=>{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:s,spNoTrim:r}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?o(`${this.socialProofStore[t][s]}`):o(!1);else if(t&&i){const a=e=>(this.socialProofStore[t]=e,o(!!n(e)&&`${e[s]}`));fetch(`https://api-social-proof.abtasty.com/clients/${i}/metrics/${e}?key=${t}${r?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(a).catch(()=>h("Failed to fetch datas from server."))}else o(!1)}getSocialProofDatas({promise:t,resolve:e},i,s=!1){const{productKey:r,keyType:a}=(()=>{const{socialProofContentType:t,productKeyProvider:e,pathToProductKey:i,customJSProductKey:s,productSKU:r}=DATA;if(2===t)return{productKey:o(),keyType:"url"};{let a=null,c="sku";switch(e){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${i};`);break;case"customJSProductKey":a=n(s);break;case"productSKU":a=r}return a||3!==t||(a=o(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:l,triggerSocialProofMinPurchases:d,triggerSocialProofMinPageViews:u}=DATA,m={pv:u,i:d,"v-pv":l}[i];return[typeof c,typeof m].includes("undefined")&&e(!1),s&&!r&&(h("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),e(!1)),this.checkSocialProofConditions(r,"v-pv"===i&&"sku"===a?"v-i":i,t=>{const e=void 0!==t[c]&&t[c]>=m;return e||h(`Widget will not be shown, Social Proof API returned ${t[c]} while ${m} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!s()){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 i=()=>JSON.parse(o).ActionTracking.find(({name:t})=>t===n),s=["storage",()=>{o=localStorage.getItem("ABTastyData"),i()&&e(!0)},{passive:!0,capture:!0}];return o&&i()?e(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let o=localStorage.getItem("ABTastyData");const i=()=>n<=(o?JSON.parse(o).VisitedPages.length:0),s=["storage",()=>{o=localStorage.getItem("ABTastyData"),i()&&e(!0)},{passive:!0,capture:!0}];return o&&i()?e(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:o}=DATA;let i=0,s=!1;const r=["click",({isTrusted:t})=>{if(t&&(i+=1,i>=n&&e(!0),!s)){s=!0;const t=setTimeout(()=>{i=0,s=!1},o);this.timeouts.push(t)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...r]),document.addEventListener(...r),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.visibilityObservers.length){const t=u();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}async isTriggered(){this.clear();const t=m(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.getSocialProofDatas(t,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(t,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(t,"v-pv")},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=m(`${this.event}Delay`);this.promises.push(t);const e=setTimeout(()=>{t.resolve(!0),this.clear()},this.delay);return this.timeouts.push(e),t.promise})():n}}const x="display",T="closing",S="validation",A="ABTastyWidgets",C=`${A}Temporary`;class ${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=l(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:t}){const e=localStorage.getItem(C),n=sessionStorage.getItem(A);"ABTastyData"===t&&!e&&n&&localStorage.setItem(C,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(A);return JSON.parse(e)}catch(e){return t.removeItem(A),!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(A,JSON.stringify(o)),o):(t.removeItem(A),!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(C),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(A,t),localStorage.removeItem(C));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 o=this.getTypeOfStorage(t);if(e()||!o&&"object"!=typeof o)return!1;const{storageString:i,storageMethod:r}=o,a=this.getStamp(t),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),d=async()=>{if(!s()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new v({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 o=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};r.setItem(A,JSON.stringify(o)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!r)return!1;if(l&&n!==S)if(n===T&&l!==S)d();else{if(n!==x||l===S||l===T)return!1;d()}else d();return a}setDisplayRecurrence(){const t=x;this.setRecurrence(this.displayRecurrence,t)}setClosingRecurrence(){const t=T;this.setRecurrence(this.closingRecurrence,t)}setValidationRecurrence(){const t=S;this.setRecurrence(this.validationRecurrence,t)}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 E{constructor(t,e,n){this.isWidgetApplied=t,this.callback=e,this.shouldUpdate=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(){const t=this.isWidgetApplied()?this.shouldUpdate&&c:a;return t?(this.clearWatcher(),this.callback(t,!0),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:t}}){t===TEST_ID&&(this.callback(a,!1),this.watch())}onTagRollback(){return this.clearWatcher(),this.callback(r,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(t){return i()?t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler():this:this.callback(r,!1)}watch(){if(t())return this;this.clearWatcher(),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams);const{clear:e}=y("body",t=>{e(),this.observer.observe(t,{childList:!0,subtree:!0})});return this}clearWatcher(){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this}}const k=/.+\/([^.]+)\.(otf|ttf)$/,L=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class P{constructor(e,n){this.children=void 0,this.uniqueId=`${u()}${n?`_${n}`:""}`,this.widgetName=l(),this.prettyName=d(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:o}=DATA,i=!e&&!n&&!o;if(t()||i)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`]},r={};return e&&(r.displayRecurrence=s[e]("displayRecurrence")),n&&(r.closingRecurrence=s[n]("closingRecurrence")),o&&(r.validationRecurrence=s[o]("validationRecurrence")),r})(),this.triggerParams=(e=>{let{triggerEvent:n}=DATA;const{triggerEventClick:o,triggerEventHover:i,triggerEventReengageDelay:s,socialProofContentType:r,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(t()||!n&&!r)return!1;const l={click:()=>o,hover:()=>i,elementVisible:()=>a},d=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?s:c;return r&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][r]),{triggerEvent:n,triggerSelector:d,triggerDelay:u,triggerTarget:e}})(e),this.recurrence=!!this.recurrenceParams&&new $(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new v(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&L.includes(this.triggerParams.triggerEvent),this.pageWatcher=new E(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.forEach(t=>document.removeEventListener(...t)),this.eventsListeners=[],this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[],this.intervals.forEach(t=>clearInterval(t)),this.intervals=[],this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]}isWidgetApplied(){return!(!this.hasBeenShown||!this.hasOncePerPageTrigger)||this.domElement&&this.domElement.isConnected}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){if(this.isWidgetApplied())return!1;document.head.appendChild(this.styleElement);const t=["free"];return"drawer"===DATA.layout&&DATA.customTarget&&t.push("drawer"),new Promise(e=>{const{elementReferrer:n="body",referrerInsertType:o="beforeend"}=t.includes(DATA.layout)?DATA:{},i=y(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==n),this.removeOldDomElement(),e(t.insertAdjacentElement(o,this.domElement))});this.elementsWaiters.push(i)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),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.pageWatcher.clearWatcher(),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(e){const n=t(),o=i(),s=this.trigger&&this.trigger.promises.length,r=!this.recurrence||this.recurrence.isOver();if(!n&&!o||s||!r)return{container:this,response:!1};this.pageWatcher.watch();const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered(),c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>{t?this.show():this.hide(!1)});e||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const o=this.isWidgetApplied(),i={[r]:()=>o?this.remove():this.pageWatcher.watch(),[a]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():o||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):n()},[c]:()=>{this.hasBeenShown?this.pageWatcher.watch():n()}};"function"==typeof i[t]&&i[t]()}addCloseEvent(...e){const{closeButton:n,overlay:o,overlayClickable:i,layout:s,animationDuration:r=1e3}=DATA,a=[];if(void 0!==o&&!0!==o||!0!==i||"popin"!==s||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",t=>{g(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*r)},{once:!0,capture:!0}];return e.push(...c),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.removeEventListener(...l),e.addEventListener(...l)}),this}getDom(){const{closeButton:t,layout:e,overlayClickable:n,overlay:o=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(e)&&(i.role="dialog"),i.innerHTML=`\n\t\t\t${"popin"===e&&!0===o?`<div ${n?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><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>`,i}loadFont(t,e){if(!t||"inherit"===t||!/otf|ttf/g.test(e))return;const n=document.createElement("style"),o=e.match(k)?e.match(k)[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:i}=n,{backgroundColor:s,isBackgroundImage:r,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:d,borderColor:u,borderRadius:h,borderWidth:m,textColor:y,textAlign:p,fontName:g,fontStyle:b,fontSize:w,isTitle:f,titleTextAlign:v,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:A,overlay:C,overlayColor:$,dropShadow:E,dropShadowColor:L,dropShadowBlur:P,containerMargin:B,containerPadding:D,closeButton:_,closeButtonPosition:I,closeButtonSize:N,closeButtonBorderRadius:R,closeButtonBorderWidth:O,closeButtonBorderColor:j,closeButtonColor:W,closeButtonBackgroundColor:M,buttonsAlign:q,buttonsBorderWidth:V,buttonsBorderColor:H,buttonsBorderRadius:F,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:K,buttonsFontStyle:G,buttonsFontSize:Y,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:Z,secondLinkBorderRadius:X,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:ot,secondLinkFontSize:it,animation:st,animationDuration:rt,animationBehaviour:at,animationSlideDirection:ct}=o?{}:n,lt=document.createElement("style");lt.type="text/css",t()&&lt.setAttribute("abtasty-script-added","true"),this.loadFont(g,b),this.loadFont(T,S),this.loadFont(K,G),this.loadFont(nt,ot);const dt=`background: ${["string"==typeof s?s:"rgba(255, 255, 255, 1)",r&&"string"==typeof a&&a.length?`url(${a})`:"",r&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",r&&"string"==typeof c?`/ ${c}`:"/ auto",r&&d&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ut="number"==typeof m&&m>0,ht=`border: ${[ut?`${m}px`:"unset",ut?"solid":"",ut&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,mt=void 0!==h?`border-radius: ${h}px;`:"",yt=void 0!==y?`color: ${y}; fill: ${y}; -webkit-text-fill-color: ${y};`:"",pt=void 0!==p?`text-align: ${p};`:"",gt=g&&"inherit"!==g?`font-family:${g}_${b.match(k)?b.match(k)[1]:""};`:b||"",bt=w?`font-size: ${w}px;`:"",wt=void 0!==E&&E?`box-shadow: 0 5px ${P}px 0 ${L};`:"",ft=B instanceof Array&&1===B.length&&B[0],vt=ft?`margin: ${ft.top}px ${ft.right}px ${ft.bottom}px ${ft.left}px;`:"",xt=ft?`margin: calc(${ft.top}px * 0.5) calc(${ft.right}px * 0.5) calc(${ft.bottom}px * 0.5) calc(${ft.left}px * 0.5);`:"",Tt=D instanceof Array&&1===D.length&&D[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",At=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!==V&&V?`border-width: ${V}px; border-style: solid;`:"",$t=[H,V].every(t=>void 0!==t)&&V?`border-color: ${H};`:"",Et=void 0!==F?`border-radius: ${F}px;`:"",kt=void 0!==z?`background-color: ${z};`:"",Lt=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Pt=K&&"inherit"!==K?`font-family:${K}_${G.match(k)?G.match(k)[1]:""};`:G||"",Bt=Y?`font-size: ${Y}px;`:"",Dt="number"==typeof Q?`border-width: ${Q}px; border-style: solid;`:"",_t=[Z,Q].every(t=>void 0!==t)&&Q?`border-color: ${Z};`:"",It=void 0!==X?`border-radius: ${X}px;`:"",Nt=void 0!==tt?`background-color: ${tt};`:"",Rt=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Ot=nt&&"inherit"!==nt?`font-family:${nt}_${ot.match(k)?ot.match(k)[1]:""};`:ot||"",jt=it?`font-size: ${it}px;`:"",Wt="popin"!==i||void 0!==C&&!0!==C?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==$?$:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Mt="number"==typeof N?N:16,qt=Mt/2,Vt=o||void 0!==_&&_?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===I?`bottom: calc(100% + ${qt}px)`:`top: ${qt}px`)+";",`right: ${qt}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof R?`border-radius: ${R}px;`:"","number"==typeof O&&O>0?`border: ${O}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof M?`background-color: ${M};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Mt}px;`,`height: ${Mt}px;`,"string"==typeof W?`fill: ${W};`:"","}"].join(""):"",Ht=f&&"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!==v?`text-align: ${v};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match(k)?S.match(k)[1]:""};`:S||"",A?`font-size: ${A}px;`:"","}"].join(""):"";let Ft="";if("string"==typeof st){const e=(rt/1e3).toFixed(2),n=["top","bottom"].includes(ct),o=Number(n),i=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[o]:"0"];n&&i.reverse(),Ft={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${at};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${at};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${i.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${at};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":st].join("")}const zt=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===q?"top":"left"}: 8px;`,Dt,_t,It,Nt,Rt,Ot,jt,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Rt,Ot,jt,"}"];return lt.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,dt,mt,ht,yt,pt,wt,vt,gt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,yt,pt,gt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",St,gt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} a {`,"text-decoration: underline;","}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a, `,`#${this.widgetContainerId} .${this.contentClassName} button {`,"text-decoration: none;","box-sizing: border-box;","display: inline-block;",Ct,$t,Et,kt,Lt,Pt,Bt,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Lt,Pt,Bt,"}",...J?zt:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,xt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,At,"}","}",Wt,Vt,Ht,Ft,`${e}`].join(""),lt}}const B=["top: 0;","top: 50%;","bottom: 0;"],D=["left: 0;","left: 50%;","right: 0;"],_=t=>1===t?"-50%":0,I=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${_(e)}, ${_(t)});`;return`${B[t]}${D[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},N=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,R=()=>{if(N())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:o,popinPercentHeight:i,popinPixelsHeight:s,heightUnit:r}=DATA;return`width: ${"px"===n?e:t}${n};height: ${o?"auto":`${"px"===r?s:i}${r}`};`};class O extends P{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(t=>_(t)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e,widthUnit:n}=DATA,o="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===t?e:t};`,"background: none;","pointer-events: "+(o?"all":"none"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",I(),R(),"pointer-events: all","}",`${N()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!N()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class j extends P{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 W extends P{constructor(t,e){super(t,e),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("")}}const M=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new O;break;case"bannerTop":case"bannerBottom":e=new j;break;case"free":e=new W;break;default:e=new P}return e};function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}var V=/.+\/([^.]+)\.(otf|ttf)$/,H=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"popin",n=DATA,o=n.imageOn,i=n.layout,s=n.inlineLayoutContent;if(!t||!o)return"";var r=DATA.image;return'<div class="countdown_'.concat(e,'_img_container">\n\t\t\t\t<img src="').concat(r,'" class="abtasty-countdown-image ').concat("popin"===i||"free"===i&&!s?"abtasty-countdown-image-popin-layout":"",'">\n\t\t\t</div>')},F=["fr","en","de","es"],z=["day","hour","minute","second"],U={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"}},K="line",G=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",Y=function(t){return F.indexOf(t)>-1}(G)?G:"en",J={day:U.day[Y],days:U.days[Y],hour:U.hour[Y],hours:U.hours[Y],minute:U.minute,minutes:U.minute,second:U.second[Y],seconds:U.second[Y]};function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function Z(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=X(t))||e){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){a=!0,s=t},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function X(t,e){if(t){if("string"==typeof t)return tt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tt(t,e):void 0}}function tt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function et(t){var e=function(t){if("object"!=Q(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Q(e)?e:e+""}var nt=function(){return e=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.testId=e,this.container=this.createContainer(),this.digitElements={},this.textElements={},this.timerElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=J,this.fonts=[],DATA.customTexts&&(this.unitsText={day:DATA.customDaysLabel,days:DATA.customDaysLabel,hour:DATA.customHoursLabel,hours:DATA.customHoursLabel,minute:DATA.customMinutesLabel,minutes:DATA.customMinutesLabel,second:DATA.customSecondsLabel,seconds:DATA.customSecondsLabel})},n=[{key:"remove",value:function(){var t=this,e=DATA.animationDuration;setTimeout(function(){return t.parentContainer.remove()},1.05*e)}},{key:"addCloseEvent",value:function(e){var n=this;e&&e.addEventListener("click",function(e){g(e),t()||n.parentContainer.recurrence.setClosingRecurrence(),n.parentContainer.hide(),n.remove()},{capture:!0,passive:!1})}},{key:"addRedirectionEvent",value:function(e){var n=this;!t()&&e&&e.addEventListener("click",function(){var t=DATA,e=t.autoHide,o=t.timeHide;e&&setTimeout(function(){n.parentContainer.hide(),n.remove()},1e3*o),n.parentContainer.recurrence.setValidationRecurrence()},{useCapture:!0,once:!0})}},{key:"createContainer",value:function(){var t=DATA,e=t.linkType,n=t.redirectionUrl,o=t.openInNewTab,i=document.createElement(e&&e.includes("widget")?"a":"div");switch(i.classList.add("abtasty-countdown"),e){case"widget":i.href=n,i.target=o?"_blank":"_self",this.addRedirectionEvent(i);break;case"widgetClose":i.href="#",i.dataset.abtastyActionnable="true",this.addCloseEvent(i)}return i}},{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){var e,n,o=DATA,i=o.layoutType,s=o.displayElapsedElements,r=o.layout,a=o.endSettings,c=Z(z);try{for(c.s();!(e=c.n()).done;){var l=e.value,d=this.timerElements[l],u=String(t[l]).padStart(2,"0"),h=1===u?this.unitsText[l]:this.unitsText["".concat(l,"s")];if(s||(d.dataset.timeEnd=0===t[l]?"true":"false"),"textDigits"===i)d.textContent="".concat(u," ").concat(h);else{var m=this.digitElements[l],y=this.textElements[l];m.textContent=u,y.textContent=h,this.maxWidth<m.offsetWidth&&(this.maxWidth=m.offsetWidth,m.style.minWidth="".concat(this.maxWidth,"px")),m.style.minWidth="".concat(this.maxWidth,"px")}}}catch(t){c.e(t)}finally{c.f()}[null,"",a].includes(this.parentContainer.domElement.ariaLabel)&&["popin","bannerTop","bannerBottom"].includes(r)&&(this.parentContainer.domElement.ariaLabel=(n=this.parentContainer.domElement.querySelectorAll(".abtasty-countdown-clock, .abtasty-countdown-top-message"),function(t){if(Array.isArray(t))return tt(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||X(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map(function(t){return t.textContent.replace(/\s+/g," ")},"").join("").trim())}},{key:"onTimeEnd",value:function(){var t,e=DATA,n=e.endSettings,o=e.layout;clearInterval(this.timeLoop);var i=this.container.querySelector("abtasty-countdown-clock");if(i&&(i.ariaLive="off"),"hideWidget"===n)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");var s,r=Z(this.container.querySelectorAll(".abtasty-countdown-elm-time"));try{for(r.s();!(s=r.n()).done;)s.value.removeAttribute("data-time-end")}catch(t){r.e(t)}finally{r.f()}["popin","bannerTop","bannerBottom"].includes(o)&&(this.parentContainer.domElement.ariaLabel=DATA.endMessage);for(var a={endText:!0,endCountdown:["showText","showTextAndButton"].includes(n),endButton:["hideCountdownAndShowTextAndButton","showTextAndButton"].includes(n)},c=["abtasty-countdown-".concat(n),"abtasty-countdown-finish"],l=0,d=Object.keys(a);l<d.length;l++){var u=d[l],h="abtasty-countdown-".concat(u),m=a[u]?"show":"hide";c.push("".concat(h,"-").concat(m))}(t=this.container.classList).add.apply(t,c)}},{key:"setCountdown",value:function(){var e=new Date,n=function(e,n){switch(e.type){case"global":return e.timestamp-n.getTime();case"local":if(t())return e.previewTimestamp-n.getTime();var o=e.timecomponents,i=o.year,s=o.month,r=o.day,a=o.hour,c=o.minute;return new Date(i,s-1,r,a,c).getTime()-n.getTime();default:return 0}}(DATA.dateTime,e)/1e3;if(window.ABTastyEditor&&("ifEnded"===DATA.previewBlock&&(n=-1),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();var o=Math.floor(n/86400);n-=86400*o;var i=Math.floor(n/3600);n-=3600*i;var s=Math.floor(n/60);n-=60*s;var r=Math.floor(n);this.setText({day:o,hour:i,minute:s,second:r})}},{key:"setButton",value:function(){var t=this,e=function(e,n,o,i){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=document.createElement("a");return r.ariaLabel=e,s&&(r.className="second_link"),r.innerHTML="<span>".concat(e,"</span>"),r.href="button"===n?o:"#","button"===n?(r.target=i?"_blank":"_self",t.addRedirectionEvent(r)):(r.dataset.abtastyActionnable="true",t.addCloseEvent(r)),r},n=DATA,o=n.linkType,i=n.buttonText,s=n.redirectionUrl,r=n.openInNewTab,a=n.secondLink,c=n.secondLinkText,l=n.secondLinkType,d=n.secondLinkURL,u=n.secondLinkOpenInNewTab,h=n.endBtnTargetBlank,m=n.endBtnLabel,y=n.endBtnLink,p=this.container.querySelector(".abtasty-countdown-bottom-button"),g=[];if(o&&o.includes("button")){var b=e(i,o,s,r);if(g.push(b),a){var w=e(c,l,d,u,a);g.push(w)}}for(var f=0,v=g;f<v.length;f++){var x=v[f];p.appendChild(x)}var T=this.container.querySelector(".abtasty-countdown-finish-button"),S=document.createElement("a");S.href=y,S.target=h?"_blank":"_self",S.innerHTML=m,S.ariaLabel=m,T.appendChild(S)}},{key:"setContent",value:function(){var t=this.container.querySelector(".abtasty-countdown-finish-text"),e=document.createElement("div");if(e.innerHTML=DATA.endMessage,t.appendChild(e),"textDigits"!==DATA.layoutType){var n=this.container.querySelector(".abtasty-countdown-top-message"),o=document.createElement("p");o.innerHTML=DATA.message,n.appendChild(o)}}},{key:"init",value:function(t){var e=this,n=DATA,o=n.layout,i=n.inlineLayoutContent,s=n.imageOn,r=n.hideResponsiveImage,a=n.hideResponsiveText;try{this.parentContainer=t;var c=["free","popin"].includes(o);!function(n){if(e.container.classList.add("abtasty-countdown-layout-".concat(n)),!c&&s&&(r&&e.container.classList.add("abtasty-countdown-hide-responsive-image"),a&&e.container.classList.add("abtasty-countdown-hide-responsive-text")),n===K){c&&(e.parentContainer.domElement.querySelector(".".concat(t.contentClassName)).classList.add("abtasty-countdown-content-".concat(o,"-inline")),e.container.classList.add("abtasty-countdown-layout-".concat(o,"-inline")));var i,l=Z(e.parentContainer.domElement.querySelectorAll(".".concat(t.closeButtonClassName)));try{for(l.s();!(i=l.n()).done;)i.value.classList.add("abtasty-countdown-close-inline")}catch(t){l.e(t)}finally{l.f()}}}(c&&!i?"free":K),this.container.innerHTML=function(){var t=DATA,e=t.layout,n=t.inlineLayoutContent,o=t.imagePosition,i=t.layoutType,s="popin"===e||"free"===e&&!n,r="\n ".concat(H(s&&!("popin"===e&&n),"popin"),'\n <div class="abtasty-countdown-layout-').concat(e,' abtasty-countdown-mini">\n ').concat(H(!s&&"before"===o,"banner"),'\n <div class="abtasty-countdown-top-message">\n ').concat(DATA.messageMinimalistMode.split(/!countdown!/gm).map(function(t){return"<p>".concat(t.trim(),"</p>")}).join('\n <span class="abtasty-countdown-days abtasty-countdown-elm-time"></span>\n <span class="abtasty-countdown-hours abtasty-countdown-elm-time"></span>\n <span class="abtasty-countdown-minutes abtasty-countdown-elm-time"></span>\n <span class="abtasty-countdown-seconds abtasty-countdown-elm-time"></span>\n').replace("<p></p>",""),"\n </div>\n ").concat(H(!s&&"after"===o,"banner"),'\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button buttons_container"></div>\n </div>\n '),a="\n ".concat(H(s&&!("popin"===e&&n),"popin"),'\n <div class="abtasty-countdown-layout-').concat(e,' abtasty-countdown-standard">\n ').concat(H(!s&&"before"===o,"banner"),'\n <div class="abtasty-countdown-clock" role="timer" aria-live="polite">\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(H(!s&&"after"===o,"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 buttons_container"></div>\n </div>\n ');return"textDigits"===i?r:a}(),this.container.insertAdjacentElement("afterbegin",(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 (min-width:741px){.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}}@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}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}}@media (max-width:579px){.ab_widget_container_countdown_content{max-width:100%;width:100vw}.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-hide-responsive-image .countdown_banner_img_container,.abtasty-countdown-hide-responsive-text .abtasty-countdown-top-message{display:none}}.abtasty-countdown,.abtasty-countdown>div{display:inline-block;text-align:center}.abtasty-countdown>div{margin:10px;overflow:auto;white-space:normal;width:100%}.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{-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-standard .abtasty-countdown-clock>.abtasty-countdown-elm-time[data-time-end=true]+.abtasty-countdown-elm-time[data-time-end=true],.abtasty-countdown-standard .abtasty-countdown-clock>.abtasty-countdown-elm-time[data-time-end=true]:first-child{display:none}.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}.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}.abtasty-countdown .abtasty-countdown-mini .abtasty-countdown-elm-time{border:none;margin:0;padding:0}.abtasty-countdown .abtasty-countdown-mini .abtasty-countdown-top-message{display:inline-block;white-space:unset;width:100%}.abtasty-countdown .abtasty-countdown-mini .abtasty-countdown-top-message>*{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.abtasty-countdown-mini .abtasty-countdown-top-message>.abtasty-countdown-elm-time[data-time-end=true]+.abtasty-countdown-elm-time[data-time-end=true],:not(.abtasty-countdown-showTextAndButton) :not(.abtasty-countdown-showText) .abtasty-countdown-mini .abtasty-countdown-top-message>.abtasty-countdown-elm-time[data-time-end=true]:first-child{display:none}"," ").concat(function(){!function(){var t,e=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return q(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(t,e):void 0}}(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,r=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return s=t.done,t},e:function(t){r=!0,i=t},f:function(){try{s||null==e.return||e.return()}finally{if(r)throw i}}}}([{name:DATA.messageFontName,style:DATA.messageFontStyle},{name:DATA.numbersfontName,style:DATA.numbersfontStyle},{name:DATA.legendfontName,style:DATA.legendfontStyle}]);try{for(e.s();!(t=e.n()).done;){var n=t.value,o=n.name,i=n.style;if(o&&"inherit"!==o&&/otf|ttf/g.test(i)){var s=document.createElement("style"),r=i.match(V)?i.match(V)[1]:"";s.innerHTML="@font-face { font-family: '".concat(o,"_").concat(r,"'; src: url('").concat(i,"'); font-display: swap; }"),document.head.appendChild(s)}}}catch(t){e.e(t)}finally{e.f()}}();var t=DATA,e=t.buttonsAlign,n=t.messageAlign,o=t.textColor,i=t.messageFontSize,s=t.messageFontName,r=t.messageFontStyle,a=t.numbersfontSize,c=t.numberstextColor,l=t.numbersfontName,d=t.numbersfontStyle,u=t.legendfontName,h=t.legendfontStyle,m=t.legendfontSize,y=t.legendtextColor,p=t.countdownBorderRadius,g=t.countdownBorderWidth,b=t.countdownBorderColor,w=t.numbersBackgroundColor,f=void 0!==e&&"fill"!==e?"text-align: ".concat(e,";"):"",v=function(t,e){return t&&"inherit"!==t?"font-family:".concat(t,"_").concat(e.match(V)?e.match(V)[1]:"",";"):e||""},x=v(s,r),T=v(l,d),S=v(u,h);return"\n .abtasty-countdown-bottom-button,\n .abtasty-countdown-finish-button {\n ".concat(f,";\n }\n .abtasty-countdown-bottom-button a,\n .abtasty-countdown-finish-button a {\n width: ").concat("fill"===e?"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(n," !important;\n color: ").concat(o,";\n font-size: ").concat(i,"px;\n ").concat(x,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number,\n .abtasty-countdown .abtasty-countdown-elm-number * {\n font-size: ").concat(a,"px;\n color: ").concat(c,";\n fill: ").concat(c,";\n -webkit-text-fill-color: ").concat(c,";\n font-weight: initial;\n ").concat(T,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text,\n .abtasty-countdown .abtasty-countdown-elm-text * {\n ").concat(S,";\n font-size: ").concat(m,"px;\n color: ").concat(y,";\n -webkit-text-fill-color: ").concat(y,";\n }\n\n .abtasty-countdown > div:not(.abtasty-countdown-mini) .abtasty-countdown-elm-time {\n border-radius: ").concat(p,"px;\n border: ").concat(g,"px solid ").concat(b,";\n background-color: ").concat(w,";\n }\n\n .abtasty-countdown > .abtasty-countdown-mini .abtasty-countdown-elm-time {\n font-size: ").concat(a,"px;\n color: ").concat(c,";\n fill: ").concat(c,";\n -webkit-text-fill-color: ").concat(c,";\n font-weight: initial;\n ").concat(T,";\n }")}())));var l,d=Z(z);try{for(d.s();!(l=d.n()).done;){var u=l.value,h=this.container.querySelector(".abtasty-countdown-".concat(u,"s"));this.timerElements[u]=h,this.digitElements[u]=h.querySelector(".abtasty-countdown-elm-number"),this.textElements[u]=h.querySelector(".abtasty-countdown-elm-text")}}catch(t){d.e(t)}finally{d.f()}this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),this.setCountdown()}catch(t){console.warn("Countdown error occurred during widget rendering:",t)}}}],n&&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,et(o.key),o)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n}();function ot(t){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ot(t)}function it(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */it=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},r=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function d(t,e,n,o){var s=e&&e.prototype instanceof g?e:g,r=Object.create(s.prototype),a=new L(o||[]);return i(r,"_invoke",{value:C(t,n,a)}),r}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=d;var h="suspendedStart",m="executing",y="completed",p={};function g(){}function b(){}function w(){}var f={};l(f,r,function(){return this});var v=Object.getPrototypeOf,x=v&&v(v(P([])));x&&x!==n&&o.call(x,r)&&(f=x);var T=w.prototype=g.prototype=Object.create(f);function S(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function A(t,e){function n(i,s,r,a){var c=u(t[i],t,s);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==ot(d)&&o.call(d,"__await")?e.resolve(d.__await).then(function(t){n("next",t,r,a)},function(t){n("throw",t,r,a)}):e.resolve(d).then(function(t){l.value=t,r(l)},function(t){return n("throw",t,r,a)})}a(c.arg)}var s;i(this,"_invoke",{value:function(t,o){function i(){return new e(function(e,i){n(t,o,e,i)})}return s=s?s.then(i,i):i()}})}function C(e,n,o){var i=h;return function(s,r){if(i===m)throw Error("Generator is already running");if(i===y){if("throw"===s)throw r;return{value:t,done:!0}}for(o.method=s,o.arg=r;;){var a=o.delegate;if(a){var c=$(a,o);if(c){if(c===p)continue;return c}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(i===h)throw i=y,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);i=m;var l=u(e,n,o);if("normal"===l.type){if(i=o.done?y:"suspendedYield",l.arg===p)continue;return{value:l.arg,done:o.done}}"throw"===l.type&&(i=y,o.method="throw",o.arg=l.arg)}}}function $(e,n){var o=n.method,i=e.iterator[o];if(i===t)return n.delegate=null,"throw"===o&&e.iterator.return&&(n.method="return",n.arg=t,$(e,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),p;var s=u(i,e.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,p;var r=s.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(o.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}throw new TypeError(ot(e)+" is not iterable")}return b.prototype=w,i(T,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,c,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(A.prototype),l(A.prototype,a,function(){return this}),e.AsyncIterator=A,e.async=function(t,n,o,i,s){void 0===s&&(s=Promise);var r=new A(d(t,n,o,i),s);return e.isGeneratorFunction(n)?r:r.next().then(function(t){return t.done?t.value:r.next()})},S(T),l(T,c,"Generator"),l(T,r,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),n=[];for(var o in e)n.push(o);return n.reverse(),function t(){for(;n.length;){var o=n.pop();if(o in e)return t.value=o,t.done=!1,t}return t.done=!0,t}},e.values=P,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(o,i){return a.type="throw",a.arg=e,n.next=o,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],a=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var c=o.call(r,"catchLoc"),l=o.call(r,"finallyLoc");if(c&&l){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var r=s?s.completion:{};return r.type=t,r.arg=e,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var i=o.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={iterator:P(e),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=t),p}},e}function st(t,e,n,o,i,s,r){try{var a=t[s](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,i)}function rt(){var t;return t=it().mark(function t(){var e,n,o,i,s;return it().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return h("Widget launch"),e=M(),t.next=4,e.init(!0);case 4:return n=t.sent,o=n.response,i=e.domElement.querySelector(".".concat(e.contentClassName)),(s=new nt(TEST_ID,DATA)).init(e),s.insert(i,"beforeend"),o&&e.show(),t.abrupt("return",s);case 12:case"end":return t.stop()}},t)}),rt=function(){var e=this,n=arguments;return new Promise(function(o,i){var s=t.apply(e,n);function r(t){st(s,o,i,r,a,"next",t)}function a(t){st(s,o,i,r,a,"throw",t)}r(void 0)})},rt.apply(this,arguments)}!function(){rt.apply(this,arguments)}()}();
1
+ !function(){"use strict";const t=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),e=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},n=t=>new Function(`try {\n\t\t${t}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),o=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),i=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),s=()=>window.ABTasty&&!0===window.ABTasty.consentReady,r=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},a=()=>{const t=r();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},c=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,l=n=>{const o=(()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),i=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(o||i){const t=a();window.console.log(`%c${t} - ${o?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${n}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},d=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=e?[]:null;if("string"!=typeof t||!t.trim().length)return n;const[o,i,s]=t.split("[]").map(t=>t.trim()),r=Boolean(s)?s:t,a=i?document.querySelector(o)?.[i]:document;return a?e?[...a.querySelectorAll(r)]:a.querySelector(r):n},h=t=>u(t,!1),m=t=>u(t,!0),y=(t,e)=>{const n=document.querySelector("body")||document.documentElement,o={childList:!0,subtree:!0,attributes:!0},i=()=>s.disconnect(),s=new MutationObserver(()=>{const n=h(e);return n&&!i()&&t(n)});return{clear:i,observe:(t=n)=>s.observe(t,o)}},g=()=>{},p=(e,n)=>{const o=h(e),i={selector:e,clear:g,observe:g};if(o)return setTimeout(()=>n(o),0),i;if(t())return setTimeout(()=>p(e,n),1e3),i;if(e.includes("[]"))return((t,e)=>{const[n,o]=e.split("[]").map(t=>t.trim()),i=h(n),s=i?.[o],{clear:r,observe:a}=y(t,e),c=()=>{const n=h(e);return n&&!l()&&t(n)},l=()=>{r(),i?.removeEventListener("load",c)},d=()=>{a(s),"iframe"===i?.localName&&i.addEventListener("load",c)};return d(),{selector:e,clear:l,observe:d}})(n,e);const{clear:s,observe:r}=y(n,e);return r(),{selector:e,clear:s,observe:r}};function b(t,e){const n=t.parentElement||t.getRootNode().host;return e(t)||!n?t:b(n,e)}const w=e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},f=(t,e)=>[...m(e)].some(n=>{const[o,,i]=e.split("[]"),s=i??o;return n===t||!!t.closest(s)});let v=!1;class x{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=null,this.mutationObserver=null,this.mouseOverEvent=null,this.scrollEvent=null,this.onTransitionEnd=null,this.onIframeLoad=null}transitionOverHandler(t){const e=[t,"transitionend",this.checkElements.bind(this),!0];return this.getEvents(...e)}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(t){const e={root:t,rootMargin:"0px",threshold:0};return this.visibilityObserver??=new IntersectionObserver(this.intersectionHandler.bind(this),e),this.visibilityObserver}startMutationObserver(t){return this.mutationObserver??=new MutationObserver(this.checkElements.bind(this)),this.mutationObserver.observe(t,{attributes:!0,childList:!0,subtree:!0}),this.mutationObserver}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:o})=>{if(n.isSameNode(t))return!0;const[i,,s]=o.split("[]"),r=s??i,a=[...t.querySelectorAll(r)];if(a.length&&a.includes(n))return!0;if(e.includes(n))return!0;if(!t.parentElement?.children?.length)return;const c=[...t.parentElement.children],l=c.findIndex(e=>e.isSameNode(t)),d=c.filter((t,e)=>e>l);if(d.length){if(d.includes(n))return!0;if(d.some(t=>[...t.querySelectorAll(r)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:o}=n,i=this.targets.find(e=>e.selector===t&&e.uniqueId===o);i&&i.resolve(e),this.clear(t,o)}}getEvents(t,...e){return{start:()=>t?.addEventListener(...e),clear:()=>t?.removeEventListener(...e)}}mouseOverHandler(t){const e=[t,"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",t=>{const e=t.composedPath(),{target:n}=t;setTimeout(()=>this.onMouseOver({target:n,path:e}),50)},!0];return this.getEvents(...e)}scrollEventHandler(t){const e=[t,"scroll",(n=this.checkElements.bind(this),()=>{v||(v=!0,setTimeout(()=>{n(),v=!1},100))}),{passive:!0}];var n;return this.getEvents(...e)}isElementVisible(t){return this.isElementOpaque(t)&&this.isElementTopmost(t)}isElementOpaque(t){return"HTML"===b(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,i=0;for(;!o&&i<n.length;){const e=t.getRootNode()?.elementFromPoint(...n[i]);o=t===e||e?.contains(t)||t.contains(e),i+=1}return o}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=h(t),[o,,i]=t.split("[]"),s=i??o;n&&!this.existingTargets.find(t=>t.element.matches(s)&&t.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!h(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{const[o,,i]=t.split("[]"),s=i??o;if(e.matches(s)&&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})}onLoadIframe(t){const e=[t.defaultView.frameElement,"load",()=>this.watch(selector,resolve,uniqueId).bind(this),{passive:!0}];return this.getEvents(...e)}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n});const{clear:o}=p(t,t=>{o();const e=t.getRootNode(),n="body"in e?e.body:document;this.mouseOverEvent=this.mouseOverHandler(e),this.scrollEvent=this.scrollEventHandler(e),this.onTransitionEnd=this.transitionOverHandler(e),e.defaultView?.frameElement&&(this.onIframeLoad=this.onLoadIframe(e),this.onIframeLoad.start()),this.startVisibilityObserver(n),this.startMutationObserver(n),this.checkElements()})}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=h(t);n&&this.visibilityObserver?.unobserve(n),0===this.targets.length&&(this.mutationObserver?.disconnect(),this.onIframeLoad?.clear()),0===this.inViewportTargets.length&&(this.mouseOverEvent?.clear(),this.scrollEvent?.clear(),this.onTransitionEnd?.clear())}}const T="remove",S="rebuild",A="update",E="ABTastyData";class C{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n,triggerTarget:o}){this.event=t,this.selector=Boolean(e)?e:"body",this.target="string"==typeof o?h(e):o,this.delay=1e3*n,this.triggerElements=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={},this.elementWaiters=[]}async onElementVisible({promise:t,resolve:e}){const n=d(`${this.event}DomReady`);this.promises.push(n);const{clear:o}=p(this.selector,()=>{const t=new x;this.visibilityObservers.push(t),t.watch(this.selector,e,c())});return this.elementWaiters.push(o),t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const o=["readystatechange",()=>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=({isTrusted:t,target:n})=>{if(t)return(n.isEqualNode(this.target)||f(n,this.selector))&&e(!0)},{clear:o}=p(this.selector,t=>{o();const e=document.createElement("style");e.id=`Click_${c()}`;const[i,,s]=this.selector.split("[]"),r=s??i;e.innerHTML=`${r} {\n\t\t\t\tcursor: pointer !important;\n\t\t\t\tpointer-events: all !important;\n\t\t\t}`;const a=t.getRootNode();("head"in a?a.head:a).appendChild(e),this.triggerElements.push(e);const l=["click",n,{passive:!0,capture:!0}];this.eventsListeners.push([a,...l]),a.addEventListener(...l)});return this.elementWaiters.push(o),t}onHover({promise:t,resolve:e}){const n=({isTrusted:t,target:n})=>{if(t)return(this.target?n.isEqualNode(this.target):f(n,this.selector))&&e(!0)},{clear:o}=p(this.selector,t=>{const e=t.getRootNode(),o="body"in e?e.body:[...e.childNodes].find(e=>e.contains(t)),i=["mouseenter",n,{passive:!0,capture:!0}];this.eventsListeners.push([o,...i]),o.addEventListener(...i)});return this.elementWaiters.push(o),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",({isTrusted:t,clientY:n})=>{t&&n<=0&&e(!0)},{passive:!0}],{clear:o}=p("html",t=>{o(),this.eventsListeners.push([t,...n]),t.addEventListener(...n)});return t}onReengage({promise:t,resolve:e}){const n=this.delay;let o=n;const i=[...document.querySelectorAll("*:empty")].map(t=>t.contentDocument||t.shadowRoot).filter(t=>t),s=[({isTrusted:t})=>{t&&(o=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{[document,...i].forEach(e=>{this.eventsListeners.push([e,t,...s]),e.addEventListener(t,...s)})});const r=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(r),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.scrollY<n?e(!0):n=window.scrollY)},{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 i=(()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S?.USER?.accountIdentifier?.length?t=window.ABTASTY_S.USER.accountIdentifier:"function"==typeof window.ABTasty?.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty?.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t})(),{viewInterval:s,spNoTrim:r}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?o(`${this.socialProofStore[t][s]}`):o(!1);else if(t&&i){const a=e=>(this.socialProofStore[t]=e,o(!!n(e)&&`${e[s]}`));fetch(`https://api-social-proof.abtasty.com/clients/${i}/metrics/${e}?key=${t}${r?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(a).catch(()=>l("Failed to fetch datas from server."))}else o(!1)}getSocialProofDatas({promise:t,resolve:e},i,s=!1){const{productKey:r,keyType:a}=(()=>{const{socialProofContentType:t,productKeyProvider:e,pathToProductKey:i,customJSProductKey:s,productSKU:r}=DATA;if(2===t)return{productKey:o(),keyType:"url"};{let a=null,c="sku";switch(e){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${i};`);break;case"customJSProductKey":a=n(s);break;case"productSKU":a=r}return a||3!==t||(a=o(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:d,triggerSocialProofMinPurchases:u,triggerSocialProofMinPageViews:h}=DATA,m={pv:h,i:u,"v-pv":d}[i];return[typeof c,typeof m].includes("undefined")&&e(!1),s&&!r&&(l("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),e(!1)),this.checkSocialProofConditions(r,"v-pv"===i&&"sku"===a?"v-i":i,t=>{const e=void 0!==t[c]&&t[c]>=m;return e||l(`Widget will not be shown, Social Proof API returned ${t[c]} while ${m} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!s()){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(E);const i=()=>JSON.parse(o)?.ActionTracking?.some(({name:t})=>t===n),s=["storage",({key:t,newValue:n})=>{t===E&&(o=n,i()&&e(!0))},{passive:!0,capture:!0}];return o&&i()?e(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let o=localStorage.getItem(E);const i=()=>n<=(o?JSON.parse(o)?.VisitedPages?.length:0),s=["storage",({key:t,newValue:n})=>{t===E&&(o=n,i()&&e(!0))},{passive:!0,capture:!0}];return o&&i()?e(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:o}=DATA;let i=0,s=!1;const r=["click",({isTrusted:t})=>{if(t&&(i+=1,i>=n&&e(!0),!s)){s=!0;const t=setTimeout(()=>{i=0,s=!1},o);this.timeouts.push(t)}},{passive:!0,capture:!0}],a=t=>{this.eventsListeners.push([t,...r]),t.addEventListener(...r)},{clear:c}=p("iframe []contentDocument[] body > *",()=>{const t=document.getElementsByTagName("iframe");for(const e of t){"contentDocument"in e&&"body"in e.contentDocument&&a(e.contentDocument);const t=()=>a(e.contentDocument);e.addEventListener("load",t),this.eventsListeners.push([e,"onIframeLoad",t])}});return this.elementWaiters.push(c),a(document),t}clear(){this.triggerElements=this.triggerElements.filter(t=>(t.remove(),!1)),this.eventsListeners=this.eventsListeners.filter(t=>{const[e,...n]=t;return e&&n.length>1&&e.removeEventListener(...n),!1}),this.timeouts=this.timeouts.filter(t=>(clearTimeout(t),!1)),this.intervals=this.intervals.filter(t=>(clearInterval(t),!1));const t=c();return this.visibilityObservers=this.visibilityObservers.filter(e=>(e.clear(this.selector,t),!1)),this.promises=this.promises.filter(t=>(t.resolve(!1),!1)),this.elementWaiters=this.elementWaiters.filter(t=>(t(),!1)),this}async isTriggered(){this.clear();const t=d(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.getSocialProofDatas(t,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(t,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(t,"v-pv")},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=d(`${this.event}Delay`);this.promises.push(t);const e=setTimeout(()=>{t.resolve(!0),this.clear()},this.delay);return this.timeouts.push(e),t.promise})():n}}const $="display",k="closing",L="validation",P="ABTastyWidgets",D=`${P}Temporary`;class I{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=c(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:t}){const e=localStorage.getItem(D),n=sessionStorage.getItem(P);"ABTastyData"===t&&!e&&n&&localStorage.setItem(D,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(P);return JSON.parse(e)}catch(e){return t.removeItem(P),!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(P,JSON.stringify(o)),o):(t.removeItem(P),!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(D),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(P,t),localStorage.removeItem(D));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 o=this.getTypeOfStorage(t);if(e()||!o&&"object"!=typeof o)return!1;const{storageString:i,storageMethod:r}=o,a=this.getStamp(t),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),d=async()=>{if(!s()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new C({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 o=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};r.setItem(P,JSON.stringify(o)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!r)return!1;if(l&&n!==L)if(n===k&&l!==L)d();else{if(n!==$||l===L||l===k)return!1;d()}else d();return a}setDisplayRecurrence(){const t=$;this.setRecurrence(this.displayRecurrence,t)}setClosingRecurrence(){const t=k;this.setRecurrence(this.closingRecurrence,t)}setValidationRecurrence(){const t=L;this.setRecurrence(this.validationRecurrence,t)}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 B{constructor(t,e,n){this.isWidgetApplied=t,this.callback=e,this.shouldUpdate=n,this.triggerIframeTarget=null,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(t){const e=!t&&this.isWidgetApplied(),n=e?this.shouldUpdate&&A:S;return n?(this.clearWatcher(),this.callback(n,!t,e),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:t}}){t===TEST_ID&&(this.callback(S,!1),this.watch())}onTagRollback({target:t}){return this.clearWatcher(t),this.callback(T,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(t){return i()?t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler():this:this.callback(T,!1)}watch(e,n){if(t())return this;if(this.clearWatcher(e),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams),n?.includes("[]contentDocument[]")){const t=n.split("[]")[0].trim(),{clear:e}=p(t,t=>{e(),this.triggerIframeTarget=t,t.addEventListener("load",this.decisionHandler.bind(this))})}const o=e?.defaultView?.frameElement;o&&this.triggerIframeTarget!==o&&o.addEventListener("load",this.decisionHandler.bind(this));const{clear:i}=p("body",t=>{i();const n=e?.body||e||t;this.observer.observe(n,{childList:!0,subtree:!0})});return this}clearTriggerElementWatcher(){this.triggerIframeTarget?.removeEventListener("load",this.decisionHandler.bind(this))}clearWatcher(t){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this.clearTriggerElementWatcher(),t?.defaultView?.frameElement?.removeEventListener("load",this.decisionHandler.bind(this)),this}}const N=/.+\/([^.]+)\.(otf|ttf)$/,_=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class R{constructor(e,n){this.children=void 0,this.uniqueId=`${c()}${n?`_${n}`:""}`,this.widgetName=r(),this.prettyName=a(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:o}=DATA,i=!e&&!n&&!o;if(t()||i)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`]},r={};return e&&(r.displayRecurrence=s[e]("displayRecurrence")),n&&(r.closingRecurrence=s[n]("closingRecurrence")),o&&(r.validationRecurrence=s[o]("validationRecurrence")),r})(),this.triggerParams=(e=>{let{triggerEvent:n}=DATA;const{triggerEventClick:o,triggerEventHover:i,triggerEventReengageDelay:s,socialProofContentType:r,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(t()||!n&&!r)return!1;const l={click:()=>o,hover:()=>i,elementVisible:()=>a},d=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?s:c;return r&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][r]),{triggerEvent:n,triggerSelector:d,triggerDelay:u,triggerTarget:e}})(e),this.recurrence=!!this.recurrenceParams&&new I(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new C(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&_.includes(this.triggerParams.triggerEvent),this.pageWatcher=new B(this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),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.rootElement=null,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.elementsWaiters=[]}clearGivenClearables(){this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement?.isConnected&&this.domElement.ownerDocument?.defaultView}removeOldDomElement(){const t=this.rootElement?.getElementById(this.widgetContainerId);return t?.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const t=["free"];"drawer"===DATA.layout&&DATA.customTarget&&t.push("drawer");const e=t.includes(DATA.layout);return new Promise(t=>{const{elementReferrer:n="body",referrerInsertType:o="beforeend"}=e?DATA:{},i=p(n,e=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==n),this.rootElement=e.getRootNode(),this.removeOldDomElement(),this.domElement.appendChild(this.styleElement),t(e.insertAdjacentElement(o,this.domElement))});this.elementsWaiters.push(i)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(this.rootElement),this.domElement?.isConnected&&this.domElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch(this.rootElement):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.rootElement),this}hide(e=!0){return!t()&&this.hasBeenShown&&e&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),e&&(this.pageWatcher.clearWatcher(this.rootElement),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(e){const n=t(),o=i(),s=this.trigger?.promises?.length,r=!this.recurrence||this.recurrence.isOver();if(!n&&!o||s||!r)return{container:this,response:!1};this.pageWatcher.watch(this.rootElement||document,this.triggerParams.triggerSelector);const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered();this.pageWatcher.clearTriggerElementWatcher();const c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(t,e,n){const o=()=>this.init().then(({response:t})=>{t?this.show():this.hide(!1)});e||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const i={[T]:()=>n?this.remove():this.pageWatcher.watch(this.rootElement),[S]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch(this.rootElement):n||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):o()},[A]:()=>{this.hasBeenShown?this.pageWatcher.watch():o()}};"function"==typeof i[t]&&i[t]()}addCloseEvent(...e){const{closeButton:n,overlay:o,overlayClickable:i,layout:s,animationDuration:r=1e3}=DATA,a=[];if(void 0!==o&&!0!==o||!0!==i||"popin"!==s||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",t=>{w(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*r)},{once:!0,capture:!0}];return e.push(...c),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.removeEventListener(...l),e.addEventListener(...l)}),this}getDom(){const{closeButton:t,layout:e,overlayClickable:n,overlay:o=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(e)&&(i.role="dialog"),i.innerHTML=`\n\t\t\t${"popin"===e&&!0===o?`<div ${n?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><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>`,i}loadFont(t,e){if(!t||"inherit"===t||!/otf|ttf/g.test(e))return;const n=document.createElement("style"),o=e.match(N)?e.match(N)[1]:"";n.innerHTML=`@font-face { font-family: '${t}_${o}'; src: url('${e}'); font-display: swap; }`;const i=this.rootElement?.head||document.head;i?.appendChild(n)}getStyleTag(e="",n=DATA){const{noStyles:o,layout:i}=n,{backgroundColor:s,isBackgroundImage:r,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:d,borderColor:u,borderRadius:h,borderWidth:m,textColor:y,textAlign:g,fontName:p,fontStyle:b,fontSize:w,isTitle:f,titleTextAlign:v,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:A,overlay:E,overlayColor:C,dropShadow:$,dropShadowColor:k,dropShadowBlur:L,containerMargin:P,containerPadding:D,closeButton:I,closeButtonPosition:B,closeButtonSize:_,closeButtonBorderRadius:R,closeButtonBorderWidth:O,closeButtonBorderColor:W,closeButtonColor:j,closeButtonBackgroundColor:V,buttonsAlign:H,buttonsBorderWidth:M,buttonsBorderColor:q,buttonsBorderRadius:F,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:K,buttonsFontStyle:G,buttonsFontSize:Y,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:Z,secondLinkBorderRadius:X,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:ot,secondLinkFontSize:it,animation:st,animationDuration:rt,animationBehaviour:at,animationSlideDirection:ct}=o?{}:n,lt=document.createElement("style");t()&&lt.setAttribute("abtasty-script-added","true"),this.loadFont(p,b),this.loadFont(T,S),this.loadFont(K,G),this.loadFont(nt,ot);const dt=`background: ${["string"==typeof s?s:"rgba(255, 255, 255, 1)",r&&"string"==typeof a&&a.length?`url(${a})`:"",r&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",r&&"string"==typeof c?`/ ${c}`:"/ auto",r&&d&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ut="number"==typeof m&&m>0,ht=`border: ${[ut?`${m}px`:"unset",ut?"solid":"",ut&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,mt=void 0!==h?`border-radius: ${h}px;`:"",yt=void 0!==y?`color: ${y}; fill: ${y}; -webkit-text-fill-color: ${y};`:"",gt=void 0!==g?`text-align: ${g};`:"",pt=p&&"inherit"!==p?`font-family:${p}_${b.match(N)?b.match(N)[1]:""};`:b||"",bt=w?`font-size: ${w}px;`:"",wt=void 0!==$&&$?`box-shadow: 0 5px ${L}px 0 ${k};`:"",ft=P instanceof Array&&1===P.length&&P[0],vt=ft?`margin: ${ft.top}px ${ft.right}px ${ft.bottom}px ${ft.left}px;`:"",xt=ft?`margin: calc(${ft.top}px * 0.5) calc(${ft.right}px * 0.5) calc(${ft.bottom}px * 0.5) calc(${ft.left}px * 0.5);`:"",Tt=D instanceof Array&&1===D.length&&D[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",At=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);`:"",Et=void 0!==M&&M?`border-width: ${M}px; border-style: solid;`:"",Ct=[q,M].every(t=>void 0!==t)&&M?`border-color: ${q};`:"",$t=void 0!==F?`border-radius: ${F}px;`:"",kt=void 0!==z?`background-color: ${z};`:"",Lt=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Pt=K&&"inherit"!==K?`font-family:${K}_${G.match(N)?G.match(N)[1]:""};`:G||"",Dt=Y?`font-size: ${Y}px;`:"",It="number"==typeof Q?`border-width: ${Q}px; border-style: solid;`:"",Bt=[Z,Q].every(t=>void 0!==t)&&Q?`border-color: ${Z};`:"",Nt=void 0!==X?`border-radius: ${X}px;`:"",_t=void 0!==tt?`background-color: ${tt};`:"",Rt=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Ot=nt&&"inherit"!==nt?`font-family:${nt}_${ot.match(N)?ot.match(N)[1]:""};`:ot||"",Wt=it?`font-size: ${it}px;`:"",jt="popin"!==i||void 0!==E&&!0!==E?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==C?C:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Vt="number"==typeof _?_:16,Ht=Vt/2,Mt=o||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===B?`bottom: calc(100% + ${Ht}px)`:`top: ${Ht}px`)+";",`right: ${Ht}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof R?`border-radius: ${R}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 j?`fill: ${j};`:"","}"].join(""):"",qt=f&&"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!==v?`text-align: ${v};`:"",T&&"inherit"!==T?`font-family:${T}_${S.match(N)?S.match(N)[1]:""};`:S||"",A?`font-size: ${A}px;`:"","}"].join(""):"";let Ft="";if("string"==typeof st){const e=(rt/1e3).toFixed(2),n=["top","bottom"].includes(ct),o=Number(n),i=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[o]:"0"];n&&i.reverse(),Ft={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${at};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${at};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${i.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${at};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":st].join("")}const zt=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===H?"top":"left"}: 8px;`,It,Bt,Nt,_t,Rt,Ot,Wt,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Rt,Ot,Wt,"}"];return lt.textContent=[`#${this.widgetContainerId} style { display: none; }`,`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,dt,mt,ht,yt,gt,wt,vt,pt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,yt,gt,pt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",St,pt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} a {`,"text-decoration: underline;","}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a, `,`#${this.widgetContainerId} .${this.contentClassName} button {`,"text-decoration: none;","box-sizing: border-box;","display: inline-block;",Et,Ct,$t,kt,Lt,Pt,Dt,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Lt,Pt,Dt,"}",...J?zt:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,xt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,At,"}","}",jt,Mt,qt,Ft,`${e}`].join(""),lt}}const O=["top: 0;","top: 50%;","bottom: 0;"],W=["left: 0;","left: 50%;","right: 0;"],j=t=>1===t?"-50%":0,V=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${j(e)}, ${j(t)});`;return`${O[t]}${W[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},H=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,M=()=>{if(H())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:o,popinPercentHeight:i,popinPixelsHeight:s,heightUnit:r}=DATA;return`width: ${"px"===n?e:t}${n};height: ${o?"auto":`${"px"===r?s:i}${r}`};`};class q extends R{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(t=>j(t)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:t,zindexCustom:e,widthUnit:n}=DATA,o="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===t?e:t};`,"background: none;","pointer-events: "+(o?"all":"none"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",V(),M(),"pointer-events: all","}",`${H()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!H()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class F extends R{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 z extends R{constructor(t,e){super(t,e),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("")}}const U=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new q;break;case"bannerTop":case"bannerBottom":e=new F;break;case"free":e=new z;break;default:e=new R}return e};function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}var G,Y=/.+\/([^.]+)\.(otf|ttf)$/,J=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"popin",n=DATA,o=n.imageOn,i=n.layout,s=n.inlineLayoutContent;if(!t||!o)return"";var r=DATA.image;return'<div class="countdown_'.concat(e,'_img_container">\n\t\t\t\t<img src="').concat(r,'" class="abtasty-countdown-image ').concat("popin"===i||"free"===i&&!s?"abtasty-countdown-image-popin-layout":"",'">\n\t\t\t</div>')},Q=["fr","en","de","es"],Z=["day","hour","minute","second"],X={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"}},tt="line",et=null!==(G=window.ABTASTY_S)&&void 0!==G&&null!==(G=G.USER)&&void 0!==G&&G.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substring(0,2)||"en",nt=function(t){return Q.indexOf(t)>-1}(et)?et:"en",ot={day:X.day[nt],days:X.days[nt],hour:X.hour[nt],hours:X.hours[nt],minute:X.minute,minutes:X.minute,second:X.second[nt],seconds:X.second[nt]};function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function st(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=rt(t))||e){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){a=!0,s=t},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function rt(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(t,e):void 0}}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function ct(t){var e=function(t){if("object"!=it(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==it(e)?e:e+""}var lt=function(){return e=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.testId=e,this.container=this.createContainer(),this.digitElements={},this.textElements={},this.timerElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=ot,this.fonts=[],DATA.customTexts&&(this.unitsText={day:DATA.customDaysLabel,days:DATA.customDaysLabel,hour:DATA.customHoursLabel,hours:DATA.customHoursLabel,minute:DATA.customMinutesLabel,minutes:DATA.customMinutesLabel,second:DATA.customSecondsLabel,seconds:DATA.customSecondsLabel})},n=[{key:"remove",value:function(){var t=this,e=DATA.animationDuration;setTimeout(function(){return t.parentContainer.remove()},1.05*e)}},{key:"addCloseEvent",value:function(e){var n=this;e&&e.addEventListener("click",function(e){w(e),t()||n.parentContainer.recurrence.setClosingRecurrence(),n.parentContainer.hide(),n.remove()},{capture:!0,passive:!1})}},{key:"addRedirectionEvent",value:function(e){var n=this;!t()&&e&&e.addEventListener("click",function(){var t=DATA,e=t.autoHide,o=t.timeHide;e&&setTimeout(function(){n.parentContainer.hide(),n.remove()},1e3*o),n.parentContainer.recurrence.setValidationRecurrence()},{useCapture:!0,once:!0})}},{key:"createContainer",value:function(){var t=DATA,e=t.linkType,n=t.redirectionUrl,o=t.openInNewTab,i=document.createElement(e&&e.includes("widget")?"a":"div");switch(i.classList.add("abtasty-countdown"),e){case"widget":i.href=n,i.target=o?"_blank":"_self",this.addRedirectionEvent(i);break;case"widgetClose":i.href="#",i.dataset.abtastyActionnable="true",this.addCloseEvent(i)}return i}},{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){var e,n,o=DATA,i=o.layoutType,s=o.displayElapsedElements,r=o.layout,a=o.endSettings,c=st(Z);try{for(c.s();!(e=c.n()).done;){var l=e.value,d=this.timerElements[l],u=String(t[l]).padStart(2,"0"),h=1===u?this.unitsText[l]:this.unitsText["".concat(l,"s")];if(s||(d.dataset.timeEnd=0===t[l]?"true":"false"),"textDigits"===i)d.textContent="".concat(u," ").concat(h);else{var m=this.digitElements[l],y=this.textElements[l];m.textContent=u,y.textContent=h,this.maxWidth<m.offsetWidth&&(this.maxWidth=m.offsetWidth,m.style.minWidth="".concat(this.maxWidth,"px")),m.style.minWidth="".concat(this.maxWidth,"px")}}}catch(t){c.e(t)}finally{c.f()}[null,"",a].includes(this.parentContainer.domElement.ariaLabel)&&["popin","bannerTop","bannerBottom"].includes(r)&&(this.parentContainer.domElement.ariaLabel=(n=this.parentContainer.domElement.querySelectorAll(".abtasty-countdown-clock, .abtasty-countdown-top-message"),function(t){if(Array.isArray(t))return at(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||rt(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map(function(t){return t.textContent.replace(/\s+/g," ")},"").join("").trim())}},{key:"onTimeEnd",value:function(){var t,e=DATA,n=e.endSettings,o=e.layout;clearInterval(this.timeLoop);var i=this.container.querySelector("abtasty-countdown-clock");if(i&&(i.ariaLive="off"),"hideWidget"===n)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");var s,r=st(this.container.querySelectorAll(".abtasty-countdown-elm-time"));try{for(r.s();!(s=r.n()).done;)s.value.removeAttribute("data-time-end")}catch(t){r.e(t)}finally{r.f()}["popin","bannerTop","bannerBottom"].includes(o)&&(this.parentContainer.domElement.ariaLabel=DATA.endMessage);for(var a={endText:!0,endCountdown:["showText","showTextAndButton"].includes(n),endButton:["hideCountdownAndShowTextAndButton","showTextAndButton"].includes(n)},c=["abtasty-countdown-".concat(n),"abtasty-countdown-finish"],l=0,d=Object.keys(a);l<d.length;l++){var u=d[l],h="abtasty-countdown-".concat(u),m=a[u]?"show":"hide";c.push("".concat(h,"-").concat(m))}(t=this.container.classList).add.apply(t,c)}},{key:"setCountdown",value:function(){var e=new Date,n=function(e,n){switch(e.type){case"global":return e.timestamp-n.getTime();case"local":if(t())return e.previewTimestamp-n.getTime();var o=e.timecomponents,i=o.year,s=o.month,r=o.day,a=o.hour,c=o.minute;return new Date(i,s-1,r,a,c).getTime()-n.getTime();default:return 0}}(DATA.dateTime,e)/1e3;if(top.ABTastyEditor&&("ifEnded"===DATA.previewBlock&&(n=-1),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();var o=Math.floor(n/86400);n-=86400*o;var i=Math.floor(n/3600);n-=3600*i;var s=Math.floor(n/60);n-=60*s;var r=Math.floor(n);this.setText({day:o,hour:i,minute:s,second:r})}},{key:"setButton",value:function(){var t=this,e=function(e,n,o,i){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=document.createElement("a");return r.ariaLabel=e,s&&(r.className="second_link"),r.innerHTML="<span>".concat(e,"</span>"),r.href="button"===n?o:"#","button"===n?(r.target=i?"_blank":"_self",t.addRedirectionEvent(r)):(r.dataset.abtastyActionnable="true",t.addCloseEvent(r)),r},n=DATA,o=n.linkType,i=n.buttonText,s=n.redirectionUrl,r=n.openInNewTab,a=n.secondLink,c=n.secondLinkText,l=n.secondLinkType,d=n.secondLinkURL,u=n.secondLinkOpenInNewTab,h=n.endBtnTargetBlank,m=n.endBtnLabel,y=n.endBtnLink,g=this.container.querySelector(".abtasty-countdown-bottom-button"),p=[];if(o&&o.includes("button")){var b=e(i,o,s,r);if(p.push(b),a){var w=e(c,l,d,u,a);p.push(w)}}for(var f=0,v=p;f<v.length;f++){var x=v[f];g.appendChild(x)}var T=this.container.querySelector(".abtasty-countdown-finish-button"),S=document.createElement("a");S.href=y,S.target=h?"_blank":"_self",S.innerHTML=m,S.ariaLabel=m,T.appendChild(S)}},{key:"setContent",value:function(){var t=this.container.querySelector(".abtasty-countdown-finish-text"),e=document.createElement("div");if(e.innerHTML=DATA.endMessage,t.appendChild(e),"textDigits"!==DATA.layoutType){var n=this.container.querySelector(".abtasty-countdown-top-message"),o=document.createElement("p");o.innerHTML=DATA.message,n.appendChild(o)}}},{key:"init",value:function(t){var e=this,n=DATA,o=n.layout,i=n.inlineLayoutContent,s=n.imageOn,r=n.hideResponsiveImage,a=n.hideResponsiveText;try{this.parentContainer=t;var c=["free","popin"].includes(o);!function(n){if(e.container.classList.add("abtasty-countdown-layout-".concat(n)),!c&&s&&(r&&e.container.classList.add("abtasty-countdown-hide-responsive-image"),a&&e.container.classList.add("abtasty-countdown-hide-responsive-text")),n===tt){c&&(e.parentContainer.domElement.querySelector(".".concat(t.contentClassName)).classList.add("abtasty-countdown-content-".concat(o,"-inline")),e.container.classList.add("abtasty-countdown-layout-".concat(o,"-inline")));var i,l=st(e.parentContainer.domElement.querySelectorAll(".".concat(t.closeButtonClassName)));try{for(l.s();!(i=l.n()).done;)i.value.classList.add("abtasty-countdown-close-inline")}catch(t){l.e(t)}finally{l.f()}}}(c&&!i?"free":tt),this.container.innerHTML=function(){var t=DATA,e=t.layout,n=t.inlineLayoutContent,o=t.imagePosition,i=t.layoutType,s="popin"===e||"free"===e&&!n,r="\n ".concat(J(s&&!("popin"===e&&n),"popin"),'\n <div class="abtasty-countdown-layout-').concat(e,' abtasty-countdown-mini">\n ').concat(J(!s&&"before"===o,"banner"),'\n <div class="abtasty-countdown-top-message">\n ').concat(DATA.messageMinimalistMode.split(/!countdown!/gm).map(function(t){return"<p>".concat(t.trim(),"</p>")}).join('\n <span class="abtasty-countdown-days abtasty-countdown-elm-time"></span>\n <span class="abtasty-countdown-hours abtasty-countdown-elm-time"></span>\n <span class="abtasty-countdown-minutes abtasty-countdown-elm-time"></span>\n <span class="abtasty-countdown-seconds abtasty-countdown-elm-time"></span>\n').replace("<p></p>",""),"\n </div>\n ").concat(J(!s&&"after"===o,"banner"),'\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button buttons_container"></div>\n </div>\n '),a="\n ".concat(J(s&&!("popin"===e&&n),"popin"),'\n <div class="abtasty-countdown-layout-').concat(e,' abtasty-countdown-standard">\n ').concat(J(!s&&"before"===o,"banner"),'\n <div class="abtasty-countdown-clock" role="timer" aria-live="polite">\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(J(!s&&"after"===o,"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 buttons_container"></div>\n </div>\n ');return"textDigits"===i?r:a}(),this.container.insertAdjacentElement("afterbegin",(t=>{const e=document.createElement("style");return e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),e})("".concat("@media (min-width:741px){.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}}@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}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}}@media (max-width:579px){.ab_widget_container_countdown_content{max-width:100%;width:100vw}.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-hide-responsive-image .countdown_banner_img_container,.abtasty-countdown-hide-responsive-text .abtasty-countdown-top-message{display:none}}.abtasty-countdown,.abtasty-countdown>div{display:inline-block;text-align:center}.abtasty-countdown>div{margin:10px;overflow:auto;white-space:normal;width:100%}.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{-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-standard .abtasty-countdown-clock>.abtasty-countdown-elm-time[data-time-end=true]+.abtasty-countdown-elm-time[data-time-end=true],.abtasty-countdown-standard .abtasty-countdown-clock>.abtasty-countdown-elm-time[data-time-end=true]:first-child{display:none}.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}.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}.abtasty-countdown .abtasty-countdown-mini .abtasty-countdown-elm-time{border:none;margin:0;padding:0}.abtasty-countdown .abtasty-countdown-mini .abtasty-countdown-top-message{display:inline-block;white-space:unset;width:100%}.abtasty-countdown .abtasty-countdown-mini .abtasty-countdown-top-message>*{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.abtasty-countdown-mini .abtasty-countdown-top-message>.abtasty-countdown-elm-time[data-time-end=true]+.abtasty-countdown-elm-time[data-time-end=true],:not(.abtasty-countdown-showTextAndButton) :not(.abtasty-countdown-showText) .abtasty-countdown-mini .abtasty-countdown-top-message>.abtasty-countdown-elm-time[data-time-end=true]:first-child{display:none}"," ").concat(function(){!function(){var t,e=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return K(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?K(t,e):void 0}}(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,r=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return s=t.done,t},e:function(t){r=!0,i=t},f:function(){try{s||null==e.return||e.return()}finally{if(r)throw i}}}}([{name:DATA.messageFontName,style:DATA.messageFontStyle},{name:DATA.numbersfontName,style:DATA.numbersfontStyle},{name:DATA.legendfontName,style:DATA.legendfontStyle}]);try{for(e.s();!(t=e.n()).done;){var n=t.value,o=n.name,i=n.style;if(o&&"inherit"!==o&&/otf|ttf/g.test(i)){var s=document.createElement("style"),r=i.match(Y)?i.match(Y)[1]:"";s.innerHTML="@font-face { font-family: '".concat(o,"_").concat(r,"'; src: url('").concat(i,"'); font-display: swap; }"),document.head.appendChild(s)}}}catch(t){e.e(t)}finally{e.f()}}();var t=DATA,e=t.buttonsAlign,n=t.messageAlign,o=t.textColor,i=t.messageFontSize,s=t.messageFontName,r=t.messageFontStyle,a=t.numbersfontSize,c=t.numberstextColor,l=t.numbersfontName,d=t.numbersfontStyle,u=t.legendfontName,h=t.legendfontStyle,m=t.legendfontSize,y=t.legendtextColor,g=t.countdownBorderRadius,p=t.countdownBorderWidth,b=t.countdownBorderColor,w=t.numbersBackgroundColor,f=void 0!==e&&"fill"!==e?"text-align: ".concat(e,";"):"",v=function(t,e){return t&&"inherit"!==t?"font-family:".concat(t,"_").concat(e.match(Y)?e.match(Y)[1]:"",";"):e||""},x=v(s,r),T=v(l,d),S=v(u,h);return"\n .abtasty-countdown-bottom-button,\n .abtasty-countdown-finish-button {\n ".concat(f,";\n }\n .abtasty-countdown-bottom-button a,\n .abtasty-countdown-finish-button a {\n width: ").concat("fill"===e?"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(n," !important;\n color: ").concat(o,";\n font-size: ").concat(i,"px;\n ").concat(x,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number,\n .abtasty-countdown .abtasty-countdown-elm-number * {\n font-size: ").concat(a,"px;\n color: ").concat(c,";\n fill: ").concat(c,";\n -webkit-text-fill-color: ").concat(c,";\n font-weight: initial;\n ").concat(T,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text,\n .abtasty-countdown .abtasty-countdown-elm-text * {\n ").concat(S,";\n font-size: ").concat(m,"px;\n color: ").concat(y,";\n -webkit-text-fill-color: ").concat(y,";\n }\n\n .abtasty-countdown > div:not(.abtasty-countdown-mini) .abtasty-countdown-elm-time {\n border-radius: ").concat(g,"px;\n border: ").concat(p,"px solid ").concat(b,";\n background-color: ").concat(w,";\n }\n\n .abtasty-countdown > .abtasty-countdown-mini .abtasty-countdown-elm-time {\n font-size: ").concat(a,"px;\n color: ").concat(c,";\n fill: ").concat(c,";\n -webkit-text-fill-color: ").concat(c,";\n font-weight: initial;\n ").concat(T,";\n }")}())));var l,d=st(Z);try{for(d.s();!(l=d.n()).done;){var u=l.value,h=this.container.querySelector(".abtasty-countdown-".concat(u,"s"));this.timerElements[u]=h,this.digitElements[u]=h.querySelector(".abtasty-countdown-elm-number"),this.textElements[u]=h.querySelector(".abtasty-countdown-elm-text")}}catch(t){d.e(t)}finally{d.f()}this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),this.setCountdown()}catch(t){console.warn("Countdown error occurred during widget rendering:",t)}}}],n&&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,ct(o.key),o)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n}();function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}function ut(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ut=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},r=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function d(t,e,n,o){var s=e&&e.prototype instanceof p?e:p,r=Object.create(s.prototype),a=new L(o||[]);return i(r,"_invoke",{value:E(t,n,a)}),r}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=d;var h="suspendedStart",m="executing",y="completed",g={};function p(){}function b(){}function w(){}var f={};l(f,r,function(){return this});var v=Object.getPrototypeOf,x=v&&v(v(P([])));x&&x!==n&&o.call(x,r)&&(f=x);var T=w.prototype=p.prototype=Object.create(f);function S(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function A(t,e){function n(i,s,r,a){var c=u(t[i],t,s);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==dt(d)&&o.call(d,"__await")?e.resolve(d.__await).then(function(t){n("next",t,r,a)},function(t){n("throw",t,r,a)}):e.resolve(d).then(function(t){l.value=t,r(l)},function(t){return n("throw",t,r,a)})}a(c.arg)}var s;i(this,"_invoke",{value:function(t,o){function i(){return new e(function(e,i){n(t,o,e,i)})}return s=s?s.then(i,i):i()}})}function E(e,n,o){var i=h;return function(s,r){if(i===m)throw Error("Generator is already running");if(i===y){if("throw"===s)throw r;return{value:t,done:!0}}for(o.method=s,o.arg=r;;){var a=o.delegate;if(a){var c=C(a,o);if(c){if(c===g)continue;return c}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(i===h)throw i=y,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);i=m;var l=u(e,n,o);if("normal"===l.type){if(i=o.done?y:"suspendedYield",l.arg===g)continue;return{value:l.arg,done:o.done}}"throw"===l.type&&(i=y,o.method="throw",o.arg=l.arg)}}}function C(e,n){var o=n.method,i=e.iterator[o];if(i===t)return n.delegate=null,"throw"===o&&e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),g;var s=u(i,e.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,g;var r=s.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function $(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach($,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(o.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}throw new TypeError(dt(e)+" is not iterable")}return b.prototype=w,i(T,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,c,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(A.prototype),l(A.prototype,a,function(){return this}),e.AsyncIterator=A,e.async=function(t,n,o,i,s){void 0===s&&(s=Promise);var r=new A(d(t,n,o,i),s);return e.isGeneratorFunction(n)?r:r.next().then(function(t){return t.done?t.value:r.next()})},S(T),l(T,c,"Generator"),l(T,r,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),n=[];for(var o in e)n.push(o);return n.reverse(),function t(){for(;n.length;){var o=n.pop();if(o in e)return t.value=o,t.done=!1,t}return t.done=!0,t}},e.values=P,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(o,i){return a.type="throw",a.arg=e,n.next=o,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],a=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var c=o.call(r,"catchLoc"),l=o.call(r,"finallyLoc");if(c&&l){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var r=s?s.completion:{};return r.type=t,r.arg=e,s?(this.method="next",this.next=s.finallyLoc,g):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var i=o.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={iterator:P(e),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=t),g}},e}function ht(t,e,n,o,i,s,r){try{var a=t[s](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,i)}function mt(){var t;return t=ut().mark(function t(){var e,n,o,i,s;return ut().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return l("Widget launch"),e=U(),t.next=4,e.init(!0);case 4:return n=t.sent,o=n.response,i=e.domElement.querySelector(".".concat(e.contentClassName)),(s=new lt(TEST_ID,DATA)).init(e),s.insert(i,"beforeend"),o&&e.show(),t.abrupt("return",s);case 12:case"end":return t.stop()}},t)}),mt=function(){var e=this,n=arguments;return new Promise(function(o,i){var s=t.apply(e,n);function r(t){ht(s,o,i,r,a,"next",t)}function a(t){ht(s,o,i,r,a,"throw",t)}r(void 0)})},mt.apply(this,arguments)}!function(){mt.apply(this,arguments)}()}();
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.9.3",
4
+ "version": "3.9.4-0",
5
5
  "form": "dist/form.js",
6
6
  "main": "dist/main.js",
7
7
  "type": "module",
@@ -43,5 +43,6 @@
43
43
  "postcss-cssnext": "^3.1.1",
44
44
  "rollup": "^4.12.0",
45
45
  "rollup-plugin-postcss": "^4.0.2"
46
- }
46
+ },
47
+ "stableVersion": "3.9.3"
47
48
  }