var l=Object.defineProperty;var c=(o,e,i)=>e in o?l(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i;var n=(o,e,i)=>c(o,typeof e!="symbol"?e+"":e,i);import{_ as u,D as h,A as m,o as d,c as S,a,j as f,d as P}from"./app-CNwDlsKB.js";import"./_commonjsHelpers-Cpj98o6Y.js";class g{constructor(e,i,t){n(this,"version",null);n(this,"resetOlderVersions",!1);n(this,"hoursToReset",!1);this.version=e,this.resetOlderVersions=i,this.hoursToReset=t}writeToLocalStorage(e,i,t=null){const s=new Date;t===null&&(t=this.hoursToReset>0?s.setHours(s.getHours()+this.hoursToReset):null);const r={value:i,version:this.version,expiry:t};localStorage.setItem(e,JSON.stringify(r))}readFromLocalStorage(e){const i=localStorage.getItem(e);if(!i)return null;const t=JSON.parse(i),s=new Date;return t.expiry!==null&&s.getTime()>t.expiry||this.resetOlderVersions&&t.version!==this.version?(localStorage.removeItem(e),null):t}}const v={data(){return{showPopup:!1}},props:{showoption:String,viewdelay:String,popupname:String,hourstoreset:{type:String,default:"1"},resetolderverions:{type:String,default:"false"},version:{type:String,default:"1"},interactcounter:{type:String,default:"0"}},created(){if(this.promotionPopUpService=new g(this.version,this.resetolderverions==="true",parseInt(this.hourstoreset)),this.showoption!==""){let o=parseInt(this.interactcounter);(o===null||isNaN(o))&&(o=0);let e=this.promotionPopUpService.readFromLocalStorage("PromotionPopupInteracted-"+this.popupname);if(parseInt(e?e.value:null)>=o&&o!==0&&(this.promotionPopupInteracted=!0),!this.promotionPopupInteracted)if(this.showoption==="ShowOnExit")document.addEventListener("mouseout",(function(t){(t.clientY<=0||t.clientX<=0||t.clientX>=window.innerWidth||t.clientY>=window.innerHeight)&&(this.promotionPopupInteracted||this.open())}).bind(this));else{let t=parseInt(this.viewdelay),s=this.promotionPopUpService.readFromLocalStorage("PromotionPopupVisitCount-"+this.popupname),r=parseInt(s?s.value:null);r===null||isNaN(r)?(this.promotionPopUpService.writeToLocalStorage("PromotionPopupVisitCount-"+this.popupname,1),(this.viewdelay===""||t===0||isNaN(t))&&this.open()):r<t-1?this.promotionPopUpService.writeToLocalStorage("PromotionPopupVisitCount-"+this.popupname,r+1,s.expiry):(r>=t-1||isNaN(t))&&this.open()}}},methods:{open(){this.showPopup=!0,this.agaSend("pop-up","auto-oeffnung","exit-intent"),h(),this.interact(),setTimeout(wOptimizePictureSizes,0)},closeSpace(){this.showPopup=!1,this.agaSend("space","geklickt","close")},closeX(){this.showPopup=!1,this.agaSend("x-button","geklickt","close")},interact(){let o=this.promotionPopUpService.readFromLocalStorage("PromotionPopupInteracted-"+this.popupname),e=o?parseInt(o.value):null;this.promotionPopupInteracted=!0,e?this.promotionPopUpService.writeToLocalStorage("PromotionPopupInteracted-"+this.popupname,e+1,o.expiry):(this.promotionPopUpService.writeToLocalStorage("PromotionPopupInteracted-"+this.popupname,1),e=0)},agaSend(o,e,i){m.send(o,e,i,0)}}},w={key:0,class:"promotion-popup"},I={class:"promotion-popup__content_center"};function _(o,e,i,t,s,r){return s.showPopup?(d(),S("div",w,[a("div",{class:"promotion-popup__overlay",onClick:e[0]||(e[0]=(...p)=>r.closeSpace&&r.closeSpace(...p))}),a("div",I,[f(o.$slots,"default"),a("span",{class:"promotion-popup__content_center_close icon-times",onClick:e[1]||(e[1]=(...p)=>r.closeX&&r.closeX(...p))})])])):P("",!0)}const N=u(v,[["render",_]]);export{N as default};