@abtasty/countdown 3.7.29 → 3.7.31

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}`),s=()=>!t()&&(e()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),i=()=>window.ABTasty&&!0===window.ABTasty.consentReady,a=(t,e)=>{const n=()=>{try{return document.querySelector(t)}catch(t){return null}};let o=n();const s=[document.querySelector("body")||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],i=()=>r.disconnect(),a=()=>r.observe(...s),r=new MutationObserver(()=>(o=n(),o&&!i()&&e(o)));return o?setTimeout(()=>e(o),0):a(),{selector:t,clear:i,observe:a}};function r(t,e){return e(t)||!t.parentElement?t:r(t.parentElement,e)}const c=e=>{t()||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},d=(t,e)=>[...document.querySelectorAll(e)].some(n=>n===t||!!t.closest(e)),l=(t,e)=>{let n=Date.now();return()=>{n+e-Date.now()<=0&&(t(),n=Date.now())}},h=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`},u=()=>{const t=h();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},m=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,g=n=>{const o=(()=>{if(t()||e())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),s=document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(o||s){const t=u();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;")}},b=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};class y{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}=a("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 s=[...t.querySelectorAll(o)];if(s.length&&s.includes(n))return!0;if(e.includes(n))return!0;const i=[...t.parentElement.children],a=i.findIndex(e=>e.isSameNode(t)),r=i.filter((t,e)=>e>a);if(r.length){if(r.includes(n))return!0;if(r.some(t=>[...t.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:o}=n,s=this.targets.find(e=>e.selector===t&&e.uniqueId===o);s&&s.resolve(e),this.clear(t,o)}}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",l(this.checkElements.bind(this),50),{passive:!0}];return this.getEvents(t)}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===r(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let o=!1,s=0;for(;!o&&s<n.length;){const e=document.elementFromPoint(...n[s]);o=t===e||t.contains(e),s+=1}return o}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(e&&this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const o=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return o&&o.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n}),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())}}const p="remove",w="rebuild",v="update";class f{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=b(`${this.event}DomReady`);this.promises.push(n);const o=await this.onPageLoad(n),s=await async function(){let t;return t=!0,!0}(),i=new y;if(this.visibilityObservers.push(i),s&&o){const t=m();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_${m()}`,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)||d(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):d(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}=a("body",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 s=[({isTrusted:t})=>{t&&(o=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{this.eventsListeners.push([document,t,...s]),document.addEventListener(t,...s)});const i=setInterval(()=>{o<=0?e(!0):o-=100},100);return this.intervals.push(i),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}onScrollUp({promise:t,resolve:e}){let n=0;const o=["scroll",({isTrusted:t})=>{t&&(window.pageYOffset<n?e(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}onScrollPercentReached({promise:t,resolve:e}){const{triggerEventScrollPercent:n}=DATA,o=["scroll",({isTrusted:t})=>{if(!t)return;const o=(()=>{const{documentElement:t,body:e}=document,n=t.scrollTop||e.scrollTop,o=t.scrollHeight||e.scrollHeight;return Math.trunc(n/(o-t.clientHeight)*100,10)})();n<o&&e(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),t}checkSocialProofConditions(t,e,n,o){const s=(()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t})(),{viewInterval:i,spNoTrim:a}=DATA;if(this.socialProofStore.hasOwnProperty(t))n(this.socialProofStore[t])?o(`${this.socialProofStore[t][i]}`):o(!1);else if(t&&s){const r=e=>(this.socialProofStore[t]=e,o(!!n(e)&&`${e[i]}`));fetch(`https://api-social-proof.abtasty.com/clients/${s}/metrics/${e}?key=${t}${a?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(r).catch(()=>g("Failed to fetch datas from server."))}else o(!1)}getSocialProofDatas({promise:t,resolve:e},s,i=!1){const{productKey:a,keyType:r}=(()=>{const{socialProofContentType:t,productKeyProvider:e,pathToProductKey:s,customJSProductKey:i,productSKU:a}=DATA;if(2===t)return{productKey:o(),keyType:"url"};{let r=null,c="sku";switch(e){case"ABTastyProductKey":r=window.ABTastyProductKey;break;case"pathToProductKey":r=n(`return ${s};`);break;case"customJSProductKey":r=n(i);break;case"productSKU":r=a}return r||3!==t||(r=o(),c="url"),{productKey:r,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:d,triggerSocialProofMinPurchases:l,triggerSocialProofMinPageViews:h}=DATA,u={pv:h,i:l,"v-pv":d}[s];return[typeof c,typeof u].includes("undefined")&&e(!1),i&&!a&&(g("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(a,"v-pv"===s&&"sku"===r?"v-i":s,t=>{const e=void 0!==t[c]&&t[c]>=u;return e||g(`Widget will not be shown, Social Proof API returned ${t[c]} while ${u} are required`),e},e),t}onConsent({promise:t,resolve:e}){if(!i()){const n=["abtasty_consentValid",()=>e(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),t}return e(!0),t}onTrackingSent({promise:t,resolve:e}){const{triggerEventTrackingSent:n}=DATA;let o=localStorage.getItem("ABTastyData");const s=()=>JSON.parse(o).ActionTracking.find(({name:t})=>t===n),i=["storage",()=>{o=localStorage.getItem("ABTastyData"),s()&&e(!0)},{passive:!0,capture:!0}];return o&&s()?e(!0):(()=>{this.eventsListeners.push([window,...i]),window.addEventListener(...i)})(),t}onMinPagesViewed({promise:t,resolve:e}){const{triggerEventMinPagesViewed:n}=DATA;let o=localStorage.getItem("ABTastyData");const s=()=>n<=(o?JSON.parse(o).VisitedPages.length:0),i=["storage",()=>{o=localStorage.getItem("ABTastyData"),s()&&e(!0)},{passive:!0,capture:!0}];return o&&s()?e(!0):(()=>{this.eventsListeners.push([window,...i]),window.addEventListener(...i)})(),t}onRageClick({promise:t,resolve:e}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:o}=DATA;let s=0,i=!1;const a=["click",({isTrusted:t})=>{if(t&&(s+=1,s>=n&&e(!0),!i)){i=!0;const t=setTimeout(()=>{s=0,i=!1},o);this.timeouts.push(t)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...a]),document.addEventListener(...a),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]=t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.visibilityObservers.length){const t=m();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=b(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=b(`${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",$="validation",S="ABTastyWidgets",C=`${S}Temporary`;class E{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=h(),this.uniqueId=m(),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(S);"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(S);return JSON.parse(e)}catch(e){return t.removeItem(S),!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(S,JSON.stringify(o)),o):(t.removeItem(S),!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(S,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:s,storageMethod:a}=o,r=this.getStamp(t),c={type:n,stamp:r},{type:d}=this.getCurrentRecurrence(),l=async()=>{if(!i()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const t=new f({triggerEvent:"consent"});await t.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===s?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===s&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const o=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};a.setItem(S,JSON.stringify(o)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!a)return!1;if(d&&n!==$)if(n===T&&d!==$)l();else{if(n!==x||d===$||d===T)return!1;l()}else l();return r}setDisplayRecurrence(){const t=x;this.setRecurrence(this.displayRecurrence,t)}setClosingRecurrence(){const t=T;this.setRecurrence(this.closingRecurrence,t)}setValidationRecurrence(){const t=$;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 A{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&&v:w;return t?(this.clearWatcher(),this.callback(t,!0),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:t}}){t===TEST_ID&&(this.callback(w,!1),this.watch())}onTagRollback(){return this.clearWatcher(),this.callback(p,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(t){return s()?t.some(t=>["removedNodes","addedNodes"].some(e=>t[e]&&t[e].length))?this.decisionHandler():this:this.callback(p,!1)}watch(){if(t())return this;this.clearWatcher(),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams);const{clear:e}=a("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)$/,B=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class L{constructor(e,n){this.children=void 0,this.uniqueId=`${m()}${n?`_${n}`:""}`,this.widgetName=h(),this.prettyName=u(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:n,validationRecurrence:o}=DATA,s=!e&&!n&&!o;if(t()||s)return!1;const i={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[`${t}_day`],week:t=>7*DATA[`${t}_week`],month:t=>30.5*DATA[`${t}_month`]},a={};return e&&(a.displayRecurrence=i[e]("displayRecurrence")),n&&(a.closingRecurrence=i[n]("closingRecurrence")),o&&(a.validationRecurrence=i[o]("validationRecurrence")),a})(),this.triggerParams=(e=>{let{triggerEvent:n}=DATA;const{triggerEventClick:o,triggerEventHover:s,triggerEventReengageDelay:i,socialProofContentType:a,triggerEventElementVisible:r,triggerEventDelay:c}=DATA;if(t()||!n&&!a)return!1;const d={click:()=>o,hover:()=>s,elementVisible:()=>r},l=Object.prototype.hasOwnProperty.call(d,n)?d[n]():"body",h="reengage"===n?i:c;return a&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][a]),{triggerEvent:n,triggerSelector:l,triggerDelay:h,triggerTarget:e}})(e),this.recurrence=!!this.recurrenceParams&&new E(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new f(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&B.includes(this.triggerParams.triggerEvent),this.pageWatcher=new A(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.observers.forEach(t=>t.disconnect()),this.observers=[],this.promises.forEach(t=>t.resolve(!1)),this.promises=[],this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){if(this.isWidgetApplied())return!1;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:{},s=a(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t.selector!==n),this.removeOldDomElement(),e(t.insertAdjacentElement(o,this.domElement))});this.elementsWaiters.push(s)}).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=s(),i=this.trigger&&this.trigger.promises.length,a=!this.recurrence||this.recurrence.isOver();if(!n&&!o||i||!a)return{container:this,response:!1};this.pageWatcher.watch();const r=n||!this.trigger||this.trigger&&await this.trigger.isTriggered(),c={container:this,response:r};return r?(await this.insert(),this.addCloseEvent(),n||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(r),c):c}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>{t?this.show():this.hide(!1)});e||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const o=this.isWidgetApplied(),s={[p]:()=>o?this.remove():this.pageWatcher.watch(),[w]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():o||this.insert().then(t=>t.show()).catch(this.pageWatcher.watch):n()},[v]:n};"function"==typeof s[t]&&s[t]()}addCloseEvent(...e){const{closeButton:n,overlay:o,overlayClickable:s,layout:i,animationDuration:a=1e3}=DATA,r=[];if(void 0!==o&&!0!==o||!0!==s||"popin"!==i||r.push(`.${this.overlayClassName}`),void 0!==n&&n&&r.push(`.${this.closeButtonClassName}`),!r.length)return this;const d=this.domElement.querySelectorAll(r.join(", "));if(!d.length)return this;const l=["click",t=>{c(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*a)},{once:!0,capture:!0}];return e.push(...d),e.forEach(e=>{t()&&(e.dataset.abtastyActionnable="true"),e.removeEventListener(...l),e.addEventListener(...l)}),this}getDom(){const{closeButton:t,layout:e,overlay:n=!0}=DATA,o=document.createElement("div");return o.className=`${this.basicClassName} ${this.hideClassName}`,o.id=this.widgetContainerId,o.role="dialog",o.innerHTML=`\n\t\t\t${"popin"===e&&!0===n?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}" aria-label="Dialog content">\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>`,o}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:s}=n,{backgroundColor:i,isBackgroundImage:a,backgroundImage:r,backgroundSize:c,backgroundPosition:d,backgroundRepeat:l,borderColor:h,borderRadius:u,borderWidth:m,textColor:g,textAlign:b,fontName:y,fontStyle:p,fontSize:w,isTitle:v,titleTextAlign:f,titleTextColor:x,titleFontName:T,titleFontStyle:$,titleFontSize:S,overlay:C,overlayColor:E,dropShadow:A,dropShadowColor:B,dropShadowBlur:L,containerMargin:P,containerPadding:N,closeButton:_,closeButtonPosition:I,closeButtonSize:R,closeButtonBorderRadius:D,closeButtonBorderWidth:O,closeButtonBorderColor:W,closeButtonColor:V,closeButtonBackgroundColor:q,buttonsAlign:H,buttonsBorderWidth:M,buttonsBorderColor:F,buttonsBorderRadius:j,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:K,buttonsFontStyle:Y,buttonsFontSize:G,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:Z,secondLinkBorderRadius:X,secondLinkBackgroundColor:tt,secondLinkTextColor:et,secondLinkFontName:nt,secondLinkFontStyle:ot,secondLinkFontSize:st,animation:it,animationDuration:at,animationBehaviour:rt,animationSlideDirection:ct}=o?{}:n,dt=document.createElement("style");dt.type="text/css",t()&&dt.setAttribute("abtasty-script-added","true"),this.loadFont(y,p),this.loadFont(T,$),this.loadFont(K,Y),this.loadFont(nt,ot);const lt=`background: ${["string"==typeof i?i:"rgba(255, 255, 255, 1)",a&&"string"==typeof r&&r.length?`url(${r})`:"",a&&"string"==typeof d&&"100% 100%"!==c?d:"0 0",a&&"string"==typeof c?`/ ${c}`:"/ auto",a&&l&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ht="number"==typeof m&&m>0,ut=`border: ${[ht?`${m}px`:"unset",ht?"solid":"",ht&&"string"==typeof h&&h.length?h:""].join(" ").trim()};`,mt=void 0!==u?`border-radius: ${u}px;`:"",gt=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",bt=void 0!==b?`text-align: ${b};`:"",yt=y&&"inherit"!==y?`font-family:${y}_${p.match(k)?p.match(k)[1]:""};`:p||"",pt=w?`font-size: ${w}px;`:"",wt=void 0!==A&&A?`box-shadow: 0 5px ${L}px 0 ${B};`:"",vt=P instanceof Array&&1===P.length&&P[0],ft=vt?`margin: ${vt.top}px ${vt.right}px ${vt.bottom}px ${vt.left}px;`:"",xt=vt?`margin: calc(${vt.top}px * 0.5) calc(${vt.right}px * 0.5) calc(${vt.bottom}px * 0.5) calc(${vt.left}px * 0.5);`:"",Tt=N instanceof Array&&1===N.length&&N[0],$t=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",St=Tt?`padding: calc(${Tt.top}px * 0.5) calc(${Tt.right}px * 0.5) calc(${Tt.bottom}px * 0.5) calc(${Tt.left}px * 0.5);`:"",Ct=void 0!==M&&M?`border-width: ${M}px; border-style: solid;`:"",Et=[F,M].every(t=>void 0!==t)&&M?`border-color: ${F};`:"",At=void 0!==j?`border-radius: ${j}px;`:"",kt=void 0!==z?`background-color: ${z};`:"",Bt=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Lt=K&&"inherit"!==K?`font-family:${K}_${Y.match(k)?Y.match(k)[1]:""};`:Y||"",Pt=G?`font-size: ${G}px;`:"",Nt="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;`:"",Rt=void 0!==tt?`background-color: ${tt};`:"",Dt=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Ot=nt&&"inherit"!==nt?`font-family:${nt}_${ot.match(k)?ot.match(k)[1]:""};`:ot||"",Wt=st?`font-size: ${st}px;`:"",Vt="popin"!==s||void 0!==C&&!0!==C?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==E?E:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),qt="number"==typeof R?R:16,Ht=qt/2,Mt=o||void 0!==_&&_?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===I?`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 D?`border-radius: ${D}px;`:"","number"==typeof O&&O>0?`border: ${O}px solid ${void 0!==W?W:"rgba(57, 57, 57, 1)"};`:"","string"==typeof q?`background-color: ${q};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${qt}px;`,`height: ${qt}px;`,"string"==typeof V?`fill: ${V};`:"","}"].join(""):"",Ft=v&&"string"==typeof x?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${x}; fill: ${x}; -webkit-text-fill-color: ${x};`,void 0!==f?`text-align: ${f};`:"",T&&"inherit"!==T?`font-family:${T}_${$.match(k)?$.match(k)[1]:""};`:$||"",S?`font-size: ${S}px;`:"","}"].join(""):"";let jt="";if("string"==typeof it){const e=(at/1e3).toFixed(2),n=["top","bottom"].includes(ct),o=Number(n),s=[(["top","left"].includes(ct)?"-":"")+"100vmax",this.translateValues?this.translateValues[o]:"0"];n&&s.reverse(),jt={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${e}s ${rt};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${e}s ${rt};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${s.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${e}s ${rt};`,"}"]}[t()&&!ABTASTY_S.WIDGETS.animationChanged?"none":it].join("")}const zt=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===H?"top":"left"}: 8px;`,Nt,_t,It,Rt,Dt,Ot,Wt,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Dt,Ot,Wt,"}"];return dt.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,lt,mt,ut,gt,bt,wt,ft,yt,pt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,gt,bt,yt,pt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",$t,yt,pt,"}",`#${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,Et,At,kt,Bt,Lt,Pt,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Bt,Lt,Pt,"}",...J?zt:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,xt,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,St,"}","}",Vt,Mt,Ft,jt,`${e}`].join(""),dt}}const P=["top: 0;","top: 50%;","bottom: 0;"],N=["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`${P[t]}${N[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},R=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,D=()=>{if(R())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:t,popinPixelsWidth:e,widthUnit:n,autoHeight:o,popinPercentHeight:s,popinPixelsHeight:i,heightUnit:a}=DATA;return`width: ${"px"===n?e:t}${n};height: ${o?"auto":`${"px"===a?i:s}${a}`};`};class O extends L{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(),D(),"pointer-events: all","}",`${R()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!R()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class W extends L{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 V extends L{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 q=["fr","en","de","es"],H=["day","hour","minute","second"],M={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"}},F="line",j=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",z=(t=>q.indexOf(t)>-1)(j)?j:"en",U={day:M.day[z],days:M.days[z],hour:M.hour[z],hours:M.hours[z],minute:M.minute,minutes:M.minute,second:M.second[z],seconds:M.second[z]};class K{constructor(t,e){this.testId=t,this.data=e,this.targetselector=e.selector,this.container=this.createContainer(),this.digitElements={},this.textElements={},this.timeElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=U,this.fonts=[],this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})}getFonts(){return[{name:this.data.messageFontName,style:this.data.messageFontStyle},{name:this.data.numbersfontName,style:this.data.numbersfontStyle},{name:this.data.legendfontName,style:this.data.legendfontStyle}]}remove(){const{animationDuration:t}=DATA;setTimeout(()=>this.parentContainer.remove(),1.05*t)}addCloseEvent(e){e&&e.addEventListener("click",e=>{c(e),t()||this.parentContainer.recurrence.setClosingRecurrence(),this.parentContainer.hide(),this.remove()},{capture:!0,passive:!1})}addRedirectionEvent(e){!t()&&e&&e.addEventListener("click",()=>{const{autoHide:t,timeHide:e}=DATA;t&&setTimeout(()=>{this.parentContainer.hide(),this.remove()},1e3*e),this.parentContainer.recurrence.setValidationRecurrence()},{useCapture:!0,once:!0})}createContainer(){const{linkType:t,redirectionUrl:e,openInNewTab:n}=DATA,o=document.createElement(t&&t.includes("widget")?"a":"div");switch(o.classList.add("abtasty-countdown"),t){case"widget":o.href=e,o.target=n?"_blank":"_self",this.addRedirectionEvent(o);break;case"widgetClose":o.href="#",o.dataset.abtastyActionnable="true",this.addCloseEvent(o)}return o}insert(t,e){return t.insertAdjacentElement(e,this.container),this}setText(t){H.forEach(e=>{let n=t[e];String(n).length<2&&(n=`0${n}`),this.digitElements[e].textContent=n,this.textElements[e].textContent=1===n?this.unitsText[e]:this.unitsText[`${e}s`],this.maxWidth<this.digitElements[e].offsetWidth&&(this.maxWidth=this.digitElements[e].offsetWidth,this.digitElements[e].style.minWidth=`${this.maxWidth}px`,window.requestAnimationFrame(()=>{this.setText(t)})),this.digitElements[e].style.minWidth=`${this.maxWidth}px`})}onTimeEnd(){const{endSettings:t}=this.data;clearInterval(this.timeLoop);const e=this.container.querySelector("abtasty-countdown-clock");if(e&&(e.ariaLive="off"),"hideWidget"===t)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");const n={endText:!0,endCountdown:["showText","showTextAndButton"].includes(t),endButton:["hideCountdownAndShowTextAndButton","showTextAndButton"].includes(t)},o=[`abtasty-countdown-${t}`,"abtasty-countdown-finish"];Object.keys(n).forEach(t=>{const e=n[t]?"show":"hide";o.push(`abtasty-countdown-${t}-${e}`)}),this.container.classList.add(...o)}setCountdown(){const e=new Date;let n=function(e,n){switch(e.type){case"global":return e.timestamp-n.getTime();case"local":if(t())return e.previewTimestamp-n.getTime();const{year:o,month:s,day:i,hour:a,minute:r}=e.timecomponents;return new Date(o,s-1,i,a,r).getTime()-n.getTime();default:return 0}}(this.data.dateTime,e)/1e3;if(window.ABTastyEditor&&("ifEnded"===this.data.previewBlock&&(n=-1),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();const o=Math.floor(n/86400);n-=86400*o;const s=Math.floor(n/3600);n-=3600*s;const i=Math.floor(n/60);n-=60*i;const a=Math.floor(n);this.setText({day:o,hour:s,minute:i,second:a})}getStyle(){this.loadFonts();const{buttonsAlign:t}=DATA;return`\n .abtasty-countdown-bottom-button,\n .abtasty-countdown-finish-button {\n ${void 0!==t&&"fill"!==t?`text-align: ${t};`:""}\n }\n .abtasty-countdown-bottom-button a,\n .abtasty-countdown-finish-button a {\n width: ${"fill"===t?"100%":"auto"};\n }\n\n .abtasty-countdown .abtasty-countdown-finish-text,\n .abtasty-countdown .abtasty-countdown-top-message,\n .abtasty-countdown .abtasty-countdown-finish-text *,\n .abtasty-countdown .abtasty-countdown-top-message * {\n white-space: pre-line;\n text-align: ${this.data.messageAlign} !important;\n color: ${this.data.textColor};\n font-size: ${this.data.messageFontSize}px;\n ${this.data.messageFontName&&"inherit"!==this.data.messageFontName?`font-family:${this.data.messageFontName}_${this.data.messageFontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)?.[1]};`:this.data.messageFontStyle||""};\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number,\n .abtasty-countdown .abtasty-countdown-elm-number * {\n font-size: ${this.data.numbersfontSize}px;\n color: ${this.data.numberstextColor};\n -webkit-text-fill-color: ${this.data.numberstextColor};\n font-weight: initial;\n ${this.data.numbersfontName&&"inherit"!==this.data.numbersfontName?`font-family:${this.data.numbersfontName}_${this.data.numbersfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)?.[1]};`:this.data.numbersfontStyle||""};\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text,\n .abtasty-countdown .abtasty-countdown-elm-text * {\n ${this.data.legendfontName&&"inherit"!==this.data.legendfontName?`font-family:${this.data.legendfontName}_${this.data.legendfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/)?.[1]};`:this.data.legendfontStyle||""};\n font-size: ${this.data.legendfontSize}px;\n color: ${this.data.legendtextColor};\n -webkit-text-fill-color: ${this.data.legendtextColor};\n }\n\n .abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ${this.data.countdownBorderRadius}px;\n border: ${this.data.countdownBorderWidth}px solid ${this.data.countdownBorderColor};\n background-color: ${this.data.numbersBackgroundColor};\n }\n `}setButton(){var t=this;const e=function(e,n,o,s){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const a=document.createElement("a");return a.ariaLabel=e,i&&(a.className="second_link"),a.innerHTML=`<span>${e}</span>`,a.href="button"===n?o:"#","button"===n?(a.target=s?"_blank":"_self",t.addRedirectionEvent(a)):(a.dataset.abtastyActionnable="true",t.addCloseEvent(a)),a},{linkType:n,buttonText:o,redirectionUrl:s,openInNewTab:i,secondLink:a,secondLinkText:r,secondLinkType:c,secondLinkURL:d,secondLinkOpenInNewTab:l,endBtnTargetBlank:h,endBtnLabel:u,endBtnLink:m}=DATA,g=this.container.querySelector(".abtasty-countdown-bottom-button"),b=[];if(n&&n.includes("button")){const t=e(o,n,s,i);if(b.push(t),a){const t=e(r,c,d,l,a);b.push(t)}}b.forEach(t=>g.appendChild(t));const y=this.container.querySelector(".abtasty-countdown-finish-button"),p=document.createElement("a");p.href=m,p.target=h?"_blank":"_self",p.innerHTML=u,p.ariaLabel=u,y.appendChild(p)}setContent(){const t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("p");e.innerHTML=this.data.message,t.appendChild(e);const n=this.container.querySelector(".abtasty-countdown-finish-text"),o=document.createElement("div");o.innerHTML=this.data.endMessage,n.appendChild(o)}init(t){var e=this;const{layout:n,inlineLayoutContent:o,imageOn:s,imagePosition:i}=this.data;try{this.parentContainer=t;const a=["free","popin"].includes(n);(e=>{this.container.classList.add(`abtasty-countdown-layout-${e}`),e===F&&(a&&(this.parentContainer.domElement.querySelector(`.${t.contentClassName}`).classList.add(`abtasty-countdown-content-${n}-inline`),this.container.classList.add(`abtasty-countdown-layout-${n}-inline`)),this.parentContainer.domElement.querySelectorAll(`.${t.closeButtonClassName}`).forEach(t=>t.classList.add("abtasty-countdown-close-inline")))})(a&&!o?"free":F);const r="popin"===n||"free"===n&&!o,c=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"popin";if(!t||!s)return"";const{image:o}=e.data;return`<div class="countdown_${n}_img_container">\n\t\t\t\t<img src="${o}" class="abtasty-countdown-image ${r?"abtasty-countdown-image-popin-layout":""}">\n\t\t\t</div>`};this.container.innerHTML=`\n ${c(r&&!("popin"===n&&o),"popin")}\n <div class="abtasty-countdown-layout-${n}">\n \t${c(!r&&"before"===i,"banner")}\n \t<div class="abtasty-countdown-clock" role="timer" aria-live="polite">\n\t\t\t\t\t\t<div class="abtasty-countdown-days abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t${c(!r&&"after"===i,"banner")}\n\t\t\t\t\t<div class="abtasty-countdown-top-message"></div>\n\t\t\t\t\t<div class="abtasty-countdown-finish-text"></div>\n\t\t\t\t\t<div class="abtasty-countdown-finish-button"></div>\n\t\t\t\t\t<div class="abtasty-countdown-bottom-button buttons_container"></div>\n </div>\n `,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})(`@media (max-width:579px){.ab_widget_container_countdown_content{width:100vw}}.abtasty-countdown,.abtasty-countdown>div{display:inline-block;text-align:center}.abtasty-countdown>div{margin:10px;overflow:auto;white-space:normal}.abtasty-countdown .countdown_popin_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;max-width:100%}.abtasty-countdown .countdown_popin_img_container:empty{display:none}.abtasty-countdown .abtasty-countdown-finish-text,.abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}.abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;margin:6px 6px 15px;padding:6px}.abtasty-countdown .abtasty-countdown-elm-number,.abtasty-countdown .abtasty-countdown-elm-text{font-stretch:normal;font-style:normal;font-weight:700;letter-spacing:normal;line-height:normal;text-align:center}.abtasty-countdown .abtasty-countdown-bottom-button a,.abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;display:block;display:inline-block;padding:6px 10px;text-align:center;text-decoration:none}.abtasty-countdown-layout-line>div{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:stretch;-ms-flex-pack:stretch;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:stretch}.abtasty-countdown-layout-line>div>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.abtasty-countdown-layout-free{display:block;text-align:center}.abtasty-countdown-layout-line>div{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-finish-text,.abtasty-countdown-layout-line .abtasty-countdown-top-message{-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:0;padding:0 5px 0 15px}.abtasty-countdown-layout-line .abtasty-countdown-top-message p{margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line{-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button,.abtasty-countdown-layout-line .abtasty-countdown-clock,.abtasty-countdown-layout-line .abtasty-countdown-finish-button{-ms-flex-negative:0;flex-shrink:0}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:55%!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:45%!important}.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:30%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:35%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:65%}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop{width:100%}.abtasty-countdown-content-popin-inline,.abtasty-countdown-content-popin-inline .abtasty-countdown-layout-popin{max-width:inherit;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content}.abtasty-countdown-content-free-inline{max-width:100%}.abtasty-countdown-image-popin-layout{margin-bottom:20px}@media (max-width:740px){.abtasty-countdown-layout-line>div:not(.abtasty-countdown-layout-popin){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.abtasty-countdown-layout-line div.abtasty-countdown-finish-text,.abtasty-countdown-layout-line div.abtasty-countdown-top-message{margin-bottom:20px;margin-top:20px}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}.countdown_banner_img_container{display:none!important}}@media (max-width:570px){.abtasty-countdown-layout-free,.abtasty-countdown-layout-popin{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important;margin:10px 0!important}}.abtasty-countdown-layout-popin{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.countdown_banner_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;padding:0 15px}.countdown_banner_img_container img{max-height:67px;max-width:200px} ${this.getStyle()}`)),H.forEach(t=>{const e=this.container.querySelector(`.abtasty-countdown-${t}s`),[n,o]=e.children;this.digitElements[t]=n,this.textElements[t]=o,this.timeElements[t]=e}),this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),setTimeout(()=>{this.setCountdown()},100),this.setCountdown()}catch(t){console.warn("Countdown error occured during widget rendering:",t)}}loadFonts(){this.getFonts().forEach(t=>{let{name:e,style:n}=t;if(!e||"inherit"===e||!/otf|ttf/g.test(n))return;const o=document.createElement("style");o.appendChild(document.createTextNode(`\n @font-face {\n font-family: '${e}_${n.match(/.+\/([^.]+)\.(otf|ttf)$/)?.[1]}';\n src: url('${n}');\n }`)),document.head.appendChild(o)})}}!async function(){g("Widget launch");const t=(()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new O;break;case"bannerTop":case"bannerBottom":e=new W;break;case"free":e=new V;break;default:e=new L}return e})(),{response:e}=await t.init(!0),n=t.domElement.querySelector(`.${t.contentClassName}`),o=new K(TEST_ID,DATA);o.init(t),o.insert(n,"beforeend"),e&&t.show()}()}();
1
+ !function(){"use strict";const t=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),e=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},n=t=>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},g=(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 y(t,e){return e(t)||!t.parentElement?t:y(t.parentElement,e)}const p=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}=g("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"===y(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}=g("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",E="ABTastyWidgets",$=`${E}Temporary`;class C{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($),n=sessionStorage.getItem(E);"ABTastyData"===t&&!e&&n&&localStorage.setItem($,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem(E);return JSON.parse(e)}catch(e){return t.removeItem(E),!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(E,JSON.stringify(o)),o):(t.removeItem(E),!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($),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem(E,t),localStorage.removeItem($));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(E,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 A{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}=g("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 C(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 A(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.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=g(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]: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=>{p(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:g,textAlign:y,fontName:p,fontStyle:b,fontSize:w,isTitle:f,titleTextAlign:v,titleTextColor:x,titleFontName:T,titleFontStyle:S,titleFontSize:E,overlay:$,overlayColor:C,dropShadow:A,dropShadowColor:L,dropShadowBlur:P,containerMargin:B,containerPadding:_,closeButton:N,closeButtonPosition:I,closeButtonSize:R,closeButtonBorderRadius:D,closeButtonBorderWidth:O,closeButtonBorderColor:j,closeButtonColor:W,closeButtonBackgroundColor:F,buttonsAlign:V,buttonsBorderWidth:q,buttonsBorderColor:M,buttonsBorderRadius:H,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(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;`:"",gt=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",yt=void 0!==y?`text-align: ${y};`:"",pt=p&&"inherit"!==p?`font-family:${p}_${b.match(k)?b.match(k)[1]:""};`:b||"",bt=w?`font-size: ${w}px;`:"",wt=void 0!==A&&A?`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=_ instanceof Array&&1===_.length&&_[0],St=Tt?`padding: ${Tt.top}px ${Tt.right}px ${Tt.bottom}px ${Tt.left}px;`:"",Et=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);`:"",$t=void 0!==q&&q?`border-width: ${q}px; border-style: solid;`:"",Ct=[M,q].every(t=>void 0!==t)&&q?`border-color: ${M};`:"",At=void 0!==H?`border-radius: ${H}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;`:"",_t="number"==typeof Q?`border-width: ${Q}px; border-style: solid;`:"",Nt=[Z,Q].every(t=>void 0!==t)&&Q?`border-color: ${Z};`:"",It=void 0!==X?`border-radius: ${X}px;`:"",Rt=void 0!==tt?`background-color: ${tt};`:"",Dt=void 0!==et?`color: ${et}; fill: ${et}; -webkit-text-fill-color: ${et};`:"",Ot=nt&&"inherit"!==nt?`font-family:${nt}_${ot.match(k)?ot.match(k)[1]:""};`:ot||"",jt=it?`font-size: ${it}px;`:"",Wt="popin"!==i||void 0!==$&&!0!==$?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==C?C:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Ft="number"==typeof R?R:16,Vt=Ft/2,qt=o||void 0!==N&&N?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===I?`bottom: calc(100% + ${Vt}px)`:`top: ${Vt}px`)+";",`right: ${Vt}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof D?`border-radius: ${D}px;`:"","number"==typeof O&&O>0?`border: ${O}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof F?`background-color: ${F};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Ft}px;`,`height: ${Ft}px;`,"string"==typeof W?`fill: ${W};`:"","}"].join(""):"",Mt=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||"",E?`font-size: ${E}px;`:"","}"].join(""):"";let Ht="";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(),Ht={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"===V?"top":"left"}: 8px;`,_t,Nt,It,Rt,Dt,Ot,jt,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Dt,Ot,jt,"}"];return lt.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,dt,mt,ht,gt,yt,wt,vt,pt,bt,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,gt,yt,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;",$t,Ct,At,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} > * {`,Et,"}","}",Wt,qt,Mt,Ht,`${e}`].join(""),lt}}const B=["top: 0;","top: 50%;","bottom: 0;"],_=["left: 0;","left: 50%;","right: 0;"],N=t=>1===t?"-50%":0,I=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:t,y:e}]}=DATA,n=`translate(${N(e)}, ${N(t)});`;return`${B[t]}${_[e]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},R=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,D=()=>{if(R())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=>N(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(),D(),"pointer-events: all","}",`${R()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!R()&&["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 F=()=>{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};var V=["fr","en","de","es"],q=["day","hour","minute","second"],M={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"}},H="line",z=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",U=function(t){return V.indexOf(t)>-1}(z)?z:"en",K={day:M.day[U],days:M.days[U],hour:M.hour[U],hours:M.hours[U],minute:M.minute,minutes:M.minute,second:M.second[U],seconds:M.second[U]};function G(t){return G="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},G(t)}function Y(t,e){if(t){if("string"==typeof t)return J(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)?J(t,e):void 0}}function J(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 Q(t){var e=function(t){if("object"!=G(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==G(e)?e:e+""}var Z=function(){return e=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.testId=e,this.data=n,this.targetselector=n.selector,this.container=this.createContainer(),this.digitElements={},this.textElements={},this.timeElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=K,this.fonts=[],this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})},n=[{key:"getFonts",value:function(){return[{name:this.data.messageFontName,style:this.data.messageFontStyle},{name:this.data.numbersfontName,style:this.data.numbersfontStyle},{name:this.data.legendfontName,style:this.data.legendfontStyle}]}},{key:"remove",value:function(){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){p(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=this;q.forEach(function(e){var o=t[e];String(o).length<2&&(o="0".concat(o)),n.digitElements[e].textContent=o,n.textElements[e].textContent=1===o?n.unitsText[e]:n.unitsText["".concat(e,"s")],n.maxWidth<n.digitElements[e].offsetWidth&&(n.maxWidth=n.digitElements[e].offsetWidth,n.digitElements[e].style.minWidth="".concat(n.maxWidth,"px"),window.requestAnimationFrame(function(){n.setText(t)})),n.digitElements[e].style.minWidth="".concat(n.maxWidth,"px")}),[null,"",DATA.endSettings].includes(this.parentContainer.domElement.ariaLabel)&&["popin","bannerTop","bannerBottom"].includes(layout)&&(this.parentContainer.domElement.ariaLabel=(e=this.parentContainer.domElement.querySelectorAll(".abtasty-countdown-clock, .abtasty-countdown-top-message"),function(t){if(Array.isArray(t))return J(t)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||Y(e)||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=this.data.endSettings;clearInterval(this.timeLoop);var n=this.container.querySelector("abtasty-countdown-clock");if(n&&(n.ariaLive="off"),"hideWidget"===e)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");["popin","bannerTop","bannerBottom"].includes(layout)&&(this.parentContainer.domElement.ariaLabel=DATA.endMessage);var o={endText:!0,endCountdown:["showText","showTextAndButton"].includes(e),endButton:["hideCountdownAndShowTextAndButton","showTextAndButton"].includes(e)},i=["abtasty-countdown-".concat(e),"abtasty-countdown-finish"];Object.keys(o).forEach(function(t){var e="abtasty-countdown-".concat(t),n=o[t]?"show":"hide";i.push("".concat(e,"-").concat(n))}),(t=this.container.classList).add.apply(t,i)}},{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}}(this.data.dateTime,e)/1e3;if(window.ABTastyEditor&&("ifEnded"===this.data.previewBlock&&(n=-1),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void this.onTimeEnd();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:"getStyle",value:function(){var t,e,n;this.loadFonts();var o=DATA.buttonsAlign,i=void 0!==o&&"fill"!==o?"text-align: ".concat(o,";"):"";return"\n .abtasty-countdown-bottom-button,\n .abtasty-countdown-finish-button {\n ".concat(i,"\n }\n .abtasty-countdown-bottom-button a,\n .abtasty-countdown-finish-button a {\n width: ").concat("fill"===o?"100%":"auto",";\n }\n\n .abtasty-countdown .abtasty-countdown-finish-text,\n .abtasty-countdown .abtasty-countdown-top-message,\n .abtasty-countdown .abtasty-countdown-finish-text *,\n .abtasty-countdown .abtasty-countdown-top-message * {\n white-space: pre-line;\n text-align: ").concat(this.data.messageAlign," !important;\n color: ").concat(this.data.textColor,";\n font-size: ").concat(this.data.messageFontSize,"px;\n ").concat(this.data.messageFontName&&"inherit"!==this.data.messageFontName?"font-family:".concat(this.data.messageFontName,"_").concat(null===(t=this.data.messageFontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/))||void 0===t?void 0:t[1],";"):this.data.messageFontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-number,\n .abtasty-countdown .abtasty-countdown-elm-number * {\n font-size: ").concat(this.data.numbersfontSize,"px;\n color: ").concat(this.data.numberstextColor,";\n -webkit-text-fill-color: ").concat(this.data.numberstextColor,";\n font-weight: initial;\n ").concat(this.data.numbersfontName&&"inherit"!==this.data.numbersfontName?"font-family:".concat(this.data.numbersfontName,"_").concat(null===(e=this.data.numbersfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/))||void 0===e?void 0:e[1],";"):this.data.numbersfontStyle||"",";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-text,\n .abtasty-countdown .abtasty-countdown-elm-text * {\n ").concat(this.data.legendfontName&&"inherit"!==this.data.legendfontName?"font-family:".concat(this.data.legendfontName,"_").concat(null===(n=this.data.legendfontStyle.match(/.+\/([^.]+)\.(otf|ttf)$/))||void 0===n?void 0:n[1],";"):this.data.legendfontStyle||"",";\n font-size: ").concat(this.data.legendfontSize,"px;\n color: ").concat(this.data.legendtextColor,";\n -webkit-text-fill-color: ").concat(this.data.legendtextColor,";\n }\n\n .abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ").concat(this.data.countdownBorderRadius,"px;\n border: ").concat(this.data.countdownBorderWidth,"px solid ").concat(this.data.countdownBorderColor,";\n background-color: ").concat(this.data.numbersBackgroundColor,";\n }\n ")}},{key:"setButton",value:function(){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,g=n.endBtnLink,y=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)}}p.forEach(function(t){return y.appendChild(t)});var f=this.container.querySelector(".abtasty-countdown-finish-button"),v=document.createElement("a");v.href=g,v.target=h?"_blank":"_self",v.innerHTML=m,v.ariaLabel=m,f.appendChild(v)}},{key:"setContent",value:function(){var t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("p");e.innerHTML=this.data.message,t.appendChild(e);var n=this.container.querySelector(".abtasty-countdown-finish-text"),o=document.createElement("div");o.innerHTML=this.data.endMessage,n.appendChild(o)}},{key:"init",value:function(t){var e,n=this,o=this.data,i=o.layout,s=o.inlineLayoutContent,r=o.imageOn,a=o.imagePosition;try{this.parentContainer=t;var c=["free","popin"].includes(i);e=c&&!s?"free":H,n.container.classList.add("abtasty-countdown-layout-".concat(e)),e===H&&(c&&(n.parentContainer.domElement.querySelector(".".concat(t.contentClassName)).classList.add("abtasty-countdown-content-".concat(i,"-inline")),n.container.classList.add("abtasty-countdown-layout-".concat(i,"-inline"))),n.parentContainer.domElement.querySelectorAll(".".concat(t.closeButtonClassName)).forEach(function(t){return t.classList.add("abtasty-countdown-close-inline")}));var l="popin"===i||"free"===i&&!s,d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"popin";if(!t||!r)return"";var o=n.data.image;return'<div class="countdown_'.concat(e,'_img_container">\n\t\t\t\t<img src="').concat(o,'" class="abtasty-countdown-image ').concat(l?"abtasty-countdown-image-popin-layout":"",'">\n\t\t\t</div>')};this.container.innerHTML="\n ".concat(d(l&&!("popin"===i&&s),"popin"),'\n <div class="abtasty-countdown-layout-').concat(i,'">\n \t').concat(d(!l&&"before"===a,"banner"),'\n \t<div class="abtasty-countdown-clock" role="timer" aria-live="polite">\n\t\t\t\t\t\t<div class="abtasty-countdown-days abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n\t\t\t\t\t\t\t<div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n\t\t\t\t\t\t\t<div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t').concat(d(!l&&"after"===a,"banner"),'\n\t\t\t\t\t<div class="abtasty-countdown-top-message"></div>\n\t\t\t\t\t<div class="abtasty-countdown-finish-text"></div>\n\t\t\t\t\t<div class="abtasty-countdown-finish-button"></div>\n\t\t\t\t\t<div class="abtasty-countdown-bottom-button buttons_container"></div>\n </div>\n '),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 (max-width:579px){.ab_widget_container_countdown_content{width:100vw}}.abtasty-countdown,.abtasty-countdown>div{display:inline-block;text-align:center}.abtasty-countdown>div{margin:10px;overflow:auto;white-space:normal}.abtasty-countdown .countdown_popin_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;max-width:100%}.abtasty-countdown .countdown_popin_img_container:empty{display:none}.abtasty-countdown .abtasty-countdown-finish-text,.abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}.abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;margin:6px 6px 15px;padding:6px}.abtasty-countdown .abtasty-countdown-elm-number,.abtasty-countdown .abtasty-countdown-elm-text{font-stretch:normal;font-style:normal;font-weight:700;letter-spacing:normal;line-height:normal;text-align:center}.abtasty-countdown .abtasty-countdown-bottom-button a,.abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;display:block;display:inline-block;padding:6px 10px;text-align:center;text-decoration:none}.abtasty-countdown-layout-line>div{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:stretch;-ms-flex-pack:stretch;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:stretch}.abtasty-countdown-layout-line>div>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.abtasty-countdown-layout-free{display:block;text-align:center}.abtasty-countdown-layout-line>div{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-finish-text,.abtasty-countdown-layout-line .abtasty-countdown-top-message{-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:0;padding:0 5px 0 15px}.abtasty-countdown-layout-line .abtasty-countdown-top-message p{margin-bottom:0}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line{-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button,.abtasty-countdown-layout-line .abtasty-countdown-clock,.abtasty-countdown-layout-line .abtasty-countdown-finish-button{-ms-flex-negative:0;flex-shrink:0}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:55%!important}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:45%!important}.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:30%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-button,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-clock,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-button{width:35%!important}.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom .abtasty-countdown-finish-text,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop .abtasty-countdown-finish-text{width:65%}.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-hideCountdownAndShowTextAndButton .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showText .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showText .abtasty-countdown-layout-bannerTop,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerBottom,.abtasty-countdown-showTextAndButton .abtasty-countdown-layout-bannerTop{width:100%}.abtasty-countdown-content-popin-inline,.abtasty-countdown-content-popin-inline .abtasty-countdown-layout-popin{max-width:inherit;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content}.abtasty-countdown-content-free-inline{max-width:100%}.abtasty-countdown-image-popin-layout{margin-bottom:20px}@media (max-width:740px){.abtasty-countdown-layout-line>div:not(.abtasty-countdown-layout-popin){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.abtasty-countdown-layout-line div.abtasty-countdown-finish-text,.abtasty-countdown-layout-line div.abtasty-countdown-top-message{margin-bottom:20px;margin-top:20px}.abtasty-countdown-layout-line div.abtasty-countdown-bottom-button a{margin-left:0}.countdown_banner_img_container{display:none!important}}@media (max-width:570px){.abtasty-countdown-layout-free,.abtasty-countdown-layout-popin{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important;margin:10px 0!important}}.abtasty-countdown-layout-popin{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.countdown_banner_img_container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;padding:0 15px}.countdown_banner_img_container img{max-height:67px;max-width:200px}"," ").concat(this.getStyle()))),q.forEach(function(t){var e,o=n.container.querySelector(".abtasty-countdown-".concat(t,"s")),i=function(t){if(Array.isArray(t))return t}(e=o.children)||function(t){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,s,r=[],a=!0,c=!1;try{for(i=(e=e.call(t)).next,!2;!(a=(n=i.call(e)).done)&&(r.push(n.value),2!==r.length);a=!0);}catch(t){c=!0,o=t}finally{try{if(!a&&null!=e.return&&(s=e.return(),Object(s)!==s))return}finally{if(c)throw o}}return r}}(e)||Y(e,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=i[0],r=i[1];n.digitElements[t]=s,n.textElements[t]=r,n.timeElements[t]=o}),this.setContent(),this.setButton(),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),setTimeout(function(){n.setCountdown()},100),this.setCountdown()}catch(t){console.warn("Countdown error occured during widget rendering:",t)}}},{key:"loadFonts",value:function(){this.getFonts().forEach(function(t){var e,n=t.name,o=t.style;if(n&&"inherit"!==n&&/otf|ttf/g.test(o)){var i=document.createElement("style");i.appendChild(document.createTextNode("\n @font-face {\n font-family: '".concat(n,"_").concat(null===(e=o.match(/.+\/([^.]+)\.(otf|ttf)$/))||void 0===e?void 0:e[1],"';\n src: url('").concat(o,"');\n }"))),document.head.appendChild(i)}})}}],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,Q(o.key),o)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n}();function X(t){return X="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},X(t)}function tt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */tt=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:$(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",g="completed",y={};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 E(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"==X(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,n,o){var i=h;return function(s,r){if(i===m)throw Error("Generator is already running");if(i===g){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===y)continue;return c}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(i===h)throw i=g,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?g:"suspendedYield",l.arg===y)continue;return{value:l.arg,done:o.done}}"throw"===l.type&&(i=g,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")),y;var s=u(i,e.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,y;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,y):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(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(A,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(X(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(E.prototype),l(E.prototype,a,function(){return this}),e.AsyncIterator=E,e.async=function(t,n,o,i,s){void 0===s&&(s=Promise);var r=new E(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,y):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),y},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),y}},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),y}},e}function et(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 nt(){var t;return t=tt().mark(function t(){var e,n,o,i,s;return tt().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return h("Widget launch"),e=F(),t.next=4,e.init(!0);case 4:return n=t.sent,o=n.response,i=e.domElement.querySelector(".".concat(e.contentClassName)),(s=new Z(TEST_ID,DATA)).init(e),s.insert(i,"beforeend"),o&&e.show(),t.abrupt("return",s);case 12:case"end":return t.stop()}},t)}),nt=function(){var e=this,n=arguments;return new Promise(function(o,i){var s=t.apply(e,n);function r(t){et(s,o,i,r,a,"next",t)}function a(t){et(s,o,i,r,a,"throw",t)}r(void 0)})},nt.apply(this,arguments)}!function(){nt.apply(this,arguments)}()}();
package/package.json CHANGED
@@ -1,53 +1,47 @@
1
1
  {
2
- "name": "@abtasty/countdown",
3
- "description": "Widget for AB Tasty",
4
- "version": "3.7.29",
5
- "form": "dist/form.js",
6
- "main": "dist/main.js",
7
- "type": "module",
8
- "files": [
9
- "dist"
10
- ],
11
- "author": "ABTasty",
12
- "scripts": {
13
- "cloneConfig": "scp ../rollup.default.config.js ./rollup.config.js && scp ../babel.default.config.json ./babel.config.json",
14
- "publish:staging": "npm version prerelease && yarn && yarn build && npm publish",
15
- "publish:prod": "npm version patch && yarn && yarn build && npm publish",
16
- "publish:staging:breaking:minor": "npm version preminor && yarn && yarn build && npm publish",
17
- "publish:breaking:minor": "npm version minor && yarn && yarn build && npm publish",
18
- "publish:staging:breaking:major": "npm version premajor && yarn && yarn build && npm publish",
19
- "publish:breaking:major": "npm version major && yarn && yarn build && npm publish",
20
- "watch": "yarn run cloneConfig && rollup -c --watch",
21
- "build": "yarn run cloneConfig && rollup -c"
22
- },
23
- "devDependencies": {
24
- "@babel/core": "^7.24.0",
25
- "@babel/eslint-parser": "^7.23.10",
26
- "@babel/plugin-proposal-object-rest-spread": "^7.18.6",
27
- "@babel/preset-env": "^7.24.0",
28
- "@rollup/plugin-babel": "^6.0.3",
29
- "@rollup/plugin-eslint": "^9.0.1",
30
- "@rollup/plugin-node-resolve": "^15.0.1",
31
- "@rollup/plugin-terser": "^0.4.4",
32
- "babel-plugin-minify-dead-code-elimination": "^0.5.2",
33
- "caniuse-lite": "^1.0.30001434",
34
- "cssnano": "^5.1.12",
35
- "eslint": "^8.57.0",
36
- "eslint-config-prettier": "^9.1.0",
37
- "eslint-import-resolver-node": "^0.3.2",
38
- "eslint-plugin-import": "^2.29.1",
39
- "postcss": "^8.4.19",
40
- "postcss-cssnext": "^3.1.1",
41
- "rollup": "^4.12.0",
42
- "rollup-plugin-postcss": "^4.0.2",
43
- "snowpack": "^3.8.8"
44
- },
45
- "dependencies": {
46
- "@abtasty/widget-utils": "0.0.0"
47
- },
48
- "snowpack": {
49
- "webDependencies": [
50
- "@abtasty/widget-utils"
51
- ]
52
- }
53
- }
2
+ "name": "@abtasty/countdown",
3
+ "description": "Widget for AB Tasty",
4
+ "version": "3.7.31",
5
+ "form": "dist/form.js",
6
+ "main": "dist/main.js",
7
+ "type": "module",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "author": "ABTasty",
12
+ "license": "MIT",
13
+ "scripts": {
14
+ "cloneConfig": "scp ../rollup.default.config.js ./rollup.config.js && scp ../babel.default.config.json ./babel.config.json",
15
+ "publish:package": "yarn build && yarn npm publish --access public",
16
+ "publish:staging": "yarn && yarn version prerelease && yarn run publish:package",
17
+ "publish:prod": "yarn && yarn version patch && yarn run publish:package",
18
+ "publish:staging:breaking:minor": "yarn && yarn version preminor && yarn run publish:package",
19
+ "publish:breaking:minor": "yarn && yarn version minor && yarn run publish:package",
20
+ "publish:staging:breaking:major": "yarn && yarn version premajor && yarn run publish:package",
21
+ "publish:breaking:major": "yarn && yarn version major && yarn run publish:package",
22
+ "watch": "yarn && yarn run cloneConfig && rollup -c --watch",
23
+ "build": "yarn && yarn run cloneConfig && rollup -c"
24
+ },
25
+ "devDependencies": {
26
+ "@babel/core": "^7.24.0",
27
+ "@babel/eslint-parser": "^7.23.10",
28
+ "@babel/plugin-proposal-object-rest-spread": "^7.18.6",
29
+ "@babel/preset-env": "^7.24.0",
30
+ "@rollup/plugin-alias": "5.1.0",
31
+ "@rollup/plugin-babel": "^6.0.3",
32
+ "@rollup/plugin-eslint": "^9.0.1",
33
+ "@rollup/plugin-node-resolve": "^15.0.1",
34
+ "@rollup/plugin-terser": "^0.4.4",
35
+ "babel-plugin-minify-dead-code-elimination": "^0.5.2",
36
+ "caniuse-lite": "^1.0.30001434",
37
+ "cssnano": "^5.1.12",
38
+ "eslint": "^8.57.0",
39
+ "eslint-config-prettier": "^9.1.0",
40
+ "eslint-import-resolver-node": "^0.3.2",
41
+ "eslint-plugin-import": "^2.29.1",
42
+ "postcss": "^8.4.19",
43
+ "postcss-cssnext": "^3.1.1",
44
+ "rollup": "^4.12.0",
45
+ "rollup-plugin-postcss": "^4.0.2"
46
+ }
47
+ }