import{A as B,H as n,dc as M,s as l,D as c,m,a5 as D,x as R,a6 as $,e as y,w as W,b as r,ab as A,ao as S,l as f,E as x,o as b,af as H}from"./stepForm.5d21c66d.js";import{d as L}from"./catalogForm.67c60cdb.js";import{v as N}from"./eventListForm.2fd071fc.js";import P from"./eventCalendarForm.6ff5141e.js";const T={name:"AmeliaDialogForms"},q=Object.assign(T,{setup(j){let e=f("shortcodeData"),E=B({sbsNew:n(M),cbf:n(L),elf:n(N),ecf:n(P)}),s=l(0);c("dialogWrapperWidth",s);let a=l(!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=l(100),_=l(0);c("loadDialogCounter",_),v.forEach(u=>{u.addEventListener("click",i=>{i.preventDefault(),i.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=l(0);function h(){d.value=window.visualViewport.height}window.addEventListener("resize",h);let V=f("isMounted");R(()=>{V.value=!0,$("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,i)=>(b(),y(S,{modelValue:r(a),"onUpdate:modelValue":i[0]||(i[0]=w=>A(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:W(()=>[(b(),y(H(r(E)[r(e).triggered_form])))]),_:1},8,["modelValue","modal-class","custom-styles","width"]))}});export{q as default};
