import{l as m,D as B,J as n,cO as M,E as f,a3 as D,s as R,a4 as $,o as y,d as x,w as W,ad as S,b as r,a9 as A,aw as L,z as l,p as c,G as b}from"./stepForm-13c8d592.js";import{_ as N}from"./catalogForm-72fc5fb3.js";import{q as P}from"./eventListForm-22b87be3.js";import T from"./eventCalendarForm-a4855c44.js";const j={name:"AmeliaDialogForms"},I=Object.assign(j,{setup(F){let e=m("shortcodeData"),E=B({sbsNew:n(M),cbf:n(N),elf:n(P),ecf:n(T)}),s=l(0);f("dialogWrapperWidth",s);let a=l(!1);f("formDialogVisibility",a);let g=c(()=>"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);f("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=m("isMounted");R(()=>{V.value=!0,$("renderPopup",{resizeAfter:p}),h()});const o=m("settings");let t=c(()=>o.customizedData&&e.value.triggered_form in o.customizedData?o.customizedData[e.value.triggered_form].colors:b[e.value.triggered_form].colors),C=c(()=>o.customizedData&&e.value.triggered_form in o.customizedData?o.customizedData[e.value.triggered_form]:b[e.value.triggered_form]),k=c(()=>({"--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)=>(y(),x(L,{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(()=>[(y(),x(S(r(E)[r(e).triggered_form])))]),_:1},8,["modelValue","modal-class","custom-styles","width"]))}});export{I as default};
