flusterduck 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/flusterduck.mjs +23 -0
- package/dist/core.d.ts +7 -1
- package/dist/d.global.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/queue.d.ts +4 -3
- package/dist/signals/frustration-correlator.d.ts +1 -1
- package/dist/types.d.ts +25 -0
- package/package.json +5 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var En="_fd_s";var Ma=/^[0-9a-f]{32}$/;function zo(e){if(e)return qo();let t=ka(En);if(t&&Ma.test(t))return t;let n=qo();return Xo(En,n,30),n}function bn(){Xo(En,"",-1)}function qo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function ka(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Xo(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var xa=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${Ne(t)}"]`;if(e.id&&!xa.test(e.id)&&e.id.length<64)return"#"+Ne(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${Ne(s)}"]`:a?i+=`[role="${Ne(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${Ne(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function Ne(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Pe=60,Aa=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Da=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Pe);if(!Da.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Pe);if(i&&!Aa.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Pe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Pe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Pe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Yo(e,t){if(t==="off")return null;if(t==="metadata")return Ra(e);let n=Ia(e);return n?{mode:"snapshot",...n}:null}function Ra(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:$o(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:$o(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Oa(e)}}}function Ia(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Pa(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Na(t),animations:i,siblings:o}}catch{return null}}function $o(e,t){return e&&t.includes(e)?e:null}function Oa(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Na(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Pa(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Ko=7e3,Ha=500,Fa=1e4,Go=50,Zo=100,Ba=3,He=6e4,Ct="application/json",Wa="application/json; encoding=gzip",ue=[],Z=null,Qo="",Jo=Ko,ei=Go,S=null,Mt={domMode:"off",compression:"auto"},yn=!1,Sn=null,Tn=!1;function Ln(e){Sn=e}var kt=new Set;function ti(e){return kt.add(e),()=>{kt.delete(e)}}function Va(e){if(e.t!=="sig"||!kt.size)return;let t=typeof e.d?.s=="string"?e.d.s:"";if(t)for(let n of kt)try{n(t,e.ts)}catch{}}function Cn(e){Tn=e}var Ua=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),qa=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),za=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function Xa(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>za.has(n))}var $a=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,ni=f(ja),ri=y(()=>ne());function oi(e,t,n,r,o){Qo=e,S=Object.assign(Object.create(null),t),Mt={domMode:nl(o?.domMode),compression:rl(o?.compression)},Jo=Math.max(Ha,Math.min(n??Ko,Fa)),ei=Math.max(1,Math.min(r??Go,Zo)),document.addEventListener("visibilitychange",ni),window.addEventListener("pagehide",ri)}function u(e){Tn||ue.length>=Zo||(Va(e),ue.push(e),ue.length>=ei?ne():Z||(Z=setTimeout(ne,Jo)))}function ne(){Ya()}async function Ya(){if(yn||!ue.length||!S)return;yn=!0,Z&&(clearTimeout(Z),Z=null);let e=ue;ue=[];let t={v:1,sid:S.sid,key:S.key,url:S.url,page:S.page,ts:Date.now(),ua:S.ua,vw:S.vw,vh:S.vh,environment:S.environment,...S.segment?{segment:S.segment}:{},dom_mode:Mt.domMode},n=e.map(o=>Qa(o,S.page,Mt.domMode)),r=[];try{for(let o of n){let i=[...r,o];if(JSON.stringify({...t,events:i}).length>He)if(r.length>0)await _n({...t,events:r}),r=[o];else{let a={...t,events:[o]};JSON.stringify(a).length<=He?await _n(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r=[]}else r=i}r.length>0&&await _n({...t,events:r})}catch{}finally{yn=!1}}function Mn(e){if(S)for(let t of Object.keys(e))Ua.has(t)&&(S[t]=e[t])}function ii(){ne(),Tn=!1,document.removeEventListener("visibilitychange",ni),window.removeEventListener("pagehide",ri),Z&&(clearTimeout(Z),Z=null)}function ja(){document.visibilityState==="hidden"&&ne()}async function _n(e){let t=JSON.stringify(e),n=await Ka(t,Mt.compression);n&&si(n,0)}async function Ka(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>He)return null;if(t!=="off"){let o=await Ga(e);if(o&&o.byteLength<=He)return{beaconBody:new Blob([o],{type:Wa}),fetchBody:new Uint8Array(o),headers:{"Content-Type":Ct,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:Ct}),fetchBody:e,headers:{"Content-Type":Ct}}}async function Ga(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=Za(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>He)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function Za(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:Ct});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}function si(e,t,n=Qo){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<Ba&&setTimeout(()=>si(e,t+1,n),1e3*(t+1))})}catch{}}function Qa(e,t,n){let r=e.d??{},o=Ja(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=jo(r.el,r.element,r.target);if(o==="signal"){i.signal_type=jo(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?tl(s,n):null;c&&(i.dom=c),i.signal_type&&Sn&&Sn(i.signal_type)}let a=el(r);return Object.keys(a).length&&(i.metadata=a),i}function Ja(e){return e==="pv"?"pageview":e==="sig"?"signal":qa.has(e)?e:"custom_signal"}function el(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=xt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=xt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function xt(e,t="",n=0){if(!(n>4)&&!Xa(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return $a.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>xt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=xt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function tl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Yo(n,t):null}catch{return null}}function jo(...e){for(let t of e)if(typeof t=="string"&&t)return t}function nl(e){return e==="metadata"||e==="snapshot"?e:"off"}function rl(e){return e==="off"?"off":"auto"}function ai(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function kn(e,t){for(let n of t){let r=il(n.pattern);if(r&&r.test(e))return n.label}return sl(e)}var ol=/^[a-zA-Z0-9/:._*\-]+$/;function il(e){if(e.length>200||!ol.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function sl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var al=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],B=[],li=3,ci=2e3,ui=24,At=ui,di=[],de=[],fi=0,Dt=new Map,Rt=new Map,ll=1e4,It=!1,pi=f(cl);function xn(e,t){It||(It=!0,li=e?.threshold??3,ci=e?.windowMs??2e3,At=e?.radius&&e.radius>0?e.radius:ui,di=[...al,...t??[]],fi=Date.now(),B=[],de=[],Dt.clear(),Rt.clear(),document.addEventListener("click",pi,{capture:!0,passive:!0}))}function An(){It&&(It=!1,document.removeEventListener("click",pi,{capture:!0,passive:!0}),B=[],de=[],Dt.clear(),Rt.clear())}function cl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,di)||pl(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;B.length&&n-B[0].t>ci;)B.shift();B.push({t:n,x:r,y:o});let i=ul();if(B.length<i)return;let s=B.slice(-i);for(let M=0;M<s.length-1;M++)for(let Oe=M+1;Oe<s.length;Oe++){let St=s[M],Tt=s[Oe],Lt=Tt.x-St.x,ce=Tt.y-St.y;if(Lt*Lt+ce*ce>At*At)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=fl(s,i,l),b=p(t),m=h(t);de.push({selector:b,ts:n});let $=de.length,_t=dl(n),Wo=Dt.get(b)??0,vn=Wo+1,Vo=Rt.get(b)??0,La=Vo>0&&n-Vo<ll;Dt.set(b,vn),Rt.set(b,n);let Uo=Wo>=1,Ca=(()=>{try{let M=t.getBoundingClientRect();if(M.width===0&&M.height===0)return null;let Oe=s.reduce((ce,wn)=>ce+wn.x,0)/s.length,St=s.reduce((ce,wn)=>ce+wn.y,0)/s.length,Tt=M.left+M.width/2,Lt=M.top+M.height/2;return{click_dx:Math.round(Oe-Tt),click_dy:Math.round(St-Lt),el_w:Math.round(M.width),el_h:Math.round(M.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:$,burst_rate_per_min:_t,repeated_target:Uo,hot_repeat:La,...Ca??{}}}),Uo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:vn,burst_count:vn,burst_seq:$}}),B=B.slice(-(i-1))}function ul(){return de.length>=3?2:li}function dl(e){let t=(e-fi)/6e4;return t<=0?0:Math.round(de.length/t*10)/10}function fl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],$=m.x-b.x,_t=m.y-b.y;d+=Math.sqrt($*$+_t*_t),l++}let g=d/l;a=Math.max(0,2-g/At*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function pl(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var ml=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,gl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,hl=/^(A|BUTTON|LABEL)$/,vl=20,mi=[],fe=null,wl=5,Ot=new Map,gi=f(El),hi=f(_l);function El(e){fe={x:e.clientX,y:e.clientY}}function Dn(e){mi=e??[],document.addEventListener("mousedown",gi,{capture:!0,passive:!0}),document.addEventListener("click",hi,{capture:!0,passive:!0})}function Rn(){document.removeEventListener("mousedown",gi,{capture:!0}),document.removeEventListener("click",hi,{capture:!0}),fe=null,Ot.clear()}function In(){Ot.clear()}function bl(e){try{return window.getComputedStyle(e).cursor.slice(0,vl)}catch{return""}}function yl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function _l(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,mi)||Cl())return;let n=Ml(e);if(fe=null,n||Sl(t))return;let r=Tl(t,e.clientX,e.clientY),o=r?vi(e.clientX,e.clientY,r):null,i=p(t),a=(Ot.get(i)??0)+1;Ot.set(i,a);let c=a>=2,d=bl(t),l=yl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function Sl(e){if(ml.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&gl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&hl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Tl(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Ll(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function vi(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Ll(e,t,n){return vi(e,t,n).dist}function Cl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Ml(e){if(!fe)return!1;let t=e.clientX-fe.x,n=e.clientY-fe.y;return Math.sqrt(t*t+n*n)>wl}var T=null,On=3e3,wi=[],Nt="click",Pt=0,kl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,xl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Ei=f(Rl),bi=f(Al),yi=f(Dl);function Nn(e,t){On=e?.delayMs??3e3,wi=t??[],document.addEventListener("click",Ei,{capture:!0,passive:!0}),document.addEventListener("keydown",bi,{capture:!0,passive:!0}),document.addEventListener("touchstart",yi,{capture:!0,passive:!0})}function Pn(){document.removeEventListener("click",Ei,{capture:!0}),document.removeEventListener("keydown",bi,{capture:!0}),document.removeEventListener("touchstart",yi,{capture:!0}),pe()}function Hn(){pe()}function Al(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Nt="keydown",Pt=Date.now()))}function Dl(){Nt="touch",Pt=Date.now()}function Rl(e){let t=e.target;if(!t||v(t,wi))return;let n=t.getAttribute("role");if(!kl.test(t.tagName)&&!(n&&xl.test(n)))return;let r=Date.now();if(r-Pt>50&&(Nt="click",Pt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=On&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Nt,observed_delay_ms:d}}),pe();return}pe()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,pe();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,pe();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},On+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function pe(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Il=100,Ol=5,_i=800,Si=2e3,Nl=3,Bn=0,Pl=16,Ht=0,Ft=0,Fe=0,Be=0,We=0,Bt=0,Fn=0,re=[],Wn=0,me=null,Ti=f(Hl);function Vn(e){_i=e?.velocityThreshold??800,Si=e?.windowMs??2e3,document.addEventListener("mousemove",Ti,{passive:!0})}function Un(){document.removeEventListener("mousemove",Ti),me&&clearTimeout(me),qn()}function Hl(e){let t=Date.now();t-Bn<Pl||(Bn=t,me&&clearTimeout(me),me=setTimeout(()=>qn(),150),Fl(e.clientX,e.clientY,t))}function Fl(e,t,n){if(Fe===0){Ht=e,Ft=t,Fe=n,Fn=n;return}let r=(n-Fe)/1e3;if(r===0)return;let o=e-Ht,i=t-Ft;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;re.length>=Il&&(re=re.slice(-50)),re.push(a),Wn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=Ol&&(Be!==0&&c!==0&&c!==Be||We!==0&&d!==0&&d!==We)&&Bt++,Be=c||Be,We=d||We,Ht=e,Ft=t,Fe=n,n-Fn>Si){if(Bt>=Nl){let l=re.reduce((g,w)=>g+w,0)/re.length;l>=_i&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Bt,distance_px:Math.round(Wn)}})}qn(),Fn=n}}function qn(){Bt=0,re=[],Wn=0,Be=0,We=0,Fe=0,Ht=0,Ft=0,Bn=0,me=null}var Li=100,Ci=5,Bl=3,L=[],k=[],zn=3e4;function Xn(e){zn=e?.windowMs??3e4}function $n(){L=[],k=[]}function Yn(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>zn;)L.shift();for(;k.length&&t-k[0].ts>zn;)k.shift();if(L.length>=Li&&(L=L.slice(-50)),k.length>=Li&&(k=k.slice(-50)),L.push({path:e,ts:t}),o){k.push({path:e,ts:t});let a=k.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=Bl&&a.length>c.size){let d=a.slice(-Ci).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),k=k.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ci).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],k=k.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var Wl=100,Mi=1e4,Kn=.5,C=[],Wt=0,Gn=0,Ve=!1,jn=0,ki=f(Vl);function Zn(e){Mi=e?.windowMs??1e4,Kn=e?.depthThreshold??.5,window.addEventListener("scroll",ki,{passive:!0})}function Qn(){window.removeEventListener("scroll",ki),C=[],Ve=!1}function Jn(){C=[],Wt=0,Gn=0,Ve=!1}function Vl(){Ve||(Ve=!0,requestAnimationFrame(()=>{Ve=!1,Ul()}))}function Ul(){let e=Date.now(),t=window.scrollY;if(jn=document.documentElement.scrollHeight-window.innerHeight,jn<=0)return;let n=t/jn,r=t>Wt?"down":"up";if(e-Gn<100){Wt=t;return}for(;C.length&&e-C[0].ts>Mi;)C.shift();C.length>=Wl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),Wt=t,Gn=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=Kn&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=Kn){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var ql=["textarea",'[role="textbox"]',"[contenteditable]"],qe=new Map,ze=new Map,Y=new Set,oe=null,er=0,xi=5e3,Ai=[],zl=50,Di=f(Xl),Ri=f($l),Ii=f(Yl),Oi=y(Ni),Ue=null;function tr(e,t){xi=e?.pauseMs??5e3,Ai=t??[],document.addEventListener("focusin",Di,{capture:!0,passive:!0}),document.addEventListener("focusout",Ri,{capture:!0,passive:!0}),document.addEventListener("submit",Ii,{capture:!0,passive:!0}),window.addEventListener("pagehide",Oi),Ue=y(()=>{document.visibilityState==="hidden"&&Ni()}),document.addEventListener("visibilitychange",Ue)}function nr(){document.removeEventListener("focusin",Di,{capture:!0}),document.removeEventListener("focusout",Ri,{capture:!0}),document.removeEventListener("submit",Ii,{capture:!0}),window.removeEventListener("pagehide",Oi),Ue&&(document.removeEventListener("visibilitychange",Ue),Ue=null),qe.clear(),ze.clear(),Y.clear(),oe=null}function rr(){qe.clear(),ze.clear(),Y.clear(),oe=null,er=0}function Xl(e){let t=e.target;if(!t||!Pi(t)||v(t,Ai)||jl(t))return;let n=Date.now();qe.set(t,n),ze.set(t,n);let r=t.closest("form");r&&r!==oe&&(oe=r,er=r.querySelectorAll("input, select, textarea").length)}function $l(e){let t=e.target;if(!t||!Pi(t))return;let n=qe.get(t),r=ze.get(t);qe.delete(t),ze.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<zl)&&n!==void 0){let a=o-n;if(a>=xi){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);Kl(t)&&Y.add(s)}function Yl(){Y.clear(),oe=null}function Ni(){if(Y.size>0&&oe){let e=er||Y.size,t=Math.round(Y.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:Y.size,total:e,field_count:e,completion_rate:t}}),Y.clear(),oe=null}}function Pi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function jl(e){if(e.tagName==="TEXTAREA")return!0;for(let t of ql)try{if(e.matches(t))return!0}catch{return!1}return!1}function Kl(e){return"value"in e?e.value.length>0:!1}var ge=null,Xe=null,Hi=/flusterduck\.com|\/v1\/ingest/,Bi=f(Ql),Wi=f(Jl);function ir(){window.addEventListener("error",Bi),window.addEventListener("unhandledrejection",Wi),ec()}function sr(){window.removeEventListener("error",Bi),window.removeEventListener("unhandledrejection",Wi),tc()}var or=/fetch|network|cors|timeout/i;function Gl(e){return or.test(e)?"network":"script"}function Zl(e){if(e instanceof TypeError&&or.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return or.test(t)?"network":"unhandled_promise"}function Ql(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:ar(t,200),ep:"",status:0,error_category:Gl(t),url:location.pathname}})}function Jl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:ar(t,200),ep:"",status:0,error_category:Zl(e.reason),url:location.pathname}})}function ec(){ge||(ge=window.fetch,Xe=function(t,n){let r;try{r=ge.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Hi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Fi(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Hi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:ar(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Fi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=Xe)}function tc(){ge&&Xe&&window.fetch===Xe&&(window.fetch=ge),ge=null,Xe=null}function Fi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function ar(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var Vi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],nc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,lr=0,cr=null,Ui=[],qi=f(rc),zi=f(oc),Xi=f(ac),$i=f(uc),Yi=f(lc);function ur(e){Ui=e??[],document.addEventListener("touchstart",qi,{passive:!0}),document.addEventListener("touchend",zi,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Xi,{passive:!0}),window.addEventListener("orientationchange",$i,{passive:!0})),window.visualViewport?.addEventListener("resize",Yi)}function dr(){document.removeEventListener("touchstart",qi),document.removeEventListener("touchend",zi),document.removeEventListener("gesturechange",Xi),window.removeEventListener("orientationchange",$i),window.visualViewport?.removeEventListener("resize",Yi),Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,lr=0,cr=null}function ji(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function rc(e){let t=e.touches[0];e.touches.length===1&&t?(Q={x:t.clientX,y:t.clientY,ts:Date.now()},ve=0):e.touches.length===2&&(ve=ji(e.touches),Q=null)}function oc(e){if(ve>0){let s=e.touches.length>=2?ji(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&($e=Math.round(s/ve*100)/100),ve=0}if(!Q||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-Q.x,r=t.clientY-Q.y,o=Date.now()-Q.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&ic(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&sc(i,n,r),Q=null}function ic(e,t,n){if(v(e,Ui))return;let r=dc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function sc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Vi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Vi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function ac(){let e=Date.now();if(e-Ye>3e4&&(I=0,Ye=e),I++,I>=2){let t=document.activeElement||document.body;!nc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-je>200&&(je=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:$e}})),I=0,$e=1}}function lc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ye>3e4&&(I=0,Ye=t),I++,I>=2&&t-je>200){let n=Math.round(e.scale*100)/100;je=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,$e=1}}}function cc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function uc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-lr>3e4&&(he=0,lr=e),t!==cr&&(he++,cr=t),he>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:he,orientation:cc()}}),he=0)}function dc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],we=null,A=0,Ee=0,V="",W=[],fr=[],fc=10,pc=5e3,Ki=5,Gi=3e3,mc=15,gc=5e3,Zi=f(hc);function pr(e){fr=e??[],document.addEventListener("keydown",Zi,{capture:!0,passive:!0})}function mr(){document.removeEventListener("keydown",Zi,{capture:!0}),x=[],W=[],we=null,A=0,Ee=0,V="",fr=[]}function hc(e){let t=Date.now(),n=e.target;n&&v(n,fr)||(e.key==="Tab"?wc(t,n,e.shiftKey):e.key==="Escape"?Ec(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&bc(t,e.target))}function vc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function wc(e,t,n){for(;x.length&&e-x[0].ts>pc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=fc){let i=x.map(a=>a.el).filter(Boolean),s=vc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===we?e-Ee<=Gi?(A++,V=i,A>=Ki&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",we=null)):(Ee=e,A=1,V=i):(we=o,Ee=e,A=1,V=i)}}function Ec(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===we){if(e-Ee>Gi){Ee=e,A=1,V=p(t);return}A++,V=p(t),A>=Ki&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",we=null)}}function bc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;W.length&&e-W[0].ts>gc;)W.shift();W.length>=50&&(W=W.slice(-25)),W.push({ts:e,container:n});let r=W.filter(o=>o.container===n);r.length>=mc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),W=[])}var be=0,Vt=0,Ut=null,gr=0,qt=!1,zt=0,hr=0,yc=1e4,_c=2,Sc=4,Tc=3e3,Ke=null,Xt=0,Lc=2e3,Qi=f(kc),Ji=f(Cc),es=f(Mc);function vr(){window.addEventListener("wheel",Ji,{passive:!0}),window.addEventListener("touchmove",es,{passive:!0}),window.addEventListener("scroll",Qi,{passive:!0})}function wr(){window.removeEventListener("wheel",Ji),window.removeEventListener("touchmove",es),window.removeEventListener("scroll",Qi),$t()}function $t(){be=0,Vt=0,Ut=null,gr=0,qt=!1,zt=0,hr=0,Ke=null,Xt=0}function Cc(){Ke="wheel",Xt=Date.now()}function Mc(){Ke="touch",Xt=Date.now()}function kc(){qt||(qt=!0,requestAnimationFrame(()=>{qt=!1,xc()}))}function xc(){let e=Date.now(),t=window.scrollY,n=t-Vt;if(Math.abs(n)<2){Vt=t;return}let r=n>0?"down":"up";if(Ut&&r!==Ut&&(e-gr>Tc&&(be=0,gr=e),be++,be>=Sc&&Math.abs(n)>100)){let i=e-Xt,s=Ke!==null&&i<=Lc?Ke:"wheel";e-hr>yc&&(zt=0,hr=e),zt++;let a=zt>=_c;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:be,source:s,repeated:a}}),be=0}Ut=r,Vt=t}var ie=0,ye=0,Ge=!1,ns=f(Ac),Ze=null,Qe=null;function Er(){window.addEventListener("scroll",ns,{passive:!0}),Qe=y(ts),window.addEventListener("pagehide",Qe),Ze=y(()=>{document.visibilityState==="hidden"&&ts()}),document.addEventListener("visibilitychange",Ze)}function br(){window.removeEventListener("scroll",ns),Qe&&(window.removeEventListener("pagehide",Qe),Qe=null),Ze&&(document.removeEventListener("visibilitychange",Ze),Ze=null),ie=0,ye=0,Ge=!1}function yr(){ie=0,ye=0,Ge=!1}function Ac(){Ge||(Ge=!0,requestAnimationFrame(()=>{Ge=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ie&&(ie=t,ye===0&&(ye=Date.now()))}}))}function ts(){if(ie>.05){let e=Date.now(),t=ye>0?Math.max(0,e-ye):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ie*100)/100,max_depth:Math.round(ie*100),dwell_ms:t}})}}var rs=1500,os=15e3,Dc=5e3,Rc=.15,_r="",_e=0,Yt=0,Je=0,Se=0,Sr=0,jt=null,Kt=0,Gt=!1,Zt=f(Oc),is=f(Nc),Te=f(Ic);function Tr(){Gt||(Gt=!0,Sr=ss(),et(),document.addEventListener("mouseenter",Zt,!0),document.addEventListener("mouseleave",Zt,!0),document.addEventListener("click",Te,{capture:!0,passive:!0}),document.addEventListener("keydown",Te,{capture:!0,passive:!0}),document.addEventListener("scroll",Te,{passive:!0}),window.addEventListener("resize",is,{passive:!0}))}function Lr(){Gt&&(Gt=!1,document.removeEventListener("mouseenter",Zt,!0),document.removeEventListener("mouseleave",Zt,!0),document.removeEventListener("click",Te,{capture:!0}),document.removeEventListener("keydown",Te,{capture:!0}),document.removeEventListener("scroll",Te),window.removeEventListener("resize",is),as(),_r="",_e=0,Yt=0,Se=0,Je=0,Kt=0)}function et(){as(),Kt+=1;let e=Kt;jt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:os,cycle:e}})},os)}function Cr(){Kt=0}function Ic(){et()}function Oc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==_r||r-Yt>rs)&&(_r=n,Yt=r,_e=0),_e+=1,!(_e<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:_e,window_ms:rs}}),_e=0,Yt=r)}function Nc(){let e=Date.now(),t=ss(),n=Sr||t,r=Math.abs(t-n)/Math.max(n,1);Sr=t,!(r<Rc)&&((!Je||e-Je>Dc)&&(Je=e,Se=0),Se+=1,!(Se<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Se,area_delta:Math.round(r*1e3)/1e3}}),Se=0,Je=e))}function ss(){return Math.max(1,window.innerWidth*window.innerHeight)}function as(){jt&&(clearTimeout(jt),jt=null)}var ls=6e4,Pc=3,Hc=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],Fc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,U=[],cs=[],us=f(Bc);function Mr(e){cs=e??[],document.addEventListener("click",us,{capture:!0,passive:!0})}function kr(){document.removeEventListener("click",us,{capture:!0}),U=[]}function xr(){U=[]}function Bc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,cs)||!Wc(t))return;let n=Date.now();for(;U.length&&n-U[0].t>ls;)U.shift();let r=p(t);if(U.push({t:n,el:r}),U.length<Pc)return;let o=new Set(U.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:U.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ls}}),U=[]}function Wc(e){let t=e;for(let n=0;n<3&&t;n++){if(Vc(t)||Uc(t))return!0;t=t.parentElement}return!1}function Vc(e){for(let t of Hc)try{if(e.matches(t))return!0}catch{}return!1}function Uc(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return Fc.test(r)}var ds=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,fs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Qt=[],Jt=new Map,ps=[],ms=f(qc);function Ar(e){ps=e??[],document.addEventListener("click",ms,{capture:!0,passive:!0})}function Dr(){document.removeEventListener("click",ms,{capture:!0}),Qt=[],Jt.clear()}function Rr(){Qt=[],Jt.clear()}function qc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ps)||!zc(t))return;let n=Date.now(),r=p(t),o=h(t);Qt.push({t:n,el:r});let s=(Jt.get(r)??0)+1;Jt.set(r,s);let a=Qt.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:$c(t),...c??{}}})}function zc(e){let t=e;for(let n=0;n<4&&t;n++){if(Xc(t))return!0;t=t.parentElement}return!1}function Xc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&fs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ds.test(o)||ds.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&fs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function $c(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var Yc=1500,O=null,gs=[],hs=f(jc),vs=f(Kc),ws=f(Gc);function Ir(e){gs=e??[],document.addEventListener("click",hs,{capture:!0,passive:!0}),document.addEventListener("keydown",vs,{capture:!0,passive:!0}),window.addEventListener("popstate",ws)}function Or(){document.removeEventListener("click",hs,{capture:!0}),document.removeEventListener("keydown",vs,{capture:!0}),window.removeEventListener("popstate",ws),O=null}function Nr(){O=null}function jc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,gs)){if(Zc(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function Kc(e){e.key==="Escape"&&Es("escape")}function Gc(){Es("back_nav")}function Es(e){if(!O)return;let t=Date.now()-O.t;if(t>Yc){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function Zc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var bs=1e4,Qc=3,Jc=/^(checkbox|radio)$/,ys=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,tt=new Map,Pr=[],_s=f(eu),Ss=f(tu);function Hr(e){Pr=e??[],document.addEventListener("change",_s,{capture:!0,passive:!0}),document.addEventListener("click",Ss,{capture:!0,passive:!0})}function Fr(){document.removeEventListener("change",_s,{capture:!0}),document.removeEventListener("click",Ss,{capture:!0}),tt.clear()}function Br(){tt.clear()}function eu(e){let t=e.target;t&&(v(t,Pr)||nu(t)&&Ts(t))}function tu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Pr))return;let n=t.getAttribute("role")??"";ys.test(n)&&t.tagName!=="INPUT"&&Ts(t)}function Ts(e){let t=p(e),n=Date.now(),r=tt.get(t);for(r||(r=[],tt.set(t,r));r.length&&n-r[0].t>bs;)r.shift();if(r.push({t:n}),r.length<Qc)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:bs}}),tt.delete(t)}function nu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?Jc.test(e.type??""):ys.test(e.getAttribute("role")??"")}var Ls=15e3,ru=3,j=[],Cs=f(ou);function Wr(){document.addEventListener("copy",Cs,{capture:!0,passive:!0})}function Vr(){document.removeEventListener("copy",Cs,{capture:!0}),j=[]}function Ur(){j=[]}function ou(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;j.length&&r-j[0].t>Ls;)j.shift();j.push({t:r}),!(j.length<ru)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:j.length,window_ms:Ls}}),j=[])}var Ms=15e3,iu=4,su=5,au=500,lu=2e3,D=[],en=0,nt=null,se=null;function qr(){nt=y(uu),se=y(cu),document.addEventListener("selectionchange",nt),document.addEventListener("copy",se,{capture:!0,passive:!0}),document.addEventListener("cut",se,{capture:!0,passive:!0})}function zr(){nt&&(document.removeEventListener("selectionchange",nt),nt=null),se&&(document.removeEventListener("copy",se,{capture:!0}),document.removeEventListener("cut",se,{capture:!0}),se=null),D=[],en=0}function Xr(){D=[],en=0}function cu(){en=Date.now(),D=[]}function uu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<su)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-en<lu)return;for(;D.length&&r-D[0].t>Ms;)D.shift();let o=D[D.length-1];o&&r-o.t<au||(D.push({t:r}),!(D.length<iu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:Ms}}),D=[]))}var $r=6e4,du=20,xs="_fd_sess",fu={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},pu=10,ks={low:1,medium:2,high:3,critical:4},q=[],Le=null,nn=!1,Me=new Map,Ce={totalSignals:0,pagesWithFrustration:0},Yr="",rt=null,ot=null,it=null,st=null;function tn(e){nn&&As(e,Date.now())}function mu(){try{let e=sessionStorage.getItem(xs);if(e){let t=JSON.parse(e);Ce={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function gu(){try{sessionStorage.setItem(xs,JSON.stringify(Ce))}catch{}}function hu(){let e=[],n=Date.now()-$r,r=[];for(let[o,i]of Me.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function As(e,t){Me.has(e)||Me.set(e,[]);let n=Me.get(e);n.push(t),n.length>du&&n.shift()}function vu(e){let t=e-$r,n=0;for(;n<q.length&&q[n].ts<t;)n++;n>0&&(q=q.slice(n))}function wu(){let e=new Map,t=0;for(let n of q)e.set(n.type,(e.get(n.type)??0)+1),t+=fu[n.type]??pu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Ds(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Eu(e,t,n){return Ds(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function bu(e,t,n,r){let o=Ds(r),i=hu();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Yr||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:$r,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Ce.totalSignals,session_pages_with_frustration:Ce.pagesWithFrustration}}),Ce.totalSignals+=q.length,Ce.pagesWithFrustration+=1,gu()}function yu(e){if(!nn||e==="frustration_burst")return;let t=Date.now();vu(t),q.length===0&&(Le=null),q.push({type:e,ts:t}),As(e,t);let{distinctTypes:n,totalWeight:r,typeCounts:o}=wu(),i=Eu(n.size,r,o);i&&(Le!==null&&ks[i]<=ks[Le]||(Le=i,bu(i,n,r,o)))}function jr(e){Yr=e}function Kr(e){q=[],Le=null,nn=!0,Me=new Map,Yr=e??"",mu(),Ln(yu),rt=()=>tn("popstate"),ot=()=>tn("hashchange"),it=()=>{document.visibilityState==="hidden"&&tn("visibilitychange")},st=()=>tn("pagehide"),window.addEventListener("popstate",rt),window.addEventListener("hashchange",ot),document.addEventListener("visibilitychange",it),window.addEventListener("pagehide",st)}function Gr(){nn=!1,q=[],Le=null,Me=new Map,Ln(null),rt&&(window.removeEventListener("popstate",rt),rt=null),ot&&(window.removeEventListener("hashchange",ot),ot=null),it&&(document.removeEventListener("visibilitychange",it),it=null),st&&(window.removeEventListener("pagehide",st),st=null)}var _u=8,Zr=3e4,Qr=5,Su=5e3,N=[],J="",at=!1,Rs=f(Lu),Is=f(Cu);function Jr(){N=[],at=!1,J=location.pathname+location.search+location.hash,window.addEventListener("popstate",Rs),window.addEventListener("hashchange",Is)}function eo(){window.removeEventListener("popstate",Rs),window.removeEventListener("hashchange",Is),N=[],at=!1,J=""}function to(){N=[],at=!1,J=location.pathname+location.search+location.hash}function lt(e){let t=Date.now();if(J&&J!==e){let n=N[N.length-1];n&&n.path===J&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>Zr;)N.shift();e!==J&&(N.push({path:e,ts:t,leftAt:null}),J=e),!(N.length<Qr)&&(at||Tu(t))}function Tu(e){let t=N.filter(l=>e-l.ts<=Zr),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<Qr||n.length===0||n.some(l=>l.leftAt-l.ts>=Su)||new Set(n.map(l=>l.path)).size<Qr)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-_u);at=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:Zr,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Lu(){let e=location.pathname+location.search+location.hash;lt(e)}function Cu(){let e=location.pathname+location.search+location.hash;lt(e)}var Mu=.3,Os=3e3,K=[],ct=!1,ae="none",le=0,ut=0,dt=0,P=!1,Ns=f(ku),Ps=f(Au);function no(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1,window.addEventListener("scroll",Ns,{passive:!0}),window.addEventListener("click",Ps,{capture:!0})}function ro(){window.removeEventListener("scroll",Ns),window.removeEventListener("click",Ps,{capture:!0}),rn()}function rn(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1}function ku(){ct||(ct=!0,requestAnimationFrame(xu))}function xu(){ct=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=K[K.length-1];if(r&&e-r.ts<50||(K.push({y:t,ts:e}),K.length>60&&(K=K.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){ae!=="down"&&P&&(P=!1),t>le&&(le=t),ae="down";return}if(P&&e-dt>Os&&(P=!1),ae==="down"){let s=le-t,a=n*Mu;s>=a&&!P&&(ut=t,dt=e,P=!0)}ae="up"}function Au(e){if(!P)return;let t=Date.now();if(t-dt>Os){P=!1;return}if(window.scrollY+e.clientY>ut+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(le-ut),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,le=window.scrollY,ae="none",K=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Du=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ru=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Iu=/^(A|BUTTON|LABEL)$/,Ou=3,Hs=9e4,Nu=5,ft=new Map,Fs=[],pt=null,Pu=5,Bs=f(Hu),Ws=f(qu);function Hu(e){pt={x:e.clientX,y:e.clientY}}function oo(e){Fs=e??[],document.addEventListener("mousedown",Bs,{capture:!0,passive:!0}),document.addEventListener("click",Ws,{capture:!0,passive:!0})}function io(){document.removeEventListener("mousedown",Bs,{capture:!0}),document.removeEventListener("click",Ws,{capture:!0}),pt=null,ft.clear()}function so(){ft.clear()}function Fu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function Bu(e,t){return e*4+t}function Wu(e){if(Du.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ru.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Iu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Vu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Uu(e){if(!pt)return!1;let t=e.clientX-pt.x,n=e.clientY-pt.y;return Math.sqrt(t*t+n*n)>Pu}function qu(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Fs)||Vu()||Uu(e)||Wu(t))return;let{row:n,col:r}=Fu(e.clientX,e.clientY),o=Bu(n,r),i=Date.now(),s=p(t),c=(ft.get(o)??[]).filter(d=>i-d.ts<Hs);if(c.push({ts:i,selector:s}),ft.set(o,c),c.length>=Ou){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,$]of d)$>g&&(g=$,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Nu))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Hs}}),ft.set(o,[])}}var ao=3,ke=12e4,_=new Map,sn=[],mt=null,Vs=f(ju),on=f(Ku);function co(e){sn=e??[],document.addEventListener("invalid",Vs,{capture:!0,passive:!0}),document.addEventListener("input",on,{capture:!0,passive:!0}),document.addEventListener("change",on,{capture:!0,passive:!0}),mt=new MutationObserver(Gu),mt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function uo(){document.removeEventListener("invalid",Vs,{capture:!0}),document.removeEventListener("input",on,{capture:!0}),document.removeEventListener("change",on,{capture:!0}),mt&&(mt.disconnect(),mt=null);for(let e of _.values())ee(e);_.clear()}function fo(){for(let e of _.values())ee(e);_.clear()}function lo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function po(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function an(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function zu(e){for(let[t,n]of _)e-n.lastTs>ke&&(ee(n),_.delete(t))}function ee(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function Xu(e){return f(t=>{zs(e)})}function $u(e){return f(t=>{zs(e)})}function Us(e,t){let n=Xu(t),r=$u(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return _.set(t,o),o}function qs(e){if(!an(e)||v(e,sn))return;let t=Date.now();zu(t);let n=p(e),r=_.get(n);if(!r){Us(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=ao&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:lo(e)}}),ee(r),_.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=ao&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:lo(e)}}),ee(r),_.delete(n)))}function Yu(e){if(!an(e))return;let t=Date.now(),n=p(e),r=_.get(n);if(r){if(t-r.lastTs>ke){ee(r),_.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function zs(e){let t=Date.now(),n=_.get(e);if(n){if(t-n.lastTs>ke){ee(n),_.delete(e);return}if(n.lastTs=t,po(n.el)){n.cycles+=1,n.cycles>=ao&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:ke,field_type:lo(n.el)}}),ee(n),_.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function ju(e){let t=e.target;t&&qs(t)}function Ku(e){let t=e.target;if(!t||!an(t)||v(t,sn))return;let n=p(t);_.has(n)||po(t)&&Us(t,n)}function Gu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!an(n)||v(n,sn))continue;let r=t.oldValue,o=r==="true"||r==="",i=po(n);i&&!o?qs(n):!i&&o&&Yu(n)}}var xe=null,gt=null,go=[],Xs=0,ht=new Map;function ho(e){go=e?.length?e:["[data-fd-impression]"],Xs=Date.now(),!(typeof IntersectionObserver>"u")&&(xe=new IntersectionObserver(y(Qu),{threshold:[0,.5,1]}),$s(),gt=new MutationObserver(y(Zu)),gt.observe(document.body,{childList:!0,subtree:!0}))}function vo(){xe&&(xe.disconnect(),xe=null),gt&&(gt.disconnect(),gt=null),ht.clear()}function wo(){ht.clear(),xe&&$s()}function $s(){for(let e of go)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)mo(t[n])}catch{}}function mo(e){ht.has(e)||(ht.set(e,{firstSeenTs:0,emitted:!1}),xe.observe(e))}function Zu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of go)try{r.matches(o)&&mo(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)mo(i[s])}catch{}}}function Qu(e){let t=Date.now();for(let n of e){let r=ht.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Xs),viewport_position:s}})}}}var Ju=2,ed=3,td=6e4,vt=new Map,Ys=[],js=f(nd);function Eo(e){Ys=e??[],document.addEventListener("input",js,{capture:!0,passive:!0})}function bo(){document.removeEventListener("input",js,{capture:!0}),vt.clear()}function yo(){vt.clear()}function nd(e){let t=e.target;if(!t||!rd(t)||v(t,Ys))return;let n=Date.now(),r=t.value??"",o=p(t),i=vt.get(o);if(!i){vt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>td){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=ed)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=Ju)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:od(t)}}),vt.delete(o);return}i.lastValue=r}function rd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function od(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Ks=2e3,id=3e4,z=null,Gs=Ks,Zs=[],ln=new Map,Qs=f(sd),Js=f(ad),ea=f(wt);function _o(e,t){Gs=e?.dwellMs??Ks,Zs=t??[],document.addEventListener("mouseover",Qs,{passive:!0}),document.addEventListener("mouseout",Js,{passive:!0}),document.addEventListener("click",ea,{capture:!0,passive:!0})}function So(){document.removeEventListener("mouseover",Qs),document.removeEventListener("mouseout",Js),document.removeEventListener("click",ea,{capture:!0}),wt(),ln.clear()}function To(){wt(),ln.clear()}function sd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Zs)||!ld(t))return;let n=p(t);if(z?.selector===n)return;wt();let r=Date.now();if(r-(ln.get(n)??0)<id)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);ln.set(n,s),z=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Gs);z={el:t,selector:n,startTs:o,timer:i}}function ad(e){if(!z)return;let t=e.target;if(t!==z.el&&!z.el.contains(t))return;let n=e.relatedTarget;n&&z.el.contains(n)||wt()}function wt(){z&&(clearTimeout(z.timer),z=null)}function ld(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var cd=20,ud=500,dd=3e3,fd=6e4,cn=0,un=0,X=null,ta=y(pd);function Lo(){cn=Date.now(),un=0,document.addEventListener("mouseleave",ta)}function Co(){document.removeEventListener("mouseleave",ta),X&&(clearTimeout(X),X=null)}function Mo(){cn=Date.now(),un=0,X&&(clearTimeout(X),X=null)}function pd(e){if(e.clientY>cd)return;let t=Date.now();t-cn<dd||t-un<fd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();un=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-cn)}})}),ud))}var md=2500,gd=4e3,na=200,hd=500,vd=.1,wd=.25,De=null,Re=null,G=null,Ae=0;function ko(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function xo(){if(!(typeof PerformanceObserver>"u")){try{De=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:ko(r,md,gd)}})})),De.observe({type:"largest-contentful-paint",buffered:!0})}catch{De=null}try{Re=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<na||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:ko(r,na,hd)}})}})),Re.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Re=null}try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!0})}catch{G=null}}}function ra(){if(G){if(G.disconnect(),G=null,Ae>0){let e=Math.round(Ae*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:ko(Ae,vd,wd)}})}Ae=0}}function Ao(){De&&(De.disconnect(),De=null),Re&&(Re.disconnect(),Re=null),ra()}function Do(){if(ra(),!(typeof PerformanceObserver>"u"))try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!1})}catch{G=null}}var oa=[],ia=f(Ed);function Ro(e){oa=e??[],document.addEventListener("paste",ia,{capture:!0,passive:!0})}function Io(){document.removeEventListener("paste",ia,{capture:!0})}function Ed(e){let t=e.target;if(!t||!bd(t)||v(t,oa))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:yd(t)}})},100)}function bd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function yd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var _d="https://api.flusterduck.com/v1/ingest",te=!1,dn=null,Ie=null,Et="__flusterduck_instance__",Oo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function Sd(){let e=window;return e[Et]&&e[Et]!==Oo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[Et]=Oo,!0)}function Td(){let e=window;e[Et]===Oo&&delete e[Et]}var bt=[];function Ld(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>xn(e.signals?.rageClick,t),stop:An},{when:()=>r("deadClick"),start:()=>Dn(t),stop:Rn,reset:In},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Nn(i?{delayMs:i.windowMs}:void 0,t)},stop:Pn,reset:Hn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;Vn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Un},{when:()=>r("loopNav"),start:()=>Xn(e.signals?.loopNav),stop:$n},{when:()=>r("scrollBounce"),start:Zn,stop:Qn,reset:Jn},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;tr(i?{pauseMs:i.threshold}:void 0,t)},stop:nr,reset:rr},{when:()=>o&&r("formValidationLoop"),start:()=>co(t),stop:uo,reset:fo},{when:()=>r("errorEncounter"),start:ir,stop:sr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>ur(t),stop:dr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>pr(t),stop:mr},{when:()=>r("scrollHijack"),start:vr,stop:wr,reset:$t},{when:()=>r("scrollDepthAbandon"),start:Er,stop:br,reset:yr},{when:()=>r("advancedHeuristics"),start:Tr,stop:Lr,reset:()=>{et(),Cr()}},{when:()=>r("helpHunt"),start:()=>Mr(t),stop:kr,reset:xr},{when:()=>r("closeClick"),start:()=>Ar(t),stop:Dr,reset:Rr},{when:()=>r("closeClickReversal"),start:()=>Ir(t),stop:Or,reset:Nr},{when:()=>r("filterSpiral"),start:()=>Hr(t),stop:Fr,reset:Br},{when:()=>r("copyFrustration"),start:Wr,stop:Vr,reset:Ur},{when:()=>r("textSelectFrustration"),start:qr,stop:zr,reset:Xr},{when:()=>r("deadClickTrapZone"),start:()=>oo(t),stop:io,reset:so},{when:()=>!0,start:()=>Kr(n),stop:Gr},{when:()=>r("navigationConfusion"),start:Jr,stop:eo,reset:to},{when:()=>r("scrollToClickConfusion"),start:no,stop:ro,reset:rn},{when:()=>r("elementImpression"),start:()=>ho(e.elementImpressionSelectors),stop:vo,reset:wo},{when:()=>o&&r("inputCorrection"),start:()=>Eo(t),stop:bo,reset:yo},{when:()=>o&&r("pasteBlocked"),start:()=>Ro(t),stop:Io},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;_o(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:So,reset:To},{when:()=>r("exitIntent"),start:Lo,stop:Co,reset:Mo},{when:()=>r("performanceVitals"),start:xo,stop:Ao,reset:Do}]}function Cd(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function aa(e){if(te||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Rd()){Ie=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ie=e;return}if(!Sd()){Ie=e;return}Ie=e,te=!0;let t=zo(e.cookieless??!1),n=Cd(e.endpoint)??_d,r=kn(location.pathname,e.pageRules??[]),o=Id(e.domMode);oi(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=sa(location.pathname,e.ignorePages??[]);i&&Cn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];bt=[];for(let d of Ld(e,c,r))d.when()&&(d.start(),bt.push({stop:d.stop,reset:d.reset}));dn=ai(y((d,l)=>{ne();for(let E of bt)E.reset?.();lt(l),jr(l);let g=kn(l,e.pageRules??[]),w=sa(l,e.ignorePages??[]);Cn(w),Mn({page:g,url:d}),Yn(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function Md(e,t){if(!te||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function kd(e,t={}){if(!te||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function xd(e){if(!te||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;r==="__proto__"||r==="constructor"||r==="prototype"||(t[r.slice(0,64)]=String(e[r]).slice(0,256),n++)}Mn({segment:t})}function Ad(e){e&&Ie&&!te?aa(Ie):e||(No(),bn())}function Dd(){No(),bn()}function No(){if(te){for(let e of bt)e.stop();bt=[],ii(),dn&&(dn(),dn=null),Td(),te=!1}}function Rd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Id(e){return e==="metadata"||e==="snapshot"?e:"off"}function sa(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var da=.1,fa=.01,pa=3e4,ma=50,ga=1e4,Od=500,Nd=3e4,Pd=6e4,la=10,Hd=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Fd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,Bd=/^\$\$?(heatmap|scroll)/,ha=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],gn=!1,fn=null,pn=null,yt=null,H=null,mn=null,va=da,wa=fa,Ea=new Set,ba=new Set(ha),ya=pa,Fo=ma,_a=ga,R=[],hn=0,F=[];function ca(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function Wd(e){gn||(gn=!0,va=ca(e?.baselineSampleRate,da),wa=ca(e?.scrollSampleRate,fa),Ea=new Set(e?.conversionEvents??[]),ba=new Set(e?.criticalSignals?.length?e.criticalSignals:ha),ya=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:pa,Fo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:ma,_a=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:ga,R=[],hn=0,F=[],pn=ti(jd),ua()||(fn=setInterval(()=>{ua()&&Bo()},Od),setTimeout(()=>Bo(),Nd)))}function Vd(){gn&&(gn=!1,Bo(),pn&&(pn(),pn=null),yt&&mn&&yt.capture.__fd_wrapped&&(yt.capture=mn),yt=null,H=null,mn=null,R=[],F=[],hn=0)}function Bo(){fn&&(clearInterval(fn),fn=null)}function ua(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;mn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return qd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,yt=e,!0}catch{return!1}}function Ud(e){return Hd.has(e)?"critical":Ea.has(e)||Fd.test(e)?"conversion":Bd.test(e)?"scroll":"baseline"}function qd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=Ud(e);if(o==="critical"||o==="conversion")return H(e,Ho(t,r),n);if(r<hn)return H(e,{...Ho(t,r),fd_boosted:!0},n);if(zd(o==="scroll"?wa:va))return H(e,Ho(t,r),n);Yd({name:e,properties:t,ts:r})}function zd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Xd();return t?$d(t)%1e4/1e4<e:Math.random()<e}var Po="";function Xd(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return Po||(Po=Math.random().toString(36).slice(2)),Po}function $d(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Ho(e,t){return Ta(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function Yd(e){R.push(e),Sa(e.ts)}function Sa(e){let t=e-ya;for(;R.length&&R[0].ts<t;)R.shift();R.length>Fo&&(R=R.slice(-Fo))}function Ta(e){let t=e-Pd;F=F.filter(n=>n.ts>=t),F.length>la&&(F=F.slice(-la))}function jd(e,t){if(F.push({name:e,ts:t}),Ta(t),!ba.has(e)||(hn=t+_a,!H||!R.length))return;Sa(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}export{No as destroy,Vd as destroyPostHogTrigger,xd as identify,aa as init,Wd as initPostHogTrigger,Dd as optOut,Ad as setConsent,Md as signal,kd as track};
|
|
1
|
+
function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var Sn="_fd_s";var Aa=/^[0-9a-f]{32}$/;function Qo(e){if(e)return Zo();let t=Da(Sn);if(t&&Aa.test(t))return t;let n=Zo();return Jo(Sn,n,30),n}function _n(){Jo(Sn,"",-1)}function Zo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function Da(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Jo(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var Ra=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${He(t)}"]`;if(e.id&&!Ra.test(e.id)&&e.id.length<64)return"#"+He(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${He(s)}"]`:a?i+=`[role="${He(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${He(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function He(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Fe=60,Ia=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Oa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Fe);if(!Oa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Fe);if(i&&!Ia.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Fe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Fe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Fe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ti(e,t){if(t==="off")return null;if(t==="metadata")return Na(e);let n=Pa(e);return n?{mode:"snapshot",...n}:null}function Na(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:ei(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:ei(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Ha(e)}}}function Pa(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Ba(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Fa(t),animations:i,siblings:o}}catch{return null}}function ei(e,t){return e&&t.includes(e)?e:null}function Ha(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Fa(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Ba(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var oi=7e3,Wa=500,Ua=1e4,ii=50,Be=100,Va=3,We=6e4,xt="application/json",qa="application/json; encoding=gzip",j=[],B=null,si="",xn=oi,ai=ii,_=null,At={domMode:"off",compression:"auto"},Tn=!1,Ln=null,An=!1,li=!0;function Dn(e){li=e}var ni=new WeakMap;function Rn(e){Ln=e}var Dt=new Set;function fe(e){return Dt.add(e),()=>{Dt.delete(e)}}function za(e){if(e.t!=="sig"||!Dt.size)return;let t=e.d??{},n=typeof t.s=="string"?t.s:"";if(!n)return;let r={name:n,element:typeof t.el=="string"?t.el:"",weight:typeof t.w=="number"?t.w:0,meta:t.meta&&typeof t.meta=="object"?t.meta:{},ts:e.ts};for(let o of Dt)try{o(r)}catch{}}function $a(e){if(!Ln||e.t!=="sig")return;let t=Mn(e.d?.s,e.d?.signal_type,e.d?.name);if(t)try{Ln(t.slice(0,128),e.ts)}catch{}}function In(e){An=e}var Xa=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Ya=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),ja=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function Ka(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>ja.has(n))}var Ga=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Cn=f(Qa),kn=y(()=>J());function ci(e,t,n,r,o){si=e,_=Object.assign(Object.create(null),t),At={domMode:ll(o?.domMode),compression:cl(o?.compression)},xn=Math.max(Wa,Math.min(n??oi,Ua)),ai=Math.max(1,Math.min(r??ii,Be)),document.removeEventListener("visibilitychange",Cn),window.removeEventListener("pagehide",kn),document.addEventListener("visibilitychange",Cn),window.addEventListener("pagehide",kn)}function u(e){An||j.length>=Be||(za(e),$a(e),li&&(j.push(e),j.length>=ai?J():B||(B=setTimeout(J,xn))))}function J(){Za()}async function Za(){if(Tn||!j.length||!_)return;Tn=!0,B&&(clearTimeout(B),B=null);let e=j;j=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:At.domMode},n=[],r={source:[],events:[]};try{for(let o of e){let i=ol(o,_.page,At.domMode),s=[...r.events,i];JSON.stringify({...t,events:s}).length>We?r.events.length>0?(n.push(r),r={source:[o],events:[i]}):(JSON.stringify({...t,events:[i]}).length<=We?n.push({source:[o],events:[i]}):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r={source:[],events:[]}):(r.source.push(o),r.events=s)}r.events.length>0&&n.push(r);for(let o of n)Ja({...t,events:o.events}).then(i=>{i||ri(o.source)}).catch(()=>ri(o.source))}catch(o){console.error("[flusterduck] batch serialization failed, events dropped:",o instanceof Error?o.message:"unknown error")}finally{Tn=!1}}function ri(e){let t=e.filter(r=>{let o=ni.get(r)??0;return o>=Va?!1:(ni.set(r,o+1),!0)});if(!t.length)return;let n=[...t,...j];n.length>Be?(console.warn(`[flusterduck] event queue overflow, dropped ${n.length-Be} oldest events`),j=n.slice(-Be)):j=n,B||(B=setTimeout(J,xn))}function On(e){if(_)for(let t of Object.keys(e))Xa.has(t)&&(_[t]=e[t])}function ui(){J(),An=!1,document.removeEventListener("visibilitychange",Cn),window.removeEventListener("pagehide",kn),B&&(clearTimeout(B),B=null)}function Qa(){document.visibilityState==="hidden"&&J()}async function Ja(e){let t=JSON.stringify(e),n=await el(t,At.compression);return n?rl(n):!0}async function el(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>We)return null;if(t!=="off"){let o=await tl(e);if(o&&o.byteLength<=We)return{beaconBody:new Blob([o],{type:qa}),fetchBody:new Uint8Array(o),headers:{"Content-Type":xt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:xt}),fetchBody:e,headers:{"Content-Type":xt}}}async function tl(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=nl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>We)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function nl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:xt});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}async function rl(e,t=si){if(!t)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(t,e.beaconBody))return!0}catch{}try{return await fetch(t,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}),!0}catch{return!1}}function ol(e,t,n){let r=e.d??{},o=il(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=Mn(r.el,r.element,r.target);if(o==="signal"){i.signal_type=Mn(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?al(s,n):null;c&&(i.dom=c)}let a=sl(r);return Object.keys(a).length&&(i.metadata=a),i}function il(e){return e==="pv"?"pageview":e==="sig"?"signal":Ya.has(e)?e:"custom_signal"}function sl(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=Rt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=Rt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function Rt(e,t="",n=0){if(!(n>4)&&!Ka(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return Ga.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>Rt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=Rt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function al(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ti(n,t):null}catch{return null}}function Mn(...e){for(let t of e)if(typeof t=="string"&&t)return t}function ll(e){return e==="metadata"||e==="snapshot"?e:"off"}function cl(e){return e==="off"?"off":"auto"}function di(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function Nn(e,t){for(let n of t){let r=dl(n.pattern);if(r&&r.test(e))return n.label}return fl(e)}var ul=/^[a-zA-Z0-9/:._*\-]+$/;function dl(e){if(e.length>200||!ul.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function fl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id")}var pl=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],W=[],fi=3,pi=2e3,mi=24,It=mi,gi=[],pe=[],hi=0,Ot=new Map,Nt=new Map,ml=1e4,Pt=!1,vi=f(gl);function Pn(e,t){Pt||(Pt=!0,fi=e?.threshold??3,pi=e?.windowMs??2e3,It=e?.radius&&e.radius>0?e.radius:mi,gi=[...pl,...t??[]],hi=Date.now(),W=[],pe=[],Ot.clear(),Nt.clear(),document.addEventListener("click",vi,{capture:!0,passive:!0}))}function Hn(){Pt&&(Pt=!1,document.removeEventListener("click",vi,{capture:!0,passive:!0}),W=[],pe=[],Ot.clear(),Nt.clear())}function gl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,gi)||El(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;W.length&&n-W[0].t>pi;)W.shift();W.push({t:n,x:r,y:o});let i=hl();if(W.length<i)return;let s=W.slice(-i);for(let k=0;k<s.length-1;k++)for(let Pe=k+1;Pe<s.length;Pe++){let Ct=s[k],kt=s[Pe],Mt=kt.x-Ct.x,de=kt.y-Ct.y;if(Mt*Mt+de*de>It*It)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=wl(s,i,l),b=p(t),m=h(t);pe.push({selector:b,ts:n});let Y=pe.length,Lt=vl(n),jo=Ot.get(b)??0,bn=jo+1,Ko=Nt.get(b)??0,Ma=Ko>0&&n-Ko<ml;Ot.set(b,bn),Nt.set(b,n);let Go=jo>=1,xa=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Pe=s.reduce((de,yn)=>de+yn.x,0)/s.length,Ct=s.reduce((de,yn)=>de+yn.y,0)/s.length,kt=k.left+k.width/2,Mt=k.top+k.height/2;return{click_dx:Math.round(Pe-kt),click_dy:Math.round(Ct-Mt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:Y,burst_rate_per_min:Lt,repeated_target:Go,hot_repeat:Ma,...xa??{}}}),Go&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:bn,burst_count:bn,burst_seq:Y}}),W=W.slice(-(i-1))}function hl(){return pe.length>=3?2:fi}function vl(e){let t=(e-hi)/6e4;return t<=0?0:Math.round(pe.length/t*10)/10}function wl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],Y=m.x-b.x,Lt=m.y-b.y;d+=Math.sqrt(Y*Y+Lt*Lt),l++}let g=d/l;a=Math.max(0,2-g/It*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function El(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var bl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,yl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Sl=/^(A|BUTTON|LABEL)$/,_l=20,wi=[],me=null,Tl=5,Ht=new Map,Ei=f(Ll),bi=f(Ml);function Ll(e){me={x:e.clientX,y:e.clientY}}function Fn(e){wi=e??[],document.addEventListener("mousedown",Ei,{capture:!0,passive:!0}),document.addEventListener("click",bi,{capture:!0,passive:!0})}function Bn(){document.removeEventListener("mousedown",Ei,{capture:!0}),document.removeEventListener("click",bi,{capture:!0}),me=null,Ht.clear()}function Wn(){Ht.clear()}function Cl(e){try{return window.getComputedStyle(e).cursor.slice(0,_l)}catch{return""}}function kl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Ml(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,wi)||Rl())return;let n=Il(e);if(me=null,n||xl(t))return;let r=Al(t,e.clientX,e.clientY),o=r?yi(e.clientX,e.clientY,r):null,i=p(t),a=(Ht.get(i)??0)+1;Ht.set(i,a);let c=a>=2,d=Cl(t),l=kl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function xl(e){if(bl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&yl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Sl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Al(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Dl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function yi(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Dl(e,t,n){return yi(e,t,n).dist}function Rl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Il(e){if(!me)return!1;let t=e.clientX-me.x,n=e.clientY-me.y;return Math.sqrt(t*t+n*n)>Tl}var T=null,Un=3e3,Si=[],Ft="click",Bt=0,Ol=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Nl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,_i=f(Fl),Ti=f(Pl),Li=f(Hl);function Vn(e,t){Un=e?.delayMs??3e3,Si=t??[],document.addEventListener("click",_i,{capture:!0,passive:!0}),document.addEventListener("keydown",Ti,{capture:!0,passive:!0}),document.addEventListener("touchstart",Li,{capture:!0,passive:!0})}function qn(){document.removeEventListener("click",_i,{capture:!0}),document.removeEventListener("keydown",Ti,{capture:!0}),document.removeEventListener("touchstart",Li,{capture:!0}),ge()}function zn(){ge()}function Pl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Ft="keydown",Bt=Date.now()))}function Hl(){Ft="touch",Bt=Date.now()}function Fl(e){let t=e.target;if(!t||v(t,Si))return;let n=t.getAttribute("role");if(!Ol.test(t.tagName)&&!(n&&Nl.test(n)))return;let r=Date.now();if(r-Bt>50&&(Ft="click",Bt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=Un&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Ft,observed_delay_ms:d}}),ge();return}ge()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,ge();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,ge();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Un+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function ge(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Bl=100,Wl=5,Ci=800,ki=2e3,Ul=3,Xn=0,Vl=16,Wt=0,Ut=0,Ue=0,Ve=0,qe=0,Vt=0,$n=0,oe=[],Yn=0,he=null,Mi=f(ql);function jn(e){Ci=e?.velocityThreshold??800,ki=e?.windowMs??2e3,document.addEventListener("mousemove",Mi,{passive:!0})}function Kn(){document.removeEventListener("mousemove",Mi),he&&clearTimeout(he),Gn()}function ql(e){let t=Date.now();t-Xn<Vl||(Xn=t,he&&clearTimeout(he),he=setTimeout(()=>Gn(),150),zl(e.clientX,e.clientY,t))}function zl(e,t,n){if(Ue===0){Wt=e,Ut=t,Ue=n,$n=n;return}let r=(n-Ue)/1e3;if(r===0)return;let o=e-Wt,i=t-Ut;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;oe.length>=Bl&&(oe=oe.slice(-50)),oe.push(a),Yn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=Wl&&(Ve!==0&&c!==0&&c!==Ve||qe!==0&&d!==0&&d!==qe)&&Vt++,Ve=c||Ve,qe=d||qe,Wt=e,Ut=t,Ue=n,n-$n>ki){if(Vt>=Ul){let l=oe.reduce((g,w)=>g+w,0)/oe.length;l>=Ci&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Vt,distance_px:Math.round(Yn)}})}Gn(),$n=n}}function Gn(){Vt=0,oe=[],Yn=0,Ve=0,qe=0,Ue=0,Wt=0,Ut=0,Xn=0,he=null}var xi=100,Ai=5,$l=3,L=[],M=[],Zn=3e4;function Qn(e){Zn=e?.windowMs??3e4}function Jn(){L=[],M=[]}function er(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Zn;)L.shift();for(;M.length&&t-M[0].ts>Zn;)M.shift();if(L.length>=xi&&(L=L.slice(-50)),M.length>=xi&&(M=M.slice(-50)),L.push({path:e,ts:t}),o){M.push({path:e,ts:t});let a=M.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=$l&&a.length>c.size){let d=a.slice(-Ai).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),M=M.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ai).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],M=M.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var Xl=100,Di=1e4,nr=.5,C=[],qt=0,rr=0,ze=!1,tr=0,Ri=f(Yl);function or(e){Di=e?.windowMs??1e4,nr=e?.depthThreshold??.5,window.addEventListener("scroll",Ri,{passive:!0})}function ir(){window.removeEventListener("scroll",Ri),C=[],ze=!1}function sr(){C=[],qt=0,rr=0,ze=!1}function Yl(){ze||(ze=!0,requestAnimationFrame(()=>{ze=!1,jl()}))}function jl(){let e=Date.now(),t=window.scrollY;if(tr=document.documentElement.scrollHeight-window.innerHeight,tr<=0)return;let n=t/tr,r=t>qt?"down":"up";if(e-rr<100){qt=t;return}for(;C.length&&e-C[0].ts>Di;)C.shift();C.length>=Xl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),qt=t,rr=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=nr&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=nr){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var Kl=["textarea",'[role="textbox"]',"[contenteditable]"],Xe=new Map,Ye=new Map,K=new Set,ie=null,ar=0,Ii=5e3,Oi=[],Gl=50,Ni=f(Zl),Pi=f(Ql),Hi=f(Jl),Fi=y(dr),$e=null;function lr(e,t){Ii=e?.pauseMs??5e3,Oi=t??[],document.addEventListener("focusin",Ni,{capture:!0,passive:!0}),document.addEventListener("focusout",Pi,{capture:!0,passive:!0}),document.addEventListener("submit",Hi,{capture:!0,passive:!0}),window.addEventListener("pagehide",Fi),$e=y(()=>{document.visibilityState==="hidden"&&dr()}),document.addEventListener("visibilitychange",$e)}function cr(){document.removeEventListener("focusin",Ni,{capture:!0}),document.removeEventListener("focusout",Pi,{capture:!0}),document.removeEventListener("submit",Hi,{capture:!0}),window.removeEventListener("pagehide",Fi),$e&&(document.removeEventListener("visibilitychange",$e),$e=null),Xe.clear(),Ye.clear(),K.clear(),ie=null}function ur(){dr(),Xe.clear(),Ye.clear(),K.clear(),ie=null,ar=0}function Zl(e){let t=e.target;if(!t||!Bi(t)||v(t,Oi)||ec(t))return;let n=Date.now();Xe.set(t,n),Ye.set(t,n);let r=t.closest("form");r&&r!==ie&&(ie=r,ar=r.querySelectorAll("input, select, textarea").length)}function Ql(e){let t=e.target;if(!t||!Bi(t))return;let n=Xe.get(t),r=Ye.get(t);Xe.delete(t),Ye.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<Gl)&&n!==void 0){let a=o-n;if(a>=Ii){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);tc(t)&&K.add(s)}function Jl(){K.clear(),ie=null}function dr(){if(K.size>0&&ie){let e=ar||K.size,t=Math.round(K.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:K.size,total:e,field_count:e,completion_rate:t}}),K.clear(),ie=null}}function Bi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function ec(e){if(e.tagName==="TEXTAREA")return!0;for(let t of Kl)try{if(e.matches(t))return!0}catch{return!1}return!1}function tc(e){return"value"in e?e.value.length>0:!1}var ve=null,je=null,Wi=/flusterduck\.com|\/v1\/ingest/,Vi=f(oc),qi=f(ic);function pr(){window.addEventListener("error",Vi),window.addEventListener("unhandledrejection",qi),sc()}function mr(){window.removeEventListener("error",Vi),window.removeEventListener("unhandledrejection",qi),ac()}var fr=/fetch|network|cors|timeout/i;function nc(e){return fr.test(e)?"network":"script"}function rc(e){if(e instanceof TypeError&&fr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return fr.test(t)?"network":"unhandled_promise"}function oc(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:gr(t,200),ep:"",status:0,error_category:nc(t),url:location.pathname}})}function ic(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:gr(t,200),ep:"",status:0,error_category:rc(e.reason),url:location.pathname}})}function sc(){ve||(ve=window.fetch,je=function(t,n){let r;try{r=ve.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Wi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Ui(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Wi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:gr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Ui(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=je)}function ac(){ve&&je&&window.fetch===je&&(window.fetch=ve),ve=null,je=null}function Ui(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function gr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var zi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],lc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,hr=0,vr=null,$i=[],Xi=f(cc),Yi=f(uc),ji=f(pc),Ki=f(hc),Gi=f(mc);function wr(e){$i=e??[],document.addEventListener("touchstart",Xi,{passive:!0}),document.addEventListener("touchend",Yi,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",ji,{passive:!0}),window.addEventListener("orientationchange",Ki,{passive:!0})),window.visualViewport?.addEventListener("resize",Gi)}function Er(){document.removeEventListener("touchstart",Xi),document.removeEventListener("touchend",Yi),document.removeEventListener("gesturechange",ji),window.removeEventListener("orientationchange",Ki),window.visualViewport?.removeEventListener("resize",Gi),ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,hr=0,vr=null}function Zi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function cc(e){let t=e.touches[0];e.touches.length===1&&t?(ee={x:t.clientX,y:t.clientY,ts:Date.now()},Ee=0):e.touches.length===2&&(Ee=Zi(e.touches),ee=null)}function uc(e){if(Ee>0){let s=e.touches.length>=2?Zi(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&(Ke=Math.round(s/Ee*100)/100),Ee=0}if(!ee||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-ee.x,r=t.clientY-ee.y,o=Date.now()-ee.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&dc(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&fc(i,n,r),ee=null}function dc(e,t,n){if(v(e,$i))return;let r=vc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function fc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||zi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!zi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function pc(){let e=Date.now();if(e-Ge>3e4&&(I=0,Ge=e),I++,I>=2){let t=document.activeElement||document.body;!lc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-Ze>200&&(Ze=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:Ke}})),I=0,Ke=1}}function mc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ge>3e4&&(I=0,Ge=t),I++,I>=2&&t-Ze>200){let n=Math.round(e.scale*100)/100;Ze=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,Ke=1}}}function gc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function hc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-hr>3e4&&(we=0,hr=e),t!==vr&&(we++,vr=t),we>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:we,orientation:gc()}}),we=0)}function vc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],be=null,A=0,ye=0,V="",U=[],br=[],wc=10,Ec=5e3,Qi=5,Ji=3e3,bc=15,yc=5e3,es=f(Sc);function yr(e){br=e??[],document.addEventListener("keydown",es,{capture:!0,passive:!0})}function Sr(){document.removeEventListener("keydown",es,{capture:!0}),x=[],U=[],be=null,A=0,ye=0,V="",br=[]}function Sc(e){let t=Date.now(),n=e.target;n&&v(n,br)||(e.key==="Tab"?Tc(t,n,e.shiftKey):e.key==="Escape"?Lc(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Cc(t,e.target))}function _c(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Tc(e,t,n){for(;x.length&&e-x[0].ts>Ec;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=wc){let i=x.map(a=>a.el).filter(Boolean),s=_c(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===be?e-ye<=Ji?(A++,V=i,A>=Qi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",be=null)):(ye=e,A=1,V=i):(be=o,ye=e,A=1,V=i)}}function Lc(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===be){if(e-ye>Ji){ye=e,A=1,V=p(t);return}A++,V=p(t),A>=Qi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",be=null)}}function Cc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;U.length&&e-U[0].ts>yc;)U.shift();U.length>=50&&(U=U.slice(-25)),U.push({ts:e,container:n});let r=U.filter(o=>o.container===n);r.length>=bc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),U=[])}var Se=0,zt=0,$t=null,_r=0,Xt=!1,Yt=0,Tr=0,kc=1e4,Mc=2,xc=4,Ac=3e3,Qe=null,jt=0,Dc=2e3,ts=f(Oc),ns=f(Rc),rs=f(Ic);function Lr(){window.addEventListener("wheel",ns,{passive:!0}),window.addEventListener("touchmove",rs,{passive:!0}),window.addEventListener("scroll",ts,{passive:!0})}function Cr(){window.removeEventListener("wheel",ns),window.removeEventListener("touchmove",rs),window.removeEventListener("scroll",ts),Kt()}function Kt(){Se=0,zt=0,$t=null,_r=0,Xt=!1,Yt=0,Tr=0,Qe=null,jt=0}function Rc(){Qe="wheel",jt=Date.now()}function Ic(){Qe="touch",jt=Date.now()}function Oc(){Xt||(Xt=!0,requestAnimationFrame(()=>{Xt=!1,Nc()}))}function Nc(){let e=Date.now(),t=window.scrollY,n=t-zt;if(Math.abs(n)<2){zt=t;return}let r=n>0?"down":"up";if($t&&r!==$t&&(e-_r>Ac&&(Se=0,_r=e),Se++,Se>=xc&&Math.abs(n)>100)){let i=e-jt,s=Qe!==null&&i<=Dc?Qe:"wheel";e-Tr>kc&&(Yt=0,Tr=e),Yt++;let a=Yt>=Mc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:Se,source:s,repeated:a}}),Se=0}$t=r,zt=t}var se=0,_e=0,Je=!1,is=f(Pc),et=null,tt=null;function kr(){window.addEventListener("scroll",is,{passive:!0}),tt=y(os),window.addEventListener("pagehide",tt),et=y(()=>{document.visibilityState==="hidden"&&os()}),document.addEventListener("visibilitychange",et)}function Mr(){window.removeEventListener("scroll",is),tt&&(window.removeEventListener("pagehide",tt),tt=null),et&&(document.removeEventListener("visibilitychange",et),et=null),se=0,_e=0,Je=!1}function xr(){se=0,_e=0,Je=!1}function Pc(){Je||(Je=!0,requestAnimationFrame(()=>{Je=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>se&&(se=t,_e===0&&(_e=Date.now()))}}))}function os(){if(se>.05){let e=Date.now(),t=_e>0?Math.max(0,e-_e):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(se*100)/100,max_depth:Math.round(se*100),dwell_ms:t}})}}var ss=1500,as=15e3,Hc=5e3,Fc=.15,Ar="",Te=0,Gt=0,nt=0,Le=0,Dr=0,Zt=null,Qt=0,Jt=!1,en=f(Wc),ls=f(Uc),Ce=f(Bc);function Rr(){Jt||(Jt=!0,Dr=cs(),rt(),document.addEventListener("mouseenter",en,!0),document.addEventListener("mouseleave",en,!0),document.addEventListener("click",Ce,{capture:!0,passive:!0}),document.addEventListener("keydown",Ce,{capture:!0,passive:!0}),document.addEventListener("scroll",Ce,{passive:!0}),window.addEventListener("resize",ls,{passive:!0}))}function Ir(){Jt&&(Jt=!1,document.removeEventListener("mouseenter",en,!0),document.removeEventListener("mouseleave",en,!0),document.removeEventListener("click",Ce,{capture:!0}),document.removeEventListener("keydown",Ce,{capture:!0}),document.removeEventListener("scroll",Ce),window.removeEventListener("resize",ls),us(),Ar="",Te=0,Gt=0,Le=0,nt=0,Qt=0)}function rt(){us(),Qt+=1;let e=Qt;Zt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:as,cycle:e}})},as)}function Or(){Qt=0}function Bc(){rt()}function Wc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Ar||r-Gt>ss)&&(Ar=n,Gt=r,Te=0),Te+=1,!(Te<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:Te,window_ms:ss}}),Te=0,Gt=r)}function Uc(){let e=Date.now(),t=cs(),n=Dr||t,r=Math.abs(t-n)/Math.max(n,1);Dr=t,!(r<Fc)&&((!nt||e-nt>Hc)&&(nt=e,Le=0),Le+=1,!(Le<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(r*1e3)/1e3}}),Le=0,nt=e))}function cs(){return Math.max(1,window.innerWidth*window.innerHeight)}function us(){Zt&&(clearTimeout(Zt),Zt=null)}var ds=6e4,Vc=3,qc=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],zc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,q=[],fs=[],ps=f($c);function Nr(e){fs=e??[],document.addEventListener("click",ps,{capture:!0,passive:!0})}function Pr(){document.removeEventListener("click",ps,{capture:!0}),q=[]}function Hr(){q=[]}function $c(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,fs)||!Xc(t))return;let n=Date.now();for(;q.length&&n-q[0].t>ds;)q.shift();let r=p(t);if(q.push({t:n,el:r}),q.length<Vc)return;let o=new Set(q.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:q.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ds}}),q=[]}function Xc(e){let t=e;for(let n=0;n<3&&t;n++){if(Yc(t)||jc(t))return!0;t=t.parentElement}return!1}function Yc(e){for(let t of qc)try{if(e.matches(t))return!0}catch{}return!1}function jc(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return zc.test(r)}var ms=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,gs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,tn=[],nn=new Map,hs=[],vs=f(Kc);function Fr(e){hs=e??[],document.addEventListener("click",vs,{capture:!0,passive:!0})}function Br(){document.removeEventListener("click",vs,{capture:!0}),tn=[],nn.clear()}function Wr(){tn=[],nn.clear()}function Kc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,hs)||!Gc(t))return;let n=Date.now(),r=p(t),o=h(t);tn.push({t:n,el:r});let s=(nn.get(r)??0)+1;nn.set(r,s);let a=tn.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:Qc(t),...c??{}}})}function Gc(e){let t=e;for(let n=0;n<4&&t;n++){if(Zc(t))return!0;t=t.parentElement}return!1}function Zc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&gs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ms.test(o)||ms.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&gs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function Qc(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var Jc=1500,O=null,ws=[],Es=f(eu),bs=f(tu),ys=f(nu);function Ur(e){ws=e??[],document.addEventListener("click",Es,{capture:!0,passive:!0}),document.addEventListener("keydown",bs,{capture:!0,passive:!0}),window.addEventListener("popstate",ys)}function Vr(){document.removeEventListener("click",Es,{capture:!0}),document.removeEventListener("keydown",bs,{capture:!0}),window.removeEventListener("popstate",ys),O=null}function qr(){O=null}function eu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,ws)){if(ru(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function tu(e){e.key==="Escape"&&Ss("escape")}function nu(){Ss("back_nav")}function Ss(e){if(!O)return;let t=Date.now()-O.t;if(t>Jc){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function ru(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var _s=1e4,ou=3,iu=/^(checkbox|radio)$/,Ts=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,ot=new Map,zr=[],Ls=f(su),Cs=f(au);function $r(e){zr=e??[],document.addEventListener("change",Ls,{capture:!0,passive:!0}),document.addEventListener("click",Cs,{capture:!0,passive:!0})}function Xr(){document.removeEventListener("change",Ls,{capture:!0}),document.removeEventListener("click",Cs,{capture:!0}),ot.clear()}function Yr(){ot.clear()}function su(e){let t=e.target;t&&(v(t,zr)||lu(t)&&ks(t))}function au(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,zr))return;let n=t.getAttribute("role")??"";Ts.test(n)&&t.tagName!=="INPUT"&&ks(t)}function ks(e){let t=p(e),n=Date.now(),r=ot.get(t);for(r||(r=[],ot.set(t,r));r.length&&n-r[0].t>_s;)r.shift();if(r.push({t:n}),r.length<ou)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:_s}}),ot.delete(t)}function lu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?iu.test(e.type??""):Ts.test(e.getAttribute("role")??"")}var Ms=15e3,cu=3,G=[],xs=f(uu);function jr(){document.addEventListener("copy",xs,{capture:!0,passive:!0})}function Kr(){document.removeEventListener("copy",xs,{capture:!0}),G=[]}function Gr(){G=[]}function uu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;G.length&&r-G[0].t>Ms;)G.shift();G.push({t:r}),!(G.length<cu)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:G.length,window_ms:Ms}}),G=[])}var As=15e3,du=4,fu=5,pu=500,mu=2e3,D=[],rn=0,it=null,ae=null;function Zr(){it=y(hu),ae=y(gu),document.addEventListener("selectionchange",it),document.addEventListener("copy",ae,{capture:!0,passive:!0}),document.addEventListener("cut",ae,{capture:!0,passive:!0})}function Qr(){it&&(document.removeEventListener("selectionchange",it),it=null),ae&&(document.removeEventListener("copy",ae,{capture:!0}),document.removeEventListener("cut",ae,{capture:!0}),ae=null),D=[],rn=0}function Jr(){D=[],rn=0}function gu(){rn=Date.now(),D=[]}function hu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<fu)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-rn<mu)return;for(;D.length&&r-D[0].t>As;)D.shift();let o=D[D.length-1];o&&r-o.t<pu||(D.push({t:r}),!(D.length<du)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:As}}),D=[]))}var eo=6e4,vu=20,Rs="_fd_sess",wu={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},Eu=10,Ds={low:1,medium:2,high:3,critical:4},z=[],ke=null,sn=!1,xe=new Map,Me={totalSignals:0,pagesWithFrustration:0},to="",st=null,at=null,lt=null,ct=null;function on(e){sn&&Is(e,Date.now())}function bu(){try{let e=sessionStorage.getItem(Rs);if(e){let t=JSON.parse(e);Me={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function yu(){try{sessionStorage.setItem(Rs,JSON.stringify(Me))}catch{}}function Su(){let e=[],n=Date.now()-eo,r=[];for(let[o,i]of xe.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Is(e,t){xe.has(e)||xe.set(e,[]);let n=xe.get(e);n.push(t),n.length>vu&&n.shift()}function _u(e){let t=e-eo,n=0;for(;n<z.length&&z[n].ts<t;)n++;n>0&&(z=z.slice(n))}function Tu(){let e=new Map,t=0;for(let n of z)e.set(n.type,(e.get(n.type)??0)+1),t+=wu[n.type]??Eu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Os(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Lu(e,t,n){return Os(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Cu(e,t,n,r){let o=Os(r),i=Su();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:to||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:eo,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Me.totalSignals,session_pages_with_frustration:Me.pagesWithFrustration}}),Me.totalSignals+=z.length,Me.pagesWithFrustration+=1,yu()}function ku(e,t){if(!sn||e==="frustration_burst")return;let n=t??Date.now();_u(n),z.length===0&&(ke=null),z.push({type:e,ts:n}),Is(e,n);let{distinctTypes:r,totalWeight:o,typeCounts:i}=Tu(),s=Lu(r.size,o,i);s&&(ke!==null&&Ds[s]<=Ds[ke]||(ke=s,Cu(s,r,o,i)))}function no(e){to=e}function ro(e){z=[],ke=null,sn=!0,xe=new Map,to=e??"",bu(),Rn(ku),st=()=>on("popstate"),at=()=>on("hashchange"),lt=()=>{document.visibilityState==="hidden"&&on("visibilitychange")},ct=()=>on("pagehide"),window.addEventListener("popstate",st),window.addEventListener("hashchange",at),document.addEventListener("visibilitychange",lt),window.addEventListener("pagehide",ct)}function oo(){sn=!1,z=[],ke=null,xe=new Map,Rn(null),st&&(window.removeEventListener("popstate",st),st=null),at&&(window.removeEventListener("hashchange",at),at=null),lt&&(document.removeEventListener("visibilitychange",lt),lt=null),ct&&(window.removeEventListener("pagehide",ct),ct=null)}var Mu=8,io=3e4,so=5,xu=5e3,N=[],te="",ut=!1,Ns=f(Du),Ps=f(Ru);function ao(){N=[],ut=!1,te=location.pathname+location.search+location.hash,window.addEventListener("popstate",Ns),window.addEventListener("hashchange",Ps)}function lo(){window.removeEventListener("popstate",Ns),window.removeEventListener("hashchange",Ps),N=[],ut=!1,te=""}function co(){N=[],ut=!1,te=location.pathname+location.search+location.hash}function dt(e){let t=Date.now();if(te&&te!==e){let n=N[N.length-1];n&&n.path===te&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>io;)N.shift();e!==te&&(N.push({path:e,ts:t,leftAt:null}),te=e),!(N.length<so)&&(ut||Au(t))}function Au(e){let t=N.filter(l=>e-l.ts<=io),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<so||n.length===0||n.some(l=>l.leftAt-l.ts>=xu)||new Set(n.map(l=>l.path)).size<so)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-Mu);ut=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:io,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Du(){let e=location.pathname+location.search+location.hash;dt(e)}function Ru(){let e=location.pathname+location.search+location.hash;dt(e)}var Iu=.3,Hs=3e3,Z=[],ft=!1,le="none",ce=0,pt=0,mt=0,P=!1,Fs=f(Ou),Bs=f(Pu);function uo(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1,window.addEventListener("scroll",Fs,{passive:!0}),window.addEventListener("click",Bs,{capture:!0})}function fo(){window.removeEventListener("scroll",Fs),window.removeEventListener("click",Bs,{capture:!0}),an()}function an(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1}function Ou(){ft||(ft=!0,requestAnimationFrame(Nu))}function Nu(){ft=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=Z[Z.length-1];if(r&&e-r.ts<50||(Z.push({y:t,ts:e}),Z.length>60&&(Z=Z.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){le!=="down"&&P&&(P=!1),t>ce&&(ce=t),le="down";return}if(P&&e-mt>Hs&&(P=!1),le==="down"){let s=ce-t,a=n*Iu;s>=a&&!P&&(pt=t,mt=e,P=!0)}le="up"}function Pu(e){if(!P)return;let t=Date.now();if(t-mt>Hs){P=!1;return}if(window.scrollY+e.clientY>pt+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(ce-pt),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,ce=window.scrollY,le="none",Z=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Hu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Fu=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Bu=/^(A|BUTTON|LABEL)$/,Wu=3,Ws=9e4,Uu=5,gt=new Map,Us=[],ht=null,Vu=5,Vs=f(qu),qs=f(Ku);function qu(e){ht={x:e.clientX,y:e.clientY}}function po(e){Us=e??[],document.addEventListener("mousedown",Vs,{capture:!0,passive:!0}),document.addEventListener("click",qs,{capture:!0,passive:!0})}function mo(){document.removeEventListener("mousedown",Vs,{capture:!0}),document.removeEventListener("click",qs,{capture:!0}),ht=null,gt.clear()}function go(){gt.clear()}function zu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function $u(e,t){return e*4+t}function Xu(e){if(Hu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Fu.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Bu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Yu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function ju(e){if(!ht)return!1;let t=e.clientX-ht.x,n=e.clientY-ht.y;return Math.sqrt(t*t+n*n)>Vu}function Ku(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Us)||Yu()||ju(e)||Xu(t))return;let{row:n,col:r}=zu(e.clientX,e.clientY),o=$u(n,r),i=Date.now(),s=p(t),c=(gt.get(o)??[]).filter(d=>i-d.ts<Ws);if(c.push({ts:i,selector:s}),gt.set(o,c),c.length>=Wu){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,Y]of d)Y>g&&(g=Y,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Uu))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Ws}}),gt.set(o,[])}}var ho=3,Ae=12e4,S=new Map,cn=[],vt=null,zs=f(ed),ln=f(td);function wo(e){cn=e??[],document.addEventListener("invalid",zs,{capture:!0,passive:!0}),document.addEventListener("input",ln,{capture:!0,passive:!0}),document.addEventListener("change",ln,{capture:!0,passive:!0}),vt=new MutationObserver(nd),vt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function Eo(){document.removeEventListener("invalid",zs,{capture:!0}),document.removeEventListener("input",ln,{capture:!0}),document.removeEventListener("change",ln,{capture:!0}),vt&&(vt.disconnect(),vt=null);for(let e of S.values())ne(e);S.clear()}function bo(){for(let e of S.values())ne(e);S.clear()}function vo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function yo(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function un(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function Gu(e){for(let[t,n]of S)e-n.lastTs>Ae&&(ne(n),S.delete(t))}function ne(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function Zu(e){return f(t=>{Ys(e)})}function Qu(e){return f(t=>{Ys(e)})}function $s(e,t){let n=Zu(t),r=Qu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return S.set(t,o),o}function Xs(e){if(!un(e)||v(e,cn))return;let t=Date.now();Gu(t);let n=p(e),r=S.get(n);if(!r){$s(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=ho&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:vo(e)}}),ne(r),S.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=ho&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:vo(e)}}),ne(r),S.delete(n)))}function Ju(e){if(!un(e))return;let t=Date.now(),n=p(e),r=S.get(n);if(r){if(t-r.lastTs>Ae){ne(r),S.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function Ys(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Ae){ne(n),S.delete(e);return}if(n.lastTs=t,yo(n.el)){n.cycles+=1,n.cycles>=ho&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Ae,field_type:vo(n.el)}}),ne(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function ed(e){let t=e.target;t&&Xs(t)}function td(e){let t=e.target;if(!t||!un(t)||v(t,cn))return;let n=p(t);S.has(n)||yo(t)&&$s(t,n)}function nd(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!un(n)||v(n,cn))continue;let r=t.oldValue,o=r==="true"||r==="",i=yo(n);i&&!o?Xs(n):!i&&o&&Ju(n)}}var De=null,wt=null,_o=[],js=0,Et=new Map;function To(e){_o=e?.length?e:["[data-fd-impression]"],js=Date.now(),!(typeof IntersectionObserver>"u")&&(De=new IntersectionObserver(y(od),{threshold:[0,.5,1]}),Ks(),wt=new MutationObserver(y(rd)),wt.observe(document.body,{childList:!0,subtree:!0}))}function Lo(){De&&(De.disconnect(),De=null),wt&&(wt.disconnect(),wt=null),Et.clear()}function Co(){Et.clear(),De&&Ks()}function Ks(){for(let e of _o)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)So(t[n])}catch{}}function So(e){Et.has(e)||(Et.set(e,{firstSeenTs:0,emitted:!1}),De.observe(e))}function rd(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of _o)try{r.matches(o)&&So(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)So(i[s])}catch{}}}function od(e){let t=Date.now();for(let n of e){let r=Et.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-js),viewport_position:s}})}}}var id=2,sd=3,ad=6e4,bt=new Map,Gs=[],Zs=f(ld);function ko(e){Gs=e??[],document.addEventListener("input",Zs,{capture:!0,passive:!0})}function Mo(){document.removeEventListener("input",Zs,{capture:!0}),bt.clear()}function xo(){bt.clear()}function ld(e){let t=e.target;if(!t||!cd(t)||v(t,Gs))return;let n=Date.now(),r=t.value??"",o=p(t),i=bt.get(o);if(!i){bt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>ad){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=sd)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=id)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:ud(t)}}),bt.delete(o);return}i.lastValue=r}function cd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function ud(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Qs=2e3,dd=3e4,$=null,Js=Qs,ea=[],dn=new Map,ta=f(fd),na=f(pd),ra=f(yt);function Ao(e,t){Js=e?.dwellMs??Qs,ea=t??[],document.addEventListener("mouseover",ta,{passive:!0}),document.addEventListener("mouseout",na,{passive:!0}),document.addEventListener("click",ra,{capture:!0,passive:!0})}function Do(){document.removeEventListener("mouseover",ta),document.removeEventListener("mouseout",na),document.removeEventListener("click",ra,{capture:!0}),yt(),dn.clear()}function Ro(){yt(),dn.clear()}function fd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ea)||!md(t))return;let n=p(t);if($?.selector===n)return;yt();let r=Date.now();if(r-(dn.get(n)??0)<dd)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);dn.set(n,s),$=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Js);$={el:t,selector:n,startTs:o,timer:i}}function pd(e){if(!$)return;let t=e.target;if(t!==$.el&&!$.el.contains(t))return;let n=e.relatedTarget;n&&$.el.contains(n)||yt()}function yt(){$&&(clearTimeout($.timer),$=null)}function md(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var gd=20,hd=500,vd=3e3,wd=6e4,fn=0,pn=0,X=null,oa=y(Ed);function Io(){fn=Date.now(),pn=0,document.addEventListener("mouseleave",oa)}function Oo(){document.removeEventListener("mouseleave",oa),X&&(clearTimeout(X),X=null)}function No(){fn=Date.now(),pn=0,X&&(clearTimeout(X),X=null)}function Ed(e){if(e.clientY>gd)return;let t=Date.now();t-fn<vd||t-pn<wd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();pn=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-fn)}})}),hd))}var bd=2500,yd=4e3,ia=200,Sd=500,_d=.1,Td=.25,Ie=null,Oe=null,Q=null,Re=0;function Po(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Ho(){if(!(typeof PerformanceObserver>"u")){try{Ie=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Po(r,bd,yd)}})})),Ie.observe({type:"largest-contentful-paint",buffered:!0})}catch{Ie=null}try{Oe=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<ia||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Po(r,ia,Sd)}})}})),Oe.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Oe=null}try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!0})}catch{Q=null}}}function sa(){if(Q){if(Q.disconnect(),Q=null,Re>0){let e=Math.round(Re*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Po(Re,_d,Td)}})}Re=0}}function Fo(){Ie&&(Ie.disconnect(),Ie=null),Oe&&(Oe.disconnect(),Oe=null),sa()}function Bo(){if(sa(),!(typeof PerformanceObserver>"u"))try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!1})}catch{Q=null}}var aa=[],la=f(Ld);function Wo(e){aa=e??[],document.addEventListener("paste",la,{capture:!0,passive:!0})}function Uo(){document.removeEventListener("paste",la,{capture:!0})}function Ld(e){let t=e.target;if(!t||!Cd(t)||v(t,aa))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:kd(t)}})},100)}function Cd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function kd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Md="https://api.flusterduck.com/v1/ingest",re=!1,mn=null,Ne=null,ue=[],St="__flusterduck_instance__",Vo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function xd(){let e=window;return e[St]&&e[St]!==Vo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[St]=Vo,!0)}function Ad(){let e=window;e[St]===Vo&&delete e[St]}var _t=[];function Dd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Pn(e.signals?.rageClick,t),stop:Hn},{when:()=>r("deadClick"),start:()=>Fn(t),stop:Bn,reset:Wn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Vn(i?{delayMs:i.windowMs}:void 0,t)},stop:qn,reset:zn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;jn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Kn},{when:()=>r("loopNav"),start:()=>Qn(e.signals?.loopNav),stop:Jn},{when:()=>r("scrollBounce"),start:or,stop:ir,reset:sr},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;lr(i?{pauseMs:i.threshold}:void 0,t)},stop:cr,reset:ur},{when:()=>o&&r("formValidationLoop"),start:()=>wo(t),stop:Eo,reset:bo},{when:()=>r("errorEncounter"),start:pr,stop:mr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>wr(t),stop:Er},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>yr(t),stop:Sr},{when:()=>r("scrollHijack"),start:Lr,stop:Cr,reset:Kt},{when:()=>r("scrollDepthAbandon"),start:kr,stop:Mr,reset:xr},{when:()=>r("advancedHeuristics"),start:Rr,stop:Ir,reset:()=>{rt(),Or()}},{when:()=>r("helpHunt"),start:()=>Nr(t),stop:Pr,reset:Hr},{when:()=>r("closeClick"),start:()=>Fr(t),stop:Br,reset:Wr},{when:()=>r("closeClickReversal"),start:()=>Ur(t),stop:Vr,reset:qr},{when:()=>r("filterSpiral"),start:()=>$r(t),stop:Xr,reset:Yr},{when:()=>r("copyFrustration"),start:jr,stop:Kr,reset:Gr},{when:()=>r("textSelectFrustration"),start:Zr,stop:Qr,reset:Jr},{when:()=>r("deadClickTrapZone"),start:()=>po(t),stop:mo,reset:go},{when:()=>!0,start:()=>ro(n),stop:oo},{when:()=>r("navigationConfusion"),start:ao,stop:lo,reset:co},{when:()=>r("scrollToClickConfusion"),start:uo,stop:fo,reset:an},{when:()=>r("elementImpression"),start:()=>To(e.elementImpressionSelectors),stop:Lo,reset:Co},{when:()=>o&&r("inputCorrection"),start:()=>ko(t),stop:Mo,reset:xo},{when:()=>o&&r("pasteBlocked"),start:()=>Wo(t),stop:Uo},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;Ao(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Do,reset:Ro},{when:()=>r("exitIntent"),start:Io,stop:Oo,reset:No},{when:()=>r("performanceVitals"),start:Ho,stop:Fo,reset:Bo}]}function Rd(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function ua(e){if(re||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Wd()){Ne=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ne=e;return}if(!xd()){Ne=e;return}Ne=e,re=!0,Dn(e.transport!=="none"),typeof e.onSignal=="function"&&ue.push(fe(e.onSignal)),e.emitSignalEvents&&ue.push(fe(Bd));let t=Qo(e.cookieless??!1),n=Rd(e.endpoint)??Md,r=Nn(location.pathname,e.pageRules??[]),o=Ud(e.domMode);ci(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=ca(location.pathname,e.ignorePages??[]);i&&In(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];_t=[];for(let d of Dd(e,c,r))d.when()&&(d.start(),_t.push({stop:d.stop,reset:d.reset}));mn=di(y((d,l)=>{for(let E of _t)E.reset?.();J(),dt(l),no(l);let g=Nn(l,e.pageRules??[]),w=ca(l,e.ignorePages??[]);In(w),On({page:g,url:d}),er(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function Id(e,t){if(!re||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Od(e,t={}){if(!re||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Nd(e){if(!re||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let o=e[r];typeof o!="string"&&typeof o!="number"&&typeof o!="boolean"||(t[r.slice(0,64)]=String(o).slice(0,256),n++)}On({segment:t})}function Pd(e){e&&Ne&&!re?ua(Ne):e||(qo(),_n())}function Hd(){qo(),_n()}function Fd(e){let t=fe(e);return ue.push(t),()=>{t(),ue=ue.filter(n=>n!==t)}}function Bd(e){if(!(typeof window>"u"||typeof CustomEvent>"u"))try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:e}))}catch{}}function qo(){if(re){for(let e of ue)e();ue=[],Dn(!0);for(let e of _t)e.stop();_t=[],ui(),mn&&(mn(),mn=null),Ad(),re=!1}}function Wd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Ud(e){return e==="metadata"||e==="snapshot"?e:"off"}function ca(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var ma=.1,ga=.01,ha=3e4,va=50,wa=1e4,Vd=500,qd=3e4,zd=6e4,da=10,$d=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Xd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,Yd=/^\$\$?(heatmap|scroll)/,Ea=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],wn=!1,gn=null,hn=null,Tt=null,H=null,vn=null,ba=ma,ya=ga,Sa=new Set,_a=new Set(Ea),Ta=ha,Xo=va,La=wa,R=[],En=0,F=[];function fa(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function jd(e){wn||(wn=!0,ba=fa(e?.baselineSampleRate,ma),ya=fa(e?.scrollSampleRate,ga),Sa=new Set(e?.conversionEvents??[]),_a=new Set(e?.criticalSignals?.length?e.criticalSignals:Ea),Ta=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:ha,Xo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:va,La=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:wa,R=[],En=0,F=[],hn=fe(nf),pa()||(gn=setInterval(()=>{pa()&&Yo()},Vd),setTimeout(()=>Yo(),qd)))}function Kd(){wn&&(wn=!1,Yo(),hn&&(hn(),hn=null),Tt&&vn&&Tt.capture.__fd_wrapped&&(Tt.capture=vn),Tt=null,H=null,vn=null,R=[],F=[],En=0)}function Yo(){gn&&(clearInterval(gn),gn=null)}function pa(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;vn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return Zd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,Tt=e,!0}catch{return!1}}function Gd(e){return $d.has(e)?"critical":Sa.has(e)||Xd.test(e)?"conversion":Yd.test(e)?"scroll":"baseline"}function Zd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=Gd(e);if(o==="critical"||o==="conversion")return H(e,$o(t,r),n);if(r<En)return H(e,{...$o(t,r),fd_boosted:!0},n);if(Qd(o==="scroll"?ya:ba))return H(e,$o(t,r),n);tf({name:e,properties:t,ts:r})}function Qd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Jd();return t?ef(t)%1e4/1e4<e:Math.random()<e}var zo="";function Jd(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return zo||(zo=Math.random().toString(36).slice(2)),zo}function ef(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function $o(e,t){return ka(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function tf(e){R.push(e),Ca(e.ts)}function Ca(e){let t=e-Ta;for(;R.length&&R[0].ts<t;)R.shift();R.length>Xo&&(R=R.slice(-Xo))}function ka(e){let t=e-zd;F=F.filter(n=>n.ts>=t),F.length>da&&(F=F.slice(-da))}function nf({name:e,ts:t}){if(F.push({name:e,ts:t}),ka(t),!_a.has(e)||(En=t+La,!H||!R.length))return;Ca(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}export{qo as destroy,Kd as destroyPostHogTrigger,Nd as identify,ua as init,jd as initPostHogTrigger,Fd as onSignal,Hd as optOut,Pd as setConsent,Id as signal,Od as track};
|
package/dist/queue.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { SDKEvent, QueueMeta, QueueOptions } from './types';
|
|
2
|
-
export declare function
|
|
3
|
-
|
|
1
|
+
import type { SDKEvent, EmittedSignal, QueueMeta, QueueOptions } from './types';
|
|
2
|
+
export declare function setQueueSend(enabled: boolean): void;
|
|
3
|
+
export declare function setCorrelatorHook(fn: ((signalType: string, ts?: number) => void) | null): void;
|
|
4
|
+
type SignalListener = (signal: EmittedSignal) => void;
|
|
4
5
|
export declare function subscribeSignals(fn: SignalListener): () => void;
|
|
5
6
|
export declare function setQueuePaused(val: boolean): void;
|
|
6
7
|
export declare function initQueue(ep: string, meta: QueueMeta, interval?: number, maxSize?: number, options?: QueueOptions): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function onSignal(type: string): void;
|
|
1
|
+
export declare function onSignal(type: string, ts?: number): void;
|
|
2
2
|
export declare function setFrustrationCorrelatorPage(page: string): void;
|
|
3
3
|
export declare function initFrustrationCorrelator(page?: string): void;
|
|
4
4
|
export declare function destroyFrustrationCorrelator(): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -21,6 +21,31 @@ export interface Config {
|
|
|
21
21
|
ignoreElements?: string[];
|
|
22
22
|
ignorePages?: string[];
|
|
23
23
|
elementImpressionSelectors?: string[];
|
|
24
|
+
/** Called synchronously the moment a friction signal is detected, before it is batched/sent. */
|
|
25
|
+
onSignal?: (signal: EmittedSignal) => void;
|
|
26
|
+
/** Also dispatch a `flusterduck:signal` CustomEvent on window for each detected signal. Off by default. */
|
|
27
|
+
emitSignalEvents?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Where detected events go. `'auto'` (default) sends to the ingest endpoint.
|
|
30
|
+
* `'none'` runs detectors and fires onSignal but never queues or transmits
|
|
31
|
+
* anything, for local demos, tests, and dev. Pair with `onSignal`.
|
|
32
|
+
*/
|
|
33
|
+
transport?: 'auto' | 'none';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A friction signal at the moment it fires, surfaced to `onSignal` and the
|
|
37
|
+
* `flusterduck:signal` window event. The payload is a signal name, the CSS
|
|
38
|
+
* selector of the element involved, a 0-100 weight, detector `meta`, and a
|
|
39
|
+
* timestamp. Flusterduck's own detectors never put PII, form values, or page
|
|
40
|
+
* text in here (built-in signals carry an empty `meta`); a host-emitted
|
|
41
|
+
* `signal(name, { metadata })` relays whatever the host itself supplied.
|
|
42
|
+
*/
|
|
43
|
+
export interface EmittedSignal {
|
|
44
|
+
name: string;
|
|
45
|
+
element: string;
|
|
46
|
+
weight: number;
|
|
47
|
+
meta: Record<string, unknown>;
|
|
48
|
+
ts: number;
|
|
24
49
|
}
|
|
25
50
|
export interface SignalOpts {
|
|
26
51
|
enabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flusterduck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Lightweight UX confusion monitoring SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"module": "./dist/index.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"flusterduck": "./bin/flusterduck.mjs"
|
|
12
|
+
},
|
|
10
13
|
"exports": {
|
|
11
14
|
".": {
|
|
12
15
|
"types": "./dist/index.d.ts",
|
|
@@ -20,6 +23,7 @@
|
|
|
20
23
|
"sideEffects": false,
|
|
21
24
|
"files": [
|
|
22
25
|
"dist",
|
|
26
|
+
"bin",
|
|
23
27
|
"LICENSE.md"
|
|
24
28
|
],
|
|
25
29
|
"publishConfig": {
|