import{h as z,$ as m,i as A,_,r as k,o as l,c as a,a as r,t as g,j as b,d as o,k as h,e as v,n as I,b as B,w as f,F as $,g as p,T as F}from"./app-CNwDlsKB.js";import D from"./DynamicsForm-CoVqyO2x.js";import"./_commonjsHelpers-Cpj98o6Y.js";const w=z({template:"<div></div>",data:()=>({aktuelleFrage:0,antworten:[],clickfunnelDarstellung:"",clickfunnelElement:void 0,content:[],formulare:[],layoutKlassenAntworten:"",formularId:!1,selectedFormular:void 0}),methods:{initData(e,t,n,s){this.content=JSON.parse(e),this.formulare=JSON.parse(t),this.clickfunnelDarstellung=n,this.clickfunnelElement=s},handleClick(e,t){this.antworten[e]=t,this.aktuelleFrage===this.content.length-1?(this.formularId=this.content[e].antworten[t].formular,this.selectedFormular=this.formulare[this.formularId]):(this.aktuelleFrage++,this.layoutAntwortenBerechnen()),m("html, body").animate({scrollTop:m(this.clickfunnelElement).offset().top-100},500)},getCssClassColor(e){return A(e)?"isLightBackground":"isDarkBackground"},layoutAntwortenBerechnen(){let e=this.content[this.aktuelleFrage],t=e.antworten.length,n=1,s=1,i="";e.darstellung==="col2"?window.innerWidth>1024?(n=2,s=Math.ceil(t/2),i=" antworten--gap"):window.innerWidth>414?(n=2,s=Math.ceil(t/2)):(n=1,s=t):window.innerWidth>1024?(n=t,s=1,t<3&&(i=" antworten--gap")):window.innerWidth>414?(n=2,s=Math.ceil(t/2)):(n=1,s=t),this.layoutKlassenAntworten="antworten--row"+s+" antworten--col"+n+i},closeClickFunnel(){this.formularId=!1,this.selectedFormular=void 0,this.aktuelleFrage=0,this.antworten=[],this.layoutAntwortenBerechnen()},getClickfunnelResponse(){let e="";return this.content.forEach((t,n)=>{e+=t.frage+" - "+t.antworten[this.antworten[n]].text+` `}),e}}}).mount(document.createElement("div")),K={components:{DynamicsForm:D},data:()=>({eventBus:w}),mounted(){this.eventBus.selectedFormular.type==="weblication"&&m('div[data-formid="'+this.eventBus.formularId+'"] > div.elementForm').clone(!0).appendTo(m(this.$refs.webform))}},E={class:"clickfunnel_dynamics"},S={class:"h2 clickfunnel_dynamics-headline"},J={class:"clickfunnel_dynamics-form_container"},T={key:0,class:"form_container-image"},N=["src"],L={key:2,ref:"webform"};function W(e,t,n,s,i,d){const c=k("dynamics-form");return l(),a("div",E,[r("p",S,g(e.eventBus.selectedFormular.headline),1),b(e.$slots,e.eventBus.formularId),r("div",J,[e.eventBus.selectedFormular.bild!==""?(l(),a("div",T,[r("img",{src:e.eventBus.selectedFormular.bild},null,8,N)])):o("",!0),e.eventBus.selectedFormular.type==="dynamics"?(l(),h(c,{key:1,"dynamics-id":e.eventBus.selectedFormular.dynamicsid,"block-id":e.eventBus.selectedFormular.blockid,"aga-category":e.eventBus.selectedFormular.agacategory,"aga-action":e.eventBus.selectedFormular.agaaction,"aga-label":e.eventBus.selectedFormular.agalabel,"aga-value":e.eventBus.selectedFormular.agavalue,"form-type":"clickfunnel","clickfunnel-data":e.eventBus.getClickfunnelResponse()},null,8,["dynamics-id","block-id","aga-category","aga-action","aga-label","aga-value","clickfunnel-data"])):(l(),a("div",L,null,512))])])}const H=_(K,[["render",W]]),M={props:["antwort","aKey","fKey"],data:()=>({eventBus:w}),methods:{getCssClassAntwort(e){return e.hintergrundbild===""?this.eventBus.getCssClassColor(e.hintergrundfarbe)+" elementBoxBackgroundColor_var"+e.hintergrundfarbe:""}}},V=["id"],O={class:"clickfunnel_antwort-text"};function R(e,t,n,s,i,d){return l(),a("a",{class:"clickfunnel_antwort",onClick:t[0]||(t[0]=c=>e.eventBus.handleClick(n.fKey,n.aKey)),id:n.antwort.gtmid},[r("div",{class:v(["clickfunnel_antwort-hintergrund",d.getCssClassAntwort(n.antwort)]),style:I([n.antwort.hintergrundbild!==""?{backgroundImage:"url('"+n.antwort.hintergrundbild+"')"}:{}])},[n.antwort.hintergrundbild===""&&n.antwort.hintergrundicon!==""?(l(),a("span",{key:0,class:v("icon-"+n.antwort.hintergrundicon+" icon-size_"+n.antwort.icongroesse)},null,2)):o("",!0)],6),r("div",O,g(n.antwort.text),1)],8,V)}const j=_(M,[["render",R]]),P={components:{ClickfunnelAntwort:j},props:["frage","fKey"],data:()=>({eventBus:w})},q={class:"clickfunnel_frage"},G={key:0},Q={class:"h2 clickfunnel_frage-headline"},U={key:0,class:"clickfunnel_frage-zusatztext"};function X(e,t,n,s,i,d){const c=k("clickfunnel-antwort");return l(),a("div",q,[B(F,{name:"fade"},{default:f(()=>[n.fKey===e.eventBus.aktuelleFrage?(l(),a("div",G,[r("p",Q,g(n.frage.frage),1),n.frage.zusatztext!==""?(l(),a("p",U,g(n.frage.zusatztext),1)):o("",!0),r("div",{class:v(["clickfunnel_antworten",e.eventBus.layoutKlassenAntworten])},[(l(!0),a($,null,p(n.frage.antworten,(y,u)=>(l(),h(c,{key:u,antwort:y,"a-key":u,"f-key":n.fKey},null,8,["antwort","a-key","f-key"]))),128))],2)])):o("",!0)]),_:1})])}const Y=_(P,[["render",X]]),Z={components:{ClickfunnelFormular:H,ClickfunnelFrage:Y},props:["contentJson","clickfunnelDarstellung","clickfunnelHintergrundfarbe","clickfunnelInnenabstand","clickfunnelTrackingId","formularJson"],data:()=>({eventBus:w}),mounted(){this.eventBus.initData(this.contentJson,this.formularJson,this.clickfunnelDarstellung,this.$el),this.eventBus.layoutAntwortenBerechnen(),window.addEventListener("resize",()=>{this.eventBus.layoutAntwortenBerechnen()})}},x=["id"],ee={key:0,class:"agenda-clickfunnel_overlay"},ne={class:"clickfunnel_content-inner"},te={key:0};function le(e,t,n,s,i,d){const c=k("clickfunnel-formular"),y=k("clickfunnel-frage");return l(),a("div",{class:"agenda-clickfunnel",id:n.clickfunnelTrackingId},[n.clickfunnelDarstellung==="layer"&&e.eventBus.aktuelleFrage!==0?(l(),a("div",ee)):o("",!0),r("div",{class:v(["agenda-clickfunnel_content elementSection",e.eventBus.getCssClassColor(n.clickfunnelHintergrundfarbe)+" elementSectionBackgroundColor_var"+n.clickfunnelHintergrundfarbe+" elementSectionPadding_var"+n.clickfunnelInnenabstand])},[r("div",ne,[n.clickfunnelDarstellung==="layer"&&e.eventBus.aktuelleFrage!==0?(l(),a("div",{key:0,class:"inner_close-icon",onClick:t[0]||(t[0]=u=>e.eventBus.closeClickFunnel())},t[1]||(t[1]=[r("span",{class:"icon-times"},null,-1)]))):o("",!0),B(F,{name:"fade"},{default:f(()=>[e.eventBus.formularId!==!1&&typeof e.eventBus.selectedFormular<"u"?(l(),h(c,{key:0},{[e.eventBus.formularId]:f(()=>[b(e.$slots,e.eventBus.formularId)]),_:2},1024)):o("",!0)]),_:3}),B(F,{name:"fade"},{default:f(()=>[e.eventBus.formularId===!1?(l(),a("div",te,[(l(!0),a($,null,p(e.eventBus.content,(u,C)=>(l(),h(y,{key:C,frage:u,"f-key":C},null,8,["frage","f-key"]))),128))])):o("",!0)]),_:1})])],2)],8,x)}const oe=_(Z,[["render",le]]);export{oe as default};