@abtasty/nps 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/main.js +1 -1
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},n=e=>new Function(`try {\n\t\t${e}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),i=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),s=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),r=()=>window.ABTasty&&!0===window.ABTasty.consentReady,o=(e,t)=>{const n=()=>{try{return document.querySelector(e)}catch(e){return null}};let i=n();const s=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],r=()=>a.disconnect(),o=()=>a.observe(...s),a=new MutationObserver(()=>(i=n(),i&&!r()&&t(i)));return i?setTimeout(()=>t(i),0):o(),{selector:e,clear:r,observe:o}};function a(e,t){return t(e)||!e.parentElement?e:a(e.parentElement,t)}const c=t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())},l=(e,t)=>[...document.querySelectorAll(t)].some(n=>n.isSameNode(e)||!!e.closest(t)),h="remove",u="rebuild",d="update",m=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},g=()=>{const e=m();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},p=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,f=n=>{if((()=>{if(e()||t())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})()){const e=g();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${n}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},v=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t};class y{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const s=[...e.querySelectorAll(i)];if(s.length&&s.includes(n))return!0;if(t.includes(n))return!0;const r=[...e.parentElement.children],o=r.findIndex(t=>t.isSameNode(e)),a=r.filter((e,t)=>t>o);if(a.length){if(a.includes(n))return!0;if(a.some(e=>[...e.querySelectorAll(i)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,s=this.targets.find(t=>t.selector===e&&t.uniqueId===i);s&&s.resolve(t),this.clear(e,i)}}mouseOverHandler(){const e=["mouseover",e=>{const t=e.composedPath(),{target:n}=e;setTimeout(()=>this.onMouseOver({target:n,path:t}),50)},!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===a(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),n=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let i=!1,s=0;for(;!i&&s<n.length;){const t=document.elementFromPoint(...n[s]);i=e===t||e.contains(t),s+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=document.querySelector(e);n&&!this.existingTargets.find(n=>n.element.matches(e)&&n.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{if(t.matches(e)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);return i&&i.resolve(t),this.clear(e,n),!1}return!0})}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n});const i=()=>{this.startMutationObserver(),this.checkElements()};document.body?i():o("body",i)}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==e&&i!==t));const n=document.querySelector(e);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class b{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[],this.socialProofStore={}}async onElementVisible({promise:e,resolve:t}){const n=v(`${this.event}DomReady`);this.promises.push(n);const i=await this.onPageLoad(n),s=await async function(){let e;return e=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||new Promise((e,t)=>{const n=window.document.getElementsByTagName("script")[0],i=window.document.createElement("script");i.src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",n.parentNode.insertBefore(i,n),i.onload=e,i.onerror=t})),e}(),r=new y;if(this.visibilityObservers.push(r),s&&i){const e=p();r.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",({isTrusted:e})=>e&&n()&&t(!0),{passive:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}return t(!0),e}onClick({promise:e,resolve:t}){const n=document.createElement("style");n.type="text/css",n.id=`Click_${p()}`,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 i=["click",({isTrusted:e,target:n})=>e&&l(n,this.selector)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onHover({promise:e,resolve:t}){const n=["mouseenter",({isTrusted:e,target:n})=>e&&l(n,this.selector)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...n]),document.documentElement.addEventListener(...n),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",({isTrusted:e,clientY:n})=>{e&&n<=0&&t(!0)},{passive:!0}],i=o("body",e=>{this.eventsListeners.push([e,...n]),e.addEventListener(...n),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i)});return this.elementsWaiters.push(i),e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const s=[({isTrusted:e})=>{e&&(i=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{this.eventsListeners.push([document,e,...s]),document.addEventListener(e,...s)});const r=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(r),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(e=>e&&t(!0)),e}onScrollUp({promise:e,resolve:t}){let n=0;const i=["scroll",({isTrusted:e})=>{e&&(window.pageYOffset<n?t(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:n}=DATA,i=["scroll",({isTrusted:e})=>{if(!e)return;const i=(()=>{const{documentElement:e,body:t}=document,n=e.scrollTop||t.scrollTop,i=e.scrollHeight||t.scrollHeight;return Math.trunc(n/(i-e.clientHeight)*100,10)})();n<i&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}checkSocialProofConditions(e,t,n,i){const s=(()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:r,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))n(this.socialProofStore[e])?i(`${this.socialProofStore[e][r]}`):i(!1);else if(e&&s){const a=t=>(this.socialProofStore[e]=t,i(!!n(t)&&`${t[r]}`));fetch(`https://api-social-proof.abtasty.com/clients/${s}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>f("Failed to fetch datas from server."))}else i(!1)}getSocialProofDatas({promise:e,resolve:t},s,r=!1){const{productKey:o,keyType:a}=(()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:s,customJSProductKey:r,productSKU:o}=DATA;if(2===e)return{productKey:i(),keyType:"url"};{let a=null,c="sku";switch(t){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${s};`);break;case"customJSProductKey":a=n(r);break;case"productSKU":a=o}return a||3!==e||(a=i(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:l,triggerSocialProofMinPurchases:h,triggerSocialProofMinPageViews:u}=DATA,d={pv:u,i:h,"v-pv":l}[s];return[typeof c,typeof d].includes("undefined")&&t(!1),r&&!o&&(f("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://abtasty.elevio.help/en/articles/190-social-proof-prerequisites"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===s&&"sku"===a?"v-i":s,e=>{const t=void 0!==e[c]&&e[c]>=d;return t||f(`Widget will not be shown, Social Proof API returned ${e[c]} while ${d} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!r()){const n=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),e}return t(!0),e}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:n}=DATA;let i=localStorage.getItem("ABTastyData");const s=()=>JSON.parse(i).ActionTracking.find(({name:e})=>e===n),r=["storage",()=>{i=localStorage.getItem("ABTastyData"),s()&&t(!0)},{passive:!0,capture:!0}];return i&&s()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:n}=DATA;let i=localStorage.getItem("ABTastyData");const s=()=>n<=(i?JSON.parse(i).VisitedPages.length:0),r=["storage",()=>{i=localStorage.getItem("ABTastyData"),s()&&t(!0)},{passive:!0,capture:!0}];return i&&s()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:i}=DATA;let s=0,r=!1;const o=["click",({isTrusted:e})=>{if(e&&(s+=1,s>=n&&t(!0),!r)){r=!0;const e=setTimeout(()=>{s=0,r=!1},i);this.timeouts.push(e)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),e}clear(e){if(top.console.log("clear",{from:e}),this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...n]=e;t&&n.length>1&&t.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=p();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear("isTriggered"),top.console.log("isTriggered",{event:this.event});const e=v(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(e),socialProofPurchases:()=>this.getSocialProofDatas(e,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(e,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(e,"v-pv")},n=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return n&&this.clear("isTriggered 2"),"reengage"!==this.event&&this.delay?n&&await(async()=>{const e=v(`${this.event}Delay`);this.promises.push(e);const t=setTimeout(()=>{e.resolve(!0),this.clear("waitDelay")},this.delay);return this.timeouts.push(t),e.promise})():n}}const w="display",C="closing",S="validation",$="ABTastyWidgets",E=`${$}Temporary`;class T{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:n},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=m(),this.uniqueId=p(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(E),n=sessionStorage.getItem($);"ABTastyData"===e&&!t&&n&&localStorage.setItem(E,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem($);return JSON.parse(t)}catch(t){return e.removeItem($),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:n,...i}=t;return Object.entries(i).length?(e.setItem($,JSON.stringify(i)),i):(e.removeItem($),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(E),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem($,e),localStorage.removeItem(E));const n=this.getLocalRecurrence(),i=(n?parseFloat(n.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&i&&!this.getLocalRecurrence()&&!t}setRecurrence(e,n){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const i=this.getTypeOfStorage(e);if(t()||!i&&"object"!=typeof i)return!1;const{storageString:s,storageMethod:o}=i,a=this.getStamp(e),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!r()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new b({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===s?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===s&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};o.setItem($,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&n!==S)if(n===C&&l!==S)h();else{if(n!==w||l===S||l===C)return!1;h()}else h();return a}setDisplayRecurrence(){const e=w;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=C;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=S;this.setRecurrence(this.validationRecurrence,e)}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class N{constructor(e,t,n,i){this.recurrence=e,this.isWidgetApplied=t,this.callback=n,this.shouldUpdate=i,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=s(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let i;const r=this.isWidgetApplied(),o=(()=>{const t=this.recurrenceIsDone();return e&&"display"===n||t})(),a=!r&&t&&o,c=r&&(!t||!o),l=!r&&!t;return this.shouldUpdate&&!e&&t&&o?i=d:a?i=u:(c||l)&&(i=h),"string"==typeof i&&(this.clearWatcher(),this.callback(i,e),this.watch()),this}eventHandler(){let e=s();return[250,500].forEach(t=>{setTimeout(()=>{const n=s();return 500===t&&n===e?this:(e=n,this.decisionHandler(!1))},t)}),this}observerHandler(e){return e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler(!0):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=()=>{const e=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...e)};return document.body?t():(()=>{const e=o("body",()=>{t(),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});this.elementsWaiters.push(e)})(),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const k=/.+\/([^.]+)\.(otf|ttf)$/,x=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class A{constructor(){this.children=void 0,this.uniqueId=p(),this.widgetName=m(),this.prettyName=g(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:n,validationRecurrence:i}=DATA;if(e()||!t&&!n&&!i)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},r={};return t&&(r.displayRecurrence=s[t]("displayRecurrence")),n&&(r.closingRecurrence=s[n]("closingRecurrence")),i&&(r.validationRecurrence=s[i]("validationRecurrence")),r})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:n,triggerEventHover:i,triggerEventReengageDelay:s,socialProofContentType:r,triggerEventElementVisible:o,triggerEventDelay:a}=DATA;if(e()||!t&&!r)return!1;const c={click:()=>n,hover:()=>i,elementVisible:()=>o},l=Object.prototype.hasOwnProperty.call(c,t)?c[t]():"body",h="reengage"===t?s:a;return r&&(t=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][r]),{triggerEvent:t,triggerSelector:l,triggerDelay:h}})(),this.recurrence=!!this.recurrenceParams&&new T(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new b(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&x.includes(this.triggerParams.triggerEvent),this.pageWatcher=new N(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(t)||e})(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=new Promise(e=>{const t=o("head",t=>{this.elementsWaiters=this.elementsWaiters.filter(({selector:e})=>"head"!==e),e(t.appendChild(this.styleElement))});this.elementsWaiters.push(t)}),t=new Promise(e=>{const{elementReferrer:t="body",referrerInsertType:n="beforeend"}="free"===DATA.layout?DATA:{},i=o(t,i=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==t),this.removeOldDomElement(),e(i.insertAdjacentElement(n,this.domElement))});this.elementsWaiters.push(i)});return Promise.all([t,e]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(e=>e&&e.isConnected&&e.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||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(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const n=e(),i=s(),r=this.trigger&&this.trigger.promises.length,o=!this.recurrence||this.recurrence.isOver();if(!n&&!i||r||!o)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||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t){let n=!1;const i=()=>this.init().then(({response:e})=>{n=e,e?this.show("onPageChange - relaunch"):this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear("onPageChange"));const s=this.isWidgetApplied(),r={[h]:()=>s?this.remove():this.pageWatcher.watch(),[u]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():!s&&n&&this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):i()},[d]:i};"function"==typeof r[e]&&r[e]()}addCloseEvent(...t){const{closeButton:n,overlay:i,overlayClickable:s,layout:r,animationDuration:o=1e3}=DATA,a=[];if(void 0!==i&&!0!==i||!0!==s||"popin"!==r||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const l=this.domElement.querySelectorAll(a.join(", "));if(!l.length)return this;const h=["click",e=>{c(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...l),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...h),t.addEventListener(...h)}),this}getDom(){const{closeButton:e,layout:t,overlay:n=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,i.innerHTML=`\n\t\t\t${"popin"===t&&!0===n?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,i}loadFont(e,t){if(!e||"inherit"===e)return;const n=document.createElement("style"),i=t.match(k)?t.match(k)[1]:"";n.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}'); font-display: swap; }`,document.head.appendChild(n)}getStyleTag(t="",n=DATA){const{noStyles:i,layout:s}=n,{backgroundColor:r,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:u,borderRadius:d,borderWidth:m,textColor:g,textAlign:p,fontName:f,fontStyle:v,fontSize:y,isTitle:b,titleTextAlign:w,titleTextColor:C,titleFontName:S,titleFontStyle:$,titleFontSize:E,overlay:T,overlayColor:N,dropShadow:x,dropShadowColor:A,dropShadowBlur:P,containerMargin:L,containerPadding:I,closeButton:O,closeButtonPosition:R,closeButtonSize:B,closeButtonBorderRadius:_,closeButtonBorderWidth:D,closeButtonBorderColor:j,closeButtonColor:W,closeButtonBackgroundColor:F,buttonsAlign:V,buttonsBorderWidth:q,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:z,buttonsTextColor:Y,buttonsFontName:U,buttonsFontStyle:K,buttonsFontSize:G,secondLink:Q,secondLinkBorderWidth:J,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:ne,secondLinkFontStyle:ie,secondLinkFontSize:se,animation:re,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=i?{}:n,le=document.createElement("style");le.type="text/css",e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(S,$),this.loadFont(U,K),this.loadFont(ne,ie);const he=`background: ${["string"==typeof r?r:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ue="number"==typeof m&&m>0,de=`border: ${[ue?`${m}px`:"unset",ue?"solid":"",ue&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,me=void 0!==d?`border-radius: ${d}px;`:"",ge=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",pe=void 0!==p?`text-align: ${p};`:"",fe=f&&"inherit"!==f?`font-family:${f}_${v.match(k)?v.match(k)[1]:""};`:v||"",ve=y?`font-size: ${y}px;`:"",ye=void 0!==x&&x?`box-shadow: 0 5px ${P}px 0 ${A};`:"",be=L instanceof Array&&1===L.length&&L[0],we=be?`margin: ${be.top}px ${be.right}px ${be.bottom}px ${be.left}px;`:"",Ce=be?`margin: calc(${be.top}px * 0.5) calc(${be.right}px * 0.5) calc(${be.bottom}px * 0.5) calc(${be.left}px * 0.5);`:"",Se=I instanceof Array&&1===I.length&&I[0],$e=Se?`padding: ${Se.top}px ${Se.right}px ${Se.bottom}px ${Se.left}px;`:"",Ee=Se?`padding: calc(${Se.top}px * 0.5) calc(${Se.right}px * 0.5) calc(${Se.bottom}px * 0.5) calc(${Se.left}px * 0.5);`:"",Te=void 0!==q&&q?`border-width: ${q}px; border-style: solid;`:"",Ne=[M,q].every(e=>void 0!==e)&&q?`border-color: ${M};`:"",ke=void 0!==H?`border-radius: ${H}px;`:"",xe=void 0!==z?`background-color: ${z};`:"",Ae=void 0!==Y?`color: ${Y}; fill: ${Y}; -webkit-text-fill-color: ${Y};`:"",Pe=U&&"inherit"!==U?`font-family:${U}_${K.match(k)?K.match(k)[1]:""};`:K||"",Le=G?`font-size: ${G}px;`:"",Ie=void 0!==J&&J?`border-width: ${J}px; border-style: solid;`:"",Oe=[X,J].every(e=>void 0!==e)&&J?`border-color: ${X};`:"",Re=void 0!==Z?`border-radius: ${Z}px;`:"",Be=void 0!==ee?`background-color: ${ee};`:"",_e=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",De=ne&&"inherit"!==ne?`font-family:${ne}_${ie.match(k)?ie.match(k)[1]:""};`:ie||"",je=se?`font-size: ${se}px;`:"",We="popin"!==s||void 0!==T&&!0!==T?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==N?N:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Fe="number"==typeof B?B:16,Ve=Fe/2,qe=i||void 0!==O&&O?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===R?`bottom: calc(100% + ${Ve}px)`:`top: ${Ve}px`)+";",`right: ${Ve}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof _?`border-radius: ${_}px;`:"","number"==typeof D&&D>0?`border: ${D}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: ${Fe}px;`,`height: ${Fe}px;`,"string"==typeof W?`fill: ${W};`:"","}"].join(""):"",Me=b&&"string"==typeof C?[`#${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: ${C}; fill: ${C}; -webkit-text-fill-color: ${C};`,void 0!==w?`text-align: ${w};`:"",S&&"inherit"!==S?`font-family:${S}_${$.match(k)?$.match(k)[1]:""};`:$||"",E?`font-size: ${E}px;`:"","}"].join(""):"";let He="";if("string"==typeof re){const t=(oe/1e3).toFixed(2),n=["top","bottom"].includes(ce),i=Number(n),s=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[i]:"0"];n&&s.reverse(),He={none:[],fade:[`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${ae};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${ae};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${s.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":re].join("")}const ze=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===V?"top":"left"}: 8px;`,Ie,Oe,Re,Be,_e,De,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,_e,De,je,"}"];return le.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,me,de,ge,pe,ye,we,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,ge,pe,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",$e,fe,ve,"}",`#${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;",Te,Ne,ke,xe,Ae,Pe,Le,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Ae,Pe,Le,"}",...Q?ze:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Ce,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Ee,"}","}",We,qe,Me,He,`${t}`].join(""),le}}const P=["top: 0;","top: 50%;","bottom: 0;"],L=["left: 0;","left: 50%;","right: 0;"],I=e=>1===e?"-50%":0,O=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,n=`translate(${I(t)}, ${I(e)});`;return`${P[e]}${L[t]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},R=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,B=()=>{if(R())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:n,autoHeight:i,popinPercentHeight:s,popinPixelsHeight:r,heightUnit:o}=DATA;return`width: ${"px"===n?t:e}${n};height: ${i?"auto":`${"px"===o?r:s}${o}`};`};class _ extends A{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>I(e)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,overlay:n,widthUnit:i}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"background: none;","pointer-events: "+(!1===n?"none":"all"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",O(),B(),"pointer-events: all","}",`${R()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!R()&&["px","em"].includes(i)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class D extends A{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===e?t:e};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class j extends A{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const W=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new _;break;case"bannerTop":case"bannerBottom":t=new D;break;case"free":t=new j;break;default:t=new A}return t};function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){M(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(e,t,n){return(t=H(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){var t=function(e){if("object"!==F(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===F(t)?t:String(t)}var z=DATA,Y=z.isFeedBackQuestion,U=z.isThankYouMessage,K=z.autoHide,G=z.timeHide,Q=z.stepToShow,J=z.question,X=z.feedbackQuestion,Z=z.buttonText,ee=z.thankYouMessage,te=z.isLegend,ne=z.minLegend,ie=z.maxLegend,se=z.noStyles,re={capture:!0,passive:!1},oe=function(){function t(e){var n=e.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.parentContainer=n,this.baseClassName="nps_container",this.className="".concat(this.baseClassName,"_").concat(n.uniqueId),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(n.uniqueId,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}var n,i;return n=t,i=[{key:"sendNote",value:function(){if(!e()&&!isNaN(this.currentNote))try{window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback})}catch(e){f("Not able to send NPS hit due to old tag version (< 3.0)")}return this}},{key:"insertIn",value:function(e,t){return document.head.insertAdjacentElement("beforeend",this.styleElement),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),K?(setTimeout(function(){e.parentContainer.hide(),setTimeout(function(){e.parentContainer.recurrence.setValidationRecurrence(),e.parentContainer.remove(),e.showNotes(),e.currentNote=NaN,e.userFeedback="",e.feedbackElements.feedbackFormElement.querySelector("textarea").value=""},1e3)},1e3*G),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),Y&&X&&X.length?this.showFeedBack():U&&ee&&ee.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){U&&ee&&ee.length?this.showThankYouMessage():this.complete()}},{key:"showNotes",value:function(){var e=this;return this.npsContainer.childNodes.forEach(function(t){return t.classList.add(e.hideClassName)}),[this.questionElement,this.notesContainer].forEach(function(t){return t.classList.remove(e.hideClassName)}),this}},{key:"showFeedBack",value:function(){var e=this;return this.npsContainer.childNodes.forEach(function(t){return t.classList.add(e.hideClassName)}),Object.values(this.feedbackElements).forEach(function(t){return t.classList.remove(e.hideClassName)}),this}},{key:"showThankYouMessage",value:function(){var e=this;return this.npsContainer.childNodes.forEach(function(t){return t.classList.add(e.hideClassName)}),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=ee,e()&&"displayThanksStep"===Q&&t.classList.remove(this.hideClassName),t}},{key:"getFeedBackElements",value:function(){var t=this,n=document.createElement("p");n.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),n.innerHTML=X;var i=document.createElement("form");i.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),i.addEventListener("submit",c,q({},re));var s=document.createElement("textarea");s.className="".concat(this.feedbackQuestionClassName,"_textarea");var r=document.createElement("button");return r.className="".concat(this.feedbackQuestionClassName,"_button"),r.innerHTML="<span>".concat(Z,"</span>"),r.addEventListener("click",function(e){return c(e),t.userFeedback=s.value,t.onFeedbackSend()},q({},re)),e()&&"displayFeedbackStep"===Q&&[n,i].forEach(function(e){return e.classList.remove(t.hideClassName)}),i.appendChild(s),i.appendChild(r),{feedbackQuestionElement:n,feedbackFormElement:i}}},{key:"getNotesElement",value:function(){var t=this,n=document.createElement("div");n.className=this.notesClassName,e()&&"displayNoteStep"!==Q&&n.classList.add(this.hideClassName);for(var i=10;i>=0;){var s=document.createElement("button");s.className=this.notesButtonsClassName,s.dataset.note=i,e()&&s.setAttribute("data-abtasty-actionnable",""),s.innerHTML+="<span>".concat(i,"</span>"),s.addEventListener("click",function(e){c(e),t.onClickNote(e)},q({},re)),n.insertAdjacentElement("afterbegin",s),5===i&&s.insertAdjacentHTML("afterend","<br>"),i-=1}return te&&(n.insertAdjacentHTML("afterbegin","<legend>".concat(ne,"</legend>")),n.insertAdjacentHTML("beforeend","<legend>".concat(ie,"</legend>"))),n}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=J,e()&&"displayNoteStep"!==Q&&t.classList.add(this.hideClassName),t}},{key:"getContainer",value:function(){var e=document.createElement("div");return e.className="".concat(this.baseClassName," ").concat(this.className),e}},{key:"getNPSElement",value:function(){var e=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),Y&&Object.values(this.feedbackElements).forEach(function(t){e.npsContainer.appendChild(t)}),U&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"getStyleElement",value:function(){var t=document.createElement("style");if(t.type="text/css",e()&&t.setAttribute("abtasty-script-added","true"),se)t.textContent=["#".concat(this.parentContainer.widgetContainerId," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var n=DATA,i=n.containerPadding,s=n.legendTextColor,r=n.legendFontName,o=n.legendFontStyle,a=n.legendFontSize,c=n.buttonsFontSize;this.parentContainer.loadFont(r,o);var l=/.+\/([^.]+)\.(otf|ttf)$/,h=r&&"inherit"!==r?"font-family:".concat(r,"_").concat(o.match(l)?o.match(l)[1]:"",";"):o||"",u=i instanceof Array&&1===i.length&&i[0],d="#".concat(this.parentContainer.widgetContainerId," .").concat(this.className);t.textContent=["".concat(d," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(d,","),"".concat(d," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: normal;","font-family: sans-serif;","}","".concat(d," > * {"),"display: block;","width: 100%;","}","".concat(d," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(d," p {"),"margin-bottom: 15px;","font-size: 1.4em;","white-space: pre-line;","}","".concat(d," button {"),"vertical-align: middle;","cursor: pointer;","text-align: center;","}","".concat(d," button span {"),"font-size: 1em;","pointer-events: none;","}","".concat(d," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: ".concat(1.75*c,"px;"),"height: ".concat(1.75*c,"px;"),"}","".concat(d," .").concat(this.notesClassName," button * {"),"display: inline-block !important;","pointer-events: none;","}","".concat(d," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",te?["".concat(d," legend {"),"position: absolute;","text-decoration: none;","border: none;","color: ".concat(s,";"),"fill: ".concat(s,";"),"-webkit-text-fill-color: ".concat(s,";"),"font-size: ".concat(a,"px;"),h,"}","".concat(d," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(d," textarea {"),"display: block;","width: 100%;","min-width: 310px;","min-height: 60px;","font-size: 1.4em;","border: 1px solid grey;","border-radius: 4px;","resize: vertical;","margin-bottom: 10px;","text-align: left;","padding: 5px;","}","".concat(d," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 580px) {","".concat(d," {"),"min-width: 560px;","}",te?["".concat(d," .").concat(this.notesClassName," {"),"padding-top: ".concat(1.5*a,"px"),"}","".concat(d," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(d," br {"),"display: none","}","}","@media screen and (max-width: 579px) {","".concat(d," {"),"min-width: ".concat(240+(u.left+u.right/2),"px;"),"}","".concat(d," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(d," br {"),"display: block","}",te?["".concat(d," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(d," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(d," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(d," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(d," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(d," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(d," textarea {"),"min-width: auto;","}","}"].join("")}return t}}],i&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,H(i.key),i)}}(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),t}();function ae(e){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(e)}function ce(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ce=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},r=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",a=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,s){var r=t&&t.prototype instanceof d?t:d,o=Object.create(r.prototype),a=new T(s||[]);return i(o,"_invoke",{value:C(e,n,a)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function d(){}function m(){}function g(){}var p={};c(p,r,function(){return this});var f=Object.getPrototypeOf,v=f&&f(f(N([])));v&&v!==t&&n.call(v,r)&&(p=v);var y=g.prototype=d.prototype=Object.create(p);function b(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function w(e,t){function s(i,r,o,a){var c=h(e[i],e,r);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==ae(u)&&n.call(u,"__await")?t.resolve(u.__await).then(function(e){s("next",e,o,a)},function(e){s("throw",e,o,a)}):t.resolve(u).then(function(e){l.value=e,o(l)},function(e){return s("throw",e,o,a)})}a(c.arg)}var r;i(this,"_invoke",{value:function(e,n){function i(){return new t(function(t,i){s(e,n,t,i)})}return r=r?r.then(i,i):i()}})}function C(e,t,n){var i="suspendedStart";return function(s,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===s)throw r;return{value:void 0,done:!0}}for(n.method=s,n.arg=r;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var c=h(e,t,n);if("normal"===c.type){if(i=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i="completed",n.method="throw",n.arg=c.arg)}}}function S(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var s=h(i,e.iterator,t.arg);if("throw"===s.type)return t.method="throw",t.arg=s.arg,t.delegate=null,u;var r=s.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function $(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach($,this),this.reset(!0)}function N(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:k}}function k(){return{value:void 0,done:!0}}return m.prototype=g,i(y,"constructor",{value:g,configurable:!0}),i(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(w.prototype),c(w.prototype,o,function(){return this}),e.AsyncIterator=w,e.async=function(t,n,i,s,r){void 0===r&&(r=Promise);var o=new w(l(t,n,i,s),r);return e.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},b(y),c(y,a,"Generator"),c(y,r,function(){return this}),c(y,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return o.type="throw",o.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,u):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var s=i.arg;E(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function le(e,t,n,i,s,r,o){try{var a=e[r](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,s)}function he(){var e;return e=ce().mark(function e(){var t,n,i;return ce().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=W(),n=t.domElement.querySelector(".".concat(t.contentClassName)),i=new oe({parentContainer:t}),t.children=i,i.insertIn(n,"beforeend"),t.init().then(function(e){return e.response&&t.show()}),e.abrupt("return",{parentContainer:t,NPS:i});case 8:case"end":return e.stop()}},e)}),he=function(){var t=this,n=arguments;return new Promise(function(i,s){var r=e.apply(t,n);function o(e){le(r,i,s,o,a,"next",e)}function a(e){le(r,i,s,o,a,"throw",e)}o(void 0)})},he.apply(this,arguments)}!function(){he.apply(this,arguments)}()}();
1
+ !function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},n=e=>new Function(`try {\n\t\t${e}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),i=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),s=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),r=()=>window.ABTasty&&!0===window.ABTasty.consentReady,o=(e,t)=>{const n=()=>{try{return document.querySelector(e)}catch(e){return null}};let i=n();const s=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],r=()=>a.disconnect(),o=()=>a.observe(...s),a=new MutationObserver(()=>(i=n(),i&&!r()&&t(i)));return i?setTimeout(()=>t(i),0):o(),{selector:e,clear:r,observe:o}};function a(e,t){return t(e)||!e.parentElement?e:a(e.parentElement,t)}const c=t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())},l=(e,t)=>[...document.querySelectorAll(t)].some(n=>n.isSameNode(e)||!!e.closest(t)),h="remove",u="rebuild",d="update",m=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},g=()=>{const e=m();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},p=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,f=n=>{if((()=>{if(e()||t())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})()){const e=g();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${n}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},v=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t};class y{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const s=[...e.querySelectorAll(i)];if(s.length&&s.includes(n))return!0;if(t.includes(n))return!0;const r=[...e.parentElement.children],o=r.findIndex(t=>t.isSameNode(e)),a=r.filter((e,t)=>t>o);if(a.length){if(a.includes(n))return!0;if(a.some(e=>[...e.querySelectorAll(i)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,s=this.targets.find(t=>t.selector===e&&t.uniqueId===i);s&&s.resolve(t),this.clear(e,i)}}mouseOverHandler(){const e=["mouseover",e=>{const t=e.composedPath(),{target:n}=e;setTimeout(()=>this.onMouseOver({target:n,path:t}),50)},!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===a(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),n=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let i=!1,s=0;for(;!i&&s<n.length;){const t=document.elementFromPoint(...n[s]);i=e===t||e.contains(t),s+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=document.querySelector(e);n&&!this.existingTargets.find(n=>n.element.matches(e)&&n.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{if(t.matches(e)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);return i&&i.resolve(t),this.clear(e,n),!1}return!0})}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n});const i=()=>{this.startMutationObserver(),this.checkElements()};document.body?i():o("body",i)}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==e&&i!==t));const n=document.querySelector(e);n&&this.visibilityObserver.unobserve(n),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class b{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[],this.socialProofStore={}}async onElementVisible({promise:e,resolve:t}){const n=v(`${this.event}DomReady`);this.promises.push(n);const i=await this.onPageLoad(n),s=await async function(){let e;return e=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||new Promise((e,t)=>{const n=window.document.getElementsByTagName("script")[0],i=window.document.createElement("script");i.src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",n.parentNode.insertBefore(i,n),i.onload=e,i.onerror=t})),e}(),r=new y;if(this.visibilityObservers.push(r),s&&i){const e=p();r.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",({isTrusted:e})=>e&&n()&&t(!0),{passive:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}return t(!0),e}onClick({promise:e,resolve:t}){const n=document.createElement("style");n.type="text/css",n.id=`Click_${p()}`,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 i=["click",({isTrusted:e,target:n})=>e&&l(n,this.selector)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onHover({promise:e,resolve:t}){const n=["mouseenter",({isTrusted:e,target:n})=>e&&l(n,this.selector)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...n]),document.documentElement.addEventListener(...n),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",({isTrusted:e,clientY:n})=>{e&&n<=0&&t(!0)},{passive:!0}],i=o("body",e=>{this.eventsListeners.push([e,...n]),e.addEventListener(...n),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i)});return this.elementsWaiters.push(i),e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const s=[({isTrusted:e})=>{e&&(i=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{this.eventsListeners.push([document,e,...s]),document.addEventListener(e,...s)});const r=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(r),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(e=>e&&t(!0)),e}onScrollUp({promise:e,resolve:t}){let n=0;const i=["scroll",({isTrusted:e})=>{e&&(window.pageYOffset<n?t(!0):n=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:n}=DATA,i=["scroll",({isTrusted:e})=>{if(!e)return;const i=(()=>{const{documentElement:e,body:t}=document,n=e.scrollTop||t.scrollTop,i=e.scrollHeight||t.scrollHeight;return Math.trunc(n/(i-e.clientHeight)*100,10)})();n<i&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}checkSocialProofConditions(e,t,n,i){const s=(()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:r,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))n(this.socialProofStore[e])?i(`${this.socialProofStore[e][r]}`):i(!1);else if(e&&s){const a=t=>(this.socialProofStore[e]=t,i(!!n(t)&&`${t[r]}`));fetch(`https://api-social-proof.abtasty.com/clients/${s}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>f("Failed to fetch datas from server."))}else i(!1)}getSocialProofDatas({promise:e,resolve:t},s,r=!1){const{productKey:o,keyType:a}=(()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:s,customJSProductKey:r,productSKU:o}=DATA;if(2===e)return{productKey:i(),keyType:"url"};{let a=null,c="sku";switch(t){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=n(`return ${s};`);break;case"customJSProductKey":a=n(r);break;case"productSKU":a=o}return a||3!==e||(a=i(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:l,triggerSocialProofMinPurchases:h,triggerSocialProofMinPageViews:u}=DATA,d={pv:u,i:h,"v-pv":l}[s];return[typeof c,typeof d].includes("undefined")&&t(!1),r&&!o&&(f("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://abtasty.elevio.help/en/articles/190-social-proof-prerequisites"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===s&&"sku"===a?"v-i":s,e=>{const t=void 0!==e[c]&&e[c]>=d;return t||f(`Widget will not be shown, Social Proof API returned ${e[c]} while ${d} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!r()){const n=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(n),window.addEventListener(...n),e}return t(!0),e}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:n}=DATA;let i=localStorage.getItem("ABTastyData");const s=()=>JSON.parse(i).ActionTracking.find(({name:e})=>e===n),r=["storage",()=>{i=localStorage.getItem("ABTastyData"),s()&&t(!0)},{passive:!0,capture:!0}];return i&&s()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:n}=DATA;let i=localStorage.getItem("ABTastyData");const s=()=>n<=(i?JSON.parse(i).VisitedPages.length:0),r=["storage",()=>{i=localStorage.getItem("ABTastyData"),s()&&t(!0)},{passive:!0,capture:!0}];return i&&s()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:i}=DATA;let s=0,r=!1;const o=["click",({isTrusted:e})=>{if(e&&(s+=1,s>=n&&t(!0),!r)){r=!0;const e=setTimeout(()=>{s=0,r=!1},i);this.timeouts.push(e)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...n]=e;t&&n.length>1&&t.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=p();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=v(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(e),socialProofPurchases:()=>this.getSocialProofDatas(e,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(e,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(e,"v-pv")},n=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return n&&this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const e=v(`${this.event}Delay`);this.promises.push(e);const t=setTimeout(()=>{e.resolve(!0),this.clear()},this.delay);return this.timeouts.push(t),e.promise})():n}}const w="display",C="closing",S="validation",$="ABTastyWidgets",E=`${$}Temporary`;class T{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:n},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=m(),this.uniqueId=p(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(E),n=sessionStorage.getItem($);"ABTastyData"===e&&!t&&n&&localStorage.setItem(E,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem($);return JSON.parse(t)}catch(t){return e.removeItem($),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:n,...i}=t;return Object.entries(i).length?(e.setItem($,JSON.stringify(i)),i):(e.removeItem($),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(E),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem($,e),localStorage.removeItem(E));const n=this.getLocalRecurrence(),i=(n?parseFloat(n.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&i&&!this.getLocalRecurrence()&&!t}setRecurrence(e,n){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const i=this.getTypeOfStorage(e);if(t()||!i&&"object"!=typeof i)return!1;const{storageString:s,storageMethod:o}=i,a=this.getStamp(e),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!r()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new b({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===s?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===s&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};o.setItem($,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&n!==S)if(n===C&&l!==S)h();else{if(n!==w||l===S||l===C)return!1;h()}else h();return a}setDisplayRecurrence(){const e=w;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=C;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=S;this.setRecurrence(this.validationRecurrence,e)}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class N{constructor(e,t,n,i){this.recurrence=e,this.isWidgetApplied=t,this.callback=n,this.shouldUpdate=i,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=s(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let i;const r=this.isWidgetApplied(),o=(()=>{const t=this.recurrenceIsDone();return e&&"display"===n||t})(),a=!r&&t&&o,c=r&&(!t||!o),l=!r&&!t;return this.shouldUpdate&&!e&&t&&o?i=d:a?i=u:(c||l)&&(i=h),"string"==typeof i&&(this.clearWatcher(),this.callback(i,e),this.watch()),this}eventHandler(){let e=s();return[250,500].forEach(t=>{setTimeout(()=>{const n=s();return 500===t&&n===e?this:(e=n,this.decisionHandler(!1))},t)}),this}observerHandler(e){return e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler(!0):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=()=>{const e=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...e)};return document.body?t():(()=>{const e=o("body",()=>{t(),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});this.elementsWaiters.push(e)})(),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const k=/.+\/([^.]+)\.(otf|ttf)$/,x=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class A{constructor(){this.children=void 0,this.uniqueId=p(),this.widgetName=m(),this.prettyName=g(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:n,validationRecurrence:i}=DATA;if(e()||!t&&!n&&!i)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},r={};return t&&(r.displayRecurrence=s[t]("displayRecurrence")),n&&(r.closingRecurrence=s[n]("closingRecurrence")),i&&(r.validationRecurrence=s[i]("validationRecurrence")),r})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:n,triggerEventHover:i,triggerEventReengageDelay:s,socialProofContentType:r,triggerEventElementVisible:o,triggerEventDelay:a}=DATA;if(e()||!t&&!r)return!1;const c={click:()=>n,hover:()=>i,elementVisible:()=>o},l=Object.prototype.hasOwnProperty.call(c,t)?c[t]():"body",h="reengage"===t?s:a;return r&&(t=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][r]),{triggerEvent:t,triggerSelector:l,triggerDelay:h}})(),this.recurrence=!!this.recurrenceParams&&new T(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new b(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&x.includes(this.triggerParams.triggerEvent),this.pageWatcher=new N(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(t)||e})(),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=new Promise(e=>{const t=o("head",t=>{this.elementsWaiters=this.elementsWaiters.filter(({selector:e})=>"head"!==e),e(t.appendChild(this.styleElement))});this.elementsWaiters.push(t)}),t=new Promise(e=>{const{elementReferrer:t="body",referrerInsertType:n="beforeend"}="free"===DATA.layout?DATA:{},i=o(t,i=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==t),this.removeOldDomElement(),e(i.insertAdjacentElement(n,this.domElement))});this.elementsWaiters.push(i)});return Promise.all([t,e]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(e=>e&&e.isConnected&&e.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||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(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const n=e(),i=s(),r=this.trigger&&this.trigger.promises.length,o=!this.recurrence||this.recurrence.isOver();if(!n&&!i||r||!o)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||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t){let n=!1;const i=()=>this.init().then(({response:e})=>{n=e,e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const s=this.isWidgetApplied(),r={[h]:()=>s?this.remove():this.pageWatcher.watch(),[u]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():!s&&n&&this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):i()},[d]:i};"function"==typeof r[e]&&r[e]()}addCloseEvent(...t){const{closeButton:n,overlay:i,overlayClickable:s,layout:r,animationDuration:o=1e3}=DATA,a=[];if(void 0!==i&&!0!==i||!0!==s||"popin"!==r||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const l=this.domElement.querySelectorAll(a.join(", "));if(!l.length)return this;const h=["click",e=>{c(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...l),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...h),t.addEventListener(...h)}),this}getDom(){const{closeButton:e,layout:t,overlay:n=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,i.innerHTML=`\n\t\t\t${"popin"===t&&!0===n?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,i}loadFont(e,t){if(!e||"inherit"===e)return;const n=document.createElement("style"),i=t.match(k)?t.match(k)[1]:"";n.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}'); font-display: swap; }`,document.head.appendChild(n)}getStyleTag(t="",n=DATA){const{noStyles:i,layout:s}=n,{backgroundColor:r,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:u,borderRadius:d,borderWidth:m,textColor:g,textAlign:p,fontName:f,fontStyle:v,fontSize:y,isTitle:b,titleTextAlign:w,titleTextColor:C,titleFontName:S,titleFontStyle:$,titleFontSize:E,overlay:T,overlayColor:N,dropShadow:x,dropShadowColor:A,dropShadowBlur:P,containerMargin:L,containerPadding:I,closeButton:O,closeButtonPosition:R,closeButtonSize:B,closeButtonBorderRadius:_,closeButtonBorderWidth:D,closeButtonBorderColor:j,closeButtonColor:W,closeButtonBackgroundColor:F,buttonsAlign:V,buttonsBorderWidth:q,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:z,buttonsTextColor:Y,buttonsFontName:U,buttonsFontStyle:K,buttonsFontSize:G,secondLink:Q,secondLinkBorderWidth:J,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:ne,secondLinkFontStyle:ie,secondLinkFontSize:se,animation:re,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=i?{}:n,le=document.createElement("style");le.type="text/css",e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(S,$),this.loadFont(U,K),this.loadFont(ne,ie);const he=`background: ${["string"==typeof r?r:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,ue="number"==typeof m&&m>0,de=`border: ${[ue?`${m}px`:"unset",ue?"solid":"",ue&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,me=void 0!==d?`border-radius: ${d}px;`:"",ge=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",pe=void 0!==p?`text-align: ${p};`:"",fe=f&&"inherit"!==f?`font-family:${f}_${v.match(k)?v.match(k)[1]:""};`:v||"",ve=y?`font-size: ${y}px;`:"",ye=void 0!==x&&x?`box-shadow: 0 5px ${P}px 0 ${A};`:"",be=L instanceof Array&&1===L.length&&L[0],we=be?`margin: ${be.top}px ${be.right}px ${be.bottom}px ${be.left}px;`:"",Ce=be?`margin: calc(${be.top}px * 0.5) calc(${be.right}px * 0.5) calc(${be.bottom}px * 0.5) calc(${be.left}px * 0.5);`:"",Se=I instanceof Array&&1===I.length&&I[0],$e=Se?`padding: ${Se.top}px ${Se.right}px ${Se.bottom}px ${Se.left}px;`:"",Ee=Se?`padding: calc(${Se.top}px * 0.5) calc(${Se.right}px * 0.5) calc(${Se.bottom}px * 0.5) calc(${Se.left}px * 0.5);`:"",Te=void 0!==q&&q?`border-width: ${q}px; border-style: solid;`:"",Ne=[M,q].every(e=>void 0!==e)&&q?`border-color: ${M};`:"",ke=void 0!==H?`border-radius: ${H}px;`:"",xe=void 0!==z?`background-color: ${z};`:"",Ae=void 0!==Y?`color: ${Y}; fill: ${Y}; -webkit-text-fill-color: ${Y};`:"",Pe=U&&"inherit"!==U?`font-family:${U}_${K.match(k)?K.match(k)[1]:""};`:K||"",Le=G?`font-size: ${G}px;`:"",Ie=void 0!==J&&J?`border-width: ${J}px; border-style: solid;`:"",Oe=[X,J].every(e=>void 0!==e)&&J?`border-color: ${X};`:"",Re=void 0!==Z?`border-radius: ${Z}px;`:"",Be=void 0!==ee?`background-color: ${ee};`:"",_e=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",De=ne&&"inherit"!==ne?`font-family:${ne}_${ie.match(k)?ie.match(k)[1]:""};`:ie||"",je=se?`font-size: ${se}px;`:"",We="popin"!==s||void 0!==T&&!0!==T?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==N?N:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Fe="number"==typeof B?B:16,Ve=Fe/2,qe=i||void 0!==O&&O?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===R?`bottom: calc(100% + ${Ve}px)`:`top: ${Ve}px`)+";",`right: ${Ve}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof _?`border-radius: ${_}px;`:"","number"==typeof D&&D>0?`border: ${D}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: ${Fe}px;`,`height: ${Fe}px;`,"string"==typeof W?`fill: ${W};`:"","}"].join(""):"",Me=b&&"string"==typeof C?[`#${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: ${C}; fill: ${C}; -webkit-text-fill-color: ${C};`,void 0!==w?`text-align: ${w};`:"",S&&"inherit"!==S?`font-family:${S}_${$.match(k)?$.match(k)[1]:""};`:$||"",E?`font-size: ${E}px;`:"","}"].join(""):"";let He="";if("string"==typeof re){const t=(oe/1e3).toFixed(2),n=["top","bottom"].includes(ce),i=Number(n),s=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[i]:"0"];n&&s.reverse(),He={none:[],fade:[`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${ae};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${ae};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${s.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":re].join("")}const ze=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===V?"top":"left"}: 8px;`,Ie,Oe,Re,Be,_e,De,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,_e,De,je,"}"];return le.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,me,de,ge,pe,ye,we,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,ge,pe,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",$e,fe,ve,"}",`#${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;",Te,Ne,ke,xe,Ae,Pe,Le,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Ae,Pe,Le,"}",...Q?ze:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Ce,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Ee,"}","}",We,qe,Me,He,`${t}`].join(""),le}}const P=["top: 0;","top: 50%;","bottom: 0;"],L=["left: 0;","left: 50%;","right: 0;"],I=e=>1===e?"-50%":0,O=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,n=`translate(${I(t)}, ${I(e)});`;return`${P[e]}${L[t]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},R=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,B=()=>{if(R())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:n,autoHeight:i,popinPercentHeight:s,popinPixelsHeight:r,heightUnit:o}=DATA;return`width: ${"px"===n?t:e}${n};height: ${i?"auto":`${"px"===o?r:s}${o}`};`};class _ extends A{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>I(e)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,overlay:n,widthUnit:i}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"background: none;","pointer-events: "+(!1===n?"none":"all"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",O(),B(),"pointer-events: all","}",`${R()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!R()&&["px","em"].includes(i)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class D extends A{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===e?t:e};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class j extends A{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const W=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new _;break;case"bannerTop":case"bannerBottom":t=new D;break;case"free":t=new j;break;default:t=new A}return t};function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){M(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(e,t,n){return(t=H(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){var t=function(e){if("object"!==F(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===F(t)?t:String(t)}var z=DATA,Y=z.isFeedBackQuestion,U=z.isThankYouMessage,K=z.autoHide,G=z.timeHide,Q=z.stepToShow,J=z.question,X=z.feedbackQuestion,Z=z.buttonText,ee=z.thankYouMessage,te=z.isLegend,ne=z.minLegend,ie=z.maxLegend,se=z.noStyles,re={capture:!0,passive:!1},oe=function(){function t(e){var n=e.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.parentContainer=n,this.baseClassName="nps_container",this.className="".concat(this.baseClassName,"_").concat(n.uniqueId),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(n.uniqueId,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}var n,i;return n=t,i=[{key:"sendNote",value:function(){if(!e()&&!isNaN(this.currentNote))try{window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback})}catch(e){f("Not able to send NPS hit due to old tag version (< 3.0)")}return this}},{key:"insertIn",value:function(e,t){return document.head.insertAdjacentElement("beforeend",this.styleElement),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),K?(setTimeout(function(){e.parentContainer.hide(),setTimeout(function(){e.parentContainer.recurrence.setValidationRecurrence(),e.parentContainer.remove(),e.showNotes(),e.currentNote=NaN,e.userFeedback="",e.feedbackElements.feedbackFormElement.querySelector("textarea").value=""},1e3)},1e3*G),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),Y&&X&&X.length?this.showFeedBack():U&&ee&&ee.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){U&&ee&&ee.length?this.showThankYouMessage():this.complete()}},{key:"showNotes",value:function(){var e=this;return this.npsContainer.childNodes.forEach(function(t){return t.classList.add(e.hideClassName)}),[this.questionElement,this.notesContainer].forEach(function(t){return t.classList.remove(e.hideClassName)}),this}},{key:"showFeedBack",value:function(){var e=this;return this.npsContainer.childNodes.forEach(function(t){return t.classList.add(e.hideClassName)}),Object.values(this.feedbackElements).forEach(function(t){return t.classList.remove(e.hideClassName)}),this}},{key:"showThankYouMessage",value:function(){var e=this;return this.npsContainer.childNodes.forEach(function(t){return t.classList.add(e.hideClassName)}),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=ee,e()&&"displayThanksStep"===Q&&t.classList.remove(this.hideClassName),t}},{key:"getFeedBackElements",value:function(){var t=this,n=document.createElement("p");n.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),n.innerHTML=X;var i=document.createElement("form");i.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),i.addEventListener("submit",c,q({},re));var s=document.createElement("textarea");s.className="".concat(this.feedbackQuestionClassName,"_textarea");var r=document.createElement("button");return r.className="".concat(this.feedbackQuestionClassName,"_button"),r.innerHTML="<span>".concat(Z,"</span>"),r.addEventListener("click",function(e){return c(e),t.userFeedback=s.value,t.onFeedbackSend()},q({},re)),e()&&"displayFeedbackStep"===Q&&[n,i].forEach(function(e){return e.classList.remove(t.hideClassName)}),i.appendChild(s),i.appendChild(r),{feedbackQuestionElement:n,feedbackFormElement:i}}},{key:"getNotesElement",value:function(){var t=this,n=document.createElement("div");n.className=this.notesClassName,e()&&"displayNoteStep"!==Q&&n.classList.add(this.hideClassName);for(var i=10;i>=0;){var s=document.createElement("button");s.className=this.notesButtonsClassName,s.dataset.note=i,e()&&s.setAttribute("data-abtasty-actionnable",""),s.innerHTML+="<span>".concat(i,"</span>"),s.addEventListener("click",function(e){c(e),t.onClickNote(e)},q({},re)),n.insertAdjacentElement("afterbegin",s),5===i&&s.insertAdjacentHTML("afterend","<br>"),i-=1}return te&&(n.insertAdjacentHTML("afterbegin","<legend>".concat(ne,"</legend>")),n.insertAdjacentHTML("beforeend","<legend>".concat(ie,"</legend>"))),n}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=J,e()&&"displayNoteStep"!==Q&&t.classList.add(this.hideClassName),t}},{key:"getContainer",value:function(){var e=document.createElement("div");return e.className="".concat(this.baseClassName," ").concat(this.className),e}},{key:"getNPSElement",value:function(){var e=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),Y&&Object.values(this.feedbackElements).forEach(function(t){e.npsContainer.appendChild(t)}),U&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"getStyleElement",value:function(){var t=document.createElement("style");if(t.type="text/css",e()&&t.setAttribute("abtasty-script-added","true"),se)t.textContent=["#".concat(this.parentContainer.widgetContainerId," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var n=DATA,i=n.containerPadding,s=n.legendTextColor,r=n.legendFontName,o=n.legendFontStyle,a=n.legendFontSize,c=n.buttonsFontSize;this.parentContainer.loadFont(r,o);var l=/.+\/([^.]+)\.(otf|ttf)$/,h=r&&"inherit"!==r?"font-family:".concat(r,"_").concat(o.match(l)?o.match(l)[1]:"",";"):o||"",u=i instanceof Array&&1===i.length&&i[0],d="#".concat(this.parentContainer.widgetContainerId," .").concat(this.className);t.textContent=["".concat(d," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(d,","),"".concat(d," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: normal;","font-family: sans-serif;","}","".concat(d," > * {"),"display: block;","width: 100%;","}","".concat(d," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(d," p {"),"margin-bottom: 15px;","font-size: 1.4em;","white-space: pre-line;","}","".concat(d," button {"),"vertical-align: middle;","cursor: pointer;","text-align: center;","}","".concat(d," button span {"),"font-size: 1em;","pointer-events: none;","}","".concat(d," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: ".concat(1.75*c,"px;"),"height: ".concat(1.75*c,"px;"),"}","".concat(d," .").concat(this.notesClassName," button * {"),"display: inline-block !important;","pointer-events: none;","}","".concat(d," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",te?["".concat(d," legend {"),"position: absolute;","text-decoration: none;","border: none;","color: ".concat(s,";"),"fill: ".concat(s,";"),"-webkit-text-fill-color: ".concat(s,";"),"font-size: ".concat(a,"px;"),h,"}","".concat(d," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(d," textarea {"),"display: block;","width: 100%;","min-width: 310px;","min-height: 60px;","font-size: 1.4em;","border: 1px solid grey;","border-radius: 4px;","resize: vertical;","margin-bottom: 10px;","text-align: left;","padding: 5px;","}","".concat(d," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 580px) {","".concat(d," {"),"min-width: 560px;","}",te?["".concat(d," .").concat(this.notesClassName," {"),"padding-top: ".concat(1.5*a,"px"),"}","".concat(d," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(d," br {"),"display: none","}","}","@media screen and (max-width: 579px) {","".concat(d," {"),"min-width: ".concat(240+(u.left+u.right/2),"px;"),"}","".concat(d," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(d," br {"),"display: block","}",te?["".concat(d," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(d," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(d," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(d," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(d," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(d," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(d," textarea {"),"min-width: auto;","}","}"].join("")}return t}}],i&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,H(i.key),i)}}(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),t}();function ae(e){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(e)}function ce(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ce=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},r=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",a=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,s){var r=t&&t.prototype instanceof d?t:d,o=Object.create(r.prototype),a=new T(s||[]);return i(o,"_invoke",{value:C(e,n,a)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function d(){}function m(){}function g(){}var p={};c(p,r,function(){return this});var f=Object.getPrototypeOf,v=f&&f(f(N([])));v&&v!==t&&n.call(v,r)&&(p=v);var y=g.prototype=d.prototype=Object.create(p);function b(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function w(e,t){function s(i,r,o,a){var c=h(e[i],e,r);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==ae(u)&&n.call(u,"__await")?t.resolve(u.__await).then(function(e){s("next",e,o,a)},function(e){s("throw",e,o,a)}):t.resolve(u).then(function(e){l.value=e,o(l)},function(e){return s("throw",e,o,a)})}a(c.arg)}var r;i(this,"_invoke",{value:function(e,n){function i(){return new t(function(t,i){s(e,n,t,i)})}return r=r?r.then(i,i):i()}})}function C(e,t,n){var i="suspendedStart";return function(s,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===s)throw r;return{value:void 0,done:!0}}for(n.method=s,n.arg=r;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var c=h(e,t,n);if("normal"===c.type){if(i=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i="completed",n.method="throw",n.arg=c.arg)}}}function S(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var s=h(i,e.iterator,t.arg);if("throw"===s.type)return t.method="throw",t.arg=s.arg,t.delegate=null,u;var r=s.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function $(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach($,this),this.reset(!0)}function N(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:k}}function k(){return{value:void 0,done:!0}}return m.prototype=g,i(y,"constructor",{value:g,configurable:!0}),i(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(w.prototype),c(w.prototype,o,function(){return this}),e.AsyncIterator=w,e.async=function(t,n,i,s,r){void 0===r&&(r=Promise);var o=new w(l(t,n,i,s),r);return e.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},b(y),c(y,a,"Generator"),c(y,r,function(){return this}),c(y,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return o.type="throw",o.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,u):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var s=i.arg;E(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function le(e,t,n,i,s,r,o){try{var a=e[r](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,s)}function he(){var e;return e=ce().mark(function e(){var t,n,i;return ce().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=W(),n=t.domElement.querySelector(".".concat(t.contentClassName)),i=new oe({parentContainer:t}),t.children=i,i.insertIn(n,"beforeend"),t.init().then(function(e){return e.response&&t.show()}),e.abrupt("return",{parentContainer:t,NPS:i});case 8:case"end":return e.stop()}},e)}),he=function(){var t=this,n=arguments;return new Promise(function(i,s){var r=e.apply(t,n);function o(e){le(r,i,s,o,a,"next",e)}function a(e){le(r,i,s,o,a,"throw",e)}o(void 0)})},he.apply(this,arguments)}!function(){he.apply(this,arguments)}()}();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abtasty/nps",
3
3
  "description": "Allow you to add a custom NPS on your website",
4
- "version": "1.5.8",
4
+ "version": "1.5.9",
5
5
  "form": "dist/form.js",
6
6
  "main": "dist/main.js",
7
7
  "type": "module",