1import{a as t}from"./chunk-62JRHF6Z-Bnc4bl6l.js";import{f as V,k as x,l as R,m as H,n as I}from"./analytics-uJgpQkEg.js";try{let o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new o.Error().stack;n&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[n]="5dc056f9-eb00-44c5-968e-71f92684498e",o._sentryDebugIdIdentifier="sentry-dbid-5dc056f9-eb00-44c5-968e-71f92684498e")}catch{}const b=o=>o.has_value===!0,m=o=>o.has_error===!0;function P(o){const{formName:n,totalFields:u,enabled:c=!0,abandonmentTimeout:T=300*1e3,onAbandonment:p}=o,g=t.useRef(Date.now()),d=t.useRef(new Map),A=t.useRef(Date.now()),l=t.useRef(null),h=t.useRef(!1),k=t.useRef(""),w=t.useCallback(()=>{!c||h.current||(h.current=!0,g.current=Date.now(),V(n,{total_fields:u}))},[c,n,u]),i=t.useCallback(()=>{let e=0;return d.current.forEach(r=>{b(r)&&!m(r)&&e++}),Math.round(e/u*100)},[u]),_=t.useCallback(()=>{if(!c)return;const e=Array.from(d.current.values()).filter(a=>b(a)&&!m(a)).length,r=i();(r===25||r===50||r===75||r===100)&&x(n,r,e,u)},[c,n,u,i]),E=t.useCallback(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{const e=Math.round((Date.now()-g.current)/1e3),r=Array.from(d.current.values()).filter(a=>b(a)&&!m(a)).length;R(n,e,r,u,k.current,{abandonment_reason:"timeout",completion_percentage:i()}),p&&p()},T)},[n,u,T,p,i]),F=t.useCallback((e,r,a)=>{if(!c)return;w();const s={...d.current.get(e)||{name:e},...a,name:e};if(a){const f=a.has_value??a.hasValue,D=a.has_error??a.hasError;f!==void 0&&(s.has_value=f),D!==void 0&&(s.has_error=D)}if(s.hasValue=void 0,s.hasError=void 0,d.current.set(e,s),A.current=Date.now(),r!=="error"&&(k.current=e),r==="blur"||r==="error"){H(n,e,r,{field_type:s.field_type??s.type,field_required:s.field_required??s.required,has_error:m(s)||r==="error",completion_percentage:i()});const f=i();f>0&&f%25===0&&_()}E()},[c,n,w,i,_,E]),C=t.useCallback((e,r)=>{c&&(I(n,e,r),F(e,"error",{has_error:!0}))},[c,n,F]),y=t.useRef(void 0);y.current=(e="navigation")=>{if(!c||!h.current)return;const r=Math.round((Date.now()-g.current)/1e3),a=Array.from(d.current.values()).filter(v=>b(v)&&!m(v)).length;R(n,r,a,u,k.current,{abandonment_reason:e,completion_percentage:i()})};const S=t.useCallback((e="navigation")=>{y.current?.(e)},[]);return t.useEffect(()=>{!c&&l.current&&(clearTimeout(l.current),l.current=null)},[c]),t.useEffect(()=>()=>{l.current&&(clearTimeout(l.current),l.current=null),y.current?.("close")},[]),{trackFieldInteraction:F,trackValidationError:C,trackProgress:_,trackAbandonment:S,getCompletionPercentage:i}}export{P as u};
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.