(()=>{((c,Ye,Kr,Xr=50,Pt=50*1024,Qe=512*1024,Le=100,Yr=5*1024*1024,Ie=50,jt=600*1e3,Qr=2e3)=>{const Ft=c.__lovableEvents||{};if(Ft.__userAppEventsSdkVersion)return;const p=c.document,ce=c.navigator||{},Ut=ce.webdriver===!0||!!c.Cypress||!!c.__nightmare,T=c.performance||{now:()=>Date.now()},I=c.location||{pathname:"",href:"",search:""},Z=()=>c.setTimeout||(typeof setTimeout=="function"?setTimeout:null),ue=()=>c.clearTimeout||(typeof clearTimeout=="function"?clearTimeout:null),Ot=()=>c.fetch||(typeof fetch=="function"?fetch:null);if((e=>e==="/__codex_token_check"||e.startsWith("/__l5e/"))(I.pathname))return;const x=p&&p.currentScript,Nt=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}:{},Vt=x?.getAttribute("data-replay")||null,Ze=(()=>{try{const e=new URL(x?.src||"").pathname,t=e.lastIndexOf("/__l5e/");return t>0?e.slice(0,t):""}catch{return""}})(),Zr=x?.getAttribute("data-track-url")||`${Ze}/__l5e/trackevents`,en=x?.getAttribute("data-replay-url")||`${Ze}/__l5e/replay`,tn=x?.getAttribute("data-replay-script-url")||`${Ze}/__l5e/rrweb-record.js`,Bt=e=>{const t=typeof e=="string"?Number(e):0;return!Number.isFinite(t)||t<=0?0:t>=1?1:t},et=Bt(x?.getAttribute("data-replay-sample-rate")||null),tt=Bt(x?.getAttribute("data-replay-crash-sample-rate")||null),rn=x?.getAttribute("data-autocapture")==="1",rt=x?.getAttribute("data-consent")==="1";let fe=null,nt=!1,Pe=!1;const Dt=e=>{const t=new Uint8Array(e);if(c.crypto&&typeof c.crypto.getRandomValues=="function")c.crypto.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);return t},$t=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join(""),R=()=>{if(c.crypto&&typeof c.crypto.randomUUID=="function")return c.crypto.randomUUID();const e=Dt(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=$t(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},ot=e=>{const t=Dt(e);return t.every(r=>r===0)&&(t[t.length-1]=1),$t(t)},zt=()=>({traceId:ot(16),rootSpanId:ot(8)}),at=R();let st=null,je=R(),lt=0,de=zt(),it=0,ee=null;const qt=[1e4,3e4,6e4,3e5];let ct=0,Fe=null;const nn=144e5;let ut=0,Ue=!1;const Ht=18e5;let te=null,Oe=0,Wt=0,pe=!1;const Jt=(e=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0)/4294967296})(at),z=et>0&&Jt<et,on=tt>0&&Jt<tt,Gt=z||on,Kt=z?et:tt;let b=null,j=0,ft=0,k=!1,Ne=null,V=0,he=0,me=0,ge=null,X=0,ye=null,Ve=null,be=!1,Be=!1,q=!1,B=z,D=z?"sampled":null,De=null,$e=null,dt=!1;const M=[],an=Math.max(Le,Le*Ie),sn=["[data-lovable-mask]","[data-sensitive]","[data-private]","[data-auth]","[data-payment]","[contenteditable]","[autocomplete]","[name*='email' i]","[name*='phone' i]","[name*='address' i]","[name*='token' i]","[name*='secret' i]"].join(","),ln=["canvas","embed","iframe","object","video","[data-lovable-block]",".rr-block","[data-payment]","[data-auth]","[data-private]"].join(","),cn="[data-lovable-ignore],.rrweb-ignore",un="h1,h2,h3,h4,h5,h6,p,span,a,button,li,label,dt,dd,th,figcaption,small,strong,em",Xt=e=>e.replace(/[^\s]/gu,"*"),fn=(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?.(un)&&!r?.(`.rr-mask,${sn}`)?e:Xt(e)},F=[],O=[],re=[],dn=500;let pt=null;const Yt=1800;let ht=Yt,ze=null;const ne=new Map,Qt=new WeakSet,Zt=new WeakSet;let mt=0,er=0,tr=!1,_e=null,ve=!1,rr=!1,nr=!1,Y=!1,or=0,pn=0;const gt=Math.max(1,Xr),hn=5,mn=200,gn=/^project\.[a-z][a-z0-9_]{0,63}(\.[a-z][a-z0-9_]{0,63})*$/u,yn=e=>{const t=Kr[e];return typeof t=="number"&&t>0?t:gn.test(e)?1:null},ar=typeof TextEncoder=="function"?new TextEncoder:null,H=e=>ar?ar.encode(e).length:e.length,sr=e=>JSON.stringify({envelope_schema_version:1,batch_id:R(),sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ye},automated:Ut,artifact:Nt,events:e}),lr=e=>{const t=c.console;t&&typeof t.debug=="function"&&t.debug(`[lovable-analytics] ${e}`)},bn=(e,t)=>{if((e===403||e===404)&&t==="rejected"){ve=!0,F.length=0,O.length=0,re.length=0,nr||(nr=!0,lr(`events disabled for this page load (HTTP ${e})`));return}rr||(rr=!0,lr(`event batch rejected (HTTP ${e})`))},ir=64*1024,cr=16*1024;let ke=0,yt=0;const ur=()=>{ke-=yt,yt=0},fr=(e,t,r)=>{const n=H(t),s=ir-(r.reserveBytes||0),o=!!r.keepalive&&ke+n<=s;o&&(ke+=n);let a=o;const i=()=>{a&&(a=!1,ke-=n)},h=c.Blob||(typeof Blob=="function"?Blob:null);if(o&&r.beacon&&ce.sendBeacon&&h)try{if(ce.sendBeacon(e,new h([t],{type:"application/json"}))){yt+=n,a=!1;return}}catch{}const y=Ot();if(!y){i(),r.onNetworkError?.();return}try{Promise.resolve(y(e,{method:"POST",headers:{"content-type":"application/json"},body:t,...o?{keepalive:!0}:{}})).then(S=>{i(),r.onResponse?.(S)},()=>{i(),r.onNetworkError?.()}).catch(()=>{})}catch{i(),r.onNetworkError?.()}},_n=()=>{if(nt)return;nt=!0;const e=r=>{fe=r,Pe=!0,(O.length>0||re.length>0)&&W()},t=Ot();if(!t){Pe=!0;return}try{Promise.resolve(t("/cdn-cgi/trace",{})).then(r=>r&&r.ok?r.text():"").then(r=>{const n=typeof r=="string"?r:"",s=/^h=(.+)$/m.exec(n)?.[1]?.trim().toLowerCase().replace(/:\d+$/,"");if(!s||s!==(I.hostname||"").toLowerCase())return e(null);const o=/^loc=([A-Z0-9]{2})$/m.exec(n)?.[1]??null;e(o==="XX"||o==="T1"?null:o)}).catch(()=>e(null))}catch{e(null)}},dr=(e,t)=>{const r=e.filter(s=>{try{return JSON.stringify(s),!0}catch{return!1}});let n=0;for(;n<r.length;){let s=r.length,o=sr(r.slice(n,s));const a=ir-ke,i=t&&a>=cr?Math.min(Pt,a):Pt;for(;s-n>1&&H(o)>i;)s=n+Math.max(1,Math.floor((s-n)/2)),o=sr(r.slice(n,s));fr(Zr,o,{keepalive:!0,beacon:t,onResponse:h=>{!h||h.ok!==!1||bn(h.status,h.headers?.get?.("x-lovable-events")??null)}}),n=s}},bt=(e,t,r)=>b?JSON.stringify({envelope_schema_version:1,replay_schema_version:1,replay_id:b,chunk_id:t,chunk_sequence:r,sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ye},automated:Ut,artifact:Nt,session_id:at,page_view_id:je,events:e}):null,vn=e=>{const t=bt([e],"00000000-0000-4000-8000-000000000000",V);return!!t&&H(t)<=Qe},pr=e=>{const t=e&&typeof e=="object"?e:null;return typeof t?.type=="number"?t.type:null},_t=()=>Math.max(0,T.now()-ft),hr=()=>{if(!ye)return;const e=ue();e&&e(ye),ye=null},qe=()=>{if(!Ve)return;const e=ue();e&&e(Ve),Ve=null},vt=()=>{try{Ne?.()}catch{}finally{Ne=null,be=!1}},kn=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}},mr=(e,t,r,n,s,o)=>{const a=kn(t);a&&C("lovable.replay_error",{replay_id:e,reason:t,stage:a,recorder:"rrweb",sample_rate:Kt,event_count:r,duration_ms:n,chunk_count:s,uploaded_bytes:o})},Sn=()=>!D||D==="sampled"?{}:{capture_reason:D,trigger_event_id:De,trigger_event_name:$e},gr=(e,t,r,n,s,o,a)=>{C("lovable.session_replay",{replay_id:e,status:t,reason:r,recorder:"rrweb",sample_rate:Kt,event_count:n,duration_ms:s,chunk_count:o,uploaded_bytes:a,...Sn()}),mr(e,r,n,s,o,a)},kt=(e,t)=>{b&&gr(b,e,t,j,_t(),V,X)},St=()=>B||D==="sampled",Et=(e,t,r,n,s,o,a)=>{St()?gr(e,t,r,n,s,o,a):mr(e,r,n,s,o,a)},$=(e,t=!1)=>{!b||k||(vt(),qe(),t&&(M.length=0,hr()),St()&&kt("stopped",e),k=!0)},yr=()=>{if(!(!b||k)){if(!B){vt(),qe();return}$("duration_limit",!0)}},br=e=>{!b||k||D==="client_error"||(B=!0,D="client_error",De=e,$e="lovable.client_error",_r())},En=()=>M.length>0||V>0||X>0,_r=()=>!b||k||D!=="client_error"||dt||!q||!En()?!1:(dt=!0,kt("captured","client_error"),oe(!0),!0),vr=e=>{if(me>0){ge=e;return}$(e,!0)},kr=()=>{if(me--,k||me>0||!ge)return;const e=ge;ge=null,he>0?Sr():$(e,!0)},oe=(e=!1)=>{if(hr(),!(!B||!b||M.length===0||!q))for(;!k&&M.length>0;){let t=Math.min(M.length,Le);const r=R(),n=V;let s=bt(M.slice(0,t),r,n);for(;s&&t>1&&H(s)>Qe;)t=Math.max(1,Math.floor(t/2)),s=bt(M.slice(0,t),r,n);if(!s)return;const o=H(s);if(o>Qe){M.shift(),j=Math.max(0,j-1);continue}const a=V-he;if(a>=Ie||X+o>Yr){vr(a>=Ie?"chunk_limit":"size_limit");return}if(M.splice(0,t),V++,X+=o,me++,fr(en,s,{keepalive:e,reserveBytes:cr,onResponse:i=>{const h=i?.status===429;if(h&&(he++,X-=o,j=Math.max(0,j-t)),kr(),h||i&&i.ok!==!1)return;const y=i?.headers?.get?.("x-lovable-events");$(y==="unavailable"?"upload_unavailable":y==="rejected"?"upload_rejected":"upload_failed",!0)},onNetworkError:()=>{$("upload_failed",!0),kr()}}),k)return;if(V-he>=Ie){vr("chunk_limit");return}}},Sr=()=>{if(ye)return;const e=Z();if(!e){oe();return}ye=e(oe,Qr)},Tn={"lovable.session_started":!0,"lovable.page_viewed":!0,"lovable.page_engagement":!0,"lovable.web_vital":!0,"lovable.client_error":!0,"lovable.resource_error":!0},wn=(e,t)=>{if(e==null)return 0;const r=(Array.isArray(e)?e:[e]).map(n=>String(n).toUpperCase());return fe&&r.includes(fe)?1:t!=="denied"?-1:fe?r.some(n=>n.startsWith(`${fe}-`))?2:-1:1},ae=()=>{try{if(ce.globalPrivacyControl===!0)return"denied";const e=c.dataLayer;let t=null;for(let a=0;Array.isArray(e)&&a<e.length;a++){const i=e[a];if(!i||typeof i!="object"||i[0]!=="consent")continue;const h=i[2],y=h&&typeof h=="object"?h.analytics_storage:null;if(!(y!=="granted"&&y!=="denied")){if(i[1]==="update")t=y,Zt.has(i)||(Zt.add(i),mt++);else if(i[1]==="default"&&!Qt.has(i)){Qt.add(i);const S=h?.region,N=S==null?"":JSON.stringify((Array.isArray(S)?S:[S]).map(J=>String(J).toUpperCase()).sort());ne.delete(N),ne.set(N,{region:S,value:y}),ne.size>100&&ne.delete(ne.keys().next().value)}}}if(ze=t??ze,ze)return ze;const r=Array.from(ne.values()),n=a=>a.region!==void 0&&a.region!==null;r.some(n)&&(r.some(a=>a.value!==r[0].value)||r.every(n)&&r[0].value==="denied")&&_n();let s=null,o=-1;for(const a of r){const i=wn(a.region,a.value);i>=0&&i>=o&&(o=i,s=a.value)}return s??(tr?"denied":null)}catch{return tr=!0,"denied"}},Er=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return null}},Tt=e=>{const t=e.properties;return t.context===void 0?e:{...e,properties:{...t,context:{}}}},xn=()=>{if(re.length===0)return;const e=ae()==="denied";for(const t of re.splice(0))F.push(e?Tt(t):t)},Rn=()=>{O.length===0||ae()==="denied"||F.unshift(...O.splice(0,O.length))},Tr=()=>{ht=Yt},wr=()=>ht<0,xr=()=>{if(pt)return;if(ht--<=0){O.length=0,er=mt;return}const e=Z();e&&(pt=e(()=>{if(pt=null,!ve){if(ae()==="denied"){O.length>0&&xr();return}Tr(),O.length>0&&W()}},1e3))},Mn=()=>{if(!_e)return;const e=ue();e&&e(_e),_e=null},W=(e=!1)=>{if(Mn(),re.length>0&&(Pe||e||Y||ae()!=="denied")&&xn(),Rn(),ve||F.length===0)return;if(e||Y){for(;F.length>0;)dr(F.splice(0,gt),!0);return}const t=F.splice(0,gt);dr(t,!1),F.length>0&&Rr()},Rr=()=>{if(_e||ve)return;const e=Z();if(!e){W();return}_e=e(W,250)},Cn=()=>{ee===null&&(ee=T.now())},He=()=>{ee=null},Se=()=>{const e=ue();Fe!==null&&e&&e(Fe),Fe=null},An=()=>{if(ee!==null){const t=T.now();it+=t-ee,ee=t}const e=Math.round(it);return it=0,e},Ee=e=>{const t=An();if(t<=0)return;ut+=t;const r=ut>=nn;r&&(Ue=!0,He(),Se()),C("lovable.page_engagement",{reason:r?"capped":e,engagement_time_ms:t})},Mr=()=>{Se();const e=Z();if(!e)return;const t=qt[Math.min(ct,qt.length-1)];Fe=e(()=>{ct++,Ee("threshold"),!Ue&&Mr()},t)},wt=()=>{const e=ue();te!==null&&(e&&e(te),Oe+=Math.max(0,T.now()-Wt)),te=null},Cr=()=>{wt(),Oe=0},Ar=()=>{if(te!==null||!p||p.visibilityState==="hidden"||p.hasFocus?.()!==!1)return;const e=Z();e&&(Wt=T.now(),te=e(()=>{te=null,Oe=Ht,pe=!0,Ee("unfocused"),He(),Se()},Math.max(0,Ht-Oe)))},Te=()=>{p&&p.visibilityState==="hidden"||pe||Ue||(Cn(),ct=0,Mr(),Ar())},Lr=()=>(Ee("navigation"),ut=0,Ue=!1,Te(),je=R(),de=zt(),lt=0,je),Ln=e=>e==="lovable.page_viewed"?{trace_id:de.traceId,span_id:de.rootSpanId}:{trace_id:de.traceId,span_id:ot(8),parent_span_id:de.rootSpanId},In=e=>e==="lovable.client_error"||e==="lovable.resource_error"||e==="lovable.replay_error",Pn=(e,t,r={})=>{if(ve)return null;const n=e==="lovable.client_error";if(In(e)&&++pn>mn)return n&&br(null),null;const s=n&&or<hn,o=R(),a=b&&!k&&(B||n)?b:null;let i={event_id:o,event_name:e,event_schema_version:t,event_time:new Date().toISOString(),session_id:at,page_view_id:je,...Ln(e),properties:r};a&&(i.replay_id=a);const h=rt&&(n||Tn[e]!==!0)&&ae()==="denied";if(n&&h){if(r.context!==void 0&&nt&&!Pe)return re.push(Er(i)??Tt(i)),o;i=Tt(i)}if(h&&!n){const y=Er(i);return wr()&&mt>er&&Tr(),!y||O.length>=dn||wr()||ce.globalPrivacyControl===!0?null:(O.push(y),xr(),o)}return s?(or++,F.unshift(i)):F.push(i),n&&br(o),s||F.length>=gt?W():Rr(),o},C=(e,t={})=>{const r=typeof e=="string"?yn(e):null;return r===null?null:Pn(e,r,t)};let we=I.pathname;const jn=(e,t={})=>(e==="lovable.page_viewed"&&(Lr(),typeof t.url_path=="string"&&(we=t.url_path)),C(e,t)),Fn=/(^|[^a-z0-9_.-])([a-z0-9_.-]*(token|secret|password|passwd|key)|token_hash|code|email)(=|%3d)/iu,xt=e=>Fn.test(e)?"/":e,Rt=e=>{try{const t=new URL(e,I.href);return t.protocol==="http:"||t.protocol==="https:"?xt(t.pathname):t.pathname}catch{return null}},Ir=e=>{try{return new URL(e,I.href).host.replace(/^www\./iu,"")}catch{return null}},Un=e=>{try{return new URL(e,I.href).protocol.replace(/:$/u,"")}catch{return null}},On=[["utm_source","campaign_source"],["utm_medium","campaign_medium"],["utm_campaign","campaign_name"],["utm_term","campaign_term"],["utm_content","campaign_content"],["utm_id","campaign_id"]],Nn=[["gclid"],["dclid"],["gbraid"],["wbraid"],["msclkid"],["ttclid"],["twclid"],["li_fat_id"],["fbclid"],["oppref"],["ko_click_id"],["irclickid","im_ref"],["via"]],Vn=128,Bn=(e,t)=>{const r={};try{const n=new URLSearchParams(typeof e=="string"?e.replace(/;/gu,"&"):"");for(const[a,i]of On){const h=n.get(a);if(typeof h!="string")continue;const y=h.trim();y&&H(y)<=Vn&&(r[i]=y)}const s=a=>{const i=n.get(a);return typeof i=="string"&&i.trim()!==""},o=Nn.filter(a=>a.some(s)).map(([a])=>a);if(!o.includes("via")&&typeof t=="string"){const a=new URLSearchParams(t.slice(1)).get("via");typeof a=="string"&&a.trim()!==""&&o.push("via")}o.length>0&&(r.campaign_click_id_types=o)}catch{return{}}return r},Pr=(e,t)=>{let r=e;for(;r&&H(JSON.stringify(r))>t;)r=r.slice(0,Math.floor(r.length*.8));return r},We=(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},Dn=2048,jr=()=>We(xt(I.pathname||"/"),Dn)||"/",Mt=e=>{const t=e&&typeof e=="object"?e:null,r=o=>typeof o=="string"?o:typeof o=="number"||typeof o=="boolean"||typeof o=="bigint"?String(o):null,n=r(t?.stack),s=r(t?.message)||r(e)||"Unknown error";return{message:Pr(s.slice(0,2e3),2048),name:r(t?.name),stack:n?Pr(n.slice(0,8e3),8192):null}},Fr=1e3,$n=1e4,Ur=10,Je=new Map,xe=[],Or=(e,t)=>{for(const[r,n]of Je)t-n>=Fr&&Je.delete(r);Je.set(e,t)},Ct=(e,t=!0)=>{t&&Lr();const r=I.pathname,n={url_path:xt(r),navigation_type:e};typeof p?.referrer=="string"&&p.referrer&&(n.referrer_host=Ir(p.referrer)??"",n.referrer_path=Rt(p.referrer)??""),Object.assign(n,Bn(I.search,I.hash)),we=r,Or(r,T.now()),C("lovable.page_viewed",n)},At=e=>{I.pathname!==we&&Ct(e)},zn=()=>{const e=I.pathname;if(e===we)return;const t=T.now(),r=Je.get(e);if(r!==void 0&&t-r<Fr&&(xe.push(t),xe.length>Ur+1&&xe.shift(),xe.length>Ur&&t-xe[0]<$n)){we=e,Or(e,t);return}Ct("replace_state")},Nr=()=>{const e=Vt==="rrweb"&&Gt&&c.rrweb&&typeof c.rrweb.record=="function"?c.rrweb.record:null;if(!(!e||b)){b=R(),ft=T.now(),k=!1,V=0,he=0,me=0,ge=null,X=0,be=!1,q=!1,B=z,D=z?"sampled":null,De=null,$e=null,dt=!1;try{const t=e({emit(n){if(k||!n||typeof n!="object")return;if(_t()>=jt){yr();return}const s=pr(n);if(!vn(n)){s===2&&!q&&$("full_snapshot_too_large",!0);return}if(!(s===3&&!q)){for(s===2&&(q=!0),j+=1,M.push(n);!B&&M.length>an;){const o=M.findIndex(a=>pr(a)!==2);M.splice(o>=0?o:0,1),j=Math.max(0,j-1)}_r()||B&&(M.length>=Le?oe():Sr())}},blockClass:"rr-block",blockSelector:ln,collectFonts:!1,ignoreClass:"rrweb-ignore",ignoreSelector:cn,inlineImages:!1,maskAllInputs:!0,maskInputFn:Xt,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:fn,maskTextSelector:"*",recordAfter:"load",recordCanvas:!1,recordCrossOriginIframes:!1});if(k){if(typeof t=="function")try{t()}catch{}return}be=!0,typeof t=="function"&&(Ne=t);const r=Z();r&&typeof e.takeFullSnapshot=="function"&&r(()=>{if(!(!b||k))try{e.takeFullSnapshot?.(!1)}catch{}},1e3),r&&(Ve=r(yr,jt)),St()&&kt("started","recorder_available")}catch{b&&Et(b,"stopped","recorder_start_failed",j,_t(),V,X),b=null,j=0,ft=0,k=!1,q=!1,B=z,D=z?"sampled":null,De=null,$e=null,Ne=null,be=!1,qe()}}},qn=()=>{if(Vt!=="rrweb"||!Gt||b||Be||rt)return;if(c.rrweb&&typeof c.rrweb.record=="function"){Nr();return}const e=p?.head;if(!p?.createElement||!e?.appendChild)return;const t=p.createElement("script");Be=!0,t.async=!0,t.src=tn,t.onload=()=>{if(Be=!1,!c.rrweb||typeof c.rrweb.record!="function"){Et(R(),"stopped","recorder_script_failed",0,0,0,0);return}Nr()},t.onerror=()=>{Be=!1,Et(R(),"stopped","recorder_script_failed",0,0,0,0)},e.appendChild(t)},Hn=e=>{if(!(!b||k)){if(vt(),qe(),!q){$("missing_full_snapshot",!0);return}oe(!0),k||$(e)}},Wn=e=>{if(!b||k)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:"",s=typeof r?.stack=="string"?r.stack:"";(n.includes("/__l5e/rrweb-record")||s.includes("/__l5e/rrweb-record"))&&$("recorder_runtime_error",!0)},Jn=(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"},Gn=e=>e==="CLS"?"score":"millisecond",A=(e,t)=>{const r=e[t];return typeof r=="number"&&Number.isFinite(r)?r:null},Ge=(e,t)=>{const r=c.PerformanceObserver;if(!r)return!1;const n=r.supportedEntryTypes;if(Array.isArray(n)&&!n.includes(e))return!1;try{return new r(o=>{const a=typeof o.getEntries=="function"?o.getEntries():[];for(const i of a)i&&typeof i=="object"&&t(i)}).observe(e==="event"?{type:e,buffered:!0,durationThreshold:40}:{type:e,buffered:!0}),!0}catch{return!1}},Kn=()=>{const e=jr(),t=(f,d,_=d,w=R())=>{!Number.isFinite(d)||d<0||C("lovable.web_vital",{url_path:e,metric:f,value:d,unit:Gn(f),delta:_,rating:Jn(f,d),id:w,navigation_type:"initial_load"})};let r=!1,n=null,s=0,o=0,a=1/0,i=1/0,h=!1;const y={},S={},N=f=>(y[f]=y[f]||R(),y[f]),J=(f,d)=>{if(S[f]===d)return;const _=S[f];S[f]=d,t(f,d,_===void 0?d:d-_,N(f))},Re=f=>(typeof T.getEntriesByType=="function"?T.getEntriesByType(f):[]).filter(d=>!!d&&typeof d=="object"),U=Re("navigation")[0]??null,se=U?A(U,"responseStart"):null,G=U?A(U,"requestStart"):null,le=U?A(U,"fetchStart"):null,Me=G??le;se!==null&&Me!==null&&se>=Me&&t("TTFB",se-Me);const Ke=()=>{const f=Math.max((U?A(U,"activationStart"):null)??0,0),d=Re("visibility-state").find(w=>{const L=A(w,"startTime");return w.name==="hidden"&&L!==null&&L>=f}),_=d?A(d,"startTime"):p?.visibilityState==="hidden"?0:null;_!==null&&(a=Math.min(a,_)),Ge("paint",w=>{if(r||w.name!=="first-contentful-paint")return;const L=A(w,"startTime");L!==null&&(r=!0,L<a&&t("FCP",Math.max(L-f,0)))}),Ge("largest-contentful-paint",w=>{const L=A(w,"startTime")??A(w,"renderTime")??A(w,"loadTime");L===null||L>=a||L>=i||(n=Math.max(L-f,0))})};if(p?.prerendering===!0&&typeof p.addEventListener=="function"?p.addEventListener("prerenderingchange",Ke,{once:!0}):Ke(),p&&typeof p.addEventListener=="function"){const f=["keydown","click"],d=_=>{if(!(!_||typeof _!="object"||_.isTrusted!==!0)&&(i=Math.min(i,T.now()),typeof p.removeEventListener=="function"))for(const w of f)p.removeEventListener(w,d,!0)};for(const _ of f)p.addEventListener(_,d,!0)}const Lt=Ge("layout-shift",f=>{if(f.hadRecentInput===!0)return;const d=A(f,"value");d!==null&&(s+=d)});return Ge("event",f=>{const d=A(f,"interactionId");if(d===null||d<=0)return;const _=A(f,"duration");_!==null&&_>o&&(o=_)}),(f=!1)=>{h||(a=Math.min(a,T.now()),n!==null&&J("LCP",n),Lt&&J("CLS",s),o>0&&J("INP",o),f&&(h=!0))}},Vr=(e,t)=>{const r=c.history,n=r&&r[e];!r||typeof n!="function"||(r[e]=function(...s){const o=n.apply(this,s);return t(),o})},Xn=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"}};c.__lovableEvents=Object.assign(Ft,{__userAppEventsSdkVersion:Ye,track:jn,flush:()=>W(),identify(e){const t=e&&typeof e=="object"?e:null;st=typeof t?.user_id=="string"?t.user_id:null},getIdentity(){return{app_user_id_hash_available:!!st}},getReplay(){return{replay_id:b,active:!!b&&!k&&be,event_count:j}},resetIdentity(){st=null},captureException(e,t={},r={}){const n=Mt(e),s=Xn(r);let o=t&&typeof t=="object"&&!Array.isArray(t)?t:{};try{H(JSON.stringify(o))>4096&&(o={})}catch{o={}}C("lovable.client_error",{occurrence_id:R(),...n,...s,context:o})},startSpan(e,t={}){const r=new Date().toISOString(),n=T.now();return{end(s="ok"){C("lovable.frontend_span",{name:e,start_time:r,status:s,duration_ms:Math.max(0,T.now()-n),attributes:t})}}}}),c.addEventListener&&c.addEventListener("error",Wn,!0),qn(),rt&&ae();const Br=Kn();if(c.addEventListener&&(c.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!==c&&(typeof r.src=="string"?n=r.src:typeof r.href=="string"&&(n=r.href)),n!==null){const o=typeof r?.tagName=="string"?r.tagName.toLowerCase():"unknown",a=Ir(n);C("lovable.resource_error",{resource_type:o,url_host:a||Un(n)||"unknown",failure_type:"load_error",element:o,url_path:a?Rt(n):null,mechanism:"resource_load",handled:!1,severity:"error"});return}const s=Mt(t?.error||t?.message);C("lovable.client_error",{occurrence_id:R(),...s,filename:typeof t?.filename=="string"?Rt(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),c.addEventListener("unhandledrejection",e=>{const r=Mt((e&&typeof e=="object"?e:null)?.reason);C("lovable.client_error",{occurrence_id:R(),...r,mechanism:"unhandledrejection",handled:!1,severity:"error"})}),c.addEventListener("pagehide",()=>{Y=!0,Br(!0),Hn("pagehide"),Ee("pagehide"),He(),Se(),wt(),W(!0)}),c.addEventListener("blur",()=>Ar()),c.addEventListener("focus",()=>{Cr(),pe&&(pe=!1,Te())}),c.addEventListener("pageshow",e=>{(e&&typeof e=="object"?e.persisted:!1)===!0&&(Y=!1,ur(),Cr(),pe=!1,Te())}),c.addEventListener("popstate",()=>At("popstate")),c.addEventListener("hashchange",()=>At("hashchange")),rn)){const i={button:!0,a:!0,input:!0,select:!0,textarea:!0,summary:!0},h={button:!0,link:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,tab:!0,switch:!0,checkbox:!0,radio:!0,option:!0},y={header:!0,footer:!0,main:!0,nav:!0,aside:!0,section:!0,article:!0,form:!0},S=typeof Symbol<"u"&&typeof Symbol.for=="function"?Symbol.for("__jsxSource__"):null,N=l=>l&&typeof l=="object"&&typeof l.tagName=="string"?l:null,J={};for(const l 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(" "))J[l]=!0;const Re={};for(const l 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(" "))Re[l]=!0;const U={};for(const l 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(" "))U[l]=!0;const se=(l,u)=>l!==null&&u[l.toLowerCase()]===!0?l.toLowerCase():null,G=l=>{const u=String(l.tagName).toLowerCase();return J[u]===!0?u:"x"},le=(l,u)=>{if(typeof l.getAttribute!="function")return null;const g=l.getAttribute(u);return typeof g=="string"&&g!==""?g:null},Me=(l,u)=>typeof l.getAttribute=="function"&&typeof l.getAttribute(u)=="string",Ke=(l,u,g)=>{const m=l.children;if(!m||typeof m.length!="number")return"";const E=m;let v=0,P=0;for(let K=0;K<E.length;K++){const ie=N(E[K]);!ie||G(ie)!==g||(P++,ie===u&&(v=P))}return v>0?":"+v:""},Lt=l=>{const u=[];let g=l;for(let E=0;g&&E<32;E++){const v=G(g);if(!v||v==="html")break;const P=N(g.parentElement);if(u.unshift(P&&v!=="body"?v+Ke(P,g,v):v),v==="body"||!P)break;g=P}if(u.length===0)return null;let m=u.join(">");for(;m.length>1024&&u.length>1;)u.shift(),m=u.join(">");return m.length>1024?m.slice(m.length-1024):m},f=l=>{if(S===null)return null;const u=l[S];if(!u||typeof u!="object")return null;const g=u.displayName;return typeof g=="string"&&g!==""?g:null},d=l=>{if(i[G(l)]===!0)return!0;const u=le(l,"role");return u!==null&&h[u.toLowerCase()]===!0},_=(l,u)=>{const g=typeof l.composedPath=="function"?l.composedPath():null;if(Array.isArray(g)){const v=[];for(const P of g){if(v.length>=u)return{nodes:v,complete:!1};const K=N(P);K&&v.push(K)}return{nodes:v,complete:!0}}const m=[];let E=N(l.target);for(;E;){if(m.length>=u)return{nodes:m,complete:!1};m.push(E),E=N(E.parentElement)}return{nodes:m,complete:!0}},w=l=>l==="mouse"||l==="touch"||l==="pen",L=2e3,Yn=300;let It="",Dr=0;const $r=l=>It!==""&&T.now()-Dr<=l?It:"";c.addEventListener("pointerdown",l=>{try{const u=l;if(u.isTrusted!==!0)return;const g=typeof u.pointerType=="string"?u.pointerType:"";w(g)&&(It=g,Dr=T.now())}catch{}},!0);const zr=l=>Math.round(l*1e3)/1e3,Ce=l=>typeof l=="number"&&isFinite(l)?l:null;c.addEventListener("click",l=>{try{if(!l||typeof l!="object")return;const u=l;if(u.isTrusted!==!0||lt>=200)return;const g=_(u,512);if(!g.complete)return;let m=null,E=null;for(let Xe=0;Xe<g.nodes.length;Xe++){const Ae=g.nodes[Xe];if(Me(Ae,"data-lov-no-capture"))return;if(!(Xe>=32)){if(m===null){d(Ae)&&(m=Ae);continue}E===null&&y[G(Ae)]===!0&&(E=Ae)}}if(m===null)return;const v=typeof u.pointerType=="string"?u.pointerType:"",P=Ce(u.detail)??0,K=P===0?$r(Yn):"",ie=w(v)?v:K||(P===0?"keyboard":$r(L)||"unknown");let qr=null,Hr=null;const Wr=Ce(u.clientX),Jr=Ce(u.clientY),Q=typeof m.getBoundingClientRect=="function"?m.getBoundingClientRect():null;ie!=="keyboard"&&Q&&Wr!==null&&Jr!==null&&Q.width>0&&Q.height>0&&(qr=zr(Math.min(1,Math.max(0,(Wr-Q.left)/Q.width))),Hr=zr(Math.min(1,Math.max(0,(Jr-Q.top)/Q.height))));const Gr=c;C("lovable.element_clicked",{url_path:jr(),element_tag:G(m),interaction_type:ie,element_role:se(le(m,"role"),Re),element_type:se(le(m,"type"),U),element_path:Lt(m),component_name:We(f(m),64),section_tag:E?We(G(E),64):null,section_label:E?We(le(E,"aria-label"),64):null,offset_x:qr,offset_y:Hr,viewport_width:Ce(Gr.innerWidth),viewport_height:Ce(Gr.innerHeight)}),lt++}catch{}},!0)}p&&typeof p.addEventListener=="function"&&p.addEventListener("visibilitychange",()=>{if(p.visibilityState==="hidden"){Y=!0,Br(),oe(!0),Ee("hidden"),He(),Se(),wt(),W(!0),Y=!1;return}Y=!1,ur(),Te()}),Vr("pushState",()=>At("push_state")),Vr("replaceState",zn),C("lovable.session_started",{reason:"new_session"}),Ct("initial_load",!1),Te()})(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);})();