@abtasty/nps 1.5.23 → 1.5.25-0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";const 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="remove",a="rebuild",c="update",l=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},h=()=>{const e=l();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=n=>{const i=(()=>{if(e()||t())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),s=document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(i||s){const e=h();window.console.log(`%c${e} - ${i?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${n}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},g=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},m=(e,t)=>{const n=()=>{try{return document.querySelector(e)}catch(e){return null}};let i=n();const s=[document.querySelector("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 p(e,t){return t(e)||!e.parentElement?e:p(e.parentElement,t)}const f=t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())},v=(e,t)=>[...document.querySelectorAll(t)].some(n=>n===e||!!e.closest(t)),y=(e,t)=>{let n=Date.now();return()=>{n+t-Date.now()<=0&&(e(),n=Date.now())}};class b{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=null,this.mouseOverEvent=this.mouseOverHandler(),this.scrollEvent=this.scrollEventHandler(),this.onTransitionEnd=this.transitionOverHandler()}transitionOverHandler(){const e=["transitionend",this.checkElements.bind(this),!0];return this.getEvents(e)}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){this.mutationObserver??=new MutationObserver(this.checkElements.bind(this));const{clear:e}=m("body",t=>{e(),this.mutationObserver.observe(t,{attributes:!0,childList:!0,subtree:!0})});return this.mutationObserver}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)}}getEvents(e){return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}mouseOverHandler(){const e=["ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",e=>{const t=e.composedPath(),{target:n}=e;setTimeout(()=>this.onMouseOver({target:n,path:t}),50)},!0];return this.getEvents(e)}scrollEventHandler(){const e=["scroll",y(this.checkElements.bind(this),50),{passive:!0}];return this.getEvents(e)}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===p(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}),this.startMutationObserver(),this.checkElements()}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(),this.scrollEvent.clear(),this.onTransitionEnd.clear())}}class w{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n,triggerTarget:i}){this.event=e,this.selector=t&&t.length?t:"body",this.target=i,this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={}}async onElementVisible({promise:e,resolve:t}){const n=g(`${this.event}DomReady`);this.promises.push(n);const i=await this.onPageLoad(n),s=new b;if(this.visibilityObservers.push(s),i){const e=u();s.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",()=>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_${u()}`,n.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(n),this.elementsSelectors.push(`#${n.id}`);const i=["click",({isTrusted:e,target:n})=>{const i=n.isEqualNode(this.target)||v(n,this.selector);return e&&i&&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})=>{const i=this.target?n.isEqualNode(this.target):v(n,this.selector);return e&&i&&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}],{clear:i}=m("html",e=>{i(),this.eventsListeners.push([e,...n]),e.addEventListener(...n)});return 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(()=>d("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,g={pv:u,i:h,"v-pv":l}[s];return[typeof c,typeof g].includes("undefined")&&t(!1),r&&!o&&(d("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===s&&"sku"===a?"v-i":s,e=>{const t=void 0!==e[c]&&e[c]>=g;return t||d(`Widget will not be shown, Social Proof API returned ${e[c]} while ${g} 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.visibilityObservers.length){const e=u();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}async isTriggered(){this.clear();const e=g(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=g(`${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 C="display",S="closing",E="validation",$="ABTastyWidgets",T=`${$}Temporary`;class N{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=l(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(T),n=sessionStorage.getItem($);"ABTastyData"===e&&!t&&n&&localStorage.setItem(T,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(T),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem($,e),localStorage.removeItem(T));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 w({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!==E)if(n===S&&l!==E)h();else{if(n!==C||l===E||l===S)return!1;h()}else h();return a}setDisplayRecurrence(){const e=C;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=S;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=E;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 k{constructor(e,t,n){this.isWidgetApplied=e,this.callback=t,this.shouldUpdate=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(){const e=this.isWidgetApplied()?this.shouldUpdate&&c:a;return e?(this.clearWatcher(),this.callback(e,!0),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:e}}){e===TEST_ID&&(this.callback(a,!1),this.watch())}onTagRollback(){return this.clearWatcher(),this.callback(o,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(e){return s()?e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler():this:this.callback(o,!1)}watch(){if(e())return this;this.clearWatcher(),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams);const{clear:t}=m("body",e=>{t(),this.observer.observe(e,{childList:!0,subtree:!0})});return this}clearWatcher(){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this}}const x=/.+\/([^.]+)\.(otf|ttf)$/,A=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class P{constructor(t,n){this.children=void 0,this.uniqueId=`${u()}${n?`_${n}`:""}`,this.widgetName=l(),this.prettyName=h(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:n,validationRecurrence:i}=DATA,s=!t&&!n&&!i;if(e()||s)return!1;const r={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},o={};return t&&(o.displayRecurrence=r[t]("displayRecurrence")),n&&(o.closingRecurrence=r[n]("closingRecurrence")),i&&(o.validationRecurrence=r[i]("validationRecurrence")),o})(),this.triggerParams=(t=>{let{triggerEvent:n}=DATA;const{triggerEventClick:i,triggerEventHover:s,triggerEventReengageDelay:r,socialProofContentType:o,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(e()||!n&&!o)return!1;const l={click:()=>i,hover:()=>s,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?r:c;return o&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][o]),{triggerEvent:n,triggerSelector:h,triggerDelay:u,triggerTarget:t}})(t),this.recurrence=!!this.recurrenceParams&&new N(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new w(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&A.includes(this.triggerParams.triggerEvent),this.pageWatcher=new k(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.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[],this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[],this.intervals.forEach(e=>clearInterval(e)),this.intervals=[],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;document.head.appendChild(this.styleElement);const e=["free"];return"drawer"===DATA.layout&&DATA.customTarget&&e.push("drawer"),new Promise(t=>{const{elementReferrer:n="body",referrerInsertType:i="beforeend"}=e.includes(DATA.layout)?DATA:{},s=m(n,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==n),this.removeOldDomElement(),t(e.insertAdjacentElement(i,this.domElement))});this.elementsWaiters.push(s)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),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.pageWatcher.clearWatcher(),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){const n=()=>this.init().then(({response:e})=>{e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const i=this.isWidgetApplied(),s={[o]:()=>i?this.remove():this.pageWatcher.watch(),[a]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():i||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):n()},[c]:n};"function"==typeof s[e]&&s[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 c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",e=>{f(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...c),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...l),t.addEventListener(...l)}),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,["popin","banner"].includes(t)&&(i.role="dialog"),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}" aria-label="Close dialog"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,i}loadFont(e,t){if(!e||"inherit"===e||!/otf|ttf/g.test(t))return;const n=document.createElement("style"),i=t.match(x)?t.match(x)[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:g,textColor:m,textAlign:p,fontName:f,fontStyle:v,fontSize:y,isTitle:b,titleTextAlign:w,titleTextColor:C,titleFontName:S,titleFontStyle:E,titleFontSize:$,overlay:T,overlayColor:N,dropShadow:k,dropShadowColor:A,dropShadowBlur:P,containerMargin:L,containerPadding:I,closeButton:O,closeButtonPosition:R,closeButtonSize:D,closeButtonBorderRadius:B,closeButtonBorderWidth:_,closeButtonBorderColor:j,closeButtonColor:F,closeButtonBackgroundColor:V,buttonsAlign:q,buttonsBorderWidth:W,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,E),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 g&&g>0,de=`border: ${[ue?`${g}px`:"unset",ue?"solid":"",ue&&"string"==typeof u&&u.length?u:""].join(" ").trim()};`,ge=void 0!==d?`border-radius: ${d}px;`:"",me=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",pe=void 0!==p?`text-align: ${p};`:"",fe=f&&"inherit"!==f?`font-family:${f}_${v.match(x)?v.match(x)[1]:""};`:v||"",ve=y?`font-size: ${y}px;`:"",ye=void 0!==k&&k?`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],Ee=Se?`padding: ${Se.top}px ${Se.right}px ${Se.bottom}px ${Se.left}px;`:"",$e=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!==W&&W?`border-width: ${W}px; border-style: solid;`:"",Ne=[M,W].every(e=>void 0!==e)&&W?`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(x)?K.match(x)[1]:""};`:K||"",Le=G?`font-size: ${G}px;`:"",Ie="number"==typeof 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;`:"",De=void 0!==ee?`background-color: ${ee};`:"",Be=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",_e=ne&&"inherit"!==ne?`font-family:${ne}_${ie.match(x)?ie.match(x)[1]:""};`:ie||"",je=se?`font-size: ${se}px;`:"",Fe="popin"!==s||void 0!==T&&!0!==T?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==N?N:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Ve="number"==typeof D?D:16,qe=Ve/2,We=i||void 0!==O&&O?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===R?`bottom: calc(100% + ${qe}px)`:`top: ${qe}px`)+";",`right: ${qe}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof B?`border-radius: ${B}px;`:"","number"==typeof _&&_>0?`border: ${_}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Ve}px;`,`height: ${Ve}px;`,"string"==typeof F?`fill: ${F};`:"","}"].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}_${E.match(x)?E.match(x)[1]:""};`:E||"",$?`font-size: ${$}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:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${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"===q?"top":"left"}: 8px;`,Ie,Oe,Re,De,Be,_e,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Be,_e,je,"}"];return le.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,ge,de,me,pe,ye,we,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,me,pe,fe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",Ee,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} > * {`,$e,"}","}",Fe,We,Me,He,`${t}`].join(""),le}}const L=["top: 0;","top: 50%;","bottom: 0;"],I=["left: 0;","left: 50%;","right: 0;"],O=e=>1===e?"-50%":0,R=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,n=`translate(${O(t)}, ${O(e)});`;return`${L[e]}${I[t]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},D=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,B=()=>{if(D())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 P{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>O(e)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,widthUnit:n}=DATA,i="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"background: none;","pointer-events: "+(i?"all":"none"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",R(),B(),"pointer-events: all","}",`${D()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!D()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class j extends P{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex: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 F extends P{constructor(e,t){super(e,t),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 V=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new _;break;case"bannerTop":case"bannerBottom":t=new j;break;case"free":t=new F;break;default:t=new P}return t};function q(e){return q="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},q(e)}function W(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 M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function H(e,t,n){return(t=z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e){var t=function(e){if("object"!=q(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==q(t)?t:t+""}var Y=DATA,U=Y.isFeedBackQuestion,K=Y.isThankYouMessage,G=Y.autoHide,Q=Y.timeHide,J=Y.stepToShow,X=Y.question,Z=Y.feedbackQuestion,ee=Y.buttonText,te=Y.thankYouMessage,ne=Y.isLegend,ie=Y.minLegend,se=Y.maxLegend,re=Y.noStyles,oe={capture:!0,passive:!1},ae=function(){return t=function e(t){var n=t.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),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()},n=[{key:"sendNote",value:function(){return e()||isNaN(this.currentNote)||(d("Sending datas, note: ".concat(this.currentNote,', feedback: "').concat(this.userFeedback,'"')),window.abtasty.send("nps",{caid:TEST_ID,vaid:VARIATION_ID,ns:this.currentNote,nf:this.userFeedback})),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(),this.parentContainer.recurrence.setValidationRecurrence(),G?(setTimeout(function(){e.parentContainer.hide(),setTimeout(function(){return e.parentContainer.remove()},1e3)},1e3*Q),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),U&&Z&&Z.length?this.showFeedBack():K&&te&&te.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){K&&te&&te.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=te,e()&&"displayThanksStep"===J&&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=Z;var i=document.createElement("form");i.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),i.addEventListener("submit",f,M({},oe));var s=document.createElement("textarea");s.className="".concat(this.feedbackQuestionClassName,"_textarea"),s.ariaLabel=Z;var r=document.createElement("button");return r.className="".concat(this.feedbackQuestionClassName,"_button"),r.innerHTML="<span>".concat(ee,"</span>"),r.ariaLabel=ee,r.addEventListener("click",function(e){return f(e),t.userFeedback=s.value,t.onFeedbackSend()},M(M({},oe),{},{once:!0})),e()&&"displayFeedbackStep"===J&&[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"!==J&&n.classList.add(this.hideClassName);for(var i=10;i>=0;){var s=document.createElement("button");s.className=this.notesButtonsClassName,s.dataset.note=i,s.ariaLabel="".concat(X," - ").concat(i,"/10"),e()&&s.setAttribute("data-abtasty-actionnable",""),s.innerHTML+="<span>".concat(i,"</span>"),s.addEventListener("click",function(e){f(e),t.onClickNote(e)},M({},oe)),n.insertAdjacentElement("afterbegin",s),5===i&&s.insertAdjacentHTML("afterend","<br>"),i-=1}return ne&&(n.insertAdjacentHTML("afterbegin","<legend>".concat(ie,"</legend>")),n.insertAdjacentHTML("beforeend","<legend>".concat(se,"</legend>"))),n}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=X,e()&&"displayNoteStep"!==J&&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),U&&Object.values(this.feedbackElements).forEach(function(t){e.npsContainer.appendChild(t)}),K&&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"),re)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;","}",ne?["".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;","}",ne?["".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","}",ne?["".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}}],n&&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,z(i.key),i)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function ce(e){return ce="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},ce(e)}function le(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */le=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var r=t&&t.prototype instanceof f?t:f,o=Object.create(r.prototype),a=new A(i||[]);return s(o,"_invoke",{value:T(e,n,a)}),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",g="executing",m="completed",p={};function f(){}function v(){}function y(){}var b={};l(b,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(P([])));C&&C!==n&&i.call(C,o)&&(b=C);var S=y.prototype=f.prototype=Object.create(b);function E(e){["next","throw","return"].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function $(e,t){function n(s,r,o,a){var c=u(e[s],e,r);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==ce(h)&&i.call(h,"__await")?t.resolve(h.__await).then(function(e){n("next",e,o,a)},function(e){n("throw",e,o,a)}):t.resolve(h).then(function(e){l.value=e,o(l)},function(e){return n("throw",e,o,a)})}a(c.arg)}var r;s(this,"_invoke",{value:function(e,i){function s(){return new t(function(t,s){n(e,i,t,s)})}return r=r?r.then(s,s):s()}})}function T(t,n,i){var s=d;return function(r,o){if(s===g)throw Error("Generator is already running");if(s===m){if("throw"===r)throw o;return{value:e,done:!0}}for(i.method=r,i.arg=o;;){var a=i.delegate;if(a){var c=N(a,i);if(c){if(c===p)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(s===d)throw s=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);s=g;var l=u(t,n,i);if("normal"===l.type){if(s=i.done?m:"suspendedYield",l.arg===p)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(s=m,i.method="throw",i.arg=l.arg)}}}function N(t,n){var i=n.method,s=t.iterator[i];if(s===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;var r=u(s,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,p;var o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var s=-1,r=function n(){for(;++s<t.length;)if(i.call(t,s))return n.value=t[s],n.done=!1,n;return n.value=e,n.done=!0,n};return r.next=r}}throw new TypeError(ce(t)+" is not iterable")}return v.prototype=y,s(S,"constructor",{value:y,configurable:!0}),s(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},E($.prototype),l($.prototype,a,function(){return this}),t.AsyncIterator=$,t.async=function(e,n,i,s,r){void 0===r&&(r=Promise);var o=new $(h(e,n,i,s),r);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},E(S),l(S,c,"Generator"),l(S,o,function(){return this}),l(S,"toString",function(){return"[object Generator]"}),t.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}},t.values=P,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(x),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function s(i,s){return a.type="throw",a.arg=t,n.next=i,s&&(n.method="next",n.arg=e),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return s("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return s(o.catchLoc,!0);if(this.prev<o.finallyLoc)return s(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return s(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return s(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n];if(s.tryLoc<=this.prev&&i.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,p):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),p},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),x(n),p}},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;x(n)}return s}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),p}},t}function he(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 ue(){var e;return e=le().mark(function e(){var t,n,i;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return d("Widget launch"),t=V(),n=t.domElement.querySelector(".".concat(t.contentClassName)),i=new ae({parentContainer:t}),t.children=i,i.insertIn(n,"beforeend"),t.init(!0).then(function(e){return e.response&&t.show()}),e.abrupt("return",{parentContainer:t,NPS:i});case 9:case"end":return e.stop()}},e)}),ue=function(){var t=this,n=arguments;return new Promise(function(i,s){var r=e.apply(t,n);function o(e){he(r,i,s,o,a,"next",e)}function a(e){he(r,i,s,o,a,"throw",e)}o(void 0)})},ue.apply(this,arguments)}!function(){ue.apply(this,arguments)}()}();
1
+ !function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"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}`),r=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),s=()=>window.ABTasty&&!0===window.ABTasty.consentReady,o=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},a=()=>{const e=o();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},c=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,l=n=>{const i=(()=>{if(e()||t())return!1;const n=ABTasty.getTestsOnPage()[TEST_ID];return!!n&&Object.keys(n.targetings.qaParameters).length>0})(),r=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(i||r){const e=a();window.console.log(`%c${e} - ${i?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${n}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},h=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},u=(e,t)=>{const n=t?[]:null;if("string"!=typeof e||!e.trim().length)return n;const[i,r,s]=e.split("[]").map(e=>e.trim()),o=Boolean(s)?s:e,a=r?document.querySelector(i)?.[r]:document;return a?t?[...a.querySelectorAll(o)]:a.querySelector(o):n},d=e=>u(e,!1),m=e=>u(e,!0),g=(e,t)=>{const n=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>s.disconnect(),s=new MutationObserver(()=>{const n=d(t);return n&&!r()&&e(n)});return{clear:r,observe:(e=n)=>s.observe(e,i)}},p=()=>{},f=(t,n)=>{const i=d(t),r={selector:t,clear:p,observe:p};if(i)return setTimeout(()=>n(i),0),r;if(e())return setTimeout(()=>f(t,n),1e3),r;if(t.includes("[]"))return((e,t)=>{const[n,i]=t.split("[]").map(e=>e.trim()),r=d(n),s=r?.[i],{clear:o,observe:a}=g(e,t),c=()=>{const n=d(t);return n&&!l()&&e(n)},l=()=>{o(),r?.removeEventListener("load",c)},h=()=>{a(s),"iframe"===r?.localName&&r.addEventListener("load",c)};return h(),{selector:t,clear:l,observe:h}})(n,t);const{clear:s,observe:o}=g(n,t);return o(),{selector:t,clear:s,observe:o}};function v(e,t){const n=e.parentElement||e.getRootNode().host;return t(e)||!n?e:v(n,t)}const y=t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())},b=(e,t)=>[...m(t)].some(n=>{const[i,,r]=t.split("[]"),s=r??i;return n===e||!!e.closest(s)});let w=!1;class C{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=null,this.mutationObserver=null,this.mouseOverEvent=null,this.scrollEvent=null,this.onTransitionEnd=null,this.onIframeLoad=null}transitionOverHandler(e){const t=[e,"transitionend",this.checkElements.bind(this),!0];return this.getEvents(...t)}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(e){const t={root:e,rootMargin:"0px",threshold:0};return this.visibilityObserver??=new IntersectionObserver(this.intersectionHandler.bind(this),t),this.visibilityObserver}startMutationObserver(e){return this.mutationObserver??=new MutationObserver(this.checkElements.bind(this)),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}),this.mutationObserver}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const[r,,s]=i.split("[]"),o=s??r,a=[...e.querySelectorAll(o)];if(a.length&&a.includes(n))return!0;if(t.includes(n))return!0;if(!e.parentElement?.children?.length)return;const c=[...e.parentElement.children],l=c.findIndex(t=>t.isSameNode(e)),h=c.filter((e,t)=>t>l);if(h.length){if(h.includes(n))return!0;if(h.some(e=>[...e.querySelectorAll(o)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,r=this.targets.find(t=>t.selector===e&&t.uniqueId===i);r&&r.resolve(t),this.clear(e,i)}}getEvents(e,...t){return{start:()=>e?.addEventListener(...t),clear:()=>e?.removeEventListener(...t)}}mouseOverHandler(e){const t=[e,"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",e=>{const t=e.composedPath(),{target:n}=e;setTimeout(()=>this.onMouseOver({target:n,path:t}),50)},!0];return this.getEvents(...t)}scrollEventHandler(e){const t=[e,"scroll",(n=this.checkElements.bind(this),()=>{w||(w=!0,setTimeout(()=>{n(),w=!1},100))}),{passive:!0}];var n;return this.getEvents(...t)}isElementVisible(e){return this.isElementOpaque(e)&&this.isElementTopmost(e)}isElementOpaque(e){return"HTML"===v(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,r=0;for(;!i&&r<n.length;){const t=e.getRootNode()?.elementFromPoint(...n[r]);i=e===t||t?.contains(e)||e.contains(t),r+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=d(e),[i,,r]=e.split("[]"),s=r??i;n&&!this.existingTargets.find(e=>e.element.matches(s)&&e.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!d(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{const[i,,r]=e.split("[]"),s=r??i;if(t.matches(s)&&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})}onLoadIframe(e){const t=[e.defaultView.frameElement,"load",()=>this.watch(selector,resolve,uniqueId).bind(this),{passive:!0}];return this.getEvents(...t)}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n});const{clear:i}=f(e,e=>{i();const t=e.getRootNode(),n="body"in t?t.body:document;this.mouseOverEvent=this.mouseOverHandler(t),this.scrollEvent=this.scrollEventHandler(t),this.onTransitionEnd=this.transitionOverHandler(t),t.defaultView?.frameElement&&(this.onIframeLoad=this.onLoadIframe(t),this.onIframeLoad.start()),this.startVisibilityObserver(n),this.startMutationObserver(n),this.checkElements()})}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=d(e);n&&this.visibilityObserver?.unobserve(n),0===this.targets.length&&(this.mutationObserver?.disconnect(),this.onIframeLoad?.clear()),0===this.inViewportTargets.length&&(this.mouseOverEvent?.clear(),this.scrollEvent?.clear(),this.onTransitionEnd?.clear())}}const E="remove",$="rebuild",T="update",S="ABTastyData";class N{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n,triggerTarget:i}){this.event=e,this.selector=Boolean(t)?t:"body",this.target="string"==typeof i?d(t):i,this.delay=1e3*n,this.triggerElements=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={},this.elementWaiters=[]}async onElementVisible({promise:e,resolve:t}){const n=h(`${this.event}DomReady`);this.promises.push(n);const{clear:i}=f(this.selector,()=>{const e=new C;this.visibilityObservers.push(e),e.watch(this.selector,t,c())});return this.elementWaiters.push(i),e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",()=>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=({isTrusted:e,target:n})=>{if(e)return(n.isEqualNode(this.target)||b(n,this.selector))&&t(!0)},{clear:i}=f(this.selector,e=>{i();const t=document.createElement("style");t.id=`Click_${c()}`;const[r,,s]=this.selector.split("[]"),o=s??r;t.innerHTML=`${o} {\n\t\t\t\tcursor: pointer !important;\n\t\t\t\tpointer-events: all !important;\n\t\t\t}`;const a=e.getRootNode();("head"in a?a.head:a).appendChild(t),this.triggerElements.push(t);const l=["click",n,{passive:!0,capture:!0}];this.eventsListeners.push([a,...l]),a.addEventListener(...l)});return this.elementWaiters.push(i),e}onHover({promise:e,resolve:t}){const n=({isTrusted:e,target:n})=>{if(e)return(this.target?n.isEqualNode(this.target):b(n,this.selector))&&t(!0)},{clear:i}=f(this.selector,e=>{const t=e.getRootNode(),i="body"in t?t.body:[...t.childNodes].find(t=>t.contains(e)),r=["mouseenter",n,{passive:!0,capture:!0}];this.eventsListeners.push([i,...r]),i.addEventListener(...r)});return this.elementWaiters.push(i),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",({isTrusted:e,clientY:n})=>{e&&n<=0&&t(!0)},{passive:!0}],{clear:i}=f("html",e=>{i(),this.eventsListeners.push([e,...n]),e.addEventListener(...n)});return e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const r=[...document.querySelectorAll("*:empty")].map(e=>e.contentDocument||e.shadowRoot).filter(e=>e),s=[({isTrusted:e})=>{e&&(i=n)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{[document,...r].forEach(t=>{this.eventsListeners.push([t,e,...s]),t.addEventListener(e,...s)})});const o=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(o),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.scrollY<n?t(!0):n=window.scrollY)},{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 r=(()=>{let e;return top.ABTasty||top.ABTASTY_S?(top.ABTASTY_S?.USER?.accountIdentifier?.length?e=top.ABTASTY_S.USER.accountIdentifier:"function"==typeof top.ABTasty?.getAccountSettings?e=top.ABTasty.getAccountSettings().identifier:top.ABTasty?.accountSettings&&(e=top.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:s,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))n(this.socialProofStore[e])?i(`${this.socialProofStore[e][s]}`):i(!1);else if(e&&r){const a=t=>(this.socialProofStore[e]=t,i(!!n(t)&&`${t[s]}`));fetch(`https://api-social-proof.abtasty.com/clients/${r}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>l("Failed to fetch datas from server."))}else i(!1)}getSocialProofDatas({promise:e,resolve:t},r,s=!1){const{productKey:o,keyType:a}=(()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:r,customJSProductKey:s,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 ${r};`);break;case"customJSProductKey":a=n(s);break;case"productSKU":a=o}return a||3!==e||(a=i(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:h,triggerSocialProofMinPurchases:u,triggerSocialProofMinPageViews:d}=DATA,m={pv:d,i:u,"v-pv":h}[r];return[typeof c,typeof m].includes("undefined")&&t(!1),s&&!o&&(l("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===r&&"sku"===a?"v-i":r,e=>{const t=void 0!==e[c]&&e[c]>=m;return t||l(`Widget will not be shown, Social Proof API returned ${e[c]} while ${m} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!s()){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(S);const r=()=>JSON.parse(i)?.ActionTracking?.some(({name:e})=>e===n),s=["storage",({key:e,newValue:n})=>{e===S&&(i=n,r()&&t(!0))},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:n}=DATA;let i=localStorage.getItem(S);const r=()=>n<=(i?JSON.parse(i)?.VisitedPages?.length:0),s=["storage",({key:e,newValue:n})=>{e===S&&(i=n,r()&&t(!0))},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...s]),window.addEventListener(...s)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:n,triggerEventRageClickDelay:i}=DATA;let r=0,s=!1;const o=["click",({isTrusted:e})=>{if(e&&(r+=1,r>=n&&t(!0),!s)){s=!0;const e=setTimeout(()=>{r=0,s=!1},i);this.timeouts.push(e)}},{passive:!0,capture:!0}],a=e=>{this.eventsListeners.push([e,...o]),e.addEventListener(...o)},{clear:c}=f("iframe []contentDocument[] body > *",()=>{const e=document.getElementsByTagName("iframe");for(const t of e){"contentDocument"in t&&"body"in t.contentDocument&&a(t.contentDocument);const e=()=>a(t.contentDocument);t.addEventListener("load",e),this.eventsListeners.push([t,"onIframeLoad",e])}});return this.elementWaiters.push(c),a(document),e}clear(){this.triggerElements=this.triggerElements.filter(e=>(e.remove(),!1)),this.eventsListeners=this.eventsListeners.filter(e=>{const[t,...n]=e;return t&&n.length>1&&t.removeEventListener(...n),!1}),this.timeouts=this.timeouts.filter(e=>(clearTimeout(e),!1)),this.intervals=this.intervals.filter(e=>(clearInterval(e),!1));const e=c();return this.visibilityObservers=this.visibilityObservers.filter(t=>(t.clear(this.selector,e),!1)),this.promises=this.promises.filter(e=>(e.resolve(!1),!1)),this.elementWaiters=this.elementWaiters.filter(e=>(e(),!1)),this}async isTriggered(){this.clear();const e=h(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=h(`${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 k="display",x="closing",A="validation",L="ABTastyWidgets",P=`${L}Temporary`;class I{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=o(),this.uniqueId=c(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(P),n=sessionStorage.getItem(L);"ABTastyData"===e&&!t&&n&&localStorage.setItem(P,n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(L);return JSON.parse(t)}catch(t){return e.removeItem(L),!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(L,JSON.stringify(i)),i):(e.removeItem(L),!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(P),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(L,e),localStorage.removeItem(P));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:r,storageMethod:o}=i,a=this.getStamp(e),c={type:n,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!s()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new N({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===r?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===r&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const i=n?{[this.recurrenceKey]:c,...n}:{[this.recurrenceKey]:c};o.setItem(L,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&n!==A)if(n===x&&l!==A)h();else{if(n!==k||l===A||l===x)return!1;h()}else h();return a}setDisplayRecurrence(){const e=k;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=x;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=A;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 O{constructor(e,t,n){this.isWidgetApplied=e,this.callback=t,this.shouldUpdate=n,this.triggerIframeTarget=null,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(e){const t=!e&&this.isWidgetApplied(),n=t?this.shouldUpdate&&T:$;return n?(this.clearWatcher(),this.callback(n,!e,t),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:e}}){e===TEST_ID&&(this.callback($,!1),this.watch())}onTagRollback({target:e}){return this.clearWatcher(e),this.callback(E,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(e){return r()?e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler():this:this.callback(E,!1)}watch(t,n){if(e())return this;if(this.clearWatcher(t),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams),n?.includes("[]contentDocument[]")){const e=n.split("[]")[0].trim(),{clear:t}=f(e,e=>{t(),this.triggerIframeTarget=e,e.addEventListener("load",this.decisionHandler.bind(this))})}const i=t?.defaultView?.frameElement;i&&this.triggerIframeTarget!==i&&i.addEventListener("load",this.decisionHandler.bind(this));const{clear:r}=f("body",e=>{r();const n=t?.body||t||e;this.observer.observe(n,{childList:!0,subtree:!0})});return this}clearTriggerElementWatcher(){this.triggerIframeTarget?.removeEventListener("load",this.decisionHandler.bind(this))}clearWatcher(e){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this.clearTriggerElementWatcher(),e?.defaultView?.frameElement?.removeEventListener("load",this.decisionHandler.bind(this)),this}}const R=/.+\/([^.]+)\.(otf|ttf)$/,D=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class B{constructor(t,n){this.children=void 0,this.uniqueId=`${c()}${n?`_${n}`:""}`,this.widgetName=o(),this.prettyName=a(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:n,validationRecurrence:i}=DATA,r=!t&&!n&&!i;if(e()||r)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`]},o={};return t&&(o.displayRecurrence=s[t]("displayRecurrence")),n&&(o.closingRecurrence=s[n]("closingRecurrence")),i&&(o.validationRecurrence=s[i]("validationRecurrence")),o})(),this.triggerParams=(t=>{let{triggerEvent:n}=DATA;const{triggerEventClick:i,triggerEventHover:r,triggerEventReengageDelay:s,socialProofContentType:o,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(e()||!n&&!o)return!1;const l={click:()=>i,hover:()=>r,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,n)?l[n]():"body",u="reengage"===n?s:c;return o&&(n=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][o]),{triggerEvent:n,triggerSelector:h,triggerDelay:u,triggerTarget:t}})(t),this.recurrence=!!this.recurrenceParams&&new I(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new N(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&D.includes(this.triggerParams.triggerEvent),this.pageWatcher=new O(this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),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.rootElement=null,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.elementsWaiters=[]}clearGivenClearables(){this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement?.isConnected&&this.domElement.ownerDocument?.defaultView}removeOldDomElement(){const e=this.rootElement?.getElementById(this.widgetContainerId);return e?.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=["free"];"drawer"===DATA.layout&&DATA.customTarget&&e.push("drawer");const t=e.includes(DATA.layout);return new Promise(e=>{const{elementReferrer:n="body",referrerInsertType:i="beforeend"}=t?DATA:{},r=f(n,t=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==n),this.rootElement=t.getRootNode(),this.removeOldDomElement(),this.domElement.appendChild(this.styleElement),e(t.insertAdjacentElement(i,this.domElement))});this.elementsWaiters.push(r)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(this.rootElement),this.domElement?.isConnected&&this.domElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch(this.rootElement):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.rootElement),this}hide(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.pageWatcher.clearWatcher(this.rootElement),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const n=e(),i=r(),s=this.trigger?.promises?.length,o=!this.recurrence||this.recurrence.isOver();if(!n&&!i||s||!o)return{container:this,response:!1};this.pageWatcher.watch(this.rootElement||document,this.triggerParams.triggerSelector);const a=n||!this.trigger||this.trigger&&await this.trigger.isTriggered();this.pageWatcher.clearTriggerElementWatcher();const c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),n||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t,n){const i=()=>this.init().then(({response:e})=>{e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const r={[E]:()=>n?this.remove():this.pageWatcher.watch(this.rootElement),[$]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch(this.rootElement):n||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):i()},[T]:()=>{this.hasBeenShown?this.pageWatcher.watch():i()}};"function"==typeof r[e]&&r[e]()}addCloseEvent(...t){const{closeButton:n,overlay:i,overlayClickable:r,layout:s,animationDuration:o=1e3}=DATA,a=[];if(void 0!==i&&!0!==i||!0!==r||"popin"!==s||a.push(`.${this.overlayClassName}`),void 0!==n&&n&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",e=>{y(e),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...c),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...l),t.addEventListener(...l)}),this}getDom(){const{closeButton:e,layout:t,overlayClickable:n,overlay:i=!0}=DATA,r=document.createElement("div");return r.className=`${this.basicClassName} ${this.hideClassName}`,r.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(t)&&(r.role="dialog"),r.innerHTML=`\n\t\t\t${"popin"===t&&!0===i?`<div ${n?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,r}loadFont(e,t){if(!e||"inherit"===e||!/otf|ttf/g.test(t))return;const n=document.createElement("style"),i=t.match(R)?t.match(R)[1]:"";n.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}'); font-display: swap; }`;const r=this.rootElement?.head||document.head;r?.appendChild(n)}getStyleTag(t="",n=DATA){const{noStyles:i,layout:r}=n,{backgroundColor:s,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:E,titleFontStyle:$,titleFontSize:T,overlay:S,overlayColor:N,dropShadow:k,dropShadowColor:x,dropShadowBlur:A,containerMargin:L,containerPadding:P,closeButton:I,closeButtonPosition:O,closeButtonSize:D,closeButtonBorderRadius:B,closeButtonBorderWidth:_,closeButtonBorderColor:j,closeButtonColor:F,closeButtonBackgroundColor:V,buttonsAlign:W,buttonsBorderWidth:q,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:z,buttonsTextColor:U,buttonsFontName:Y,buttonsFontStyle:K,buttonsFontSize:G,secondLink:Q,secondLinkBorderWidth:J,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:ne,secondLinkFontStyle:ie,secondLinkFontSize:re,animation:se,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=i?{}:n,le=document.createElement("style");e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(f,v),this.loadFont(E,$),this.loadFont(Y,K),this.loadFont(ne,ie);const he=`background: ${["string"==typeof s?s:"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(R)?v.match(R)[1]:""};`:v||"",ve=y?`font-size: ${y}px;`:"",ye=void 0!==k&&k?`box-shadow: 0 5px ${A}px 0 ${x};`:"",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);`:"",Ee=P instanceof Array&&1===P.length&&P[0],$e=Ee?`padding: ${Ee.top}px ${Ee.right}px ${Ee.bottom}px ${Ee.left}px;`:"",Te=Ee?`padding: calc(${Ee.top}px * 0.5) calc(${Ee.right}px * 0.5) calc(${Ee.bottom}px * 0.5) calc(${Ee.left}px * 0.5);`:"",Se=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!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Le=Y&&"inherit"!==Y?`font-family:${Y}_${K.match(R)?K.match(R)[1]:""};`:K||"",Pe=G?`font-size: ${G}px;`:"",Ie="number"==typeof 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;`:"",De=void 0!==ee?`background-color: ${ee};`:"",Be=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",_e=ne&&"inherit"!==ne?`font-family:${ne}_${ie.match(R)?ie.match(R)[1]:""};`:ie||"",je=re?`font-size: ${re}px;`:"",Fe="popin"!==r||void 0!==S&&!0!==S?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==N?N:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Ve="number"==typeof D?D:16,We=Ve/2,qe=i||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===O?`bottom: calc(100% + ${We}px)`:`top: ${We}px`)+";",`right: ${We}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof B?`border-radius: ${B}px;`:"","number"==typeof _&&_>0?`border: ${_}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof V?`background-color: ${V};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Ve}px;`,`height: ${Ve}px;`,"string"==typeof F?`fill: ${F};`:"","}"].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};`:"",E&&"inherit"!==E?`font-family:${E}_${$.match(R)?$.match(R)[1]:""};`:$||"",T?`font-size: ${T}px;`:"","}"].join(""):"";let He="";if("string"==typeof se){const t=(oe/1e3).toFixed(2),n=["top","bottom"].includes(ce),i=Number(n),r=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[i]:"0"];n&&r.reverse(),He={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${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(${r.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":se].join("")}const ze=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===W?"top":"left"}: 8px;`,Ie,Oe,Re,De,Be,_e,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Be,_e,je,"}"];return le.textContent=[`#${this.widgetContainerId} style { display: none; }`,`.${this.hideClassName} {`,"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;",Se,Ne,ke,xe,Ae,Le,Pe,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Ae,Le,Pe,"}",...Q?ze:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Ce,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Te,"}","}",Fe,qe,Me,He,`${t}`].join(""),le}}const _=["top: 0;","top: 50%;","bottom: 0;"],j=["left: 0;","left: 50%;","right: 0;"],F=e=>1===e?"-50%":0,V=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,n=`translate(${F(t)}, ${F(e)});`;return`${_[e]}${j[t]}transform: ${n}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},W=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,q=()=>{if(W())return"width: auto; height: auto; min-width: fit-content;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:n,autoHeight:i,popinPercentHeight:r,popinPixelsHeight:s,heightUnit:o}=DATA;return`width: ${"px"===n?t:e}${n};height: ${i?"auto":`${"px"===o?s:r}${o}`};`};class M extends B{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>F(e)),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,widthUnit:n}=DATA,i="string"!=typeof DATA.overlay&&DATA.overlay;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"background: none;","pointer-events: "+(i?"all":"none"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",V(),q(),"pointer-events: all","}",`${W()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${!W()&&["px","em"].includes(n)?["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join(""):""}`].join("")}}class H extends B{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 z extends B{constructor(e,t){super(e,t),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const U=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new M;break;case"bannerTop":case"bannerBottom":t=new H;break;case"free":t=new z;break;default:t=new B}return t};function Y(e){return Y="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},Y(e)}function K(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 G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(e,t,n){return(t=X(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function X(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}var Z=DATA,ee=Z.isFeedBackQuestion,te=Z.isThankYouMessage,ne=Z.autoHide,ie=Z.timeHide,re=Z.stepToShow,se=Z.question,oe=Z.feedbackQuestion,ae=Z.buttonText,ce=Z.thankYouMessage,le=Z.isLegend,he=Z.minLegend,ue=Z.maxLegend,de=Z.noStyles,me=Z.layout,ge={capture:!0,passive:!1},pe=function(){return t=function e(t){var n=t.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),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()},n=[{key:"sendNote",value:function(){return e()||isNaN(this.currentNote)||(l("Sending datas, note: ".concat(this.currentNote,', feedback: "').concat(this.userFeedback,'"')),window.abtasty.send("nps",{caid:TEST_ID,vaid:VARIATION_ID,ns:this.currentNote,nf:this.userFeedback})),this}},{key:"insertIn",value:function(e,t){return this.setStyles(),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),this.parentContainer.recurrence.setValidationRecurrence(),ne?(setTimeout(function(){e.parentContainer.hide(),setTimeout(function(){return e.parentContainer.remove()},1e3)},1e3*ie),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),ee&&oe&&oe.length?this.showFeedBack():te&&ce&&ce.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){te&&ce&&ce.length?this.showThankYouMessage():this.complete()}},{key:"hideAllChildren",value:function(){var e,t=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,t){if(e){if("string"==typeof e)return J(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(e))){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return s=e.done,e},e:function(e){o=!0,r=e},f:function(){try{s||null==t.return||t.return()}finally{if(o)throw r}}}}(this.npsContainer.children);try{for(t.s();!(e=t.n()).done;)e.value.classList.add(this.hideClassName)}catch(e){t.e(e)}finally{t.f()}}},{key:"setAriaLabel",value:function(e){["popin","bannerTop","bannerBottom"].includes(me)&&this.parentContainer.domElement.setAttribute("aria-label",e)}},{key:"showFeedBack",value:function(){this.hideAllChildren();for(var e=0,t=Object.values(this.feedbackElements);e<t.length;e++)t[e].classList.remove(this.hideClassName);return this.setAriaLabel(oe),this}},{key:"showThankYouMessage",value:function(){return this.hideAllChildren(),this.thankYouElement.classList.remove(this.hideClassName),this.setAriaLabel(ce),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=ce,e()&&"displayThanksStep"===re&&(t.classList.remove(this.hideClassName),this.setAriaLabel(ce)),t}},{key:"getFeedBackElements",value:function(){var t=this,n=document.createElement("p");n.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),n.innerHTML=oe;var i=document.createElement("form");i.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),i.addEventListener("submit",y,G({},ge));var r=document.createElement("textarea");r.className="".concat(this.feedbackQuestionClassName,"_textarea"),r.ariaLabel=oe;var s=document.createElement("button");return s.className="".concat(this.feedbackQuestionClassName,"_button"),s.innerHTML="<span>".concat(ae,"</span>"),s.ariaLabel=ae,s.addEventListener("click",function(e){return y(e),t.userFeedback=r.value,t.onFeedbackSend()},G(G({},ge),{},{once:!0})),e()&&"displayFeedbackStep"===re&&([n,i].forEach(function(e){return e.classList.remove(t.hideClassName)}),this.setAriaLabel(oe)),i.appendChild(r),i.appendChild(s),{feedbackQuestionElement:n,feedbackFormElement:i}}},{key:"getNotesElement",value:function(){var t=this,n=document.createElement("div");n.className=this.notesClassName,e()&&"displayNoteStep"!==re&&n.classList.add(this.hideClassName);for(var i=10;i>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=i,r.ariaLabel="".concat(se," - ").concat(i,"/10"),e()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(i,"</span>"),r.addEventListener("click",function(e){y(e),t.onClickNote(e)},G({},ge)),n.insertAdjacentElement("afterbegin",r),5===i&&r.insertAdjacentHTML("afterend","<br>"),i-=1}return le&&(n.insertAdjacentHTML("afterbegin","<legend>".concat(he,"</legend>")),n.insertAdjacentHTML("beforeend","<legend>".concat(ue,"</legend>"))),n}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=se,e()&&"displayNoteStep"!==re&&t.classList.add(this.hideClassName),"displayNoteStep"===re&&this.setAriaLabel(se),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),ee&&Object.values(this.feedbackElements).forEach(function(t){e.npsContainer.appendChild(t)}),te&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"setStyles",value:function(){var e=this.parentContainer,t=e.styleElement,n=e.widgetContainerId,i="";if(de)i=["#".concat(n," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var r=DATA,s=r.containerPadding,o=r.legendTextColor,a=r.legendFontName,c=r.legendFontStyle,l=r.legendFontSize,h=r.buttonsFontSize;this.parentContainer.loadFont(a,c);var u=/.+\/([^.]+)\.(otf|ttf)$/,d=a&&"inherit"!==a?"font-family:".concat(a,"_").concat(c.match(u)?c.match(u)[1]:"",";"):c||"",m=s instanceof Array&&1===s.length&&s[0],g="#".concat(n," .").concat(this.className);i=["".concat(g," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(g,","),"".concat(g," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: normal;","font-family: sans-serif;","}","".concat(g," > * {"),"display: block;","width: 100%;","}","".concat(g," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(g," p {"),"margin-bottom: 15px;","font-size: 1.4em;","white-space: pre-line;","}","".concat(g," button {"),"vertical-align: middle;","cursor: pointer;","text-align: center;","}","".concat(g," button span {"),"font-size: 1em;","pointer-events: none;","}","".concat(g," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: ".concat(1.75*h,"px;"),"height: ".concat(1.75*h,"px;"),"}","".concat(g," .").concat(this.notesClassName," button * {"),"display: inline-block !important;","pointer-events: none;","}","".concat(g," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",le?["".concat(g," legend {"),"position: absolute;","text-decoration: none;","border: none;","color: ".concat(o,";"),"fill: ".concat(o,";"),"-webkit-text-fill-color: ".concat(o,";"),"font-size: ".concat(l,"px;"),d,"}","".concat(g," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(g," 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(g," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 580px) {","".concat(g," {"),"min-width: 560px;","}",le?["".concat(g," .").concat(this.notesClassName," {"),"padding-top: ".concat(1.5*l,"px"),"}","".concat(g," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(g," br {"),"display: none","}","}","@media screen and (max-width: 579px) {","".concat(g," {"),"min-width: ".concat(240+(m.left+m.right/2),"px;"),"}","".concat(g," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(g," br {"),"display: block","}",le?["".concat(g," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(g," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(g," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(g," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(g," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(g," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(g," textarea {"),"min-width: auto;","}","}"].join("")}return t.insertAdjacentText("afterbegin",i),t}}],n&&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,X(i.key),i)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function fe(e){return fe="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},fe(e)}function ve(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ve=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var s=t&&t.prototype instanceof f?t:f,o=Object.create(s.prototype),a=new A(i||[]);return r(o,"_invoke",{value:S(e,n,a)}),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",m="executing",g="completed",p={};function f(){}function v(){}function y(){}var b={};l(b,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==n&&i.call(C,o)&&(b=C);var E=y.prototype=f.prototype=Object.create(b);function $(e){["next","throw","return"].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function T(e,t){function n(r,s,o,a){var c=u(e[r],e,s);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==fe(h)&&i.call(h,"__await")?t.resolve(h.__await).then(function(e){n("next",e,o,a)},function(e){n("throw",e,o,a)}):t.resolve(h).then(function(e){l.value=e,o(l)},function(e){return n("throw",e,o,a)})}a(c.arg)}var s;r(this,"_invoke",{value:function(e,i){function r(){return new t(function(t,r){n(e,i,t,r)})}return s=s?s.then(r,r):r()}})}function S(t,n,i){var r=d;return function(s,o){if(r===m)throw Error("Generator is already running");if(r===g){if("throw"===s)throw o;return{value:e,done:!0}}for(i.method=s,i.arg=o;;){var a=i.delegate;if(a){var c=N(a,i);if(c){if(c===p)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===d)throw r=g,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=m;var l=u(t,n,i);if("normal"===l.type){if(r=i.done?g:"suspendedYield",l.arg===p)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(r=g,i.method="throw",i.arg=l.arg)}}}function N(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;var s=u(r,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,p;var o=s.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,s=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(fe(t)+" is not iterable")}return v.prototype=y,r(E,"constructor",{value:y,configurable:!0}),r(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},$(T.prototype),l(T.prototype,a,function(){return this}),t.AsyncIterator=T,t.async=function(e,n,i,r,s){void 0===s&&(s=Promise);var o=new T(h(e,n,i,r),s);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},$(E),l(E,c,"Generator"),l(E,o,function(){return this}),l(E,"toString",function(){return"[object Generator]"}),t.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}},t.values=L,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(x),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):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),p},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),x(n),p}},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 r=i.arg;x(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:L(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),p}},t}function ye(e,t,n,i,r,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,r)}function be(){var e;return e=ve().mark(function e(){var t,n,i;return ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l("Widget launch"),t=U(),n=t.domElement.querySelector(".".concat(t.contentClassName)),i=new pe({parentContainer:t}),t.children=i,i.insertIn(n,"beforeend"),t.init(!0).then(function(e){return e.response&&t.show()}),e.abrupt("return",{parentContainer:t,NPS:i});case 9:case"end":return e.stop()}},e)}),be=function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){ye(s,i,r,o,a,"next",e)}function a(e){ye(s,i,r,o,a,"throw",e)}o(void 0)})},be.apply(this,arguments)}!function(){be.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.23",
4
+ "version": "1.5.25-0",
5
5
  "form": "dist/form.js",
6
6
  "main": "dist/main.js",
7
7
  "type": "module",
@@ -43,5 +43,6 @@
43
43
  "postcss-cssnext": "^3.1.1",
44
44
  "rollup": "^4.12.0",
45
45
  "rollup-plugin-postcss": "^4.0.2"
46
- }
46
+ },
47
+ "stableVersion": "1.5.24"
47
48
  }