PageSourceSearch

https://tryformula.co/76221449-d7d8-49f4-857a-4ab49ec08cca/c788e29…/_astro/MultiForm.D4m9FFxm.js

js tryformula.co collected 2026-10-05 08:39:27 UTC 7,856 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/MultiForm13.CROfGi5v.js","_astro/VariantContext.DvYRgBT-.js","_astro/index.o9bRfbtw.js","_astro/index.C780YxeD.js","_astro/index.BxIRzB8P.js","_astro/index.BYLxQceh.js","_astro/clsx.B-dksMZM.js","_astro/index.esm.Dtm3i1vN.js","_astro/index.BBmNdloa.js","_astro/iconBase.j15Rtm-Y.js","_astro/Link.BBrf2Aa1.js","_astro/hipaa-sanitizer.BZ_9wSqq.js"])))=>i.map(i=>d[i]);
2import{j as d,a as te}from"./VariantContext.DvYRgBT-.js";import{g as ne,u as se,a as oe}from"./zod.BaM0SVi-.js";import{r as c}from"./index.o9bRfbtw.js";import{a as re,F as ie}from"./index.esm.Dtm3i1vN.js";import{_ as ae,R as L,I as z}from"./components.DkQfT8pm.js";import{C as le}from"./ComponentStyleWrapper.CKukler5.js";import ue from"./CTAWrapper.Bk2CWCb9.js";import ce from"./HeaderWrapper.DTbK-Jg3.js";import fe from"./NavbarWrapper.BgC9I2F2.js";import"./hipaa-sanitizer.BZ_9wSqq.js";import"./analytics-runtime.DMumoeD8.js";const me=c.lazy(()=>ae(()=>import("./MultiForm13.CROfGi5v.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(r=>({default:r.MultiForm13}))),pe=r=>{switch(r){case"MultiForm13":return me;default:return null}},de=c.memo(function({name:o,props:p,styles:e,children:t}){const i=c.useMemo(()=>pe(o),[o]),a=c.useMemo(()=>`MultiForm${o}`,[o]);return i?d.jsx(le,{componentKey:a,styles:e,children:d.jsx(c.Suspense,{fallback:null,children:d.jsx(i,{...p,name:o,children:t})})}):(console.error(`No MultiForm component found for name: ${o}`),null)});class he extends Event{detail;constructor(o,p){super(o,{bubbles:!0}),this.detail=p}}const _="__multiFormDispatchedStepEvents",B=()=>typeof window>"u"?new Set:(window[_]||(window[_]=new Set),window[_]),H=r=>{if(!r)return null;const o=Object.keys(r);return o.length>0?o[0]:null},G=r=>{if(!r)return!1;for(const o of Object.values(r))if(Array.isArray(o)){if(o.includes(null))return!0}else if(o===null)return!0;return!1},V=(r,o)=>{if(!r.visible)return!0;for(const[p,e]of Object.entries(r.visible)){const t=o[p],i=t==null||t==="";if(Array.isArray(e)){let a=!1;for(const h of e)if(h===null){if(i){a=!0;break}}else if(t===h){a=!0;break}if(!a)return!1}else if(e===null){if(!i)return!1}else if(t!==e)return!1}return!0},ve=(r,o,p)=>{const e=new Map;let t=0;for(const i of r){if(i.countInSteps===!1)continue;const a=H(i.visible);if(!a)t++;else{const h=G(i.visible),E=V(i,p);if(!e.has(a))e.set(a,{hasNull:h,isVisible:E});else{const x=e.get(a);h&&(x.hasNull=!0),E&&(x.isVisible=!0)}}}for(const{hasNull:i,isVisible:a}of e.values())(i||a)&&t++;return t+(o?1:0)},be=(r,o,p)=>{const e=new Map;let t=0;for(let i=0;i<=r&&i<o.length;i++){const a=o[i];if(a.countInSteps===!1)continue;const h=H(a.visible);if(!h)t++;else{const E=G(a.visible),x=V(a,p);if(!e.has(h))e.set(h,{hasNull:E,isVisible:x,counted:!1});else{const w=e.get(h);E&&(w.hasNull=!0),x&&(w.isVisible=!0)}const F=e.get(h);!F.counted&&(F.hasNull||F.isVisible)&&(t++,F.counted=!0)}}return t},je=({name:r,props:o,styles:p})=>{const{steps:e,emailField:t,cta19:i,header200:a,navbar10:h,successSteps:E,events:x,stepEvents:F,startEvents:w,clearFocusOnStepChange:M=!0}=o||{steps:[]},[l,C]=c.useState(0),[y,P]=c.useState(!1),{integrations:Y}=te(),W=c.useCallback(()=>{if(!w?.length)return;const s=`${r}-start`,n=B();if(n.has(s)){console.log(`[MultiForm] Skipping duplicate start event for: ${s}`);return}n.add(s);const f=`${s}-${Date.now()}`;console.log(`[MultiForm] Dispatching start event: ${s}, eventId: ${f}`),w.forEach(u=>{const v=new CustomEvent(u.name,{bubbles:!0,detail:{eventProps:u.props,eventId:f,data:{}}});document.dispatchEvent(v)})},[w,r]),j=c.useCallback((s,n)=>{if(!F?.length||s<0)return;const f=`${r}-${s}`,u=B();if(u.has(f)){console.log(`[MultiForm] Skipping duplicate dispatch for: ${f}`);return}u.add(f);const v=`${f}-${Date.now()}`;console.log(`[MultiForm] Dispatching step event: ${f}, eventId: ${v}`),F.forEach(S=>{const m=new CustomEvent(S.name,{bubbles:!0,detail:{eventProps:S.props,eventId:v,data:{completed:s,total:n}}});document.dispatchEvent(m)})},[F,r]),q=c.useMemo(()=>{const s=e.map(n=>n.components).flat().filter(n=>n?.name.startsWith("Form")).map(n=>n?.props?.fields).flat().filter(n=>n?.component);return t&&((t.headline||t.subhead)&&(s.push({name:"firstName",component:"text",required:!0}),s.push({name:"lastName",component:"text",required:!0})),s.push({name:"email",component:"text",required:!0}),t.checkboxLabel&&s.push({name:"consent",component:"text",required:t.checkboxRequired||!1})),s},[e,t]),$=re({resolver:se(oe(q)),defaultValues:ne(q),mode:"onChange"}),{handleSubmit:A,trigger:D,formState:{errors:ge},getValues:b,watch:J}=$,I=J(),g=c.useMemo(()=>ve(e,!!t,I),[e,t,I]),k=c.useMemo(()=>t&&l>=e.length?g:be(l,e,I),[l,e,t,g,I]),N=t&&l>=e.length,Q=k>=g,T=l===0,K=!!E?.length;c.useEffect(()=>{M&&document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur()},[l,M]),c.useEffect(()=>{const s=e[l];
2if(!s?.autoAdvanceAfter||y||N)return;const n=setTimeout(()=>{s.countInSteps!==!1&&j(k-1,g);const f=b();let u=l+1;for(;u<e.length;){const v=e[u];if(V(v,f))break;u++}u<e.length?C(u):t?C(e.length):P(!0)},s.autoAdvanceAfter);return()=>clearTimeout(n)},[l,e,y,N,t,b,j,k,g]);const U=async s=>{const n=b("email")||"",f=b("firstName")||"",u=b("lastName")||"",v=b("consent");if(x?.length){z.setIntegrations(Y);for(const S of x){const{name:m,props:O}=S,ee=new he(m,{eventProps:O,data:{...s,email:n,firstName:f,lastName:u,...v!==void 0&&{consent:v}}});await z.handle(ee)}}},R=c.useCallback(async s=>{await U(s),P(!0)},[]),X=c.useCallback(async s=>{if(s.preventDefault(),N){const m=["email"];if((t?.headline||t?.subhead)&&m.push("firstName","lastName"),t?.checkboxLabel&&m.push("consent"),!await D(m))return;j(g-1,g),A(R)();return}const n=e[l];if(!n)return;const f=n?.components?.filter(m=>m?.name?.startsWith("Form")).map(m=>m?.props?.fields).flat().filter(m=>m?.component).map(m=>m?.name).filter(Boolean);let u=!1;if(f?.length?u=await D(f):u=!0,!u)return;T&&W(),n.countInSteps!==!1&&j(k-1,g);const v=b();let S=l+1;for(;S<e.length;){const m=e[S];if(V(m,v))break;S++}if(S<e.length){C(S),M&&setTimeout(()=>{document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur()},0);return}if(t){C(e.length);return}A(R)()},[l,e,D,b,A,$.formState.errors,N,T,t,W,j,k,g]),Z=c.useCallback(()=>{if(l===0)return;const s=b();if(N){for(let n=e.length-1;n>=0;n--)if(V(e[n],s)){C(n),M&&setTimeout(()=>{document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur()},0);return}C(0);return}for(let n=l-1;n>=0;n--)if(V(e[n],s)){C(n),M&&setTimeout(()=>{document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur()},0);return}C(0)},[l,e,b,N]);return y&&!K?d.jsxs(c.Suspense,{fallback:null,children:[h&&d.jsx(fe,{name:"Navbar10",props:h,styles:p},"navbar10"),d.jsxs("div",{className:"flex flex-col items-center justify-center w-full min-h-[100vh] relative after:absolute after:inset-0 after:bg-background-error after:z-[-20]",children:[i&&d.jsx(ue,{name:"CTA19",props:i,styles:p},"cta19"),a&&d.jsx(ce,{name:"Header200",props:a,styles:p},"header200")]})]}):d.jsx("div",{className:"relative after:absolute after:inset-0 after:bg-background-error after:z-[-20]",children:d.jsx(ie,{...$,children:d.jsx(de,{name:r,props:{currentStep:Math.max(0,k-1),handleNext:X,isFirstStep:T,isLastStep:Q,totalSteps:g,handlePrev:Z,isCompleted:y,buttonText:e[l]?.buttonText,autoAdvanceAfter:e[l]?.autoAdvanceAfter,hideButtons:e[l]?.hideButtons,...o},children:d.jsxs(c.Suspense,{fallback:null,children:[e.map((s,n)=>{const f=`multiform-step-${n}`,u=n===l&&!N&&!y;return!V(s,I)&&s.visible?null:d.jsx("div",{style:{display:u?"block":"none"},children:d.jsx(L,{uniqueKeyPrefix:`multiform-step-${n}`,components:s.components,styles:p})},f)}),y&&K&&d.jsx(L,{components:E[0].components,styles:p})]})})})})};export{je as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.