(()=>{((i,Ve,kr,Sr=50,mt=50*1024,Ne=512*1024,_e=100,Tr=5*1024*1024,ve=50,ht=600*1e3,Er=2e3)=>{const gt=i.__lovableEvents||{};if(gt.__userAppEventsSdkVersion)return;const _=i.document,De=i.navigator||{},yt=De.webdriver===!0||!!i.Cypress||!!i.__nightmare,k=i.performance||{now:()=>Date.now()},M=i.location||{pathname:"",href:"",search:""},Z=()=>i.setTimeout||(typeof setTimeout=="function"?setTimeout:null),ee=()=>i.clearTimeout||(typeof clearTimeout=="function"?clearTimeout:null);if((e=>e==="/__codex_token_check"||e.startsWith("/__l5e/"))(M.pathname))return;const x=_&&_.currentScript,bt=x?{kind:x.getAttribute("data-artifact-kind")||null,id:x.getAttribute("data-artifact-id")||null,commit_sha:x.getAttribute("data-commit-sha")||null,context_token:x.getAttribute("data-context-token")||null}:{},_t=x?.getAttribute("data-replay")||null,wr=x?.getAttribute("data-track-url")||"/__l5e/trackevents",xr=x?.getAttribute("data-replay-url")||"/__l5e/replay",Rr=x?.getAttribute("data-replay-script-url")||"/__l5e/rrweb-record.js",vt=e=>{const t=typeof e=="string"?Number(e):0;return!Number.isFinite(t)||t<=0?0:t>=1?1:t},ze=vt(x?.getAttribute("data-replay-sample-rate")||null),qe=vt(x?.getAttribute("data-replay-crash-sample-rate")||null),Mr=x?.getAttribute("data-autocapture")==="1",kt=e=>{const t=new Uint8Array(e);if(i.crypto&&typeof i.crypto.getRandomValues=="function")i.crypto.getRandomValues(t);else for(let r=0;rArray.from(e,t=>t.toString(16).padStart(2,"0")).join(""),S=()=>{if(i.crypto&&typeof i.crypto.randomUUID=="function")return i.crypto.randomUUID();const e=kt(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=St(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},$e=e=>{const t=kt(e);return t.every(r=>r===0)&&(t[t.length-1]=1),St(t)},Tt=()=>({traceId:$e(16),rootSpanId:$e(8)}),Ge=S();let He=null,ke=S(),Je=0,te=Tt(),We=0,H=null;const Et=[1e4,3e4,6e4,3e5];let Ke=0,Se=null;const Lr=144e5;let Ye=0,Te=!1;const wt=18e5;let J=null,Ee=0,xt=0,re=!1;const Rt=(e=>{let t=2166136261;for(let r=0;r>>0)/4294967296})(Ge),V=ze>0&&Rt0&&Rte.replace(/[^\s]/gu,"*"),Ur=(e,t)=>{if(typeof t?.tagName=="string"&&t.tagName.toUpperCase()==="STYLE")return e;const r=t&&typeof t.closest=="function"?t.closest.bind(t):null;return r?.("[data-lovable-unmask]")?.matches?.(Fr)&&!r?.(`.rr-mask,${Pr}`)?e:It(e)},$=[];let ie=null,Ie=!1,At=!1,Pt=!1,W=!1,jt=0,Or=0;const Ct=Math.max(1,Sr),Br=5,Vr=200,Nr=/^project\.[a-z][a-z0-9_]{0,63}(\.[a-z][a-z0-9_]{0,63})*$/u,Dr=e=>{const t=kr[e];return typeof t=="number"&&t>0?t:Nr.test(e)?1:null},Ft=typeof TextEncoder=="function"?new TextEncoder:null,D=e=>Ft?Ft.encode(e).length:e.length,Ut=e=>JSON.stringify({envelope_schema_version:1,batch_id:S(),sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ve},automated:yt,artifact:bt,events:e}),Ot=e=>{const t=i.console;t&&typeof t.debug=="function"&&t.debug(`[lovable-analytics] ${e}`)},zr=(e,t)=>{if((e===403||e===404)&&t==="rejected"){Ie=!0,$.length=0,Pt||(Pt=!0,Ot(`events disabled for this page load (HTTP ${e})`));return}At||(At=!0,Ot(`event batch rejected (HTTP ${e})`))},Bt=64*1024,Vt=16*1024;let ce=0,Ze=0;const Nt=()=>{ce-=Ze,Ze=0},Dt=(e,t,r)=>{const n=D(t),l=Bt-(r.reserveBytes||0),a=!!r.keepalive&&ce+n<=l;a&&(ce+=n);let s=a;const m=()=>{s&&(s=!1,ce-=n)},b=i.Blob||(typeof Blob=="function"?Blob:null);if(a&&r.beacon&&De.sendBeacon&&b)try{if(De.sendBeacon(e,new b([t],{type:"application/json"}))){Ze+=n,s=!1;return}}catch{}const w=i.fetch||(typeof fetch=="function"?fetch:null);if(!w){m(),r.onNetworkError?.();return}try{Promise.resolve(w(e,{method:"POST",headers:{"content-type":"application/json"},body:t,...a?{keepalive:!0}:{}})).then(U=>{m(),r.onResponse?.(U)},()=>{m(),r.onNetworkError?.()}).catch(()=>{})}catch{m(),r.onNetworkError?.()}},qr=(e,t)=>{const r=e.filter(l=>{try{return JSON.stringify(l),!0}catch{return!1}});let n=0;for(;n=Vt?Math.min(mt,s):mt;for(;l-n>1&&D(a)>m;)l=n+Math.max(1,Math.floor((l-n)/2)),a=Ut(r.slice(n,l));Dt(wr,a,{keepalive:!0,beacon:t,onResponse:b=>{!b||b.ok!==!1||zr(b.status,b.headers?.get?.("x-lovable-events")??null)}}),n=l}},et=(e,t,r)=>g?JSON.stringify({envelope_schema_version:1,replay_schema_version:1,replay_id:g,chunk_id:t,chunk_sequence:r,sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ve},automated:yt,artifact:bt,session_id:Ge,page_view_id:ke,events:e}):null,$r=e=>{const t=et([e],"00000000-0000-4000-8000-000000000000",P);return!!t&&D(t)<=Ne},zt=e=>{const t=e&&typeof e=="object"?e:null;return typeof t?.type=="number"?t.type:null},tt=()=>Math.max(0,k.now()-Xe),qt=()=>{if(!le)return;const e=ee();e&&e(le),le=null},Ae=()=>{if(!xe)return;const e=ee();e&&e(xe),xe=null},rt=()=>{try{we?.()}catch{}finally{we=null,se=!1}},Gr=e=>{switch(e){case"recorder_script_failed":return"recorder_script";case"recorder_start_failed":return"recorder_start";case"recorder_runtime_error":return"recorder_runtime";case"missing_full_snapshot":case"full_snapshot_too_large":return"snapshot";case"upload_failed":return"upload";default:return null}},$t=(e,t,r,n,l,a)=>{const s=Gr(t);s&&E("lovable.replay_error",{replay_id:e,reason:t,stage:s,recorder:"rrweb",sample_rate:Lt,event_count:r,duration_ms:n,chunk_count:l,uploaded_bytes:a})},Hr=()=>!C||C==="sampled"?{}:{capture_reason:C,trigger_event_id:Me,trigger_event_name:Le},Gt=(e,t,r,n,l,a,s)=>{E("lovable.session_replay",{replay_id:e,status:t,reason:r,recorder:"rrweb",sample_rate:Lt,event_count:n,duration_ms:l,chunk_count:a,uploaded_bytes:s,...Hr()}),$t(e,r,n,l,a,s)},nt=(e,t)=>{g&&Gt(g,e,t,L,tt(),P,q)},ot=()=>j||C==="sampled",at=(e,t,r,n,l,a,s)=>{ot()?Gt(e,t,r,n,l,a,s):$t(e,r,n,l,a,s)},F=(e,t=!1)=>{!g||v||(rt(),Ae(),t&&(T.length=0,qt()),ot()&&nt("stopped",e),v=!0)},Ht=()=>{if(!(!g||v)){if(!j){rt(),Ae();return}F("duration_limit",!0)}},Jt=e=>{!g||v||C==="client_error"||(j=!0,C="client_error",Me=e,Le="lovable.client_error",Wt())},Jr=()=>T.length>0||P>0||q>0,Wt=()=>!g||v||C!=="client_error"||Qe||!N||!Jr()?!1:(Qe=!0,nt("captured","client_error"),K(!0),!0),Kt=e=>{if(oe>0){ae=e;return}F(e,!0)},Yt=()=>{if(oe--,v||oe>0||!ae)return;const e=ae;ae=null,ne>0?Xt():F(e,!0)},K=(e=!1)=>{if(qt(),!(!j||!g||T.length===0||!N))for(;!v&&T.length>0;){let t=Math.min(T.length,_e);const r=S(),n=P;let l=et(T.slice(0,t),r,n);for(;l&&t>1&&D(l)>Ne;)t=Math.max(1,Math.floor(t/2)),l=et(T.slice(0,t),r,n);if(!l)return;const a=D(l);if(a>Ne){T.shift(),L=Math.max(0,L-1);continue}const s=P-ne;if(s>=ve||q+a>Tr){Kt(s>=ve?"chunk_limit":"size_limit");return}if(T.splice(0,t),P++,q+=a,oe++,Dt(xr,l,{keepalive:e,reserveBytes:Vt,onResponse:m=>{const b=m?.status===429;if(b&&(ne++,q-=a,L=Math.max(0,L-t)),Yt(),b||m&&m.ok!==!1)return;const w=m?.headers?.get?.("x-lovable-events");F(w==="unavailable"?"upload_unavailable":w==="rejected"?"upload_rejected":"upload_failed",!0)},onNetworkError:()=>{F("upload_failed",!0),Yt()}}),v)return;if(P-ne>=ve){Kt("chunk_limit");return}}},Xt=()=>{if(le)return;const e=Z();if(!e){K();return}le=e(K,Er)},Wr=()=>{if(!ie)return;const e=ee();e&&e(ie),ie=null},Y=(e=!1)=>{if(Wr(),Ie||$.length===0)return;const t=$.splice(0,Ct);qr(t,e||W),$.length>0&&Qt()},Qt=()=>{if(ie||Ie)return;const e=Z();if(!e){Y();return}ie=e(Y,250)},Kr=()=>{H===null&&(H=k.now())},Pe=()=>{H=null},ue=()=>{const e=ee();Se!==null&&e&&e(Se),Se=null},Yr=()=>{if(H!==null){const t=k.now();We+=t-H,H=t}const e=Math.round(We);return We=0,e},pe=e=>{const t=Yr();if(t<=0)return;Ye+=t;const r=Ye>=Lr;r&&(Te=!0,Pe(),ue()),E("lovable.page_engagement",{reason:r?"capped":e,engagement_time_ms:t})},Zt=()=>{ue();const e=Z();if(!e)return;const t=Et[Math.min(Ke,Et.length-1)];Se=e(()=>{Ke++,pe("threshold"),!Te&&Zt()},t)},lt=()=>{const e=ee();J!==null&&(e&&e(J),Ee+=Math.max(0,k.now()-xt)),J=null},er=()=>{lt(),Ee=0},tr=()=>{if(J!==null||!_||_.visibilityState==="hidden"||_.hasFocus?.()!==!1)return;const e=Z();e&&(xt=k.now(),J=e(()=>{J=null,Ee=wt,re=!0,pe("unfocused"),Pe(),ue()},Math.max(0,wt-Ee)))},fe=()=>{_&&_.visibilityState==="hidden"||re||Te||(Kr(),Ke=0,Zt(),tr())},rr=()=>(pe("navigation"),Ye=0,Te=!1,fe(),ke=S(),te=Tt(),Je=0,ke),Xr=e=>e==="lovable.page_viewed"?{trace_id:te.traceId,span_id:te.rootSpanId}:{trace_id:te.traceId,span_id:$e(8),parent_span_id:te.rootSpanId},Qr=e=>e==="lovable.client_error"||e==="lovable.resource_error"||e==="lovable.replay_error",Zr=(e,t,r={})=>{if(Ie)return null;if(Qr(e)&&++Or>Vr)return e==="lovable.client_error"&&Jt(null),null;const n=e==="lovable.client_error"&&jt=Ct?Y():Qt(),l},E=(e,t={})=>{const r=typeof e=="string"?Dr(e):null;return r===null?null:Zr(e,r,t)};let de=M.pathname;const en=(e,t={})=>(e==="lovable.page_viewed"&&(rr(),typeof t.url_path=="string"&&(de=t.url_path)),E(e,t)),tn=/(^|[^a-z0-9_.-])([a-z0-9_.-]*(token|secret|password|passwd|key)|token_hash|code|email)(=|%3d)/iu,st=e=>tn.test(e)?"/":e,it=e=>{try{const t=new URL(e,M.href);return t.protocol==="http:"||t.protocol==="https:"?st(t.pathname):t.pathname}catch{return null}},nr=e=>{try{return new URL(e,M.href).host.replace(/^www\./iu,"")}catch{return null}},rn=e=>{try{return new URL(e,M.href).protocol.replace(/:$/u,"")}catch{return null}},nn=[["utm_source","campaign_source"],["utm_medium","campaign_medium"],["utm_campaign","campaign_name"],["utm_term","campaign_term"],["utm_content","campaign_content"],["utm_id","campaign_id"]],on=[["gclid"],["dclid"],["gbraid"],["wbraid"],["msclkid"],["ttclid"],["twclid"],["li_fat_id"],["fbclid"],["oppref"],["ko_click_id"],["irclickid","im_ref"],["via"]],an=128,ln=(e,t)=>{const r={};try{const n=new URLSearchParams(typeof e=="string"?e.replace(/;/gu,"&"):"");for(const[s,m]of nn){const b=n.get(s);if(typeof b!="string")continue;const w=b.trim();w&&D(w)<=an&&(r[m]=w)}const l=s=>{const m=n.get(s);return typeof m=="string"&&m.trim()!==""},a=on.filter(s=>s.some(l)).map(([s])=>s);if(!a.includes("via")&&typeof t=="string"){const s=new URLSearchParams(t.slice(1)).get("via");typeof s=="string"&&s.trim()!==""&&a.push("via")}a.length>0&&(r.campaign_click_id_types=a)}catch{return{}}return r},or=(e,t)=>{let r=e;for(;r&&D(JSON.stringify(r))>t;)r=r.slice(0,Math.floor(r.length*.8));return r},me=(e,t)=>{if(typeof e!="string")return null;const r=e.replace(/\s+/gu," ").trim();if(!r)return null;if(r.length<=t)return r;const n=Array.from(r);return n.length>t?n.slice(0,t).join(""):r},sn=2048,ar=()=>me(st(M.pathname||"/"),sn)||"/",ct=e=>{const t=e&&typeof e=="object"?e:null,r=a=>typeof a=="string"?a:typeof a=="number"||typeof a=="boolean"||typeof a=="bigint"?String(a):null,n=r(t?.stack),l=r(t?.message)||r(e)||"Unknown error";return{message:or(l.slice(0,2e3),2048),name:r(t?.name),stack:n?or(n.slice(0,8e3),8192):null}},lr=1e3,cn=1e4,sr=10,je=new Map,he=[],ir=(e,t)=>{for(const[r,n]of je)t-n>=lr&&je.delete(r);je.set(e,t)},ut=(e,t=!0)=>{t&&rr();const r=M.pathname,n={url_path:st(r),navigation_type:e};typeof _?.referrer=="string"&&_.referrer&&(n.referrer_host=nr(_.referrer)??"",n.referrer_path=it(_.referrer)??""),Object.assign(n,ln(M.search,M.hash)),de=r,ir(r,k.now()),E("lovable.page_viewed",n)},pt=e=>{M.pathname!==de&&ut(e)},un=()=>{const e=M.pathname;if(e===de)return;const t=k.now(),r=je.get(e);if(r!==void 0&&t-rsr+1&&he.shift(),he.length>sr&&t-he[0]{const e=_t==="rrweb"&&Mt&&i.rrweb&&typeof i.rrweb.record=="function"?i.rrweb.record:null;if(!(!e||g)){g=S(),Xe=k.now(),v=!1,P=0,ne=0,oe=0,ae=null,q=0,se=!1,N=!1,j=V,C=V?"sampled":null,Me=null,Le=null,Qe=!1;try{const t=e({emit(n){if(v||!n||typeof n!="object")return;if(tt()>=ht){Ht();return}const l=zt(n);if(!$r(n)){l===2&&!N&&F("full_snapshot_too_large",!0);return}if(!(l===3&&!N)){for(l===2&&(N=!0),L+=1,T.push(n);!j&&T.length>Ar;){const a=T.findIndex(s=>zt(s)!==2);T.splice(a>=0?a:0,1),L=Math.max(0,L-1)}Wt()||j&&(T.length>=_e?K():Xt())}},blockClass:"rr-block",blockSelector:jr,collectFonts:!1,ignoreClass:"rrweb-ignore",ignoreSelector:Cr,inlineImages:!1,maskAllInputs:!0,maskInputFn:It,maskInputOptions:{checkbox:!1,color:!1,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,radio:!1,range:!1,search:!0,select:!0,tel:!0,text:!0,textarea:!0,time:!0,url:!0,week:!0},maskTextClass:"rr-mask",maskTextFn:Ur,maskTextSelector:"*",recordAfter:"load",recordCanvas:!1,recordCrossOriginIframes:!1});if(v){if(typeof t=="function")try{t()}catch{}return}se=!0,typeof t=="function"&&(we=t);const r=Z();r&&typeof e.takeFullSnapshot=="function"&&r(()=>{if(!(!g||v))try{e.takeFullSnapshot?.(!1)}catch{}},1e3),r&&(xe=r(Ht,ht)),ot()&&nt("started","recorder_available")}catch{g&&at(g,"stopped","recorder_start_failed",L,tt(),P,q),g=null,L=0,Xe=0,v=!1,N=!1,j=V,C=V?"sampled":null,Me=null,Le=null,we=null,se=!1,Ae()}}},pn=()=>{if(_t!=="rrweb"||!Mt||g||Re)return;if(i.rrweb&&typeof i.rrweb.record=="function"){cr();return}const e=_?.head;if(!_?.createElement||!e?.appendChild)return;const t=_.createElement("script");Re=!0,t.async=!0,t.src=Rr,t.onload=()=>{if(Re=!1,!i.rrweb||typeof i.rrweb.record!="function"){at(S(),"stopped","recorder_script_failed",0,0,0,0);return}cr()},t.onerror=()=>{Re=!1,at(S(),"stopped","recorder_script_failed",0,0,0,0)},e.appendChild(t)},fn=e=>{if(!(!g||v)){if(rt(),Ae(),!N){F("missing_full_snapshot",!0);return}K(!0),v||F(e)}},dn=e=>{if(!g||v)return;const t=e&&typeof e=="object"?e:null,r=t?.error&&typeof t.error=="object"?t.error:null,n=typeof t?.filename=="string"?t.filename:"",l=typeof r?.stack=="string"?r.stack:"";(n.includes("/__l5e/rrweb-record")||l.includes("/__l5e/rrweb-record"))&&F("recorder_runtime_error",!0)},mn=(e,t)=>{const n={CLS:[.1,.25],FCP:[1800,3e3],INP:[200,500],LCP:[2500,4e3],TTFB:[800,1800]}[e];return!n||t<=n[0]?"good":t<=n[1]?"needs-improvement":"poor"},hn=e=>e==="CLS"?"score":"millisecond",I=(e,t)=>{const r=e[t];return typeof r=="number"&&Number.isFinite(r)?r:null},Ce=(e,t)=>{const r=i.PerformanceObserver;if(!r)return!1;const n=r.supportedEntryTypes;if(Array.isArray(n)&&!n.includes(e))return!1;try{return new r(a=>{const s=typeof a.getEntries=="function"?a.getEntries():[];for(const m of s)m&&typeof m=="object"&&t(m)}).observe(e==="event"?{type:e,buffered:!0,durationThreshold:40}:{type:e,buffered:!0}),!0}catch{return!1}},gn=()=>{const e=ar(),t=(u,f,A=f,ft=S())=>{!Number.isFinite(f)||f<0||E("lovable.web_vital",{url_path:e,metric:u,value:f,unit:hn(u),delta:A,rating:mn(u,f),id:ft,navigation_type:"initial_load"})};let r=!1,n=null,l=0,a=0,s=!1;const m={},b={},w=u=>(m[u]=m[u]||S(),m[u]),U=(u,f)=>{if(b[u]===f)return;const A=b[u];b[u]=f,t(u,f,A===void 0?f:f-A,w(u))},ge=typeof k.getEntriesByType=="function"?k.getEntriesByType("navigation"):[],O=ge[0]&&typeof ge[0]=="object"?ge[0]:null,B=O?I(O,"responseStart"):null,Fe=O?I(O,"requestStart"):null,Ue=O?I(O,"fetchStart"):null,X=Fe??Ue;B!==null&&X!==null&&B>=X&&t("TTFB",B-X),Ce("paint",u=>{if(r||u.name!=="first-contentful-paint")return;const f=I(u,"startTime");f!==null&&(r=!0,t("FCP",f))}),Ce("largest-contentful-paint",u=>{n=I(u,"startTime")??I(u,"renderTime")??I(u,"loadTime")??n});const Oe=Ce("layout-shift",u=>{if(u.hadRecentInput===!0)return;const f=I(u,"value");f!==null&&(l+=f)});return Ce("event",u=>{const f=I(u,"interactionId");if(f===null||f<=0)return;const A=I(u,"duration");A!==null&&A>a&&(a=A)}),(u=!1)=>{s||(n!==null&&U("LCP",n),Oe&&U("CLS",l),a>0&&U("INP",a),u&&(s=!0))}},ur=(e,t)=>{const r=i.history,n=r&&r[e];!r||typeof n!="function"||(r[e]=function(...l){const a=n.apply(this,l);return t(),a})},yn=e=>{const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=typeof t.mechanism=="string"?t.mechanism:"manual",n=typeof t.severity=="string"?t.severity:"error";return{mechanism:["manual","onerror","unhandledrejection","react_error_boundary"].includes(r)?r:"manual",handled:typeof t.handled=="boolean"?t.handled:!0,severity:["error","warning","info"].includes(n)?n:"error"}};i.__lovableEvents=Object.assign(gt,{__userAppEventsSdkVersion:Ve,track:en,flush:()=>Y(),identify(e){const t=e&&typeof e=="object"?e:null;He=typeof t?.user_id=="string"?t.user_id:null},getIdentity(){return{app_user_id_hash_available:!!He}},getReplay(){return{replay_id:g,active:!!g&&!v&&se,event_count:L}},resetIdentity(){He=null},captureException(e,t={},r={}){const n=ct(e),l=yn(r);let a=t&&typeof t=="object"&&!Array.isArray(t)?t:{};try{D(JSON.stringify(a))>4096&&(a={})}catch{a={}}E("lovable.client_error",{occurrence_id:S(),...n,...l,context:a})},startSpan(e,t={}){const r=new Date().toISOString(),n=k.now();return{end(l="ok"){E("lovable.frontend_span",{name:e,start_time:r,status:l,duration_ms:Math.max(0,k.now()-n),attributes:t})}}}}),i.addEventListener&&i.addEventListener("error",dn,!0),pn();const pr=gn();if(i.addEventListener&&(i.addEventListener("error",e=>{const t=e&&typeof e=="object"?e:null,r=t?.target&&typeof t.target=="object"?t.target:null;let n=null;if(r&&r!==i&&(typeof r.src=="string"?n=r.src:typeof r.href=="string"&&(n=r.href)),n!==null){const a=typeof r?.tagName=="string"?r.tagName.toLowerCase():"unknown",s=nr(n);E("lovable.resource_error",{resource_type:a,url_host:s||rn(n)||"unknown",failure_type:"load_error",element:a,url_path:s?it(n):null,mechanism:"resource_load",handled:!1,severity:"error"});return}const l=ct(t?.error||t?.message);E("lovable.client_error",{occurrence_id:S(),...l,filename:typeof t?.filename=="string"?it(t.filename):null,lineno:typeof t?.lineno=="number"?t.lineno:null,colno:typeof t?.colno=="number"?t.colno:null,mechanism:"onerror",handled:!1,severity:"error"})},!0),i.addEventListener("unhandledrejection",e=>{const r=ct((e&&typeof e=="object"?e:null)?.reason);E("lovable.client_error",{occurrence_id:S(),...r,mechanism:"unhandledrejection",handled:!1,severity:"error"})}),i.addEventListener("pagehide",()=>{W=!0,pr(!0),fn("pagehide"),pe("pagehide"),Pe(),ue(),lt(),Y(!0)}),i.addEventListener("blur",()=>tr()),i.addEventListener("focus",()=>{er(),re&&(re=!1,fe())}),i.addEventListener("pageshow",e=>{(e&&typeof e=="object"?e.persisted:!1)===!0&&(W=!1,Nt(),er(),re=!1,fe())}),i.addEventListener("popstate",()=>pt("popstate")),i.addEventListener("hashchange",()=>pt("hashchange")),Mr)){const b={select:!0,textarea:!0,input:!0},w={button:!0,a:!0,input:!0,select:!0,textarea:!0,summary:!0},U={button:!0,link:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,tab:!0,switch:!0,checkbox:!0,radio:!0,option:!0},ge={header:!0,footer:!0,main:!0,nav:!0,aside:!0,section:!0,article:!0,form:!0},O=typeof Symbol<"u"&&typeof Symbol.for=="function"?Symbol.for("__jsxSource__"):null,B=o=>o&&typeof o=="object"&&typeof o.tagName=="string"?o:null,Fe={};for(const o of"html body div span main header footer nav aside section article form p a button input select textarea label fieldset legend optgroup option datalist output progress meter ul ol li dl dt dd table thead tbody tfoot tr td th caption col colgroup h1 h2 h3 h4 h5 h6 br hr pre blockquote figure figcaption small strong em b i u s q cite abbr code kbd samp var mark sub sup time address details summary dialog menu picture source track canvas iframe object embed param map area img video audio template slot noscript script style link meta title base head ins del ruby rt rp bdi bdo wbr data hgroup search fencedframe svg path g circle rect line polyline polygon ellipse text textpath tspan defs use symbol clippath mask pattern lineargradient radialgradient stop filter foreignobject marker image view desc animate animatetransform animatemotion set fegaussianblur feoffset feblend fecolormatrix fecomposite feflood femerge femergenode femorphology fetile feturbulence fedropshadow fedisplacementmap".split(" "))Fe[o]=!0;const Ue={};for(const o of"button link menuitem menuitemcheckbox menuitemradio tab switch checkbox radio option combobox listbox textbox searchbox slider spinbutton treeitem gridcell row columnheader rowheader tooltip dialog alertdialog navigation main banner contentinfo complementary region form search article list listitem table grid tree menu menubar toolbar tabpanel tablist progressbar status alert log timer none presentation".split(" "))Ue[o]=!0;const X={};for(const o of"button submit reset checkbox radio text password email number tel url search date time datetime-local month week color file range hidden image".split(" "))X[o]=!0;const Oe=(o,c)=>o!==null&&c[o.toLowerCase()]===!0?o.toLowerCase():null,u=o=>{const c=String(o.tagName).toLowerCase();return Fe[c]===!0?c:"x"},f=(o,c)=>{if(typeof o.getAttribute!="function")return null;const d=o.getAttribute(c);return typeof d=="string"&&d!==""?d:null},A=(o,c)=>typeof o.getAttribute=="function"&&typeof o.getAttribute(c)=="string",ft=o=>{if(b[u(o)]===!0)return null;const c=o.childNodes;if(!c||typeof c.length!="number")return null;const d=c;let p="";for(let y=0;y200)return null}return p===""?null:p},bn=o=>me(f(o,"aria-label")||f(o,"title")||f(o,"alt")||ft(o),64),_n=(o,c,d)=>{const p=o.children;if(!p||typeof p.length!="number")return"";const y=p;let h=0,R=0;for(let z=0;z0?":"+h:""},vn=o=>{const c=[];let d=o;for(let y=0;d&&y<32;y++){const h=u(d);if(!h||h==="html")break;const R=B(d.parentElement);if(c.unshift(R&&h!=="body"?h+_n(R,d,h):h),h==="body"||!R)break;d=R}if(c.length===0)return null;let p=c.join(">");for(;p.length>1024&&c.length>1;)c.shift(),p=c.join(">");return p.length>1024?p.slice(p.length-1024):p},kn=o=>{if(O===null)return null;const c=o[O];if(!c||typeof c!="object")return null;const d=c.displayName;return typeof d=="string"&&d!==""?d:null},Sn=o=>{if(w[u(o)]===!0)return!0;const c=f(o,"role");return c!==null&&U[c.toLowerCase()]===!0},Tn=(o,c)=>{const d=typeof o.composedPath=="function"?o.composedPath():null;if(Array.isArray(d)){const h=[];for(const R of d){if(h.length>=c)return{nodes:h,complete:!1};const z=B(R);z&&h.push(z)}return{nodes:h,complete:!0}}const p=[];let y=B(o.target);for(;y;){if(p.length>=c)return{nodes:p,complete:!1};p.push(y),y=B(y.parentElement)}return{nodes:p,complete:!0}},fr=o=>o==="mouse"||o==="touch"||o==="pen",En=2e3,wn=300;let dt="",dr=0;const mr=o=>dt!==""&&k.now()-dr<=o?dt:"";i.addEventListener("pointerdown",o=>{try{const c=o;if(c.isTrusted!==!0)return;const d=typeof c.pointerType=="string"?c.pointerType:"";fr(d)&&(dt=d,dr=k.now())}catch{}},!0);const hr=o=>Math.round(o*1e3)/1e3,ye=o=>typeof o=="number"&&isFinite(o)?o:null;i.addEventListener("click",o=>{try{if(!o||typeof o!="object")return;const c=o;if(c.isTrusted!==!0||Je>=200)return;const d=Tn(c,512);if(!d.complete)return;let p=null,y=null;for(let Be=0;Be=32)){if(p===null){Sn(be)&&(p=be);continue}y===null&&ge[u(be)]===!0&&(y=be)}}if(p===null)return;const h=typeof c.pointerType=="string"?c.pointerType:"",R=ye(c.detail)??0,z=R===0?mr(wn):"",Q=fr(h)?h:z||(R===0?"keyboard":mr(En)||"unknown");let gr=null,yr=null;const br=ye(c.clientX),_r=ye(c.clientY),G=typeof p.getBoundingClientRect=="function"?p.getBoundingClientRect():null;Q!=="keyboard"&&G&&br!==null&&_r!==null&&G.width>0&&G.height>0&&(gr=hr(Math.min(1,Math.max(0,(br-G.left)/G.width))),yr=hr(Math.min(1,Math.max(0,(_r-G.top)/G.height))));const vr=i;E("lovable.element_clicked",{url_path:ar(),element_tag:u(p),interaction_type:Q,element_role:Oe(f(p,"role"),Ue),element_type:Oe(f(p,"type"),X),element_label:bn(p),element_path:vn(p),component_name:me(kn(p),64),section_tag:y?me(u(y),64):null,section_label:y?me(f(y,"aria-label"),64):null,offset_x:gr,offset_y:yr,viewport_width:ye(vr.innerWidth),viewport_height:ye(vr.innerHeight)}),Je++}catch{}},!0)}_&&typeof _.addEventListener=="function"&&_.addEventListener("visibilitychange",()=>{if(_.visibilityState==="hidden"){W=!0,pr(),K(!0),pe("hidden"),Pe(),ue(),lt(),Y(!0),W=!1;return}W=!1,Nt(),fe()}),ur("pushState",()=>pt("push_state")),ur("replaceState",un),E("lovable.session_started",{reason:"new_session"}),ut("initial_load",!1),fe()})(window, "0.3.0-automated-flag", {"lovable.webmcp_tool_invoked":1,"lovable.session_started":1,"lovable.page_viewed":1,"lovable.client_error":1,"lovable.frontend_span":1,"lovable.interaction":1,"lovable.element_clicked":1,"lovable.form_submitted":1,"lovable.resource_error":1,"lovable.session_replay":1,"lovable.replay_error":1,"lovable.web_vital":1,"lovable.page_engagement":1}, 50, 51200, 524288, 100, 5242880, 50, 600000, 2000);})();