import{e as B,_ as M}from"./catalogForm.35725705.js";import{D as R,M as n,d5 as W,s as i,J as c,m,a9 as D,x as $,aa as S,e as y,w as A,b as r,B as F,l as f,K as x,o as b,ai as L}from"./stepForm.ddcbefb6.js";import{l as N}from"./eventListForm.f96fb533.js";import P from"./eventCalendarForm.78c8616d.js";const T={name:"AmeliaDialogForms"},O=Object.assign(T,{setup(j){let e=f("shortcodeData"),E=R({sbsNew:n(W),cbf:n(B),elf:n(N),ecf:n(P)}),s=i(0);c("dialogWrapperWidth",s);let a=i(!1);c("formDialogVisibility",a);let g=m(()=>"isRestored"in e.value?e.value.isRestored:!1),v=e.value.trigger_type&&e.value.trigger_type==="class"?[...document.getElementsByClassName(e.value.trigger)]:[document.getElementById(e.value.trigger)],p=i(100),_=i(0);c("loadDialogCounter",_),v.forEach(u=>{u.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),a.value=!0,g.value||_.value++,setTimeout(()=>{window.dispatchEvent(new Event("resize"))},p.value)})}),D(()=>{g.value&&v.forEach(u=>{u.dispatchEvent(new Event("click"))})});function z(){a.value=!1}let d=i(0);function h(){d.value=window.visualViewport.height}window.addEventListener("resize",h);let V=f("isMounted");$(()=>{V.value=!0,S("renderPopup",{resizeAfter:p}),h()});const o=f("settings");let t=m(()=>o.customizedData&&e.value.triggered_form in o.customizedData?o.customizedData[e.value.triggered_form].colors:x[e.value.triggered_form].colors),C=m(()=>o.customizedData&&e.value.triggered_form in o.customizedData?o.customizedData[e.value.triggered_form]:x[e.value.triggered_form]),k=m(()=>({"--am-c-primary":t.value.colorPrimary,"--am-c-success":t.value.colorSuccess,"--am-c-error":t.value.colorError,"--am-c-warning":t.value.colorWarning,"--am-c-main-bgr":t.value.colorMainBgr,"--am-c-main-heading-text":t.value.colorMainHeadingText,"--am-c-main-text":t.value.colorMainText,"--am-dvh":d.value?`${d.value}px`:"100dvh"}));return D(()=>{e.value.triggered_form==="sbsNew"&&(s.value=C.value.sidebar.options.self.visibility?"760px":"520px"),e.value.triggered_form==="cbf"&&(s.value="1140px"),e.value.triggered_form==="elf"&&(s.value="792px")},{flush:"post"}),(u,l)=>(b(),y(M,{modelValue:r(a),"onUpdate:modelValue":l[0]||(l[0]=w=>F(a)?a.value=w:a=w),"append-to-body":!0,"modal-class":`amelia-v2-booking am-forms-dialog am-${r(e).triggered_form}`,"close-on-click-modal":!1,"close-on-press-escape":!1,"custom-styles":r(k),"used-for-shortcode":!0,width:r(s),onClosed:z},{default:A(()=>[(b(),y(L(r(E)[r(e).triggered_form])))]),_:1},8,["modelValue","modal-class","custom-styles","width"]))}});export{O as default};
